mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-22 21:43:41 +00:00
Cleanup of Essentials class
Moved all ban stuff to BanWorkaround
This commit is contained in:
parent
963fd7cf01
commit
25c9557c59
12 changed files with 268 additions and 331 deletions
|
@ -2,8 +2,6 @@ package com.earth2me.essentials.commands;
|
|||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
|
||||
|
@ -16,36 +14,22 @@ public class Commandtempban extends EssentialsCommand
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
User p = null;
|
||||
try
|
||||
{
|
||||
p = getPlayer(server, args, 0);
|
||||
}
|
||||
catch (NoSuchFieldException ex)
|
||||
{
|
||||
p = ess.getOfflineUser(args[0]);
|
||||
}
|
||||
if (p == null)
|
||||
{
|
||||
sender.sendMessage(Util.format("playerNotFound"));
|
||||
}
|
||||
final User player = getPlayer(server, args, 0, true);
|
||||
final String time = getFinalArg(args, 1);
|
||||
final long banTimestamp = Util.parseDateDiff(time, true);
|
||||
|
||||
String time = getFinalArg(args, 1);
|
||||
long banTimestamp = Util.parseDateDiff(time, true);
|
||||
|
||||
String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp));
|
||||
p.setBanReason(banReason);
|
||||
p.setBanTimeout(banTimestamp);
|
||||
p.kickPlayer(banReason);
|
||||
((CraftServer)server).getHandle().a(p.getName());
|
||||
server.broadcastMessage(Util.format("playerBanned", p.getName(), banReason));
|
||||
Essentials.getStatic().loadBanList();
|
||||
final String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp));
|
||||
player.setBanReason(banReason);
|
||||
player.setBanTimeout(banTimestamp);
|
||||
player.kickPlayer(banReason);
|
||||
ess.getBans().banByName(player.getName());
|
||||
server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue