Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Implement config to the API
Dieser Commit ist enthalten in:
Ursprung
ccb2a4756f
Commit
147891f76b
@ -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<UUID, UserConnection> 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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
34
src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java
Normale Datei
34
src/main/java/us/myles/ViaVersion/api/ViaVersionConfig.java
Normale Datei
@ -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();
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren