diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
-rw-r--r-- | src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 0666acc7fa..b787acd02d 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.handler.events; -import java.util.UUID; +import java.util.*; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; @@ -45,7 +45,7 @@ public class LoginEventHandler { Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); } Utils.LOG_INFO("You currently have: "+CORE.VERSION); - PlayerUtils.messagePlayer(this.localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); + ShortTimer(this.localPlayerRef, 20); } else { Utils.LOG_INFO("You're using the latest recommended version of GT++."); @@ -100,5 +100,30 @@ public class LoginEventHandler { } } + + //Handles notifying the player about a version update. + public Timer ShortTimer(EntityPlayer localPlayer, final int seconds) { + Timer timer; + timer = new Timer(); + timer.schedule(new NotifyPlayer(localPlayer), seconds * 1000); + return timer; + } + + //Timer Task for notifying the player. + class NotifyPlayer extends TimerTask { + final EntityPlayer toMessage; + public NotifyPlayer(EntityPlayer localPlayer) { + toMessage = localPlayer; + } + + @Override + public void run() { + if (toMessage != null){ + if (toMessage instanceof EntityPlayerMP){ + PlayerUtils.messagePlayer(toMessage, "You're not using the latest recommended version of GT++, consider updating."); + } + } + } + } }
\ No newline at end of file |