From 2bf1012fa41ec41d71e8bea7489786bd6ea21805 Mon Sep 17 00:00:00 2001 From: Teddy Date: Tue, 8 Dec 2015 16:34:07 +0000 Subject: [PATCH 1/6] SSM Pig bomb bug fix --- .../mineplex/core/common/util/UtilPlayer.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index af1712362..8f4e98a6a 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -1,5 +1,7 @@ package mineplex.core.common.util; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; @@ -496,6 +498,20 @@ public class UtilPlayer return best; } + private static boolean checkClosest(Player player, Entity... ignore) + { + for(Entity e : ignore) + { + if(e instanceof Player) + { + if(e == player) + return true; + } + } + + return false; + } + public static Player getClosest(Location loc, Entity... ignore) { Player best = null; @@ -509,6 +525,9 @@ public class UtilPlayer if (cur.isDead()) continue; + if(checkClosest(cur, ignore)) + continue; + if (ignore != null) { for (int i = 0; i < ignore.length; i++) From 504a49278cb7e140029e4c2ceb85f3defe524a33 Mon Sep 17 00:00:00 2001 From: Teddy Date: Tue, 8 Dec 2015 16:35:49 +0000 Subject: [PATCH 2/6] SSM kit description change, grammar mistake --- .../src/nautilus/game/arcade/game/games/smash/kits/KitPig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index 755cfa69d..4ae1fcb33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -62,7 +62,7 @@ public class KitPig extends SmashKit ChatColor.RESET + "dealing damage and knockback to enemies.", ChatColor.RESET + "", ChatColor.RESET + "Eat the bacon to restore some Energy.", - ChatColor.RESET + "Bacon that hit an enemy will restore Health.", + ChatColor.RESET + "Bacon that hits an enemy will restore Health.", })); From 09d8367b4baa87630524cd9c2b11685dc7ad764d Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 07:32:36 +1100 Subject: [PATCH 3/6] fixed method --- .../mineplex/core/common/util/UtilPlayer.java | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index 8f4e98a6a..f1e17e2df 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -498,20 +498,6 @@ public class UtilPlayer return best; } - private static boolean checkClosest(Player player, Entity... ignore) - { - for(Entity e : ignore) - { - if(e instanceof Player) - { - if(e == player) - return true; - } - } - - return false; - } - public static Player getClosest(Location loc, Entity... ignore) { Player best = null; @@ -525,16 +511,21 @@ public class UtilPlayer if (cur.isDead()) continue; - if(checkClosest(cur, ignore)) - continue; - + //Ignore Check if (ignore != null) { - for (int i = 0; i < ignore.length; i++) + boolean shouldIgnore = false; + for (Entity ent : ignore) { - if (cur.equals(ignore[i])) - continue; + if (cur.equals(ent)) + { + shouldIgnore = true; + break; + } } + + if (shouldIgnore) + continue; } double dist = UtilMath.offset(cur.getLocation(), loc); From 2decc049c5af3786d4326e74f50bf5e0ca485450 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 07:47:07 +1100 Subject: [PATCH 4/6] fixed my muddling of perks --- .../game/games/monsterleague/kits/KitEnderman.java | 5 ++--- ...{PerkBlink.java => PerkBlinkMonsterLeague.java} | 8 +++----- .../nautilus/game/arcade/kit/perks/PerkBlink.java | 14 ++++++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/{PerkBlink.java => PerkBlinkMonsterLeague.java} (94%) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java index 20796f801..5f1c52111 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/kits/KitEnderman.java @@ -6,12 +6,11 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; -import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.monsterleague.perks.PerkBlinkMonsterLeague; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBlink; import nautilus.game.arcade.kit.perks.PerkDoubleJump; public class KitEnderman extends LeagueKit @@ -28,7 +27,7 @@ public class KitEnderman extends LeagueKit new Perk[] { new PerkDoubleJump("Double Jump", 1, 1, true), - new PerkBlink("Blink", 32, 16000), + new PerkBlinkMonsterLeague("Blink", 32, 16000), }, EntityType.ENDERMAN, new ItemStack(Material.AIR), 1.4); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java index 75e0654a9..de32a72e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/monsterleague/perks/PerkBlinkMonsterLeague.java @@ -19,14 +19,15 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashPerk; -public class PerkBlink extends SmashPerk +public class PerkBlinkMonsterLeague extends Perk { private double _range = 32; private long _recharge = 24000; - public PerkBlink(String name, double range, long recharge) + public PerkBlinkMonsterLeague(String name, double range, long recharge) { super("Blink", new String[] { @@ -51,9 +52,6 @@ public class PerkBlink extends SmashPerk return; Player player = event.getPlayer(); - - if (isSuperActive(player)) - return; if (!Kit.HasKit(player)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java index 4890bc63e..dfbc490a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBlink.java @@ -17,11 +17,12 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.SmashPerk; -public class PerkBlink extends Perk +public class PerkBlink extends SmashPerk { private String _name = ""; private double _range; @@ -45,17 +46,22 @@ public class PerkBlink extends Perk if (event.isCancelled()) return; - if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && - event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; if (UtilBlock.usable(event.getClickedBlock())) return; + + if (!UtilGear.isAxe(event.getPlayer().getItemInHand())) + return; Player player = event.getPlayer(); if (!Kit.HasKit(player)) return; + + if (isSuperActive(player)) + return; if (!Recharge.Instance.use(player, _name, _recharge, true, true)) return; From fba88ec231a1aa2a68868faa7e6436c4448da0b5 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 08:19:55 +1100 Subject: [PATCH 5/6] mount stuff is fixed --- .../mineplex/core/mount/types/MountCart.java | 2 +- .../mineplex/core/mount/types/MountSlime.java | 98 ++++++++++--------- 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java index 3abbf00e0..f5aa7f809 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java @@ -75,7 +75,7 @@ public class MountCart extends Mount> if (event.getRightClicked() == null) return; - SingleEntityMountData mount = GetActive().get(event.getPlayer()); + SingleEntityMountData mount = getMountData(event.getRightClicked()); if(mount == null) return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java index 2a0b3831a..e8a1bd649 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSlime.java @@ -30,11 +30,11 @@ public class MountSlime extends Mount> { super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[] { - ChatColor.RESET + "Bounce around on your very", - ChatColor.RESET + "own personal slime friend!", + ChatColor.RESET + "Bounce around on your very", + ChatColor.RESET + "own personal slime friend!", }, 15000); - + KnownPackage = false; } @@ -42,153 +42,155 @@ public class MountSlime extends Mount> { player.leaveVehicle(); player.eject(); - + //Remove other mounts Manager.DeregisterAll(player); - + SingleEntityMountData mount = new SingleEntityMountData(player, player.getWorld().spawn(player.getLocation(), Slime.class)); mount.getEntity().setSize(2); - + mount.getEntity().setCustomName(player.getName() + "'s " + GetName()); //Inform UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); - + //Store _active.put(player, mount); } - + public void Disable(Player player) { SingleEntityMountData mount = _active.remove(player); if (mount != null) { mount.remove(); - + //Inform UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); - + Manager.removeActive(player); } } - + @EventHandler public void interactMount(PlayerInteractEntityEvent event) { if (event.getRightClicked() == null) return; - - if (!GetActive().containsKey(event.getPlayer())) - return; - - if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer())) - return; - + + SingleEntityMountData data = GetActive().get(event.getPlayer()); + + if(data == null) return; + + if(!data.ownsMount(event.getPlayer())) return; + + if(!data.isPartOfMount(event.getRightClicked())) return; + event.getPlayer().leaveVehicle(); event.getPlayer().eject(); - + event.getRightClicked().setPassenger(event.getPlayer()); } - + @EventHandler public void target(EntityTargetEvent event) { if (!GetActive().containsKey(event.getTarget())) return; - + if (!GetActive().get(event.getTarget()).equals(event.getEntity())) event.setCancelled(true); } - + @EventHandler public void updateBounce(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + //Bounce for (SingleEntityMountData slimeData : GetActive().values()) { Slime slime = slimeData.getEntity(); - + if (slime.getPassenger() == null) { UtilEnt.setFakeHead(slime, false); continue; } - + if (!UtilEnt.isGrounded(slime)) continue; - + if (!(slime.getPassenger() instanceof Player)) continue; - + Player player = (Player)slime.getPassenger(); - + if (!Recharge.Instance.use(player, GetName(), 200, false, false)) continue; Vector dir = slime.getPassenger().getLocation().getDirection(); - + UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true); - + UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir)); - + slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); } - + //Collide for (SingleEntityMountData slimeData : GetActive().values()) { Slime slime = slimeData.getEntity(); if (slime.getPassenger() == null) continue; - + if (!(slime.getPassenger() instanceof Player)) continue; - + Player player = (Player)slime.getPassenger(); - + if (!Recharge.Instance.usable(player, GetName() + " Collide")) continue; - + for (SingleEntityMountData otherSlime : GetActive().values()) { Slime other = otherSlime.getEntity(); - + if (other.equals(slime)) continue; - + if (other.getPassenger() == null) continue; - + if (!(other.getPassenger() instanceof Player)) continue; - + Player otherPlayer = (Player)other.getPassenger(); - + if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) continue; - + //Collide if (UtilMath.offset(slime, other) > 2) continue; - + Recharge.Instance.useForce(player, GetName() + " Collide", 500); Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); - + UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true); - + slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_ATTACK, 1f, 0.5f); slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.5f); other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.5f); - + slime.playEffect(EntityEffect.HURT); other.playEffect(EntityEffect.HURT); } } } - - + + } From 26c5c419f8ee1c75357063822608f525bfab438a Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 9 Dec 2015 08:38:05 +1100 Subject: [PATCH 6/6] fixed a bug where old displayName would be used after name was updated. --- .../src/nautilus/game/arcade/game/Game.java | 18 ++++++++++++++++++ .../nautilus/game/arcade/game/GameTeam.java | 9 ++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 7616b98ad..edf144f5e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -36,6 +36,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingPlaceEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -1723,4 +1724,21 @@ public abstract class Game implements Listener } } } + + @EventHandler + public void debug(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().equals("/debugteams")) + { + for (GameTeam team : GetTeamList()) + { + event.getPlayer().sendMessage(team.GetFormattedName()); + + for (Player player : team.GetPlayers(false)) + { + event.getPlayer().sendMessage(player.getName() + ": " + team.IsAlive(player)); + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index ddbd4f68c..7d8264b88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -79,7 +79,7 @@ public class GameTeam { Host = host; - _displayName = name; + _displayName = null; _name = name; _color = color; _spawns = spawns; @@ -178,7 +178,7 @@ public class GameTeam { _players.put(player, in ? PlayerState.IN : PlayerState.OUT); - UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _displayName + " Team.")); + UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + getDisplayName() + " Team.")); VisibilityManager.Instance.refreshPlayerToAll(player); } @@ -192,7 +192,7 @@ public class GameTeam other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player); other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player); } - UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded.")); + UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded.")); } _players.clear(); @@ -323,6 +323,9 @@ public class GameTeam public String getDisplayName() { + if (_displayName == null) + return _name; + return _displayName; }