Added support for varying log levels configurable in the server config (see log_level in default.conf)
Error logs now properly print to stderr when possible Colour-coded logs Addressed a scenario in which outgoing packet writes could get hung up Fixed interface incorrect definition message on server startup
This commit is contained in:
@@ -115,7 +115,7 @@ public class DestinationFlag {
|
||||
if (dir != null) {
|
||||
return getDestination(mover, object, sizeX, sizeY, dir, 3);
|
||||
}
|
||||
// System.out.println(dir);
|
||||
|
||||
return getDestination(mover, object, sizeX, sizeY, Direction.getLogicalDirection(object.getLocation(), mover.getLocation()), 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@ import core.game.world.update.flag.player.FaceLocationFlag;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.InteractionOptionContext;
|
||||
import core.net.packet.out.InteractionOption;
|
||||
import core.tools.Log;
|
||||
import core.tools.SystemLogger;
|
||||
import core.game.world.GameWorld;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Handles interaction between nodes.
|
||||
* @author Emperor
|
||||
@@ -85,7 +88,7 @@ public class InteractPlugin {
|
||||
player.dispatch(new InteractionEvent(node, option.getName().toLowerCase()));
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
SystemLogger.logErr(this.getClass(), this.getClass().getName() + e.getMessage());
|
||||
log(this.getClass(), Log.ERR, this.getClass().getName() + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +121,7 @@ public class InteractPlugin {
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
SystemLogger.logErr(this.getClass(), this.getClass().getName() + e.getMessage());
|
||||
log(this.getClass(), Log.ERR, this.getClass().getName() + e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -149,7 +152,7 @@ public class InteractPlugin {
|
||||
player.getPacketDispatch().sendMessage("Nothing interesting happens.");
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
SystemLogger.logErr(this.getClass(), this.getClass().getName() + e.getMessage());
|
||||
log(this.getClass(), Log.ERR, this.getClass().getName() + e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -187,7 +190,7 @@ public class InteractPlugin {
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
SystemLogger.logErr(this.getClass(), this.getClass().getName() + e.getMessage());
|
||||
log(this.getClass(), Log.ERR, this.getClass().getName() + e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -233,9 +233,6 @@ public abstract class MovementPulse extends Pulse {
|
||||
return;
|
||||
}
|
||||
if(destination.getLocation() == null){
|
||||
SystemLogger.logAlert(this.getClass(), destination.getId() + " < ID");
|
||||
SystemLogger.logAlert(this.getClass(), destination.getName() + " < NAME");
|
||||
SystemLogger.logAlert(this.getClass(), "ASDAD");
|
||||
return;
|
||||
}
|
||||
boolean inside = isInsideEntity(mover.getLocation());
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class Option {
|
||||
if (node instanceof Item) {
|
||||
return ItemDefinition.getOptionHandler(nodeId, name);
|
||||
}
|
||||
System.out.println("Unhandled node type " + node + "!");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package core.game.interaction;
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.Log;
|
||||
import core.tools.SystemLogger;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Plugin;
|
||||
@@ -10,6 +11,8 @@ import core.plugin.Plugin;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Handles an interaction option.
|
||||
* @author Emperor
|
||||
@@ -71,7 +74,7 @@ public abstract class OptionHandler implements Plugin<Object> {
|
||||
final SceneryDefinition definition = SceneryDefinition.forId(wrapper);
|
||||
final List<Integer> list = new ArrayList<>(20);
|
||||
if (definition.getChildrenIds() == null) {
|
||||
SystemLogger.logErr(this.getClass(), "Null child wrapper in option handler wrapperId=" + wrapper);
|
||||
log(this.getClass(), Log.ERR, "Null child wrapper in option handler wrapperId=" + wrapper);
|
||||
return new int[] { wrapper };
|
||||
}
|
||||
for (int child : definition.getChildrenIds()) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import core.game.node.scenery.Scenery
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.tools.Log
|
||||
import core.tools.SystemLogger
|
||||
import java.lang.Integer.max
|
||||
|
||||
@@ -150,7 +151,7 @@ class ScriptProcessor(val entity: Entity) {
|
||||
continue
|
||||
if (entity !is Player) {
|
||||
toRemove.add(script)
|
||||
SystemLogger.logErr(this::class.java, "Tried to queue an item UseWith interaction for a non-player!")
|
||||
log(this::class.java, Log.ERR, "Tried to queue an item UseWith interaction for a non-player!")
|
||||
continue
|
||||
}
|
||||
if (script.nextExecution > GameWorld.ticks)
|
||||
@@ -273,7 +274,7 @@ class ScriptProcessor(val entity: Entity) {
|
||||
|
||||
fun addToQueue(script: Script<*>, strength: QueueStrength) {
|
||||
if (script !is QueuedScript && script !is QueuedUseWith) {
|
||||
SystemLogger.logErr(this::class.java, "Tried to queue ${script::class.java.simpleName} as a queueable script but it's not!")
|
||||
log(this::class.java, Log.ERR, "Tried to queue ${script::class.java.simpleName} as a queueable script but it's not!")
|
||||
return
|
||||
}
|
||||
if (strength == QueueStrength.STRONG && entity is Player) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import core.game.node.entity.npc.NPC;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.tools.Log;
|
||||
import core.tools.SystemLogger;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.Location;
|
||||
@@ -19,6 +20,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Handles the "use {@code node a} with {@code node b}" option.
|
||||
*
|
||||
@@ -210,7 +213,7 @@ public abstract class UseWithHandler implements Plugin<Object> {
|
||||
final SceneryDefinition definition = SceneryDefinition.forId(wrapper);
|
||||
final List<Integer> list = new ArrayList<>(20);
|
||||
if (definition.getChildrenIds() == null) {
|
||||
SystemLogger.logErr(this.getClass(), "Null child wrapper in option handler wrapperId=" + wrapper);
|
||||
log(this.getClass(), Log.ERR, "Null child wrapper in option handler wrapperId=" + wrapper);
|
||||
return new int[]{wrapper};
|
||||
}
|
||||
for (int child : definition.getChildrenIds()) {
|
||||
|
||||
Reference in New Issue
Block a user