diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-07-30 18:12:47 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-07-30 18:12:47 -0400 |
commit | 000219a5ff183e469129e5804d0a6090d6b47b26 (patch) | |
tree | 5217465c967796680cc03b11359490f638d6b78c /src/main/java/net/tylermurphy/hideAndSeek/game/events | |
parent | Merge branch 'main' of ssh://g.tylerm.dev:21/tylermurphy534/KenshinsHideAndSe... (diff) | |
download | kenshinshideandseek-000219a5ff183e469129e5804d0a6090d6b47b26.tar.gz kenshinshideandseek-000219a5ff183e469129e5804d0a6090d6b47b26.tar.bz2 kenshinshideandseek-000219a5ff183e469129e5804d0a6090d6b47b26.zip |
1.7.5 rc4
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/game/events')
3 files changed, 0 insertions, 250 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Border.java b/src/main/java/net/tylermurphy/hideAndSeek/game/events/Border.java deleted file mode 100644 index 9f7b5bf..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Border.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.tylermurphy.hideAndSeek.game.events; - -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.configuration.Map; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - -public class Border { - - private int delay; - private boolean running; - private final Map map; - private int currentSize; - - public Border(Map map) { - this.map = map; - this.delay = (int) (60 * map.getWorldBorderData().getY()); - this.currentSize = (int) map.getWorldBorderData().getX(); - } - - public void update() { - if (delay == 30 && !running) { - Main.getInstance().getGame().broadcastMessage(worldBorderPrefix + message("WORLDBORDER_WARN")); - } else if (delay == 0) { - if (running) { - delay = (int) (60 * map.getWorldBorderData().getY()); - running = false; - } - else decreaseWorldBorder(); - } - delay--; - } - - private void decreaseWorldBorder() { - if (currentSize == 100) return; - if(map.getGameSpawn().load() == null) return; - int change = (int) map.getWorldBorderData().getZ(); - if (currentSize-change < 100) { - change = currentSize-100; - } - running = true; - Main.getInstance().getGame().broadcastMessage(worldBorderPrefix + message("WORLDBORDER_DECREASING").addAmount(change)); - currentSize -= map.getWorldBorderData().getZ(); - org.bukkit.WorldBorder border = map.getGameSpawn().load().getWorldBorder(); - border.setSize(border.getSize()-change,30); - delay = 30; - } - - public void resetWorldBorder() { - if(map.getGameSpawn().load() == null) return; - org.bukkit.WorldBorder border = map.getGameSpawn().load().getWorldBorder(); - if (map.isWorldBorderEnabled()) { - border.setSize(map.getWorldBorderData().getX()); - border.setCenter(map.getWorldBorderPos().getX(), map.getWorldBorderPos().getY()); - currentSize = (int) map.getWorldBorderData().getX(); - } else { - border.setSize(30000000); - border.setCenter(0, 0); - } - delay = (int) (60 * map.getWorldBorderData().getY()); - } - - public int getDelay() { - return delay; - } - - public boolean isRunning() { - return running; - } - -}
\ No newline at end of file diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Glow.java b/src/main/java/net/tylermurphy/hideAndSeek/game/events/Glow.java deleted file mode 100644 index dec23d7..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Glow.java +++ /dev/null @@ -1,77 +0,0 @@ -package net.tylermurphy.hideAndSeek.game.events; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.wrappers.WrappedDataWatcher; -import net.tylermurphy.hideAndSeek.Main; -import net.tylermurphy.hideAndSeek.util.packet.EntityMetadataPacket; -import org.bukkit.entity.Player; - -import java.lang.reflect.InvocationTargetException; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; - -public class Glow { - - private static final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); - - private int glowTime; - private boolean running; - - public Glow() { - this.glowTime = 0; - } - - public void onProjectile() { - if (glowStackable) glowTime += glowLength; - else glowTime = glowLength; - running = true; - } - - private void sendPackets() { - for (Player hider : Main.getInstance().getBoard().getHiders()) - for (Player seeker : Main.getInstance().getBoard().getSeekers()) - setGlow(hider, seeker, true); - } - - public void update() { - if(alwaysGlow){ - sendPackets(); - return; - } - if (running) { - sendPackets(); - glowTime--; - glowTime = Math.max(glowTime, 0); - if (glowTime == 0) { - stopGlow(); - } - } - } - - private void stopGlow() { - running = false; - for (Player hider : Main.getInstance().getBoard().getHiders()) { - for (Player seeker : Main.getInstance().getBoard().getSeekers()) { - setGlow(hider, seeker, false); - } - } - } - - public boolean isRunning() { - return running; - } - - public void setGlow(Player player, Player target, boolean glowing) { - - EntityMetadataPacket packet = new EntityMetadataPacket(); - packet.setEntity(target); - packet.setGlow(glowing); - packet.writeMetadata(); - packet.send(player); - - } - -} diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Taunt.java b/src/main/java/net/tylermurphy/hideAndSeek/game/events/Taunt.java deleted file mode 100644 index 191b1e7..0000000 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/events/Taunt.java +++ /dev/null @@ -1,101 +0,0 @@ -package net.tylermurphy.hideAndSeek.game.events; - -import net.tylermurphy.hideAndSeek.Main; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.World; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Firework; -import org.bukkit.entity.Player; -import org.bukkit.inventory.meta.FireworkMeta; - -import java.util.Optional; -import java.util.Random; -import java.util.UUID; - -import static net.tylermurphy.hideAndSeek.configuration.Config.*; -import static net.tylermurphy.hideAndSeek.configuration.Config.tauntDelay; -import static net.tylermurphy.hideAndSeek.configuration.Localization.message; - -public class Taunt { - - private UUID tauntPlayer; - private int delay; - private boolean running; - - public Taunt() { - this.delay = tauntDelay; - } - - public void update() { - if (delay == 0) { - if (running) launchTaunt(); - else if (tauntLast || Main.getInstance().getBoard().sizeHider() > 1) executeTaunt(); - } else { - delay--; - delay = Math.max(delay, 0); - } - } - - private void executeTaunt() { - Optional<Player> rand = Main.getInstance().getBoard().getHiders().stream().skip(new Random().nextInt(Main.getInstance().getBoard().size())).findFirst(); - if (!rand.isPresent()) { - Main.getInstance().getLogger().warning("Failed to select random seeker."); - return; - } - Player taunted = rand.get(); - taunted.sendMessage(message("TAUNTED").toString()); - Main.getInstance().getGame().broadcastMessage(tauntPrefix + message("TAUNT")); - tauntPlayer = taunted.getUniqueId(); - running = true; - delay = 30; - } - - private void launchTaunt() { - Player taunted = Main.getInstance().getBoard().getPlayer(tauntPlayer); - if (taunted != null) { - if (!Main.getInstance().getBoard().isHider(taunted)) { - Main.getInstance().getLogger().info("Taunted played died and is now seeker. Skipping taunt."); - tauntPlayer = null; - running = false; - delay = tauntDelay; - return; - } - World world = taunted.getLocation().getWorld(); - if (world == null) { - Main.getInstance().getLogger().severe("Game world is null while trying to launch taunt."); - tauntPlayer = null; - running = false; - delay = tauntDelay; - return; - } - Firework fw = (Firework) world.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); - Main.getInstance().getGame().broadcastMessage(tauntPrefix + message("TAUNT_ACTIVATE")); - } - tauntPlayer = null; - running = false; - delay = tauntDelay; - } - - public int getDelay() { - return delay; - } - - public boolean isRunning() { - return running; - } - -}
\ No newline at end of file |