From 1b3d7f1c209c467b458e5d74442376fd1e1b6234 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 8 Jul 2015 23:57:48 -0400 Subject: [PATCH 01/37] Fixed and added things --- .../src/mineplex/core/game/GameDisplay.java | 1 + .../src/nautilus/game/arcade/GameType.java | 4 +- .../game/games/lobbers/BombLobbers.java | 169 ++++++++++++++++++ .../game/games/lobbers/kits/KitCannoneer.java | 35 ++++ .../lobbers/kits/perks/PerkCraftman.java | 49 +++++ 5 files changed, 257 insertions(+), 1 deletion(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 196b046e2..c5230d28f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -27,6 +27,7 @@ public enum GameDisplay HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), + Lobbers("Bomb Lobbers", Material.TNT, (byte) 0, GameCategory.ARCADE, 53), Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug 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 fe73d8673..b2b8e3d40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -26,6 +26,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.hideseek.HideSeek; import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; import nautilus.game.arcade.game.games.horsecharge.Horse; +import nautilus.game.arcade.game.games.lobbers.BombLobbers; import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.minestrike.MineStrike; @@ -84,6 +85,7 @@ public enum GameType HideSeek(HideSeek.class, GameDisplay.HideSeek), HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall), Horse(Horse.class, GameDisplay.Horse), + Lobbers(BombLobbers.class, GameDisplay.Lobbers), Micro(Micro.class, GameDisplay.Micro), MilkCow(MilkCow.class, GameDisplay.MilkCow), MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/file/c/assets.zip", true),// Temp set to CHAMPIONS to fix UI bug @@ -112,7 +114,7 @@ public enum GameType TurfWars(TurfForts.class, GameDisplay.TurfWars), UHC(UHC.class, GameDisplay.UHC), WitherAssault(WitherGame.class, GameDisplay.WitherAssault), - Wizards(Wizards.class, GameDisplay.Barbarians.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true), + Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true), ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival), Build(Build.class, GameDisplay.Build), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java new file mode 100644 index 000000000..1a2b6aa02 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -0,0 +1,169 @@ +package nautilus.game.arcade.game.games.lobbers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +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.TeamGame; +import nautilus.game.arcade.game.games.lobbers.kits.KitCannoneer; +import nautilus.game.arcade.kit.Kit; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class BombLobbers extends TeamGame +{ + private NautHashMap _averageSpawns = new NautHashMap(); + + private NautHashMap _throwers = new NautHashMap(); + private NautHashMap _teams = new NautHashMap(); + + private List _allowed = new ArrayList(); + + public BombLobbers(ArcadeManager manager) + { + super(manager, GameType.Lobbers, new Kit[] + { + new KitCannoneer(manager) + }, new String[] + { + "Throw TNT to blow up your enemies!", + "Click with TNT to throw" + }); + + DamagePvP = false; + DamageSelf = false; + + WorldWaterDamage = 5; + + PrepareFreeze = false; + + TeamArmor = true; + TeamArmorHotbar = true; + } + + @EventHandler + public void loadTeamLocations(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Live) + { + for (GameTeam team : _teamList) + { + _averageSpawns.put(team, UtilAlg.getAverageLocation(team.GetSpawns())); + } + } + } + + //Skywars code + @EventHandler + public void throwTNT(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + Player player = event.getPlayer(); + + if (!IsAlive(player)) + return; + + if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.TNT, (byte) 0, 1); + UtilInv.Update(player); + + TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()),TNTPrimed.class); + + UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); + + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); + + _throwers.put(tnt, player.getName()); + _teams.put(tnt, GetTeam(player)); + } + + @EventHandler(priority = EventPriority.HIGH) + public void onTNTExplode(ExplosionPrimeEvent event) + { + if (!IsLive()) + return; + + if (!(event.getEntity() instanceof TNTPrimed)) + return; + + TNTPrimed tnt = (TNTPrimed) event.getEntity(); + + if (!_throwers.containsKey(tnt)) + return; + + Player thrower = UtilPlayer.searchExact(_throwers.get(tnt)); + + if (thrower == null) + { + if (_teams.get(tnt).IsTeamAlive()) + { + thrower = _teams.get(tnt).GetPlayers(true).get(0); + } + else + { + event.setCancelled(true); + + event.getEntity().remove(); + return; + } + } + + GameTeam throwerTeam = GetTeam(thrower); + GameTeam throwerSide = getSide(tnt.getLocation()); + + if (throwerTeam.GetName().equalsIgnoreCase(throwerSide.GetName())) + { + event.setCancelled(true); + + event.getEntity().remove(); + return; + } + + _allowed.add(thrower); + _throwers.remove(tnt); + _teams.remove(tnt); + + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 8)) + { + if (Manager.canHurt(thrower, other)) + { + Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); + } + } + } + + private GameTeam getSide(Location entityLoc) + { + Location nearest = UtilAlg.findClosest(entityLoc, new ArrayList(_averageSpawns.values())); + for (Entry entry : _averageSpawns.entrySet()) + { + if (entry.getValue().equals(nearest)) + return entry.getKey(); + } + return null; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java new file mode 100644 index 000000000..892a06285 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.lobbers.kits; + +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitCannoneer extends Kit +{ + + public KitCannoneer(ArcadeManager manager) + { + super(manager, "Cannoneer", KitAvailability.Free, 0, new String[] + { + "Once the ammunitions expert for", + "pirates, explosives are his specialty." + }, new Perk[] + { + new PerkCraftman() + }, EntityType.ZOMBIE, new ItemBuilder(Material.TNT).build()); + } + + @Override + public void GiveItems(Player player) + { + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java new file mode 100644 index 000000000..b6d74ff5b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.lobbers.kits.perks; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PerkCraftman extends Perk +{ + private Recharge _recharge; + + public PerkCraftman() + { + super("Craftman", new String[] + { + C.cGray + "Recieve 1 TNT every 2 seconds. Maximum of 4." + }); + + _recharge = Recharge.Instance; + } + + @EventHandler + public void give(UpdateEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!_recharge.usable(player, "TNT Give")) + continue; + + _recharge.use(player, "TNT Give", 2000, false, false); + + //Has 4 + if (UtilInv.contains(player, Material.TNT, (byte) 0, 4)) + continue; + + UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(C.cGreen + "Throwing TNT").build()); + } + } + +} From 9e07be51c7fdb49512dc0ec6e6f98848ad512650 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 9 Jul 2015 12:03:56 -0400 Subject: [PATCH 02/37] Bug fixes --- .../game/games/lobbers/BombLobbers.java | 113 +++++++++++++++++- .../{KitCannoneer.java => KitJumper.java} | 13 +- .../lobbers/kits/perks/PerkCraftman.java | 16 ++- 3 files changed, 132 insertions(+), 10 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/{KitCannoneer.java => KitJumper.java} (66%) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 1a2b6aa02..abb1e9fb6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -1,29 +1,42 @@ package nautilus.game.arcade.game.games.lobbers; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; 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.TeamGame; -import nautilus.game.arcade.game.games.lobbers.kits.KitCannoneer; +import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; import nautilus.game.arcade.kit.Kit; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -40,7 +53,7 @@ public class BombLobbers extends TeamGame { super(manager, GameType.Lobbers, new Kit[] { - new KitCannoneer(manager) + new KitJumper(manager) }, new String[] { "Throw TNT to blow up your enemies!", @@ -56,6 +69,11 @@ public class BombLobbers extends TeamGame TeamArmor = true; TeamArmorHotbar = true; + + InventoryOpenChest = false; + InventoryOpenBlock = false; + + HungerSet = 20; } @EventHandler @@ -70,10 +88,12 @@ public class BombLobbers extends TeamGame } } - //Skywars code @EventHandler public void throwTNT(PlayerInteractEvent event) { + if (event.getAction() == Action.PHYSICAL) + return; + if (!IsLive()) return; @@ -154,7 +174,94 @@ public class BombLobbers extends TeamGame } } } + + //Doesn't seem to work for some reason + @EventHandler + public void removeLiquids(EntityExplodeEvent event) + { + System.out.println("EXPLOSION EVENT CALLED FROM ENTITYEXPLODEEVENT"); + if (!IsLive()) + return; + + Iterator iterator = event.blockList().iterator(); + + while (iterator.hasNext()) + { + if (iterator.next().isLiquid()) + { + System.out.println("REMOVED A LIQUID FROM THE EXPLOSION"); + iterator.remove(); + } + } + } + + @EventHandler + public void removeLiquids2(ExplosionEvent event) + { + System.out.println("EXPLOSION EVENT CALLED FROM EXPLOSIONEVENT"); + if (!IsLive()) + return; + + Iterator iterator = event.GetBlocks().iterator(); + + while (iterator.hasNext()) + { + if (iterator.next().isLiquid()) + { + System.out.println("REMOVED A LIQUID FROM THE EXPLOSION"); + + iterator.remove(); + } + } + } + + @EventHandler + public void updateParticles(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + for (Entry tnt : _teams.entrySet()) + { + if (tnt.getKey() != null && tnt.getKey().isValid() && !tnt.getKey().isOnGround()) + { + if (tnt.getValue().GetColor() == ChatColor.AQUA) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), -1, -1, 1, 1, 0, + ViewDist.LONG, UtilServer.getPlayers()); + } + else + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), 0.0F, 0.0F, 0.0F, 0.0F, 3, ViewDist.LONG, UtilServer.getPlayers()); + } + } + } + } + + @EventHandler + public void preventCheating(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + for (Player player : GetPlayers(true)) + { + if (GetTeam(player) != getSide(player.getLocation())) + { + player.damage(500); + UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!")); + continue; + } + } + } + private GameTeam getSide(Location entityLoc) { Location nearest = UtilAlg.findClosest(entityLoc, new ArrayList(_averageSpawns.values())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java similarity index 66% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java index 892a06285..ad38caeb1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitCannoneer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java @@ -6,22 +6,23 @@ import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -public class KitCannoneer extends Kit +public class KitJumper extends Kit { - public KitCannoneer(ArcadeManager manager) + public KitJumper(ArcadeManager manager) { - super(manager, "Cannoneer", KitAvailability.Free, 0, new String[] + super(manager, "Jumper", KitAvailability.Free, 0, new String[] { - "Once the ammunitions expert for", - "pirates, explosives are his specialty." + "Use your jumping abilities to leap away from trouble!" }, new Perk[] { + new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true), new PerkCraftman() }, EntityType.ZOMBIE, new ItemBuilder(Material.TNT).build()); } @@ -32,4 +33,4 @@ public class KitCannoneer extends Kit } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java index b6d74ff5b..26b0b6e28 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -36,7 +36,7 @@ public class PerkCraftman extends Perk if (!_recharge.usable(player, "TNT Give")) continue; - _recharge.use(player, "TNT Give", 2000, false, false); + _recharge.use(player, "TNT Give", rechargeSeconds(), false, false); //Has 4 if (UtilInv.contains(player, Material.TNT, (byte) 0, 4)) @@ -45,5 +45,19 @@ public class PerkCraftman extends Perk UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(C.cGreen + "Throwing TNT").build()); } } + + public long rechargeSeconds() + { + if (!Manager.GetGame().IsLive()) + return 0; + + if (Manager.GetGame().getGameLiveTime() > 60000) + return 2000; + + if (Manager.GetGame().getGameLiveTime() > 30000) + return 3000; + + return 4000; + } } From f812fd0530fc3f5c0729c8e3060c72ea08c39589 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 10 Jul 2015 16:31:37 -0400 Subject: [PATCH 03/37] Please push please --- .../game/games/lobbers/BombLobbers.java | 100 +++++--------- .../games/lobbers/events/TNTThrowEvent.java | 37 ++++++ .../game/games/lobbers/kits/KitDetonator.java | 124 ++++++++++++++++++ .../game/games/lobbers/kits/KitJumper.java | 2 +- .../lobbers/kits/perks/PerkCraftman.java | 28 ++-- 5 files changed, 202 insertions(+), 89 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTThrowEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index abb1e9fb6..026ac13a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -1,8 +1,6 @@ package nautilus.game.arcade.game.games.lobbers; import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import java.util.Map.Entry; import mineplex.core.common.util.F; @@ -15,7 +13,6 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.explosion.ExplosionEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -23,6 +20,8 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; +import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator; import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; import nautilus.game.arcade.kit.Kit; @@ -30,15 +29,13 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.metadata.FixedMetadataValue; public class BombLobbers extends TeamGame { @@ -46,14 +43,13 @@ public class BombLobbers extends TeamGame private NautHashMap _throwers = new NautHashMap(); private NautHashMap _teams = new NautHashMap(); - - private List _allowed = new ArrayList(); - + public BombLobbers(ArcadeManager manager) { super(manager, GameType.Lobbers, new Kit[] { - new KitJumper(manager) + new KitJumper(manager), + new KitDetonator(manager) }, new String[] { "Throw TNT to blow up your enemies!", @@ -73,6 +69,12 @@ public class BombLobbers extends TeamGame InventoryOpenChest = false; InventoryOpenBlock = false; + ItemDrop = false; + + BlockPlace = false; + + Manager.GetExplosion().SetLiquidDamage(false); + HungerSet = 20; } @@ -107,20 +109,25 @@ public class BombLobbers extends TeamGame event.setCancelled(true); + UtilInv.remove(player, Material.TNT, (byte) 0, 1); UtilInv.Update(player); TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()),TNTPrimed.class); + tnt.setFuseTicks(60); + tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); - + _throwers.put(tnt, player.getName()); _teams.put(tnt, GetTeam(player)); + + Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); } - @EventHandler(priority = EventPriority.HIGH) + @EventHandler public void onTNTExplode(ExplosionPrimeEvent event) { if (!IsLive()) @@ -138,17 +145,13 @@ public class BombLobbers extends TeamGame if (thrower == null) { - if (_teams.get(tnt).IsTeamAlive()) - { - thrower = _teams.get(tnt).GetPlayers(true).get(0); - } - else - { - event.setCancelled(true); + event.setCancelled(true); - event.getEntity().remove(); - return; - } + _throwers.remove(tnt); + _teams.remove(tnt); + + event.getEntity().remove(); + return; } GameTeam throwerTeam = GetTeam(thrower); @@ -158,61 +161,20 @@ public class BombLobbers extends TeamGame { event.setCancelled(true); + _throwers.remove(tnt); + _teams.remove(tnt); + event.getEntity().remove(); + return; } - _allowed.add(thrower); _throwers.remove(tnt); _teams.remove(tnt); - for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 8)) + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) { - if (Manager.canHurt(thrower, other)) - { - Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); - } - } - } - - //Doesn't seem to work for some reason - @EventHandler - public void removeLiquids(EntityExplodeEvent event) - { - System.out.println("EXPLOSION EVENT CALLED FROM ENTITYEXPLODEEVENT"); - if (!IsLive()) - return; - - Iterator iterator = event.blockList().iterator(); - - while (iterator.hasNext()) - { - if (iterator.next().isLiquid()) - { - System.out.println("REMOVED A LIQUID FROM THE EXPLOSION"); - - iterator.remove(); - } - } - } - - @EventHandler - public void removeLiquids2(ExplosionEvent event) - { - System.out.println("EXPLOSION EVENT CALLED FROM EXPLOSIONEVENT"); - if (!IsLive()) - return; - - Iterator iterator = event.GetBlocks().iterator(); - - while (iterator.hasNext()) - { - if (iterator.next().isLiquid()) - { - System.out.println("REMOVED A LIQUID FROM THE EXPLOSION"); - - iterator.remove(); - } + Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTThrowEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTThrowEvent.java new file mode 100644 index 000000000..b6bebee11 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTThrowEvent.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.games.lobbers.events; + +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class TNTThrowEvent extends PlayerEvent +{ + private static final HandlerList _handlers = new HandlerList(); + + private TNTPrimed _tnt; + + public TNTThrowEvent(Player thrower, TNTPrimed tnt) + { + super(thrower); + + _tnt = tnt; + } + + public TNTPrimed getTNT() + { + return _tnt; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java new file mode 100644 index 000000000..9cde3f12f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -0,0 +1,124 @@ +package nautilus.game.arcade.game.games.lobbers.kits; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +public class KitDetonator extends Kit +{ + + public KitDetonator(ArcadeManager manager) + { + super(manager, "Detonator", KitAvailability.Free, 0, new String[] + { + "He doesn't like to wait.", + "", + C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Fuse Time.", + C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time." + }, new Perk[] + { + new PerkCraftman() + }, EntityType.ZOMBIE, + new ItemBuilder(Material.LEVER).build()); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(2).build()); + } + + @EventHandler + public void setFuse(TNTThrowEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!HasKit(event.getPlayer())) + return; + + ItemStack lever = event.getPlayer().getInventory().getItem(1); + + if (lever == null || lever.getType() == Material.AIR) + { + GiveItems(event.getPlayer()); + } + else + { + if (lever.getAmount() <= 0 || lever.getAmount() > 3) + { + GiveItems(event.getPlayer()); + } + else + { + event.getTNT().setFuseTicks(lever.getAmount() * 20); + } + } + } + + @EventHandler + public void changeFuse(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (!HasKit(event.getPlayer())) + return; + + if (event.getItem().getType() != Material.LEVER) + return; + + ItemStack lever = event.getPlayer().getInventory().getItem(1); + + if (lever.getAmount() <= 0 || lever.getAmount() > 3) + { + GiveItems(event.getPlayer()); + return; + } + + //Right + if (event.getAction().toString().contains("RIGHT")) + { + if (lever.getAmount() == 3) + { + return; + } + lever.setAmount(lever.getAmount() + 1); + UtilInv.Update(event.getPlayer()); + } + //Left + else + { + if (lever.getAmount() == 1) + { + return; + } + lever.setAmount(lever.getAmount() - 1); + UtilInv.Update(event.getPlayer()); + } + + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CLICK, 3.0F, 1.0F); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java index ad38caeb1..4b97e2985 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java @@ -24,7 +24,7 @@ public class KitJumper extends Kit { new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true), new PerkCraftman() - }, EntityType.ZOMBIE, new ItemBuilder(Material.TNT).build()); + }, EntityType.ZOMBIE, new ItemBuilder(Material.IRON_AXE).build()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java index 26b0b6e28..b99b833ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.lobbers.kits.perks; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.recharge.Recharge; @@ -8,6 +9,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -19,7 +21,7 @@ public class PerkCraftman extends Perk { super("Craftman", new String[] { - C.cGray + "Recieve 1 TNT every 2 seconds. Maximum of 4." + C.cGray + "Recieve 1 TNT every 2 seconds. Maximum of 3." }); _recharge = Recharge.Instance; @@ -35,29 +37,17 @@ public class PerkCraftman extends Perk { if (!_recharge.usable(player, "TNT Give")) continue; - - _recharge.use(player, "TNT Give", rechargeSeconds(), false, false); + + _recharge.use(player, "TNT Give", Manager.GetGame().getGameLiveTime() >= 60000 ? 3000 : (Manager.GetGame().getGameLiveTime() >= 3000 ? 4000 : 5000), false, false); //Has 4 - if (UtilInv.contains(player, Material.TNT, (byte) 0, 4)) + if (UtilInv.contains(player, Material.TNT, (byte) 0, 3)) continue; - UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(C.cGreen + "Throwing TNT").build()); + UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).build()); + + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 3.0F, 1.0F); } } - - public long rechargeSeconds() - { - if (!Manager.GetGame().IsLive()) - return 0; - - if (Manager.GetGame().getGameLiveTime() > 60000) - return 2000; - - if (Manager.GetGame().getGameLiveTime() > 30000) - return 3000; - - return 4000; - } } From d0180910e9953b5ee647d0baccbf443c22d33527 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 11 Jul 2015 10:25:04 -0400 Subject: [PATCH 04/37] Added two new kits. --- .../game/games/lobbers/BombLobbers.java | 16 +- .../game/games/lobbers/kits/KitArmorer.java | 53 ++++++ .../game/games/lobbers/kits/KitDetonator.java | 44 +++-- .../game/games/lobbers/kits/KitJumper.java | 9 +- .../game/games/lobbers/kits/KitWaller.java | 37 ++++ .../games/lobbers/kits/perks/PerkWaller.java | 162 ++++++++++++++++++ 6 files changed, 289 insertions(+), 32 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 026ac13a3..cbdc955e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -21,8 +21,10 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; +import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer; import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator; import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; +import nautilus.game.arcade.game.games.lobbers.kits.KitWaller; import nautilus.game.arcade.kit.Kit; import org.bukkit.ChatColor; @@ -49,14 +51,15 @@ public class BombLobbers extends TeamGame super(manager, GameType.Lobbers, new Kit[] { new KitJumper(manager), - new KitDetonator(manager) + new KitArmorer(manager), + new KitDetonator(manager), + new KitWaller(manager) }, new String[] { "Throw TNT to blow up your enemies!", "Click with TNT to throw" }); - DamagePvP = false; DamageSelf = false; WorldWaterDamage = 5; @@ -73,6 +76,8 @@ public class BombLobbers extends TeamGame BlockPlace = false; + DamageFall = true; + Manager.GetExplosion().SetLiquidDamage(false); HungerSet = 20; @@ -153,11 +158,8 @@ public class BombLobbers extends TeamGame event.getEntity().remove(); return; } - - GameTeam throwerTeam = GetTeam(thrower); - GameTeam throwerSide = getSide(tnt.getLocation()); - if (throwerTeam.GetName().equalsIgnoreCase(throwerSide.GetName())) + if (GetTeam(thrower) == getSide(tnt.getLocation())) { event.setCancelled(true); @@ -172,7 +174,7 @@ public class BombLobbers extends TeamGame _throwers.remove(tnt); _teams.remove(tnt); - for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 5)) { Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java new file mode 100644 index 000000000..de1651826 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.games.lobbers.kits; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class KitArmorer extends Kit +{ + + public KitArmorer(ArcadeManager manager) + { + super(manager, "Armorer", KitAvailability.Free, 0, new String[] + { + "He uses his expert armor-making", + "skills to block excess damage!", + "", + C.cGray + "Recieve " + C.cYellow + "Full Gold Armor" + }, new Perk[] + { + new PerkCraftman() + }, EntityType.ZOMBIE, + new ItemStack(Material.AIR)); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build()); + player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build()); + } + + @Override + public void SpawnCustom(LivingEntity ent) + { + ent.getEquipment().setHelmet(new ItemBuilder(Material.GOLD_HELMET).build()); + ent.getEquipment().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).build()); + ent.getEquipment().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).build()); + ent.getEquipment().setBoots(new ItemBuilder(Material.GOLD_BOOTS).build()); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java index 9cde3f12f..6c8c3768f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; @@ -14,9 +16,9 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; @@ -37,12 +39,18 @@ public class KitDetonator extends Kit }, EntityType.ZOMBIE, new ItemBuilder(Material.LEVER).build()); } - + @Override public void GiveItems(Player player) { player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(2).build()); } + + @Override + public void SpawnCustom(LivingEntity ent) + { + + } @EventHandler public void setFuse(TNTThrowEvent event) @@ -75,9 +83,6 @@ public class KitDetonator extends Kit @EventHandler public void changeFuse(PlayerInteractEvent event) { - if (event.getAction() == Action.PHYSICAL) - return; - if (!Manager.GetGame().IsLive()) return; @@ -87,38 +92,29 @@ public class KitDetonator extends Kit if (!HasKit(event.getPlayer())) return; - if (event.getItem().getType() != Material.LEVER) + if (!UtilInv.IsItem(event.getItem(), Material.LEVER, (byte) 0)) return; - ItemStack lever = event.getPlayer().getInventory().getItem(1); - - if (lever.getAmount() <= 0 || lever.getAmount() > 3) - { - GiveItems(event.getPlayer()); - return; - } + int amount = event.getPlayer().getInventory().getItem(1).getAmount(); //Right - if (event.getAction().toString().contains("RIGHT")) + if (UtilEvent.isAction(event, ActionType.R)) { - if (lever.getAmount() == 3) - { + if (amount >= 3) return; - } - lever.setAmount(lever.getAmount() + 1); + + UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).build()); UtilInv.Update(event.getPlayer()); } //Left - else + else if (UtilEvent.isAction(event, ActionType.L)) { - if (lever.getAmount() == 1) - { + if (amount <= 1) return; - } - lever.setAmount(lever.getAmount() - 1); + + UtilInv.remove(event.getPlayer(), Material.LEVER, (byte) 0, 1); UtilInv.Update(event.getPlayer()); } - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CLICK, 3.0F, 1.0F); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java index 4b97e2985..20e73f9cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java @@ -10,6 +10,7 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; public class KitJumper extends Kit @@ -30,7 +31,13 @@ public class KitJumper extends Kit @Override public void GiveItems(Player player) { - + + } + + @Override + public void SpawnCustom(LivingEntity ent) + { + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java new file mode 100644 index 000000000..b427930a1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.games.lobbers.kits; + +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkWaller; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitWaller extends Kit +{ + + public KitWaller(ArcadeManager manager) + { + super(manager, "Waller", KitAvailability.Free, 0, new String[] + { + "When the times get tough,", + "build yourself a wall!" + }, new Perk[] + { + new PerkWaller() + }, EntityType.ZOMBIE, + new ItemBuilder(Material.SMOOTH_BRICK).setUnbreakable(true).build()); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().setItem(1, new ItemBuilder(Material.STONE_SPADE).setAmount(3).setTitle(F.item("Wall Builder")).build()); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java new file mode 100644 index 000000000..187ab2a49 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -0,0 +1,162 @@ +package nautilus.game.arcade.game.games.lobbers.kits.perks; + +import java.util.HashSet; +import java.util.Set; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkWaller extends Perk +{ + private BlockFace[] axis = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }; + + private Set _tnt = new HashSet(); + + private Set _wallBlocks = new HashSet(); + + public PerkWaller() + { + super("Waller", new String[] + { + C.cYellow + "Click Block" + C.cGray + " with shovel to " + C.cGreen + "Place Wall", + C.cGray + "Walls can absorb 1 hit before breaking.", + C.cGray + "TNT that touches a wall will explode instantly." + }); + } + + @EventHandler + public void onThrow(TNTThrowEvent event) + { + _tnt.add(event.getTNT()); + } + + @EventHandler + public void onExplode(EntityExplodeEvent event) + { + if (_tnt.contains(event.getEntity())) + { + _tnt.remove(event.getEntity()); + } + } + + @EventHandler + public void onPlace(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (!Kit.HasKit(event.getPlayer())) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.STONE_SPADE, (byte) 0)) + return; + + _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw(), getFace(event.getPlayer().getLocation().getYaw()))); + } + + @SuppressWarnings("deprecation") + @EventHandler + public void explode(ExplosionEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + for (Block block : event.GetBlocks()) + { + if (_wallBlocks.contains(block.getLocation())) + { + if (block.getData() != 2) + { + block.setData((byte) 2); + } + } + } + } + + @EventHandler + public void explodeTNT(UpdateEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (event.getType() != UpdateType.FAST) + return; + + for (TNTPrimed tnt : _tnt) + { + for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 1.5F).keySet()) + { + if (_wallBlocks.contains(near.getLocation())) + { + tnt.setFuseTicks(0); + } + } + } + } + + private Set buildWall(final Location source, final float playerYaw, final BlockFace facing) + { + Set allWallBlocks = new HashSet(); + Set baseWallBlocks = new HashSet(); + + Location centerWallBlock = source.getBlock().getRelative(facing).getRelative(BlockFace.UP).getLocation(); + + float leftYaw = playerYaw - 90; + float rightYaw = playerYaw + 90; + + BlockFace leftSide = getFace(leftYaw); + BlockFace rightSide = getFace(rightYaw); + + baseWallBlocks.add(centerWallBlock.getBlock().getRelative(leftSide).getRelative(leftSide).getLocation()); + baseWallBlocks.add(centerWallBlock.getBlock().getRelative(leftSide).getLocation()); + baseWallBlocks.add(centerWallBlock); + baseWallBlocks.add(centerWallBlock.getBlock().getRelative(rightSide).getLocation()); + baseWallBlocks.add(centerWallBlock.getBlock().getRelative(rightSide).getRelative(rightSide).getLocation()); + + for (Location base : baseWallBlocks) + { + for (int height = 0 ; height < 3 ; height++) + { + allWallBlocks.add(base.clone().add(0, height, 0)); + } + } + for (Location block : allWallBlocks) + { + block.getBlock().setType(Material.SMOOTH_BRICK); + block.getWorld().playEffect(block, Effect.STEP_SOUND, 1.0F); + } + return allWallBlocks; + } + + private BlockFace getFace(float yaw) + { + if (yaw < 0) + yaw = yaw * (-1); + + return axis[Math.round(yaw / 90F) & 0x3]; + } +} From 616c444c16d0bc7f595b93eb907d146a0e6c66dc Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 12 Jul 2015 18:15:33 -0400 Subject: [PATCH 05/37] Added some things and stuff --- .../game/games/lobbers/BombLobbers.java | 11 ++++++-- .../game/games/lobbers/kits/KitArmorer.java | 20 +++++++++++-- .../games/lobbers/kits/perks/PerkWaller.java | 28 +++++++++++++------ 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index cbdc955e4..822efa06e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -56,11 +56,16 @@ public class BombLobbers extends TeamGame new KitWaller(manager) }, new String[] { - "Throw TNT to blow up your enemies!", - "Click with TNT to throw" + "Fight against your enemies using", + "the power of explosives!", + "", + "Left click TNT to throw at your enemy.", + "Last team alive wins!", + "Kaboom!" }); DamageSelf = false; + DamageTeamSelf = false; WorldWaterDamage = 5; @@ -174,7 +179,7 @@ public class BombLobbers extends TeamGame _throwers.remove(tnt); _teams.remove(tnt); - for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 5)) + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) { Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index de1651826..be7f2c64a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; @@ -31,14 +32,23 @@ public class KitArmorer extends Kit }, EntityType.ZOMBIE, new ItemStack(Material.AIR)); } - + @Override - public void GiveItems(Player player) + public void ApplyKit(Player player) { + UtilInv.Clear(player); + + for (Perk perk : GetPerks()) + perk.Apply(player); + + GiveItemsCall(player); + player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build()); player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build()); player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build()); player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build()); + + UtilInv.Update(player); } @Override @@ -50,4 +60,10 @@ public class KitArmorer extends Kit ent.getEquipment().setBoots(new ItemBuilder(Material.GOLD_BOOTS).build()); } + @Override + public void GiveItems(Player player) + { + + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 187ab2a49..211110b66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.lobbers.kits.perks; import java.util.HashSet; +import java.util.Iterator; import java.util.Set; import mineplex.core.common.util.C; @@ -75,7 +76,9 @@ public class PerkWaller extends Perk if (!UtilInv.IsItem(event.getItem(), Material.STONE_SPADE, (byte) 0)) return; - _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw(), getFace(event.getPlayer().getLocation().getYaw()))); + UtilInv.remove(event.getPlayer(), Material.STONE_SPADE, (byte) 0, 1); + + _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw())); } @SuppressWarnings("deprecation") @@ -85,13 +88,18 @@ public class PerkWaller extends Perk if (!Manager.GetGame().IsLive()) return; - for (Block block : event.GetBlocks()) + Iterator iterator = event.GetBlocks().iterator(); + + while (iterator.hasNext()) { + Block block = iterator.next(); + if (_wallBlocks.contains(block.getLocation())) { if (block.getData() != 2) { block.setData((byte) 2); + iterator.remove(); } } } @@ -108,7 +116,7 @@ public class PerkWaller extends Perk for (TNTPrimed tnt : _tnt) { - for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 1.5F).keySet()) + for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 2.0F).keySet()) { if (_wallBlocks.contains(near.getLocation())) { @@ -118,8 +126,11 @@ public class PerkWaller extends Perk } } - private Set buildWall(final Location source, final float playerYaw, final BlockFace facing) + @SuppressWarnings("deprecation") + private Set buildWall(final Location source, final float playerYaw) { + BlockFace facing = getFace(playerYaw + 180F); + Set allWallBlocks = new HashSet(); Set baseWallBlocks = new HashSet(); @@ -147,16 +158,15 @@ public class PerkWaller extends Perk for (Location block : allWallBlocks) { block.getBlock().setType(Material.SMOOTH_BRICK); - block.getWorld().playEffect(block, Effect.STEP_SOUND, 1.0F); + block.getBlock().setData((byte) 0); + + block.getWorld().playEffect(block, Effect.STEP_SOUND, block.getBlock().getType()); } return allWallBlocks; } private BlockFace getFace(float yaw) { - if (yaw < 0) - yaw = yaw * (-1); - - return axis[Math.round(yaw / 90F) & 0x3]; + return axis[Math.round(yaw / 90f) & 0x3]; } } From df6065978615de643e472a26cc090fe68afa9932 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 13 Jul 2015 12:14:25 -0400 Subject: [PATCH 06/37] Core edits --- .../game/games/lobbers/BombLobbers.java | 25 ++++++++++++++++++ .../games/lobbers/kits/perks/PerkWaller.java | 26 ------------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 822efa06e..89b3fe351 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.lobbers; import java.util.ArrayList; +import java.util.Iterator; import java.util.Map.Entry; import mineplex.core.common.util.F; @@ -13,6 +14,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.explosion.ExplosionEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -31,6 +33,7 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; @@ -231,6 +234,28 @@ public class BombLobbers extends TeamGame } } + + @SuppressWarnings("deprecation") + @EventHandler + public void damageBlocks(ExplosionEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + Iterator iterator = event.GetBlocks().iterator(); + + while (iterator.hasNext()) + { + Block block = iterator.next(); + + if (block.getData() == 0) + { + block.setData((byte) 2); + iterator.remove(); + } + } + } + private GameTeam getSide(Location entityLoc) { Location nearest = UtilAlg.findClosest(entityLoc, new ArrayList(_averageSpawns.values())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 211110b66..82c0f2290 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.lobbers.kits.perks; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; import mineplex.core.common.util.C; @@ -9,7 +8,6 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; -import mineplex.core.explosion.ExplosionEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; @@ -81,30 +79,6 @@ public class PerkWaller extends Perk _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw())); } - @SuppressWarnings("deprecation") - @EventHandler - public void explode(ExplosionEvent event) - { - if (!Manager.GetGame().IsLive()) - return; - - Iterator iterator = event.GetBlocks().iterator(); - - while (iterator.hasNext()) - { - Block block = iterator.next(); - - if (_wallBlocks.contains(block.getLocation())) - { - if (block.getData() != 2) - { - block.setData((byte) 2); - iterator.remove(); - } - } - } - } - @EventHandler public void explodeTNT(UpdateEvent event) { From 1e1cf6403deec95f121fb874dc9b481ba6383a01 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 14 Jul 2015 13:31:41 -0400 Subject: [PATCH 07/37] Added achievements --- .../core/achievement/Achievement.java | 46 ++++++ .../core/achievement/AchievementCategory.java | 21 +-- .../game/games/lobbers/BombLobbers.java | 131 ++++++++++++++++-- .../game/games/lobbers/kits/KitArmorer.java | 2 +- .../game/games/lobbers/kits/KitDetonator.java | 6 +- .../game/games/lobbers/kits/KitWaller.java | 2 +- .../games/lobbers/kits/perks/PerkWaller.java | 4 +- .../games/lobbers/trackers/Tracker6Kill.java | 38 +++++ .../lobbers/trackers/TrackerBestTeam.java | 51 +++++++ .../lobbers/trackers/TrackerBlastProof.java | 35 +++++ .../lobbers/trackers/TrackerNoDamage.java | 69 +++++++++ .../lobbers/trackers/TrackerTNTThrown.java | 26 ++++ 12 files changed, 402 insertions(+), 29 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/Tracker6Kill.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBestTeam.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerNoDamage.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerTNTThrown.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index a1d818cca..a058b7496 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -630,6 +630,52 @@ public enum Achievement new String[]{"Kill 2 enemies while blinded from", "a single flashbang"}, new int[]{1}, AchievementCategory.MINE_STRIKE), + + //Bomb Lobbers + BOMB_LOBBERS_WINS("Master Bomber", 1200, + new String[]{"Bomb Lobbers.Wins"}, + new String[]{"Win 100 games of Bomb Lobbers"}, + new int[] {100}, + AchievementCategory.BOMB_LOBBERS), + + BOMB_LOBBERS_PROFESSIONAL_LOBBER("Professional Lobber", 1000, + new String[]{"Bomb Lobbers.Thrown"}, + new String[]{"Throw 2000 TNT"}, + new int[]{2000}, + AchievementCategory.BOMB_LOBBERS), + +// BOMB_LOBBERS_REKT_X3("Rekt x3", 800, +// new String[]{"Bomb Lobbers.3Kill"}, +// new String[]{"Kill 3 players with one explosion"}, +// new int[]{1}, +// AchievementCategory.BOMB_LOBBERS), + + BOMB_LOBBERS_ULTIMATE_KILLER("Ultimate Killer", 800, + new String[]{"Bomb Lobbers.Killer"}, + new String[]{"Kill 6 players in a single game"}, + new int[]{1}, + AchievementCategory.BOMB_LOBBERS), + + BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1000, + new String[]{"Bomb Lobbers.JellySkin"}, + new String[]{"Win a game without taking any damage."}, + new int[]{1}, + AchievementCategory.BOMB_LOBBERS), + + BOMB_LOBBERS_BEST_TEAM("The Best Team", 800, + new String[]{"Bomb Lobbers.BestTeam"}, + new String[]{"Win a game without losing a teammate"}, + new int[]{1}, + AchievementCategory.BOMB_LOBBERS), + + BOMB_LOBBERS_BLAST_PROOF("Blast Proof", 800, + new String[]{"Bomb Lobbers.BlastProof"}, + new String[]{"Win 20 games using Armorer"}, + new int[]{20}, + AchievementCategory.BOMB_LOBBERS) + + +// BOMB_LOBBERS_ ; private String _name; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index d777224ac..bffc840e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -32,11 +32,11 @@ public enum AchievementCategory UHC("Ultra Hardcore", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "Extra Class Skills"), + Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, null), WIZARDS("Wizards", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"), + Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"), CASTLE_SIEGE("Castle Siege", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), @@ -45,7 +45,7 @@ public enum AchievementCategory BLOCK_HUNT("Block Hunt", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.GRASS, 0, GameCategory.CLASSICS, null), + Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"), SMASH_MOBS("Super Smash Mobs", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -57,7 +57,7 @@ public enum AchievementCategory DRAW_MY_THING("Draw My Thing", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, - Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null), + Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"), CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -74,7 +74,7 @@ public enum AchievementCategory DRAGON_ESCAPE("Dragon Escape", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, - Material.DRAGON_EGG, 0, GameCategory.ARCADE, null), + Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit"), SHEEP_QUEST("Sheep Quest", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -86,7 +86,7 @@ public enum AchievementCategory ONE_IN_THE_QUIVER("One in the Quiver", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.BOW, 0, GameCategory.ARCADE, null), + Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"), SUPER_PAINTBALL("Super Paintball", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -110,7 +110,7 @@ public enum AchievementCategory SNAKE("Snake", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.WOOL, 4, GameCategory.ARCADE, null), + Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit"), BACON_BRAWL("Bacon Brawl", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -118,9 +118,12 @@ public enum AchievementCategory MICRO_BATTLE("Micro Battle", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.LAVA, 0, GameCategory.ARCADE, null); + Material.LAVA, 0, GameCategory.ARCADE, null), + + BOMB_LOBBERS("Bomb Lobbers", null, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + Material.TNT, 0, GameCategory.ARCADE, "Waller Kit"); - private String _name; private String[] _statsToPull; private StatDisplay[] _statDisplays; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 89b3fe351..41027947d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -17,6 +17,9 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -27,6 +30,11 @@ import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer; import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator; import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; import nautilus.game.arcade.game.games.lobbers.kits.KitWaller; +import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill; +import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam; +import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBlastProof; +import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage; +import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown; import nautilus.game.arcade.kit.Kit; import org.bukkit.ChatColor; @@ -48,7 +56,10 @@ public class BombLobbers extends TeamGame private NautHashMap _throwers = new NautHashMap(); private NautHashMap _teams = new NautHashMap(); + + private NautHashMap _kills = new NautHashMap(); + @SuppressWarnings("unchecked") public BombLobbers(ArcadeManager manager) { super(manager, GameType.Lobbers, new Kit[] @@ -66,10 +77,8 @@ public class BombLobbers extends TeamGame "Last team alive wins!", "Kaboom!" }); - DamageSelf = false; - DamageTeamSelf = false; - + WorldWaterDamage = 5; PrepareFreeze = false; @@ -83,12 +92,67 @@ public class BombLobbers extends TeamGame ItemDrop = false; BlockPlace = false; - - DamageFall = true; - + Manager.GetExplosion().SetLiquidDamage(false); HungerSet = 20; + + registerStatTrackers(new Tracker6Kill(this), new TrackerBestTeam(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this)); + } + + public void addKill(Player player) + { + _kills.put(player, _kills.containsKey(player) ? _kills.get(player) + 1 : 1); + } + + public void addAssist(Player player) + { + _kills.put(player, _kills.containsKey(player) ? _kills.get(player) + .5 : .5); + } + + public double getKills(Player player) + { + if (_kills.containsKey(player)) + { + return _kills.get(player); + } + else + { + _kills.put(player, 0.0); + return 0; + } + } + + @EventHandler + public void onKill(CombatDeathEvent event) + { + if (!IsLive()) + return; + + Player dead = UtilPlayer.searchExact(((Player) event.GetEvent().getEntity()).getName()); + + if (!IsAlive(dead)) + return; + + for (CombatComponent damager : event.GetLog().GetAttackers()) + { + Player killer = UtilPlayer.searchExact(damager.GetName()); + + if (killer == null || !killer.isOnline()) + continue; + + if (IsAlive(killer)) + { + if (event.GetLog().GetKiller() == damager) + { + addKill(killer); + } + else + { + addAssist(killer); + } + } + } } @EventHandler @@ -234,8 +298,16 @@ public class BombLobbers extends TeamGame } } + @EventHandler + public void nerfTNT(CustomDamageEvent event) + { + if (event.GetCause().toString().contains("EXPLOSION")) + { + event.AddMod("Armor", "Damage Nerf", -(event.GetDamage() * .333), false); + } + } + - @SuppressWarnings("deprecation") @EventHandler public void damageBlocks(ExplosionEvent event) { @@ -248,14 +320,49 @@ public class BombLobbers extends TeamGame { Block block = iterator.next(); - if (block.getData() == 0) - { - block.setData((byte) 2); - iterator.remove(); - } + if (!shouldRemoveFromExplosion(block)) + continue; + + event.GetBlocks().remove(block); } } + //Boolean = remove + @SuppressWarnings("deprecation") + public boolean shouldRemoveFromExplosion(Block block) + { + //Stone + if (block.getTypeId() == 1) + { + block.setTypeId(4); + return false; + } + + //Stone Brick + else if (block.getTypeId() == 98) + { + block.setData((byte) 2); + return false; + } + + //Grass + else if (block.getTypeId() == 2) + { + block.setTypeId(3); + return false; + } + + //Wood Planks + else if (block.getTypeId() == 5) + { + block.setData((byte) 2); + return false; + } + + //Other + return true; + } + private GameTeam getSide(Location entityLoc) { Location nearest = UtilAlg.findClosest(entityLoc, new ArrayList(_averageSpawns.values())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index be7f2c64a..47ecd4222 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -20,7 +20,7 @@ public class KitArmorer extends Kit public KitArmorer(ArcadeManager manager) { - super(manager, "Armorer", KitAvailability.Free, 0, new String[] + super(manager, "Armorer", KitAvailability.Gem, 2000, new String[] { "He uses his expert armor-making", "skills to block excess damage!", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java index 6c8c3768f..82213872f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -27,9 +27,9 @@ public class KitDetonator extends Kit public KitDetonator(ArcadeManager manager) { - super(manager, "Detonator", KitAvailability.Free, 0, new String[] + super(manager, "Detonator", KitAvailability.Gem, 4000, new String[] { - "He doesn't like to wait.", + "He doesn't like to wait. Max fuse of 3 and min fuse of 2.", "", C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Fuse Time.", C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time." @@ -109,7 +109,7 @@ public class KitDetonator extends Kit //Left else if (UtilEvent.isAction(event, ActionType.L)) { - if (amount <= 1) + if (amount <= 2) return; UtilInv.remove(event.getPlayer(), Material.LEVER, (byte) 0, 1); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java index b427930a1..f8b7e136f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java @@ -17,7 +17,7 @@ public class KitWaller extends Kit public KitWaller(ArcadeManager manager) { - super(manager, "Waller", KitAvailability.Free, 0, new String[] + super(manager, "Waller", KitAvailability.Achievement, 0, new String[] { "When the times get tough,", "build yourself a wall!" diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 82c0f2290..81b16ed8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -35,9 +35,7 @@ public class PerkWaller extends Perk { super("Waller", new String[] { - C.cYellow + "Click Block" + C.cGray + " with shovel to " + C.cGreen + "Place Wall", - C.cGray + "Walls can absorb 1 hit before breaking.", - C.cGray + "TNT that touches a wall will explode instantly." + C.cYellow + "Click Block" + C.cGray + " with shovel to " + C.cGreen + "Place Wall" }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/Tracker6Kill.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/Tracker6Kill.java new file mode 100644 index 000000000..ee8bc27f5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/Tracker6Kill.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.game.games.lobbers.trackers; + +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.lobbers.BombLobbers; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class Tracker6Kill extends StatTracker +{ + + public Tracker6Kill(Game game) + { + super(game); + } + + @EventHandler + public void onEndgame(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + if (getGame() instanceof BombLobbers) + { + for (Player player : UtilServer.getPlayers()) + { + if (((BombLobbers) getGame()).getKills(player) >= 6.0) + { + addStat(player, "Killer", 1, true, false); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBestTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBestTeam.java new file mode 100644 index 000000000..fb37cc3ae --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBestTeam.java @@ -0,0 +1,51 @@ +package nautilus.game.arcade.game.games.lobbers.trackers; + +import mineplex.core.common.util.NautHashMap; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class TrackerBestTeam extends StatTracker +{ + private NautHashMap _teams = new NautHashMap(); + + public TrackerBestTeam(Game game) + { + super(game); + } + + @EventHandler + public void onGameStart(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (GameTeam team : getGame().GetTeamList()) + { + _teams.put(team, team.GetPlayers(true).size()); + } + } + + @EventHandler + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + for (GameTeam team : getGame().GetTeamList()) + { + if (_teams.get(team) == team.GetPlayers(true).size()) + { + for (Player player : team.GetPlayers(true)) + { + addStat(player, "BestTeam", 1, true, false); + } + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java new file mode 100644 index 000000000..7d4e8f627 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.lobbers.trackers; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class TrackerBlastProof extends StatTracker +{ + + public TrackerBlastProof(Game game) + { + super(game); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + for (Player winner : getGame().getWinners()) + { + if (getGame().GetKit(winner) instanceof KitArmorer) + { + addStat(winner, "BlastProof", 1, false, false); + } + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerNoDamage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerNoDamage.java new file mode 100644 index 000000000..7ad9f8550 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerNoDamage.java @@ -0,0 +1,69 @@ +package nautilus.game.arcade.game.games.lobbers.trackers; + +import java.util.HashSet; +import java.util.Set; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class TrackerNoDamage extends StatTracker +{ + private Set _noDamage = new HashSet(); + + public TrackerNoDamage(Game game) + { + super(game); + } + + @EventHandler + public void onGameStart(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (Player player : getGame().GetPlayers(true)) + { + _noDamage.add(player.getName()); + } + } + + @EventHandler + public void onGameEnd(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + for (String name : _noDamage) + { + Player player = UtilPlayer.searchExact(name); + + if (player == null || !player.isOnline()) + continue; + + addStat(player, "JellySkin", 1, true, false); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onDamage(CustomDamageEvent event) + { + if (!getGame().IsLive()) + return; + + if (event.GetDamageePlayer() == null || !event.GetDamageePlayer().isOnline()) + return; + + if (_noDamage.contains(event.GetDamageePlayer().getName())) + { + _noDamage.remove(event.GetDamageePlayer().getName()); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerTNTThrown.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerTNTThrown.java new file mode 100644 index 000000000..0aa2d93e6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerTNTThrown.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game.games.lobbers.trackers; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.event.EventHandler; + +public class TrackerTNTThrown extends StatTracker +{ + + public TrackerTNTThrown(Game game) + { + super(game); + } + + @EventHandler + public void onThrow(TNTThrowEvent event) + { + if (!getGame().IsLive()) + return; + + addStat(event.getPlayer(), "Thrown", 1, false, false); + } + +} From 52dd9df834c13f318cedfc124eeaa190a6c6e29b Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 17 Jul 2015 11:39:01 -0500 Subject: [PATCH 08/37] Motd changes. --- .../src/mineplex/bungee/motd/MotdManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 941527a80..49e6f6ae1 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -41,6 +41,7 @@ public class MotdManager implements Listener, Runnable List lines = new ArrayList(); lines.add(" §b§l◄§f§lNEW§b§l► §f§l◄§b§lSKYWARS§f§l► §b§l◄§f§lNEW§b§l►"); //lines.add(" §d§lRank Sale §a§l40% Off"); + //lines.add(" §f§l◄§c§lMAINTENANCE§f§l►"); updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines); System.out.println("Updated Bungee MOTD"); From 2dc2b8792c30f223381387b11a6be6b7a438d195 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 17 Jul 2015 17:01:24 -0400 Subject: [PATCH 09/37] Fixes, updates --- .../game/games/lobbers/BombLobbers.java | 121 ++++++++---------- .../game/games/lobbers/kits/KitArmorer.java | 2 +- .../game/games/lobbers/kits/KitDetonator.java | 2 +- .../game/games/lobbers/kits/KitWaller.java | 5 +- .../lobbers/kits/perks/PerkCraftman.java | 27 ++-- .../lobbers/trackers/TrackerBlastProof.java | 3 + 6 files changed, 81 insertions(+), 79 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 41027947d..4452e6ddf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -15,11 +15,12 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.explosion.ExplosionEvent; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -37,11 +38,12 @@ import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown; import nautilus.game.arcade.kit.Kit; -import org.bukkit.ChatColor; +import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; @@ -49,8 +51,9 @@ import org.bukkit.event.block.Action; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.util.Vector; -public class BombLobbers extends TeamGame +public class BombLobbers extends TeamGame implements IThrown { private NautHashMap _averageSpawns = new NautHashMap(); @@ -72,12 +75,11 @@ public class BombLobbers extends TeamGame { "Fight against your enemies using", "the power of explosives!", - "", "Left click TNT to throw at your enemy.", - "Last team alive wins!", - "Kaboom!" + "Last team alive wins!" }); - DamageSelf = false; + DamageFall = true; + DamageEvP = true; WorldWaterDamage = 5; @@ -195,6 +197,7 @@ public class BombLobbers extends TeamGame tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); + Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), this, -1L, true, false, false, .2F); player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); @@ -265,15 +268,7 @@ public class BombLobbers extends TeamGame { if (tnt.getKey() != null && tnt.getKey().isValid() && !tnt.getKey().isOnGround()) { - if (tnt.getValue().GetColor() == ChatColor.AQUA) - { - UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), -1, -1, 1, 1, 0, - ViewDist.LONG, UtilServer.getPlayers()); - } - else - { - UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), 0.0F, 0.0F, 0.0F, 0.0F, 3, ViewDist.LONG, UtilServer.getPlayers()); - } + UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), tnt.getValue().GetColorBase().getRed(), tnt.getValue().GetColorBase().getGreen(), tnt.getValue().GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); } } } @@ -293,21 +288,11 @@ public class BombLobbers extends TeamGame { player.damage(500); UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!")); - continue; } } } - @EventHandler - public void nerfTNT(CustomDamageEvent event) - { - if (event.GetCause().toString().contains("EXPLOSION")) - { - event.AddMod("Armor", "Damage Nerf", -(event.GetDamage() * .333), false); - } - } - - + @SuppressWarnings("deprecation") @EventHandler public void damageBlocks(ExplosionEvent event) { @@ -320,47 +305,22 @@ public class BombLobbers extends TeamGame { Block block = iterator.next(); - if (!shouldRemoveFromExplosion(block)) + //Stone + if (block.getType() == Material.STONE) + { + block.setType(Material.COBBLESTONE); + iterator.remove(); continue; - - event.GetBlocks().remove(block); - } - } + } - //Boolean = remove - @SuppressWarnings("deprecation") - public boolean shouldRemoveFromExplosion(Block block) - { - //Stone - if (block.getTypeId() == 1) - { - block.setTypeId(4); - return false; + //Stone Brick + if (block.getType() == Material.SMOOTH_BRICK && block.getData() != 2) + { + block.setData((byte) 2); + iterator.remove(); + continue; + } } - - //Stone Brick - else if (block.getTypeId() == 98) - { - block.setData((byte) 2); - return false; - } - - //Grass - else if (block.getTypeId() == 2) - { - block.setTypeId(3); - return false; - } - - //Wood Planks - else if (block.getTypeId() == 5) - { - block.setData((byte) 2); - return false; - } - - //Other - return true; } private GameTeam getSide(Location entityLoc) @@ -373,5 +333,34 @@ public class BombLobbers extends TeamGame } return null; } - + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (!(target instanceof Player) || !(data.GetThrower() instanceof Player)) + return; + + if (GetTeam((Player) target) == GetTeam((Player) data.GetThrower())) + return; + + data.GetThrown().setVelocity(new Vector()); + + if (target != null) + { + UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); + target.playEffect(EntityEffect.HURT); + } + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index 47ecd4222..b9184ad47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -28,7 +28,7 @@ public class KitArmorer extends Kit C.cGray + "Recieve " + C.cYellow + "Full Gold Armor" }, new Perk[] { - new PerkCraftman() + new PerkCraftman(5000) }, EntityType.ZOMBIE, new ItemStack(Material.AIR)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java index 82213872f..8536d1afb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -35,7 +35,7 @@ public class KitDetonator extends Kit C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time." }, new Perk[] { - new PerkCraftman() + new PerkCraftman(6000) }, EntityType.ZOMBIE, new ItemBuilder(Material.LEVER).build()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java index f8b7e136f..7d9d760e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkWaller; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -14,7 +15,6 @@ import org.bukkit.entity.Player; public class KitWaller extends Kit { - public KitWaller(ArcadeManager manager) { super(manager, "Waller", KitAvailability.Achievement, 0, new String[] @@ -23,7 +23,8 @@ public class KitWaller extends Kit "build yourself a wall!" }, new Perk[] { - new PerkWaller() + new PerkWaller(), + new PerkCraftman(6000) }, EntityType.ZOMBIE, new ItemBuilder(Material.SMOOTH_BRICK).setUnbreakable(true).build()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java index b99b833ae..686cd1186 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -5,11 +5,11 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -17,37 +17,46 @@ public class PerkCraftman extends Perk { private Recharge _recharge; + private final long _giveTime; + public PerkCraftman() + { + this(4000); + } + + public PerkCraftman(long giveTime) { super("Craftman", new String[] { - C.cGray + "Recieve 1 TNT every 2 seconds. Maximum of 3." + C.cGray + "Recieve 1 TNT every " + C.cYellow + giveTime / 1000 + C.cGray + " seconds. Maximum of 3." }); _recharge = Recharge.Instance; + _giveTime = giveTime; } @EventHandler public void give(UpdateEvent event) { + if (event.getType() != UpdateType.FAST) + return; + if (!Manager.GetGame().IsLive()) return; for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!_recharge.usable(player, "TNT Give")) + if (!Kit.HasKit(player)) continue; - - _recharge.use(player, "TNT Give", Manager.GetGame().getGameLiveTime() >= 60000 ? 3000 : (Manager.GetGame().getGameLiveTime() >= 3000 ? 4000 : 5000), false, false); - //Has 4 + if (!_recharge.use(player, "Bomb Give", _giveTime, false, false)) + continue; + + //Has 3 if (UtilInv.contains(player, Material.TNT, (byte) 0, 3)) continue; UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).build()); - - player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 3.0F, 1.0F); } } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java index 7d4e8f627..af23a5b37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/trackers/TrackerBlastProof.java @@ -24,6 +24,9 @@ public class TrackerBlastProof extends StatTracker if (event.GetState() != GameState.End) return; + if (getGame().getWinners() == null) + return; + for (Player winner : getGame().getWinners()) { if (getGame().GetKit(winner) instanceof KitArmorer) From 6edc923002ccdd11f2f9c8de3ff1015f2955f086 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 19 Jul 2015 15:43:13 -0400 Subject: [PATCH 10/37] Changed mineplex.com/supporthub > mineplex.com/reports --- Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index d48239d6e..eaa6f0e2e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -329,7 +329,7 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "Accusing players of cheating in-game is against the rules." + "If you think someone is cheating, please gather evidence and report it at " - + F.link("www.mineplex.com/supporthub/"))); + + F.link("www.mineplex.com/reports/"))); event.setCancelled(true); } else if (_playerLastMessage.containsKey(sender.getUniqueId())) From 8b2b4c28265139fe86b9db2a40a31300a41d0853 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 19 Jul 2015 15:51:34 -0400 Subject: [PATCH 11/37] Added to MPS --- Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java | 2 +- .../src/nautilus/game/arcade/managers/GameHostManager.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index c5230d28f..dbb06498f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -27,7 +27,7 @@ public enum GameDisplay HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), - Lobbers("Bomb Lobbers", Material.TNT, (byte) 0, GameCategory.ARCADE, 53), + Lobbers("Bomb Lobbers", Material.FIREWORK_CHARGE, (byte) 0, GameCategory.ARCADE, 53), Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index ccb1c54ae..482dab324 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -84,6 +84,7 @@ public class GameHostManager implements Listener ultraGames.add(GameType.SneakyAssassins); ultraGames.add(GameType.TurfWars); ultraGames.add(GameType.Spleef); + ultraGames.add(GameType.Lobbers); //Hero Games heroGames.add(GameType.ChampionsDominate); From 87cc40fc0cb7fa7979fa18d44af0443992dff071 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 19 Jul 2015 22:38:03 -0400 Subject: [PATCH 12/37] Fixed a few achievements --- .../stats/BridgesSniperStatTracker.java | 24 +++++++----- .../stats/ElectrocutionStatTracker.java | 31 ++++++++++++--- .../stats/FirstSupplyDropOpenStatTracker.java | 24 +++++++----- .../stats/TheLongestShotStatTracker.java | 11 ++++-- .../stats/WinWithoutDyingStatTracker.java | 28 ++++++------- .../WinWithoutOpeningChestStatTracker.java | 28 +++++++------ .../WinWithoutWearingArmorStatTracker.java | 39 +++++++++++-------- 7 files changed, 116 insertions(+), 69 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BridgesSniperStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BridgesSniperStatTracker.java index 7b10cb9b1..2322950cb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BridgesSniperStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BridgesSniperStatTracker.java @@ -1,12 +1,12 @@ package nautilus.game.arcade.stats; -import mineplex.core.common.util.*; -import mineplex.minecraft.game.core.combat.event.*; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.bridge.*; -import org.bukkit.entity.*; -import org.bukkit.event.*; -import org.bukkit.event.entity.*; +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.games.bridge.Bridge; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class BridgesSniperStatTracker extends StatTracker { @@ -18,7 +18,7 @@ public class BridgesSniperStatTracker extends StatTracker @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onCombatDeath(CombatDeathEvent event) { - if (getGame().GetState() != Game.GameState.Live) + if (!getGame().IsLive()) return; if (getGame().isBridgesDown()) @@ -31,6 +31,7 @@ public class BridgesSniperStatTracker extends StatTracker return; Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (killer == null) return; @@ -41,13 +42,16 @@ public class BridgesSniperStatTracker extends StatTracker return; Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + if (player == null) return; if (player == killer) return; - - if ("Archery".equals(event.GetLog().GetLastDamager().GetLastDamageSource())) + + if (event.GetLog().GetLastDamager().GetLastDamageSource().contains("Archery")) + { addStat(killer, "Sniper", 1, true, false); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ElectrocutionStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ElectrocutionStatTracker.java index 471cd5da0..2975b101b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ElectrocutionStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ElectrocutionStatTracker.java @@ -1,8 +1,15 @@ package nautilus.game.arcade.stats; -import mineplex.minecraft.game.classcombat.Skill.Mage.*; -import nautilus.game.arcade.game.*; -import org.bukkit.event.*; +import java.util.ArrayList; +import java.util.List; + +import mineplex.minecraft.game.classcombat.Skill.Mage.LightningOrb.LightningOrbEvent; +import nautilus.game.arcade.game.Game; + +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class ElectrocutionStatTracker extends StatTracker { @@ -12,12 +19,24 @@ public class ElectrocutionStatTracker extends StatTracker } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onLightningOrb(LightningOrb.LightningOrbEvent event) + public void onLightningOrb(LightningOrbEvent event) { if (getGame().GetState() != Game.GameState.Live) return; - - if (event.getStruck().size() >= 4) + + List viable = new ArrayList(); + + for (LivingEntity en : event.getStruck()) + { + if (en instanceof Player) + { + viable.add((Player) en); + } + } + + if (viable.size() >= 4) + { addStat(event.getPlayer(), "MassElectrocution", 1, true, false); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FirstSupplyDropOpenStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FirstSupplyDropOpenStatTracker.java index 901982794..10f9893b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FirstSupplyDropOpenStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FirstSupplyDropOpenStatTracker.java @@ -1,12 +1,18 @@ package nautilus.game.arcade.stats; -import nautilus.game.arcade.game.*; -import nautilus.game.arcade.game.games.survivalgames.*; -import org.bukkit.event.*; +import java.util.HashSet; +import java.util.Set; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent; + +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class FirstSupplyDropOpenStatTracker extends StatTracker { - private boolean first = true; + private Set _opened = new HashSet(); public FirstSupplyDropOpenStatTracker(Game game) { @@ -19,11 +25,11 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker if (getGame().GetState() != Game.GameState.Live) return; - if (first) - { - addStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false); + if (_opened.contains(event.getChest())) + return; + + _opened.add(event.getChest()); - first = false; - } + addStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java index 8edaaac79..383c34993 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java @@ -18,7 +18,7 @@ public class TheLongestShotStatTracker extends StatTracker @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onCombatDeath(CombatDeathEvent event) { - if (getGame().GetState() != Game.GameState.Live) + if (!getGame().IsLive()) return; if (event.GetLog().GetKiller() == null) @@ -38,13 +38,16 @@ public class TheLongestShotStatTracker extends StatTracker return; Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); - if (player == null) + + if (player == null || !player.isOnline()) return; - if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains("Longshot")) + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().toLowerCase().contains("Longshot")) { - if (killer.getLocation().distanceSquared(player.getLocation()) >= 64 * 64) + if (killer.getLocation().distance(player.getLocation()) >= 64) + { addStat(killer, "TheLongestShot", 1, false, false); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java index 49b448e66..cb24d7b0b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java @@ -3,20 +3,19 @@ package nautilus.game.arcade.stats; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + public class WinWithoutDyingStatTracker extends StatTracker { - private final Set _hasDied = new HashSet<>(); + private final Set _hasDied = new HashSet(); private final String _stat; public WinWithoutDyingStatTracker(Game game, String stat) @@ -29,7 +28,7 @@ public class WinWithoutDyingStatTracker extends StatTracker @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onCombatDeath(CombatDeathEvent event) { - if (getGame().GetState() != Game.GameState.Live) + if (!getGame().IsLive()) return; if (event.GetLog().GetPlayer() == null) @@ -39,13 +38,14 @@ public class WinWithoutDyingStatTracker extends StatTracker return; Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); - if (player == null) + if (player == null || !player.isOnline()) + { return; - - _hasDied.add(player.getUniqueId()); + } + _hasDied.add(player); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void onGameStateChange(GameStateChangeEvent event) { if (event.GetState() == Game.GameState.End) @@ -56,8 +56,10 @@ public class WinWithoutDyingStatTracker extends StatTracker { for (Player winner : winners) { - if (!_hasDied.contains(winner.getUniqueId())) - addStat(winner, getStat(), 1, true, false); + if (!_hasDied.contains(winner)) + { + addStat(winner, _stat, 1, true, false); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java index 90d61b653..2f91d8f86 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java @@ -3,24 +3,22 @@ package nautilus.game.arcade.stats; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.UUID; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.skywars.events.PlayerOpenChestEvent; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerInteractEvent; public class WinWithoutOpeningChestStatTracker extends StatTracker { - - private final Set _openChest = new HashSet<>(); + private final Set _openChest = new HashSet(); public WinWithoutOpeningChestStatTracker(Game game) { @@ -28,14 +26,18 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void onOpenChest(PlayerInteractEvent event) { - if (event.getAction() == Action.RIGHT_CLICK_BLOCK) + if (event.isCancelled()) + { + return; + } + if (UtilEvent.isAction(event, ActionType.R_BLOCK)) { if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CHEST) { - _openChest.add(event.getPlayer().getUniqueId()); + _openChest.add(event.getPlayer()); } } } @@ -44,10 +46,12 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker public void onBreakChest(BlockBreakEvent event) { if (event.getBlock().getType() == Material.CHEST) - _openChest.add(event.getPlayer().getUniqueId()); + { + _openChest.add(event.getPlayer()); + } } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void onGameStateChange(GameStateChangeEvent event) { if (event.GetState() == Game.GameState.End) @@ -58,8 +62,10 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker { for (Player winner : winners) { - if (!_openChest.contains(winner.getUniqueId())) + if (!_openChest.contains(winner)) + { addStat(winner, "NoChest", 1, true, false); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java index b6c850159..005743742 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java @@ -1,19 +1,23 @@ package nautilus.game.arcade.stats; -import mineplex.core.updater.*; -import mineplex.core.updater.event.*; -import nautilus.game.arcade.events.*; -import nautilus.game.arcade.game.*; -import org.bukkit.*; -import org.bukkit.entity.*; -import org.bukkit.event.*; -import org.bukkit.inventory.*; +import java.util.HashSet; +import java.util.List; +import java.util.Set; -import java.util.*; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.inventory.ItemStack; public class WinWithoutWearingArmorStatTracker extends StatTracker { - private final Set _armorWearers = new HashSet<>(); + private final Set _wearing = new HashSet(); public WinWithoutWearingArmorStatTracker(Game game) { @@ -26,19 +30,20 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker if (getGame().GetState() != Game.GameState.Live) return; - if (event.getType() == UpdateType.FAST) + if (event.getType() == UpdateType.TICK) { for (Player player : getGame().GetPlayers(true)) { - if (_armorWearers.contains(player.getUniqueId())) + if (_wearing.contains(player)) + { continue; + } for (ItemStack armor : player.getInventory().getArmorContents()) { if (armor != null && armor.getType() != Material.AIR) { - _armorWearers.add(player.getUniqueId()); - + _wearing.add(player); break; } } @@ -46,7 +51,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker } } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR) public void onGameStateChange(GameStateChangeEvent event) { if (event.GetState() == Game.GameState.End) @@ -57,8 +62,10 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker { for (Player winner : winners) { - if (!_armorWearers.contains(winner.getUniqueId())) + if (!_wearing.contains(winner)) + { addStat(winner, "NoArmor", 1, true, false); + } } } } From bb769aa0f43471fdaa4fa1c75e17c9e5d6306c48 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 20 Jul 2015 10:02:50 -0400 Subject: [PATCH 13/37] I'm a dumbass --- .../nautilus/game/arcade/stats/TheLongestShotStatTracker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java index 383c34993..d22e2e515 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java @@ -42,7 +42,7 @@ public class TheLongestShotStatTracker extends StatTracker if (player == null || !player.isOnline()) return; - if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().toLowerCase().contains("Longshot")) + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().toLowerCase().contains("longshot")) { if (killer.getLocation().distance(player.getLocation()) >= 64) { From 63df369700fee872cf18f18ffa5bc344625e878f Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 20 Jul 2015 10:18:50 -0400 Subject: [PATCH 14/37] Cleaned up somethings (lib's request) --- .../nautilus/game/arcade/game/games/skywars/Skywars.java | 5 +---- .../game/arcade/stats/WinWithoutDyingStatTracker.java | 6 +++--- .../arcade/stats/WinWithoutOpeningChestStatTracker.java | 8 ++++---- .../arcade/stats/WinWithoutWearingArmorStatTracker.java | 8 ++++---- 4 files changed, 12 insertions(+), 15 deletions(-) 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 c64af6eaa..c6a2003e9 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 @@ -6,7 +6,6 @@ import java.util.HashSet; import java.util.Iterator; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; @@ -25,7 +24,6 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.explosion.ExplosionEvent; -import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.loot.ChestLoot; import mineplex.core.loot.RandomItem; import mineplex.core.updater.UpdateType; @@ -43,8 +41,8 @@ import nautilus.game.arcade.game.games.skywars.data.TNTGenerator; import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent; import nautilus.game.arcade.game.games.skywars.kits.KitChicken; import nautilus.game.arcade.game.games.skywars.kits.KitDestructor; -import nautilus.game.arcade.game.games.skywars.kits.KitMiner; import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist; +import nautilus.game.arcade.game.games.skywars.kits.KitMiner; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.ore.OreHider; import nautilus.game.arcade.stats.DeathBomberStatTracker; @@ -67,7 +65,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.entity.Egg; import org.bukkit.entity.EnderPearl; import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java index cb24d7b0b..5f9f990f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutDyingStatTracker.java @@ -15,7 +15,7 @@ import org.bukkit.event.EventPriority; public class WinWithoutDyingStatTracker extends StatTracker { - private final Set _hasDied = new HashSet(); + private final Set _hasDied = new HashSet(); private final String _stat; public WinWithoutDyingStatTracker(Game game, String stat) @@ -42,7 +42,7 @@ public class WinWithoutDyingStatTracker extends StatTracker { return; } - _hasDied.add(player); + _hasDied.add(player.getUniqueId().toString()); } @EventHandler(priority = EventPriority.MONITOR) @@ -56,7 +56,7 @@ public class WinWithoutDyingStatTracker extends StatTracker { for (Player winner : winners) { - if (!_hasDied.contains(winner)) + if (!_hasDied.contains(winner.getUniqueId().toString())) { addStat(winner, _stat, 1, true, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java index 2f91d8f86..3a9459092 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutOpeningChestStatTracker.java @@ -18,7 +18,7 @@ import org.bukkit.event.player.PlayerInteractEvent; public class WinWithoutOpeningChestStatTracker extends StatTracker { - private final Set _openChest = new HashSet(); + private final Set _openChest = new HashSet(); public WinWithoutOpeningChestStatTracker(Game game) { @@ -37,7 +37,7 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker { if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CHEST) { - _openChest.add(event.getPlayer()); + _openChest.add(event.getPlayer().getUniqueId().toString()); } } } @@ -47,7 +47,7 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker { if (event.getBlock().getType() == Material.CHEST) { - _openChest.add(event.getPlayer()); + _openChest.add(event.getPlayer().getUniqueId().toString()); } } @@ -62,7 +62,7 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker { for (Player winner : winners) { - if (!_openChest.contains(winner)) + if (!_openChest.contains(winner.getUniqueId().toString())) { addStat(winner, "NoChest", 1, true, false); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java index 005743742..5f2626d06 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/WinWithoutWearingArmorStatTracker.java @@ -17,7 +17,7 @@ import org.bukkit.inventory.ItemStack; public class WinWithoutWearingArmorStatTracker extends StatTracker { - private final Set _wearing = new HashSet(); + private final Set _wearing = new HashSet(); public WinWithoutWearingArmorStatTracker(Game game) { @@ -34,7 +34,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker { for (Player player : getGame().GetPlayers(true)) { - if (_wearing.contains(player)) + if (_wearing.contains(player.getUniqueId().toString())) { continue; } @@ -43,7 +43,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker { if (armor != null && armor.getType() != Material.AIR) { - _wearing.add(player); + _wearing.add(player.getUniqueId().toString()); break; } } @@ -62,7 +62,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker { for (Player winner : winners) { - if (!_wearing.contains(winner)) + if (!_wearing.contains(winner.getUniqueId().toString())) { addStat(winner, "NoArmor", 1, true, false); } From 6addf00037a35cba3aa60189d14716362f899498 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 20 Jul 2015 14:27:10 -0400 Subject: [PATCH 15/37] LOTS of tweaks :D --- .../src/mineplex/core/common/Rank.java | 2 +- .../core/account/command/UpdateRank.java | 2 +- .../core/achievement/AchievementCategory.java | 26 ++++---- .../src/mineplex/core/chat/Chat.java | 4 +- .../mineplex/core/friend/FriendManager.java | 2 +- .../mineplex/core/ignore/IgnoreManager.java | 2 +- .../mineplex/core/message/MessageManager.java | 8 +-- .../core/message/commands/AdminCommand.java | 2 +- .../message/commands/MessageAdminCommand.java | 2 +- .../message/commands/ResendAdminCommand.java | 2 +- .../core/portal/Commands/ServerCommand.java | 2 +- .../core/punish/Command/PunishCommand.java | 2 +- .../src/mineplex/core/punish/Punish.java | 2 +- .../serverConfig/ServerConfiguration.java | 2 +- .../src/mineplex/hub/HubManager.java | 6 +- .../classcombat/Skill/Brute/BlockToss.java | 4 +- .../classcombat/shop/ClassShopManager.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/games/turfforts/TurfForts.java | 63 +++++++++++-------- .../arcade/game/games/wither/WitherGame.java | 48 +++++++------- .../arcade/kit/perks/PerkSeismicSlam.java | 46 +++++++++----- .../game/arcade/kit/perks/PerkZombieBile.java | 38 +++++++---- .../game/arcade/managers/GameHostManager.java | 1 + 23 files changed, 154 insertions(+), 116 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 47719668a..1639d49a8 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -15,7 +15,7 @@ public enum Rank SNR_MODERATOR("Sr.Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD), JNR_DEV("Jr.Dev", ChatColor.RED), - HELPER("Trainee", ChatColor.DARK_AQUA), + TRAINEE("Trainee", ChatColor.DARK_AQUA), MAPLEAD("MapLead", ChatColor.DARK_PURPLE), MAPDEV("Builder", ChatColor.BLUE), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index 8a7efe8fe..56d65a52e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -52,7 +52,7 @@ public class UpdateRank extends CommandBase final Rank rank = tempRank; - if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) + if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.TRAINEE || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) { if (rank == Rank.ADMIN && !Plugin.hasRank(caller, Rank.LT)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index d777224ac..af4c16c20 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -16,7 +16,7 @@ public enum AchievementCategory { GLOBAL("Global", null, new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME }, - Material.EMERALD, 0, GameCategory.GLOBAL, null), + Material.EMERALD, 0, GameCategory.GLOBAL, "None"), BRIDGES("The Bridges", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -32,11 +32,11 @@ public enum AchievementCategory UHC("Ultra Hardcore", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "Extra Class Skills"), + Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "None"), WIZARDS("Wizards", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"), + Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"), CASTLE_SIEGE("Castle Siege", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), @@ -45,7 +45,7 @@ public enum AchievementCategory BLOCK_HUNT("Block Hunt", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.GRASS, 0, GameCategory.CLASSICS, null), + Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"), SMASH_MOBS("Super Smash Mobs", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -53,11 +53,11 @@ public enum AchievementCategory MINE_STRIKE("MineStrike", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.TNT, 0, GameCategory.CLASSICS, null), + Material.TNT, 0, GameCategory.CLASSICS, "None"), DRAW_MY_THING("Draw My Thing", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, - Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null), + Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"), CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -65,7 +65,7 @@ public enum AchievementCategory MASTER_BUILDERS("Master Builders", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, - Material.WOOD, 0, GameCategory.CLASSICS, null), + Material.WOOD, 0, GameCategory.CLASSICS, "None"), //Arcade DRAGONS("Dragons", null, @@ -74,7 +74,7 @@ public enum AchievementCategory DRAGON_ESCAPE("Dragon Escape", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, - Material.DRAGON_EGG, 0, GameCategory.ARCADE, null), + Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit"), SHEEP_QUEST("Sheep Quest", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -82,11 +82,11 @@ public enum AchievementCategory SNEAKY_ASSASSINS("Sneaky Assassins", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.INK_SACK, 0, GameCategory.ARCADE, null), + Material.INK_SACK, 0, GameCategory.ARCADE, "Briber Kit"), ONE_IN_THE_QUIVER("One in the Quiver", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.BOW, 0, GameCategory.ARCADE, null), + Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"), SUPER_PAINTBALL("Super Paintball", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -97,11 +97,11 @@ public enum AchievementCategory Material.HARD_CLAY, 14, GameCategory.ARCADE, null), RUNNER("Runner", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null), SPLEEF("Super Spleef", null, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, Material.IRON_SPADE, 0, GameCategory.ARCADE, null), DEATH_TAG("Death Tag", null, @@ -110,7 +110,7 @@ public enum AchievementCategory SNAKE("Snake", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.WOOL, 4, GameCategory.ARCADE, null), + Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit"), BACON_BRAWL("Bacon Brawl", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index eaa6f0e2e..1c32b56a8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -323,7 +323,7 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); event.setCancelled(true); } - else if (!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) && + else if (!_clientManager.Get(sender).GetRank().Has(Rank.TRAINEE) && msgContainsHack(event.getMessage())) { UtilPlayer.message(sender, F.main("Chat", @@ -337,7 +337,7 @@ public class Chat extends MiniPlugin MessageData lastMessage = _playerLastMessage.get(sender.getUniqueId()); long chatSlowTime = 1000L * _chatSlow; long timeDiff = System.currentTimeMillis() - lastMessage.getTimeSent(); - if (timeDiff < chatSlowTime && !_clientManager.Get(sender).GetRank().Has(Rank.HELPER)) + if (timeDiff < chatSlowTime && !_clientManager.Get(sender).GetRank().Has(Rank.TRAINEE)) { UtilPlayer.message(sender, F.main("Chat", "Chat slow enabled. Please wait " + F.time(UtilTime.convertString(chatSlowTime - timeDiff, 1, UtilTime.TimeUnit.FIT)))); event.setCancelled(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index c25fec865..bf0a5d16a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -251,7 +251,7 @@ public class FriendManager extends MiniDbClientPlugin public void showFriends(Player caller) { - boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.HELPER); + boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.TRAINEE); boolean gotAFriend = false; List friendStatuses = Get(caller).getFriends(); Collections.sort(friendStatuses, _friendSorter); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java index 7edaa801f..35d3f95b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java @@ -88,7 +88,7 @@ public class IgnoreManager extends MiniDbClientPlugin @EventHandler public void onChat(AsyncPlayerChatEvent event) { - if (ClientManager.Get(event.getPlayer()).GetRank().Has(Rank.HELPER)) + if (ClientManager.Get(event.getPlayer()).GetRank().Has(Rank.TRAINEE)) return; Iterator itel = event.getRecipients().iterator(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index b81e7fbb1..c7eac5639 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -191,7 +191,7 @@ public class MessageManager extends MiniClientPlugin // My attempt at trying to mitigate some of the spam bots - Phinary // Triggers if they are whispering a new player - if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null + if (!GetClientManager().Get(from).GetRank().Has(Rank.TRAINEE) && Get(from).LastTo != null && !Get(from).LastTo.equalsIgnoreCase(to.getName())) { long delta = System.currentTimeMillis() - Get(from).LastToTime; @@ -247,7 +247,7 @@ public class MessageManager extends MiniClientPlugin { if (!to.equals(staff) && !from.equals(staff)) { - if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) + if (_clientManager.Get(staff).GetRank().Has(Rank.TRAINEE)) { UtilPlayer.message(staff, F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + C.cPurple + " -> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message); @@ -364,7 +364,7 @@ public class MessageManager extends MiniClientPlugin { if (!to.equals(staff)) { - if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) + if (_clientManager.Get(staff).GetRank().Has(Rank.TRAINEE)) { UtilPlayer.message(staff, @@ -442,7 +442,7 @@ public class MessageManager extends MiniClientPlugin { if (!target.equals(staff)) { - if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) + if (_clientManager.Get(staff).GetRank().Has(Rank.TRAINEE)) { UtilPlayer.message(staff, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java index 8534424dc..375cd623a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java @@ -48,7 +48,7 @@ public class AdminCommand extends CommandBase boolean staff = false; for (Player to : UtilServer.getPlayers()) { - if (Plugin.GetClientManager().Get(to).GetRank().Has(Rank.HELPER)) + if (Plugin.GetClientManager().Get(to).GetRank().Has(Rank.TRAINEE)) { if (!to.equals(caller)) UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java index 89a459c36..6534614dd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java @@ -24,7 +24,7 @@ public class MessageAdminCommand extends CommandBase } else { - if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.HELPER, true)) + if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.TRAINEE, true)) return; if (args.length == 0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java index a1a4f21c3..4f46d6c48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java @@ -24,7 +24,7 @@ public class ResendAdminCommand extends CommandBase } else { - if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.HELPER, true)) + if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.TRAINEE, true)) return; String lastTo = Plugin.Get(caller).LastAdminTo; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java index 37d5d933c..53557ba79 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -72,7 +72,7 @@ public class ServerCommand extends CommandBase } else if (servUp.contains("STAFF")) { - if (playerRank.Has(Rank.HELPER)) + if (playerRank.Has(Rank.TRAINEE)) Plugin.sendPlayerToServer(player, args[0]); else deniedAccess = true; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java index b578a2566..347d4024e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java @@ -19,7 +19,7 @@ public class PunishCommand extends CommandBase { public PunishCommand(Punish plugin) { - super(plugin, Rank.HELPER, "punish", "p"); + super(plugin, Rank.TRAINEE, "punish", "p"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index adaceb736..74663cd37 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -214,7 +214,7 @@ public class Punish extends MiniPlugin { for (Player player : UtilServer.getPlayers()) { - if (_clientManager.Get(player).GetRank().Has(Rank.HELPER) || player.getName().equals(punishee)) + if (_clientManager.Get(player).GetRank().Has(Rank.TRAINEE) || player.getName().equals(punishee)) { player.sendMessage(msg); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java b/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java index 02cc887b0..77743b88d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java @@ -56,7 +56,7 @@ public class ServerConfiguration extends MiniPlugin @EventHandler public void onPlayerLogin(PlayerLoginEvent event) { - if (_serverGroup.getStaffOnly() && !_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.HELPER, false)) + if (_serverGroup.getStaffOnly() && !_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.TRAINEE, false)) event.disallow(Result.KICK_OTHER, "This is a staff only server."); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 33dd7047d..548f9fb04 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -318,7 +318,7 @@ public class HubManager extends MiniClientPlugin + "§r\n" + "§lHow do I apply for Trainee?\n" + "\n" - + "§rYou may only apply for Helper if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n" + + "§rYou may only apply for Trainee if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n" + "Apply at:\n" + "§omineplex.com/application\n"); @@ -620,7 +620,7 @@ public class HubManager extends MiniClientPlugin public void playerPrivateMessage(PrivateMessageEvent event) { //Dont Let PM Near Spawn! - if (UtilMath.offset2d(GetSpawn(), event.getSender().getLocation()) == 0 && !_clientManager.Get(event.getSender()).GetRank().Has(Rank.HELPER)) + if (UtilMath.offset2d(GetSpawn(), event.getSender().getLocation()) == 0 && !_clientManager.Get(event.getSender()).GetRank().Has(Rank.TRAINEE)) { UtilPlayer.message(event.getSender(), F.main("Chat", "You must leave spawn before you can Private Message!")); event.setCancelled(true); @@ -634,7 +634,7 @@ public class HubManager extends MiniClientPlugin return; //Dont Let Chat Near Spawn! - if (UtilMath.offset2d(GetSpawn(), event.getPlayer().getLocation()) == 0 && !_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.HELPER)) + if (UtilMath.offset2d(GetSpawn(), event.getPlayer().getLocation()) == 0 && !_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.TRAINEE)) { UtilPlayer.message(event.getPlayer(), F.main("Chat", "You must leave spawn before you can chat!")); event.setCancelled(true); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index 9bf9994fc..524bdce6c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -130,7 +130,7 @@ public class BlockToss extends SkillCharge implements IThrown } //Block to Item - FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0); + FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData()); //Action player.eject(); @@ -235,7 +235,7 @@ public class BlockToss extends SkillCharge implements IThrown { FallingBlock thrown = (FallingBlock) data.GetThrown(); - FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData()); //Remove Old _falling.remove(thrown); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java index 5a333c782..5643076e5 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java @@ -48,7 +48,7 @@ public class ClassShopManager extends MiniPlugin public boolean hasAchievements(Player player) { - if (_clientManager.Get(player).GetRank().Has(Rank.HELPER)) + if (_clientManager.Get(player).GetRank().Has(Rank.TRAINEE)) return true; return _achievementManager.hasCategory(player, new Achievement[] 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 7e8b5243e..c9e389be1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -797,7 +797,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Reserved Slot Check if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers()) { - if (_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.HELPER, false)) + if (_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.TRAINEE, false)) { event.allow(); event.setResult(PlayerLoginEvent.Result.ALLOWED); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index a4c514cb3..7b4477a05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -4,33 +4,6 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.ProjectileHitEvent; - -import net.minecraft.server.v1_7_R4.EntityArrow; -import net.minecraft.server.v1_7_R4.Item; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; @@ -57,6 +30,32 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker; import nautilus.game.arcade.stats.BlockShreadStatTracker; import nautilus.game.arcade.stats.TheComebackStatTracker; +import net.minecraft.server.v1_7_R4.EntityArrow; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.ProjectileHitEvent; public class TurfForts extends TeamGame { @@ -328,6 +327,16 @@ public class TurfForts extends TeamGame } } + + @EventHandler(priority = EventPriority.HIGH) + public void BlockBreak(BlockBreakEvent event) + { + if (!IsAlive(event.getPlayer())) + { + event.setCancelled(true); + return; + } + } @EventHandler public void BlockDamage(ProjectileHitEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index b11d44b68..634e27970 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -6,24 +6,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.EntityEffect; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.ThrownPotion; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -43,14 +25,32 @@ 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.TeamGame; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.paintball.PlayerCopy; -import nautilus.game.arcade.game.games.wither.kit.*; +import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher; +import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.perks.data.IBlockRestorer; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.EntityEffect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + public class WitherGame extends TeamGame implements IBlockRestorer { private GameTeam _runners; @@ -110,13 +110,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer this.KitRegisterState = GameState.Prepare; this.TeamArmor = true; - this.TeamArmorHotbar = false; - - _help = new String[] - { - C.cRed + C.Bold + "This game is still under development!", - - }; + this.TeamArmorHotbar = false; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java index 9309e6cf4..f3ee858f5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlam.java @@ -2,6 +2,19 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -11,23 +24,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.kit.Perk; - public class PerkSeismicSlam extends Perk { private HashMap _live = new HashMap(); @@ -39,6 +39,21 @@ public class PerkSeismicSlam extends Perk C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam" }); } + + @EventHandler + public void deactivateDeath(PlayerDeathEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!Kit.HasKit(event.getEntity())) + return; + + if (_live.containsKey(event.getEntity())) + { + _live.remove(event.getEntity()); + } + } @EventHandler public void Leap(PlayerInteractEvent event) @@ -109,6 +124,9 @@ public class PerkSeismicSlam extends Perk if (cur.equals(player)) continue; + if (cur instanceof Player && !Manager.IsAlive((Player) cur)) + continue; + //Damage Event Manager.GetDamage().NewDamageEvent(cur, player, null, DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, true, true, false, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java index 47835d469..57ef2dc4d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkZombieBile.java @@ -3,17 +3,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; import java.util.Iterator; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -30,6 +19,18 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.SmashPerk; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + public class PerkZombieBile extends SmashPerk implements IThrown { private HashMap _active = new HashMap(); @@ -70,6 +71,21 @@ public class PerkZombieBile extends SmashPerk implements IThrown UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } + @EventHandler + public void deactivateDeath(PlayerDeathEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!Kit.HasKit(event.getEntity())) + return; + + if (_active.containsKey(event.getEntity())) + { + _active.remove(event.getEntity()); + } + } + @EventHandler public void update(UpdateEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index ccb1c54ae..c7ac57ff5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -308,6 +308,7 @@ public class GameHostManager implements Listener if (!event.getMessage().toLowerCase().startsWith("/menu")) return; + event.setCancelled(true); openMenu(event.getPlayer()); } From e55ca81d480ff5aabc4478be3b362703a2268c1e Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 20 Jul 2015 15:45:16 -0400 Subject: [PATCH 16/37] Reverted Trainee to Helper due to popular demand. --- .../src/mineplex/core/account/command/UpdateRank.java | 2 +- Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java | 4 ++-- .../src/mineplex/core/friend/FriendManager.java | 2 +- .../src/mineplex/core/gadget/gadgets/BlockForm.java | 2 +- .../src/mineplex/core/ignore/IgnoreManager.java | 2 +- .../src/mineplex/core/message/MessageManager.java | 8 ++++---- .../src/mineplex/core/message/commands/AdminCommand.java | 2 +- .../core/message/commands/MessageAdminCommand.java | 2 +- .../core/message/commands/ResendAdminCommand.java | 2 +- .../src/mineplex/core/portal/Commands/ServerCommand.java | 2 +- .../src/mineplex/core/punish/Command/PunishCommand.java | 2 +- .../Mineplex.Core/src/mineplex/core/punish/Punish.java | 2 +- .../mineplex/core/serverConfig/ServerConfiguration.java | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index 56d65a52e..8a7efe8fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -52,7 +52,7 @@ public class UpdateRank extends CommandBase final Rank rank = tempRank; - if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.TRAINEE || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) + if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) { if (rank == Rank.ADMIN && !Plugin.hasRank(caller, Rank.LT)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index 1c32b56a8..eaa6f0e2e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -323,7 +323,7 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); event.setCancelled(true); } - else if (!_clientManager.Get(sender).GetRank().Has(Rank.TRAINEE) && + else if (!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) && msgContainsHack(event.getMessage())) { UtilPlayer.message(sender, F.main("Chat", @@ -337,7 +337,7 @@ public class Chat extends MiniPlugin MessageData lastMessage = _playerLastMessage.get(sender.getUniqueId()); long chatSlowTime = 1000L * _chatSlow; long timeDiff = System.currentTimeMillis() - lastMessage.getTimeSent(); - if (timeDiff < chatSlowTime && !_clientManager.Get(sender).GetRank().Has(Rank.TRAINEE)) + if (timeDiff < chatSlowTime && !_clientManager.Get(sender).GetRank().Has(Rank.HELPER)) { UtilPlayer.message(sender, F.main("Chat", "Chat slow enabled. Please wait " + F.time(UtilTime.convertString(chatSlowTime - timeDiff, 1, UtilTime.TimeUnit.FIT)))); event.setCancelled(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index bf0a5d16a..c25fec865 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -251,7 +251,7 @@ public class FriendManager extends MiniDbClientPlugin public void showFriends(Player caller) { - boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.TRAINEE); + boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.HELPER); boolean gotAFriend = false; List friendStatuses = Get(caller).getFriends(); Collections.sort(friendStatuses, _friendSorter); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java index 6635ddbe3..c5d37b9c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/BlockForm.java @@ -3,7 +3,6 @@ package mineplex.core.gadget.gadgets; import java.util.ArrayList; import java.util.List; -import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilBlock; @@ -64,6 +63,7 @@ public class BlockForm DisguiseChicken disguise = new DisguiseChicken(_player); disguise.setBaby(); disguise.setSoundDisguise(new DisguiseCat(_player)); + disguise.setInvisible(true); _host.Manager.getDisguiseManager().disguise(disguise); //Apply Falling Block diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java index 35d3f95b5..7edaa801f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java @@ -88,7 +88,7 @@ public class IgnoreManager extends MiniDbClientPlugin @EventHandler public void onChat(AsyncPlayerChatEvent event) { - if (ClientManager.Get(event.getPlayer()).GetRank().Has(Rank.TRAINEE)) + if (ClientManager.Get(event.getPlayer()).GetRank().Has(Rank.HELPER)) return; Iterator itel = event.getRecipients().iterator(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index c7eac5639..b81e7fbb1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -191,7 +191,7 @@ public class MessageManager extends MiniClientPlugin // My attempt at trying to mitigate some of the spam bots - Phinary // Triggers if they are whispering a new player - if (!GetClientManager().Get(from).GetRank().Has(Rank.TRAINEE) && Get(from).LastTo != null + if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null && !Get(from).LastTo.equalsIgnoreCase(to.getName())) { long delta = System.currentTimeMillis() - Get(from).LastToTime; @@ -247,7 +247,7 @@ public class MessageManager extends MiniClientPlugin { if (!to.equals(staff) && !from.equals(staff)) { - if (_clientManager.Get(staff).GetRank().Has(Rank.TRAINEE)) + if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) { UtilPlayer.message(staff, F.rank(_clientManager.Get(from).GetRank()) + " " + from.getName() + C.cPurple + " -> " + F.rank(_clientManager.Get(to).GetRank()) + " " + to.getName() + " " + C.cPurple + message); @@ -364,7 +364,7 @@ public class MessageManager extends MiniClientPlugin { if (!to.equals(staff)) { - if (_clientManager.Get(staff).GetRank().Has(Rank.TRAINEE)) + if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) { UtilPlayer.message(staff, @@ -442,7 +442,7 @@ public class MessageManager extends MiniClientPlugin { if (!target.equals(staff)) { - if (_clientManager.Get(staff).GetRank().Has(Rank.TRAINEE)) + if (_clientManager.Get(staff).GetRank().Has(Rank.HELPER)) { UtilPlayer.message(staff, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java index 375cd623a..8534424dc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/AdminCommand.java @@ -48,7 +48,7 @@ public class AdminCommand extends CommandBase boolean staff = false; for (Player to : UtilServer.getPlayers()) { - if (Plugin.GetClientManager().Get(to).GetRank().Has(Rank.TRAINEE)) + if (Plugin.GetClientManager().Get(to).GetRank().Has(Rank.HELPER)) { if (!to.equals(caller)) UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java index 6534614dd..89a459c36 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/MessageAdminCommand.java @@ -24,7 +24,7 @@ public class MessageAdminCommand extends CommandBase } else { - if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.TRAINEE, true)) + if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.HELPER, true)) return; if (args.length == 0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java index 4f46d6c48..a1a4f21c3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/ResendAdminCommand.java @@ -24,7 +24,7 @@ public class ResendAdminCommand extends CommandBase } else { - if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.TRAINEE, true)) + if (!Plugin.GetClientManager().Get(caller).GetRank().Has(caller, Rank.HELPER, true)) return; String lastTo = Plugin.Get(caller).LastAdminTo; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java index 53557ba79..37d5d933c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -72,7 +72,7 @@ public class ServerCommand extends CommandBase } else if (servUp.contains("STAFF")) { - if (playerRank.Has(Rank.TRAINEE)) + if (playerRank.Has(Rank.HELPER)) Plugin.sendPlayerToServer(player, args[0]); else deniedAccess = true; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java index 347d4024e..b578a2566 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Command/PunishCommand.java @@ -19,7 +19,7 @@ public class PunishCommand extends CommandBase { public PunishCommand(Punish plugin) { - super(plugin, Rank.TRAINEE, "punish", "p"); + super(plugin, Rank.HELPER, "punish", "p"); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 74663cd37..adaceb736 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -214,7 +214,7 @@ public class Punish extends MiniPlugin { for (Player player : UtilServer.getPlayers()) { - if (_clientManager.Get(player).GetRank().Has(Rank.TRAINEE) || player.getName().equals(punishee)) + if (_clientManager.Get(player).GetRank().Has(Rank.HELPER) || player.getName().equals(punishee)) { player.sendMessage(msg); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java b/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java index 77743b88d..02cc887b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/serverConfig/ServerConfiguration.java @@ -56,7 +56,7 @@ public class ServerConfiguration extends MiniPlugin @EventHandler public void onPlayerLogin(PlayerLoginEvent event) { - if (_serverGroup.getStaffOnly() && !_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.TRAINEE, false)) + if (_serverGroup.getStaffOnly() && !_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.HELPER, false)) event.disallow(Result.KICK_OTHER, "This is a staff only server."); } From d38fc1a603aa99cd6194a0844b966b5f92b5bdcc Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 20 Jul 2015 16:40:37 -0400 Subject: [PATCH 17/37] Reverted things --- .../Mineplex.Core.Common/src/mineplex/core/common/Rank.java | 4 ++-- Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java | 4 ++-- .../minecraft/game/classcombat/shop/ClassShopManager.java | 2 +- .../src/nautilus/game/arcade/ArcadeManager.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 1639d49a8..1c769e523 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -15,7 +15,7 @@ public enum Rank SNR_MODERATOR("Sr.Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD), JNR_DEV("Jr.Dev", ChatColor.RED), - TRAINEE("Trainee", ChatColor.DARK_AQUA), + HELPER("Trainee", ChatColor.DARK_AQUA), MAPLEAD("MapLead", ChatColor.DARK_PURPLE), MAPDEV("Builder", ChatColor.BLUE), @@ -75,7 +75,7 @@ public enum Rank { UtilPlayer.message(player, C.mHead + "Permissions> " + C.mBody + "This requires Permission Rank [" + - C.mHead + rank + + C.mHead + rank.Name.toUpperCase() + C.mBody + "]."); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 548f9fb04..2e1dbc813 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -620,7 +620,7 @@ public class HubManager extends MiniClientPlugin public void playerPrivateMessage(PrivateMessageEvent event) { //Dont Let PM Near Spawn! - if (UtilMath.offset2d(GetSpawn(), event.getSender().getLocation()) == 0 && !_clientManager.Get(event.getSender()).GetRank().Has(Rank.TRAINEE)) + if (UtilMath.offset2d(GetSpawn(), event.getSender().getLocation()) == 0 && !_clientManager.Get(event.getSender()).GetRank().Has(Rank.HELPER)) { UtilPlayer.message(event.getSender(), F.main("Chat", "You must leave spawn before you can Private Message!")); event.setCancelled(true); @@ -634,7 +634,7 @@ public class HubManager extends MiniClientPlugin return; //Dont Let Chat Near Spawn! - if (UtilMath.offset2d(GetSpawn(), event.getPlayer().getLocation()) == 0 && !_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.TRAINEE)) + if (UtilMath.offset2d(GetSpawn(), event.getPlayer().getLocation()) == 0 && !_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.HELPER)) { UtilPlayer.message(event.getPlayer(), F.main("Chat", "You must leave spawn before you can chat!")); event.setCancelled(true); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java index 5643076e5..5a333c782 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java @@ -48,7 +48,7 @@ public class ClassShopManager extends MiniPlugin public boolean hasAchievements(Player player) { - if (_clientManager.Get(player).GetRank().Has(Rank.TRAINEE)) + if (_clientManager.Get(player).GetRank().Has(Rank.HELPER)) return true; return _achievementManager.hasCategory(player, new Achievement[] 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 c9e389be1..7e8b5243e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -797,7 +797,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Reserved Slot Check if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers()) { - if (_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.TRAINEE, false)) + if (_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.HELPER, false)) { event.allow(); event.setResult(PlayerLoginEvent.Result.ALLOWED); From b4df9f47c55702db6c6c94d61622efef3fec5d13 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 21 Jul 2015 11:01:45 -0400 Subject: [PATCH 18/37] Added a mortar kit ;o (Please don't fire me b2) --- .../game/games/lobbers/BombLobbers.java | 101 ++++++++++----- .../lobbers/events/TNTPreExplodeEvent.java | 52 ++++++++ .../game/games/lobbers/kits/KitMortar.java | 36 ++++++ .../lobbers/kits/perks/PerkCraftman.java | 2 +- .../games/lobbers/kits/perks/PerkMortar.java | 116 ++++++++++++++++++ .../kits/perks/PerkMorterCraftman.java | 55 +++++++++ 6 files changed, 332 insertions(+), 30 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTPreExplodeEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitMortar.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMorterCraftman.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 4452e6ddf..fd518af67 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -8,6 +8,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -26,10 +27,12 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer; import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator; import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; +import nautilus.game.arcade.game.games.lobbers.kits.KitMortar; import nautilus.game.arcade.game.games.lobbers.kits.KitWaller; import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam; @@ -57,8 +60,7 @@ public class BombLobbers extends TeamGame implements IThrown { private NautHashMap _averageSpawns = new NautHashMap(); - private NautHashMap _throwers = new NautHashMap(); - private NautHashMap _teams = new NautHashMap(); + private NautHashMap _tnt = new NautHashMap(); private NautHashMap _kills = new NautHashMap(); @@ -70,6 +72,7 @@ public class BombLobbers extends TeamGame implements IThrown new KitJumper(manager), new KitArmorer(manager), new KitDetonator(manager), + new KitMortar(manager), new KitWaller(manager) }, new String[] { @@ -188,25 +191,38 @@ public class BombLobbers extends TeamGame implements IThrown event.setCancelled(true); - UtilInv.remove(player, Material.TNT, (byte) 0, 1); UtilInv.Update(player); - TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()),TNTPrimed.class); - tnt.setFuseTicks(60); + TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); + tnt.setFuseTicks(60); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); - Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), this, -1L, true, false, false, .2F); - - player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); - - _throwers.put(tnt, player.getName()); - _teams.put(tnt, GetTeam(player)); - - Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); - } + Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, false, .2F); + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); + + Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); + + _tnt.put(tnt, player.getName()); + } + + public boolean hasThrower(TNTPrimed tnt) + { + return _tnt.containsKey(tnt); + } + + public void addThrower(Player player, TNTPrimed tnt) + { + _tnt.put(tnt, player.getName()); + } + + public String getThrower(TNTPrimed tnt) + { + return _tnt.get(tnt); + } + @EventHandler public void onTNTExplode(ExplosionPrimeEvent event) { @@ -218,17 +234,16 @@ public class BombLobbers extends TeamGame implements IThrown TNTPrimed tnt = (TNTPrimed) event.getEntity(); - if (!_throwers.containsKey(tnt)) + if (!_tnt.containsKey(tnt)) return; - Player thrower = UtilPlayer.searchExact(_throwers.get(tnt)); + Player thrower = UtilPlayer.searchExact(_tnt.get(tnt)); if (thrower == null) { event.setCancelled(true); - _throwers.remove(tnt); - _teams.remove(tnt); + _tnt.remove(tnt); event.getEntity().remove(); return; @@ -238,21 +253,30 @@ public class BombLobbers extends TeamGame implements IThrown { event.setCancelled(true); - _throwers.remove(tnt); - _teams.remove(tnt); + _tnt.remove(tnt); event.getEntity().remove(); return; } - _throwers.remove(tnt); - _teams.remove(tnt); + TNTPreExplodeEvent preExplode = new TNTPreExplodeEvent(thrower, tnt); + Manager.getPlugin().getServer().getPluginManager().callEvent(preExplode); - for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) + if (preExplode.isCancelled()) { - Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); + event.setCancelled(true); + tnt.remove(); } + else + { + for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14)) + { + Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false); + } + } + + _tnt.remove(tnt); } @EventHandler @@ -264,12 +288,31 @@ public class BombLobbers extends TeamGame implements IThrown if (!IsLive()) return; - for (Entry tnt : _teams.entrySet()) + for (Entry tnt : _tnt.entrySet()) { - if (tnt.getKey() != null && tnt.getKey().isValid() && !tnt.getKey().isOnGround()) - { - UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), tnt.getValue().GetColorBase().getRed(), tnt.getValue().GetColorBase().getGreen(), tnt.getValue().GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); - } + if (tnt.getKey() == null) + continue; + + if (!tnt.getKey().isValid()) + continue; + + if (UtilEnt.isGrounded(tnt.getKey()) || tnt.getKey().isOnGround()) + continue; + + Player thrower = UtilPlayer.searchExact(tnt.getValue()); + + if (thrower == null) + continue; + + if (!IsPlaying(thrower)) + continue; + + GameTeam team = GetTeam(thrower); + + if (team == null) + continue; + + UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTPreExplodeEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTPreExplodeEvent.java new file mode 100644 index 000000000..e79bc6f5c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/events/TNTPreExplodeEvent.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.games.lobbers.events; + +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class TNTPreExplodeEvent extends PlayerEvent implements Cancellable +{ + private static final HandlerList _handlers = new HandlerList(); + + private boolean _cancelled = false; + + private TNTPrimed _tnt; + + public TNTPreExplodeEvent(Player thrower, TNTPrimed tnt) + { + super(thrower); + + _tnt = tnt; + } + + public TNTPrimed getTNT() + { + return _tnt; + } + + @Override + public void setCancelled(boolean flag) + { + _cancelled = flag; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitMortar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitMortar.java new file mode 100644 index 000000000..52f24b832 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitMortar.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.games.lobbers.kits; + +import mineplex.core.itemstack.ItemBuilder; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkMortar; +import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkMorterCraftman; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitMortar extends Kit +{ + public KitMortar(ArcadeManager manager) + { + super(manager, "Mortar", KitAvailability.Gem, 6000, new String[] + { + "He loves the big guns." + }, new Perk[] + { + new PerkMortar(), + new PerkCraftman(), + new PerkMorterCraftman() + }, EntityType.ZOMBIE, new ItemBuilder(Material.FIREBALL).build()); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java index 686cd1186..9373d293b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -28,7 +28,7 @@ public class PerkCraftman extends Perk { super("Craftman", new String[] { - C.cGray + "Recieve 1 TNT every " + C.cYellow + giveTime / 1000 + C.cGray + " seconds. Maximum of 3." + C.cGray + "Recieve 1 TNT every " + C.cYellow + giveTime / 1000 + " Seconds." + C.cGray + " Maximum of 3." }); _recharge = Recharge.Instance; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java new file mode 100644 index 000000000..e79aaefff --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java @@ -0,0 +1,116 @@ +package nautilus.game.arcade.game.games.lobbers.kits.perks; + +import java.util.HashSet; +import java.util.Set; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import nautilus.game.arcade.game.games.lobbers.BombLobbers; +import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.util.Vector; + +public class PerkMortar extends Perk +{ + private Set _scatter = new HashSet(); + + public PerkMortar() + { + super("Mortar", new String[] + { + C.cYellow + "Right Click" + C.cGray + " Fireball to " + C.cGreen + "Fire Mortar", + "Mortars will explode after " + C.cYellow + "2 Seconds", + "releasing 3 more TNT, each with a 3 second fuse.", + "Your TNT will not scatter if it is grounded." + }); + } + + @EventHandler + public void throwTNT(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!(Manager.GetGame() instanceof BombLobbers)) + return; + + BombLobbers l = (BombLobbers) Manager.GetGame(); + + Player player = event.getPlayer(); + + if (!Manager.IsAlive(player)) + return; + + if (!UtilInv.IsItem(player.getItemInHand(), Material.FIREBALL, (byte) 0)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.FIREBALL, (byte) 0, 1); + UtilInv.Update(player); + + TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); + tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); + tnt.setFuseTicks(40); + + UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); + Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, false, false, .2F); + + player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); + + l.addThrower(player, tnt); + } + + @EventHandler + public void onExplode(TNTPreExplodeEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!Kit.HasKit(event.getPlayer())) + return; + + if (event.getTNT().isOnGround() || UtilEnt.isGrounded(event.getTNT())) + return; + + if (!(Manager.GetGame() instanceof BombLobbers)) + return; + + BombLobbers l = (BombLobbers) Manager.GetGame(); + + event.setCancelled(true); + + if (_scatter.contains(event.getTNT())) + { + _scatter.remove(event.getTNT()); + return; + } + + for (int i = -1 ; i < 2 ; i++) + { + TNTPrimed tnt = (TNTPrimed) event.getTNT().getWorld().spawn(event.getTNT().getLocation(), TNTPrimed.class); + tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getPlayer().getUniqueId())); + tnt.setFuseTicks(60); + + UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); + Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, false, false, .2F); + + l.addThrower(event.getPlayer(), tnt); + _scatter.add(tnt); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMorterCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMorterCraftman.java new file mode 100644 index 000000000..9ea4ddd91 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMorterCraftman.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.games.lobbers.kits.perks; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkMorterCraftman extends Perk +{ + private Recharge _recharge; + + public PerkMorterCraftman() + { + super("Morter Craftman", new String[] + { + "You will recieve 1 mortar every " + C.cYellow + "10 Seconds.", + "Maximum of 1." + }); + + _recharge = Recharge.Instance; + } + + @EventHandler + public void give(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!Manager.GetGame().IsLive()) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!Kit.HasKit(player)) + continue; + + if (!_recharge.use(player, "Mortar Give", 10000, false, false)) + continue; + + //Has 1 + if (UtilInv.contains(player, Material.FIREBALL, (byte) 0, 1)) + continue; + + UtilInv.insert(player, new ItemBuilder(Material.FIREBALL).setTitle(F.item("Mortar")).build()); + } + } +} From b9762bddc422cab2a532cd9a21a3f036c09ddfbe Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 22 Jul 2015 16:50:57 -0400 Subject: [PATCH 19/37] Fixes --- .../src/mineplex/core/game/GameDisplay.java | 2 +- .../core/projectile/ProjectileManager.java | 23 +++-- .../core/projectile/ProjectileUser.java | 30 ++++--- .../game/games/lobbers/BombLobbers.java | 24 +++--- .../game/games/lobbers/kits/KitDetonator.java | 84 +++++++++++++++---- .../games/lobbers/kits/perks/PerkWaller.java | 2 +- 6 files changed, 116 insertions(+), 49 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index dbb06498f..65e1d6da4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -27,7 +27,7 @@ public enum GameDisplay HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), - Lobbers("Bomb Lobbers", Material.FIREWORK_CHARGE, (byte) 0, GameCategory.ARCADE, 53), + Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 53), Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index a3e3fb661..132500dc8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -1,15 +1,13 @@ package mineplex.core.projectile; -import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; import java.util.WeakHashMap; import mineplex.core.MiniPlugin; import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Effect; import org.bukkit.Sound; @@ -35,7 +33,7 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - null, 1f, 1f, null, 0, null, null, hitboxGrow)); + null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, @@ -43,7 +41,7 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, pickup, - null, 1f, 1f, null, 0, null, null, hitboxGrow)); + null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, @@ -52,7 +50,7 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxGrow)); + sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, @@ -61,7 +59,7 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxGrow)); + sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, @@ -70,7 +68,16 @@ public class ProjectileManager extends MiniPlugin { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, null, 0, effectRate, particle, hitboxMult)); + sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult)); + } + + public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, + Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult) + { + _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, + expireTime, hitPlayer, hitBlock, idle, false, + sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index a19cf5caa..6c94d9e00 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -1,16 +1,13 @@ package mineplex.core.projectile; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguiseSquid; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_7_R4.AxisAlignedBB; import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.MovingObjectPosition; @@ -25,7 +22,6 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -46,7 +42,14 @@ public class ProjectileUser private Sound _sound = null; private float _soundVolume = 1f; private float _soundPitch = 1f; + private ParticleType _particle = null; + private float _particleX = 0F; + private float _particleY = 0F; + private float _particleZ = 0F; + private float _particleS = 0F; + private int _particleC = 1; + private Effect _effect = null; private int _effectData = 0; private UpdateType _effectRate = UpdateType.TICK; @@ -57,8 +60,8 @@ public class ProjectileUser long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, - ParticleType particle, - double hitboxMult) + ParticleType particle, float particleX, float particleY, + float particleZ, float particleS, int particleC, double hitboxMult) { Throw = throwInput; @@ -76,6 +79,11 @@ public class ProjectileUser _soundVolume = soundVolume; _soundPitch = soundPitch; _particle = particle; + _particleX = particleX; + _particleY = particleY; + _particleZ = particleZ; + _particleS = particleS; + _particleC = particleC; _effect = effect; _effectData = effectData; _effectRate = effectRate; @@ -95,7 +103,7 @@ public class ProjectileUser _thrown.getWorld().playEffect(_thrown.getLocation(), _effect, _effectData); if (_particle != null) - UtilParticle.PlayParticle(_particle, _thrown.getLocation(), 0f, 0f, 0f, 0, 1, + UtilParticle.PlayParticle(_particle, _thrown.getLocation(), _particleX, _particleY, _particleZ, _particleS, _particleC, ViewDist.LONG, UtilServer.getPlayers()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index fd518af67..329e33c5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -32,7 +32,6 @@ import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer; import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator; import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; -import nautilus.game.arcade.game.games.lobbers.kits.KitMortar; import nautilus.game.arcade.game.games.lobbers.kits.KitWaller; import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam; @@ -44,7 +43,6 @@ import nautilus.game.arcade.kit.Kit; import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -72,7 +70,7 @@ public class BombLobbers extends TeamGame implements IThrown new KitJumper(manager), new KitArmorer(manager), new KitDetonator(manager), - new KitMortar(manager), +// new KitMortar(manager), new KitWaller(manager) }, new String[] { @@ -188,7 +186,7 @@ public class BombLobbers extends TeamGame implements IThrown if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0)) return; - + event.setCancelled(true); UtilInv.remove(player, Material.TNT, (byte) 0, 1); @@ -199,9 +197,7 @@ public class BombLobbers extends TeamGame implements IThrown tnt.setFuseTicks(60); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); - Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, false, .2F); - - player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); + Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F); Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); @@ -218,9 +214,17 @@ public class BombLobbers extends TeamGame implements IThrown _tnt.put(tnt, player.getName()); } - public String getThrower(TNTPrimed tnt) + public void removeThrower(TNTPrimed tnt) { - return _tnt.get(tnt); + _tnt.remove(tnt); + } + + public Player getThrower(TNTPrimed tnt) + { + if (_tnt.get(tnt) == null) + return null; + + return UtilPlayer.searchExact(_tnt.get(tnt)); } @EventHandler @@ -312,7 +316,7 @@ public class BombLobbers extends TeamGame implements IThrown if (team == null) continue; - UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.5, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java index 8536d1afb..f0ad0da20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -1,12 +1,17 @@ package nautilus.game.arcade.game.games.lobbers.kits; +import java.util.Map.Entry; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.lobbers.BombLobbers; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; @@ -16,23 +21,26 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; public class KitDetonator extends Kit { + private NautHashMap _fuseTimes = new NautHashMap(); public KitDetonator(ArcadeManager manager) { super(manager, "Detonator", KitAvailability.Gem, 4000, new String[] { - "He doesn't like to wait. Max fuse of 3 and min fuse of 2.", - "", + "He doesn't like to wait. ", C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Fuse Time.", - C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time." + C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time.", + "Maximum fuse time of " + C.cYellow + "6 Seconds.", + "Minimum fuse time of " + C.cYellow + "2 Seconds.", }, new Perk[] { new PerkCraftman(6000) @@ -43,13 +51,7 @@ public class KitDetonator extends Kit @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(2).build()); - } - - @Override - public void SpawnCustom(LivingEntity ent) - { - + player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(3).build()); } @EventHandler @@ -69,14 +71,13 @@ public class KitDetonator extends Kit } else { - if (lever.getAmount() <= 0 || lever.getAmount() > 3) + if (lever.getAmount() < 2 || lever.getAmount() > 6) { GiveItems(event.getPlayer()); } - else - { - event.getTNT().setFuseTicks(lever.getAmount() * 20); - } + + event.getTNT().setFuseTicks(lever.getAmount() * 20); + _fuseTimes.put(event.getTNT(), lever.getAmount() * 20); } } @@ -100,7 +101,7 @@ public class KitDetonator extends Kit //Right if (UtilEvent.isAction(event, ActionType.R)) { - if (amount >= 3) + if (amount >= 6) return; UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).build()); @@ -116,5 +117,52 @@ public class KitDetonator extends Kit UtilInv.Update(event.getPlayer()); } event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CLICK, 3.0F, 1.0F); - } + } + + @EventHandler + public void respawnBombs(UpdateEvent event) + { + if (!(Manager.GetGame() instanceof BombLobbers)) + return; + + BombLobbers l = (BombLobbers) Manager.GetGame(); + + if (!Manager.GetGame().IsLive()) + return; + + for (Entry entry : _fuseTimes.entrySet()) + { + if (entry.getKey() == null || !entry.getKey().isValid()) + return; + + //If it will need respawning + if (entry.getValue() > 60) + { + //If it's near 60 ticks + //2 tick leeway + if (entry.getKey().getFuseTicks() >= 60 && entry.getKey().getFuseTicks() <= 62) + { + Player player = l.getThrower(entry.getKey()); + + if (player == null) + { + continue; + } + + TNTPrimed newTNT = entry.getKey().getWorld().spawn(entry.getKey().getLocation(), TNTPrimed.class); + newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); + newTNT.setVelocity(entry.getKey().getVelocity()); + newTNT.setFuseTicks(59); + + Manager.GetProjectile().AddThrow(newTNT, player, l, -1L, true, false, true, .2F); + + entry.getKey().remove(); + l.removeThrower(entry.getKey()); + _fuseTimes.remove(entry.getKey()); + + l.addThrower(player, newTNT); + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 81b16ed8d..7f696aa22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -88,7 +88,7 @@ public class PerkWaller extends Perk for (TNTPrimed tnt : _tnt) { - for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 2.0F).keySet()) + for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 3.0F).keySet()) { if (_wallBlocks.contains(near.getLocation())) { From e6386744444c1ebce9d3d7af121d5bf793c9e191 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 22 Jul 2015 20:17:19 -0400 Subject: [PATCH 20/37] Fixed fuse on detonator --- .../game/games/lobbers/kits/KitDetonator.java | 59 +++++++++++-------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java index f0ad0da20..304ccf255 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -12,6 +12,7 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.BombLobbers; +import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; @@ -30,7 +31,7 @@ import org.bukkit.metadata.FixedMetadataValue; public class KitDetonator extends Kit { - private NautHashMap _fuseTimes = new NautHashMap(); + private NautHashMap _respawnTimes = new NautHashMap(); public KitDetonator(ArcadeManager manager) { @@ -77,7 +78,11 @@ public class KitDetonator extends Kit } event.getTNT().setFuseTicks(lever.getAmount() * 20); - _fuseTimes.put(event.getTNT(), lever.getAmount() * 20); + + if (lever.getAmount() > 3) + { + _respawnTimes.put(event.getTNT(), System.currentTimeMillis() + 3000); + } } } @@ -130,39 +135,41 @@ public class KitDetonator extends Kit if (!Manager.GetGame().IsLive()) return; - for (Entry entry : _fuseTimes.entrySet()) + for (Entry entry : _respawnTimes.entrySet()) { if (entry.getKey() == null || !entry.getKey().isValid()) return; //If it will need respawning - if (entry.getValue() > 60) + if (System.currentTimeMillis() >= entry.getValue()) { - //If it's near 60 ticks - //2 tick leeway - if (entry.getKey().getFuseTicks() >= 60 && entry.getKey().getFuseTicks() <= 62) - { - Player player = l.getThrower(entry.getKey()); - - if (player == null) - { - continue; - } - - TNTPrimed newTNT = entry.getKey().getWorld().spawn(entry.getKey().getLocation(), TNTPrimed.class); - newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); - newTNT.setVelocity(entry.getKey().getVelocity()); - newTNT.setFuseTicks(59); + Player player = l.getThrower(entry.getKey()); - Manager.GetProjectile().AddThrow(newTNT, player, l, -1L, true, false, true, .2F); - - entry.getKey().remove(); - l.removeThrower(entry.getKey()); - _fuseTimes.remove(entry.getKey()); + if (player == null) + continue; - l.addThrower(player, newTNT); - } + TNTPrimed newTNT = entry.getKey().getWorld().spawn(entry.getKey().getLocation(), TNTPrimed.class); + newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); + newTNT.setVelocity(entry.getKey().getVelocity()); + newTNT.setFuseTicks(60); + + Manager.GetProjectile().AddThrow(newTNT, player, l, -1L, true, false, true, .2F); + + entry.getKey().remove(); + l.removeThrower(entry.getKey()); + _respawnTimes.remove(entry.getKey()); + + l.addThrower(player, newTNT); } } } + + @EventHandler + public void onExplode(TNTPreExplodeEvent event) + { + if (_respawnTimes.containsKey(event.getTNT())) + { + _respawnTimes.remove(event.getTNT()); + } + } } From e4ecc9e85856c7b1eabeb51d7fea6338d0eaf5d3 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 22 Jul 2015 23:31:07 -0400 Subject: [PATCH 21/37] http://pastebin.com/BRhT7pZP --- .../core/achievement/Achievement.java | 2 +- .../mineplex/core/cosmetic/ui/page/Menu.java | 3 + .../gadget/gadgets/ItemMelonLauncher.java | 3 +- .../src/mineplex/core/game/GameDisplay.java | 2 +- .../core/treasure/TreasureLocation.java | 5 +- .../hub/server/ui/ServerGameMenu.java | 2 +- .../game/classcombat/Skill/Mage/Rupture.java | 2 +- .../nautilus/game/arcade/ArcadeManager.java | 5 ++ .../game/arcade/addons/SoupAddon.java | 3 + .../game/games/bridge/kits/KitBeserker.java | 2 +- .../arcade/game/games/build/BuildData.java | 10 +++- .../game/games/minestrike/MineStrike.java | 11 ++++ .../arcade/game/games/smash/SuperSmash.java | 2 +- .../game/games/smash/kits/KitChicken.java | 2 +- .../game/games/smash/kits/KitSheep.java | 4 +- .../game/arcade/game/games/spleef/Spleef.java | 3 + .../game/games/spleef/kits/KitSnowballer.java | 2 +- .../game/arcade/kit/perks/PerkArcticAura.java | 14 +++-- .../game/arcade/kit/perks/PerkDestructor.java | 4 +- .../arcade/kit/perks/PerkSheepHoming.java | 2 +- .../game/arcade/managers/GameFlagManager.java | 8 ++- .../arcade/managers/GamePlayerManager.java | 58 ++++++++++--------- .../arcade/stats/LastStandStatTracker.java | 9 ++- 23 files changed, 104 insertions(+), 54 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index a1d818cca..595f80541 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -326,7 +326,7 @@ public enum Achievement SUPER_PAINTBALL_FLAWLESS_VICTORY("Flawless Victory", 1000, new String[]{"Super Paintball.Wins"}, - new String[]{"Win a team with your entire team alive"}, + new String[]{"Win a game with your entire team alive"}, new int[]{1}, AchievementCategory.SUPER_PAINTBALL), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 4e779d687..f77c4851f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -52,6 +52,9 @@ public class Menu extends ShopPageBase " ", ChatColor.RESET + C.cPurple + "Hero Rank", ChatColor.RESET + "Receives 15000 Coins per Month", + " ", + ChatColor.RESET + C.cGreen + "Legend Rank", + ChatColor.RESET + "Recieves 30000 Coins per Month" }, 1, false)); addButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java index a2ee2c308..90c80cc1c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java @@ -126,7 +126,8 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 1f, 1f); - event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1), true); + if (!event.getPlayer().hasPotionEffect(PotionEffectType.SPEED)) + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1), true); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 196b046e2..6dd84ea8e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -60,7 +60,7 @@ public enum GameDisplay Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50), Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51), - Skywars("Skywars", Material.FEATHER, (byte)5, GameCategory.SURVIVAL, 52), + Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 8911e6d3a..570eb152c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -99,7 +99,10 @@ public class TreasureLocation implements Listener setHoloChestVisible(false); - if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.MYTHICAL) + if (treasureType == TreasureType.ANCIENT) + Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening an " + treasureType.getName())); + + if (treasureType == TreasureType.MYTHICAL) Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName())); Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType()); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 4e0c5bb3a..47a0e34d0 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -64,7 +64,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BR") + ChatColor.RESET + " other players!", })); - setItem(2, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[] + setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[] { ChatColor.RESET + "", ChatColor.RESET + "Search for chests to find loot and ", diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java index 0f444315d..d8797a258 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java @@ -68,7 +68,7 @@ public class Rupture extends SkillActiveCharge "", "Release Block to release the rupture,", "causing earth and players to fly upward,", - "dealing up to #4#1 inital damage." + "dealing up to #4#1 initial damage." }); } 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 7e8b5243e..9acbd0298 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -31,6 +31,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; import com.google.common.base.Objects; @@ -840,6 +841,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation { player.setGameMode(GameMode.SURVIVAL); player.setAllowFlight(false); + player.setFlySpeed(0.1F); + UtilInv.Clear(player); ((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); @@ -871,6 +874,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Remove all conditions GetCondition().EndCondition(player, null, null); + for (PotionEffect potion : player.getActivePotionEffects()) + player.removePotionEffect(potion.getType()); HubClock(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java index 92d5576ef..4174f64ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/SoupAddon.java @@ -40,6 +40,9 @@ public class SoupAddon extends MiniPlugin Player player = event.getPlayer(); + if (!Manager.GetGame().IsAlive(player)) + return; + if (!UtilGear.isMat(player.getItemInHand(), Material.MUSHROOM_SOUP)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java index 133f27aaf..fa56f9ce2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBeserker.java @@ -20,7 +20,7 @@ public class KitBeserker extends Kit new String[] { - "Agile warrior trained in the ways axe combat." + "Agile warrior trained in the ways of axe combat." }, new Perk[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java index 4069df70f..a8306e7d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java @@ -98,7 +98,15 @@ public class BuildData return false; } - Particles.put(Player.getEyeLocation().add(Player.getLocation().getDirection()), particleType); + Location toPlace = Player.getEyeLocation().add(Player.getLocation().getDirection()); + + if (!inBuildArea(toPlace.getBlock())) + { + UtilPlayer.message(Player, F.main("Game", "You cannot place particles outside your plot!")); + return false; + } + + Particles.put(toPlace, particleType); UtilPlayer.message(Player, F.main("Game", "You placed " + particleType.getFriendlyName() + "!")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index b1900ffd7..45ec44424 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -1924,7 +1924,18 @@ public class MineStrike extends TeamGame Announce(color + "===================================", false); for (Player player : UtilServer.getPlayers()) + { player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f); + + //Clear reloading things + for (String recharge : Recharge.Instance.Get(player).keySet()) + { + if (!recharge.toLowerCase().contains("reload")) + continue; + + Recharge.Instance.recharge(player, recharge); + } + } UtilTextMiddle.display(null, winnerLine, 20, 120, 20); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 174dcfd5b..8ea1c5c8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -172,7 +172,7 @@ public class SuperSmash extends SoloGame if (lives > 0) { UtilPlayer.message(player, C.cRed + C.Bold + "You have died!"); - UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!"); + UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + (lives == 1 ? "life" : "lives") + " left!"); player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f); _lives.put(player, lives); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index e66ed7509..91f27649c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -40,7 +40,7 @@ public class KitChicken extends SmashKit }, EntityType.CHICKEN, new ItemStack(Material.EGG), - "Airial Gunner", 20000, Sound.CHICKEN_HURT); + "Aerial Gunner", 20000, Sound.CHICKEN_HURT); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java index cbabc5f8f..06e392f7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSheep.java @@ -76,7 +76,7 @@ public class KitSheep extends SmashKit { ChatColor.RESET + "Shear yourself and use the wool as", ChatColor.RESET + "an explosive device. You can Right-Click", - ChatColor.RESET + "as second time to solidify the bomb, and", + ChatColor.RESET + "a second time to solidify the bomb, and", ChatColor.RESET + "a third time to detonate it on command.", })); @@ -98,7 +98,7 @@ public class KitSheep extends SmashKit { ChatColor.RESET + "Release one Homing Sheeple towards every player.", ChatColor.RESET + "They will slowly home in on their target and", - ChatColor.RESET + "explode to deal devestating damage.", + ChatColor.RESET + "explode to deal devastating damage.", })); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index 6716ac290..c9d231bd0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -172,6 +172,9 @@ public class Spleef extends SoloGame event.setCancelled(true); + if (event.getBlock().getType() == Material.BEDROCK) + return; + BlockFade(event.getBlock(), event.getPlayer(), false); //Snowball diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java index 36cafe126..5e1ecc8d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitSnowballer.java @@ -21,7 +21,7 @@ public class KitSnowballer extends Kit new String[] { "Throw snowballs to break blocks!", - "Receives 2 Snowball when you punch blocks!" + "Receives 1 Snowball when you punch blocks!" }, new Perk[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java index ece2ee4b7..cd84bcc8f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkArcticAura.java @@ -2,16 +2,17 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + public class PerkArcticAura extends Perk { public PerkArcticAura() @@ -32,7 +33,10 @@ public class PerkArcticAura extends Perk { if (!Kit.HasKit(player)) continue; - + + if (((CraftPlayer) player).getHandle().spectating) + continue; + double range = 5*player.getExp(); //Blocks diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java index 45a67cde4..96311faab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDestructor.java @@ -89,8 +89,8 @@ public class PerkDestructor extends Perk { if (event.isCancelled()) return; - - if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.ENDER_PEARL, (byte) 0)) + + if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), "Seismic Charge", Material.ENDER_PEARL, (byte) 0)) return; //Cancel diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java index 8e7ee1331..eea416543 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSheepHoming.java @@ -28,7 +28,7 @@ public class PerkSheepHoming extends SmashPerk public PerkSheepHoming() { - super("Homing Sheepiles", new String[] + super("Homing Sheeples", new String[] { }, false); } 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 cf954185b..dafbc7416 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 @@ -721,6 +721,12 @@ public class GameFlagManager implements Listener UtilAction.velocity(player, new Vector(0,0,0), 1, true, 0.4, 0, 1, true); + if (!game.IsAlive(player)) + { + Manager.addSpectator(player, true); + return; + } + UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + time + " seconds..."); UtilTextMiddle.display(null, "Respawning in " + time + " seconds...", 5, 40, 5, player); @@ -732,7 +738,7 @@ public class GameFlagManager implements Listener if (game.IsAlive(player)) { game.RespawnPlayer(player); - } + } else { Manager.addSpectator(player, true); 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 0c28bab88..3af8cabb7 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 @@ -177,18 +177,18 @@ public class GamePlayerManager implements Listener Player player = event.getPlayer(); + GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked()); + + if (team == null) + return; + //Observer if (Manager.IsObserver(player)) { UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); return; } - - GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked()); - - if (team == null) - return; - + TeamClick(player, team); } @@ -198,20 +198,20 @@ public class GamePlayerManager implements Listener Player player = event.GetDamagerPlayer(false); if (player == null) return; - //Observer - if (Manager.IsObserver(player)) - { - UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); - return; - } - LivingEntity target = event.GetDamageeEntity(); GameTeam team = Manager.GetLobby().GetClickedTeam(target); if (team == null) return; - + + //Observer + if (Manager.IsObserver(player)) + { + UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); + return; + } + TeamClick(player, team); } @@ -265,6 +265,13 @@ public class GamePlayerManager implements Listener Player player = event.getPlayer(); + + + Kit kit = Manager.GetLobby().GetClickedKit(event.getRightClicked()); + + if (kit == null) + return; + //Observer if (Manager.IsObserver(player) || Manager.isSpectator(player)) { @@ -272,11 +279,6 @@ public class GamePlayerManager implements Listener return; } - Kit kit = Manager.GetLobby().GetClickedKit(event.getRightClicked()); - - if (kit == null) - return; - KitClick(player, kit, event.getRightClicked()); event.setCancelled(true); @@ -294,12 +296,7 @@ public class GamePlayerManager implements Listener Player player = event.GetDamagerPlayer(false); if (player == null) return; - //Observer - if (Manager.IsObserver(player) || Manager.isSpectator(player)) - { - UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); - return; - } + LivingEntity target = event.GetDamageeEntity(); @@ -307,7 +304,14 @@ public class GamePlayerManager implements Listener if (kit == null) return; - + + //Observer + if (Manager.IsObserver(player) || Manager.isSpectator(player)) + { + UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games.")); + return; + } + KitClick(player, kit, target); } @@ -340,7 +344,7 @@ public class GamePlayerManager implements Listener { Manager.GetGame().SetKit(player, kit, true); } - else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) > kit.GetCost()) + else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost()) { Manager.GetShop().openPageForPlayer(player, new ConfirmationPage( Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java index 135888975..d1df0b6f5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java @@ -4,15 +4,14 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; - import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class LastStandStatTracker extends StatTracker { From 91db076053c51f444549b1af67c0fbe7da48a422 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 23 Jul 2015 09:28:35 -0400 Subject: [PATCH 22/37] Fixed lobbers icon in stats --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index bffc840e7..0f823efe0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -122,7 +122,7 @@ public enum AchievementCategory BOMB_LOBBERS("Bomb Lobbers", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.TNT, 0, GameCategory.ARCADE, "Waller Kit"); + Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"); private String _name; private String[] _statsToPull; From 71148ef38739e772b79023bd7354b7f1206ed5db Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Thu, 23 Jul 2015 16:29:42 +0200 Subject: [PATCH 23/37] gave twitch same perms as youtubers --- .../src/mineplex/core/antihack/AntiHack.java | 2 +- .../core/personalServer/PersonalServerManager.java | 2 +- .../core/preferences/ui/PreferencesPage.java | 2 +- .../src/nautilus/game/arcade/ArcadeManager.java | 12 ++++++------ .../nautilus/game/arcade/command/GameCommand.java | 2 +- .../{YoutubeCommand.java => KitUnlockCommand.java} | 8 ++++---- .../src/nautilus/game/arcade/command/SetCommand.java | 2 +- .../nautilus/game/arcade/command/StartCommand.java | 2 +- .../src/nautilus/game/arcade/kit/Kit.java | 4 ++-- .../game/arcade/managers/GameLobbyManager.java | 2 +- .../game/arcade/managers/GamePlayerManager.java | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/{YoutubeCommand.java => KitUnlockCommand.java} (63%) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index f7371bf4c..37ff11c9b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -345,7 +345,7 @@ public class AntiHack extends MiniPlugin } //Auto-Kick - if (!handled && _clientManager.Get(player).GetRank() == Rank.YOUTUBE) + if (!handled && _clientManager.Get(player).GetRank() != Rank.YOUTUBE && _clientManager.Get(player).GetRank() != Rank.TWITCH) { player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 2f, 0.5f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java index 22b0f6e19..db709fd28 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/personalServer/PersonalServerManager.java @@ -125,7 +125,7 @@ public class PersonalServerManager extends MiniPlugin Rank rank = _clientManager.Get(player).GetRank(); - if (eventServer || rank.Has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE) + if (eventServer || rank.Has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH) { ram = 2048; cpu = 4; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java index d09e9c3db..f293eaf8d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -255,7 +255,7 @@ public class PreferencesPage extends ShopPageBase { public GameCommand(ArcadeManager plugin) { - super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "game"); + super(plugin, Rank.ADMIN, new Rank[] {Rank.MAPLEAD, Rank.JNR_DEV}, "game"); AddCommand(new StartCommand(Plugin)); AddCommand(new StopCommand(Plugin)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/YoutubeCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/KitUnlockCommand.java similarity index 63% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/YoutubeCommand.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/KitUnlockCommand.java index 454b19375..73cc210e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/YoutubeCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/KitUnlockCommand.java @@ -6,16 +6,16 @@ import nautilus.game.arcade.ArcadeManager; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; -public class YoutubeCommand extends CommandBase +public class KitUnlockCommand extends CommandBase { - public YoutubeCommand(ArcadeManager plugin) + public KitUnlockCommand(ArcadeManager plugin) { - super(plugin, Rank.OWNER, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, new String[] {"youtube", "twitch"}); + super(plugin, Rank.OWNER, new Rank[] {Rank.YOUTUBE, Rank.TWITCH}, new String[] {"youtube", "twitch", "kits"}); } @Override public void Execute(Player caller, String[] args) { - Plugin.setYoutuber(caller); + Plugin.toggleUnlockKits(caller); } } 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 7db88b496..0d7f183a7 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 @@ -18,7 +18,7 @@ public class SetCommand extends CommandBase { public SetCommand(ArcadeManager plugin) { - super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "set"); + super(plugin, Rank.ADMIN, new Rank[] {Rank.MAPLEAD, Rank.JNR_DEV}, "set"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java index b78521dc9..7a7a0dd43 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/StartCommand.java @@ -12,7 +12,7 @@ public class StartCommand extends CommandBase { public StartCommand(ArcadeManager plugin) { - super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "start"); + super(plugin, Rank.ADMIN, new Rank[] {Rank.MAPLEAD, Rank.JNR_DEV}, "start"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java index 8327bcb7e..e23422a01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -220,8 +220,8 @@ public abstract class Kit implements Listener return _achivementCategory; } - public boolean isYoutuber(Player player) + public boolean hasKitsUnlocked(Player player) { - return Manager.isYoutuber(player); + return Manager.hasKitsUnlocked(player); } } 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 89bf6ada6..47879e6e5 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 @@ -1099,7 +1099,7 @@ public class GameLobbyManager implements Listener, IPacketHandler } if (ent.GetKit().GetAvailability() == KitAvailability.Free || //Free - Manager.isYoutuber(player) || //YouTube + Manager.hasKitsUnlocked(player) || //YouTube (ent.GetKit().GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, ent.GetKit().getAchievementRequirement())) || //Achievement donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + ent.GetKit().GetName()) || //Green 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 0c28bab88..24f3c1f42 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 @@ -325,7 +325,7 @@ public class GamePlayerManager implements Listener if (kit.GetAvailability() == KitAvailability.Free || //Free - Manager.isYoutuber(player) || //YouTube + Manager.hasKitsUnlocked(player) || //YouTube (kit.GetAvailability() == KitAvailability.Achievement && //Achievement Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) || From 06d4de16cf058be7f051a1d54bad01354a7c601b Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 23 Jul 2015 13:34:11 -0400 Subject: [PATCH 24/37] Changed particle methods --- .../game/games/lobbers/BombLobbers.java | 54 +++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 329e33c5b..9d5c7eb58 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -40,6 +40,7 @@ import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage; import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown; import nautilus.game.arcade.kit.Kit; +import org.bukkit.ChatColor; import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; @@ -58,7 +59,7 @@ public class BombLobbers extends TeamGame implements IThrown { private NautHashMap _averageSpawns = new NautHashMap(); - private NautHashMap _tnt = new NautHashMap(); + private NautHashMap _tnt = new NautHashMap(); private NautHashMap _kills = new NautHashMap(); @@ -70,7 +71,7 @@ public class BombLobbers extends TeamGame implements IThrown new KitJumper(manager), new KitArmorer(manager), new KitDetonator(manager), -// new KitMortar(manager), +// new KitMortar(manager), << Spare time kit for Bobbeh new KitWaller(manager) }, new String[] { @@ -201,7 +202,7 @@ public class BombLobbers extends TeamGame implements IThrown Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); - _tnt.put(tnt, player.getName()); + _tnt.put(tnt, new BombToken(player)); } public boolean hasThrower(TNTPrimed tnt) @@ -211,7 +212,7 @@ public class BombLobbers extends TeamGame implements IThrown public void addThrower(Player player, TNTPrimed tnt) { - _tnt.put(tnt, player.getName()); + _tnt.put(tnt, new BombToken(player)); } public void removeThrower(TNTPrimed tnt) @@ -224,7 +225,7 @@ public class BombLobbers extends TeamGame implements IThrown if (_tnt.get(tnt) == null) return null; - return UtilPlayer.searchExact(_tnt.get(tnt)); + return UtilPlayer.searchExact(_tnt.get(tnt).Thrower); } @EventHandler @@ -241,7 +242,7 @@ public class BombLobbers extends TeamGame implements IThrown if (!_tnt.containsKey(tnt)) return; - Player thrower = UtilPlayer.searchExact(_tnt.get(tnt)); + Player thrower = UtilPlayer.searchExact(_tnt.get(tnt).Thrower); if (thrower == null) { @@ -292,7 +293,7 @@ public class BombLobbers extends TeamGame implements IThrown if (!IsLive()) return; - for (Entry tnt : _tnt.entrySet()) + for (Entry tnt : _tnt.entrySet()) { if (tnt.getKey() == null) continue; @@ -303,7 +304,8 @@ public class BombLobbers extends TeamGame implements IThrown if (UtilEnt.isGrounded(tnt.getKey()) || tnt.getKey().isOnGround()) continue; - Player thrower = UtilPlayer.searchExact(tnt.getValue()); + BombToken token = tnt.getValue(); + Player thrower = UtilPlayer.searchExact(token.Thrower); if (thrower == null) continue; @@ -316,7 +318,41 @@ public class BombLobbers extends TeamGame implements IThrown if (team == null) continue; - UtilParticle.PlayParticle(ParticleType.RED_DUST, tnt.getKey().getLocation().clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); + //A is current + //B is previous + token.B = token.A; + token.A = tnt.getKey().getLocation(); + + if (token.A == null || token.B == null) + continue; + + //Adapted from static lazer code + double curRange = 0; + double distance = Math.abs(token.A.distance(token.B)); + + while (curRange <= distance) + { + Location newTarget = token.B.add(UtilAlg.getTrajectory(token.B, token.A).multiply(curRange)); +// Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange)); + + //Progress Forwards + curRange += 0.2; + + if (team.GetColor() == ChatColor.AQUA) + { + for (int i = 0 ; i < 5 ; i++) + UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0, + ViewDist.LONG, UtilServer.getPlayers()); + } + else + { + for (int i = 0 ; i < 5 ; i++) + UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1, + ViewDist.LONG, UtilServer.getPlayers()); + } + + //UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); + } } } From 335eb5eacdcf9d837af48445d9fa9a59b4ef986a Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 23 Jul 2015 13:35:06 -0400 Subject: [PATCH 25/37] Fixed report link --- Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index eaa6f0e2e..82808334e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -329,7 +329,7 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "Accusing players of cheating in-game is against the rules." + "If you think someone is cheating, please gather evidence and report it at " - + F.link("www.mineplex.com/reports/"))); + + F.link("www.mineplex.com/reports"))); event.setCancelled(true); } else if (_playerLastMessage.containsKey(sender.getUniqueId())) From 365968f41d386386b07caa105fdc8f2047ea958b Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 23 Jul 2015 16:26:43 -0400 Subject: [PATCH 26/37] Added a bomb token thing --- .../arcade/game/games/lobbers/BombToken.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java new file mode 100644 index 000000000..eed18640a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java @@ -0,0 +1,16 @@ +package nautilus.game.arcade.game.games.lobbers; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class BombToken +{ + public final String Thrower; + public Location A = null; + public Location B = null; + + public BombToken(Player player) + { + Thrower = player.getName(); + } +} From 5d87d9e1e49c8646aed4e39a4f7c09327f01be11 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 25 Jul 2015 02:01:55 -0400 Subject: [PATCH 27/37] . --- .../game/arcade/game/games/lobbers/BombLobbers.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 9d5c7eb58..a05ed1cc3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -171,6 +171,15 @@ public class BombLobbers extends TeamGame implements IThrown } } + @EventHandler + public void disableFlying(GameStateChangeEvent event) + { + for (Player player : GetPlayers(true)) + { + player.setAllowFlight(false); + } + } + @EventHandler public void throwTNT(PlayerInteractEvent event) { From a002da4c0f6d8e42e850310e4a6bcab1551263fb Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 25 Jul 2015 03:21:56 -0400 Subject: [PATCH 28/37] Redid how lobbers works --- .../game/games/lobbers/BombLobbers.java | 131 +++++++++++++++--- .../arcade/game/games/lobbers/BombToken.java | 4 + .../game/games/lobbers/kits/KitArmorer.java | 2 +- .../game/games/lobbers/kits/KitDetonator.java | 89 ++---------- .../game/games/lobbers/kits/KitJumper.java | 30 ++-- .../game/games/lobbers/kits/KitWaller.java | 2 +- .../lobbers/kits/perks/PerkCraftman.java | 14 +- .../games/lobbers/kits/perks/PerkMortar.java | 4 +- 8 files changed, 160 insertions(+), 116 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index a05ed1cc3..96bef6555 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -8,6 +8,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilParticle; @@ -15,6 +16,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -214,21 +216,6 @@ public class BombLobbers extends TeamGame implements IThrown _tnt.put(tnt, new BombToken(player)); } - public boolean hasThrower(TNTPrimed tnt) - { - return _tnt.containsKey(tnt); - } - - public void addThrower(Player player, TNTPrimed tnt) - { - _tnt.put(tnt, new BombToken(player)); - } - - public void removeThrower(TNTPrimed tnt) - { - _tnt.remove(tnt); - } - public Player getThrower(TNTPrimed tnt) { if (_tnt.get(tnt) == null) @@ -292,6 +279,104 @@ public class BombLobbers extends TeamGame implements IThrown _tnt.remove(tnt); } + + @EventHandler + public void updateTNT(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + for (Entry tnt : _tnt.entrySet()) + { + if (tnt.getKey() == null) + continue; + + if (!tnt.getKey().isValid()) + continue; + + BombToken token = tnt.getValue(); + Player thrower = UtilPlayer.searchExact(token.Thrower); + + if (thrower == null) + continue; + + if (!IsPlaying(thrower)) + continue; + + if (!token.Primed) + { + if (tnt.getKey().getFuseTicks() <= 20) + { + //Respawn + TNTPrimed newTNT = tnt.getKey().getWorld().spawn(tnt.getKey().getLocation(), TNTPrimed.class); + newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), thrower.getUniqueId())); + newTNT.setVelocity(tnt.getKey().getVelocity()); + newTNT.setFuseTicks(60); + + Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, false, true, .2F); + + tnt.getKey().remove(); + + _tnt.remove(tnt.getKey()); + _tnt.put(newTNT, token); + } + } + } + } + + @EventHandler + public void blockCollision(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + for (Entry tnt : _tnt.entrySet()) + { + if (tnt.getKey() == null) + continue; + + if (!tnt.getKey().isValid()) + continue; + + BombToken token = tnt.getValue(); + Player thrower = UtilPlayer.searchExact(token.Thrower); + + if (thrower == null) + continue; + + if (!IsPlaying(thrower)) + continue; + + if (!token.Primed) + { + //8+ insta explode + if (UtilTime.elapsed(token.Created, 8000)) + { + token.Primed = true; + tnt.getKey().setFuseTicks(0); + continue; + } + else if (UtilTime.elapsed(token.Created, 3000)) + { + for (Block block : UtilBlock.getSurrounding(tnt.getKey().getLocation().getBlock(), true)) + { + if (block.getType() != Material.AIR) + { + token.Primed = true; + tnt.getKey().setFuseTicks(0); + break; + } + } + } + } + } + } @EventHandler public void updateParticles(UpdateEvent event) @@ -429,9 +514,23 @@ public class BombLobbers extends TeamGame implements IThrown @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - if (!(target instanceof Player) || !(data.GetThrower() instanceof Player)) + if (!(data.GetThrown() instanceof TNTPrimed)) return; + TNTPrimed tnt = (TNTPrimed) data.GetThrown(); + + if (_tnt.containsKey(tnt)) + { + _tnt.get(tnt).Primed = true; + tnt.setFuseTicks(0); + } + + if (!(data.GetThrower() instanceof Player)) + return; + + if (!(target instanceof Player)) + return; + if (GetTeam((Player) target) == GetTeam((Player) data.GetThrower())) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java index eed18640a..a7eb4efd7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombToken.java @@ -5,12 +5,16 @@ import org.bukkit.entity.Player; public class BombToken { + public final long Created; public final String Thrower; public Location A = null; public Location B = null; + public boolean Primed = false; public BombToken(Player player) { Thrower = player.getName(); + + Created = System.currentTimeMillis(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index b9184ad47..47ecd4222 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -28,7 +28,7 @@ public class KitArmorer extends Kit C.cGray + "Recieve " + C.cYellow + "Full Gold Armor" }, new Perk[] { - new PerkCraftman(5000) + new PerkCraftman() }, EntityType.ZOMBIE, new ItemStack(Material.AIR)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java index 304ccf255..bba5fd8e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java @@ -1,18 +1,13 @@ package nautilus.game.arcade.game.games.lobbers.kits; -import java.util.Map.Entry; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.lobbers.BombLobbers; -import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; @@ -20,31 +15,26 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; public class KitDetonator extends Kit { - private NautHashMap _respawnTimes = new NautHashMap(); - public KitDetonator(ArcadeManager manager) { super(manager, "Detonator", KitAvailability.Gem, 4000, new String[] { "He doesn't like to wait. ", - C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Fuse Time.", - C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time.", - "Maximum fuse time of " + C.cYellow + "6 Seconds.", - "Minimum fuse time of " + C.cYellow + "2 Seconds.", + C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity", + C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity", + "Maximum Velocity of " + C.cYellow + "3.", + "Minimum Velocity of " + C.cYellow + "1.", }, new Perk[] { - new PerkCraftman(6000) + new PerkCraftman() }, EntityType.ZOMBIE, new ItemBuilder(Material.LEVER).build()); } @@ -52,7 +42,7 @@ public class KitDetonator extends Kit @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).setAmount(3).build()); + player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).build()); } @EventHandler @@ -72,17 +62,12 @@ public class KitDetonator extends Kit } else { - if (lever.getAmount() < 2 || lever.getAmount() > 6) + if (lever.getAmount() < 1 || lever.getAmount() > 3) { GiveItems(event.getPlayer()); } - - event.getTNT().setFuseTicks(lever.getAmount() * 20); - if (lever.getAmount() > 3) - { - _respawnTimes.put(event.getTNT(), System.currentTimeMillis() + 3000); - } + UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), lever.getAmount(), false, 0.0D, 0.1D, 10.0D, false); } } @@ -106,70 +91,20 @@ public class KitDetonator extends Kit //Right if (UtilEvent.isAction(event, ActionType.R)) { - if (amount >= 6) + if (amount >= 3) return; - UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Fuse Selector (Seconds)")).build()); + UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).build()); UtilInv.Update(event.getPlayer()); } //Left else if (UtilEvent.isAction(event, ActionType.L)) { - if (amount <= 2) + if (amount <= 1) return; UtilInv.remove(event.getPlayer(), Material.LEVER, (byte) 0, 1); UtilInv.Update(event.getPlayer()); } - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CLICK, 3.0F, 1.0F); - } - - @EventHandler - public void respawnBombs(UpdateEvent event) - { - if (!(Manager.GetGame() instanceof BombLobbers)) - return; - - BombLobbers l = (BombLobbers) Manager.GetGame(); - - if (!Manager.GetGame().IsLive()) - return; - - for (Entry entry : _respawnTimes.entrySet()) - { - if (entry.getKey() == null || !entry.getKey().isValid()) - return; - - //If it will need respawning - if (System.currentTimeMillis() >= entry.getValue()) - { - Player player = l.getThrower(entry.getKey()); - - if (player == null) - continue; - - TNTPrimed newTNT = entry.getKey().getWorld().spawn(entry.getKey().getLocation(), TNTPrimed.class); - newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId())); - newTNT.setVelocity(entry.getKey().getVelocity()); - newTNT.setFuseTicks(60); - - Manager.GetProjectile().AddThrow(newTNT, player, l, -1L, true, false, true, .2F); - - entry.getKey().remove(); - l.removeThrower(entry.getKey()); - _respawnTimes.remove(entry.getKey()); - - l.addThrower(player, newTNT); - } - } - } - - @EventHandler - public void onExplode(TNTPreExplodeEvent event) - { - if (_respawnTimes.containsKey(event.getTNT())) - { - _respawnTimes.remove(event.getTNT()); - } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java index 20e73f9cd..ec0a9cbe7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitJumper.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.lobbers.kits; import mineplex.core.itemstack.ItemBuilder; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; @@ -10,8 +11,9 @@ import nautilus.game.arcade.kit.perks.PerkDoubleJump; import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; public class KitJumper extends Kit { @@ -20,7 +22,8 @@ public class KitJumper extends Kit { super(manager, "Jumper", KitAvailability.Free, 0, new String[] { - "Use your jumping abilities to leap away from trouble!" + "Use your jumping abilities to leap away from trouble!", + "You take no fall damage." }, new Perk[] { new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true), @@ -33,11 +36,22 @@ public class KitJumper extends Kit { } - - @Override - public void SpawnCustom(LivingEntity ent) + + @EventHandler + public void onDamage(CustomDamageEvent event) { - + if (!Manager.GetGame().IsLive()) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + if (!HasKit(event.GetDamageePlayer())) + return; + + if (event.GetCause() == DamageCause.FALL) + { + event.SetCancelled("Jumper no fall damage"); + } } - -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java index 7d9d760e8..022fb8b75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitWaller.java @@ -24,7 +24,7 @@ public class KitWaller extends Kit }, new Perk[] { new PerkWaller(), - new PerkCraftman(6000) + new PerkCraftman() }, EntityType.ZOMBIE, new ItemBuilder(Material.SMOOTH_BRICK).setUnbreakable(true).build()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java index 9373d293b..9c1e6fc8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -16,23 +16,15 @@ import org.bukkit.event.EventHandler; public class PerkCraftman extends Perk { private Recharge _recharge; - - private final long _giveTime; - + public PerkCraftman() - { - this(4000); - } - - public PerkCraftman(long giveTime) { super("Craftman", new String[] { - C.cGray + "Recieve 1 TNT every " + C.cYellow + giveTime / 1000 + " Seconds." + C.cGray + " Maximum of 3." + C.cGray + "Recieve 1 TNT every so often. Maximum of 3." }); _recharge = Recharge.Instance; - _giveTime = giveTime; } @EventHandler @@ -49,7 +41,7 @@ public class PerkCraftman extends Perk if (!Kit.HasKit(player)) continue; - if (!_recharge.use(player, "Bomb Give", _giveTime, false, false)) + if (!_recharge.use(player, "Bomb Give", (long) (1000 * (8 - Math.floor(Manager.GetGame().getGameLiveTime() / 20))), false, false)) continue; //Has 3 diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java index e79aaefff..db295ff13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkMortar.java @@ -72,7 +72,7 @@ public class PerkMortar extends Perk player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); - l.addThrower(player, tnt); +// l.addThrower(player, tnt); } @EventHandler @@ -109,7 +109,7 @@ public class PerkMortar extends Perk UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, false, false, .2F); - l.addThrower(event.getPlayer(), tnt); +// l.addThrower(event.getPlayer(), tnt); _scatter.add(tnt); } } From d295cead09e3b752bb758ff7a63983d024005be4 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 25 Jul 2015 04:18:18 -0400 Subject: [PATCH 29/37] Final stuff --- .../game/games/lobbers/BombLobbers.java | 35 ++++++++++--------- .../{KitDetonator.java => KitPitcher.java} | 24 +++++++++---- .../lobbers/kits/perks/PerkCraftman.java | 26 ++++++++++++-- .../games/lobbers/kits/perks/PerkWaller.java | 21 ----------- 4 files changed, 60 insertions(+), 46 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/{KitDetonator.java => KitPitcher.java} (84%) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 96bef6555..ce716f561 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -24,6 +24,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -32,7 +33,7 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer; -import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator; +import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher; import nautilus.game.arcade.game.games.lobbers.kits.KitJumper; import nautilus.game.arcade.game.games.lobbers.kits.KitWaller; import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill; @@ -43,7 +44,6 @@ import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown; import nautilus.game.arcade.kit.Kit; import org.bukkit.ChatColor; -import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -52,6 +52,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.metadata.FixedMetadataValue; @@ -72,7 +73,7 @@ public class BombLobbers extends TeamGame implements IThrown { new KitJumper(manager), new KitArmorer(manager), - new KitDetonator(manager), + new KitPitcher(manager), // new KitMortar(manager), << Spare time kit for Bobbeh new KitWaller(manager) }, new String[] @@ -289,8 +290,11 @@ public class BombLobbers extends TeamGame implements IThrown if (!IsLive()) return; - for (Entry tnt : _tnt.entrySet()) + Iterator> iterator = _tnt.entrySet().iterator(); + while (iterator.hasNext()) { + Entry tnt = iterator.next(); + if (tnt.getKey() == null) continue; @@ -516,15 +520,7 @@ public class BombLobbers extends TeamGame implements IThrown { if (!(data.GetThrown() instanceof TNTPrimed)) return; - - TNTPrimed tnt = (TNTPrimed) data.GetThrown(); - - if (_tnt.containsKey(tnt)) - { - _tnt.get(tnt).Primed = true; - tnt.setFuseTicks(0); - } - + if (!(data.GetThrower() instanceof Player)) return; @@ -537,10 +533,9 @@ public class BombLobbers extends TeamGame implements IThrown data.GetThrown().setVelocity(new Vector()); if (target != null) - { UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true); - target.playEffect(EntityEffect.HURT); - } + + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 6.0, false, false, true, "Throwing TNT", "Throwing TNT Direct Hit"); } @Override @@ -554,4 +549,12 @@ public class BombLobbers extends TeamGame implements IThrown { } + + public void knockbackIncrease(CustomDamageEvent event) + { + if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION) + return; + + event.AddKnockback("Explosion", 1.5D); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java similarity index 84% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java index bba5fd8e5..8e69a8499 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitDetonator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java @@ -21,13 +21,14 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -public class KitDetonator extends Kit +public class KitPitcher extends Kit { - public KitDetonator(ArcadeManager manager) + public KitPitcher(ArcadeManager manager) { - super(manager, "Detonator", KitAvailability.Gem, 4000, new String[] + super(manager, "Pitcher", KitAvailability.Gem, 4000, new String[] { - "He doesn't like to wait. ", + "He can easily pitch the perfect shot for any occasion.", + "", C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity", C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity", "Maximum Velocity of " + C.cYellow + "3.", @@ -42,7 +43,7 @@ public class KitDetonator extends Kit @Override public void GiveItems(Player player) { - player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).build()); + player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).setAmount(3).build()); } @EventHandler @@ -67,7 +68,7 @@ public class KitDetonator extends Kit GiveItems(event.getPlayer()); } - UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), lever.getAmount(), false, 0.0D, 0.1D, 10.0D, false); + UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), getVelocity(lever.getAmount()), false, 0.0D, 0.1D, 10.0D, false); } } @@ -107,4 +108,15 @@ public class KitDetonator extends Kit UtilInv.Update(event.getPlayer()); } } + + private double getVelocity(int amount) + { + if (amount == 1) + return 1.5; + + if (amount == 2) + return 1.75; + + return 2.0; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java index 9c1e6fc8a..7e89b427f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkCraftman.java @@ -22,7 +22,7 @@ public class PerkCraftman extends Perk super("Craftman", new String[] { C.cGray + "Recieve 1 TNT every so often. Maximum of 3." - }); + }, false); _recharge = Recharge.Instance; } @@ -40,8 +40,9 @@ public class PerkCraftman extends Perk { if (!Kit.HasKit(player)) continue; - - if (!_recharge.use(player, "Bomb Give", (long) (1000 * (8 - Math.floor(Manager.GetGame().getGameLiveTime() / 20))), false, false)) + //If game time is 56 seconds - 56000 + //8 - 1 + if (!_recharge.use(player, "Bomb Give", getRechargeTime(), false, false)) continue; //Has 3 @@ -51,4 +52,23 @@ public class PerkCraftman extends Perk UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).build()); } } + + private long getRechargeTime() + { + long ingame = Manager.GetGame().getGameLiveTime(); + + if (ingame <= 20000) + return 8000; + + if (ingame <= 40000) + return 7000; + + if (ingame <= 60000) + return 6000; + + if (ingame <= 620000) + return 5000; + + return 4000; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index 7f696aa22..afb0e8b47 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -77,27 +77,6 @@ public class PerkWaller extends Perk _wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw())); } - @EventHandler - public void explodeTNT(UpdateEvent event) - { - if (!Manager.GetGame().IsLive()) - return; - - if (event.getType() != UpdateType.FAST) - return; - - for (TNTPrimed tnt : _tnt) - { - for (Block near : UtilBlock.getInRadius(tnt.getLocation(), 3.0F).keySet()) - { - if (_wallBlocks.contains(near.getLocation())) - { - tnt.setFuseTicks(0); - } - } - } - } - @SuppressWarnings("deprecation") private Set buildWall(final Location source, final float playerYaw) { From 84be48f2648869a3c468cba2f8c3412f2d135cbb Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sat, 25 Jul 2015 01:30:50 -0700 Subject: [PATCH 30/37] Updated MiniDbClientPlugin to include accountId in the processLoginResultSet method. Added conversion of stats to new stat table via StatHandler. Changed stats value from int to long. --- .../src/mineplex/core/MiniDbClientPlugin.java | 2 +- .../core/account/ILoginProcessor.java | 2 +- .../account/repository/AccountRepository.java | 2 +- .../core/achievement/Achievement.java | 2 +- .../core/achievement/AchievementData.java | 10 +- .../core/achievement/AchievementLog.java | 4 +- .../mineplex/core/benefit/BenefitManager.java | 2 +- .../core/donation/DonationManager.java | 2 +- .../src/mineplex/core/elo/EloManager.java | 2 +- .../mineplex/core/friend/FriendManager.java | 2 +- .../mineplex/core/ignore/IgnoreManager.java | 2 +- .../core/inventory/InventoryManager.java | 2 +- .../core/preferences/PreferencesManager.java | 2 +- .../src/mineplex/core/stats/PlayerStats.java | 10 +- .../core/stats/SecondaryStatHandler.java | 99 +++++ .../src/mineplex/core/stats/StatsManager.java | 37 +- .../mineplex/core/stats/StatsRepository.java | 26 +- .../core/stats/command/GiveStatCommand.java | 2 +- .../core/stats/command/TimeCommand.java | 4 +- .../core/stats/event/StatChangeEvent.java | 10 +- .../src/mineplex/core/task/TaskManager.java | 2 +- .../src/mineplex/database/Account.java | 5 +- .../src/mineplex/database/Keys.java | 18 + .../src/mineplex/database/Routines.java | 41 +- .../src/mineplex/database/Tables.java | 15 + .../database/routines/AccountGoldChange.java | 67 ++++ .../database/routines/Check_daily.java | 26 +- .../database/routines/Check_rank.java | 93 +++++ .../mineplex/database/routines/TestPro.java | 41 ++ .../mineplex/database/tables/AccountStat.java | 109 ++++++ .../src/mineplex/database/tables/Bonus.java | 4 +- .../src/mineplex/database/tables/Clans.java | 27 +- .../src/mineplex/database/tables/Mailbox.java | 137 +++++++ .../database/tables/RankBenefits.java | 117 ++++++ .../tables/records/AccountStatRecord.java | 199 ++++++++++ .../database/tables/records/BonusRecord.java | 24 +- .../database/tables/records/ClansRecord.java | 218 ++++++++++- .../tables/records/MailboxRecord.java | 359 ++++++++++++++++++ .../tables/records/RankBenefitsRecord.java | 199 ++++++++++ .../src/mineplex/hub/HubRepository.java | 27 -- .../src/mineplex/hub/modules/NewsManager.java | 2 +- .../src/mineplex/hub/poll/PollManager.java | 4 +- .../command/GemHunterCommand.java | 2 +- 43 files changed, 1830 insertions(+), 130 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/routines/AccountGoldChange.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/routines/Check_rank.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/routines/TestPro.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/tables/Mailbox.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/tables/RankBenefits.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/tables/records/MailboxRecord.java create mode 100644 Plugins/Mineplex.Database/src/mineplex/database/tables/records/RankBenefitsRecord.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniDbClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniDbClientPlugin.java index 92e2ea3cb..2f479adeb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniDbClientPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniDbClientPlugin.java @@ -21,7 +21,7 @@ public abstract class MiniDbClientPlugin extends MiniCl clientManager.addStoredProcedureLoginProcessor(this); } - public abstract void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException; + public abstract void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException; public CoreClientManager getClientManager() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/ILoginProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/account/ILoginProcessor.java index aca0eb341..2f278165b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/ILoginProcessor.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/ILoginProcessor.java @@ -7,7 +7,7 @@ public interface ILoginProcessor { String getName(); - void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException; + void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException; String getQuery(int accountId, String uuid, String name); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index 954f3eaa9..60f756748 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -142,7 +142,7 @@ public class AccountRepository extends RepositoryBase for (ILoginProcessor loginProcessor : loginProcessors.values()) { - loginProcessor.processLoginResultSet(name, statement.getResultSet()); + loginProcessor.processLoginResultSet(name, accountId, statement.getResultSet()); statement.getMoreResults(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index a1d818cca..8bbb530e2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -754,7 +754,7 @@ public enum Achievement return _category; } - public AchievementData getLevelData(int exp) + public AchievementData getLevelData(long exp) { for (int i = 0; i < _levels.length; i++) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementData.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementData.java index 41e9562a2..5f1f617fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementData.java @@ -3,10 +3,10 @@ package mineplex.core.achievement; public class AchievementData { private int _level; - private int _expRemainder; - private int _expNextLevel; + private long _expRemainder; + private long _expNextLevel; - public AchievementData(int level, int expRemainder, int expNextLevel) + public AchievementData(int level, long expRemainder, long expNextLevel) { _level = level; _expRemainder = expRemainder; @@ -18,12 +18,12 @@ public class AchievementData return _level; } - public int getExpRemainder() + public long getExpRemainder() { return _expRemainder; } - public int getExpNextLevel() + public long getExpNextLevel() { return _expNextLevel; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementLog.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementLog.java index 6d6e37f91..1684c162f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementLog.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementLog.java @@ -2,10 +2,10 @@ package mineplex.core.achievement; public class AchievementLog { - public int Amount; + public long Amount; public boolean LevelUp; - public AchievementLog(int amount, boolean levelUp) + public AchievementLog(long amount, boolean levelUp) { Amount = amount; LevelUp = levelUp; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java index 973950020..0301e0225 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManager.java @@ -73,7 +73,7 @@ public class BenefitManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.retrievePlayerBenefitData(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 5b4ca0932..aaad37d68 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -386,7 +386,7 @@ public class DonationManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Get(playerName).addGold(_repository.retrieveDonorInfo(resultSet).getGold()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 01f927d39..d1c44b6d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -108,7 +108,7 @@ public class EloManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java index c25fec865..cafd20ec9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/FriendManager.java @@ -401,7 +401,7 @@ public class FriendManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java index 7edaa801f..e7b8732c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/IgnoreManager.java @@ -230,7 +230,7 @@ public class IgnoreManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 2cb728e5c..8c87db300 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -251,7 +251,7 @@ public class InventoryManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java index b24e700ba..6a96dcd16 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesManager.java @@ -106,7 +106,7 @@ public class PreferencesManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java index 02b67752a..b5caa1745 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java @@ -6,13 +6,13 @@ import mineplex.core.common.util.NautHashMap; public class PlayerStats { - private NautHashMap _statHash = new NautHashMap(); + private NautHashMap _statHash = new NautHashMap(); - public int addStat(String statName, int value) + public long addStat(String statName, long value) { if (!_statHash.containsKey(statName)) { - _statHash.put(statName, 0); + _statHash.put(statName, 0L); } _statHash.put(statName, _statHash.get(statName) + value); @@ -20,9 +20,9 @@ public class PlayerStats return _statHash.get(statName); } - public int getStat(String statName) + public long getStat(String statName) { - return _statHash.containsKey(statName) ? _statHash.get(statName) : 0; + return _statHash.containsKey(statName) ? _statHash.get(statName) : 0L; } public Set getStatsNames() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java new file mode 100644 index 000000000..1aa39a19c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java @@ -0,0 +1,99 @@ +package mineplex.core.stats; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.jooq.Configuration; +import org.jooq.DSLContext; +import org.jooq.Delete; +import org.jooq.Insert; +import org.jooq.SQLDialect; +import org.jooq.TransactionalRunnable; +import org.jooq.Update; +import org.jooq.impl.DSL; + +import mineplex.core.account.ILoginProcessor; +import mineplex.core.database.DBPool; +import mineplex.database.Tables; + +public class SecondaryStatHandler implements ILoginProcessor +{ + private StatsManager _statsManager; + private StatsRepository _repository; + + public SecondaryStatHandler(StatsManager statsManager, StatsRepository repository) + { + _statsManager = statsManager; + _repository = repository; + } + + @Override + public String getName() + { + return "Secondary Stat Handler"; + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + PlayerStats oldPlayerStats = _statsManager.Get(playerName); + PlayerStats newPlayerStats = _repository.loadClientInformation(resultSet); + + if (newPlayerStats.getStatsNames().size() == 0 && oldPlayerStats.getStatsNames().size() != 0) + { + try + { + DSLContext context = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL); + + final List inserts = new ArrayList<>(); + final List deletes = new ArrayList<>(); + + for (String statName : oldPlayerStats.getStatsNames()) + { + Integer statId = _statsManager.getStatId(statName); + + Insert insert = context + .insertInto(Tables.accountStat) + .set(Tables.accountStat.accountId, accountId) + .set(Tables.accountStat.statId, statId) + .set(Tables.accountStat.value, oldPlayerStats.getStat(statName)); + + inserts.add(insert); + + Delete delete = context.delete(Tables.accountStats) + .where(Tables.accountStats.accountId.equal(accountId)); + + deletes.add(delete); + } + + context.transaction(new TransactionalRunnable() + { + @Override + public void run(Configuration config) throws Exception + { + DSL.using(config).batch(inserts).execute(); + DSL.using(config).batch(deletes).execute(); + } + }); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + else + { + _statsManager.replacePlayerHack(playerName, newPlayerStats); + } + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT stats.name, value FROM accountStat INNER JOIN stats ON stats.id = accountStat.statId WHERE accountStat.accountId = '" + accountId + "';"; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 8ab29b11d..16d079282 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniDbClientPlugin; -import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilServer; @@ -24,7 +23,7 @@ public class StatsManager extends MiniDbClientPlugin private StatsRepository _repository; private NautHashMap _stats = new NautHashMap(); - private NautHashMap> _statUploadQueue = new NautHashMap>(); + private NautHashMap> _statUploadQueue = new NautHashMap>(); private Runnable _saveRunnable; public StatsManager(JavaPlugin plugin, CoreClientManager clientManager) @@ -50,11 +49,13 @@ public class StatsManager extends MiniDbClientPlugin { _stats.put(stat.Name, stat.Id); } + + clientManager.addStoredProcedureLoginProcessor(new SecondaryStatHandler(this, _repository)); } - public void incrementStat(final Player player, final String statName, final int value) + public void incrementStat(final Player player, final String statName, final long value) { - int newValue = Get(player).addStat(statName, value); + long newValue = Get(player).addStat(statName, value); //Event UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue)); @@ -97,15 +98,15 @@ public class StatsManager extends MiniDbClientPlugin } } - private void addToQueue(String statName, Player player, int value) + private void addToQueue(String statName, Player player, long value) { synchronized (_statSync) { if (!_statUploadQueue.containsKey(player)) - _statUploadQueue.put(player, new NautHashMap()); + _statUploadQueue.put(player, new NautHashMap()); if (!_statUploadQueue.get(player).containsKey(statName)) - _statUploadQueue.get(player).put(statName, 0); + _statUploadQueue.get(player).put(statName, 0L); _statUploadQueue.get(player).put(statName, _statUploadQueue.get(player).get(statName) + value); } @@ -118,7 +119,7 @@ public class StatsManager extends MiniDbClientPlugin try { - NautHashMap> uploadQueue = new NautHashMap>(); + NautHashMap> uploadQueue = new NautHashMap>(); synchronized (_statSync) { @@ -131,7 +132,7 @@ public class StatsManager extends MiniDbClientPlugin int uploadKey = ClientManager.getCachedClientAccountId(player.getUniqueId()); - uploadQueue.put(uploadKey, new NautHashMap()); + uploadQueue.put(uploadKey, new NautHashMap()); for (String statName : _statUploadQueue.get(player).keySet()) { @@ -152,13 +153,13 @@ public class StatsManager extends MiniDbClientPlugin } } - public boolean incrementStat(final int accountId, final String statName, final int value) + public boolean incrementStat(final int accountId, final String statName, final long value) { if (_stats.containsKey(statName)) return false; - final NautHashMap> uploadQueue = new NautHashMap>(); - uploadQueue.put(accountId, new NautHashMap()); + final NautHashMap> uploadQueue = new NautHashMap>(); + uploadQueue.put(accountId, new NautHashMap()); uploadQueue.get(accountId).put(_stats.get(statName), value); runAsync(new Runnable() @@ -172,6 +173,16 @@ public class StatsManager extends MiniDbClientPlugin return true; } + public int getStatId(String statName) + { + return _stats.get(statName); + } + + public void replacePlayerHack(String playerName, PlayerStats playerStats) + { + Set(playerName, playerStats); + } + @Override protected PlayerStats AddPlayer(String player) { @@ -191,7 +202,7 @@ public class StatsManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index 23d3daa9d..683cca93d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -77,7 +77,7 @@ public class StatsRepository extends RepositoryBase } @SuppressWarnings("rawtypes") - public void saveStats(NautHashMap> uploadQueue) + public void saveStats(NautHashMap> uploadQueue) { try { @@ -91,18 +91,18 @@ public class StatsRepository extends RepositoryBase for (Integer statId : uploadQueue.get(accountId).keySet()) { Update update = context - .update(Tables.accountStats) - .set(Tables.accountStats.value, Tables.accountStats.value.plus(uploadQueue.get(accountId).get(statId))) - .where(Tables.accountStats.accountId.eq(accountId)) - .and(Tables.accountStats.statId.eq(statId)); + .update(Tables.accountStat) + .set(Tables.accountStat.value, Tables.accountStat.value.plus(uploadQueue.get(accountId).get(statId))) + .where(Tables.accountStat.accountId.eq(accountId)) + .and(Tables.accountStat.statId.eq(statId)); updates.add(update); Insert insert = context - .insertInto(Tables.accountStats) - .set(Tables.accountStats.accountId, accountId) - .set(Tables.accountStats.statId, statId) - .set(Tables.accountStats.value, uploadQueue.get(accountId).get(statId)); + .insertInto(Tables.accountStat) + .set(Tables.accountStat.accountId, accountId) + .set(Tables.accountStat.statId, statId) + .set(Tables.accountStat.value, uploadQueue.get(accountId).get(statId)); inserts.add(insert); } @@ -137,10 +137,10 @@ public class StatsRepository extends RepositoryBase context = DSL.using(getConnectionPool(), SQLDialect.MYSQL); } - Result> result = context.select(Tables.stats.name, Tables.accountStats.value).from(Tables.accountStats) + Result> result = context.select(Tables.stats.name, Tables.accountStat.value).from(Tables.accountStat) .join(Tables.stats) - .on(Tables.stats.id.eq(Tables.accountStats.statId)) - .where(Tables.accountStats.accountId.eq(DSL.select(Tables.accounts.id) + .on(Tables.stats.id.eq(Tables.accountStat.statId)) + .where(Tables.accountStat.accountId.eq(DSL.select(Tables.accounts.id) .from(Tables.accounts) .where(Tables.accounts.name.eq(playerName))) ).fetch(); @@ -149,7 +149,7 @@ public class StatsRepository extends RepositoryBase if (result.isNotEmpty()) { playerStats = new PlayerStats(); - for (Record2 record : result) + for (Record2 record : result) { playerStats.addStat(record.value1(), record.value2()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java index 35293a2b5..60212f1d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/GiveStatCommand.java @@ -47,7 +47,7 @@ public class GiveStatCommand extends CommandBase final CoreClient client = Plugin.getClientManager().Get(args[0]); if (client != null) - Plugin.incrementStat(client.getAccountId(), statName, Integer.parseInt(args[args.length - 1])); + Plugin.incrementStat(client.getAccountId(), statName, Long.parseLong(args[args.length - 1])); else caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + args[0] + "'s account!")); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java index 321f7f14a..2754465d8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/command/TimeCommand.java @@ -55,7 +55,7 @@ public class TimeCommand extends CommandBase } else { - int time = stats.getStat("Global.TimeInGame"); + long time = stats.getStat("Global.TimeInGame"); UtilPlayer.message(caller, F.main("Time", F.name(args[0]) + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game")); } } @@ -70,7 +70,7 @@ public class TimeCommand extends CommandBase } else { - int time = Plugin.Get(target).getStat("Global.TimeInGame"); + long time = Plugin.Get(target).getStat("Global.TimeInGame"); UtilPlayer.message(caller, F.main("Time", F.name(target.getName() + " has spent " + F.elem(UtilTime.convertString(time * 1000L, 1, UtilTime.TimeUnit.FIT)) + " in game"))); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java index ec1c230f1..2dc93919f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/event/StatChangeEvent.java @@ -11,10 +11,10 @@ public class StatChangeEvent extends Event private String _player; private String _statName; - private int _valueBefore; - private int _valueAfter; + private long _valueBefore; + private long _valueAfter; - public StatChangeEvent(String player, String statName, int valueBefore, int valueAfter) + public StatChangeEvent(String player, String statName, long valueBefore, long valueAfter) { _player = player; _statName = statName; @@ -42,12 +42,12 @@ public class StatChangeEvent extends Event return _statName; } - public int getValueBefore() + public long getValueBefore() { return _valueBefore; } - public int getValueAfter() + public long getValueAfter() { return _valueAfter; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java index fc9e67158..2ecce2580 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java @@ -134,7 +134,7 @@ public class TaskManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadClientInformation(resultSet)); } diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Account.java b/Plugins/Mineplex.Database/src/mineplex/database/Account.java index dbbc64d17..9e66bafa8 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Account.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Account.java @@ -16,7 +16,7 @@ package mineplex.database; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Account extends org.jooq.impl.SchemaImpl implements java.io.Serializable, java.lang.Cloneable { - private static final long serialVersionUID = -478529995; + private static final long serialVersionUID = 625106486; /** * The reference instance of Account @@ -48,6 +48,7 @@ public class Account extends org.jooq.impl.SchemaImpl implements java.io.Seriali mineplex.database.tables.AccountPolls.accountPolls, mineplex.database.tables.AccountPreferences.accountPreferences, mineplex.database.tables.Accounts.accounts, + mineplex.database.tables.AccountStat.accountStat, mineplex.database.tables.AccountStats.accountStats, mineplex.database.tables.AccountTasks.accountTasks, mineplex.database.tables.AccountTransactions.accountTransactions, @@ -67,9 +68,11 @@ public class Account extends org.jooq.impl.SchemaImpl implements java.io.Seriali mineplex.database.tables.ItemCategories.itemCategories, mineplex.database.tables.Items.items, mineplex.database.tables.Mail.mail, + mineplex.database.tables.Mailbox.mailbox, mineplex.database.tables.Npcs.npcs, mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.Polls.polls, + mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.Spawns.spawns, mineplex.database.tables.StatEvents.statEvents, diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Keys.java b/Plugins/Mineplex.Database/src/mineplex/database/Keys.java index 5b882d388..4eb24c54d 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Keys.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Keys.java @@ -47,9 +47,11 @@ public class Keys { public static final org.jooq.Identity IDENTITY_itemCategories = Identities0.IDENTITY_itemCategories; public static final org.jooq.Identity IDENTITY_items = Identities0.IDENTITY_items; public static final org.jooq.Identity IDENTITY_mail = Identities0.IDENTITY_mail; + public static final org.jooq.Identity IDENTITY_mailbox = Identities0.IDENTITY_mailbox; public static final org.jooq.Identity IDENTITY_npcs = Identities0.IDENTITY_npcs; public static final org.jooq.Identity IDENTITY_playerMap = Identities0.IDENTITY_playerMap; public static final org.jooq.Identity IDENTITY_polls = Identities0.IDENTITY_polls; + public static final org.jooq.Identity IDENTITY_rankBenefits = Identities0.IDENTITY_rankBenefits; public static final org.jooq.Identity IDENTITY_serverPassword = Identities0.IDENTITY_serverPassword; public static final org.jooq.Identity IDENTITY_spawns = Identities0.IDENTITY_spawns; public static final org.jooq.Identity IDENTITY_statEvents = Identities0.IDENTITY_statEvents; @@ -75,6 +77,7 @@ public class Keys { public static final org.jooq.UniqueKey KEY_accountPreferences_uuid_index = UniqueKeys0.KEY_accountPreferences_uuid_index; public static final org.jooq.UniqueKey KEY_accounts_PRIMARY = UniqueKeys0.KEY_accounts_PRIMARY; public static final org.jooq.UniqueKey KEY_accounts_uuidIndex = UniqueKeys0.KEY_accounts_uuidIndex; + public static final org.jooq.UniqueKey KEY_accountStat_PRIMARY = UniqueKeys0.KEY_accountStat_PRIMARY; public static final org.jooq.UniqueKey KEY_accountStats_PRIMARY = UniqueKeys0.KEY_accountStats_PRIMARY; public static final org.jooq.UniqueKey KEY_accountTasks_PRIMARY = UniqueKeys0.KEY_accountTasks_PRIMARY; public static final org.jooq.UniqueKey KEY_accountTransactions_PRIMARY = UniqueKeys0.KEY_accountTransactions_PRIMARY; @@ -101,10 +104,12 @@ public class Keys { public static final org.jooq.UniqueKey KEY_items_PRIMARY = UniqueKeys0.KEY_items_PRIMARY; public static final org.jooq.UniqueKey KEY_items_uniqueNameCategoryIndex = UniqueKeys0.KEY_items_uniqueNameCategoryIndex; public static final org.jooq.UniqueKey KEY_mail_PRIMARY = UniqueKeys0.KEY_mail_PRIMARY; + public static final org.jooq.UniqueKey KEY_mailbox_PRIMARY = UniqueKeys0.KEY_mailbox_PRIMARY; public static final org.jooq.UniqueKey KEY_npcs_PRIMARY = UniqueKeys0.KEY_npcs_PRIMARY; public static final org.jooq.UniqueKey KEY_playerMap_PRIMARY = UniqueKeys0.KEY_playerMap_PRIMARY; public static final org.jooq.UniqueKey KEY_playerMap_playerIndex = UniqueKeys0.KEY_playerMap_playerIndex; public static final org.jooq.UniqueKey KEY_polls_PRIMARY = UniqueKeys0.KEY_polls_PRIMARY; + public static final org.jooq.UniqueKey KEY_rankBenefits_PRIMARY = UniqueKeys0.KEY_rankBenefits_PRIMARY; public static final org.jooq.UniqueKey KEY_serverPassword_PRIMARY = UniqueKeys0.KEY_serverPassword_PRIMARY; public static final org.jooq.UniqueKey KEY_spawns_PRIMARY = UniqueKeys0.KEY_spawns_PRIMARY; public static final org.jooq.UniqueKey KEY_statEvents_PRIMARY = UniqueKeys0.KEY_statEvents_PRIMARY; @@ -131,6 +136,8 @@ public class Keys { public static final org.jooq.ForeignKey accountInventory_ibfk_2 = ForeignKeys0.accountInventory_ibfk_2; public static final org.jooq.ForeignKey accountPolls_ibfk_1 = ForeignKeys0.accountPolls_ibfk_1; public static final org.jooq.ForeignKey accountPolls_ibfk_2 = ForeignKeys0.accountPolls_ibfk_2; + public static final org.jooq.ForeignKey accountStat_account = ForeignKeys0.accountStat_account; + public static final org.jooq.ForeignKey accountStat_stat = ForeignKeys0.accountStat_stat; public static final org.jooq.ForeignKey accountStats_ibfk_1 = ForeignKeys0.accountStats_ibfk_1; public static final org.jooq.ForeignKey accountStats_ibfk_2 = ForeignKeys0.accountStats_ibfk_2; public static final org.jooq.ForeignKey ACCOUNTTASKS_ACCOUNTID = ForeignKeys0.ACCOUNTTASKS_ACCOUNTID; @@ -147,6 +154,8 @@ public class Keys { public static final org.jooq.ForeignKey clanTerritory_ibfk_2 = ForeignKeys0.clanTerritory_ibfk_2; public static final org.jooq.ForeignKey items_ibfk_1 = ForeignKeys0.items_ibfk_1; public static final org.jooq.ForeignKey mail_ibfk_1 = ForeignKeys0.mail_ibfk_1; + public static final org.jooq.ForeignKey mailbox_ibfk_1 = ForeignKeys0.mailbox_ibfk_1; + public static final org.jooq.ForeignKey rankBenefits_ibfk_1 = ForeignKeys0.rankBenefits_ibfk_1; // ------------------------------------------------------------------------- // [#1459] distribute members to avoid static initialisers > 64kb @@ -179,9 +188,11 @@ public class Keys { public static org.jooq.Identity IDENTITY_itemCategories = createIdentity(mineplex.database.tables.ItemCategories.itemCategories, mineplex.database.tables.ItemCategories.itemCategories.id); public static org.jooq.Identity IDENTITY_items = createIdentity(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.id); public static org.jooq.Identity IDENTITY_mail = createIdentity(mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.id); + public static org.jooq.Identity IDENTITY_mailbox = createIdentity(mineplex.database.tables.Mailbox.mailbox, mineplex.database.tables.Mailbox.mailbox.id); public static org.jooq.Identity IDENTITY_npcs = createIdentity(mineplex.database.tables.Npcs.npcs, mineplex.database.tables.Npcs.npcs.id); public static org.jooq.Identity IDENTITY_playerMap = createIdentity(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.id); public static org.jooq.Identity IDENTITY_polls = createIdentity(mineplex.database.tables.Polls.polls, mineplex.database.tables.Polls.polls.id); + public static org.jooq.Identity IDENTITY_rankBenefits = createIdentity(mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.id); public static org.jooq.Identity IDENTITY_serverPassword = createIdentity(mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.ServerPassword.serverPassword.id); public static org.jooq.Identity IDENTITY_spawns = createIdentity(mineplex.database.tables.Spawns.spawns, mineplex.database.tables.Spawns.spawns.id); public static org.jooq.Identity IDENTITY_statEvents = createIdentity(mineplex.database.tables.StatEvents.statEvents, mineplex.database.tables.StatEvents.statEvents.eventId); @@ -205,6 +216,7 @@ public class Keys { public static final org.jooq.UniqueKey KEY_accountPreferences_uuid_index = createUniqueKey(mineplex.database.tables.AccountPreferences.accountPreferences, mineplex.database.tables.AccountPreferences.accountPreferences.uuid); public static final org.jooq.UniqueKey KEY_accounts_PRIMARY = createUniqueKey(mineplex.database.tables.Accounts.accounts, mineplex.database.tables.Accounts.accounts.id); public static final org.jooq.UniqueKey KEY_accounts_uuidIndex = createUniqueKey(mineplex.database.tables.Accounts.accounts, mineplex.database.tables.Accounts.accounts.uuid); + public static final org.jooq.UniqueKey KEY_accountStat_PRIMARY = createUniqueKey(mineplex.database.tables.AccountStat.accountStat, mineplex.database.tables.AccountStat.accountStat.accountId, mineplex.database.tables.AccountStat.accountStat.statId); public static final org.jooq.UniqueKey KEY_accountStats_PRIMARY = createUniqueKey(mineplex.database.tables.AccountStats.accountStats, mineplex.database.tables.AccountStats.accountStats.id); public static final org.jooq.UniqueKey KEY_accountTasks_PRIMARY = createUniqueKey(mineplex.database.tables.AccountTasks.accountTasks, mineplex.database.tables.AccountTasks.accountTasks.id); public static final org.jooq.UniqueKey KEY_accountTransactions_PRIMARY = createUniqueKey(mineplex.database.tables.AccountTransactions.accountTransactions, mineplex.database.tables.AccountTransactions.accountTransactions.id); @@ -231,10 +243,12 @@ public class Keys { public static final org.jooq.UniqueKey KEY_items_PRIMARY = createUniqueKey(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.id); public static final org.jooq.UniqueKey KEY_items_uniqueNameCategoryIndex = createUniqueKey(mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.name, mineplex.database.tables.Items.items.categoryId); public static final org.jooq.UniqueKey KEY_mail_PRIMARY = createUniqueKey(mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.id); + public static final org.jooq.UniqueKey KEY_mailbox_PRIMARY = createUniqueKey(mineplex.database.tables.Mailbox.mailbox, mineplex.database.tables.Mailbox.mailbox.id); public static final org.jooq.UniqueKey KEY_npcs_PRIMARY = createUniqueKey(mineplex.database.tables.Npcs.npcs, mineplex.database.tables.Npcs.npcs.id); public static final org.jooq.UniqueKey KEY_playerMap_PRIMARY = createUniqueKey(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.id); public static final org.jooq.UniqueKey KEY_playerMap_playerIndex = createUniqueKey(mineplex.database.tables.PlayerMap.playerMap, mineplex.database.tables.PlayerMap.playerMap.playerName); public static final org.jooq.UniqueKey KEY_polls_PRIMARY = createUniqueKey(mineplex.database.tables.Polls.polls, mineplex.database.tables.Polls.polls.id); + public static final org.jooq.UniqueKey KEY_rankBenefits_PRIMARY = createUniqueKey(mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.id); public static final org.jooq.UniqueKey KEY_serverPassword_PRIMARY = createUniqueKey(mineplex.database.tables.ServerPassword.serverPassword, mineplex.database.tables.ServerPassword.serverPassword.id); public static final org.jooq.UniqueKey KEY_spawns_PRIMARY = createUniqueKey(mineplex.database.tables.Spawns.spawns, mineplex.database.tables.Spawns.spawns.id); public static final org.jooq.UniqueKey KEY_statEvents_PRIMARY = createUniqueKey(mineplex.database.tables.StatEvents.statEvents, mineplex.database.tables.StatEvents.statEvents.eventId); @@ -259,6 +273,8 @@ public class Keys { public static final org.jooq.ForeignKey accountInventory_ibfk_2 = createForeignKey(mineplex.database.Keys.KEY_items_PRIMARY, mineplex.database.tables.AccountInventory.accountInventory, mineplex.database.tables.AccountInventory.accountInventory.itemId); public static final org.jooq.ForeignKey accountPolls_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountPolls.accountPolls, mineplex.database.tables.AccountPolls.accountPolls.accountId); public static final org.jooq.ForeignKey accountPolls_ibfk_2 = createForeignKey(mineplex.database.Keys.KEY_polls_PRIMARY, mineplex.database.tables.AccountPolls.accountPolls, mineplex.database.tables.AccountPolls.accountPolls.pollId); + public static final org.jooq.ForeignKey accountStat_account = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountStat.accountStat, mineplex.database.tables.AccountStat.accountStat.accountId); + public static final org.jooq.ForeignKey accountStat_stat = createForeignKey(mineplex.database.Keys.KEY_stats_PRIMARY, mineplex.database.tables.AccountStat.accountStat, mineplex.database.tables.AccountStat.accountStat.statId); public static final org.jooq.ForeignKey accountStats_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountStats.accountStats, mineplex.database.tables.AccountStats.accountStats.accountId); public static final org.jooq.ForeignKey accountStats_ibfk_2 = createForeignKey(mineplex.database.Keys.KEY_stats_PRIMARY, mineplex.database.tables.AccountStats.accountStats, mineplex.database.tables.AccountStats.accountStats.statId); public static final org.jooq.ForeignKey ACCOUNTTASKS_ACCOUNTID = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.AccountTasks.accountTasks, mineplex.database.tables.AccountTasks.accountTasks.accountId); @@ -275,5 +291,7 @@ public class Keys { public static final org.jooq.ForeignKey clanTerritory_ibfk_2 = createForeignKey(mineplex.database.Keys.KEY_clanServer_PRIMARY, mineplex.database.tables.ClanTerritory.clanTerritory, mineplex.database.tables.ClanTerritory.clanTerritory.serverId); public static final org.jooq.ForeignKey items_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_itemCategories_PRIMARY, mineplex.database.tables.Items.items, mineplex.database.tables.Items.items.categoryId); public static final org.jooq.ForeignKey mail_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.Mail.mail, mineplex.database.tables.Mail.mail.accountId); + public static final org.jooq.ForeignKey mailbox_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.Mailbox.mailbox, mineplex.database.tables.Mailbox.mailbox.accountId); + public static final org.jooq.ForeignKey rankBenefits_ibfk_1 = createForeignKey(mineplex.database.Keys.KEY_accounts_PRIMARY, mineplex.database.tables.RankBenefits.rankBenefits, mineplex.database.tables.RankBenefits.rankBenefits.accountId); } } diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Routines.java b/Plugins/Mineplex.Database/src/mineplex/database/Routines.java index 1e81aaa0b..21ae7415e 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Routines.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Routines.java @@ -16,14 +16,39 @@ package mineplex.database; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Routines { + /** + * Call Account.accountGoldChange + */ + public static java.lang.Byte callAccountgoldchange(org.jooq.Configuration configuration, java.lang.Integer accountId, java.lang.Integer goldChange) { + mineplex.database.routines.AccountGoldChange p = new mineplex.database.routines.AccountGoldChange(); + p.setAccountId(accountId); + p.setGoldChange(goldChange); + + p.execute(configuration); + return p.getSuccess(); + } + /** * Call Account.check_daily */ - public static mineplex.database.routines.Check_daily callCheckDaily(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer coins_change, java.lang.Integer gems_change) { + public static mineplex.database.routines.Check_daily callCheckDaily(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer coinsChange, java.lang.Integer gemsChange) { mineplex.database.routines.Check_daily p = new mineplex.database.routines.Check_daily(); p.setAccountId_in(accountId_in); - p.setCoins_change(coins_change); - p.setGems_change(gems_change); + p.setCoinsChange(coinsChange); + p.setGemsChange(gemsChange); + + p.execute(configuration); + return p; + } + + /** + * Call Account.check_rank + */ + public static mineplex.database.routines.Check_rank callCheckRank(org.jooq.Configuration configuration, java.lang.Integer accountId_in, java.lang.Integer coinsChange, java.lang.Integer gemsChange) { + mineplex.database.routines.Check_rank p = new mineplex.database.routines.Check_rank(); + p.setAccountId_in(accountId_in); + p.setCoinsChange(coinsChange); + p.setGemsChange(gemsChange); p.execute(configuration); return p; @@ -117,6 +142,16 @@ public class Routines { p.execute(configuration); } + /** + * Call Account.testPro + */ + public static java.sql.Date callTestpro(org.jooq.Configuration configuration) { + mineplex.database.routines.TestPro p = new mineplex.database.routines.TestPro(); + + p.execute(configuration); + return p.getVar(); + } + /** * Call Account.updateTournament */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/Tables.java b/Plugins/Mineplex.Database/src/mineplex/database/Tables.java index 34b62d652..36f9b2e67 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/Tables.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/Tables.java @@ -61,6 +61,11 @@ public class Tables { */ public static final mineplex.database.tables.Accounts accounts = mineplex.database.tables.Accounts.accounts; + /** + * The table Account.accountStat + */ + public static final mineplex.database.tables.AccountStat accountStat = mineplex.database.tables.AccountStat.accountStat; + /** * The table Account.accountStats */ @@ -156,6 +161,11 @@ public class Tables { */ public static final mineplex.database.tables.Mail mail = mineplex.database.tables.Mail.mail; + /** + * The table Account.mailbox + */ + public static final mineplex.database.tables.Mailbox mailbox = mineplex.database.tables.Mailbox.mailbox; + /** * The table Account.npcs */ @@ -171,6 +181,11 @@ public class Tables { */ public static final mineplex.database.tables.Polls polls = mineplex.database.tables.Polls.polls; + /** + * The table Account.rankBenefits + */ + public static final mineplex.database.tables.RankBenefits rankBenefits = mineplex.database.tables.RankBenefits.rankBenefits; + /** * The table Account.serverPassword */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/AccountGoldChange.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/AccountGoldChange.java new file mode 100644 index 000000000..40c4a7dd5 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/AccountGoldChange.java @@ -0,0 +1,67 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.routines; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class AccountGoldChange extends org.jooq.impl.AbstractRoutine implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 360483639; + + /** + * The parameter Account.accountGoldChange.accountId. + */ + public static final org.jooq.Parameter accountId = createParameter("accountId", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.accountGoldChange.goldChange. + */ + public static final org.jooq.Parameter goldChange = createParameter("goldChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.accountGoldChange.success. + */ + public static final org.jooq.Parameter success = createParameter("success", org.jooq.impl.SQLDataType.TINYINT, false); + + /** + * Create a new routine call instance + */ + public AccountGoldChange() { + super("accountGoldChange", mineplex.database.Account.Account); + + addInParameter(accountId); + addInParameter(goldChange); + addOutParameter(success); + } + + /** + * Set the accountId parameter IN value to the routine + */ + public void setAccountId(java.lang.Integer value) { + setValue(mineplex.database.routines.AccountGoldChange.accountId, value); + } + + /** + * Set the goldChange parameter IN value to the routine + */ + public void setGoldChange(java.lang.Integer value) { + setValue(mineplex.database.routines.AccountGoldChange.goldChange, value); + } + + /** + * Get the success parameter OUT value from the routine + */ + public java.lang.Byte getSuccess() { + return getValue(success); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_daily.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_daily.java index ab68749e8..a7846d168 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_daily.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_daily.java @@ -16,7 +16,7 @@ package mineplex.database.routines; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Check_daily extends org.jooq.impl.AbstractRoutine implements java.io.Serializable, java.lang.Cloneable { - private static final long serialVersionUID = -1106680609; + private static final long serialVersionUID = -1266580733; /** * The parameter Account.check_daily.accountId_in. @@ -24,14 +24,14 @@ public class Check_daily extends org.jooq.impl.AbstractRoutine i public static final org.jooq.Parameter accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false); /** - * The parameter Account.check_daily.coins_change. + * The parameter Account.check_daily.coinsChange. */ - public static final org.jooq.Parameter coins_change = createParameter("coins_change", org.jooq.impl.SQLDataType.INTEGER, false); + public static final org.jooq.Parameter coinsChange = createParameter("coinsChange", org.jooq.impl.SQLDataType.INTEGER, false); /** - * The parameter Account.check_daily.gems_change. + * The parameter Account.check_daily.gemsChange. */ - public static final org.jooq.Parameter gems_change = createParameter("gems_change", org.jooq.impl.SQLDataType.INTEGER, false); + public static final org.jooq.Parameter gemsChange = createParameter("gemsChange", org.jooq.impl.SQLDataType.INTEGER, false); /** * The parameter Account.check_daily.pass. @@ -50,8 +50,8 @@ public class Check_daily extends org.jooq.impl.AbstractRoutine i super("check_daily", mineplex.database.Account.Account); addInParameter(accountId_in); - addInParameter(coins_change); - addInParameter(gems_change); + addInParameter(coinsChange); + addInParameter(gemsChange); addOutParameter(pass); addOutParameter(outTime); } @@ -64,17 +64,17 @@ public class Check_daily extends org.jooq.impl.AbstractRoutine i } /** - * Set the coins_change parameter IN value to the routine + * Set the coinsChange parameter IN value to the routine */ - public void setCoins_change(java.lang.Integer value) { - setValue(mineplex.database.routines.Check_daily.coins_change, value); + public void setCoinsChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_daily.coinsChange, value); } /** - * Set the gems_change parameter IN value to the routine + * Set the gemsChange parameter IN value to the routine */ - public void setGems_change(java.lang.Integer value) { - setValue(mineplex.database.routines.Check_daily.gems_change, value); + public void setGemsChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_daily.gemsChange, value); } /** diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_rank.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_rank.java new file mode 100644 index 000000000..8cb172e3b --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/Check_rank.java @@ -0,0 +1,93 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.routines; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Check_rank extends org.jooq.impl.AbstractRoutine implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = -1491579372; + + /** + * The parameter Account.check_rank.accountId_in. + */ + public static final org.jooq.Parameter accountId_in = createParameter("accountId_in", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_rank.coinsChange. + */ + public static final org.jooq.Parameter coinsChange = createParameter("coinsChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_rank.gemsChange. + */ + public static final org.jooq.Parameter gemsChange = createParameter("gemsChange", org.jooq.impl.SQLDataType.INTEGER, false); + + /** + * The parameter Account.check_rank.pass. + */ + public static final org.jooq.Parameter pass = createParameter("pass", org.jooq.impl.SQLDataType.TINYINT, false); + + /** + * The parameter Account.check_rank.outTime. + */ + public static final org.jooq.Parameter outTime = createParameter("outTime", org.jooq.impl.SQLDataType.DATE, false); + + /** + * Create a new routine call instance + */ + public Check_rank() { + super("check_rank", mineplex.database.Account.Account); + + addInParameter(accountId_in); + addInParameter(coinsChange); + addInParameter(gemsChange); + addOutParameter(pass); + addOutParameter(outTime); + } + + /** + * Set the accountId_in parameter IN value to the routine + */ + public void setAccountId_in(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_rank.accountId_in, value); + } + + /** + * Set the coinsChange parameter IN value to the routine + */ + public void setCoinsChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_rank.coinsChange, value); + } + + /** + * Set the gemsChange parameter IN value to the routine + */ + public void setGemsChange(java.lang.Integer value) { + setValue(mineplex.database.routines.Check_rank.gemsChange, value); + } + + /** + * Get the pass parameter OUT value from the routine + */ + public java.lang.Byte getPass() { + return getValue(pass); + } + + /** + * Get the outTime parameter OUT value from the routine + */ + public java.sql.Date getOutTime() { + return getValue(outTime); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/routines/TestPro.java b/Plugins/Mineplex.Database/src/mineplex/database/routines/TestPro.java new file mode 100644 index 000000000..5c6e7c875 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/routines/TestPro.java @@ -0,0 +1,41 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.routines; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TestPro extends org.jooq.impl.AbstractRoutine implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = -418397480; + + /** + * The parameter Account.testPro.var. + */ + public static final org.jooq.Parameter var = createParameter("var", org.jooq.impl.SQLDataType.DATE, false); + + /** + * Create a new routine call instance + */ + public TestPro() { + super("testPro", mineplex.database.Account.Account); + + addOutParameter(var); + } + + /** + * Get the var parameter OUT value from the routine + */ + public java.sql.Date getVar() { + return getValue(var); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java new file mode 100644 index 000000000..fead0616c --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/AccountStat.java @@ -0,0 +1,109 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.tables; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class AccountStat extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 956897097; + + /** + * The reference instance of Account.accountStat + */ + public static final mineplex.database.tables.AccountStat accountStat = new mineplex.database.tables.AccountStat(); + + /** + * The class holding records for this type + */ + @Override + public java.lang.Class getRecordType() { + return mineplex.database.tables.records.AccountStatRecord.class; + } + + /** + * The column Account.accountStat.accountId. + */ + public final org.jooq.TableField accountId = createField("accountId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.accountStat.statId. + */ + public final org.jooq.TableField statId = createField("statId", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.accountStat.value. + */ + public final org.jooq.TableField value = createField("value", org.jooq.impl.SQLDataType.BIGINT.defaulted(true), this, ""); + + /** + * Create a Account.accountStat table reference + */ + public AccountStat() { + this("accountStat", null); + } + + /** + * Create an aliased Account.accountStat table reference + */ + public AccountStat(java.lang.String alias) { + this(alias, mineplex.database.tables.AccountStat.accountStat); + } + + private AccountStat(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private AccountStat(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, mineplex.database.Account.Account, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return mineplex.database.Keys.KEY_accountStat_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>asList(mineplex.database.Keys.KEY_accountStat_PRIMARY); + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getReferences() { + return java.util.Arrays.>asList(mineplex.database.Keys.accountStat_account, mineplex.database.Keys.accountStat_stat); + } + + /** + * {@inheritDoc} + */ + @Override + public mineplex.database.tables.AccountStat as(java.lang.String alias) { + return new mineplex.database.tables.AccountStat(alias, this); + } + + /** + * Rename this table + */ + public mineplex.database.tables.AccountStat rename(java.lang.String name) { + return new mineplex.database.tables.AccountStat(name, null); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java index 7113e796b..a2acbbbb5 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Bonus.java @@ -16,7 +16,7 @@ package mineplex.database.tables; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Bonus extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { - private static final long serialVersionUID = -1950407601; + private static final long serialVersionUID = -70389593; /** * The reference instance of Account.bonus @@ -44,7 +44,7 @@ public class Bonus extends org.jooq.impl.TableImplAccount.bonus.ranktime. */ - public final org.jooq.TableField ranktime = createField("ranktime", org.jooq.impl.SQLDataType.TIMESTAMP, this, ""); + public final org.jooq.TableField ranktime = createField("ranktime", org.jooq.impl.SQLDataType.DATE, this, ""); /** * Create a Account.bonus table reference diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Clans.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Clans.java index 2e0a0b810..a72409235 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/Clans.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Clans.java @@ -16,7 +16,7 @@ package mineplex.database.tables; @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class Clans extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { - private static final long serialVersionUID = -194264445; + private static final long serialVersionUID = -1842631086; /** * The reference instance of Account.clans @@ -76,6 +76,31 @@ public class Clans extends org.jooq.impl.TableImpl energy = createField("energy", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, ""); + /** + * The column Account.clans.kills. + */ + public final org.jooq.TableField kills = createField("kills", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.clans.murder. + */ + public final org.jooq.TableField murder = createField("murder", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.clans.deaths. + */ + public final org.jooq.TableField deaths = createField("deaths", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.clans.warWins. + */ + public final org.jooq.TableField warWins = createField("warWins", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, ""); + + /** + * The column Account.clans.warLosses. + */ + public final org.jooq.TableField warLosses = createField("warLosses", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, ""); + /** * Create a Account.clans table reference */ diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/Mailbox.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/Mailbox.java new file mode 100644 index 000000000..1a64d9373 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/Mailbox.java @@ -0,0 +1,137 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.tables; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Mailbox extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 581316209; + + /** + * The reference instance of Account.mailbox + */ + public static final mineplex.database.tables.Mailbox mailbox = new mineplex.database.tables.Mailbox(); + + /** + * The class holding records for this type + */ + @Override + public java.lang.Class getRecordType() { + return mineplex.database.tables.records.MailboxRecord.class; + } + + /** + * The column Account.mailbox.id. + */ + public final org.jooq.TableField id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.mailbox.accountId. + */ + public final org.jooq.TableField accountId = createField("accountId", org.jooq.impl.SQLDataType.INTEGER, this, ""); + + /** + * The column Account.mailbox.sender. + */ + public final org.jooq.TableField sender = createField("sender", org.jooq.impl.SQLDataType.VARCHAR.length(64), this, ""); + + /** + * The column Account.mailbox.message. + */ + public final org.jooq.TableField message = createField("message", org.jooq.impl.SQLDataType.VARCHAR.length(1024), this, ""); + + /** + * The column Account.mailbox.archived. + */ + public final org.jooq.TableField archived = createField("archived", org.jooq.impl.SQLDataType.TINYINT, this, ""); + + /** + * The column Account.mailbox.deleted. + */ + public final org.jooq.TableField deleted = createField("deleted", org.jooq.impl.SQLDataType.TINYINT, this, ""); + + /** + * The column Account.mailbox.timeSent. + */ + public final org.jooq.TableField timeSent = createField("timeSent", org.jooq.impl.SQLDataType.TIMESTAMP.nullable(false).defaulted(true), this, ""); + + /** + * Create a Account.mailbox table reference + */ + public Mailbox() { + this("mailbox", null); + } + + /** + * Create an aliased Account.mailbox table reference + */ + public Mailbox(java.lang.String alias) { + this(alias, mineplex.database.tables.Mailbox.mailbox); + } + + private Mailbox(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private Mailbox(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, mineplex.database.Account.Account, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Identity getIdentity() { + return mineplex.database.Keys.IDENTITY_mailbox; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return mineplex.database.Keys.KEY_mailbox_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>asList(mineplex.database.Keys.KEY_mailbox_PRIMARY); + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getReferences() { + return java.util.Arrays.>asList(mineplex.database.Keys.mailbox_ibfk_1); + } + + /** + * {@inheritDoc} + */ + @Override + public mineplex.database.tables.Mailbox as(java.lang.String alias) { + return new mineplex.database.tables.Mailbox(alias, this); + } + + /** + * Rename this table + */ + public mineplex.database.tables.Mailbox rename(java.lang.String name) { + return new mineplex.database.tables.Mailbox(name, null); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/RankBenefits.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/RankBenefits.java new file mode 100644 index 000000000..165075f93 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/RankBenefits.java @@ -0,0 +1,117 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.tables; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class RankBenefits extends org.jooq.impl.TableImpl implements java.io.Serializable, java.lang.Cloneable { + + private static final long serialVersionUID = 1274456623; + + /** + * The reference instance of Account.rankBenefits + */ + public static final mineplex.database.tables.RankBenefits rankBenefits = new mineplex.database.tables.RankBenefits(); + + /** + * The class holding records for this type + */ + @Override + public java.lang.Class getRecordType() { + return mineplex.database.tables.records.RankBenefitsRecord.class; + } + + /** + * The column Account.rankBenefits.id. + */ + public final org.jooq.TableField id = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column Account.rankBenefits.accountId. + */ + public final org.jooq.TableField accountId = createField("accountId", org.jooq.impl.SQLDataType.INTEGER, this, ""); + + /** + * The column Account.rankBenefits.benefit. + */ + public final org.jooq.TableField benefit = createField("benefit", org.jooq.impl.SQLDataType.VARCHAR.length(100), this, ""); + + /** + * Create a Account.rankBenefits table reference + */ + public RankBenefits() { + this("rankBenefits", null); + } + + /** + * Create an aliased Account.rankBenefits table reference + */ + public RankBenefits(java.lang.String alias) { + this(alias, mineplex.database.tables.RankBenefits.rankBenefits); + } + + private RankBenefits(java.lang.String alias, org.jooq.Table aliased) { + this(alias, aliased, null); + } + + private RankBenefits(java.lang.String alias, org.jooq.Table aliased, org.jooq.Field[] parameters) { + super(alias, mineplex.database.Account.Account, aliased, parameters, ""); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Identity getIdentity() { + return mineplex.database.Keys.IDENTITY_rankBenefits; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.UniqueKey getPrimaryKey() { + return mineplex.database.Keys.KEY_rankBenefits_PRIMARY; + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getKeys() { + return java.util.Arrays.>asList(mineplex.database.Keys.KEY_rankBenefits_PRIMARY); + } + + /** + * {@inheritDoc} + */ + @Override + public java.util.List> getReferences() { + return java.util.Arrays.>asList(mineplex.database.Keys.rankBenefits_ibfk_1); + } + + /** + * {@inheritDoc} + */ + @Override + public mineplex.database.tables.RankBenefits as(java.lang.String alias) { + return new mineplex.database.tables.RankBenefits(alias, this); + } + + /** + * Rename this table + */ + public mineplex.database.tables.RankBenefits rename(java.lang.String name) { + return new mineplex.database.tables.RankBenefits(name, null); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java new file mode 100644 index 000000000..83dc0a684 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/AccountStatRecord.java @@ -0,0 +1,199 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.tables.records; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class AccountStatRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { + + private static final long serialVersionUID = 1109290129; + + /** + * Setter for Account.accountStat.accountId. + */ + public void setAccountId(java.lang.Integer value) { + setValue(0, value); + } + + /** + * Getter for Account.accountStat.accountId. + */ + public java.lang.Integer getAccountId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for Account.accountStat.statId. + */ + public void setStatId(java.lang.Integer value) { + setValue(1, value); + } + + /** + * Getter for Account.accountStat.statId. + */ + public java.lang.Integer getStatId() { + return (java.lang.Integer) getValue(1); + } + + /** + * Setter for Account.accountStat.value. + */ + public void setValue(java.lang.Long value) { + setValue(2, value); + } + + /** + * Getter for Account.accountStat.value. + */ + public java.lang.Long getValue() { + return (java.lang.Long) getValue(2); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record2 key() { + return (org.jooq.Record2) super.key(); + } + + // ------------------------------------------------------------------------- + // Record3 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row3 fieldsRow() { + return (org.jooq.Row3) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row3 valuesRow() { + return (org.jooq.Row3) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return mineplex.database.tables.AccountStat.accountStat.accountId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return mineplex.database.tables.AccountStat.accountStat.statId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field3() { + return mineplex.database.tables.AccountStat.accountStat.value; + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value1() { + return getAccountId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value2() { + return getStatId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Long value3() { + return getValue(); + } + + /** + * {@inheritDoc} + */ + @Override + public AccountStatRecord value1(java.lang.Integer value) { + setAccountId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AccountStatRecord value2(java.lang.Integer value) { + setStatId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AccountStatRecord value3(java.lang.Long value) { + setValue(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AccountStatRecord values(java.lang.Integer value1, java.lang.Integer value2, java.lang.Long value3) { + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AccountStatRecord + */ + public AccountStatRecord() { + super(mineplex.database.tables.AccountStat.accountStat); + } + + /** + * Create a detached, initialised AccountStatRecord + */ + public AccountStatRecord(java.lang.Integer accountId, java.lang.Integer statId, java.lang.Long value) { + super(mineplex.database.tables.AccountStat.accountStat); + + setValue(0, accountId); + setValue(1, statId); + setValue(2, value); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java index c4dc28f8c..be35509b0 100644 --- a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/BonusRecord.java @@ -14,9 +14,9 @@ package mineplex.database.tables.records; comments = "This class is generated by jOOQ" ) @java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) -public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { +public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { - private static final long serialVersionUID = 1527068906; + private static final long serialVersionUID = -64019858; /** * Setter for Account.bonus.accountId. @@ -49,15 +49,15 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImplAccount.bonus.ranktime. */ - public void setRanktime(java.sql.Timestamp value) { + public void setRanktime(java.sql.Date value) { setValue(2, value); } /** * Getter for Account.bonus.ranktime. */ - public java.sql.Timestamp getRanktime() { - return (java.sql.Timestamp) getValue(2); + public java.sql.Date getRanktime() { + return (java.sql.Date) getValue(2); } // ------------------------------------------------------------------------- @@ -80,7 +80,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl fieldsRow() { + public org.jooq.Row3 fieldsRow() { return (org.jooq.Row3) super.fieldsRow(); } @@ -88,7 +88,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl valuesRow() { + public org.jooq.Row3 valuesRow() { return (org.jooq.Row3) super.valuesRow(); } @@ -112,7 +112,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl field3() { + public org.jooq.Field field3() { return mineplex.database.tables.Bonus.bonus.ranktime; } @@ -136,7 +136,7 @@ public class BonusRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record9 { +public class ClansRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record14 { - private static final long serialVersionUID = -1803774546; + private static final long serialVersionUID = -1588610871; /** * Setter for Account.clans.id. @@ -144,6 +144,76 @@ public class ClansRecord extends org.jooq.impl.UpdatableRecordImplAccount.clans.kills. + */ + public void setKills(java.lang.Integer value) { + setValue(9, value); + } + + /** + * Getter for Account.clans.kills. + */ + public java.lang.Integer getKills() { + return (java.lang.Integer) getValue(9); + } + + /** + * Setter for Account.clans.murder. + */ + public void setMurder(java.lang.Integer value) { + setValue(10, value); + } + + /** + * Getter for Account.clans.murder. + */ + public java.lang.Integer getMurder() { + return (java.lang.Integer) getValue(10); + } + + /** + * Setter for Account.clans.deaths. + */ + public void setDeaths(java.lang.Integer value) { + setValue(11, value); + } + + /** + * Getter for Account.clans.deaths. + */ + public java.lang.Integer getDeaths() { + return (java.lang.Integer) getValue(11); + } + + /** + * Setter for Account.clans.warWins. + */ + public void setWarWins(java.lang.Integer value) { + setValue(12, value); + } + + /** + * Getter for Account.clans.warWins. + */ + public java.lang.Integer getWarWins() { + return (java.lang.Integer) getValue(12); + } + + /** + * Setter for Account.clans.warLosses. + */ + public void setWarLosses(java.lang.Integer value) { + setValue(13, value); + } + + /** + * Getter for Account.clans.warLosses. + */ + public java.lang.Integer getWarLosses() { + return (java.lang.Integer) getValue(13); + } + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -157,23 +227,23 @@ public class ClansRecord extends org.jooq.impl.UpdatableRecordImpl fieldsRow() { - return (org.jooq.Row9) super.fieldsRow(); + public org.jooq.Row14 fieldsRow() { + return (org.jooq.Row14) super.fieldsRow(); } /** * {@inheritDoc} */ @Override - public org.jooq.Row9 valuesRow() { - return (org.jooq.Row9) super.valuesRow(); + public org.jooq.Row14 valuesRow() { + return (org.jooq.Row14) super.valuesRow(); } /** @@ -248,6 +318,46 @@ public class ClansRecord extends org.jooq.impl.UpdatableRecordImpl field10() { + return mineplex.database.tables.Clans.clans.kills; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field11() { + return mineplex.database.tables.Clans.clans.murder; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field12() { + return mineplex.database.tables.Clans.clans.deaths; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field13() { + return mineplex.database.tables.Clans.clans.warWins; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field14() { + return mineplex.database.tables.Clans.clans.warLosses; + } + /** * {@inheritDoc} */ @@ -320,6 +430,46 @@ public class ClansRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7 { + + private static final long serialVersionUID = 763437590; + + /** + * Setter for Account.mailbox.id. + */ + public void setId(java.lang.Integer value) { + setValue(0, value); + } + + /** + * Getter for Account.mailbox.id. + */ + public java.lang.Integer getId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for Account.mailbox.accountId. + */ + public void setAccountId(java.lang.Integer value) { + setValue(1, value); + } + + /** + * Getter for Account.mailbox.accountId. + */ + public java.lang.Integer getAccountId() { + return (java.lang.Integer) getValue(1); + } + + /** + * Setter for Account.mailbox.sender. + */ + public void setSender(java.lang.String value) { + setValue(2, value); + } + + /** + * Getter for Account.mailbox.sender. + */ + public java.lang.String getSender() { + return (java.lang.String) getValue(2); + } + + /** + * Setter for Account.mailbox.message. + */ + public void setMessage(java.lang.String value) { + setValue(3, value); + } + + /** + * Getter for Account.mailbox.message. + */ + public java.lang.String getMessage() { + return (java.lang.String) getValue(3); + } + + /** + * Setter for Account.mailbox.archived. + */ + public void setArchived(java.lang.Byte value) { + setValue(4, value); + } + + /** + * Getter for Account.mailbox.archived. + */ + public java.lang.Byte getArchived() { + return (java.lang.Byte) getValue(4); + } + + /** + * Setter for Account.mailbox.deleted. + */ + public void setDeleted(java.lang.Byte value) { + setValue(5, value); + } + + /** + * Getter for Account.mailbox.deleted. + */ + public java.lang.Byte getDeleted() { + return (java.lang.Byte) getValue(5); + } + + /** + * Setter for Account.mailbox.timeSent. + */ + public void setTimeSent(java.sql.Timestamp value) { + setValue(6, value); + } + + /** + * Getter for Account.mailbox.timeSent. + */ + public java.sql.Timestamp getTimeSent() { + return (java.sql.Timestamp) getValue(6); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record1 key() { + return (org.jooq.Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record7 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row7 fieldsRow() { + return (org.jooq.Row7) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row7 valuesRow() { + return (org.jooq.Row7) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return mineplex.database.tables.Mailbox.mailbox.id; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return mineplex.database.tables.Mailbox.mailbox.accountId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field3() { + return mineplex.database.tables.Mailbox.mailbox.sender; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field4() { + return mineplex.database.tables.Mailbox.mailbox.message; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field5() { + return mineplex.database.tables.Mailbox.mailbox.archived; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field6() { + return mineplex.database.tables.Mailbox.mailbox.deleted; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field7() { + return mineplex.database.tables.Mailbox.mailbox.timeSent; + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value1() { + return getId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value2() { + return getAccountId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.String value3() { + return getSender(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.String value4() { + return getMessage(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Byte value5() { + return getArchived(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Byte value6() { + return getDeleted(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.sql.Timestamp value7() { + return getTimeSent(); + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value1(java.lang.Integer value) { + setId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value2(java.lang.Integer value) { + setAccountId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value3(java.lang.String value) { + setSender(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value4(java.lang.String value) { + setMessage(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value5(java.lang.Byte value) { + setArchived(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value6(java.lang.Byte value) { + setDeleted(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord value7(java.sql.Timestamp value) { + setTimeSent(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MailboxRecord values(java.lang.Integer value1, java.lang.Integer value2, java.lang.String value3, java.lang.String value4, java.lang.Byte value5, java.lang.Byte value6, java.sql.Timestamp value7) { + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached MailboxRecord + */ + public MailboxRecord() { + super(mineplex.database.tables.Mailbox.mailbox); + } + + /** + * Create a detached, initialised MailboxRecord + */ + public MailboxRecord(java.lang.Integer id, java.lang.Integer accountId, java.lang.String sender, java.lang.String message, java.lang.Byte archived, java.lang.Byte deleted, java.sql.Timestamp timeSent) { + super(mineplex.database.tables.Mailbox.mailbox); + + setValue(0, id); + setValue(1, accountId); + setValue(2, sender); + setValue(3, message); + setValue(4, archived); + setValue(5, deleted); + setValue(6, timeSent); + } +} diff --git a/Plugins/Mineplex.Database/src/mineplex/database/tables/records/RankBenefitsRecord.java b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/RankBenefitsRecord.java new file mode 100644 index 000000000..9eec884c0 --- /dev/null +++ b/Plugins/Mineplex.Database/src/mineplex/database/tables/records/RankBenefitsRecord.java @@ -0,0 +1,199 @@ +/** + * This class is generated by jOOQ + */ +package mineplex.database.tables.records; + +/** + * This class is generated by jOOQ. + */ +@javax.annotation.Generated( + value = { + "http://www.jooq.org", + "jOOQ version:3.5.2" + }, + comments = "This class is generated by jOOQ" +) +@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class RankBenefitsRecord extends org.jooq.impl.UpdatableRecordImpl implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record3 { + + private static final long serialVersionUID = 1205523956; + + /** + * Setter for Account.rankBenefits.id. + */ + public void setId(java.lang.Integer value) { + setValue(0, value); + } + + /** + * Getter for Account.rankBenefits.id. + */ + public java.lang.Integer getId() { + return (java.lang.Integer) getValue(0); + } + + /** + * Setter for Account.rankBenefits.accountId. + */ + public void setAccountId(java.lang.Integer value) { + setValue(1, value); + } + + /** + * Getter for Account.rankBenefits.accountId. + */ + public java.lang.Integer getAccountId() { + return (java.lang.Integer) getValue(1); + } + + /** + * Setter for Account.rankBenefits.benefit. + */ + public void setBenefit(java.lang.String value) { + setValue(2, value); + } + + /** + * Getter for Account.rankBenefits.benefit. + */ + public java.lang.String getBenefit() { + return (java.lang.String) getValue(2); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Record1 key() { + return (org.jooq.Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record3 type implementation + // ------------------------------------------------------------------------- + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row3 fieldsRow() { + return (org.jooq.Row3) super.fieldsRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Row3 valuesRow() { + return (org.jooq.Row3) super.valuesRow(); + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field1() { + return mineplex.database.tables.RankBenefits.rankBenefits.id; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field2() { + return mineplex.database.tables.RankBenefits.rankBenefits.accountId; + } + + /** + * {@inheritDoc} + */ + @Override + public org.jooq.Field field3() { + return mineplex.database.tables.RankBenefits.rankBenefits.benefit; + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value1() { + return getId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.Integer value2() { + return getAccountId(); + } + + /** + * {@inheritDoc} + */ + @Override + public java.lang.String value3() { + return getBenefit(); + } + + /** + * {@inheritDoc} + */ + @Override + public RankBenefitsRecord value1(java.lang.Integer value) { + setId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RankBenefitsRecord value2(java.lang.Integer value) { + setAccountId(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RankBenefitsRecord value3(java.lang.String value) { + setBenefit(value); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RankBenefitsRecord values(java.lang.Integer value1, java.lang.Integer value2, java.lang.String value3) { + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached RankBenefitsRecord + */ + public RankBenefitsRecord() { + super(mineplex.database.tables.RankBenefits.rankBenefits); + } + + /** + * Create a detached, initialised RankBenefitsRecord + */ + public RankBenefitsRecord(java.lang.Integer id, java.lang.Integer accountId, java.lang.String benefit) { + super(mineplex.database.tables.RankBenefits.rankBenefits); + + setValue(0, id); + setValue(1, accountId); + setValue(2, benefit); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java index a8216b3fe..5c09e8423 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java @@ -33,33 +33,6 @@ public class HubRepository public void initialize(boolean us) { _us = us; - - PreparedStatement preparedStatement = null; - - try (Connection connection = DBPool.MINEPLEX.getConnection()) - { - // Create table - preparedStatement = connection.prepareStatement(CREATE_NEWS_TABLE); - preparedStatement.execute(); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - finally - { - if (preparedStatement != null) - { - try - { - preparedStatement.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } - } } public HashMap retrieveNewsEntries() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 727b3c312..ba341104a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -58,7 +58,7 @@ public class NewsManager extends MiniPlugin "News Line 3", "News Line 4", }; - + RefreshNews(); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java index e9a7af389..8820efd46 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/poll/PollManager.java @@ -11,10 +11,10 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; + import net.minecraft.server.v1_7_R4.ChatSerializer; import net.minecraft.server.v1_7_R4.PacketPlayOutChat; import net.minecraft.util.com.google.gson.JsonObject; - import mineplex.core.MiniDbClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; @@ -212,7 +212,7 @@ public class PollManager extends MiniDbClientPlugin } @Override - public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException { Set(playerName, _repository.loadPollData(resultSet)); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java index 87d3749a7..36c62ffe5 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/GemHunterCommand.java @@ -33,7 +33,7 @@ public class GemHunterCommand extends CommandBase else if (amount == 8) tempExp = 220000; - final int experience = tempExp; + final long experience = tempExp; Plugin.getClientManager().loadClientByName(playerName, new Runnable() { From ae5c74680cbfd19e658e259c5ee96fc3179a9720 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 25 Jul 2015 04:30:56 -0400 Subject: [PATCH 31/37] SMALL CHANGE OMG DON'T MERGE WITH MASTER YET PELASE --- .../game/arcade/game/games/lobbers/BombLobbers.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index ce716f561..0d29c13ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -60,6 +60,11 @@ import org.bukkit.util.Vector; public class BombLobbers extends TeamGame implements IThrown { + /** + * @author Mysticate + * Created in July, 2015 + */ + private NautHashMap _averageSpawns = new NautHashMap(); private NautHashMap _tnt = new NautHashMap(); @@ -324,7 +329,7 @@ public class BombLobbers extends TeamGame implements IThrown tnt.getKey().remove(); - _tnt.remove(tnt.getKey()); + iterator.remove(); _tnt.put(newTNT, token); } } From 9feac87a15f4d2200edc90f4016f4ad93348190d Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 25 Jul 2015 09:51:23 -0400 Subject: [PATCH 32/37] Fixed not being able to buy Armorer. Lowered view distance on particles. --- .../nautilus/game/arcade/game/games/lobbers/BombLobbers.java | 4 ++-- .../game/arcade/game/games/lobbers/kits/KitArmorer.java | 3 +-- .../game/arcade/game/games/lobbers/kits/perks/PerkWaller.java | 4 ---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 0d29c13ee..51190eed7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -445,13 +445,13 @@ public class BombLobbers extends TeamGame implements IThrown { for (int i = 0 ; i < 5 ; i++) UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0, - ViewDist.LONG, UtilServer.getPlayers()); + ViewDist.NORMAL, UtilServer.getPlayers()); } else { for (int i = 0 ; i < 5 ; i++) UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1, - ViewDist.LONG, UtilServer.getPlayers()); + ViewDist.NORMAL, UtilServer.getPlayers()); } //UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index 47ecd4222..3a94cb31a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -13,7 +13,6 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class KitArmorer extends Kit { @@ -30,7 +29,7 @@ public class KitArmorer extends Kit { new PerkCraftman() }, EntityType.ZOMBIE, - new ItemStack(Material.AIR)); + new ItemBuilder(Material.GOLD_INGOT).build()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java index afb0e8b47..9f7802238 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/perks/PerkWaller.java @@ -4,19 +4,15 @@ import java.util.HashSet; import java.util.Set; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.kit.Perk; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; From 7c7b166b4d626b0a5da823859fbb48fe8b996faa Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Sat, 25 Jul 2015 16:05:12 +0200 Subject: [PATCH 33/37] reduced particles a little --- .../nautilus/game/arcade/game/games/lobbers/BombLobbers.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index 51190eed7..4fbb726a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -443,13 +443,13 @@ public class BombLobbers extends TeamGame implements IThrown if (team.GetColor() == ChatColor.AQUA) { - for (int i = 0 ; i < 5 ; i++) + for (int i = 0 ; i < 2 ; i++) UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0, ViewDist.NORMAL, UtilServer.getPlayers()); } else { - for (int i = 0 ; i < 5 ; i++) + for (int i = 0 ; i < 2 ; i++) UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } From dffde689824bf8f3fb5eb8c9e03529fe9d1c9c81 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Sat, 25 Jul 2015 17:11:02 +0200 Subject: [PATCH 34/37] fixed bug removed debug --- .../src/mineplex/core/common/util/UtilText.java | 7 ++++++- .../game/arcade/game/games/minestrike/items/guns/Gun.java | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 694739fa9..4ae8f94dc 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -48,6 +48,11 @@ public class UtilText { public static boolean isStringSimilar(String newString, String oldString, float matchRequirement) { + if (newString.length() <= 3) + { + return newString.toLowerCase().equals(oldString.toLowerCase()); + } + for (int i=0 ; i < newString.length() * matchRequirement ; i++) { int matchFromIndex = 0; @@ -56,7 +61,7 @@ public class UtilText { for (int j=0 ; j < oldString.length() ; j++) { //End of newString - if (i+j > newString.length()) + if (i+j >= newString.length()) { break; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index 0a70ee22a..dfd1863e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -202,7 +202,7 @@ public class Gun extends StrikeItem else if (player.isSneaking() && _gunStats.getGunType() != GunType.SNIPER) cone = cone * 0.8; - System.out.println("Vision: " + player.hasPotionEffect(PotionEffectType.NIGHT_VISION)); + //System.out.println("Vision: " + player.hasPotionEffect(PotionEffectType.NIGHT_VISION)); //Sniper Zoomed if (!player.hasPotionEffect(PotionEffectType.NIGHT_VISION) && _gunStats.getScope() && UtilGear.isMat(player.getInventory().getHelmet(), Material.PUMPKIN)) @@ -223,7 +223,7 @@ public class Gun extends StrikeItem } } - System.out.println("Cone: " + cone); + //System.out.println("Cone: " + cone); return cone; } From 2b240f3dfab704d1257c9593f29e9dcd172a5551 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Sat, 25 Jul 2015 17:16:20 +0200 Subject: [PATCH 35/37] removed visdata debug --- .../src/mineplex/core/visibility/VisibilityManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java index 4336048d5..bcbb9453e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java @@ -91,7 +91,7 @@ public class VisibilityManager extends MiniPlugin _data.remove(event.getPlayer()); } - @EventHandler + //@EventHandler DISABLED public void updateDebug(UpdateEvent event) { if (event.getType() != UpdateType.MIN_01) From 1247f33b1e45846e797ae1647631ceb2a70ee11d Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Sun, 26 Jul 2015 11:43:24 +0200 Subject: [PATCH 36/37] end game stats will display, even if no gems awarded. --- .../game/arcade/managers/GameGemManager.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 121d7d44b..3617ab6a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -174,7 +174,7 @@ public class GameGemManager implements Listener } } - if (DoubleGem && game.GemDoubleEnabled) + if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) total += earned; Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total); @@ -186,9 +186,6 @@ public class GameGemManager implements Listener public void AnnounceGems(Game game, Player player, HashMap gems, boolean give) { - if (!Manager.IsRewardGems()) - return; - if (gems == null) return; @@ -197,7 +194,7 @@ public class GameGemManager implements Listener UtilPlayer.message(player, ""); UtilPlayer.message(player, ArcadeFormat.Line); - UtilPlayer.message(player, "§f§lGems Earned"); + UtilPlayer.message(player, Manager.IsRewardGems() ? "§f§lGems Earned" : "§f§lGame Stats"); UtilPlayer.message(player, ""); int earnedGems = 0; @@ -214,9 +211,17 @@ public class GameGemManager implements Listener String amountStr = ""; if (amount > 0) amountStr = amount + " "; + + String out = ""; + if (Manager.IsRewardGems()) + out += F.elem(C.cGreen + "+" + (int)(gemCount * game.GemMultiplier) + " Gems") + " for "; + out += F.elem(amountStr + type); - UtilPlayer.message(player, F.elem(C.cGreen + "+" + (int)(gemCount * game.GemMultiplier) + " Gems") + " for " + F.elem(amountStr + type)); + UtilPlayer.message(player, out); } + + if (!Manager.IsRewardGems()) + return; earnedGems = (int) (earnedGems * game.GemMultiplier); @@ -245,9 +250,9 @@ public class GameGemManager implements Listener } //Double Gem - if (DoubleGem && game.GemDoubleEnabled) + if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) { - UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Bonus")); + UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend")); totalGems += earnedGems; } From 26ed7ebb94b79d18c542d902bb5ae8f592dc3fc9 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sun, 26 Jul 2015 08:49:35 -0700 Subject: [PATCH 37/37] Fixes to redis Fixes for stat handler. --- .../core/stats/SecondaryStatHandler.java | 100 ++++++++++++++++-- .../src/mineplex/serverdata/Utility.java | 1 + .../src/mineplex/staffServer/StaffServer.java | 3 +- 3 files changed, 95 insertions(+), 9 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java index 1aa39a19c..5901a17e1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/SecondaryStatHandler.java @@ -49,7 +49,6 @@ public class SecondaryStatHandler implements ILoginProcessor DSLContext context = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL); final List inserts = new ArrayList<>(); - final List deletes = new ArrayList<>(); for (String statName : oldPlayerStats.getStatsNames()) { @@ -59,14 +58,9 @@ public class SecondaryStatHandler implements ILoginProcessor .insertInto(Tables.accountStat) .set(Tables.accountStat.accountId, accountId) .set(Tables.accountStat.statId, statId) - .set(Tables.accountStat.value, oldPlayerStats.getStat(statName)); + .set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L)); inserts.add(insert); - - Delete delete = context.delete(Tables.accountStats) - .where(Tables.accountStats.accountId.equal(accountId)); - - deletes.add(delete); } context.transaction(new TransactionalRunnable() @@ -75,7 +69,6 @@ public class SecondaryStatHandler implements ILoginProcessor public void run(Configuration config) throws Exception { DSL.using(config).batch(inserts).execute(); - DSL.using(config).batch(deletes).execute(); } }); } @@ -87,6 +80,97 @@ public class SecondaryStatHandler implements ILoginProcessor else { _statsManager.replacePlayerHack(playerName, newPlayerStats); + + if (oldPlayerStats.getStatsNames().size() != 0) + { + try + { + final DSLContext context = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL); + final List updates = new ArrayList<>(); + final List inserts = new ArrayList<>(); + boolean foundNegativeStat = false; + boolean foundLessThanStat = false; + + for (String statName : oldPlayerStats.getStatsNames()) + { + Integer statId = _statsManager.getStatId(statName); + + Insert insert = context + .insertInto(Tables.accountStat) + .set(Tables.accountStat.accountId, accountId) + .set(Tables.accountStat.statId, statId) + .set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L)); + + inserts.add(insert); + + Update update = context + .update(Tables.accountStat) + .set(Tables.accountStat.value, Math.max(oldPlayerStats.getStat(statName), 0L)) + .where(Tables.accountStat.accountId.eq(accountId)) + .and(Tables.accountStat.statId.eq(statId)); + + updates.add(update); + + if (oldPlayerStats.getStat(statName) < 0) + { + foundNegativeStat = true; + } + else if (newPlayerStats.getStat(statName) < oldPlayerStats.getStat(statName)) + { + foundLessThanStat = true; + } + } + + if (foundNegativeStat && foundLessThanStat) + { + context.transaction(new TransactionalRunnable() + { + @Override + public void run(Configuration config) throws Exception + { + int[] updateResult = context.batch(updates).execute(); + + for (int i = 0; i < updateResult.length; i++) + { + if (updateResult[i] > 0) + inserts.set(i, null); + } + + inserts.removeAll(Collections.singleton(null)); + + context.batch(inserts).execute(); + + System.out.println("Updating"); + } + }); + } + +/* + final List deletes = new ArrayList<>(); + + for (String statName : oldPlayerStats.getStatsNames()) + { + Delete delete = context.delete(Tables.accountStats) + .where(Tables.accountStats.accountId.equal(accountId)); + + deletes.add(delete); + } + + context.transaction(new TransactionalRunnable() + { + @Override + public void run(Configuration config) throws Exception + { + DSL.using(config).batch(deletes).execute(); + } + }); + */ + } + catch (Exception e) + { + e.printStackTrace(); + } + } } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java index 9e6dba353..790a2efa3 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java @@ -134,6 +134,7 @@ public class Utility JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxWaitMillis(1000); jedisPoolConfig.setMinIdle(5); + jedisPoolConfig.setTestOnBorrow(true); return new JedisPool(jedisPoolConfig, connData.getHost(), connData.getPort()); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 37b54b75b..f349df29e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -83,11 +83,12 @@ public class StaffServer extends JavaPlugin ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("80f40f29-4d66-4355-a32f-01a65af2a14c"), "rl6")); - + ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh")); + ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); } }