Commit ef26a2fd authored by Kenix Whisperwind's avatar Kenix Whisperwind

There is no longer a static Server and World instance global to the entire Server application

parent ebc082bc
package com.openrsc.server.plugins.commands;
import com.openrsc.server.Server;
import com.openrsc.server.model.Point;
import com.openrsc.server.model.entity.GameObject;
import com.openrsc.server.model.entity.npc.Npc;
import com.openrsc.server.model.entity.player.Player;
import com.openrsc.server.model.world.World;
import com.openrsc.server.model.world.region.TileValue;
import com.openrsc.server.net.rsc.ActionSender;
import com.openrsc.server.plugins.listeners.action.CommandListener;
import com.openrsc.server.util.rsc.DataConversions;
public final class Development implements CommandListener {
public static String messagePrefix = null;
public static String badSyntaxPrefix = null;
public void onCommand(String cmd, String[] args, Player player) {
if (isCommandAllowed(player, cmd))
if (isCommandAllowed(player, cmd)) {
if(messagePrefix == null) {
messagePrefix = player.getWorld().getServer().getConfig().MESSAGE_PREFIX;
}
if(badSyntaxPrefix == null) {
badSyntaxPrefix = player.getWorld().getServer().getConfig().BAD_SYNTAX_PREFIX;
}
handleCommand(cmd, args, player);
}
}
public boolean isCommandAllowed(Player player, String cmd) {
......@@ -66,7 +77,7 @@ public final class Development implements CommandListener {
y = player.getY();
}
if(!world.withinWorld(x, y))
if(!player.getWorld().withinWorld(x, y))
{
player.message(messagePrefix + "Invalid coordinates");
return;
......@@ -80,10 +91,10 @@ public final class Development implements CommandListener {
return;
}
World.getWorld().registerNpc(n);
player.getWorld().registerNpc(n);
n.setShouldRespawn(true);
player.message(messagePrefix + "Added NPC to database: " + n.getDef().getName() + " at " + npcLoc + " with radius " + radius);
player.getWorld().getServer().getDatabaseConnection().executeUpdate("INSERT INTO `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX
player.getWorld().getServer().getDatabaseConnection().executeUpdate("INSERT INTO `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX
+ "npclocs`(`id`,`startX`,`minX`,`maxX`,`startY`,`minY`,`maxY`) VALUES('" + n.getLoc().getId()
+ "', '" + n.getLoc().startX() + "', '" + n.getLoc().minX() + "', '" + n.getLoc().maxX() + "','"
+ n.getLoc().startY() + "','" + n.getLoc().minY() + "','" + n.getLoc().maxY() + "')");
......@@ -103,7 +114,7 @@ public final class Development implements CommandListener {
return;
}
Npc npc = World.getWorld().getNpc(id);
Npc npc = player.getWorld().getNpc(id);
if(npc == null) {
player.message(messagePrefix + "Invalid npc instance id");
......@@ -112,12 +123,12 @@ public final class Development implements CommandListener {
player.message(messagePrefix + "Removed NPC from database: " + npc.getDef().getName() + " with instance ID " + id);
player.getWorld().getServer().getDatabaseConnection()
.executeUpdate("DELETE FROM `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX
.executeUpdate("DELETE FROM `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX
+ "npclocs` WHERE `id` = '" + npc.getID() + "' AND startX='" + npc.getLoc().startX
+ "' AND startY='" + npc.getLoc().startY + "' AND minX='" + npc.getLoc().minX
+ "' AND maxX = '" + npc.getLoc().maxX + "' AND minY='" + npc.getLoc().minY
+ "' AND maxY = '" + npc.getLoc().maxY + "'");
World.getWorld().unregisterNpc(npc);
player.getWorld().unregisterNpc(npc);
}
else if (cmd.equalsIgnoreCase("removeobject") || cmd.equalsIgnoreCase("robject")) {
if(args.length == 1) {
......@@ -149,7 +160,7 @@ public final class Development implements CommandListener {
y = player.getY();
}
if(!world.withinWorld(x, y))
if(!player.getWorld().withinWorld(x, y))
{
player.message(messagePrefix + "Invalid coordinates");
return;
......@@ -166,11 +177,11 @@ public final class Development implements CommandListener {
player.message(messagePrefix + "Removed object from database: " + object.getGameObjectDef().getName() + " with instance ID " + object.getID());
player.getWorld().getServer().getDatabaseConnection()
.executeUpdate("DELETE FROM `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX
.executeUpdate("DELETE FROM `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX
+ "objects` WHERE `x` = '" + object.getX() + "' AND `y` = '" + object.getY()
+ "' AND `id` = '" + object.getID() + "' AND `direction` = '" + object.getDirection()
+ "' AND `type` = '" + object.getType() + "'");
World.getWorld().unregisterGameObject(object);
player.getWorld().unregisterGameObject(object);
}
else if (cmd.equalsIgnoreCase("createobject") || cmd.equalsIgnoreCase("cobject") || cmd.equalsIgnoreCase("addobject") || cmd.equalsIgnoreCase("aobject")) {
if (args.length < 1 || args.length == 2) {
......@@ -203,7 +214,7 @@ public final class Development implements CommandListener {
y = player.getY();
}
if(!world.withinWorld(x, y))
if(!player.getWorld().withinWorld(x, y))
{
player.message(messagePrefix + "Invalid coordinates");
return;
......@@ -223,10 +234,10 @@ public final class Development implements CommandListener {
}
GameObject newObject = new GameObject(player.getWorld(), Point.location(x, y), id, 0, 0);
World.getWorld().registerGameObject(newObject);
player.getWorld().registerGameObject(newObject);
player.message(messagePrefix + "Added object to database: " + newObject.getGameObjectDef().getName() + " with instance ID " + newObject.getID() + " at " + newObject.getLocation());
player.getWorld().getServer().getDatabaseConnection()
.executeUpdate("INSERT INTO `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX
.executeUpdate("INSERT INTO `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX
+ "objects`(`x`, `y`, `id`, `direction`, `type`) VALUES ('"
+ newObject.getX() + "', '" + newObject.getY() + "', '" + newObject.getID() + "', '"
+ newObject.getDirection() + "', '" + newObject.getType() + "')");
......@@ -263,7 +274,7 @@ public final class Development implements CommandListener {
}
if(!world.withinWorld(x, y))
if(!player.getWorld().withinWorld(x, y))
{
player.message(messagePrefix + "Invalid coordinates");
return;
......@@ -298,17 +309,17 @@ public final class Development implements CommandListener {
}
player.getWorld().getServer().getDatabaseConnection()
.executeUpdate("DELETE FROM `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX + "objects` WHERE `x` = '"
.executeUpdate("DELETE FROM `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX + "objects` WHERE `x` = '"
+ object.getX() + "' AND `y` = '" + object.getY() + "' AND `id` = '" + object.getID()
+ "' AND `direction` = '" + object.getDirection() + "' AND `type` = '" + object.getType()
+ "'");
World.getWorld().unregisterGameObject(object);
player.getWorld().unregisterGameObject(object);
GameObject newObject = new GameObject(player.getWorld(), Point.location(x, y), object.getID(), direction, object.getType());
World.getWorld().registerGameObject(newObject);
player.getWorld().registerGameObject(newObject);
player.getWorld().getServer().getDatabaseConnection()
.executeUpdate("INSERT INTO `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX
.executeUpdate("INSERT INTO `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX
+ "objects`(`x`, `y`, `id`, `direction`, `type`) VALUES ('" + newObject.getX() + "', '"
+ newObject.getY() + "', '" + newObject.getID() + "', '" + newObject.getDirection() + "', '"
+ newObject.getType() + "')");
......@@ -316,7 +327,7 @@ public final class Development implements CommandListener {
player.message(messagePrefix + "Rotated object in database: " + newObject.getGameObjectDef().getName() + " to rotation " + newObject.getDirection() + " with instance ID " + newObject.getID() + " at " + newObject.getLocation());
}
else if (cmd.equalsIgnoreCase("tile")) {
TileValue tv = World.getWorld().getTile(player.getLocation());
TileValue tv = player.getWorld().getTile(player.getLocation());
player.message(messagePrefix + "traversal: " + tv.traversalMask + ", vertVal:" + (tv.verticalWallVal & 0xff) + ", horiz: "
+ (tv.horizontalWallVal & 0xff) + ", diagVal: " + (tv.diagWallVal & 0xff) + ", projectile: " + tv.projectileAllowed);
}
......@@ -374,7 +385,7 @@ public final class Development implements CommandListener {
}
else if (cmd.equalsIgnoreCase("coords")) {
Player p = args.length > 0 ?
world.getPlayer(DataConversions.usernameToHash(args[0])) :
player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) :
player;
if(p != null)
......@@ -383,7 +394,7 @@ public final class Development implements CommandListener {
player.message(messagePrefix + "Invalid name or player is not online");
}
else if (cmd.equalsIgnoreCase("events") || cmd.equalsIgnoreCase("serverstats")) {
ActionSender.sendBox(player, Server.getServer().buildProfilingDebugInformation(true),true);
ActionSender.sendBox(player, player.getWorld().getServer().buildProfilingDebugInformation(true),true);
}
}
}
......@@ -4,7 +4,6 @@ import com.openrsc.server.model.Point;
import com.openrsc.server.model.container.Item;
import com.openrsc.server.model.entity.player.Group;
import com.openrsc.server.model.entity.player.Player;
import com.openrsc.server.model.world.World;
import com.openrsc.server.net.rsc.ActionSender;
import com.openrsc.server.plugins.listeners.action.CommandListener;
import com.openrsc.server.sql.query.logs.StaffLog;
......@@ -16,9 +15,21 @@ import java.util.ArrayList;
public final class Moderator implements CommandListener {
public static String messagePrefix = null;
public static String badSyntaxPrefix = null;
public void onCommand(String cmd, String[] args, Player player) {
if (isCommandAllowed(player, cmd))
if (isCommandAllowed(player, cmd)) {
if(messagePrefix == null) {
messagePrefix = player.getWorld().getServer().getConfig().MESSAGE_PREFIX;
}
if(badSyntaxPrefix == null) {
badSyntaxPrefix = player.getWorld().getServer().getConfig().BAD_SYNTAX_PREFIX;
}
handleCommand(cmd, args, player);
}
}
public boolean isCommandAllowed(Player player, String cmd) {
......@@ -33,7 +44,7 @@ public final class Moderator implements CommandListener {
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -85,7 +96,7 @@ public final class Moderator implements CommandListener {
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -136,7 +147,7 @@ public final class Moderator implements CommandListener {
player.message(badSyntaxPrefix + cmd.toUpperCase() + " [player]");
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
return;
......@@ -151,7 +162,7 @@ public final class Moderator implements CommandListener {
} else if (cmd.equalsIgnoreCase("alert")) {
StringBuilder message = new StringBuilder();
if (args.length > 0) {
Player p = world.getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p != null) {
for (int i = 1; i < args.length; i++)
......@@ -167,7 +178,7 @@ public final class Moderator implements CommandListener {
player.message(badSyntaxPrefix + cmd.toUpperCase() + " [name]");
return;
}
Player p = world.getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
return;
......@@ -198,11 +209,11 @@ public final class Moderator implements CommandListener {
}
player.getWorld().getServer().getGameLogger().addQuery(new StaffLog(player, 13, newStr.toString()));
newStr.insert(0, player.getStaffName() + ": ");
for (Player p : World.getWorld().getPlayers()) {
for (Player p : player.getWorld().getPlayers()) {
ActionSender.sendMessage(p, player, 1, MessageType.GLOBAL_CHAT, newStr.toString(), player.getIcon());
}
} else if (cmd.equalsIgnoreCase("info") || cmd.equalsIgnoreCase("about")) {
Player p = args.length > 0 ? World.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) : player;
Player p = args.length > 0 ? player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) : player;
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
return;
......@@ -228,7 +239,7 @@ public final class Moderator implements CommandListener {
+ "@gre@Total Time Played:@whi@ " + DataConversions.getDateFromMsec(timePlayed) + " %"
, true);
} else if (cmd.equalsIgnoreCase("inventory")) {
Player p = args.length > 0 ? World.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) : player;
Player p = args.length > 0 ? player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) : player;
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
return;
......@@ -236,12 +247,12 @@ public final class Moderator implements CommandListener {
ArrayList<Item> inventory = p.getInventory().getItems();
ArrayList<String> itemStrings = new ArrayList<>();
for (Item invItem : inventory)
itemStrings.add("@gre@" + invItem.getAmount() + " @whi@" + invItem.getDef().getName());
itemStrings.add("@gre@" + invItem.getAmount() + " @whi@" + invItem.getDef(player.getWorld()).getName());
ActionSender.sendBox(player, "@lre@Inventory of " + p.getUsername() + ":%"
+ "@whi@" + StringUtils.join(itemStrings, ", "), true);
} else if (cmd.equalsIgnoreCase("bank")) {
Player p = args.length > 0 ? World.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) : player;
Player p = args.length > 0 ? player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) : player;
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
return;
......@@ -249,7 +260,7 @@ public final class Moderator implements CommandListener {
ArrayList<Item> inventory = p.getBank().getItems();
ArrayList<String> itemStrings = new ArrayList<>();
for (Item bankItem : inventory)
itemStrings.add("@gre@" + bankItem.getAmount() + " @whi@" + bankItem.getDef().getName());
itemStrings.add("@gre@" + bankItem.getAmount() + " @whi@" + bankItem.getDef(player.getWorld()).getName());
ActionSender.sendBox(player, "@lre@Bank of " + p.getUsername() + ":%"
+ "@whi@" + StringUtils.join(itemStrings, ", "), true);
} else if (cmd.equalsIgnoreCase("announcement") || cmd.equalsIgnoreCase("announce") || cmd.equalsIgnoreCase("anouncement") || cmd.equalsIgnoreCase("anounce")) {
......@@ -259,8 +270,8 @@ public final class Moderator implements CommandListener {
newStr.append(arg).append(" ");
}
player.getWorld().getServer().getGameLogger().addQuery(new StaffLog(player, 13, newStr.toString()));
newStr.insert(0, player.getStaffName() + ": ");
for (Player p : World.getWorld().getPlayers()) {
newStr.insert(0, player.getStaffName() + ":@whi@ ");
for (Player p : player.getWorld().getPlayers()) {
ActionSender.sendMessage(p, player, 1, MessageType.GLOBAL_CHAT, "ANNOUNCEMENT: @whi@" + newStr.toString(), player.getIcon());
}
}
......
package com.openrsc.server.plugins.commands;
import com.openrsc.server.Server;
import com.openrsc.server.external.ItemDropDef;
import com.openrsc.server.external.NPCDef;
import com.openrsc.server.model.Point;
import com.openrsc.server.model.entity.player.Player;
import com.openrsc.server.model.world.World;
import com.openrsc.server.plugins.listeners.action.CommandListener;
import com.openrsc.server.sql.query.logs.StaffLog;
import com.openrsc.server.util.rsc.DataConversions;
......@@ -20,9 +18,21 @@ import static com.openrsc.server.plugins.commands.Event.LOGGER;
public final class SuperModerator implements CommandListener {
public static String messagePrefix = null;
public static String badSyntaxPrefix = null;
public void onCommand(String cmd, String[] args, Player player) {
if (isCommandAllowed(player, cmd))
if (isCommandAllowed(player, cmd)) {
if(messagePrefix == null) {
messagePrefix = player.getWorld().getServer().getConfig().MESSAGE_PREFIX;
}
if(badSyntaxPrefix == null) {
badSyntaxPrefix = player.getWorld().getServer().getConfig().BAD_SYNTAX_PREFIX;
}
handleCommand(cmd, args, player);
}
}
public boolean isCommandAllowed(Player player, String cmd) {
......@@ -41,7 +51,7 @@ public final class SuperModerator implements CommandListener {
int valArg = args.length >= 3 ? 2 : 1;
Player p = args.length >= 3 ?
world.getPlayer(DataConversions.usernameToHash(args[0])) :
player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) :
player;
if (p == null) {
......@@ -86,7 +96,7 @@ public final class SuperModerator implements CommandListener {
int keyArg = args.length >= 2 ? 1 : 0;
Player p = args.length >= 2 ?
world.getPlayer(DataConversions.usernameToHash(args[0])) :
player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) :
player;
if (p == null) {
......@@ -109,7 +119,7 @@ public final class SuperModerator implements CommandListener {
int keyArg = args.length >= 2 ? 1 : 0;
Player p = args.length >= 2 ?
world.getPlayer(DataConversions.usernameToHash(args[0])) :
player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) :
player;
if (p == null) {
......@@ -135,7 +145,7 @@ public final class SuperModerator implements CommandListener {
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -178,7 +188,7 @@ public final class SuperModerator implements CommandListener {
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -209,7 +219,7 @@ public final class SuperModerator implements CommandListener {
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -228,7 +238,7 @@ public final class SuperModerator implements CommandListener {
} else if (cmd.equalsIgnoreCase("reloaddrops")) {
try {
PreparedStatement statement = player.getWorld().getServer().getDatabaseConnection().prepareStatement(
"SELECT * FROM `" + Server.getServer().getConfig().MYSQL_TABLE_PREFIX + "npcdrops` WHERE npcdef_id = ?");
"SELECT * FROM `" + player.getWorld().getServer().getConfig().MYSQL_TABLE_PREFIX + "npcdrops` WHERE npcdef_id = ?");
for (int i = 0; i < player.getWorld().getServer().getEntityHandler().npcs.size(); i++) {
statement.setInt(1, i);
ResultSet dropResult = statement.executeQuery();
......@@ -252,7 +262,7 @@ public final class SuperModerator implements CommandListener {
}
player.message(messagePrefix + "Drop tables reloaded");
} else if (cmd.equalsIgnoreCase("reloadworld") || cmd.equalsIgnoreCase("reloadland")) {
World.getWorld().getWorldLoader().loadWorld();
player.getWorld().getWorldLoader().loadWorld();
player.message(messagePrefix + "World Reloaded");
} else if (cmd.equalsIgnoreCase("summonall")) {
if (args.length == 1) {
......@@ -261,7 +271,7 @@ public final class SuperModerator implements CommandListener {
}
if (args.length == 0) {
for (Player p : world.getPlayers()) {
for (Player p : player.getWorld().getPlayers()) {
if (p == null)
continue;
......@@ -282,7 +292,7 @@ public final class SuperModerator implements CommandListener {
return;
}
Random rand = DataConversions.getRandom();
for (Player p : world.getPlayers()) {
for (Player p : player.getWorld().getPlayers()) {
if (p != player) {
int x = rand.nextInt(width);
int y = rand.nextInt(height);
......@@ -304,7 +314,7 @@ public final class SuperModerator implements CommandListener {
player.message(messagePrefix + "You have summoned all players to " + player.getLocation());
player.getWorld().getServer().getGameLogger().addQuery(new StaffLog(player, 15, player.getUsername() + " has summoned all players to " + player.getLocation()));
} else if (cmd.equalsIgnoreCase("returnall")) {
for (Player p : world.getPlayers()) {
for (Player p : player.getWorld().getPlayers()) {
if (p == null)
continue;
......@@ -321,7 +331,7 @@ public final class SuperModerator implements CommandListener {
return;
}
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -358,7 +368,7 @@ public final class SuperModerator implements CommandListener {
return;
}
Player p = world.getPlayer(DataConversions.usernameToHash(args[0]));
Player p = player.getWorld().getPlayer(DataConversions.usernameToHash(args[0]));
if (p == null) {
player.message(messagePrefix + "Invalid name or player is not online");
......@@ -383,7 +393,7 @@ public final class SuperModerator implements CommandListener {
}
} else if (cmd.equalsIgnoreCase("release")) {
Player p = args.length > 0 ?
world.getPlayer(DataConversions.usernameToHash(args[0])) :
player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) :
player;
if (p == null) {
......@@ -415,7 +425,7 @@ public final class SuperModerator implements CommandListener {
long userToBan = DataConversions.usernameToHash(args[0]);
String usernameToBan = DataConversions.hashToUsername(userToBan);
Player p = World.getWorld().getPlayer(userToBan);
Player p = player.getWorld().getPlayer(userToBan);
int time;
if (args.length >= 2) {
......@@ -459,10 +469,10 @@ public final class SuperModerator implements CommandListener {
player.getWorld().getServer().getGameLogger().addQuery(new StaffLog(player, 11, p, player.getUsername() + " was banned by " + player.getUsername() + " " + (time == -1 ? "permanently" : " for " + time + " minutes")));
}
player.message(messagePrefix + Server.getServer().getPlayerDataProcessor().getDatabase().banPlayer(usernameToBan, time)); // Disabled as it doesn't compile with PlayerDatabaseExecutor extending ThrottleFilter
player.message(messagePrefix + player.getWorld().getServer().getPlayerDataProcessor().getDatabase().banPlayer(usernameToBan, time)); // Disabled as it doesn't compile with PlayerDatabaseExecutor extending ThrottleFilter
} else if (cmd.equalsIgnoreCase("ipcount")) {
Player p = args.length > 0 ?
world.getPlayer(DataConversions.usernameToHash(args[0])) :
player.getWorld().getPlayer(DataConversions.usernameToHash(args[0])) :
player;
if (p == null) {
......@@ -471,7 +481,7 @@ public final class SuperModerator implements CommandListener {
}
int count = 0;
for (Player worldPlayer : world.getPlayers()) {
for (Player worldPlayer : player.getWorld().getPlayers()) {
if (worldPlayer.getCurrentIP().equals(p.getCurrentIP()))
count++;
}
......