mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-23 05:53:54 +00:00
Include IP address when banning IP
This commit is contained in:
parent
13efbb666d
commit
090c1f6f83
14 changed files with 29 additions and 16 deletions
|
@ -1,9 +1,13 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Console;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.OfflinePlayer;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class Commandbanip extends EssentialsCommand
|
||||
|
@ -26,7 +30,7 @@ public class Commandbanip extends EssentialsCommand
|
|||
if (player == null)
|
||||
{
|
||||
ess.getServer().banIP(args[0]);
|
||||
sender.sendMessage(_("banIpAddress"));
|
||||
sender.sendMessage(_("banIpAddress"), senderName, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,8 +39,17 @@ public class Commandbanip extends EssentialsCommand
|
|||
{
|
||||
throw new Exception(_("playerNotFound"));
|
||||
}
|
||||
ess.getServer().banIP(player.getLastLoginAddress());
|
||||
sender.sendMessage(_("banIpAddress"));
|
||||
ess.getServer().banIP(ipAddress);
|
||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||
server.getLogger().log(Level.INFO, _("banIpAddress", senderName, ipAddress));
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
final User player = ess.getUser(onlinePlayer);
|
||||
if (onlinePlayer == sender || player.isAuthorized("essentials.ban.notify"))
|
||||
{
|
||||
sender.sendMessage(_("banIpAddress", senderName, ipAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue