From dfbc8e863715cbcb7470fcc2c8e9c95cc23a5dab Mon Sep 17 00:00:00 2001 From: CodeForFame Date: Wed, 22 Jun 2011 11:32:03 -0500 Subject: [PATCH] Added mail.jar to build path... Removed IRC stuff in Constants... Made the configs load before any logs being printed out (caused errors). Fixed issue specified in pull request 9. Fixed issue with being logged out (due to an error) caused by an old mistake (by the RSCA team) that created dead code. So, I moved the dead code, so it's not dead, and fixes the bug. --- GameServer/build.xml | 1 + .../org/moparscape/msc/config/Constants.java | 41 --------- .../src/org/moparscape/msc/gs/Server.java | 9 +- .../msc/gs/event/WalkToPointEvent.java | 57 ++++++------- .../msc/gs/phandler/client/PickupItem.java | 15 ++-- LoginServer/logs/err.log | 84 +++++++++++++++++++ 6 files changed, 126 insertions(+), 81 deletions(-) diff --git a/GameServer/build.xml b/GameServer/build.xml index 863479f..a649297 100644 --- a/GameServer/build.xml +++ b/GameServer/build.xml @@ -32,6 +32,7 @@ + diff --git a/GameServer/src/org/moparscape/msc/config/Constants.java b/GameServer/src/org/moparscape/msc/config/Constants.java index b52a51a..e95f95e 100644 --- a/GameServer/src/org/moparscape/msc/config/Constants.java +++ b/GameServer/src/org/moparscape/msc/config/Constants.java @@ -55,47 +55,6 @@ public class Constants { } - /** - * @category IRC - */ - public static class IRC { - /** - * to enable IRC integration or not. - */ - public static boolean USE_IRC = false; - /** - * Hosts of the IRC channels - */ - public static final String[] HOSTS = { "irc.shakeababy.net" }; - /** - * Channels for the IRC bot to join Passwords in the second dimention - */ - public static final String[][] CHANNELS = { { - "#org.moparscape.msc.staff", "staffonly" } }; - /** - * Channel for the IRC bot to join - */ - public static final String NICK = "msc_" - + (Config.members ? "P2P" : "F2P") + "_" - + Formulae.Rand(0, 900); - /** - * the login/full name thing IRC wants. [NOT NICKNAME] - */ - public static final String USER = "org.moparscape.msc"; - /** - * Each person in here is their IRC name, if they are in here ALL - * Moderator in-game activities will be sent to them via PM. - */ - public static final String[] ADMINISTRATORS = { "KO9", "ollie", - "Necroth", "Melshef" }; - /** - * Banned words you don't want your IRCBot to say (Optional) {Banned - * word, new mask} - */ - public static final String[][] BANNED_WORDS = { { "stork", - "org.moparscape.msc" } }; - } - /** * @category LoginServer */ diff --git a/GameServer/src/org/moparscape/msc/gs/Server.java b/GameServer/src/org/moparscape/msc/gs/Server.java index f8249a4..968e5ca 100644 --- a/GameServer/src/org/moparscape/msc/gs/Server.java +++ b/GameServer/src/org/moparscape/msc/gs/Server.java @@ -40,14 +40,11 @@ public class Server { configFile = f.getName(); } } - - if (args[2] != null && args[2].equalsIgnoreCase("no")) - Constants.IRC.USE_IRC = false; - + + Config.initConfig(configFile); world = Instance.getWorld(); world.wl.loadObjects(); - Config.initConfig(configFile); World.initilizeDB(); Logger.println(Config.SERVER_NAME + " [" @@ -183,7 +180,7 @@ public class Server { } /** - * Kills the game engine and irc engine + * Kills the game engine * * @throws InterruptedException */ diff --git a/GameServer/src/org/moparscape/msc/gs/event/WalkToPointEvent.java b/GameServer/src/org/moparscape/msc/gs/event/WalkToPointEvent.java index 47b3958..c6814c5 100644 --- a/GameServer/src/org/moparscape/msc/gs/event/WalkToPointEvent.java +++ b/GameServer/src/org/moparscape/msc/gs/event/WalkToPointEvent.java @@ -4,38 +4,39 @@ import org.moparscape.msc.gs.model.Player; import org.moparscape.msc.gs.model.Point; public abstract class WalkToPointEvent extends DelayedEvent { - protected Point location; - private int radius; - private boolean stop; + protected Point location; + private int radius; + private boolean stop; - public WalkToPointEvent(Player owner, Point location, int radius, boolean stop) { - super(owner, 500); - this.location = location; - this.radius = radius; - this.stop = stop; - if (stop && owner.withinRange(location, radius)) { - owner.resetPath(); - arrived(); - super.matchRunning = false; + public WalkToPointEvent(Player owner, Point location, int radius, + boolean stop) { + super(owner, 500); + this.location = location; + this.radius = radius; + this.stop = stop; + if (stop && owner.withinRange(location, radius)) { + owner.resetPath(); + arrived(); + super.matchRunning = false; + } } - } - public abstract void arrived(); + public abstract void arrived(); - public Point getLocation() { - return location; - } - - public final void run() { - if (stop && owner.withinRange(location, radius)) { - owner.resetPath(); - arrived(); - } else if (owner.hasMoved()) { - return; // We're still moving - } else if (owner.withinRange(location, radius)) { - arrived(); + public Point getLocation() { + return location; + } + + public final void run() { + if (stop && owner.withinRange(location, radius)) { + owner.resetPath(); + arrived(); + } else if (owner.hasMoved()) { + return; // We're still moving + } else if (owner.withinRange(location, radius)) { + arrived(); + } + super.matchRunning = false; } - super.matchRunning = false; - } } \ No newline at end of file diff --git a/GameServer/src/org/moparscape/msc/gs/phandler/client/PickupItem.java b/GameServer/src/org/moparscape/msc/gs/phandler/client/PickupItem.java index d38936a..cbe56ac 100644 --- a/GameServer/src/org/moparscape/msc/gs/phandler/client/PickupItem.java +++ b/GameServer/src/org/moparscape/msc/gs/phandler/client/PickupItem.java @@ -51,17 +51,20 @@ public class PickupItem implements PacketHandler { int id = p.readShort(); final ActiveTile tile = world.getTile(location); final Item item = getItem(id, tile, player); + + if (item == null) { + //player.setSuspiciousPlayer(true); + player.resetPath(); + return; + } + if(!item.getDef().canTrade()) { if(item.droppedby() != 0 && org.moparscape.msc.gs.tools.DataConversions.usernameToHash(player.getUsername()) != item.droppedby()) { player.getActionSender().sendMessage("This item is non-tradable."); return; } } - if (item == null) { - //player.setSuspiciousPlayer(true); - player.resetPath(); - return; - } + if(player.isPMod() && !player.isMod()) return; if (item.getDef().isMembers() && !World.isMembers()) { @@ -70,7 +73,7 @@ public class PickupItem implements PacketHandler { } player.setStatus(Action.TAKING_GITEM); - Instance.getDelayedEventHandler().add(new WalkToPointEvent(player, location, 1, false) { + Instance.getDelayedEventHandler().add(new WalkToPointEvent(player, location, 0, true) { public void arrived() { if (owner.isBusy() || owner.isRanging() || !tile.hasItem(item) || !owner.nextTo(item) || owner.getStatus() != Action.TAKING_GITEM) { return; diff --git a/LoginServer/logs/err.log b/LoginServer/logs/err.log index e69de29..5ec03af 100644 --- a/LoginServer/logs/err.log +++ b/LoginServer/logs/err.log @@ -0,0 +1,84 @@ +10:27:56 22-06-11: java.io.IOException: Connection reset by peer +10:27:56 22-06-11: + +10:27:56 22-06-11: java.io.IOException: Connection reset by peer +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.FileDispatcher.read0(Native Method) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:251) +10:27:56 22-06-11: + +10:27:56 22-06-11: java.io.IOException: Connection reset by peer +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.FileDispatcher.read0(Native Method) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:251) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.IOUtil.read(IOUtil.java:218) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:254) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45) +10:27:56 22-06-11: + +10:27:56 22-06-11: java.io.IOException: Connection reset by peer +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.FileDispatcher.read0(Native Method) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:251) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.IOUtil.read(IOUtil.java:218) +10:27:56 22-06-11: + +10:27:56 22-06-11: at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:254) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485) +10:27:56 22-06-11: + +10:27:56 22-06-11: at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) +10:27:56 22-06-11: + +10:27:56 22-06-11: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) +10:27:56 22-06-11: + +10:27:56 22-06-11: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) +10:27:56 22-06-11: + +10:27:56 22-06-11: at java.lang.Thread.run(Thread.java:636) +10:27:56 22-06-11: +