Jump to content

Recommended Posts

Posted

Hi guys.

 

I ban player using next code:

entityPlayerMP.playerNetServerHandler.kickPlayerFromServer("YOU ARE BANNED!");

 

I want to unban the player with his/her name and I found method:

MinecraftServer.getServer().getConfigurationManager().allowUserToConnect(SocketAdress addr, GameProfile prf);

 

but I think this method unban player with IP. Not the one I want....

 

 

Is there any method unban player with his/her name?

or how can I use "allowUserToConnect" to unban player?

 

Posted

I found CommandPardonPlayer that contains next code:

MinecraftServer minecraftserver = MinecraftServer.getServer();

GameProfile gameprofile = minecraftserver.getConfigurationManager().func_152608_h().func_152703_a(p_71515_2_[0]);

 

if (gameprofile == null) {

  throw new CommandException("commands.unban.failed", new Object[] {p_71515_2_[0]});

} else {

  minecraftserver.getConfigurationManager().func_152608_h().func_152684_c(gameprofile);

  func_152373_a(p_71515_1_, this, "commands.unban.success", new Object[] {p_71515_2_[0]});

}

 

and I think I can rewrite for my purpose :

 

MinecraftServer minecraftserver = MinecraftServer.getServer();

GameProfile gameprofile = minecraftserver.getConfigurationManager().func_152608_h().func_152703_a(String playername);

minecraftserver.getConfigurationManager().func_152608_h().func_152684_c(gameprofile);

 

I think this will work, but I can't debug it because I have another problem with running server...

Anyway, Thank you!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.