Update to Minecraft 1.14-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-04-23 12:00:00 +10:00
parent 0e98365784
commit a0f2b74c8d
560 changed files with 10642 additions and 10867 deletions

View File

@@ -1,27 +1,25 @@
--- a/net/minecraft/server/PropertyManager.java
+++ b/net/minecraft/server/PropertyManager.java
@@ -8,6 +8,8 @@
@@ -15,15 +15,30 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import joptsimple.OptionSet; // CraftBukkit
+
public class PropertyManager {
public abstract class PropertyManager<T extends PropertyManager<T>> {
private static final Logger a = LogManager.getLogger();
@@ -42,6 +44,24 @@
}
public final Properties properties;
+ // CraftBukkit start
+ private OptionSet options = null;
+
+ public PropertyManager(final OptionSet options) {
+ this((File) options.valueOf("config"));
- public PropertyManager(Properties properties) {
+ public PropertyManager(Properties properties, final OptionSet options) {
this.properties = properties;
+
+ this.options = options;
+ }
+
}
+ private <T> T getOverride(String name, T value) {
+ if ((this.options != null) && (this.options.has(name))) {
+ return (T) this.options.valueOf(name);
@@ -31,63 +29,90 @@
+ }
+ // CraftBukkit end
+
public void a() {
PropertyManager.a.info("Generating new properties file");
this.savePropertiesFile();
@@ -51,6 +71,12 @@
FileOutputStream fileoutputstream = null;
public static Properties loadPropertiesFile(java.nio.file.Path java_nio_file_path) {
Properties properties = new Properties();
@@ -59,6 +74,11 @@
public void savePropertiesFile(java.nio.file.Path java_nio_file_path) {
try {
+ // CraftBukkit start - Don't attempt writing to file if it's read only
+ if (this.file.exists() && !this.file.canWrite()) {
+ if (java_nio_file_path.toFile().exists() && !java_nio_file_path.toFile().canWrite()) {
+ return;
+ }
+ // CraftBukkit end
+
fileoutputstream = new FileOutputStream(this.file);
this.properties.store(fileoutputstream, "Minecraft server properties");
} catch (Exception exception) {
@@ -80,36 +106,36 @@
this.savePropertiesFile();
}
OutputStream outputstream = Files.newOutputStream(java_nio_file_path);
Throwable throwable = null;
- return this.properties.getProperty(s, s1);
+ return getOverride(s, this.properties.getProperty(s, s1)); // CraftBukkit
@@ -90,7 +110,7 @@
private static <V extends Number> Function<String, V> a(Function<String, V> function) {
return (s) -> {
try {
- return (Number) function.apply(s);
+ return (V) function.apply(s); // CraftBukkit - decompile error
} catch (NumberFormatException numberformatexception) {
return null;
}
@@ -109,7 +129,7 @@
@Nullable
private String c(String s) {
- return (String) this.properties.get(s);
+ return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit
}
public int getInt(String s, int i) {
try {
- return Integer.parseInt(this.getString(s, "" + i));
+ return getOverride(s, Integer.parseInt(this.getString(s, "" + i))); // CraftBukkit
} catch (Exception exception) {
this.properties.setProperty(s, "" + i);
this.savePropertiesFile();
- return i;
+ return getOverride(s, i); // CraftBukkit
}
@Nullable
@@ -137,7 +157,7 @@
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
this.properties.put(s, function1.apply(v1));
- return new PropertyManager.EditableProperty<>(s, v1, function1);
+ return new PropertyManager.EditableProperty(s, v1, function1); // CraftBukkit - decompile error
}
public long getLong(String s, long i) {
try {
- return Long.parseLong(this.getString(s, "" + i));
+ return getOverride(s, Long.parseLong(this.getString(s, "" + i))); // CraftBukkit
} catch (Exception exception) {
this.properties.setProperty(s, "" + i);
this.savePropertiesFile();
- return i;
+ return getOverride(s, i); // CraftBukkit
}
protected <V> V a(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
@@ -166,7 +186,7 @@
}
public boolean getBoolean(String s, boolean flag) {
try {
- return Boolean.parseBoolean(this.getString(s, "" + flag));
+ return getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); //CraftBukkit
} catch (Exception exception) {
this.properties.setProperty(s, "" + flag);
this.savePropertiesFile();
- return flag;
+ return getOverride(s, flag); // CraftBukkit
}
protected int getInt(String s, int i) {
- return (Integer) this.a(s, a(Integer::parseInt), (Object) i);
+ return (Integer) this.a(s, a(Integer::parseInt), i); // CraftBukkit - decompile error
}
protected PropertyManager<T>.EditableProperty<Integer> b(String s, int i) {
@@ -178,7 +198,7 @@
}
protected long getLong(String s, long i) {
- return (Long) this.a(s, a(Long::parseLong), (Object) i);
+ return (Long) this.a(s, a(Long::parseLong), i); // CraftBukkit - decompile error
}
protected boolean getBoolean(String s, boolean flag) {
@@ -201,7 +221,7 @@
return properties;
}
- protected abstract T reload(Properties properties);
+ protected abstract T reload(Properties properties, OptionSet optionset); // CraftBukkit
public class EditableProperty<V> implements Supplier<V> {
@@ -209,7 +229,7 @@
private final V c;
private final Function<V, String> d;
- private EditableProperty(String s, Object object, Function function) {
+ private EditableProperty(String s, V object, Function function) { // CraftBukkit - decompile error
this.b = s;
this.c = object;
this.d = function;
@@ -223,7 +243,7 @@
Properties properties = PropertyManager.this.a();
properties.put(this.b, this.d.apply(v0));
- return PropertyManager.this.reload(properties);
+ return PropertyManager.this.reload(properties, PropertyManager.this.options); // CraftBukkit
}
}
}