Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 17:10:13 +01:00
Merge pull request #1528 from KennyTV/abstraction
Hold config values in fields, add extra mappings constructor, other fixes
Dieser Commit ist enthalten in:
Commit
459871257e
@ -1,7 +1,7 @@
|
|||||||
package us.myles.ViaVersion.bukkit.platform;
|
package us.myles.ViaVersion.bukkit.platform;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import us.myles.ViaVersion.AbstractViaConfig;
|
import us.myles.ViaVersion.AbstractViaConfig;
|
||||||
import us.myles.ViaVersion.ViaVersionPlugin;
|
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -12,13 +12,27 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BukkitViaConfig extends AbstractViaConfig {
|
public class BukkitViaConfig extends AbstractViaConfig {
|
||||||
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
|
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
|
||||||
|
private boolean antiXRay;
|
||||||
|
private boolean quickMoveActionFix;
|
||||||
|
private boolean hitboxFix1_9;
|
||||||
|
private boolean hitboxFix1_14;
|
||||||
|
private String blockConnectionMethod;
|
||||||
|
|
||||||
public BukkitViaConfig() {
|
public BukkitViaConfig() {
|
||||||
super(new File(((ViaVersionPlugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
super(new File(((Plugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFields() {
|
||||||
|
super.loadFields();
|
||||||
|
antiXRay = getBoolean("anti-xray-patch", true);
|
||||||
|
quickMoveActionFix = getBoolean("quick-move-action-fix", false);
|
||||||
|
hitboxFix1_9 = getBoolean("change-1_9-hitbox", false);
|
||||||
|
hitboxFix1_14 = getBoolean("change-1_14-hitbox", false);
|
||||||
|
blockConnectionMethod = getString("blockconnection-method", "packet");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
@ -28,6 +42,31 @@ public class BukkitViaConfig extends AbstractViaConfig {
|
|||||||
protected void handleConfig(Map<String, Object> config) {
|
protected void handleConfig(Map<String, Object> config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAntiXRay() {
|
||||||
|
return antiXRay;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_12QuickMoveActionFix() {
|
||||||
|
return quickMoveActionFix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_9HitboxFix() {
|
||||||
|
return hitboxFix1_9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_14HitboxFix() {
|
||||||
|
return hitboxFix1_14;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBlockConnectionMethod() {
|
||||||
|
return blockConnectionMethod;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getUnsupportedOptions() {
|
public List<String> getUnsupportedOptions() {
|
||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
|
@ -10,13 +10,23 @@ import java.util.*;
|
|||||||
|
|
||||||
public class BungeeViaConfig extends AbstractViaConfig {
|
public class BungeeViaConfig extends AbstractViaConfig {
|
||||||
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
||||||
|
private int bungeePingInterval;
|
||||||
|
private boolean bungeePingSave;
|
||||||
|
private Map<String, Integer> bungeeServerProtocols;
|
||||||
|
|
||||||
public BungeeViaConfig(File configFile) {
|
public BungeeViaConfig(File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFields() {
|
||||||
|
super.loadFields();
|
||||||
|
bungeePingInterval = getInt("bungee-ping-interval", 60);
|
||||||
|
bungeePingSave = getBoolean("bungee-ping-save", true);
|
||||||
|
bungeeServerProtocols = get("bungee-servers", Map.class, new HashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
@ -59,11 +69,6 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAntiXRay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemCache() {
|
public boolean isItemCache() {
|
||||||
return false;
|
return false;
|
||||||
@ -74,26 +79,6 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockConnectionMethod() {
|
|
||||||
return "packet";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_9HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_14HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the interval for checking servers via ping
|
* What is the interval for checking servers via ping
|
||||||
* -1 for disabled
|
* -1 for disabled
|
||||||
@ -101,7 +86,7 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
* @return Ping interval in seconds
|
* @return Ping interval in seconds
|
||||||
*/
|
*/
|
||||||
public int getBungeePingInterval() {
|
public int getBungeePingInterval() {
|
||||||
return getInt("bungee-ping-interval", 60);
|
return bungeePingInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +95,7 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
* @return True if it should save
|
* @return True if it should save
|
||||||
*/
|
*/
|
||||||
public boolean isBungeePingSave() {
|
public boolean isBungeePingSave() {
|
||||||
return getBoolean("bungee-ping-save", true);
|
return bungeePingSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +105,6 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
* @return Map of String, Integer
|
* @return Map of String, Integer
|
||||||
*/
|
*/
|
||||||
public Map<String, Integer> getBungeeServerProtocols() {
|
public Map<String, Integer> getBungeeServerProtocols() {
|
||||||
return get("bungee-servers", Map.class, new HashMap<>());
|
return bungeeServerProtocols;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,252 +4,349 @@ import us.myles.ViaVersion.api.ViaVersionConfig;
|
|||||||
import us.myles.ViaVersion.util.Config;
|
import us.myles.ViaVersion.util.Config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class AbstractViaConfig extends Config implements ViaVersionConfig {
|
public abstract class AbstractViaConfig extends Config implements ViaVersionConfig {
|
||||||
|
|
||||||
|
private boolean checkForUpdates;
|
||||||
|
private boolean preventCollision;
|
||||||
|
private boolean useNewEffectIndicator;
|
||||||
|
private boolean useNewDeathmessages;
|
||||||
|
private boolean suppressMetadataErrors;
|
||||||
|
private boolean shieldBlocking;
|
||||||
|
private boolean hologramPatch;
|
||||||
|
private boolean pistonAnimationPatch;
|
||||||
|
private boolean bossbarPatch;
|
||||||
|
private boolean bossbarAntiFlicker;
|
||||||
|
private double hologramOffset;
|
||||||
|
private int maxPPS;
|
||||||
|
private String maxPPSKickMessage;
|
||||||
|
private int trackingPeriod;
|
||||||
|
private int warningPPS;
|
||||||
|
private int maxPPSWarnings;
|
||||||
|
private String maxPPSWarningsKickMessage;
|
||||||
|
private boolean sendSupportedVersions;
|
||||||
|
private boolean simulatePlayerTick;
|
||||||
|
private boolean itemCache;
|
||||||
|
private boolean nmsPlayerTicking;
|
||||||
|
private boolean replacePistons;
|
||||||
|
private int pistonReplacementId;
|
||||||
|
private boolean autoTeam;
|
||||||
|
private boolean forceJsonTransform;
|
||||||
|
private boolean nbtArrayFix;
|
||||||
|
private Set<Integer> blockedProtocols;
|
||||||
|
private String blockedDisconnectMessage;
|
||||||
|
private String reloadDisconnectMessage;
|
||||||
|
private boolean suppressConversionWarnings;
|
||||||
|
private boolean disable1_13TabComplete;
|
||||||
|
private boolean minimizeCooldown;
|
||||||
|
private boolean teamColourFix;
|
||||||
|
private boolean serversideBlockConnections;
|
||||||
|
private boolean reduceBlockStorageMemory;
|
||||||
|
private boolean flowerStemWhenBlockAbove;
|
||||||
|
private boolean snowCollisionFix;
|
||||||
|
private int tabCompleteDelay;
|
||||||
|
private boolean truncate1_14Books;
|
||||||
|
private boolean leftHandedHandling;
|
||||||
|
private boolean fullBlockLightFix;
|
||||||
|
private boolean healthNaNFix;
|
||||||
|
private boolean instantRespawn;
|
||||||
|
|
||||||
protected AbstractViaConfig(File configFile) {
|
protected AbstractViaConfig(File configFile) {
|
||||||
super(configFile);
|
super(configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reloadConfig() {
|
||||||
|
super.reloadConfig();
|
||||||
|
loadFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadFields() {
|
||||||
|
checkForUpdates = getBoolean("checkforupdates", true);
|
||||||
|
preventCollision = getBoolean("prevent-collision", true);
|
||||||
|
useNewEffectIndicator = getBoolean("use-new-effect-indicator", true);
|
||||||
|
useNewDeathmessages = getBoolean("use-new-deathmessages", true);
|
||||||
|
suppressMetadataErrors = getBoolean("suppress-metadata-errors", false);
|
||||||
|
shieldBlocking = getBoolean("shield-blocking", true);
|
||||||
|
hologramPatch = getBoolean("hologram-patch", false);
|
||||||
|
pistonAnimationPatch = getBoolean("piston-animation-patch", false);
|
||||||
|
bossbarPatch = getBoolean("bossbar-patch", true);
|
||||||
|
bossbarAntiFlicker = getBoolean("bossbar-anti-flicker", false);
|
||||||
|
hologramOffset = getDouble("hologram-y", -0.96D);
|
||||||
|
maxPPS = getInt("max-pps", 800);
|
||||||
|
maxPPSKickMessage = getString("max-pps-kick-msg", "Sending packets too fast? lag?");
|
||||||
|
trackingPeriod = getInt("tracking-period", 6);
|
||||||
|
warningPPS = getInt("tracking-warning-pps", 120);
|
||||||
|
maxPPSWarnings = getInt("tracking-max-warnings", 3);
|
||||||
|
maxPPSWarningsKickMessage = getString("tracking-max-kick-msg", "You are sending too many packets, :(");
|
||||||
|
sendSupportedVersions = getBoolean("send-supported-versions", false);
|
||||||
|
simulatePlayerTick = getBoolean("simulate-pt", true);
|
||||||
|
itemCache = getBoolean("item-cache", true);
|
||||||
|
nmsPlayerTicking = getBoolean("nms-player-ticking", true);
|
||||||
|
replacePistons = getBoolean("replace-pistons", false);
|
||||||
|
pistonReplacementId = getInt("replacement-piston-id", 0);
|
||||||
|
autoTeam = getBoolean("auto-team", true);
|
||||||
|
forceJsonTransform = getBoolean("force-json-transform", false);
|
||||||
|
nbtArrayFix = getBoolean("chat-nbt-fix", true);
|
||||||
|
blockedProtocols = new HashSet<>(getIntegerList("block-protocols"));
|
||||||
|
blockedDisconnectMessage = getString("block-disconnect-msg", "You are using an unsupported Minecraft version!");
|
||||||
|
reloadDisconnectMessage = getString("reload-disconnect-msg", "Server reload, please rejoin!");
|
||||||
|
minimizeCooldown = getBoolean("minimize-cooldown", true);
|
||||||
|
teamColourFix = getBoolean("team-colour-fix", true);
|
||||||
|
suppressConversionWarnings = getBoolean("suppress-conversion-warnings", false);
|
||||||
|
disable1_13TabComplete = getBoolean("disable-1_13-auto-complete", false);
|
||||||
|
serversideBlockConnections = getBoolean("serverside-blockconnections", false);
|
||||||
|
reduceBlockStorageMemory = getBoolean("reduce-blockstorage-memory", false);
|
||||||
|
flowerStemWhenBlockAbove = getBoolean("flowerstem-when-block-above", false);
|
||||||
|
snowCollisionFix = getBoolean("fix-low-snow-collision", false);
|
||||||
|
tabCompleteDelay = getInt("1_13-tab-complete-delay", 0);
|
||||||
|
truncate1_14Books = getBoolean("truncate-1_14-books", false);
|
||||||
|
leftHandedHandling = getBoolean("left-handed-handling", true);
|
||||||
|
fullBlockLightFix = getBoolean("fix-non-full-blocklight", false);
|
||||||
|
healthNaNFix = getBoolean("fix-1_14-health-nan", true);
|
||||||
|
instantRespawn = getBoolean("use-1_15-instant-respawn", false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCheckForUpdates() {
|
public boolean isCheckForUpdates() {
|
||||||
return getBoolean("checkforupdates", true);
|
return checkForUpdates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreventCollision() {
|
public boolean isPreventCollision() {
|
||||||
return getBoolean("prevent-collision", true);
|
return preventCollision;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNewEffectIndicator() {
|
public boolean isNewEffectIndicator() {
|
||||||
return getBoolean("use-new-effect-indicator", true);
|
return useNewEffectIndicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShowNewDeathMessages() {
|
public boolean isShowNewDeathMessages() {
|
||||||
return getBoolean("use-new-deathmessages", true);
|
return useNewDeathmessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSuppressMetadataErrors() {
|
public boolean isSuppressMetadataErrors() {
|
||||||
return getBoolean("suppress-metadata-errors", false);
|
return suppressMetadataErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShieldBlocking() {
|
public boolean isShieldBlocking() {
|
||||||
return getBoolean("shield-blocking", true);
|
return shieldBlocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHologramPatch() {
|
public boolean isHologramPatch() {
|
||||||
return getBoolean("hologram-patch", false);
|
return hologramPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPistonAnimationPatch() {
|
public boolean isPistonAnimationPatch() {
|
||||||
return getBoolean("piston-animation-patch", false);
|
return pistonAnimationPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBossbarPatch() {
|
public boolean isBossbarPatch() {
|
||||||
return getBoolean("bossbar-patch", true);
|
return bossbarPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBossbarAntiflicker() {
|
public boolean isBossbarAntiflicker() {
|
||||||
return getBoolean("bossbar-anti-flicker", false);
|
return bossbarAntiFlicker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getHologramYOffset() {
|
public double getHologramYOffset() {
|
||||||
return getDouble("hologram-y", -0.96D);
|
return hologramOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxPPS() {
|
public int getMaxPPS() {
|
||||||
return getInt("max-pps", 800);
|
return maxPPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMaxPPSKickMessage() {
|
public String getMaxPPSKickMessage() {
|
||||||
return getString("max-pps-kick-msg", "Sending packets too fast? lag?");
|
return maxPPSKickMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTrackingPeriod() {
|
public int getTrackingPeriod() {
|
||||||
return getInt("tracking-period", 6);
|
return trackingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWarningPPS() {
|
public int getWarningPPS() {
|
||||||
return getInt("tracking-warning-pps", 120);
|
return warningPPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxWarnings() {
|
public int getMaxWarnings() {
|
||||||
return getInt("tracking-max-warnings", 3);
|
return maxPPSWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMaxWarningsKickMessage() {
|
public String getMaxWarningsKickMessage() {
|
||||||
return getString("tracking-max-kick-msg", "You are sending too many packets, :(");
|
return maxPPSWarningsKickMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAntiXRay() {
|
public boolean isAntiXRay() {
|
||||||
return getBoolean("anti-xray-patch", true);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSendSupportedVersions() {
|
public boolean isSendSupportedVersions() {
|
||||||
return getBoolean("send-supported-versions", false);
|
return sendSupportedVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStimulatePlayerTick() {
|
public boolean isSimulatePlayerTick() {
|
||||||
return getBoolean("simulate-pt", true);
|
return simulatePlayerTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemCache() {
|
public boolean isItemCache() {
|
||||||
return getBoolean("item-cache", true);
|
return itemCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNMSPlayerTicking() {
|
public boolean isNMSPlayerTicking() {
|
||||||
return getBoolean("nms-player-ticking", true);
|
return nmsPlayerTicking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplacePistons() {
|
public boolean isReplacePistons() {
|
||||||
return getBoolean("replace-pistons", false);
|
return replacePistons;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPistonReplacementId() {
|
public int getPistonReplacementId() {
|
||||||
return getInt("replacement-piston-id", 0);
|
return pistonReplacementId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAutoTeam() {
|
public boolean isAutoTeam() {
|
||||||
// Collision has to be enabled first
|
// Collision has to be enabled first
|
||||||
return isPreventCollision() && getBoolean("auto-team", true);
|
return isPreventCollision() && autoTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isForceJsonTransform() {
|
public boolean isForceJsonTransform() {
|
||||||
return getBoolean("force-json-transform", false);
|
return forceJsonTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_12NBTArrayFix() {
|
public boolean is1_12NBTArrayFix() {
|
||||||
return getBoolean("chat-nbt-fix", true);
|
return nbtArrayFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
public boolean is1_12QuickMoveActionFix() {
|
||||||
return getBoolean("quick-move-action-fix", false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> getBlockedProtocols() {
|
public Set<Integer> getBlockedProtocols() {
|
||||||
return getIntegerList("block-protocols");
|
return blockedProtocols;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockedDisconnectMsg() {
|
public String getBlockedDisconnectMsg() {
|
||||||
return getString("block-disconnect-msg", "You are using an unsupported Minecraft version!");
|
return blockedDisconnectMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReloadDisconnectMsg() {
|
public String getReloadDisconnectMsg() {
|
||||||
return getString("reload-disconnect-msg", "Server reload, please rejoin!");
|
return reloadDisconnectMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMinimizeCooldown() {
|
public boolean isMinimizeCooldown() {
|
||||||
return getBoolean("minimize-cooldown", true);
|
return minimizeCooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_13TeamColourFix() {
|
public boolean is1_13TeamColourFix() {
|
||||||
return getBoolean("team-colour-fix", true);
|
return teamColourFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSuppress1_13ConversionErrors() {
|
public boolean isSuppressConversionWarnings() {
|
||||||
return getBoolean("suppress-1_13-conversion-errors", false);
|
return suppressConversionWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDisable1_13AutoComplete() {
|
public boolean isDisable1_13AutoComplete() {
|
||||||
return getBoolean("disable-1_13-auto-complete", false);
|
return disable1_13TabComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isServersideBlockConnections() {
|
public boolean isServersideBlockConnections() {
|
||||||
return getBoolean("serverside-blockconnections", false);
|
return serversideBlockConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockConnectionMethod() {
|
public String getBlockConnectionMethod() {
|
||||||
return getString("blockconnection-method", "packet");
|
return "packet";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReduceBlockStorageMemory() {
|
public boolean isReduceBlockStorageMemory() {
|
||||||
return getBoolean("reduce-blockstorage-memory", false);
|
return reduceBlockStorageMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStemWhenBlockAbove() {
|
public boolean isStemWhenBlockAbove() {
|
||||||
return getBoolean("flowerstem-when-block-above", false);
|
return flowerStemWhenBlockAbove;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSnowCollisionFix() {
|
public boolean isSnowCollisionFix() {
|
||||||
return getBoolean("fix-low-snow-collision", false);
|
return snowCollisionFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int get1_13TabCompleteDelay() {
|
public int get1_13TabCompleteDelay() {
|
||||||
return getInt("1_13-tab-complete-delay", 0);
|
return tabCompleteDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTruncate1_14Books() {
|
public boolean isTruncate1_14Books() {
|
||||||
return getBoolean("truncate-1_14-books", false);
|
return truncate1_14Books;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLeftHandedHandling() {
|
public boolean isLeftHandedHandling() {
|
||||||
return getBoolean("left-handed-handling", true);
|
return leftHandedHandling;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_9HitboxFix() {
|
public boolean is1_9HitboxFix() {
|
||||||
return getBoolean("change-1_9-hitbox", false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_14HitboxFix() {
|
public boolean is1_14HitboxFix() {
|
||||||
return getBoolean("change-1_14-hitbox", false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNonFullBlockLightFix() {
|
public boolean isNonFullBlockLightFix() {
|
||||||
return getBoolean("fix-non-full-blocklight", false);
|
return fullBlockLightFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_14HealthNaNFix() {
|
public boolean is1_14HealthNaNFix() {
|
||||||
return getBoolean("fix-1_14-health-nan", true);
|
return healthNaNFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_15InstantRespawn() {
|
public boolean is1_15InstantRespawn() {
|
||||||
return getBoolean("use-1_15-instant-respawn", false);
|
return instantRespawn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package us.myles.ViaVersion.api;
|
package us.myles.ViaVersion.api;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface ViaVersionConfig {
|
public interface ViaVersionConfig {
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ public interface ViaVersionConfig {
|
|||||||
*
|
*
|
||||||
* @return if true, enabled
|
* @return if true, enabled
|
||||||
*/
|
*/
|
||||||
boolean isStimulatePlayerTick();
|
boolean isSimulatePlayerTick();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the item cache to prevent high resource usage
|
* Use the item cache to prevent high resource usage
|
||||||
@ -213,7 +213,7 @@ public interface ViaVersionConfig {
|
|||||||
*
|
*
|
||||||
* @return An Integer list
|
* @return An Integer list
|
||||||
*/
|
*/
|
||||||
List<Integer> getBlockedProtocols();
|
Set<Integer> getBlockedProtocols();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom disconnect message
|
* Get the custom disconnect message
|
||||||
@ -231,11 +231,11 @@ public interface ViaVersionConfig {
|
|||||||
String getReloadDisconnectMsg();
|
String getReloadDisconnectMsg();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we hide errors that occur when trying to converting to 1.13 data?
|
* Should we hide errors that occur when trying to convert block and item data over versions?
|
||||||
*
|
*
|
||||||
* @return True if enabled
|
* @return True if enabled
|
||||||
*/
|
*/
|
||||||
boolean isSuppress1_13ConversionErrors();
|
boolean isSuppressConversionWarnings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we disable the 1.13 auto-complete feature to stop spam kicks? (for any server lower than 1.13)
|
* Should we disable the 1.13 auto-complete feature to stop spam kicks? (for any server lower than 1.13)
|
||||||
|
@ -31,7 +31,7 @@ public class MappingDataLoader {
|
|||||||
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
||||||
Map.Entry<String, JsonElement> value = findValue(newIdentifiers, entry.getValue().getAsString());
|
Map.Entry<String, JsonElement> value = findValue(newIdentifiers, entry.getValue().getAsString());
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -53,7 +53,7 @@ public class MappingDataLoader {
|
|||||||
value = findValue(newIdentifiers, diffIdentifiers.get(entry.getKey()).getAsString());
|
value = findValue(newIdentifiers, diffIdentifiers.get(entry.getKey()).getAsString());
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -68,7 +68,7 @@ public class MappingDataLoader {
|
|||||||
JsonElement v = oldIdentifiers.get(i);
|
JsonElement v = oldIdentifiers.get(i);
|
||||||
Integer index = findIndex(newIdentifiers, v.getAsString());
|
Integer index = findIndex(newIdentifiers, v.getAsString());
|
||||||
if (index == null) {
|
if (index == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("No key for " + v + " :( ");
|
Via.getPlatform().getLogger().warning("No key for " + v + " :( ");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -8,13 +8,17 @@ import java.util.Arrays;
|
|||||||
public class Mappings {
|
public class Mappings {
|
||||||
protected final short[] oldToNew;
|
protected final short[] oldToNew;
|
||||||
|
|
||||||
|
protected Mappings(short[] oldToNew) {
|
||||||
|
this.oldToNew = oldToNew;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps old identifiers to the new ones.
|
* Maps old identifiers to the new ones.
|
||||||
* If an old value cannot be found in the new mappings, the diffmapping will be checked for the given entry.
|
* If an old value cannot be found in the new mappings, the diffmapping will be checked for the given entry.
|
||||||
*
|
*
|
||||||
* @param size set size of the underlying short array
|
* @param size set size of the underlying short array
|
||||||
* @param oldMapping mappings to map from
|
* @param oldMapping mappings to map from
|
||||||
* @param newMapping mappings to map to
|
* @param newMapping mappings to map to
|
||||||
* @param diffMapping extra mappings that will be used/scanned when an entry cannot be found
|
* @param diffMapping extra mappings that will be used/scanned when an entry cannot be found
|
||||||
*/
|
*/
|
||||||
public Mappings(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
public Mappings(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
||||||
@ -30,7 +34,7 @@ public class Mappings {
|
|||||||
/**
|
/**
|
||||||
* Maps old identifiers to the new ones.
|
* Maps old identifiers to the new ones.
|
||||||
*
|
*
|
||||||
* @param size set size of the underlying short array
|
* @param size set size of the underlying short array
|
||||||
* @param oldMapping mappings to map from
|
* @param oldMapping mappings to map from
|
||||||
* @param newMapping mappings to map to
|
* @param newMapping mappings to map to
|
||||||
*/
|
*/
|
||||||
@ -47,7 +51,7 @@ public class Mappings {
|
|||||||
/**
|
/**
|
||||||
* Maps old identifiers to the new ones.
|
* Maps old identifiers to the new ones.
|
||||||
*
|
*
|
||||||
* @param size set size of the underlying short array
|
* @param size set size of the underlying short array
|
||||||
* @param oldMapping mappings to map from
|
* @param oldMapping mappings to map from
|
||||||
* @param newMapping mappings to map to
|
* @param newMapping mappings to map to
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@ public class Entity1_10Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.10 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class Entity1_11Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.11 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class Entity1_12Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.12 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class Entity1_13Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.13 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class Entity1_14Types {
|
|||||||
Optional<EntityType> type = EntityType.findById(typeID);
|
Optional<EntityType> type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID);
|
Via.getPlatform().getLogger().severe("Could not find 1.14 type id " + typeID);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class Entity1_15Types {
|
|||||||
Optional<EntityType> type = EntityType.findById(typeID);
|
Optional<EntityType> type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID);
|
Via.getPlatform().getLogger().severe("Could not find 1.15 type id " + typeID);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ public class Entity1_15Types {
|
|||||||
|
|
||||||
// Monsters
|
// Monsters
|
||||||
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
||||||
BLAZE(4, ABSTRACT_MONSTER),
|
BLAZE(5, ABSTRACT_MONSTER),
|
||||||
CREEPER(12, ABSTRACT_MONSTER),
|
CREEPER(12, ABSTRACT_MONSTER),
|
||||||
ENDERMITE(21, ABSTRACT_MONSTER),
|
ENDERMITE(21, ABSTRACT_MONSTER),
|
||||||
ENDERMAN(20, ABSTRACT_MONSTER),
|
ENDERMAN(20, ABSTRACT_MONSTER),
|
||||||
|
@ -85,6 +85,18 @@ public class ItemRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerSetCooldown(int oldPacketId, int newPacketId, ItemIdRewriteFunction itemIDRewriteFunction) {
|
||||||
|
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
int itemId = wrapper.read(Type.VAR_INT);
|
||||||
|
wrapper.write(Type.VAR_INT, itemIDRewriteFunction.rewrite(itemId));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Only sent to the client
|
// Only sent to the client
|
||||||
public PacketHandler itemArrayHandler(Type<Item[]> type) {
|
public PacketHandler itemArrayHandler(Type<Item[]> type) {
|
||||||
return wrapper -> {
|
return wrapper -> {
|
||||||
@ -108,4 +120,10 @@ public class ItemRewriter {
|
|||||||
|
|
||||||
void rewrite(Item item);
|
void rewrite(Item item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface ItemIdRewriteFunction {
|
||||||
|
|
||||||
|
int rewrite(int itemId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class ByteArrayType extends Type<byte[]> {
|
|||||||
@Override
|
@Override
|
||||||
public byte[] read(ByteBuf buffer) throws Exception {
|
public byte[] read(ByteBuf buffer) throws Exception {
|
||||||
int length = Type.VAR_INT.read(buffer);
|
int length = Type.VAR_INT.read(buffer);
|
||||||
Preconditions.checkArgument(!buffer.isReadable(length), "Length is fewer than readable bytes");
|
Preconditions.checkArgument(buffer.isReadable(length), "Length is fewer than readable bytes");
|
||||||
byte[] array = new byte[length];
|
byte[] array = new byte[length];
|
||||||
buffer.readBytes(array);
|
buffer.readBytes(array);
|
||||||
return array;
|
return array;
|
||||||
|
@ -100,7 +100,7 @@ public class InventoryPackets {
|
|||||||
flags |= 1;
|
flags |= 1;
|
||||||
Optional<SoundSource> finalSource = SoundSource.findBySource(originalSource);
|
Optional<SoundSource> finalSource = SoundSource.findBySource(originalSource);
|
||||||
if (!finalSource.isPresent()) {
|
if (!finalSource.isPresent()) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().info("Could not handle unknown sound source " + originalSource + " falling back to default: master");
|
Via.getPlatform().getLogger().info("Could not handle unknown sound source " + originalSource + " falling back to default: master");
|
||||||
}
|
}
|
||||||
finalSource = Optional.of(SoundSource.MASTER);
|
finalSource = Optional.of(SoundSource.MASTER);
|
||||||
@ -147,7 +147,7 @@ public class InventoryPackets {
|
|||||||
String old = channel;
|
String old = channel;
|
||||||
channel = getNewPluginChannelId(channel);
|
channel = getNewPluginChannelId(channel);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + old);
|
Via.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + old);
|
||||||
}
|
}
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
@ -159,7 +159,7 @@ public class InventoryPackets {
|
|||||||
String rewritten = getNewPluginChannelId(channels[i]);
|
String rewritten = getNewPluginChannelId(channels[i]);
|
||||||
if (rewritten != null) {
|
if (rewritten != null) {
|
||||||
rewrittenChannels.add(rewritten);
|
rewrittenChannels.add(rewritten);
|
||||||
} else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]);
|
Via.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ public class InventoryPackets {
|
|||||||
String old = channel;
|
String old = channel;
|
||||||
channel = getOldPluginChannelId(channel);
|
channel = getOldPluginChannelId(channel);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + old);
|
Via.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + old);
|
||||||
}
|
}
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
@ -230,7 +230,7 @@ public class InventoryPackets {
|
|||||||
String rewritten = getOldPluginChannelId(channels[i]);
|
String rewritten = getOldPluginChannelId(channels[i]);
|
||||||
if (rewritten != null) {
|
if (rewritten != null) {
|
||||||
rewrittenChannels.add(rewritten);
|
rewrittenChannels.add(rewritten);
|
||||||
} else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]);
|
Via.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,7 +431,7 @@ public class InventoryPackets {
|
|||||||
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
||||||
rawId &= ~0xF; // Remove data
|
rawId &= ~0xF; // Remove data
|
||||||
} else {
|
} else {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier());
|
Via.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier());
|
||||||
}
|
}
|
||||||
rawId = 16; // Stone
|
rawId = 16; // Stone
|
||||||
@ -518,7 +518,7 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rawId == null) {
|
if (rawId == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.getIdentifier());
|
Via.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.getIdentifier());
|
||||||
}
|
}
|
||||||
rawId = 0x10000; // Stone
|
rawId = 0x10000; // Stone
|
||||||
|
@ -73,7 +73,7 @@ public class WorldPackets {
|
|||||||
|
|
||||||
Optional<Integer> id = provider.getIntByIdentifier(motive);
|
Optional<Integer> id = provider.getIntByIdentifier(motive);
|
||||||
|
|
||||||
if (!id.isPresent() && (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug())) {
|
if (!id.isPresent() && (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug())) {
|
||||||
Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)");
|
Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)");
|
||||||
}
|
}
|
||||||
wrapper.write(Type.VAR_INT, id.orElse(0));
|
wrapper.write(Type.VAR_INT, id.orElse(0));
|
||||||
@ -374,7 +374,7 @@ public class WorldPackets {
|
|||||||
if (!validBiomes.contains(biome)) {
|
if (!validBiomes.contains(biome)) {
|
||||||
if (biome != 255 // is it generated naturally? *shrug*
|
if (biome != 255 // is it generated naturally? *shrug*
|
||||||
&& latestBiomeWarn != biome) {
|
&& latestBiomeWarn != biome) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Received invalid biome id " + biome);
|
Via.getPlatform().getLogger().warning("Received invalid biome id " + biome);
|
||||||
}
|
}
|
||||||
latestBiomeWarn = biome;
|
latestBiomeWarn = biome;
|
||||||
@ -502,12 +502,12 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
newId = MappingData.blockMappings.getNewId(oldId & ~0xF); // Remove data
|
newId = MappingData.blockMappings.getNewId(oldId & ~0xF); // Remove data
|
||||||
if (newId != -1) {
|
if (newId != -1) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Missing block " + oldId);
|
Via.getPlatform().getLogger().warning("Missing block " + oldId);
|
||||||
}
|
}
|
||||||
return newId;
|
return newId;
|
||||||
}
|
}
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Missing block completely " + oldId);
|
Via.getPlatform().getLogger().warning("Missing block completely " + oldId);
|
||||||
}
|
}
|
||||||
// Default stone
|
// Default stone
|
||||||
|
@ -61,7 +61,7 @@ public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler
|
|||||||
} else if (flowersNumberId.containsKey(pair)) {
|
} else if (flowersNumberId.containsKey(pair)) {
|
||||||
return flowersNumberId.get(pair);
|
return flowersNumberId.get(pair);
|
||||||
} else {
|
} else {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Could not find flowerpot content " + item + " for " + tag);
|
Via.getPlatform().getLogger().warning("Could not find flowerpot content " + item + " for " + tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,6 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
|||||||
registerOutgoing(State.PLAY, 0x34, 0x35);
|
registerOutgoing(State.PLAY, 0x34, 0x35);
|
||||||
registerOutgoing(State.PLAY, 0x35, 0x36);
|
registerOutgoing(State.PLAY, 0x35, 0x36);
|
||||||
registerOutgoing(State.PLAY, 0x36, 0x37);
|
registerOutgoing(State.PLAY, 0x36, 0x37);
|
||||||
registerOutgoing(State.PLAY, 0x37, 0x38);
|
|
||||||
registerOutgoing(State.PLAY, 0x38, 0x39);
|
registerOutgoing(State.PLAY, 0x38, 0x39);
|
||||||
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
||||||
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
||||||
|
@ -115,6 +115,8 @@ public class EntityPackets {
|
|||||||
|
|
||||||
// Metadata packet
|
// Metadata packet
|
||||||
metadataRewriter.registerMetadataRewriter(0x43, 0x44, Types1_14.METADATA_LIST);
|
metadataRewriter.registerMetadataRewriter(0x43, 0x44, Types1_14.METADATA_LIST);
|
||||||
|
|
||||||
|
metadataRewriter.registerEntityDestroy(0x37, 0x38);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewEntityId(int oldId) {
|
public static int getNewEntityId(int oldId) {
|
||||||
|
@ -31,6 +31,16 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
boolean groundUp = input.readBoolean();
|
boolean groundUp = input.readBoolean();
|
||||||
int primaryBitmask = Type.VAR_INT.read(input);
|
int primaryBitmask = Type.VAR_INT.read(input);
|
||||||
CompoundTag heightMap = Type.NBT.read(input);
|
CompoundTag heightMap = Type.NBT.read(input);
|
||||||
|
|
||||||
|
int[] biomeData = groundUp ? new int[256] : null;
|
||||||
|
if (groundUp) {
|
||||||
|
//TODO Why 1024 ints?
|
||||||
|
for (int i = 0; i < 1024; i++) {
|
||||||
|
//biomeData[i] = input.readInt();
|
||||||
|
input.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Type.VAR_INT.read(input);
|
Type.VAR_INT.read(input);
|
||||||
|
|
||||||
BitSet usedSections = new BitSet(16);
|
BitSet usedSections = new BitSet(16);
|
||||||
@ -42,15 +52,6 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] biomeData = groundUp ? new int[256] : null;
|
|
||||||
if (groundUp) {
|
|
||||||
//TODO Why 1024 ints?
|
|
||||||
for (int i = 0; i < 1024; i++) {
|
|
||||||
//biomeData[i] = input.readInt();
|
|
||||||
input.readInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read sections
|
// Read sections
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (!usedSections.get(i)) continue; // Section not set
|
if (!usedSections.get(i)) continue; // Section not set
|
||||||
|
@ -100,7 +100,7 @@ public class Protocol1_9To1_8 extends Protocol {
|
|||||||
providers.register(BossBarProvider.class, new BossBarProvider());
|
providers.register(BossBarProvider.class, new BossBarProvider());
|
||||||
providers.register(MainHandProvider.class, new MainHandProvider());
|
providers.register(MainHandProvider.class, new MainHandProvider());
|
||||||
providers.require(MovementTransmitterProvider.class);
|
providers.require(MovementTransmitterProvider.class);
|
||||||
if (Via.getConfig().isStimulatePlayerTick()) {
|
if (Via.getConfig().isSimulatePlayerTick()) {
|
||||||
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
|
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public abstract class Config implements ConfigurationProvider {
|
|||||||
|
|
||||||
private final CommentStore commentStore = new CommentStore('.', 2);
|
private final CommentStore commentStore = new CommentStore('.', 2);
|
||||||
private final File configFile;
|
private final File configFile;
|
||||||
private ConcurrentSkipListMap<String, Object> config;
|
private Map<String, Object> config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Config instance, this will *not* load the config by default.
|
* Create a new Config instance, this will *not* load the config by default.
|
||||||
|
@ -22,6 +22,8 @@ block-disconnect-msg: "You are using an unsupported Minecraft version!"
|
|||||||
# (We don't suggest using reload either, use a plugin manager)
|
# (We don't suggest using reload either, use a plugin manager)
|
||||||
# You can customise the message we kick people with if you use ProtocolLib here.
|
# You can customise the message we kick people with if you use ProtocolLib here.
|
||||||
reload-disconnect-msg: "Server reload, please rejoin!"
|
reload-disconnect-msg: "Server reload, please rejoin!"
|
||||||
|
# We warn when there's a error converting item and block data over versions, should we suppress these? (Only suggested if spamming)
|
||||||
|
suppress-conversion-warnings: false
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# BUNGEE OPTIONS #
|
# BUNGEE OPTIONS #
|
||||||
@ -110,8 +112,6 @@ chat-nbt-fix: true
|
|||||||
quick-move-action-fix: false
|
quick-move-action-fix: false
|
||||||
# Should we use prefix for team colour on 1.13 and above clients
|
# Should we use prefix for team colour on 1.13 and above clients
|
||||||
team-colour-fix: true
|
team-colour-fix: true
|
||||||
# We warn when there's a error converting from pre-1.13 to 1.13, should we suppress these? (Only suggested if spamming)
|
|
||||||
suppress-1_13-conversion-errors: false
|
|
||||||
# 1.13 introduced new auto complete which can trigger "Kicked for spamming" for servers older than 1.13, the following option will disable it completely.
|
# 1.13 introduced new auto complete which can trigger "Kicked for spamming" for servers older than 1.13, the following option will disable it completely.
|
||||||
disable-1_13-auto-complete: false
|
disable-1_13-auto-complete: false
|
||||||
# The following option will delay the tab complete request in x ticks if greater than 0, if other tab-complete is received, the previous is cancelled
|
# The following option will delay the tab complete request in x ticks if greater than 0, if other tab-complete is received, the previous is cancelled
|
||||||
|
@ -18,7 +18,6 @@ public class SpongeViaConfig extends AbstractViaConfig {
|
|||||||
public SpongeViaConfig(PluginContainer pluginContainer, File configFile) {
|
public SpongeViaConfig(PluginContainer pluginContainer, File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
this.pluginContainer = pluginContainer;
|
this.pluginContainer = pluginContainer;
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,24 +38,4 @@ public class SpongeViaConfig extends AbstractViaConfig {
|
|||||||
public List<String> getUnsupportedOptions() {
|
public List<String> getUnsupportedOptions() {
|
||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAntiXRay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_9HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_14HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,23 @@ import java.util.*;
|
|||||||
|
|
||||||
public class VelocityViaConfig extends AbstractViaConfig {
|
public class VelocityViaConfig extends AbstractViaConfig {
|
||||||
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
||||||
|
private int velocityPingInterval;
|
||||||
|
private boolean velocityPingSave;
|
||||||
|
private Map<String, Integer> velocityServerProtocols;
|
||||||
|
|
||||||
public VelocityViaConfig(File configFile) {
|
public VelocityViaConfig(File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFields() {
|
||||||
|
super.loadFields();
|
||||||
|
velocityPingInterval = getInt("velocity-ping-interval", 60);
|
||||||
|
velocityPingSave = getBoolean("velocity-ping-save", true);
|
||||||
|
velocityServerProtocols = get("velocity-servers", Map.class, new HashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return getClass().getClassLoader().getResource("assets/viaversion/config.yml");
|
return getClass().getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
@ -64,11 +74,6 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAntiXRay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemCache() {
|
public boolean isItemCache() {
|
||||||
return false;
|
return false;
|
||||||
@ -79,26 +84,6 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockConnectionMethod() {
|
|
||||||
return "packet";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_9HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_14HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the interval for checking servers via ping
|
* What is the interval for checking servers via ping
|
||||||
* -1 for disabled
|
* -1 for disabled
|
||||||
@ -106,7 +91,7 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
* @return Ping interval in seconds
|
* @return Ping interval in seconds
|
||||||
*/
|
*/
|
||||||
public int getVelocityPingInterval() {
|
public int getVelocityPingInterval() {
|
||||||
return getInt("velocity-ping-interval", 60);
|
return velocityPingInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +100,7 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
* @return True if it should save
|
* @return True if it should save
|
||||||
*/
|
*/
|
||||||
public boolean isVelocityPingSave() {
|
public boolean isVelocityPingSave() {
|
||||||
return getBoolean("velocity-ping-save", true);
|
return velocityPingSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,6 +110,6 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
* @return Map of String, Integer
|
* @return Map of String, Integer
|
||||||
*/
|
*/
|
||||||
public Map<String, Integer> getVelocityServerProtocols() {
|
public Map<String, Integer> getVelocityServerProtocols() {
|
||||||
return get("velocity-servers", Map.class, new HashMap<>());
|
return velocityServerProtocols;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren