mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-07 07:51:55 +01:00
Allow unbanning players who do not have valid userdata
This commit is contained in:
parent
cbc1aeacbe
commit
6c3b2076ff
@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -23,12 +24,19 @@ public class Commandunban extends EssentialsCommand
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final User player = getPlayer(server, args, 0, true);
|
final User user = getPlayer(server, args, 0, true);
|
||||||
player.setBanned(false);
|
user.setBanned(false);
|
||||||
sender.sendMessage(_("unbannedPlayer"));
|
sender.sendMessage(_("unbannedPlayer"));
|
||||||
}
|
}
|
||||||
catch (NoSuchFieldException e)
|
catch (NoSuchFieldException e)
|
||||||
{
|
{
|
||||||
|
final OfflinePlayer player = server.getOfflinePlayer(args[0]);
|
||||||
|
if (player.isBanned()) {
|
||||||
|
player.setBanned(false);
|
||||||
|
sender.sendMessage(_("unbannedPlayer"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception(_("playerNotFound"), e);
|
throw new Exception(_("playerNotFound"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user