diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index c60046b45..c1b548ee6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1401,6 +1401,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation _plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin); } + public void disableChampionsModules() + { + _classManager.setEnabled(false); + _classShopManager.deregisterSelf(); + _skillFactory.deregisterSelf(); + _itemFactory.deregisterSelf(); + _energy.deregisterSelf(); + _eloManager.deregisterSelf(); + + //Class Shop + HandlerList.unregisterAll(_classShop); + } + public void toggleChampionsModules(GameType gameType) { boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles; @@ -1420,15 +1433,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation } else { - _classManager.setEnabled(false); - _classShopManager.deregisterSelf(); - _skillFactory.deregisterSelf(); - _itemFactory.deregisterSelf(); - _energy.deregisterSelf(); - _eloManager.deregisterSelf(); - - //Class Shop - HandlerList.unregisterAll(_classShop); + disableChampionsModules(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 703e1e187..e003678a2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -138,7 +138,7 @@ public enum GameType Paintball(Paintball.class, GameDisplay.Paintball), Quiver(Quiver.class, new GameMode[]{new GameMode(BunnyHop.class, "Bunny Hop"), new GameMode(TwoQuiver.class, "Two In The Quiver")}, GameDisplay.Quiver), QuiverTeams(QuiverTeams.class, GameDisplay.QuiverTeams), - Runner(Runner.class, new GameMode[]{new GameMode(FasterThanLight.class, "Gotta Go Fast")}, GameDisplay.Runner), + Runner(Runner.class, new GameMode[]{new GameMode(FasterThanLight.class, "Faster Than Light")}, GameDisplay.Runner), SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy), Sheep(SheepGame.class, new GameMode[]{new GameMode(EweHeroes.class, "Heroes Of The Ewe")}, GameDisplay.Sheep), TypeWars(TypeWars.class, GameDisplay.TypeWars), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java index bedb2af95..60fec3dca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/SetCommand.java @@ -43,19 +43,19 @@ public class SetCommand extends CommandBase for(String token : args) { - if(token.startsWith("s")) + if(token.startsWith("@s")) { Plugin.GetGameCreationManager().MapSource = token.substring(1); - source = token.substring(1); + source = token.substring(2); } - else if(token.startsWith("m")) + else if(token.startsWith("@m")) { Plugin.GetGameCreationManager().MapPref = token.substring(1); - map = token.substring(1); + map = token.substring(2); } - else if(token.startsWith("e")) + else if(token.startsWith("@e")) { - Plugin.GetGameCreationManager().ModePref = token.substring(1); + Plugin.GetGameCreationManager().ModePref = token.substring(2); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index 50f2ca2d0..5a9bc8076 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -66,6 +66,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.loot.ChestLoot; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; @@ -1959,5 +1960,10 @@ public class Bridge extends TeamGame implements OreObsfucation { return _oreDensity; } + + public ArrayList getChestLoot() + { + return _chestLoot; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java index c5e17dafa..d2f9c21a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/OverpoweredBridge.java @@ -4,8 +4,18 @@ import java.util.ArrayList ; import org.bukkit.Location ; import org.bukkit.Material ; +import org.bukkit.block.Chest; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.material.MaterialData; +import org.bukkit.potion.Potion; +import org.bukkit.potion.Potion.Tier; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.potion.PotionType; import mineplex.core.common.util.UtilMath ; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager ; import nautilus.game.arcade.game.games.bridge.Bridge ; @@ -215,6 +225,70 @@ public class OverpoweredBridge extends Bridge } } + @Override + protected void ParseChests() + { + for (Location loc : WorldData.GetCustomLocs("54")) + { + if (loc.getBlock().getType() != Material.CHEST) + loc.getBlock().setType(Material.CHEST); + + Chest chest = (Chest) loc.getBlock().getState(); + + chest.getBlockInventory().clear(); + + int count = 12 + UtilMath.r(10); + for (int i = 0; i < count; i++) + { + chest.getBlockInventory().addItem(GetChestItem()); + } + } + } + + @Override + protected ItemStack GetChestItem() + { + if (getChestLoot().isEmpty()) + { + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_HELMET)); + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_CHESTPLATE)); + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_LEGGINGS)); + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_BOOTS)); + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_SWORD)); + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_AXE)); + for (int i = 0; i < 5; i++) + getChestLoot().add(new ItemStack(Material.DIAMOND_PICKAXE)); + + for (int i = 0; i < 13; i++) + getChestLoot().add(new ItemStack(Material.GOLDEN_APPLE)); + + for (int i = 0; i < 6; i++) + getChestLoot().add(new ItemStack(Material.BOW)); + for (int i = 0; i < 8; i++) + getChestLoot().add(new ItemStack(Material.ARROW, 8)); + + for (int i = 0; i < 12; i++) + getChestLoot().add(new ItemStack(Material.MUSHROOM_SOUP)); + for (int i = 0; i < 12; i++) + getChestLoot().add(new ItemStack(Material.COOKED_CHICKEN, 2)); + } + + ItemStack stack = getChestLoot().get(UtilMath.r(getChestLoot().size())); + + int amount = 1; + + if (stack.getType().getMaxStackSize() > 1) + amount = stack.getAmount() + UtilMath.r(stack.getAmount()); + + return ItemStackFactory.Instance.CreateStack(stack.getTypeId(), amount); + } + @Override public String GetMode() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java index fad63aa8a..3beffd2b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/modes/SpeedBridges.java @@ -26,7 +26,7 @@ public class SpeedBridges extends Bridge @EventHandler public void fallBridges(GameStateChangeEvent event) { - if (event.GetState() != GameState.Live) + if (event.GetState() != GameState.Prepare) return; setBridgeTime(_untilBridges); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 22594124f..447ed261f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -1103,11 +1103,14 @@ public class Build extends Game if (data == null) return; - if (data.Team.HasPlayer(event.getPlayer())) + if(data.Player == null) { - event.getItem().remove(); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getItem().getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); + if (data.Team.HasPlayer(event.getPlayer())) + { + event.getItem().remove(); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getItem().getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, + ViewDist.LONG, UtilServer.getPlayers()); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java index 4948e41fa..23050818a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/modes/DukesOfDecoration.java @@ -37,7 +37,16 @@ public class DukesOfDecoration extends Build for (int i = 0; i < 22; i++) { Material mat = Material.values()[1 + UtilMath.r(174)]; - while (_blocks.contains(mat) || mat == Material.COMMAND || mat == Material.COMMAND_MINECART) + while (_blocks.contains(mat) + || mat == Material.COMMAND + || mat == Material.COMMAND_MINECART + || mat == Material.BARRIER + || mat == Material.BURNING_FURNACE + || mat == Material.MOB_SPAWNER + || mat == Material.FURNACE + || mat == Material.DRAGON_EGG + || mat == Material.ENDER_PORTAL + || mat == Material.ENDER_PORTAL_FRAME) { mat = Material.values()[1 + UtilMath.r(174)]; } @@ -60,6 +69,9 @@ public class DukesOfDecoration extends Build @EventHandler public void giveBlockCommand(PlayerCommandPreprocessEvent event) { + if(!IsLive()) + return; + if (!IsPlaying(event.getPlayer())) return; @@ -74,18 +86,31 @@ public class DukesOfDecoration extends Build public void giveBlocks(Player player) { - for (Material mat : _blocks) + Manager.runSyncLater(new Runnable() { - UtilInv.insert(player, new ItemStack(mat)); - } - - UtilPlayer.message(player, F.main("Game", "You have been given your building blocks. If you want to get them once again type " + F.game("/giveblocks"))); + + @Override + public void run() + { + for (Material mat : _blocks) + { + UtilInv.insert(player, new ItemStack(mat)); + } + + UtilPlayer.message(player, F.main("Game", "You have been given your building blocks. If you want to get them once again type " + F.game("/giveblocks"))); + } + + }, 10); } @EventHandler public void placeBlock(BlockPlaceEvent event) { - if (!_blocks.contains(event.getBlockPlaced().getType())) + if (!_blocks.contains(event.getBlockPlaced().getType()) + || (event.getBlockPlaced().getType() == Material.WOOL + || event.getBlockPlaced().getType() == Material.STAINED_CLAY + || event.getBlockPlaced().getType() == Material.STAINED_GLASS + || event.getBlockPlaced().getType() == Material.STAINED_GLASS_PANE && event.getBlock().getData() != 0)) { event.setCancelled(true); UtilPlayer.message(event.getPlayer(), F.main("Game", "You can not place this Block")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java index e2853ecb5..edd6a58cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/modes/OverpoweredGladiators.java @@ -4,6 +4,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.UtilInv; @@ -43,7 +45,11 @@ public class OverpoweredGladiators extends Gladiators case YELLOW: enchantMentLevel = 2; case GREEN: enchantMentLevel = 1; } + + System.out.println(enchantMentLevel); + UtilInv.Clear(p); + p.getInventory().clear(); p.getInventory().setArmorContents(null); @@ -69,6 +75,7 @@ public class OverpoweredGladiators extends Gladiators if(enchantMentLevel >= 4) { + System.out.println("Notch Apple"); UtilInv.insert(p, new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 2ef678d00..990304b25 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -935,7 +935,7 @@ public class HideSeek extends TeamGame if (!_hiders.HasPlayer(player)) return; - if (!Recharge.Instance.use(player, "Axe Boost", 16000, true, true)) + if (!Recharge.Instance.use(player, "Axe Boost", 16000, inform(), true)) return; if (UtilGear.isMat(player.getItemInHand(), Material.WOOD_AXE)) @@ -998,7 +998,7 @@ public class HideSeek extends TeamGame event.setCancelled(true); - if (!Recharge.Instance.use(player, "Meow", 5000, true, true)) + if (!Recharge.Instance.use(player, "Meow", 5000, inform(), true)) return; player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f); @@ -1027,7 +1027,7 @@ public class HideSeek extends TeamGame event.setCancelled(true); - if (!Recharge.Instance.use(player, "Firework", 15000, true, true)) + if (!Recharge.Instance.use(player, "Firework", 15000, inform(), true)) return; this.AddGems(player, 2, "Fireworks", true, true); @@ -1472,7 +1472,7 @@ public class HideSeek extends TeamGame return; } - if (!Recharge.Instance.use(player, "Infest", 8000, true, true)) + if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true)) return; // Cloak @@ -1505,7 +1505,7 @@ public class HideSeek extends TeamGame return; } - if (!Recharge.Instance.use(player, "Infest", 8000, true, true)) + if (!Recharge.Instance.use(player, "Infest", 8000, inform(), true)) return; // Cloak @@ -1658,4 +1658,14 @@ public class HideSeek extends TeamGame { return _forms; } + + public ArrayList getAllowedBlocks() + { + return _allowedBlocks; + } + + public boolean inform() + { + return true; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java index 04afbc989..6cc08e3fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/modes/Countdown.java @@ -10,6 +10,8 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -31,18 +33,11 @@ public class Countdown extends HideSeek private long _lastChanged = 0; - private ArrayList _blocks; - public Countdown(ArcadeManager manager) { super(manager); _changeInterval = 30; - _blocks = new ArrayList<>(); - for (Material mat : Material.values()) - { - _blocks.add(mat); - } } @EventHandler @@ -53,6 +48,24 @@ public class Countdown extends HideSeek _lastChanged = System.currentTimeMillis(); } + + @EventHandler + public void countdown(UpdateEvent event) + { + if(!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + double percentage = (double) (System.currentTimeMillis() - _lastChanged) / (_changeInterval*1000); + + for (Player player : UtilServer.getPlayers()) + { + UtilTextBottom.displayProgress("Block change", percentage, + UtilTime.MakeStr(Math.max(0, (_changeInterval*1000) - (System.currentTimeMillis() - _lastChanged))), player); + } + } @EventHandler public void changeForms(UpdateEvent event) @@ -67,19 +80,13 @@ public class Countdown extends HideSeek { _lastChanged = System.currentTimeMillis(); - Material mat = _blocks.get(UtilMath.r(_blocks.size())); - int i = 0; - while (i < 20 && UtilBlock.isBlock(new ItemStack(mat))) - { - mat = _blocks.get(UtilMath.r(_blocks.size())); - i++; - } - if (i >= 20) - { - mat = Material.JUKEBOX; - } + Material mat = getAllowedBlocks().get(UtilMath.r(getAllowedBlocks().size())); + for (Player player : GetPlayers(true)) { + if(!getForms().containsKey(player)) + continue; + getForms().get(player).Remove(); Form form = new BlockForm(this, player, mat); @@ -93,6 +100,12 @@ public class Countdown extends HideSeek } } + + @Override + public boolean inform() + { + return false; + } @Override public String GetMode() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/TwoQuiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/TwoQuiver.java index baaf65c96..f48437c30 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/TwoQuiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/TwoQuiver.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.quiver.modes; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -10,6 +11,8 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.game.games.quiver.kits.KitSlamShot; @@ -30,6 +33,20 @@ public class TwoQuiver extends Quiver _arrowAmount = 2; } + @Override + @EventHandler(priority = EventPriority.HIGH) + public void GameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 2, F.item("Super Arrow"))); + player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); + } + } + @Override @EventHandler public void Death(CombatDeathEvent event) @@ -56,7 +73,7 @@ public class TwoQuiver extends Quiver if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null)) { - amount++; + amount = _arrowAmount * 2; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/kits/KitModedLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/kits/KitModedLeaper.java index 5af241f44..1eb091458 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/kits/KitModedLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/modes/kits/KitModedLeaper.java @@ -44,7 +44,7 @@ public class KitModedLeaper extends Kit if (Manager.GetGame().GetState() == GameState.Live) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 2, F.item("Super Arrow"))); final Player fPlayer = player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/modes/FasterThanLight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/modes/FasterThanLight.java index 04ac471f3..87fae177a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/modes/FasterThanLight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/modes/FasterThanLight.java @@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.runner.modes; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -24,13 +26,15 @@ public class FasterThanLight extends Runner @EventHandler public void speed(UpdateEvent event) { + if(!IsLive()) + return; + if (event.getType() != UpdateType.SEC) return; for (Player player : GetPlayers(true)) { - Manager.GetCondition().Factory().Speed("Game Mode", player, player, 3, 4, true, true, - true); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 40, 2, true, true), true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java index e32cb60ab..d1451ea53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/modes/EweHeroes.java @@ -1,5 +1,7 @@ package nautilus.game.arcade.game.games.sheep.modes; +import java.util.ArrayList; + import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -7,11 +9,16 @@ import org.bukkit.entity.Sheep; import org.bukkit.event.EventHandler; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.champions.ChampionsFixes; import nautilus.game.arcade.game.games.champions.kits.KitAssassin; import nautilus.game.arcade.game.games.champions.kits.KitBrute; @@ -67,6 +74,15 @@ public class EweHeroes extends SheepGame } } + @EventHandler + public void end(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + Manager.disableChampionsModules(); + } + @Override public void inventoryWool(Player player, int count, Entity sheep) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java index 9e58995ca..cf2063de8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/skywars/Skywars.java @@ -193,9 +193,6 @@ public abstract class Skywars extends Game }; - setupPlayerLoot(); - setupMiddleLoot(); - setAlreadyAnnounced(false); registerStatTrackers( @@ -219,6 +216,8 @@ public abstract class Skywars extends Game public void ParseData() { + setupPlayerLoot(); + setupMiddleLoot(); parseCreateZombieSpawns(); parseCreateMiddleChests(); parseCreatePlayerChests(); 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 8cebf5e0c..b35ca3b5c 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 @@ -1511,7 +1511,7 @@ public abstract class SurvivalGames extends Game } } - private void setupLoot() + public void setupLoot() { // Food _baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3)); @@ -2054,4 +2054,34 @@ public abstract class SurvivalGames extends Game return _lootedBlocks; } + public ChestLoot getBaseLoot() + { + return _baseLoot; + } + + public ChestLoot getCrateLoot() + { + return _crateLoot; + } + + public ChestLoot getSpawnLoot() + { + return _spawnLoot; + } + + public ChestLoot getDeathMatch() + { + return _deathMatchLoot; + } + + public ChestLoot getRawFurnace() + { + return _rawFurnace; + } + + public ChestLoot getFurnace() + { + return _cookedFurnace; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/OverpoweredSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/OverpoweredSurvival.java index 449d64c53..81f36de90 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/OverpoweredSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/modes/OverpoweredSurvival.java @@ -1,260 +1,119 @@ package nautilus.game.arcade.game.games.survivalgames.modes; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.Bukkit ; -import org.bukkit.ChatColor; import org.bukkit.Material ; -import org.bukkit.block.Block ; -import org.bukkit.block.Chest ; -import org.bukkit.enchantments.Enchantment ; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack ; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilMath ; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTime.TimeUnit; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.loot.RandomItem; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent ; -import nautilus.game.arcade.game.games.survivalgames.SurvivalGames; -import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter ; +import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames; /** * OverpoweredSurvival * * @author xXVevzZXx */ -public class OverpoweredSurvival extends SurvivalGames +public class OverpoweredSurvival extends SoloSurvivalGames { - - private GameTeam _players; - + public OverpoweredSurvival(ArcadeManager manager) { - super(manager, GameType.SurvivalGames, new String[] - { - "Search for chests to find loot", - - "Slaughter your opponents", - - "Stay away from the borders!", - - "Last tribute alive wins!" - }); - } - - @Override - public void fillChest(Player looter, Block block) - { - getLootedBlocks().add(block.getLocation()); - - Chest chest = (Chest) block.getState(); - - chest.getBlockInventory().clear(); - - int items = 2; - if (Math.random() > 0.20) - items++; - if (Math.random() > 0.40) - items++; - if (Math.random() > 0.60) - items++; - if (Math.random() > 0.80) - items++; - - if (GetKit(looter) instanceof KitLooter) - { - items += UtilMath.r(3); - } - - for (int i = 0; i < items; i++) - { - ItemStack item; - - item = GetChestItem(UtilMath.r(4) == 0); - - if (item.getType() == Material.COMPASS) - { - item = buildCompass(5); - } - - if(getSupplyBlocks().contains(block)) - { - if(item.getType() == Material.DIAMOND_CHESTPLATE - || item.getType() == Material.DIAMOND_LEGGINGS - || item.getType() == Material.DIAMOND_BOOTS - || item.getType() == Material.DIAMOND_HELMET) - { - item.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, UtilMath.r(4) + 1); - } - - if(item.getType() == Material.DIAMOND_SWORD - || item.getType() == Material.DIAMOND_AXE) - { - item.addEnchantment(Enchantment.DAMAGE_ALL, UtilMath.r(5) + 1); - } - } - - chest.getBlockInventory().setItem(UtilMath.r(27), item); - } - - if (getSupplyBlocks().contains(block)) - { - Bukkit.getPluginManager().callEvent( - new SupplyChestOpenEvent(looter, block)); - } - - getSupplyBlocks().remove(block); - } - - @EventHandler - public void CustomTeamGeneration(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Recruit) - return; - - _players = GetTeamList().get(0); - _players.SetColor(ChatColor.YELLOW); - _players.SetName("Players"); - _players.setDisplayName(C.cYellow + C.Bold + "Players"); + super(manager); } @Override - @EventHandler - public void ScoreboardUpdate(UpdateEvent event) + public void setupLoot() { - if (event.getType() != UpdateType.FAST) - return; + // Food + getBaseLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3)); + getBaseLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2)); + getBaseLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2)); + getBaseLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1)); + getBaseLoot().addLoot(new RandomItem(Material.APPLE, 30)); - if (GetTeamList().isEmpty()) - return; + // Weapons + getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_AXE, 80)); + getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_SWORD, 70)); - Scoreboard.Reset(); + // Chain armor + getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_BOOTS, 35)); + getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 35)); + getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_HELMET, 35)); + getBaseLoot().addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 35)); - Scoreboard.WriteBlank(); + // Throwable + getBaseLoot().addLoot(new RandomItem(Material.FISHING_ROD, 30)); + getBaseLoot().addLoot(new RandomItem(Material.BOW, 20)); + getBaseLoot().addLoot(new RandomItem(Material.ARROW, 20, 1, 3)); - GameTeam team = GetTeamList().get(0); + // Misc + getBaseLoot().addLoot(new RandomItem(Material.EXP_BOTTLE, 40, 5, 20)); + getBaseLoot().addLoot(new RandomItem(Material.COMPASS, 20)); + getBaseLoot().addLoot(new RandomItem(Material.STICK, 30, 1, 2)); + getBaseLoot().addLoot(new RandomItem(Material.BOAT, 15)); + getBaseLoot().addLoot(new RandomItem(Material.FLINT, 30, 1, 2)); + getBaseLoot().addLoot(new RandomItem(Material.FEATHER, 30, 1, 2)); + getBaseLoot().addLoot(new RandomItem(Material.GOLD_INGOT, 20)); + getBaseLoot().addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack( + Material.TNT, (byte) 0, 1, F.item("Throwing TNT")), 15)); + getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15)); - Scoreboard.Write(C.cGreen + C.Bold + "Time"); - Scoreboard - .Write(UtilTime.convertString(this.getSecondsSinceStart() * 1000, 0, TimeUnit.FIT)); + getSpawnLoot().cloneLoot(getBaseLoot()); - Scoreboard.WriteBlank(); + // Food + getSpawnLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5)); + getSpawnLoot().addLoot(new RandomItem(Material.CAKE, 30)); + getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1)); + getSpawnLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3)); + getSpawnLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3)); + getSpawnLoot().addLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6)); + getSpawnLoot().addLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3)); + getSpawnLoot().addLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3)); + getSpawnLoot().addLoot(new RandomItem(Material.APPLE, 30, 2, 6)); - Scoreboard.Write(C.cYellow + C.Bold + "Tributes"); - if (team.GetPlayers(true).size() > 7) - { - Scoreboard.Write("" + team.GetPlayers(true).size()); - } - else - { - for (Player player : team.GetPlayers(true)) - { - Scoreboard.Write(C.cWhite + player.getName()); - } - } + // Loot for chests in spawn + // Weaponry and ores + getSpawnLoot().addLoot(new RandomItem(Material.DIAMOND_SWORD, 30)); + getSpawnLoot().addLoot(new RandomItem(Material.DIAMOND_AXE, 30)); + getSpawnLoot().addLoot(new RandomItem(Material.DIAMOND, 30, 3, 6)); - Scoreboard.WriteBlank(); + // Supply crate loot + // Diamond gear + getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_HELMET, 30)); + getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 30)); + getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 30)); + getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_BOOTS, 30)); - if (this.getChestRefillTime() > 0 && this.getDeathMatchTime() > 60) - { - Scoreboard.Write(C.cGold + C.Bold + "Chest Refill"); - Scoreboard.Write( - UtilTime.convertString(this.getChestRefillTime() * 1000, 0, TimeUnit.FIT)); - } - else if (this.getDeathMatchTime() > 0) - { - Scoreboard.Write(C.cRed + C.Bold + "Deathmatch"); - Scoreboard - .Write(UtilTime - .convertString( - Math.min(this.getDeathMatchTime(), - this.isDeathMatchTeleported() ? 10 - : this.getDeathMatchTime()) - * 1000, - 0, TimeUnit.FIT)); - } - else - { - Scoreboard.Write(C.cRed + C.Bold + "Game End"); - Scoreboard.Write(UtilTime.convertString(Math.max(0, this.getGameEndTime()) * 1000, 0, - TimeUnit.FIT)); - } + // Weapons + getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_SWORD, 24)); + getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_AXE, 16)); - Scoreboard.Draw(); + // Cooked furnace + getFurnace().addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2)); + getFurnace() + .addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); + getFurnace().addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2)); + getFurnace().addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2)); + getFurnace().addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1)); + getFurnace().addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1)); + getFurnace().addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1)); + + // Raw furnace + getRawFurnace().addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3)); + getRawFurnace().addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3)); + getRawFurnace().addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3)); + getRawFurnace().addLoot(new RandomItem(Material.PORK, 1, 1, 3)); + getRawFurnace().addLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3)); + + // Deathmatch Loot + getDeathMatch().addLoot(new RandomItem(Material.PUMPKIN_PIE, 4)); + getDeathMatch().addLoot(new RandomItem(Material.BAKED_POTATO, 4)); + getDeathMatch().addLoot(new RandomItem(Material.CAKE, 4)); + getDeathMatch().addLoot(new RandomItem(Material.APPLE, 4)); + getDeathMatch().addLoot(new RandomItem(Material.DIAMOND_AXE, 3)); + getDeathMatch().addLoot(new RandomItem(Material.DIAMOND_SWORD, 3)); } - @Override - public void EndCheck() - { - if (!IsLive()) - return; - - if (GetPlayers(true).size() <= 1) - { - ArrayList places = GetTeamList().get(0).GetPlacements(true); - - //Announce - AnnounceEnd(places); - - //Gems - if (places.size() >= 1) - AddGems(places.get(0), 20, "1st Place", false, false); - - if (places.size() >= 2) - AddGems(places.get(1), 15, "2nd Place", false, false); - - if (places.size() >= 3) - AddGems(places.get(2), 10, "3rd Place", false, false); - - for (Player player : GetPlayers(false)) - if (player.isOnline()) - AddGems(player, 10, "Participation", false, false); - - //End - SetState(GameState.End); - } - } - - @Override - public List getWinners() - { - if (GetState().ordinal() >= GameState.End.ordinal()) - { - List places = GetTeamList().get(0).GetPlacements(true); - - if (places.isEmpty() || !places.get(0).isOnline()) - return Arrays.asList(); - else - return Arrays.asList(places.get(0)); - } - else - return null; - } - - @Override - public List getLosers() - { - List winners = getWinners(); - - if (winners == null) - return null; - - List losers = GetTeamList().get(0).GetPlayers(false); - - losers.removeAll(winners); - - return losers; - } @Override public String GetMode() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 9f9514f1b..f42afb666 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -389,7 +389,7 @@ public class UHC extends TeamGame // Timings TimingManager.startTotal("UHC Generation"); - + for (int i = 0; i < _chunksPerTick ; i++) { // Unload Previous diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java index 102df5fac..67bcb63fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/modes/GodBattles.java @@ -6,12 +6,16 @@ import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.games.uhc.UHC; /** @@ -62,6 +66,18 @@ public class GodBattles extends UHC } } } + + @EventHandler + public void givePickaxe(GameStateChangeEvent event) + { + if(event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + player.getInventory().addItem(UtilItem.makeUnbreakable(new ItemStack(Material.DIAMOND_PICKAXE))); + } + } @Override public void setOreType(ArrayList blocks) @@ -69,9 +85,19 @@ public class GodBattles extends UHC Material ore = _ores.get(UtilMath.r(_ores.size())); for (Block block : blocks) { - block.setType(ore); + if(block.getType() != Material.DIAMOND_ORE && block.getType() != Material.GOLD_ORE) + { + if(!UtilBlock.isVisible(block)) + block.setType(ore); + } } } + + @Override + public boolean isOre(Block block) + { + return (block.getType() == Material.COAL_ORE || block.getType() == Material.REDSTONE_ORE || block.getType() == Material.IRON_ORE || block.getType() == Material.GOLD_ORE || block.getType() == Material.DIAMOND_ORE); + } @Override public String GetMode()