diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2021-11-08 15:53:13 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2021-11-08 15:53:13 -0500 |
commit | 72f093b243c07766d1cce808c9a0fccb30227b9d (patch) | |
tree | 074bda0b305786b667f592cc889c98df0024d90c /src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java | |
parent | 1.3.1 build 4 (diff) | |
download | kenshinshideandseek-72f093b243c07766d1cce808c9a0fccb30227b9d.tar.gz kenshinshideandseek-72f093b243c07766d1cce808c9a0fccb30227b9d.tar.bz2 kenshinshideandseek-72f093b243c07766d1cce808c9a0fccb30227b9d.zip |
1.3.1 build 6
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java b/src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java index 748ae40..d24c93f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java @@ -32,20 +32,19 @@ public class Taunt { } private void waitTaunt() { - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() { - public void run() { - if(delay == 0) { - if(!tauntLast && Main.plugin.board.size() < 2) return; - else executeTaunt(); - } else { - delay--; - waitTaunt(); - } + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> { + if(delay == 0) { + if(!tauntLast && Main.plugin.board.size() < 2) return; + else executeTaunt(); + } else { + delay--; + waitTaunt(); } },20); } private void executeTaunt() { + if(temp != Main.plugin.gameId) return; Player taunted = null; int rand = (int) (Math.random()*Main.plugin.board.sizeHider()); for(Player player : Main.plugin.board.getPlayers()) { @@ -62,31 +61,29 @@ public class Taunt { taunted.sendMessage(message("TAUNTED").toString()); Util.broadcastMessage(tauntPrefix + message("TAUNT")); tauntPlayer = taunted.getName(); - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, new Runnable() { - public void run() { - if(temp != Main.plugin.gameId) return; - Player taunted = Main.plugin.board.getPlayer(tauntPlayer); - if(taunted != null) { - Firework fw = (Firework) taunted.getLocation().getWorld().spawnEntity(taunted.getLocation(), EntityType.FIREWORK); - FireworkMeta fwm = fw.getFireworkMeta(); - fwm.setPower(4); - fwm.addEffect(FireworkEffect.builder() - .withColor(Color.BLUE) - .withColor(Color.RED) - .withColor(Color.YELLOW) - .with(FireworkEffect.Type.STAR) - .with(FireworkEffect.Type.BALL) - .with(FireworkEffect.Type.BALL_LARGE) - .flicker(true) - .withTrail() - .build()); - fw.setFireworkMeta(fwm); - Util.broadcastMessage(tauntPrefix + message("TAUNT_ACTIVATE")); - } - tauntPlayer = ""; - running = false; - schedule(); + Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.plugin, () -> { + if(temp != Main.plugin.gameId) return; + Player taunted1 = Main.plugin.board.getPlayer(tauntPlayer); + if(taunted1 != null) { + Firework fw = (Firework) taunted1.getLocation().getWorld().spawnEntity(taunted1.getLocation(), EntityType.FIREWORK); + FireworkMeta fwm = fw.getFireworkMeta(); + fwm.setPower(4); + fwm.addEffect(FireworkEffect.builder() + .withColor(Color.BLUE) + .withColor(Color.RED) + .withColor(Color.YELLOW) + .with(FireworkEffect.Type.STAR) + .with(FireworkEffect.Type.BALL) + .with(FireworkEffect.Type.BALL_LARGE) + .flicker(true) + .withTrail() + .build()); + fw.setFireworkMeta(fwm); + Util.broadcastMessage(tauntPrefix + message("TAUNT_ACTIVATE")); } + tauntPlayer = ""; + running = false; + schedule(); },20*30); } else { schedule(); |