mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 08:45:11 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,54 @@
|
||||
package noppes.npcs.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class AnalyticsTracking{
|
||||
|
||||
public static void sendData(final EntityPlayer player, final String event, final String data){
|
||||
Runnable r = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
UUID uuid = player.getUniqueID();
|
||||
|
||||
String analyticsPostData = "v=1" +
|
||||
"&tid=UA-29079943-5" +
|
||||
"&cid=" + uuid.toString() +
|
||||
"&t=event" +
|
||||
"&ec=customnpcs_1.7d" +
|
||||
"&ea=" + event +
|
||||
"&el=" + data +
|
||||
"&ev=300";
|
||||
|
||||
URL url = new URL("http://www.google-analytics.com/collect");
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setConnectTimeout(10000);
|
||||
connection.setReadTimeout(10000);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
connection.setRequestProperty("Content-Length", Integer.toString(analyticsPostData.getBytes().length));
|
||||
OutputStream dataOutput = connection.getOutputStream();
|
||||
dataOutput.write(analyticsPostData.getBytes());
|
||||
dataOutput.close();
|
||||
connection.getInputStream().close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Thread t = new Thread(r);
|
||||
t.start();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user