diff --git a/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java b/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java index efa05b282..a503fa244 100644 --- a/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java +++ b/src/main/java/us/myles/ViaVersion/ViaVersionPlugin.java @@ -14,6 +14,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import us.myles.ViaVersion.api.ViaVersion; import us.myles.ViaVersion.api.ViaVersionAPI; +import us.myles.ViaVersion.api.ViaVersionConfig; import us.myles.ViaVersion.api.boss.BossBar; import us.myles.ViaVersion.api.boss.BossColor; import us.myles.ViaVersion.api.boss.BossStyle; @@ -42,7 +43,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI { +public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI, ViaVersionConfig { private final Map portedPlayers = new ConcurrentHashMap<>(); private boolean debug = false; @@ -324,6 +325,10 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI { return getConfig().getBoolean("bossbar-anti-flicker", false); } + public boolean isUnkownEntitiesSuppressed() { + return getConfig().getBoolean("suppress-entityid-errors", false); + } + public double getHologramYOffset() { return getConfig().getDouble("hologram-y", -1D); } diff --git a/src/main/java/us/myles/ViaVersion/api/ViaVersion.java b/src/main/java/us/myles/ViaVersion/api/ViaVersion.java index f5507d4d2..97a5fa51e 100644 --- a/src/main/java/us/myles/ViaVersion/api/ViaVersion.java +++ b/src/main/java/us/myles/ViaVersion/api/ViaVersion.java @@ -2,10 +2,17 @@ package us.myles.ViaVersion.api; import lombok.Getter; import lombok.Setter; +import us.myles.ViaVersion.ViaVersionPlugin; public class ViaVersion { @Getter - @Setter private static ViaVersionAPI instance; + @Getter + private static ViaVersionConfig config; + + public static void setInstance(ViaVersionPlugin plugin) { + ViaVersion.instance = plugin; + ViaVersion.config = plugin; + } } diff --git a/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java b/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java new file mode 100644 index 000000000..8682a9b31 --- /dev/null +++ b/src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java @@ -0,0 +1,34 @@ +package us.myles.ViaVersion.api; + +/** + * Created by Hugo on 22/03/2016. + */ +public interface ViaVersionConfig { + + /** + * Obtain if global debug is enabled + * + * @return true if debug is enabled + */ + boolean isDebug(); + + public boolean isPreventCollision(); + + public boolean isNewEffectIndicator(); + + public boolean isSuppressMetadataErrors(); + + public boolean isShieldBlocking(); + + public boolean isHologramPatch(); + + public boolean isBossbarPatch(); + + public boolean isBossbarAntiflicker(); + + public boolean isUnkownEntitiesSuppressed(); + + public double getHologramYOffset(); + + public boolean isAutoTeam(); +}