From ac088e85b2da520e826e5ba13bf1976304f6c030 Mon Sep 17 00:00:00 2001 From: Chiss Date: Thu, 21 Aug 2014 13:35:31 +1000 Subject: [PATCH] Added some game flags Dragon escape changes --- .../src/nautilus/game/arcade/game/Game.java | 4 ++ .../game/games/dragonescape/DragonEscape.java | 9 ++- .../games/survivalgames/SurvivalGames.java | 12 ---- .../game/arcade/managers/GameFlagManager.java | 62 +++++++++++++++++++ .../arcade/managers/GameLobbyManager.java | 3 +- .../arcade/managers/GamePlayerManager.java | 3 +- 6 files changed, 76 insertions(+), 17 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index fb0b3cc67..fc1c6fece 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -143,6 +143,10 @@ public abstract class Game implements Listener public boolean WorldWeatherEnabled = false; public int WorldWaterDamage = 0; public boolean WorldBoundaryKill = true; + public boolean WorldBlockBurn = false; + public boolean WorldFireSpread = false; + public boolean WorldLeavesDecay = false; + public boolean WorldSoilTrample = false; public int HungerSet = -1; public int HealthSet = -1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index d6f0dbf6c..2ff0ded4d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -145,13 +145,13 @@ public class DragonEscape extends SoloGame @EventHandler public void MoveDragon(UpdateEvent event) - { + { if (event.getType() != UpdateType.TICK) return; if (_dragonData == null) return; - + _dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1))); _dragonData.Move(); @@ -165,11 +165,14 @@ public class DragonEscape extends SoloGame if (block.isLiquid()) blockIterator.remove(); + + else if (block.getRelative(BlockFace.UP).isLiquid()) + blockIterator.remove(); else if (WorldData.MapName.contains("Hell") && block.getY() < 30) blockIterator.remove(); - else if (WorldData.MapName.contains("Pirate") && block.getY() < 4) + else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6)) blockIterator.remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index e13346506..fae09b7bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -1315,18 +1315,6 @@ public class SurvivalGames extends SoloGame player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); } - @EventHandler(priority = EventPriority.LOWEST) - public void CropTrample(PlayerInteractEvent event) - { - if (event.getAction() != Action.PHYSICAL) - return; - - if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL) - return; - - event.setCancelled(true); - } - @EventHandler public void CompassUpdate(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 3180ac725..24364eeaa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -34,6 +34,10 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; @@ -870,6 +874,64 @@ public class GameFlagManager implements Listener } } + @EventHandler(priority = EventPriority.LOWEST) + public void WorldSoilTrample(PlayerInteractEvent event) + { + if (event.getAction() != Action.PHYSICAL) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.WorldSoilTrample) + return; + + if (event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.SOIL) + return; + + event.setCancelled(true); + } + + @EventHandler + public void WorldBlockBurn(BlockBurnEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.WorldBlockBurn) + return; + + event.setCancelled(true); + } + + @EventHandler + public void WorldFireSpread(BlockIgniteEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (event.getCause() != IgniteCause.SPREAD) + return; + + if (game.WorldFireSpread) + return; + + if (event.getBlock().getType() == Material.FIRE) + event.setCancelled(true); + } + + @EventHandler + public void WorldLeavesDecay(BlockFromToEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.WorldLeavesDecay) + return; + + event.setCancelled(true); + } + @EventHandler public void SpectatorMessage(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 148f33cd6..1e88d7fd4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -1017,7 +1017,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener if (ent.GetKit().GetAvailability() == KitAvailability.Free || //Free donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + ent.GetKit().GetName()) || //Green donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Old - Single Game Ultra - Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER)) //STAFF + Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER) || //STAFF + Manager.GetServerConfig().Tournament) //Tournament { entityName = ent.GetKit().GetAvailability().GetColor() + entityName; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index 750c4283e..2a36516a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -317,7 +317,8 @@ public class GamePlayerManager implements Listener if (kit.GetAvailability() == KitAvailability.Free || //Free donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()) || //Green donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //OLD - Single Game Ultras - Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER)) //STAFF + Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER) || //STAFF + Manager.GetServerConfig().Tournament) //Tournament { Manager.GetGame().SetKit(player, kit, true); }