mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-16 03:24:31 +02:00
Extract CommandSender to CommandSource, this should prevent Ess user object leaks.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package com.earth2me.essentials.xmpp;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.Console;
|
||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Commandxmpp extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
|
||||
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ public class Commandxmpp extends EssentialsCommand
|
||||
else
|
||||
{
|
||||
final String message = getFinalArg(args, 1);
|
||||
final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME;
|
||||
final String senderName = sender.isPlayer() ? ess.getUser(sender.getPlayer()).getDisplayName() : Console.NAME;
|
||||
sender.sendMessage("[" + senderName + ">" + address + "] " + message);
|
||||
if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message))
|
||||
{
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.earth2me.essentials.xmpp;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||
import java.util.List;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Commandxmppspy extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
|
||||
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user