From ccb601dd7e675a9829dfac7080a917b1083d9a6d Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Mon, 11 Dec 2017 14:49:38 +1000 Subject: $ Redid Analytics Handling to be done on a per-player basis and not handle client side per-player. --- .../core/handler/events/BlockEventHandler.java | 8 ++++++- .../core/handler/events/LoginEventHandler.java | 27 ++++++++++------------ 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'src/Java/gtPlusPlus/core/handler/events') diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index 16599b3b8b..b4872bde93 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -7,7 +7,9 @@ import java.util.ArrayList; import java.util.Random; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.api.analytics.SegmentAnalytics; import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; @@ -40,7 +42,7 @@ public class BlockEventHandler { event.world.setBlock(fireX, fireY, fireZ, Blocks.fire); // Replace it with Fire event.useBlock = Event.Result.DENY; // Prevent the Fire from being extinguished (also prevents Block#onBlockClicked from being called) } - }*/ + }*/ } @SubscribeEvent @@ -158,6 +160,10 @@ public class BlockEventHandler { } } } + + //Try submit some data for this event. + SegmentAnalytics.getAnalyticsForPlayer(event.harvester).submitTrackingData("Action_Block_Broken"); + } catch (Throwable r){ Utils.LOG_INFO("Block Event Handler Failed. Please Report this to Alkalus."); diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index b3897e48c1..9664c7d340 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.handler.events; -import static gtPlusPlus.core.lib.CORE.mLocalProfile; - import java.util.*; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; +import gtPlusPlus.api.analytics.SegmentAnalytics; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.proxy.ClientProxy; import gtPlusPlus.core.util.Utils; @@ -29,11 +28,17 @@ public class LoginEventHandler { //Set this for easier use elsewhere. if (event.player.getEntityWorld().isRemote){ - ClientProxy.playerName = this.localPlayersName; - if (mLocalProfile == null){ - mLocalProfile = this.localPlayerRef.getGameProfile(); - } - } + ClientProxy.playerName = this.localPlayersName; + } + + try { + new SegmentAnalytics(event.player); + } + catch (Throwable t){ + SegmentAnalytics.LOG("Failed to create Analytics submission during log in process."); + SegmentAnalytics.LOG("Disabling."); + SegmentAnalytics.isEnabled = false; + } try { @@ -44,14 +49,6 @@ public class LoginEventHandler { if (!this.localPlayerRef.worldObj.isRemote){ PlayerCache.appendParamChanges(this.localPlayersName, this.localPlayersUUID.toString()); - //Submit Analytics - try { - CORE.mAnalytics.submitInitData(); - } - catch (Throwable t){ - Utils.LOG_INFO("Failed to submit analytics data."); - } - if (CORE.ConfigSwitches.enableUpdateChecker){ if (!Utils.isModUpToDate()){ Utils.LOG_INFO("[GT++] You're not using the latest recommended version of GT++, consider updating."); -- cgit