Improve logs and debug messages

This commit is contained in:
filoghost 2018-08-22 15:31:07 +02:00
parent f74d80ba43
commit 64fe5659bc
44 changed files with 196 additions and 178 deletions

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -260,7 +260,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -225,7 +225,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}
}

View File

@ -18,7 +18,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -57,7 +57,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -68,7 +68,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -79,7 +79,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -236,7 +236,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
@ -210,7 +210,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}
}

View File

@ -16,7 +16,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -65,7 +65,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -76,7 +76,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -87,7 +87,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -236,7 +236,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
@ -210,7 +210,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}
}

View File

@ -17,7 +17,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -66,7 +66,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -77,7 +77,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -88,7 +88,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -236,7 +236,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import net.minecraft.server.v1_13_R1.AxisAlignedBB;
@ -211,7 +211,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}
}

View File

@ -19,7 +19,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.VersionUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -77,7 +77,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -88,7 +88,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -99,7 +99,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -214,7 +214,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
RIDER_PITCH_DELTA.set(this, 0.0);
RIDER_YAW_DELTA.set(this, 0.0);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
if (this.vehicle != null) {

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import net.minecraft.server.v1_8_R1.AxisAlignedBB;
@ -181,7 +181,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
RIDER_PITCH_DELTA.set(this, 0.0);
RIDER_YAW_DELTA.set(this, 0.0);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
if (this.vehicle != null) {

View File

@ -18,7 +18,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -57,7 +57,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -68,7 +68,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -79,7 +79,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectMethod;
@ -40,7 +40,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
try {
SET_MARKER_METHOD.invoke(this, true);
} catch (Exception e) {
DebugHandler.handleDebugException(e);
ConsoleLogger.logDebugException(e);
// It will still work, but the offset will be wrong.
}
this.parentPiece = parentPiece;

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -214,7 +214,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
RIDER_PITCH_DELTA.set(this, 0.0);
RIDER_YAW_DELTA.set(this, 0.0);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
if (this.vehicle != null) {

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import net.minecraft.server.v1_8_R2.AxisAlignedBB;
@ -181,7 +181,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
RIDER_PITCH_DELTA.set(this, 0.0);
RIDER_YAW_DELTA.set(this, 0.0);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
if (this.vehicle != null) {

View File

@ -18,7 +18,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -57,7 +57,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -68,7 +68,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -79,7 +79,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectMethod;
@ -40,7 +40,7 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
try {
SET_MARKER_METHOD.invoke(this, true);
} catch (Exception e) {
DebugHandler.handleDebugException(e);
ConsoleLogger.logDebugException(e);
// It will still work, but the offset will be wrong.
}
this.parentPiece = parentPiece;

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -214,7 +214,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
RIDER_PITCH_DELTA.set(this, 0.0);
RIDER_YAW_DELTA.set(this, 0.0);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
if (this.vehicle != null) {

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
@ -181,7 +181,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
RIDER_PITCH_DELTA.set(this, 0.0);
RIDER_YAW_DELTA.set(this, 0.0);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
if (this.vehicle != null) {

View File

@ -18,7 +18,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -57,7 +57,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -68,7 +68,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -79,7 +79,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -8,7 +8,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -259,7 +259,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -223,7 +223,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}
}

View File

@ -17,7 +17,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -56,7 +56,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -67,7 +67,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -78,7 +78,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -1,5 +1,7 @@
package com.gmail.filoghost.holographicdisplays.nms.v1_9_R2;
import java.util.logging.Level;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
@ -8,7 +10,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.ItemLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.ItemPickupManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -260,7 +262,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebug(Level.SEVERE, "Couldn't set " + vehicleBase + " as passenger of " + this, ex);
}
}

View File

@ -7,7 +7,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -224,7 +224,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
entity.passengers.add(this);
} catch (Exception ex) {
DebugHandler.handleDebugException(ex);
ConsoleLogger.logDebugException(ex);
}
}
}

View File

@ -18,7 +18,7 @@ import com.gmail.filoghost.holographicdisplays.nms.interfaces.NMSManager;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Validator;
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
@ -57,7 +57,7 @@ public class NmsManagerImpl implements NMSManager {
customItem.setLocationNMS(x, y, z);
customItem.setItemStackNMS(stack);
if (!addEntityToWorld(nmsWorld, customItem)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return customItem;
}
@ -68,7 +68,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSSlime touchSlime = new EntityNMSSlime(nmsWorld, parentPiece);
touchSlime.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, touchSlime)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return touchSlime;
}
@ -79,7 +79,7 @@ public class NmsManagerImpl implements NMSManager {
EntityNMSArmorStand invisibleArmorStand = new EntityNMSArmorStand(nmsWorld, parentPiece);
invisibleArmorStand.setLocationNMS(x, y, z);
if (!addEntityToWorld(nmsWorld, invisibleArmorStand)) {
DebugHandler.handleSpawnFail(parentPiece);
ConsoleLogger.handleSpawnFail(parentPiece);
}
return invisibleArmorStand;
}

View File

@ -1,6 +1,7 @@
package com.gmail.filoghost.holographicdisplays;
import java.util.Set;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -32,6 +33,7 @@ import com.gmail.filoghost.holographicdisplays.placeholder.PlaceholdersManager;
import com.gmail.filoghost.holographicdisplays.task.BungeeCleanupTask;
import com.gmail.filoghost.holographicdisplays.task.StartupLoadHologramsTask;
import com.gmail.filoghost.holographicdisplays.task.WorldPlayerCounterTask;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.NMSVersion;
import com.gmail.filoghost.holographicdisplays.util.VersionUtils;
@ -65,6 +67,7 @@ public class HolographicDisplays extends JavaPlugin {
System.setProperty("HolographicDisplaysLoaded", "true");
instance = this;
ConsoleLogger.setLogger(instance.getLogger());
// Load placeholders.yml.
UnicodeSymbols.load(this);
@ -79,9 +82,9 @@ public class HolographicDisplays extends JavaPlugin {
public void onUpdateFound(final String newVersion) {
HolographicDisplays.newVersion = newVersion;
getLogger().info("Found a new version available: " + newVersion);
getLogger().info("Download it on Bukkit Dev:");
getLogger().info("dev.bukkit.org/bukkit-plugins/holographic-displays");
ConsoleLogger.log(Level.INFO, "Found a new version available: " + newVersion);
ConsoleLogger.log(Level.INFO, "Download it on Bukkit Dev:");
ConsoleLogger.log(Level.INFO, "dev.bukkit.org/bukkit-plugins/holographic-displays");
}
});
}
@ -152,7 +155,7 @@ public class HolographicDisplays extends JavaPlugin {
}
} catch (Exception e) {
getLogger().warning("Could not check ProtocolLib version (" + e.getClass().getName() + ": " + e.getMessage() + "), enabling support anyway and hoping for the best. If you get errors, please contact the author.");
ConsoleLogger.log(Level.WARNING, "Could not check ProtocolLib version (" + e.getClass().getName() + ": " + e.getMessage() + "), enabling support anyway and hoping for the best. If you get errors, please contact the author.");
}
if (requiredVersionError == null) {
@ -160,16 +163,16 @@ public class HolographicDisplays extends JavaPlugin {
if (VersionUtils.classExists("com.comphenix.protocol.wrappers.WrappedDataWatcher$WrappedDataWatcherObject")) {
// Only the new version contains this class
getLogger().info("Found ProtocolLib, using new version.");
ConsoleLogger.log(Level.INFO, "Found ProtocolLib, using new version.");
protocolLibHook = new com.gmail.filoghost.holographicdisplays.bridge.protocollib.current.ProtocolLibHookImpl();
} else {
getLogger().info("Found ProtocolLib, using old version.");
ConsoleLogger.log(Level.INFO, "Found ProtocolLib, using old version.");
protocolLibHook = new com.gmail.filoghost.holographicdisplays.bridge.protocollib.old.ProtocolLibHookImpl();
}
if (protocolLibHook.hook(this, nmsManager)) {
HolographicDisplays.protocolLibHook = protocolLibHook;
getLogger().info("Enabled player relative placeholders with ProtocolLib.");
ConsoleLogger.log(Level.INFO, "Enabled player relative placeholders with ProtocolLib.");
}
} else {
@ -180,8 +183,7 @@ public class HolographicDisplays extends JavaPlugin {
}
} catch (Exception ex) {
ex.printStackTrace();
getLogger().warning("Failed to load ProtocolLib support. Is it updated?");
ConsoleLogger.log(Level.WARNING, "Failed to load ProtocolLib support. Is it updated?", ex);
}
// Load animation files and the placeholder manager.
@ -189,8 +191,7 @@ public class HolographicDisplays extends JavaPlugin {
try {
AnimationsRegister.loadAnimations(this);
} catch (Exception ex) {
ex.printStackTrace();
getLogger().warning("Failed to load animation files!");
ConsoleLogger.log(Level.WARNING, "Failed to load animation files!", ex);
}
// Initalize other static classes.
@ -208,14 +209,13 @@ public class HolographicDisplays extends JavaPlugin {
NamedHologram singleHologram = HologramDatabase.loadHologram(singleHologramName);
NamedHologramManager.addHologram(singleHologram);
} catch (HologramNotFoundException e) {
getLogger().warning("Hologram '" + singleHologramName + "' not found, skipping it.");
ConsoleLogger.log(Level.WARNING, "Hologram '" + singleHologramName + "' not found, skipping it.");
} catch (InvalidFormatException e) {
getLogger().warning("Hologram '" + singleHologramName + "' has an invalid location format.");
ConsoleLogger.log(Level.WARNING, "Hologram '" + singleHologramName + "' has an invalid location format.");
} catch (WorldNotFoundException e) {
getLogger().warning("Hologram '" + singleHologramName + "' was in the world '" + e.getMessage() + "' but it wasn't loaded.");
ConsoleLogger.log(Level.WARNING, "Hologram '" + singleHologramName + "' was in the world '" + e.getMessage() + "' but it wasn't loaded.");
} catch (Exception e) {
e.printStackTrace();
getLogger().warning("Unhandled exception while loading the hologram '" + singleHologramName + "'. Please contact the developer.");
ConsoleLogger.log(Level.WARNING, "Unhandled exception while loading the hologram '" + singleHologramName + "'. Please contact the developer.", e);
}
}
}

View File

@ -19,7 +19,7 @@ import com.google.common.primitives.Ints;
/**
* A very simple and lightweight updater, without download features.
* @autor filoghost
* @author filoghost
*/
public final class SimpleUpdater {

View File

@ -7,6 +7,7 @@ import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.util.Collection;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -15,6 +16,7 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.NMSVersion;
public class BungeeChannel implements PluginMessageListener {
@ -97,8 +99,7 @@ public class BungeeChannel implements PluginMessageListener {
out.writeUTF(server);
} catch (IOException e) {
// It should not happen.
e.printStackTrace();
HolographicDisplays.getInstance().getLogger().warning("I/O Exception while asking for player count on server '" + server + "'.");
ConsoleLogger.log(Level.WARNING, "I/O Exception while asking for player count on server '" + server + "'.", e);
}
// OR, if you don't need to send it to a specific player

View File

@ -6,6 +6,7 @@ import java.net.UnknownHostException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
@ -15,7 +16,7 @@ import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.Se
import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.ServerPinger;
import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.PingResponse;
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
public class BungeeServerTracker {
@ -172,14 +173,14 @@ public class BungeeServerTracker {
} catch (SocketTimeoutException e) {
displayOffline = true;
} catch (UnknownHostException e) {
HolographicDisplays.getInstance().getLogger().warning("Couldn't fetch data from " + entry.getKey() + "(" + entry.getValue().toString() + "): unknown host address.");
ConsoleLogger.log(Level.WARNING, "Couldn't fetch data from " + entry.getKey() + "(" + entry.getValue().toString() + "): unknown host address.");
displayOffline = true;
} catch (IOException e) {
displayOffline = true;
} catch (Exception e) {
displayOffline = true;
HolographicDisplays.getInstance().getLogger().warning("Couldn't fetch data from " + entry.getKey() + "(" + entry.getValue().toString() + "), unhandled exception: " + e.toString());
DebugHandler.handleDebugException(e);
ConsoleLogger.log(Level.WARNING, "Couldn't fetch data from " + entry.getKey() + "(" + entry.getValue().toString() + "), unhandled exception: " + e.toString());
ConsoleLogger.logDebugException(e);
}
if (displayOffline) {

View File

@ -1,11 +1,12 @@
package com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger;
import java.lang.String;
import java.util.logging.Level;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
public class PingResponse
{
@ -25,7 +26,7 @@ public class PingResponse
if (jsonString == null || jsonString.isEmpty()) {
motd = "Invalid ping response";
DebugHandler.logToConsole("Received empty Json response from IP \"" + address.toString() + "\"!");
ConsoleLogger.logDebug(Level.WARNING, "Received empty Json response from IP \"" + address.toString() + "\"!");
return;
}
@ -33,7 +34,7 @@ public class PingResponse
if (!(jsonObject instanceof JSONObject)) {
motd = "Invalid ping response";
DebugHandler.logToConsole("Received invalid Json response from IP \"" + address.toString() + "\": " + jsonString);
ConsoleLogger.logDebug(Level.WARNING, "Received invalid Json response from IP \"" + address.toString() + "\": " + jsonString);
return;
}
@ -55,7 +56,7 @@ public class PingResponse
}
} else {
motd = "Invalid ping response (description not found)";
DebugHandler.logToConsole("Received invalid Json response from IP \"" + address.toString() + "\": " + jsonString);
ConsoleLogger.logDebug(Level.WARNING, "Received invalid Json response from IP \"" + address.toString() + "\": " + jsonString);
}
Object playersObject = json.get("players");

View File

@ -7,6 +7,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.configuration.InvalidConfigurationException;
@ -14,7 +15,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.ServerAddress;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
/**
@ -57,15 +58,15 @@ public class Configuration {
config.load(configFile);
} catch (InvalidConfigurationException e) {
e.printStackTrace();
plugin.getLogger().warning("The configuration is not a valid YAML file! Please check it with a tool like http://yaml-online-parser.appspot.com/");
ConsoleLogger.log(Level.WARNING, "The configuration is not a valid YAML file! Please check it with a tool like http://yaml-online-parser.appspot.com/");
return;
} catch (IOException e) {
e.printStackTrace();
plugin.getLogger().warning("I/O error while reading the configuration. Was the file in use?");
ConsoleLogger.log(Level.WARNING, "I/O error while reading the configuration. Was the file in use?");
return;
} catch (Exception e) {
e.printStackTrace();
plugin.getLogger().warning("Unhandled exception while reading the configuration!");
ConsoleLogger.log(Level.WARNING, "Unhandled exception while reading the configuration!");
return;
}
@ -110,7 +111,7 @@ public class Configuration {
config.save(configFile);
} catch (IOException e) {
e.printStackTrace();
plugin.getLogger().warning("I/O error while saving the configuration. Was the file in use?");
ConsoleLogger.log(Level.WARNING, "I/O error while saving the configuration. Was the file in use?");
}
}
@ -142,7 +143,7 @@ public class Configuration {
for (String singleServer : config.getStringList(ConfigNode.BUNGEE_PINGER_SERVERS.getPath())) {
String[] nameAndAddress = singleServer.split(":", 2);
if (nameAndAddress.length < 2) {
plugin.getLogger().warning("The server info \"" + singleServer + "\" is not valid. There should be a name and an address, separated by a colon.");
ConsoleLogger.log(Level.WARNING, "The server info \"" + singleServer + "\" is not valid. There should be a name and an address, separated by a colon.");
continue;
}
@ -158,7 +159,7 @@ public class Configuration {
try {
port = Integer.parseInt(ipAndPort[1]);
} catch (NumberFormatException e) {
plugin.getLogger().warning("Invalid port number in the server info \"" + singleServer + "\".");
ConsoleLogger.log(Level.WARNING, "Invalid port number in the server info \"" + singleServer + "\".");
continue;
}
} else {
@ -170,7 +171,7 @@ public class Configuration {
}
}
DebugHandler.setDebugEnabled(config.getBoolean(ConfigNode.DEBUG.getPath()));
ConsoleLogger.setDebugEnabled(config.getBoolean(ConfigNode.DEBUG.getPath()));
String tempColor = config.getString(ConfigNode.TRANSPARENCY_COLOR.getPath()).replace('&', ChatColor.COLOR_CHAR);
boolean foundColor = false;
@ -182,7 +183,7 @@ public class Configuration {
}
if (!foundColor) {
Configuration.transparencyColor = ChatColor.GRAY;
plugin.getLogger().warning("You didn't set a valid chat color for transparency in the configuration, light gray (&7) will be used.");
ConsoleLogger.log(Level.WARNING, "You didn't set a valid chat color for transparency in the configuration, light gray (&7) will be used.");
}
try {
@ -190,16 +191,16 @@ public class Configuration {
timeFormat.setTimeZone(TimeZone.getTimeZone(config.getString(ConfigNode.TIME_ZONE.getPath())));
} catch (IllegalArgumentException ex) {
timeFormat = new SimpleDateFormat("H:mm");
plugin.getLogger().warning("Time format not valid in the configuration, using the default.");
ConsoleLogger.log(Level.WARNING, "Time format not valid in the configuration, using the default.");
}
if (bungeeRefreshSeconds < 1) {
plugin.getLogger().warning("The minimum interval for pinging BungeeCord's servers is 1 second. It has been automatically set.");
ConsoleLogger.log(Level.WARNING, "The minimum interval for pinging BungeeCord's servers is 1 second. It has been automatically set.");
bungeeRefreshSeconds = 1;
}
if (bungeeRefreshSeconds > 60) {
plugin.getLogger().warning("The maximum interval for pinging BungeeCord's servers is 60 seconds. It has been automatically set.");
ConsoleLogger.log(Level.WARNING, "The maximum interval for pinging BungeeCord's servers is 60 seconds. It has been automatically set.");
bungeeRefreshSeconds = 60;
}
}

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.Location;
import org.bukkit.Material;
@ -13,7 +14,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
import com.gmail.filoghost.holographicdisplays.exception.HologramNotFoundException;
import com.gmail.filoghost.holographicdisplays.exception.InvalidFormatException;
import com.gmail.filoghost.holographicdisplays.exception.WorldNotFoundException;
@ -22,6 +22,7 @@ import com.gmail.filoghost.holographicdisplays.object.NamedHologram;
import com.gmail.filoghost.holographicdisplays.object.line.CraftHologramLine;
import com.gmail.filoghost.holographicdisplays.object.line.CraftItemLine;
import com.gmail.filoghost.holographicdisplays.object.line.CraftTextLine;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.ItemUtils;
import com.gmail.filoghost.holographicdisplays.util.Utils;
@ -147,7 +148,7 @@ public class HologramDatabase {
saveToDisk();
} catch (IOException ex) {
ex.printStackTrace();
HolographicDisplays.getInstance().getLogger().severe("Unable to save database.yml to disk!");
ConsoleLogger.log(Level.SEVERE, "Unable to save database.yml to disk!");
}
}
}

View File

@ -6,10 +6,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import org.apache.commons.lang.StringEscapeUtils;
import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.FileUtils;
public class UnicodeSymbols {
@ -30,12 +32,10 @@ public class UnicodeSymbols {
try {
lines = FileUtils.readLines(file);
} catch (IOException e) {
e.printStackTrace();
plugin.getLogger().warning("I/O error while reading symbols.yml. Was the file in use?");
ConsoleLogger.log(Level.WARNING, "I/O error while reading symbols.yml. Was the file in use?", e);
return;
} catch (Exception e) {
e.printStackTrace();
plugin.getLogger().warning("Unhandled exception while reading symbols.yml!");
ConsoleLogger.log(Level.WARNING, "Unhandled exception while reading symbols.yml!", e);
return;
}
@ -47,7 +47,7 @@ public class UnicodeSymbols {
}
if (!line.contains(":")) {
plugin.getLogger().warning("Unable to parse a line(" + line + ") from symbols.yml: it must contain ':' to separate the placeholder and the replacement.");
ConsoleLogger.log(Level.WARNING, "Unable to parse a line(" + line + ") from symbols.yml: it must contain ':' to separate the placeholder and the replacement.");
continue;
}
@ -56,12 +56,12 @@ public class UnicodeSymbols {
String replacement = StringEscapeUtils.unescapeJava(unquote(line.substring(indexOf + 1, line.length()).trim()));
if (placeholder.isEmpty() || replacement.isEmpty()) {
plugin.getLogger().warning("Unable to parse a line(" + line + ") from symbols.yml: the placeholder and the replacement must have both at least 1 character.");
ConsoleLogger.log(Level.WARNING, "Unable to parse a line(" + line + ") from symbols.yml: the placeholder and the replacement must have both at least 1 character.");
continue;
}
if (placeholder.length() > 30) {
plugin.getLogger().warning("Unable to parse a line(" + line + ") from symbols.yml: the placeholder cannot be longer than 30 characters.");
ConsoleLogger.log(Level.WARNING, "Unable to parse a line(" + line + ") from symbols.yml: the placeholder cannot be longer than 30 characters.");
continue;
}

View File

@ -35,6 +35,7 @@ import com.gmail.filoghost.holographicdisplays.object.NamedHologramManager;
import com.gmail.filoghost.holographicdisplays.object.PluginHologram;
import com.gmail.filoghost.holographicdisplays.object.PluginHologramManager;
import com.gmail.filoghost.holographicdisplays.object.line.CraftTouchSlimeLine;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
public class MainListener implements Listener, ItemPickupManager {
@ -138,7 +139,7 @@ public class MainListener implements Listener, ItemPickupManager {
touchSlime.getTouchablePiece().getTouchHandler().onTouch(event.getPlayer());
} catch (Throwable t) {
Plugin plugin = touchSlime.getParent() instanceof PluginHologram ? ((PluginHologram) touchSlime.getParent()).getOwner() : HolographicDisplays.getInstance();
HolographicDisplays.getInstance().getLogger().log(Level.WARNING, "The plugin " + plugin.getName() + " generated an exception when the player " + event.getPlayer().getName() + " touched a hologram.", t);
ConsoleLogger.log(Level.WARNING, "The plugin " + plugin.getName() + " generated an exception when the player " + event.getPlayer().getName() + " touched a hologram.", t);
}
}
}
@ -157,7 +158,7 @@ public class MainListener implements Listener, ItemPickupManager {
}
} catch (Throwable t) {
Plugin plugin = hologram instanceof PluginHologram ? ((PluginHologram) hologram).getOwner() : HolographicDisplays.getInstance();
HolographicDisplays.getInstance().getLogger().log(Level.WARNING, "The plugin " + plugin.getName() + " generated an exception when the player " + player.getName() + " picked up an item from a hologram.", t);
ConsoleLogger.log(Level.WARNING, "The plugin " + plugin.getName() + " generated an exception when the player " + player.getName() + " picked up an item from a hologram.", t);
}
}

View File

@ -3,12 +3,13 @@ package com.gmail.filoghost.holographicdisplays.placeholder;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
import com.gmail.filoghost.holographicdisplays.disk.StringConverter;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.FileUtils;
import com.gmail.filoghost.holographicdisplays.util.Utils;
@ -53,12 +54,12 @@ public class AnimationsRegister {
}
if (!validSpeedFound) {
plugin.getLogger().warning("Could not find a valid 'speed: <number>' in the first line of the file '" + file.getName() + "'. Default speed of 0.5 seconds will be used.");
ConsoleLogger.log(Level.WARNING, "Could not find a valid 'speed: <number>' in the first line of the file '" + file.getName() + "'. Default speed of 0.5 seconds will be used.");
}
if (lines.isEmpty()) {
lines.add("[No lines: " + file.getName() + "]");
plugin.getLogger().warning("Could not find any line in '" + file.getName() + "' (excluding the speed). You should add at least one more line.");
ConsoleLogger.log(Level.WARNING, "Could not find any line in '" + file.getName() + "' (excluding the speed). You should add at least one more line.");
}
// Replace placeholders.
@ -67,11 +68,10 @@ public class AnimationsRegister {
}
animations.put(file.getName(), new Placeholder(HolographicDisplays.getInstance(), file.getName(), speed, new CyclicPlaceholderReplacer(lines.toArray(new String[lines.size()]))));
DebugHandler.handleAnimationLoadSuccess(file.getName(), speed);
ConsoleLogger.logDebug(Level.INFO, "Successfully loaded animation '" + file.getName() + "', speed = " + speed + ".");
} catch (Exception e) {
e.printStackTrace();
plugin.getLogger().severe("Couldn't load the file '" + file.getName() + "'!");
ConsoleLogger.log(Level.SEVERE, "Couldn't load the file '" + file.getName() + "'!", e);
}
}
}

View File

@ -11,12 +11,12 @@ import java.util.regex.Pattern;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
import com.gmail.filoghost.holographicdisplays.api.placeholder.PlaceholderReplacer;
import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.BungeeServerTracker;
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSNameable;
import com.gmail.filoghost.holographicdisplays.object.line.CraftTextLine;
import com.gmail.filoghost.holographicdisplays.task.WorldPlayerCounterTask;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
import com.gmail.filoghost.holographicdisplays.util.Utils;
public class PlaceholdersManager {
@ -53,7 +53,7 @@ public class PlaceholdersManager {
try {
placeholder.update();
} catch (Throwable t) {
HolographicDisplays.getInstance().getLogger().log(Level.WARNING, "The placeholder " + placeholder.getTextPlaceholder() + " registered by the plugin " + placeholder.getOwner().getName() + " generated an exception while updating. Please contact the author of " + placeholder.getOwner().getName(), t);
ConsoleLogger.log(Level.WARNING, "The placeholder " + placeholder.getTextPlaceholder() + " registered by the plugin " + placeholder.getOwner().getName() + " generated an exception while updating. Please contact the author of " + placeholder.getOwner().getName(), t);
}
}
}

View File

@ -3,10 +3,11 @@ package com.gmail.filoghost.holographicdisplays.task;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.BungeeServerInfo;
import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.BungeeServerTracker;
import com.gmail.filoghost.holographicdisplays.util.DebugHandler;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
/**
* A task to remove unused server data in the server tracker.
@ -28,7 +29,7 @@ public class BungeeCleanupTask implements Runnable {
if (lastRequest != 0 && now - lastRequest > MAX_INACTIVITY) {
// Don't track that server anymore.
iter.remove();
DebugHandler.logToConsole("Removed bungee server \"" + next.getKey() + "\" from tracking due to inactivity.");
ConsoleLogger.logDebug(Level.INFO, "Removed bungee server \"" + next.getKey() + "\" from tracking due to inactivity.");
}
}
}

View File

@ -0,0 +1,49 @@
package com.gmail.filoghost.holographicdisplays.util;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
public class ConsoleLogger {
private static boolean debug;
private static Logger logger;
public static void setLogger(Logger logger) {
ConsoleLogger.logger = logger;
}
public static void setDebugEnabled(boolean enabled) {
debug = enabled;
}
public static void log(Level level, String msg, Throwable thrown) {
if (logger != null) {
logger.log(level, msg, thrown);
}
}
public static void log(Level level, String msg) {
log(level, msg, null);
}
public static void logDebug(Level level, String msg, Throwable thrown) {
if (debug) {
log(level, "[Debug] " + msg, thrown);
}
}
public static void logDebug(Level level, String msg) {
logDebug(level, msg, null);
}
public static void logDebugException(Throwable thrown) {
thrown.printStackTrace();
}
public static void handleSpawnFail(HologramLine parentPiece) {
logDebug(Level.WARNING, "Coulnd't spawn entity for this hologram: " + parentPiece.getParent().toString());
}
}

View File

@ -1,40 +0,0 @@
package com.gmail.filoghost.holographicdisplays.util;
import org.bukkit.plugin.Plugin;
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
public class DebugHandler {
private static boolean debug;
private static Plugin plugin;
public static void setDebugEnabled(boolean enabled) {
debug = enabled;
}
public static void logToConsole(String msg) {
if (debug) {
plugin.getLogger().info("[Debug] " + msg);
}
}
public static void handleAnimationLoadSuccess(String name, double speed) {
logToConsole("Successfully loaded animation '" + name + "', speed = " + speed + ".");
}
public static void handleSpawnFail(HologramLine parentPiece) {
if (debug) {
plugin.getLogger().severe("[Debug] Coulnd't spawn entity for this hologram: " + parentPiece.getParent().toString());
}
}
public static void handleDebugException(Exception e) {
if (debug) {
e.printStackTrace();
}
}
}

View File

@ -3,7 +3,7 @@ package com.gmail.filoghost.holographicdisplays.util.reflection;
import java.lang.reflect.Method;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
public class ReflectionUtils {
@ -38,7 +38,7 @@ public class ReflectionUtils {
}
} catch (Throwable t) {
if (!stackTraceErrorPrinted) {
Bukkit.getPluginManager().getPlugin("HolographicDisplays").getLogger().log(Level.WARNING, "Unable to get a stacktrace element, please inform the developer. You will only see this error once to avoid spam.", t);
ConsoleLogger.log(Level.WARNING, "Unable to get a stacktrace element, please inform the developer. You will only see this error once to avoid spam.", t);
stackTraceErrorPrinted = true;
}
return null;