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:
@@ -14,7 +14,7 @@ import content.global.skill.agility.AgilityHandler;
|
||||
public class RopeSwing extends UseWithHandler {
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
System.out.println("Trying to handle.");
|
||||
|
||||
if(event.getUsedWith() instanceof Scenery){
|
||||
Scenery object = event.getUsedWith().asScenery();
|
||||
int objId = object.getId();
|
||||
|
||||
@@ -11,9 +11,12 @@ import core.game.node.entity.player.Player;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.Log;
|
||||
import core.tools.SystemLogger;
|
||||
import core.plugin.ClassScanner;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* The build option handling plugin.
|
||||
* @author Emperor
|
||||
@@ -63,8 +66,8 @@ public final class BuildOptionPlugin extends OptionHandler {
|
||||
}
|
||||
Hotspot hotspot = player.getHouseManager().getHotspot(object);
|
||||
if (hotspot == null || !isBuildable(player, object, hotspot)) {
|
||||
System.out.println(hotspot == null);
|
||||
SystemLogger.logErr(this.getClass(), "Construction (building): " + hotspot + " : " + object + " chunkX = " + object.getLocation().getChunkX() + ", chunkY = " + object.getLocation().getChunkY());
|
||||
|
||||
log(this.getClass(), Log.ERR, "Construction (building): " + hotspot + " : " + object + " chunkX = " + object.getLocation().getChunkX() + ", chunkY = " + object.getLocation().getChunkY());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,15 @@ import core.game.world.update.flag.context.Animation;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.ContainerContext;
|
||||
import core.net.packet.out.ContainerPacket;
|
||||
import core.tools.Log;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Utility class for building.
|
||||
* @author Emperor
|
||||
@@ -135,7 +138,7 @@ public final class BuildingUtils {
|
||||
player.getPacketDispatch().sendString("Level " + decoration.getLevel(), 396, 140 + menuIndex);
|
||||
//player.getPacketDispatch().sendItemZoomOnInterface(items[i].protocol(), 50000, 396, 49 + i);
|
||||
}
|
||||
System.out.println(c261Value);
|
||||
|
||||
player.getConfigManager().set(261, c261Value);
|
||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, 396, 132, 8, items, false));
|
||||
}
|
||||
@@ -287,7 +290,7 @@ public final class BuildingUtils {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SystemLogger.logErr(BuildingUtils.class, "Couldn't find stairs! " + plane);
|
||||
log(BuildingUtils.class, Log.ERR, "Couldn't find stairs! " + plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,7 +410,7 @@ public final class BuildingUtils {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SystemLogger.logErr(BuildingUtils.class, "Couldn't find stairs! " + plane);
|
||||
log(BuildingUtils.class, Log.ERR, "Couldn't find stairs! " + plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -549,7 +552,7 @@ public final class BuildingUtils {
|
||||
}
|
||||
}
|
||||
//(0=east, 1=south, 2=west, 3=north).
|
||||
// System.out.println("Roof information: index=" + index + ", exit count=" + count + "; array=" + Arrays.toString(exits));
|
||||
|
||||
if (count == 4) {
|
||||
room = Room.create(player, RoomProperties.ROOF_4_EXIT);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,11 @@ import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.Log;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Handles the creating of a decoration object.
|
||||
* @author Emperor
|
||||
@@ -38,12 +41,12 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||
Hotspot hotspot = player.getAttribute("con:hotspot");
|
||||
Scenery object = player.getAttribute("con:hsobject");
|
||||
if (hotspot == null || object == null) {
|
||||
SystemLogger.logErr(this.getClass(), "Failed building decoration " + hotspot + " : " + object);
|
||||
log(this.getClass(), Log.ERR, "Failed building decoration " + hotspot + " : " + object);
|
||||
break;
|
||||
}
|
||||
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
|
||||
if (slot >= hotspot.getHotspot().getDecorations().length) {
|
||||
SystemLogger.logErr(this.getClass(), "Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
|
||||
log(this.getClass(), Log.ERR, "Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
|
||||
break;
|
||||
}
|
||||
boolean debug = player.isStaff();
|
||||
@@ -104,7 +107,7 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||
break;
|
||||
case 402:
|
||||
int index = button - 160;
|
||||
SystemLogger.logErr(this.getClass(), "BuildRoom Interface Index: " + index);
|
||||
log(this.getClass(), Log.FINE, "BuildRoom Interface Index: " + index);
|
||||
if (index > -1 && index < RoomProperties.values().length) {
|
||||
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,7 @@ import core.game.world.map.build.DynamicRegion;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.game.world.map.zone.ZoneBuilder;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.Log;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.json.simple.JSONArray;
|
||||
@@ -27,6 +28,7 @@ import core.game.world.GameWorld;
|
||||
import java.awt.*;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
import static core.api.regionspec.RegionSpecificationKt.fillWith;
|
||||
import static core.api.regionspec.RegionSpecificationKt.using;
|
||||
|
||||
@@ -323,7 +325,7 @@ public final class HouseManager {
|
||||
*/
|
||||
public Location getEnterLocation() {
|
||||
if (houseRegion == null) {
|
||||
SystemLogger.logErr(this.getClass(), "House wasn't constructed yet!");
|
||||
log(this.getClass(), Log.ERR, "House wasn't constructed yet!");
|
||||
return null;
|
||||
}
|
||||
for (int x = 0; x < 8; x++) {
|
||||
|
||||
+3
-1
@@ -1,5 +1,6 @@
|
||||
package content.global.skill.crafting.lightsources
|
||||
|
||||
import core.api.log
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
import core.game.container.Container
|
||||
import core.game.interaction.OptionHandler
|
||||
@@ -9,6 +10,7 @@ import core.game.node.item.Item
|
||||
import core.tools.SystemLogger
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import core.tools.Log
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,7 +30,7 @@ class LightSourceExtinguisher : OptionHandler(){
|
||||
|
||||
val lightSource = LightSources.forId(node.id)
|
||||
|
||||
lightSource ?: return false.also { SystemLogger.logWarn(this::class.java, "UNHANDLED EXTINGUISH OPTION: ID = ${node.id}") }
|
||||
lightSource ?: return false.also { log(this::class.java, Log.WARN, "UNHANDLED EXTINGUISH OPTION: ID = ${node.id}") }
|
||||
|
||||
player.inventory.replace(node.asItem(), Item(lightSource.fullID))
|
||||
return true
|
||||
|
||||
@@ -73,7 +73,6 @@ class FarmingState(player: Player? = null) : State(player) {
|
||||
val cBin = CompostBins.values()[binOrdinal]
|
||||
val b = cBin.getBinForPlayer(player)
|
||||
b.parse(bin["binData"] as JSONObject)
|
||||
SystemLogger.logErr(this::class.java, "bin size " + binMap.size)
|
||||
}
|
||||
}
|
||||
if(_data.containsKey("farming-patches")){
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.skill.farming
|
||||
|
||||
import core.api.log
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
@@ -8,6 +9,7 @@ import core.game.node.entity.skill.Skills
|
||||
import core.tools.SystemLogger
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import core.tools.Log
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@Initializable
|
||||
@@ -39,7 +41,7 @@ class HealthChecker : OptionHandler(){
|
||||
PatchType.FRUIT_TREE -> patch.setCurrentState(patch.getCurrentState() - 14)
|
||||
PatchType.BUSH -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 4)
|
||||
PatchType.CACTUS -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 3)
|
||||
else -> SystemLogger.logErr(this::class.java,"Unreachable patch type from when(type) switch in HealthChecker.kt line 36")
|
||||
else -> log(this::class.java, Log.ERR, "Unreachable patch type from when(type) switch in HealthChecker.kt line 36")
|
||||
}
|
||||
|
||||
if(type == PatchType.FRUIT_TREE){
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package content.global.skill.farming
|
||||
|
||||
import core.api.log
|
||||
import core.game.node.entity.player.Player
|
||||
import core.tools.Log
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.Items
|
||||
import core.tools.SystemLogger
|
||||
@@ -110,7 +112,7 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
||||
PatchType.FRUIT_TREE -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,plantable!!.value + plantable!!.stages + 20)
|
||||
PatchType.BUSH -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,250 + (plantable!!.ordinal - Plantable.REDBERRY_SEED.ordinal))
|
||||
PatchType.CACTUS -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, 31)
|
||||
else -> SystemLogger.logWarn(this::class.java, "Invalid setting of isCheckHealth for patch type: " + patch.type.name)
|
||||
else -> log(this::class.java, Log.WARN, "Invalid setting of isCheckHealth for patch type: " + patch.type.name)
|
||||
}
|
||||
} else {
|
||||
when(patch.type){
|
||||
|
||||
@@ -59,7 +59,7 @@ public enum FishingSpot {
|
||||
for(FishingOption o : this.options){
|
||||
if(o.getName().equals(name)){return o;}
|
||||
}
|
||||
System.out.println("Unhandled fishing spot option, spot id: " + this.ids[0] + " desired fishing option: " + name);
|
||||
|
||||
return FishingOption.SMALL_NET; //safe, default return.
|
||||
}
|
||||
|
||||
|
||||
@@ -645,7 +645,6 @@ public enum SkillingResource {
|
||||
static {
|
||||
for (SkillingResource resource : SkillingResource.values()) {
|
||||
if (RESOURCES.containsKey(resource.id)) {
|
||||
SystemLogger.logErr(SkillingResource.class, "Already contained resource " + resource.getId() + " - " + resource.name());
|
||||
}
|
||||
RESOURCES.put(resource.id, resource);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class FishingPulse(player: Player?, npc: NPC, private val option: FishingOption?
|
||||
}
|
||||
player.debug(player.inventory.containsItem(option.tool).toString())
|
||||
if (!player.inventory.containsItem(option.tool) && !hasBarbTail()) {
|
||||
//System.out.println(isBareHanded(player));
|
||||
|
||||
player.dialogueInterpreter.sendDialogue("You need a " + option.tool.name.toLowerCase() + " to catch these fish.")
|
||||
stop()
|
||||
return false
|
||||
|
||||
@@ -5,6 +5,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.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
@@ -12,6 +13,8 @@ import core.game.world.update.flag.context.Animation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Represents a trap type.
|
||||
* @author Vexia
|
||||
@@ -101,7 +104,7 @@ public enum Traps {
|
||||
return;
|
||||
}
|
||||
if (instance.getWrapper(object) == null) {
|
||||
SystemLogger.logErr(this.getClass(), "NO WRAPPER (HUNTER DISMANTLE)");
|
||||
log(this.getClass(), Log.ERR, "NO WRAPPER (HUNTER DISMANTLE)");
|
||||
return;
|
||||
}
|
||||
player.faceLocation(object.getLocation());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package content.global.skill.hunter.tracking
|
||||
|
||||
import core.api.log
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
import core.game.node.scenery.Scenery
|
||||
@@ -14,6 +15,7 @@ import core.tools.RandomFunction
|
||||
import org.rs09.consts.Items
|
||||
import core.tools.SystemLogger
|
||||
import core.game.world.GameWorld
|
||||
import core.tools.Log
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -50,7 +52,7 @@ abstract class HunterTracking : OptionHandler(){
|
||||
val trail = player.getAttribute(attribute, ArrayList<TrailDefinition>())
|
||||
val initialTrail = getInitialTrail(startobj)
|
||||
if(initialTrail == null) {
|
||||
SystemLogger.logWarn(this::class.java, "UNHANDLED STARTING OBJECT FOR HUNTER TRACKING $startobj")
|
||||
log(this::class.java, Log.WARN, "UNHANDLED STARTING OBJECT FOR HUNTER TRACKING $startobj")
|
||||
return
|
||||
}
|
||||
trail.add(initialTrail)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package content.global.skill.magic
|
||||
|
||||
import core.api.log
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.tools.Log
|
||||
import core.tools.SystemLogger
|
||||
|
||||
object SpellListeners {
|
||||
@@ -18,12 +20,12 @@ object SpellListeners {
|
||||
}
|
||||
|
||||
fun get(spellID: Int, type: Int, book: String): ((Player,Node?) -> Unit)?{
|
||||
SystemLogger.logInfo(this::class.java, "Getting $book:$spellID:$type")
|
||||
log(this::class.java, Log.FINE, "Getting $book:$spellID:$type")
|
||||
return castMap["$book:$spellID:$type"]
|
||||
}
|
||||
|
||||
fun get(spellID: Int, type: Int, id: Int, book: String): ((Player,Node?) -> Unit)?{
|
||||
SystemLogger.logInfo(this::class.java, "Getting $book:$spellID:$type:$id")
|
||||
log(this::class.java, Log.FINE, "Getting $book:$spellID:$type:$id")
|
||||
return castMap["$book:$spellID:$type:$id"]
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public final class ChargeOrbSpells extends MagicSpell {
|
||||
&& objectId == 2151
|
||||
&& p.getInventory().containsItems(Runes.COSMIC_RUNE.getItem(15), Runes.WATER_RUNE.getItem(150), new Item(UNPOWERED_ORB.getId(), 5))) {
|
||||
p.setAttribute("/save:diary:seers:water-orb-can-earn", true);
|
||||
System.out.println("can_earn_true");
|
||||
|
||||
p.setAttribute("/save:diary:seers:water-orb", 1);
|
||||
}
|
||||
if (!meetsRequirements(entity, true, true)) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import core.api.*
|
||||
import core.game.node.Node
|
||||
import core.plugin.ClassScanner.definePlugin
|
||||
import core.tools.colorize
|
||||
import core.tools.SystemLogger.logInfo
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.entity.impl.Animator
|
||||
import core.game.node.entity.npc.NPC
|
||||
@@ -28,6 +27,7 @@ import org.rs09.consts.Scenery as Sceneries
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.game.world.GameWorld
|
||||
import core.tools.Log
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
import kotlin.random.Random
|
||||
@@ -255,7 +255,7 @@ class AbyssPlugin : InteractionListener {
|
||||
const val BURN_PROGRESS = 16
|
||||
const val DISTRACT_PROGRESS = 18
|
||||
fun handleObstacle(obstacle: Node, player: Player, skill: Int, varbitVal: Int?, animation: Animation, messages: Array<String>): Boolean {
|
||||
logInfo(this::class.java, "handled abyss ${obstacle.name}")
|
||||
log(this::class.java, Log.FINE, "handled abyss ${obstacle.name}")
|
||||
player.lock()
|
||||
player.animate(animation)
|
||||
GameWorld.Pulser.submit(object : Pulse(1, player) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import core.game.world.map.zone.ZoneRestriction;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.Log;
|
||||
import core.tools.RandomFunction;
|
||||
import core.game.node.entity.combat.CombatPulse;
|
||||
import core.game.node.entity.combat.CombatSwingHandler;
|
||||
@@ -33,6 +34,8 @@ import content.global.skill.summoning.SummoningPouch;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
|
||||
/**
|
||||
* Represents a familiar.
|
||||
* @author Emperor
|
||||
@@ -579,7 +582,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
||||
face(owner);
|
||||
}
|
||||
if (!isRenderable() && owner.isActive()) {
|
||||
// SystemLogger.logErr(this.getClass(), "Familiar in inactive region!");
|
||||
// log(this.getClass(), Log.ERR, "Familiar in inactive region!");
|
||||
getWalkingQueue().update();
|
||||
getUpdateMasks().prepare(this);
|
||||
}
|
||||
@@ -628,7 +631,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int id : getIds()) {
|
||||
if (FamiliarManager.getFamiliars().containsKey(id)) {
|
||||
SystemLogger.logErr(this.getClass(), "Familiar " + id + " was already registered!");
|
||||
log(this.getClass(), Log.ERR, "Familiar " + id + " was already registered!");
|
||||
return null;
|
||||
}
|
||||
FamiliarManager.getFamiliars().put(id, this);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class PickableDoorHandler extends OptionHandler {
|
||||
door.pickLock(player, (Scenery) node);
|
||||
return true;
|
||||
}
|
||||
System.out.println("Unhandled door: " + node.getId());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user