Divide
Member
- Jul 13, 2013
- 45
- 11
Hi,
I created some code to change your username in the server and in-game.
You can be whoever you want with this and troll your friends!
The command I named it as is "/dme" (Disguise me).
With this command you can also login to your server more than once because it thinks you've logged out!
Here it is
I created some code to change your username in the server and in-game.
You can be whoever you want with this and troll your friends!
The command I named it as is "/dme" (Disguise me).
With this command you can also login to your server more than once because it thinks you've logged out!
Here it is
Code:
if(commandLable.equalsIgnoreCase("dme")){
if(sender instanceof Player){
if(!sender.isOp())
{
sender.sendMessage("This is an op only command!");
return true;
}
Player player = (Player) sender;
String nameBefore = player.getName();
EntityPlayer ep = ((CraftPlayer) player).getHandle();
if(args[0].equalsIgnoreCase("notch"))
{
ep.name = ChatColor.GOLD + "Notch" + ChatColor.RESET;
player.setDisplayName(ChatColor.GOLD + "Notch" + ChatColor.RESET);
player.setPlayerListName(ChatColor.GOLD + "Notch" + ChatColor.RESET);
for(Player p : Bukkit.getOnlinePlayers())
{
if(p != player)
{
((CraftPlayer) p).getHandle().playerConnection.sendPacket(new Packet20NamedEntitySpawn(ep));
Location loc = player.getLocation();
Bukkit.getWorld("world").setSpawnLocation(loc.getBlockX(), loc.getBlockY() + 1, loc.getBlockZ());
p.sendMessage(ChatColor.YELLOW + nameBefore + " left the game.");
p.sendMessage(ChatColor.YELLOW + player.getName() + ChatColor.YELLOW + " joined the game.");
}
}
}