mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-15 23:20:44 +00:00
FIX: Got rid of useless NORMAL Mode Off message when player manually
turns off reinforcement or fortification mode.
This commit is contained in:
@@ -43,6 +43,9 @@ public class PlayerState {
|
||||
bypassMode = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the placement mode to NORMAL and resets other properties.
|
||||
*/
|
||||
public void reset() {
|
||||
mode = PlacementMode.NORMAL;
|
||||
fortificationMaterial = null;
|
||||
@@ -98,18 +101,25 @@ public class PlayerState {
|
||||
this.lastThrottledMessage = lastThrottledMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a scheduled task to reset the mode after a configured amount
|
||||
* of time.
|
||||
*
|
||||
* If a task is already scheduled it is canceled first.
|
||||
*/
|
||||
public void checkResetMode() {
|
||||
Citadel plugin = Citadel.getInstance();
|
||||
Citadel plugin = Citadel.getInstance();
|
||||
BukkitScheduler scheduler = plugin.getServer().getScheduler();
|
||||
if (cancelModePid != null && scheduler.isQueued(cancelModePid))
|
||||
scheduler.cancelTask(cancelModePid);
|
||||
|
||||
cancelModePid = scheduler.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
sendMessage(player, ChatColor.YELLOW, "%s mode off", mode.name());
|
||||
reset();
|
||||
}
|
||||
public void run() {
|
||||
if (mode != PlacementMode.NORMAL) {
|
||||
sendMessage(player, ChatColor.YELLOW, "%s mode off", mode.name());
|
||||
reset();
|
||||
}
|
||||
}
|
||||
}, 20L * plugin.autoModeReset);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user