From d8123795aad985867e8dfffc914b7669f400767d Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 16 Aug 2014 16:33:18 +1000 Subject: [PATCH] changed the way disguises show rank. --- Plugins/.idea/artifacts/Mineplex_Hub_test.xml | 19 +++++++++++++------ .../core/disguise/disguises/DisguiseBase.java | 2 ++ .../disguises/DisguiseInsentient.java | 18 +++++++++++++++++- .../core/gadget/gadgets/MorphBlaze.java | 2 +- .../core/gadget/gadgets/MorphChicken.java | 2 +- .../core/gadget/gadgets/MorphCreeper.java | 2 +- .../core/gadget/gadgets/MorphPig.java | 2 +- .../core/gadget/gadgets/MorphPumpkinKing.java | 2 +- .../core/gadget/gadgets/MorphSnowman.java | 2 +- .../src/mineplex/hub/HubManager.java | 2 +- .../game/games/smash/SuperSmashTeam.java | 2 +- 11 files changed, 40 insertions(+), 15 deletions(-) diff --git a/Plugins/.idea/artifacts/Mineplex_Hub_test.xml b/Plugins/.idea/artifacts/Mineplex_Hub_test.xml index 39a87c356..c35d47a4c 100644 --- a/Plugins/.idea/artifacts/Mineplex_Hub_test.xml +++ b/Plugins/.idea/artifacts/Mineplex_Hub_test.xml @@ -1,10 +1,17 @@ - - $PROJECT_DIR$/../Testing/Hub - - - - + + $PROJECT_DIR$/../Testing/Hub/plugins + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java index 9faba7890..9941886d7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java @@ -1,5 +1,6 @@ package mineplex.core.disguise.disguises; +import mineplex.core.common.*; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; @@ -8,6 +9,7 @@ import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.Entity; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import org.bukkit.entity.*; public abstract class DisguiseBase { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java index e94302afb..1bee11fbc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java @@ -3,8 +3,10 @@ package mineplex.core.disguise.disguises; import java.util.ArrayList; import java.util.List; +import mineplex.core.common.*; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; +import org.bukkit.*; public abstract class DisguiseInsentient extends DisguiseLiving { @@ -20,9 +22,23 @@ public abstract class DisguiseInsentient extends DisguiseLiving public void SetName(String name) { - DataWatcher.watch(10, name); + SetName(name, null); } + public void SetName(String name, Rank rank) + { + if (rank != null) + { + if (rank.Has(Rank.ULTRA)) + { + name = rank.GetTag(true, true) + " " + ChatColor.RESET + name; + } + } + + DataWatcher.watch(10, name); + } + + public boolean HasCustomName() { return DataWatcher.getString(10).length() > 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java index 87a1c3e8e..c5c8e50e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java @@ -40,7 +40,7 @@ public class MorphBlaze extends MorphGadget this.ApplyArmor(player); DisguiseBlaze disguise = new DisguiseBlaze(player); - disguise.SetName(Manager.getClientManager().Get(player).GetRank().GetTag(true, true) + " " + ChatColor.RESET + player.getName()); + disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetCustomNameVisible(true); Manager.getDisguiseManager().disguise(disguise); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java index 314eee8bc..de9fe2b09 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java @@ -50,7 +50,7 @@ public class MorphChicken extends MorphGadget this.ApplyArmor(player); DisguiseChicken disguise = new DisguiseChicken(player); - disguise.SetName(Manager.getClientManager().Get(player).GetRank().GetTag(true, true) + " " + ChatColor.RESET + player.getName()); + disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetCustomNameVisible(true); Manager.getDisguiseManager().disguise(disguise); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java index 0a3a34cea..0092940a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java @@ -49,7 +49,7 @@ public class MorphCreeper extends MorphGadget this.ApplyArmor(player); DisguiseCreeper disguise = new DisguiseCreeper(player); - disguise.SetName(Manager.getClientManager().Get(player).GetRank().GetTag(true, true) + " " + ChatColor.RESET + player.getName()); + disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetCustomNameVisible(true); Manager.getDisguiseManager().disguise(disguise); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java index 11ac0bfbd..60cabaf12 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java @@ -50,7 +50,7 @@ public class MorphPig extends MorphGadget this.ApplyArmor(player); DisguisePig disguise = new DisguisePig(player); - disguise.SetName(Manager.getClientManager().Get(player).GetRank().GetTag(true, true) + " " + ChatColor.RESET + player.getName()); + disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetCustomNameVisible(true); Manager.getDisguiseManager().disguise(disguise); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java index a388c1786..93acca25d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPumpkinKing.java @@ -36,7 +36,7 @@ public class MorphPumpkinKing extends MorphGadget DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); - disguise.SetName(Manager.getClientManager().Get(player).GetRank().GetTag(true, true) + " " + ChatColor.RESET + player.getName()); + disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetCustomNameVisible(true); disguise.SetSkeletonType(SkeletonType.WITHER); Manager.getDisguiseManager().disguise(disguise); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSnowman.java index d2423ca6e..13633a88b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSnowman.java @@ -32,7 +32,7 @@ public class MorphSnowman extends MorphGadget this.ApplyArmor(player); DisguiseSnowman disguise = new DisguiseSnowman(player); - disguise.SetName(Manager.getClientManager().Get(player).GetRank().GetTag(true, true) + " " + ChatColor.RESET + player.getName()); + disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetCustomNameVisible(true); Manager.getDisguiseManager().disguise(disguise); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index afd0761fd..e97502e89 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -426,7 +426,7 @@ public class HubManager extends MiniClientPlugin { DisguiseSlime disguise = new DisguiseSlime(entity); disguise.SetCustomNameVisible(true); - disguise.SetName(((LivingEntity)entity).getCustomName()); + disguise.SetName(((LivingEntity)entity).getCustomName(), null); disguise.SetSize(2); _disguiseManager.disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java index dfe4b7feb..a56cf41c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmashTeam.java @@ -302,7 +302,7 @@ public class SuperSmashTeam extends TeamGame player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f); event.setCancelled(true); - } + } @EventHandler public void ExplosionDamageCancel(EntityDamageEvent event)