Merge branch 'hotfix/fix-timer'

This commit is contained in:
Maxlego08 2020-04-27 21:13:51 +02:00
commit 5165a86161
2 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,6 @@
name: zKoth name: zKoth
author: Maxlego08 author: Maxlego08
main: fr.maxlego08.koth.ZKoth main: fr.maxlego08.koth.ZKoth
version: 1.0.0.5 version: 1.0.0.6
softdepend: [PlaceholderAPI] softdepend: [PlaceholderAPI]
commands: commands:

View File

@ -31,6 +31,7 @@ public class Koth extends ZUtils {
private transient int cooldown; private transient int cooldown;
private transient Player currentPlayer; private transient Player currentPlayer;
private transient Cuboid cuboid; private transient Cuboid cuboid;
private transient boolean hasPlayer = false;
private transient FactionListener factionListener; private transient FactionListener factionListener;
public Koth(String name, int capSec) { public Koth(String name, int capSec) {
@ -141,6 +142,7 @@ public class Koth extends ZUtils {
isEnable = false; isEnable = false;
isCooldown = false; isCooldown = false;
currentPlayer = null; currentPlayer = null;
hasPlayer = false;
broadcast(Message.KOTH_STOP, null, null, 0); broadcast(Message.KOTH_STOP, null, null, 0);
} }
@ -244,6 +246,7 @@ public class Koth extends ZUtils {
isEnable = true; isEnable = true;
currentPlayer = null; currentPlayer = null;
hasPlayer = false;
buildCuboid(); buildCuboid();
broadcast(Message.KOTH_SPAWN_MESSAGE, null, null, 0); broadcast(Message.KOTH_SPAWN_MESSAGE, null, null, 0);
@ -251,6 +254,11 @@ public class Koth extends ZUtils {
public void startCap(Player player, FactionListener listener) { public void startCap(Player player, FactionListener listener) {
if (hasPlayer)
return;
hasPlayer = true;
this.factionListener = listener; this.factionListener = listener;
KothEvent event = new KothStartEvent(player, this, listener); KothEvent event = new KothStartEvent(player, this, listener);
@ -269,12 +277,14 @@ public class Koth extends ZUtils {
scheduleFix(0, 1000, (task, isCancelled) -> { scheduleFix(0, 1000, (task, isCancelled) -> {
if (!isCancelled) { if (!isCancelled) {
hasPlayer = false;
task.cancel(); task.cancel();
return; return;
} }
if (!isEnable) { if (!isEnable) {
task.cancel(); task.cancel();
hasPlayer = false;
return; return;
} }
@ -287,7 +297,8 @@ public class Koth extends ZUtils {
if (kothEvent.isCancelled()) if (kothEvent.isCancelled())
return; return;
hasPlayer = false;
task.cancel(); task.cancel();
broadcast(Message.KOHT_LOOSE, player, listener.getFactionTag(player), tmpTimer); broadcast(Message.KOHT_LOOSE, player, listener.getFactionTag(player), tmpTimer);
return; return;
@ -310,6 +321,7 @@ public class Koth extends ZUtils {
isEnable = false; isEnable = false;
isCooldown = false; isCooldown = false;
currentPlayer = null; currentPlayer = null;
hasPlayer = false;
KothLootManager lootManager = new KothLootManager(this, player, listener); KothLootManager lootManager = new KothLootManager(this, player, listener);