For Sarah <3

This commit is contained in:
Morten 2015-08-07 05:40:16 +02:00
parent 1680b652db
commit 608e8bf693
4 changed files with 54 additions and 6 deletions

View File

@ -76,6 +76,10 @@ public class CoreClient
this._disguisedAs = originalName;
}
/**
* Only use this method if the client is actually disguised!
* @return
*/
public Rank getDisguisedRank() {
return _disguisedRank;
}

View File

@ -313,5 +313,4 @@ public class DisguiseCommand extends CommandBase<HubManager> implements Listener
dp.setSneaking(!dp.getSneaking());
}
}
}

View File

@ -22,6 +22,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import org.bukkit.Bukkit;
@ -33,6 +34,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
@ -168,6 +170,7 @@ public class DisguiseCommand extends CommandBase<ArcadeManager> implements Liste
Plugin.getCosmeticManager().getGadgetManager().RemoveItem(caller);
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller));
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
} catch(Exception e)
{
@ -330,10 +333,42 @@ public class DisguiseCommand extends CommandBase<ArcadeManager> implements Liste
{
if(_disguisedPlayers.containsKey(player))
{
EntityHuman human = (((CraftHumanEntity)((CraftPlayer) player)).getHandle());
EntityHuman human = (((CraftHumanEntity) ((CraftPlayer) player)).getHandle());
human.world.broadcastEntityEffect(human, (byte) 0);
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onDPlayerChat(AsyncPlayerChatEvent event)
{
if(_disguisedPlayers.containsKey(event.getPlayer()))
{
event.setFormat(" *" + event.getMessage());
}
}
@EventHandler
public void on(PlayerInteractEvent event)
{
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
{
if(_disguisedPlayers.containsKey(event.getPlayer()))
{
Player player = event.getPlayer();
PacketPlayOutAnimation packet = new PacketPlayOutAnimation();
packet.a = player.getEntityId();
for(Player p : Bukkit.getOnlinePlayers())
{
if(p != player)
{
Plugin.getPacketHandler().getPacketVerifier((Player) p).bypassProcess(packet);
}
}
}
}
}
}

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
import java.util.Iterator;
import mineplex.core.account.CoreClient;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -55,8 +56,17 @@ public class GameChatManager implements Listener
dead = C.cGray + "Dead ";
Rank rank = Manager.GetClients().Get(sender).GetRank();
String disguiseTag = "";
if(Manager.GetClients().Get(sender).isDisguised())
rank = Manager.GetClients().Get(sender).getDisguisedRank();
{
CoreClient cc = Manager.GetClients().Get(sender);
rank = cc.getDisguisedRank();
if(!cc.GetRank().Has(Rank.JNR_DEV))
{
disguiseTag = ChatColor.BLACK + " ";
}
}
boolean ownsUltra = false;
@ -112,7 +122,7 @@ public class GameChatManager implements Listener
}
//Base Format
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + senderName + " " + ChatColor.WHITE + "%2$s");
event.setFormat(disguiseTag + dead + levelStr + rankStr + Manager.GetColor(sender) + senderName + " " + ChatColor.WHITE + "%2$s");
//Public/Private (Not If Player Dead)
if (Manager.GetGame() != null && Manager.GetGame().GetState() == GameState.Live)
@ -128,13 +138,13 @@ public class GameChatManager implements Listener
if (event.getMessage().charAt(0) == '@')
{
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
event.setFormat(disguiseTag + C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
}
//All Chat
else
{
globalMessage = true;
event.setFormat(dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
event.setFormat(disguiseTag + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
}
}