Extract CommandSender to CommandSource, this should prevent Ess user object leaks.

This commit is contained in:
KHobbits 2013-10-16 20:59:39 +01:00
parent cf9d79d24c
commit 6f85761f7f
145 changed files with 1848 additions and 590 deletions

View file

@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.PlayerList;
import com.earth2me.essentials.User;
@ -7,8 +8,6 @@ import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.NumberUtil;
import java.util.*;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandlist extends EssentialsCommand
@ -19,12 +18,12 @@ public class Commandlist extends EssentialsCommand
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{
boolean showHidden = true;
if (sender instanceof Player)
if (sender.isPlayer())
{
showHidden = ess.getUser(sender).isAuthorized("essentials.list.hidden") || ess.getUser(sender).isAuthorized("essentials.vanish.interact");
showHidden = ess.getUser(sender.getPlayer()).isAuthorized("essentials.list.hidden") || ess.getUser(sender.getPlayer()).isAuthorized("essentials.vanish.interact");
}
sender.sendMessage(PlayerList.listSummary(ess, showHidden));
final Map<String, List<User>> playerList = PlayerList.getPlayerLists(ess, showHidden);
@ -40,7 +39,7 @@ public class Commandlist extends EssentialsCommand
}
// Output the standard /list output, when no group is specified
private void sendGroupedList(CommandSender sender, String commandLabel, Map<String, List<User>> playerList)
private void sendGroupedList(CommandSource sender, String commandLabel, Map<String, List<User>> playerList)
{
final Set<String> configGroups = ess.getSettings().getListGroupConfig().keySet();
final List<String> asterisk = new ArrayList<String>();