Skip to content

Commit

Permalink
Add extra checks on proxy time changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCodez committed Dec 13, 2024
1 parent 0042045 commit 3bd41af
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
10 changes: 10 additions & 0 deletions VotingPlugin/src/com/bencodez/votingplugin/BungeeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ public void debug(Exception e) {
public void debug(String text) {
plugin.debug(text);
}

@Override
public void info(String text) {
plugin.getLogger().info(text);
}
});
} else {
globalDataHandler = new GlobalDataHandler(
Expand All @@ -253,6 +258,11 @@ public void debug(Exception e) {
public void debug(String text) {
plugin.debug(text);
}

@Override
public void info(String text) {
plugin.getLogger().info(text);
}
});
}
globalDataHandler.getGlobalMysql().alterColumnType("IgnoreTime", "VARCHAR(5)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ public void debug(Exception e) {
public void debug(String text) {
debug2(text);
}

@Override
public void info(String text) {
getLogger().info(text);

}
}, servers) {

@Override
Expand Down Expand Up @@ -412,6 +418,12 @@ public void debug(Exception e) {
public void debug(String text) {
debug2(text);
}

@Override
public void info(String text) {
getLogger().info(text);

}
}, servers) {

@Override
Expand Down Expand Up @@ -632,6 +644,7 @@ public void timeChanged(TimeType type, boolean fake, boolean pre, boolean post)
checkVoteCacheTime();
}
if (!config.getGlobalDataEnabled()) {
getLogger().warning("Global data not enabled, ignoring time change event");
return;
}
for (String s : getAvailableAllServers()) {
Expand Down Expand Up @@ -751,7 +764,6 @@ public void debug(String text) {

bungeeTimeChecker.setTimeChangeFailSafeBypass(config.getTimeChangeFailSafeBypass());
bungeeTimeChecker.loadTimer();


nonVotedPlayersCache = new NonVotedPlayersCache(this);
nonVotedPlayersCache.load();
Expand Down Expand Up @@ -1380,10 +1392,10 @@ public synchronized void vote(String player, String service, boolean realVote, b
getLogger().info("No name from vote on " + service);
return;
}

if (timeQueue) {
if (getConfig().getGlobalDataEnabled()) {
if (getGlobalDataHandler().isTimeChangedHappened()) {
if (getConfig().getGlobalDataEnabled()) {
if (getGlobalDataHandler().isTimeChangedHappened()) {
getGlobalDataHandler().checkForFinishedTimeChanges();
if (timeQueue) {
timeChangeQueue.add(new VoteTimeQueue(player, service,
LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
getLogger().info("Cachcing vote from " + player + "/" + service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ public void debug(Exception e) {
public void debug(String text) {
debug2(text);
}

@Override
public void info(String text) {
logger.info(text);
}
}, servers) {

@Override
Expand Down Expand Up @@ -417,6 +422,11 @@ public void debug(Exception e) {
public void debug(String text) {
debug2(text);
}

@Override
public void info(String text) {
logger.info(text);
}
}, servers) {

@Override
Expand Down Expand Up @@ -683,6 +693,7 @@ public void timeChanged(TimeType type, boolean fake, boolean pre, boolean post)
checkVoteCacheTime();
}
if (!config.getGlobalDataEnabled()) {
getLogger().warn("Global data not enabled, ignoring time change event");
return;
}
for (RegisteredServer s : getAvailableAllServers()) {
Expand Down Expand Up @@ -1454,10 +1465,10 @@ public synchronized void vote(String player, String service, boolean realVote, b
logger.info("No name from vote on " + service);
return;
}

if (timeQueue) {
if (getConfig().getGlobalDataEnabled()) {
if (getGlobalDataHandler().isTimeChangedHappened()) {
if (getConfig().getGlobalDataEnabled()) {
if (getGlobalDataHandler().isTimeChangedHappened()) {
getGlobalDataHandler().checkForFinishedTimeChanges();
if (timeQueue) {
timeChangeQueue.add(new VoteTimeQueue(player, service,
LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
getLogger().info("Cachcing vote from " + player + "/" + service
Expand Down

0 comments on commit 3bd41af

Please sign in to comment.