· 8 years ago · Dec 19, 2017, 12:08 PM
1/**
2 * (C) 2015 NPException
3 */
4package in.firstseed.grandson.gameanalytics;
5
6
7/**
8 * @author NPException
9 *
10 */
11public class MCSimpleAnalytics extends SimpleAnalytics {
12
13 public final boolean isClient;
14
15 /**
16 * Creates a new MCSimpleAnalytics instance which automatically transmits a
17 * session keep-alive event to GA every 10 seconds.
18 *
19 * @param build The build version of your minecraft mod
20 * @param gameKey The game key for your GA project
21 * @param secretKey The secret key for your GA project
22 */
23 public MCSimpleAnalytics(String build, String gameKey, String secretKey) {
24 super(build, gameKey, secretKey);
25 isClient = true;//FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT;
26 ActivityReportTickEventHandler.addToReportList(this);
27 }
28
29 @Override
30 public boolean isActive() {
31 return true;
32 //return (isClient ? Minecraft.getMinecraft().isSnooperEnabled() : isServerSnooper());
33 }
34
35 /**
36 * We try to grab the snooper settings from the server. If they are not yet
37 * initialized, we assume true.
38 *
39 * @return
40 */
41// private static boolean isServerSnooper() {
42// try {
43// return MinecraftServer.getServer().isSnooperEnabled();
44// } catch (NullPointerException npe) {
45// return true;
46// }
47// }
48
49 @Override
50 public String userPrefix() {
51 return isClient ? "client" : "server";
52 }
53}