Skip to content

Commit

Permalink
Add extra checks on global data time changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Oct 7, 2024
1 parent e39fcd7 commit d85ad02
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public boolean checkGlobalDataTime(TimeType type, HashMap<String, DataValue> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit d85ad02

Please sign in to comment.