summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/events/Taunt.java63
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();