mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 09:15:38 +00:00
032e54e2d4
Here's a list of things I've fixed/mitigated: - Range bans in ban-related commands (FS-209) - Bug in /tempban where the duration in the broadcast is always wrong - Over-complicated handling of /tempban durations (instead of trying to process them and silently fail, it'll flat out say that an invalid duration is well, invalid) - Inconsistent "player not found" messages in banning commands - (Mitigates) weird issue with case-sensitive usernames in banning commands when the server has restarted since a player last joined - (Mitigates) banned IPs being inaccurate when a player was banned offline whilst containing multiple IPs in their playerdata - Redoing how MovementValidator handled positive and negative infinity exploit items, completely removing the need for Mojangson in the first place and allowing the plugin to run without Essentials once more in the process (related to FS-406) Here is what I've done in addition: - Merged /tban and /noob into /tempban, which now bans for 5 minutes by default (FS-205)
62 lines
2.2 KiB
Java
62 lines
2.2 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import com.earth2me.essentials.User;
|
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
|
@CommandParameters(description = "Unbans the specified player.", usage = "/<command> <username> [-r]")
|
|
public class Command_unban extends FreedomCommand
|
|
{
|
|
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
if (args.length > 0)
|
|
{
|
|
String username;
|
|
String ip;
|
|
|
|
// Gets the IP using Essentials data if available
|
|
if (plugin.esb.isEnabled() && plugin.esb.getEssentialsUser(args[0]) != null)
|
|
{
|
|
User essUser = plugin.esb.getEssentialsUser(args[0]);
|
|
//
|
|
username = essUser.getName();
|
|
ip = essUser.getLastLoginAddress();
|
|
}
|
|
// Secondary method - using Essentials if available
|
|
else
|
|
{
|
|
final PlayerData entry = plugin.pl.getData(args[0]);
|
|
if (entry == null)
|
|
{
|
|
msg(PLAYER_NOT_FOUND);
|
|
return true;
|
|
}
|
|
username = entry.getName();
|
|
ip = entry.getIps().get(0);
|
|
}
|
|
|
|
FUtil.adminAction(sender.getName(), "Unbanning " + username, true);
|
|
plugin.bm.removeBan(plugin.bm.getByUsername(username));
|
|
plugin.bm.removeBan(plugin.bm.getByIp(ip));
|
|
msg(username + " has been unbanned along with the IP: " + ip);
|
|
|
|
if (args.length >= 2)
|
|
{
|
|
if (args[1].equalsIgnoreCase("-r"))
|
|
{
|
|
plugin.cpb.restore(username);
|
|
msg("Restored edits for: " + username);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
} |