[CODE] Change username [BUKKIT

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
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.");
}
    }
    }
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Isn't this already a option when using commands such as /nick in bigger servers
 

Timothy

Kylie Jenner
Sep 25, 2013
674
79
Yeah this is already put in, its /nick whateveryouwant when u download essentials plugin or something like that the /nick comes with it this command you have is technically useless.
 

Keydose

New Member
Sep 11, 2013
28
2
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
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.");
}
    }
    }
I'm struggling to see your logic behind modifying the spawn location?
 

Doge

Active Member
Jan 12, 2012
174
40
Isn't this already a option when using commands such as /nick in bigger servers
Was about to reply but I saw that this thread is over a year old. I'm not sure if this section is dead or you bumped it back to the top, but yeah.

And yeah there's a nick command on essentials making this code pretty much useless considering the amount of other stuff you get within the essentials plugin, and, I'm not sure why he sets a spawn location... He may be new to coding java plugins for bukkit.
 

Users who are viewing this thread

Top