From d85ad022fb8bd8dd0ecd617ba728c358971473de Mon Sep 17 00:00:00 2001 From: BenCodez Date: Mon, 7 Oct 2024 07:27:49 -0600 Subject: [PATCH] Add extra checks on global data time changes --- .../src/com/bencodez/votingplugin/BungeeHandler.java | 2 ++ .../bencodez/votingplugin/bungee/VotingPluginBungee.java | 8 ++++++++ .../bungee/velocity/VotingPluginVelocity.java | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java b/VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java index 29d1972cd..1f0658fdb 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java @@ -167,6 +167,8 @@ public boolean checkGlobalDataTime(TimeType type, HashMap dat plugin.debug("Detected time change from bungee: " + type.toString()); plugin.getTimeChecker().forceChanged(type, false, true, true); globalDataHandler.setBoolean(plugin.getBungeeSettings().getServer(), type.toString(), false); + getGlobalMessageHandler().sendMessage("TimeChangeFinished", + "" + plugin.getBungeeSettings().getServer()); } } return isProcessing; diff --git a/VotingPlugin/src/com/bencodez/votingplugin/bungee/VotingPluginBungee.java b/VotingPlugin/src/com/bencodez/votingplugin/bungee/VotingPluginBungee.java index 094b7cb8a..24e9f9095 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/bungee/VotingPluginBungee.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/bungee/VotingPluginBungee.java @@ -876,6 +876,10 @@ protected void onMessage(String channel, String[] message) { if (message[0].equalsIgnoreCase("statusokay")) { String server = message[1]; getLogger().info("Status okay for " + server); + } else if (message[0].equalsIgnoreCase("TimeChangeFinished")) { + if (getConfig().getGlobalDataEnabled()) { + getGlobalDataHandler().checkForFinishedTimeChanges(); + } } else if (message[0].equalsIgnoreCase("login")) { String player = message[1]; String uuid = message[2]; @@ -1183,6 +1187,10 @@ public void onPluginMessage(PluginMessageEvent ev) { String server = in.readUTF(); getLogger().info("Status okay for " + server); return; + } else if (subchannel.equalsIgnoreCase("TimeChangeFinished")) { + if (getConfig().getGlobalDataEnabled()) { + getGlobalDataHandler().checkForFinishedTimeChanges(); + } } else if (subchannel.equalsIgnoreCase("login")) { String player = in.readUTF(); String uuid = in.readUTF(); diff --git a/VotingPlugin/src/com/bencodez/votingplugin/bungee/velocity/VotingPluginVelocity.java b/VotingPlugin/src/com/bencodez/votingplugin/bungee/velocity/VotingPluginVelocity.java index d446d55bf..a708b358c 100644 --- a/VotingPlugin/src/com/bencodez/votingplugin/bungee/velocity/VotingPluginVelocity.java +++ b/VotingPlugin/src/com/bencodez/votingplugin/bungee/velocity/VotingPluginVelocity.java @@ -497,7 +497,12 @@ public void onPluginMessagingReceived(PluginMessageEvent event) { String server = in.readUTF(); logger.info("Status okay for " + server); return; + } else if (subchannel.equalsIgnoreCase("TimeChangeFinished")) { + if (getConfig().getGlobalDataEnabled()) { + getGlobalDataHandler().checkForFinishedTimeChanges(); + } } else if (subchannel.equalsIgnoreCase("login")) { + String player = in.readUTF(); String uuid = in.readUTF(); String serverName = ""; @@ -959,6 +964,10 @@ protected void onMessage(String channel, String[] message) { if (message[0].equalsIgnoreCase("statusokay")) { String server = message[1]; getLogger().info("Status okay for " + server); + } else if (message[0].equalsIgnoreCase("TimeChangeFinished")) { + if (getConfig().getGlobalDataEnabled()) { + getGlobalDataHandler().checkForFinishedTimeChanges(); + } } else if (message[0].equalsIgnoreCase("login")) { String player = message[1]; String uuid = message[2];