diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2021-12-20 18:22:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 18:22:23 -0500 |
commit | 2ab0b2bbb604db246dcc46209ef780ba44d7aa69 (patch) | |
tree | d2513dbf0e511d66aaa8361e330ccb8bdf086bea /src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java | |
parent | 1.3.0 full release (diff) | |
parent | Add Workflows (diff) | |
download | kenshinshideandseek-2ab0b2bbb604db246dcc46209ef780ba44d7aa69.tar.gz kenshinshideandseek-2ab0b2bbb604db246dcc46209ef780ba44d7aa69.tar.bz2 kenshinshideandseek-2ab0b2bbb604db246dcc46209ef780ba44d7aa69.zip |
Merge pull request #12 from tylermurphy534/1.3.1
1.3.1
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java b/src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java index dec3b0f..a817df3 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/events/Glow.java @@ -6,6 +6,8 @@ import org.bukkit.entity.Player; import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.util.Packet; +import static net.tylermurphy.hideAndSeek.configuration.Config.*; + public class Glow { private final int temp; @@ -18,7 +20,8 @@ public class Glow { } public void onProjectilve() { - glowTime++; + if(glowStackable) glowTime += glowLength; + else glowTime = glowLength; if(!running) startGlow(); } @@ -34,26 +37,29 @@ public class Glow { } private void waitGlow() { - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() { - public void run() { - if(temp != Main.plugin.gameId) return; - glowTime--; - glowTime = Math.max(glowTime, 0); - if(glowTime == 0) { - stopGlow(); - } else { - waitGlow(); - } + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> { + if(temp != Main.plugin.gameId) return; + glowTime--; + glowTime = Math.max(glowTime, 0); + if(glowTime == 0) { + stopGlow(); + } else { + waitGlow(); } - }, 20*30); + }, 20); } private void stopGlow() { + running = false; for(Player hider : Main.plugin.board.getHiders()) { - for(Player seeker : Main.plugin.board.getSeekers()) { + for (Player seeker : Main.plugin.board.getSeekers()) { Packet.setGlow(hider, seeker, false); } } } + + public boolean isRunning() { + return running; + } } |