Config file

This commit is contained in:
creeper123123321 2018-08-21 15:14:42 -03:00
parent dc7c4d34fa
commit 157ec02661
3 changed files with 85 additions and 46 deletions

View File

@ -2,8 +2,7 @@ buildscript {
repositories { repositories {
jcenter() jcenter()
maven { url 'https://www.dimdev.org/maven/' } maven { url 'https://www.dimdev.org/maven/' }
maven { url 'https://www.dimdev.org/maven/' } maven { url 'https://repo.spongepowered.org/maven/' }
maven { url = 'https://repo.spongepowered.org/maven/' }
} }
dependencies { dependencies {
classpath 'org.dimdev:ForgeGradle:2.3-SNAPSHOT' classpath 'org.dimdev:ForgeGradle:2.3-SNAPSHOT'
@ -25,9 +24,10 @@ targetCompatibility = 1.8
repositories { repositories {
mavenCentral() mavenCentral()
maven { url 'https://libraries.minecraft.net/' } maven { url 'https://libraries.minecraft.net/' }
maven {url 'https://oss.sonatype.org/content/repositories/snapshots'} maven { url 'https://repo.viaversion.com/'}
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://www.dimdev.org/maven/' } maven { url 'https://www.dimdev.org/maven/' }
maven { url = 'https://repo.viaversion.com/'} maven { url 'https://jitpack.io' }
} }
configurations { configurations {
@ -36,7 +36,11 @@ configurations {
} }
dependencies { dependencies {
shade ('us.myles:viaversion:1.4.2-SNAPSHOT') { transitive = false } shade ('us.myles:viaversion:1.4.2-SNAPSHOT') {
transitive = false
changing = true
}
shade 'org.yaml:snakeyaml:1.18'
implementation 'org.dimdev:mixin:0.7.11-SNAPSHOT' implementation 'org.dimdev:mixin:0.7.11-SNAPSHOT'
compile 'org.dimdev.rift:Rift:1.0.1:dev' compile 'org.dimdev.rift:Rift:1.0.1:dev'
} }

View File

@ -14,11 +14,14 @@ import us.myles.ViaVersion.api.platform.ViaPlatform;
import us.myles.ViaVersion.sponge.VersionInfo; import us.myles.ViaVersion.sponge.VersionInfo;
import us.myles.viaversion.libs.gson.JsonObject; import us.myles.viaversion.libs.gson.JsonObject;
import java.io.File;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger; import java.util.logging.Logger;
public class VRPlatform implements ViaPlatform { public class VRPlatform implements ViaPlatform {
private VRViaConfig config = new VRViaConfig(new File("config/ViaRift/config.yml"));
@Override @Override
public Logger getLogger() { public Logger getLogger() {
return ViaRift.JLOGGER; return ViaRift.JLOGGER;
@ -99,12 +102,12 @@ public class VRPlatform implements ViaPlatform {
@Override @Override
public ViaVersionConfig getConf() { public ViaVersionConfig getConf() {
return new VRViaConfig(); return config;
} }
@Override @Override
public ConfigurationProvider getConfigurationProvider() { public ConfigurationProvider getConfigurationProvider() {
throw new UnsupportedOperationException(); return config;
} }
@Override @Override

View File

@ -1,59 +1,86 @@
package com.github.creeper123123321.viarift.platform; package com.github.creeper123123321.viarift.platform;
import us.myles.ViaVersion.api.ViaVersionConfig; import us.myles.ViaVersion.api.ViaVersionConfig;
import us.myles.ViaVersion.util.Config;
import java.util.ArrayList; import java.io.File;
import java.net.URL;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
public class VRViaConfig extends Config implements ViaVersionConfig {
// Based on Sponge ViaVersion
private static List<String> UNSUPPORTED = Arrays.asList("anti-xray-patch", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "quick-move-action-fix", "nms-player-ticking", "item-cache");
public VRViaConfig(File configFile) {
super(new File(configFile, "config.yml"));
// Load config
reloadConfig();
}
public class VRViaConfig implements ViaVersionConfig {
@Override @Override
public URL getDefaultConfigURL() {
return getClass().getClassLoader().getResource("assets/viaversion/config.yml");
}
@Override
protected void handleConfig(Map<String, Object> config) {
// Nothing Currently
}
@Override
public List<String> getUnsupportedOptions() {
return UNSUPPORTED;
}
public boolean isCheckForUpdates() { public boolean isCheckForUpdates() {
return false; return getBoolean("checkforupdates", true);
} }
@Override @Override
public boolean isPreventCollision() { public boolean isPreventCollision() {
return true; return getBoolean("prevent-collision", true);
} }
@Override @Override
public boolean isNewEffectIndicator() { public boolean isNewEffectIndicator() {
return true; return getBoolean("use-new-effect-indicator", true);
} }
@Override @Override
public boolean isShowNewDeathMessages() { public boolean isShowNewDeathMessages() {
return false; return getBoolean("use-new-deathmessages", true);
} }
@Override @Override
public boolean isSuppressMetadataErrors() { public boolean isSuppressMetadataErrors() {
return false; return getBoolean("suppress-metadata-errors", false);
} }
@Override @Override
public boolean isShieldBlocking() { public boolean isShieldBlocking() {
return true; return getBoolean("shield-blocking", true);
} }
@Override @Override
public boolean isHologramPatch() { public boolean isHologramPatch() {
return true; return getBoolean("hologram-patch", false);
} }
@Override @Override
public boolean isPistonAnimationPatch() { public boolean isPistonAnimationPatch() {
return false; return getBoolean("piston-animation-patch", false);
} }
@Override @Override
public boolean isBossbarPatch() { public boolean isBossbarPatch() {
return true; return getBoolean("bossbar-patch", true);
} }
@Override @Override
public boolean isBossbarAntiflicker() { public boolean isBossbarAntiflicker() {
return false; return getBoolean("bossbar-anti-flicker", false);
} }
@Override @Override
@ -63,12 +90,7 @@ public class VRViaConfig implements ViaVersionConfig {
@Override @Override
public double getHologramYOffset() { public double getHologramYOffset() {
return -0.96; return getDouble("hologram-y", -0.96D);
}
@Override
public boolean isAutoTeam() {
return false;
} }
@Override @Override
@ -78,32 +100,32 @@ public class VRViaConfig implements ViaVersionConfig {
@Override @Override
public int getMaxPPS() { public int getMaxPPS() {
return -1; return getInt("max-pps", 800);
} }
@Override @Override
public String getMaxPPSKickMessage() { public String getMaxPPSKickMessage() {
return null; return getString("max-pps-kick-msg", "Sending packets too fast? lag?");
} }
@Override @Override
public int getTrackingPeriod() { public int getTrackingPeriod() {
return -1; return getInt("tracking-period", 6);
} }
@Override @Override
public int getWarningPPS() { public int getWarningPPS() {
return -1; return getInt("tracking-warning-pps", 120);
} }
@Override @Override
public int getMaxWarnings() { public int getMaxWarnings() {
return -1; return getInt("tracking-max-warnings", 3);
} }
@Override @Override
public String getMaxWarningsKickMessage() { public String getMaxWarningsKickMessage() {
return ""; return getString("tracking-max-kick-msg", "You are sending too many packets, :(");
} }
@Override @Override
@ -113,12 +135,12 @@ public class VRViaConfig implements ViaVersionConfig {
@Override @Override
public boolean isSendSupportedVersions() { public boolean isSendSupportedVersions() {
return false; return getBoolean("send-supported-versions", false);
} }
@Override @Override
public boolean isStimulatePlayerTick() { public boolean isStimulatePlayerTick() {
return true; return getBoolean("simulate-pt", true);
} }
@Override @Override
@ -133,27 +155,27 @@ public class VRViaConfig implements ViaVersionConfig {
@Override @Override
public boolean isReplacePistons() { public boolean isReplacePistons() {
return false; return getBoolean("replace-pistons", false);
} }
@Override @Override
public int getPistonReplacementId() { public int getPistonReplacementId() {
return -1; return getInt("replacement-piston-id", 0);
}
public boolean isAutoTeam() {
// Collision has to be enabled first
return isPreventCollision() && getBoolean("auto-team", true);
} }
@Override @Override
public boolean isForceJsonTransform() { public boolean isForceJsonTransform() {
return false; return getBoolean("force-json-transform", false);
} }
@Override @Override
public boolean is1_12NBTArrayFix() { public boolean is1_12NBTArrayFix() {
return true; return getBoolean("chat-nbt-fix", true);
}
@Override
public boolean is1_13TeamColourFix() {
return false;
} }
@Override @Override
@ -163,16 +185,26 @@ public class VRViaConfig implements ViaVersionConfig {
@Override @Override
public List<Integer> getBlockedProtocols() { public List<Integer> getBlockedProtocols() {
return new ArrayList<>(); return getIntegerList("block-protocols");
} }
@Override @Override
public String getBlockedDisconnectMsg() { public String getBlockedDisconnectMsg() {
return ""; return getString("block-disconnect-msg", "You are using an unsupported Minecraft version!");
} }
@Override @Override
public String getReloadDisconnectMsg() { public String getReloadDisconnectMsg() {
return ""; return getString("reload-disconnect-msg", "Server reload, please rejoin!");
}
@Override
public boolean is1_13TeamColourFix() {
return getBoolean("team-colour-fix", true);
}
//@Override
public boolean isSuppress1_13ConversionErrors() {
return getBoolean("suppress-1_13-conversion-errors", false);
} }
} }