From 3dad23c2168b2290acef266d2865ce1bbc359409 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 5 Oct 2017 00:35:28 +0200 Subject: [PATCH] Better error handling for hologram signs; resolves #267 --- .../io/github/dre2n/dungeonsxl/player/DInstancePlayer.java | 1 - .../java/io/github/dre2n/dungeonsxl/reward/ItemReward.java | 1 - .../java/io/github/dre2n/dungeonsxl/sign/ChestSign.java | 1 - .../java/io/github/dre2n/dungeonsxl/sign/FloorSign.java | 1 - .../java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java | 1 - .../io/github/dre2n/dungeonsxl/sign/ResourcePackSign.java | 1 - .../java/io/github/dre2n/dungeonsxl/sign/ScriptSign.java | 1 - .../io/github/dre2n/dungeonsxl/sign/lobby/ClassesSign.java | 1 - .../github/dre2n/dungeonsxl/sign/message/HologramSign.java | 6 +++++- .../java/io/github/dre2n/dungeonsxl/sign/mob/DMobSign.java | 1 - .../github/dre2n/dungeonsxl/sign/mob/ExternalMobSign.java | 1 - 11 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/dre2n/dungeonsxl/player/DInstancePlayer.java b/src/main/java/io/github/dre2n/dungeonsxl/player/DInstancePlayer.java index 7fc2c507..fdd98bd7 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/player/DInstancePlayer.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/player/DInstancePlayer.java @@ -16,7 +16,6 @@ */ package io.github.dre2n.dungeonsxl.player; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.MainConfig; import io.github.dre2n.dungeonsxl.util.ParsingUtil; import io.github.dre2n.dungeonsxl.world.DInstanceWorld; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/reward/ItemReward.java b/src/main/java/io/github/dre2n/dungeonsxl/reward/ItemReward.java index ad3dfbf3..0fb0bc17 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/reward/ItemReward.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/reward/ItemReward.java @@ -17,7 +17,6 @@ package io.github.dre2n.dungeonsxl.reward; import io.github.dre2n.commons.chat.MessageUtil; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.DMessage; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java index 766a2d10..e2761bc1 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java @@ -17,7 +17,6 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.commons.misc.NumberUtil; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.loottable.DLootTable; import io.github.dre2n.dungeonsxl.world.DGameWorld; import io.github.dre2n.dungeonsxl.world.block.RewardChest; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/FloorSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/FloorSign.java index 981a00a8..37aa3807 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/FloorSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/FloorSign.java @@ -16,7 +16,6 @@ */ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.player.DGamePlayer; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.world.DGameWorld; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java index 66252465..ad16a03f 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/LeaveSign.java @@ -16,7 +16,6 @@ */ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.event.dplayer.instance.game.DGamePlayerEscapeEvent; import io.github.dre2n.dungeonsxl.player.DGamePlayer; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/ResourcePackSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/ResourcePackSign.java index 8f47511d..009dba54 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/ResourcePackSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/ResourcePackSign.java @@ -16,7 +16,6 @@ */ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.world.DGameWorld; import org.bukkit.ChatColor; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/ScriptSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/ScriptSign.java index 42cf68aa..d04258bb 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/ScriptSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/ScriptSign.java @@ -16,7 +16,6 @@ */ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.world.DGameWorld; import org.bukkit.Material; import org.bukkit.block.Sign; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/lobby/ClassesSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/lobby/ClassesSign.java index e463065b..4c7a6c38 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/lobby/ClassesSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/lobby/ClassesSign.java @@ -16,7 +16,6 @@ */ package io.github.dre2n.dungeonsxl.sign.lobby; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.player.DClass; import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.sign.DSignType; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/message/HologramSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/message/HologramSign.java index 53af7247..1044800b 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/message/HologramSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/message/HologramSign.java @@ -24,11 +24,11 @@ import io.github.dre2n.commons.compatibility.CompatibilityHandler; import io.github.dre2n.commons.compatibility.Version; import io.github.dre2n.commons.misc.EnumUtil; import io.github.dre2n.commons.misc.NumberUtil; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.sign.DSignType; import io.github.dre2n.dungeonsxl.sign.DSignTypeDefault; import io.github.dre2n.dungeonsxl.world.DGameWorld; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -55,6 +55,10 @@ public class HologramSign extends DSign { @Override public void onInit() { + if (Bukkit.getPluginManager().getPlugin("HolographicDisplays") == null) { + markAsErroneous(); + return; + } getSign().getBlock().setType(Material.AIR); String[] holoLines = lines[1].split("/"); diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/DMobSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/DMobSign.java index 0df31b8e..4517c8cb 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/DMobSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/DMobSign.java @@ -17,7 +17,6 @@ package io.github.dre2n.dungeonsxl.sign.mob; import io.github.dre2n.commons.misc.NumberUtil; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.sign.DSignType; import io.github.dre2n.dungeonsxl.sign.DSignTypeDefault; diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/ExternalMobSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/ExternalMobSign.java index a40f456a..e02fecac 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/ExternalMobSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/mob/ExternalMobSign.java @@ -17,7 +17,6 @@ package io.github.dre2n.dungeonsxl.sign.mob; import io.github.dre2n.commons.misc.NumberUtil; -import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.mob.ExternalMobPlugin; import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider; import io.github.dre2n.dungeonsxl.sign.DSign;