Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mrkirby153.MscHouses.core.handlers;
- import java.util.EnumSet;
- import mrkirby153.MscHouses.configuration.ConfigurationHandler;
- import mrkirby153.MscHouses.configuration.ConfigurationSettings;
- import mrkirby153.MscHouses.core.helpers.VersionHelper;
- import mrkirby153.MscHouses.core.lang.Strings;
- import mrkirby153.MscHouses.lib.Reference;
- import net.minecraftforge.common.Configuration;
- import cpw.mods.fml.client.FMLClientHandler;
- import cpw.mods.fml.common.ITickHandler;
- import cpw.mods.fml.common.TickType;
- public class VersionCheckTickHandler implements ITickHandler {
- private static boolean initialized = false;
- @Override
- public void tickStart(EnumSet<TickType> type, Object... tickData) {
- }
- @Override
- public void tickEnd(EnumSet<TickType> type, Object... tickData) {
- if (ConfigurationSettings.DISPLAY_VERSION_RESULT) {
- if (!initialized) {
- for (TickType tickType : type) {
- if (tickType == TickType.CLIENT) {
- if (FMLClientHandler.instance().getClient().currentScreen == null) {
- if (VersionHelper.getResult() != VersionHelper.UNINITIALIZED || VersionHelper.getResult() != VersionHelper.FINAL_ERROR) {
- initialized = true;
- if (VersionHelper.getResult() == VersionHelper.OUTDATED) {
- FMLClientHandler.instance().getClient().ingameGUI.getChatGUI().printChatMessage(VersionHelper.getResultMessageForClient());
- ConfigurationHandler.set(Configuration.CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, Strings.FALSE);
- }
- }
- }
- }
- }
- }
- }
- }
- @Override
- public EnumSet<TickType> ticks() {
- return EnumSet.of(TickType.CLIENT);
- }
- @Override
- public String getLabel() {
- return Reference.MOD_NAME + ": " + this.getClass().getSimpleName();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment