@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/PropertyManager.java
|
||||
+++ b/net/minecraft/server/PropertyManager.java
|
||||
@@ -15,15 +15,30 @@
|
||||
--- a/net/minecraft/server/dedicated/PropertyManager.java
|
||||
+++ b/net/minecraft/server/dedicated/PropertyManager.java
|
||||
@@ -17,15 +17,30 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -29,22 +29,22 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static Properties loadPropertiesFile(java.nio.file.Path java_nio_file_path) {
|
||||
public static Properties loadPropertiesFile(Path path) {
|
||||
Properties properties = new Properties();
|
||||
|
||||
@@ -59,6 +74,11 @@
|
||||
@@ -61,6 +76,11 @@
|
||||
|
||||
public void savePropertiesFile(java.nio.file.Path java_nio_file_path) {
|
||||
public void savePropertiesFile(Path path) {
|
||||
try {
|
||||
+ // CraftBukkit start - Don't attempt writing to file if it's read only
|
||||
+ if (java_nio_file_path.toFile().exists() && !java_nio_file_path.toFile().canWrite()) {
|
||||
+ if (path.toFile().exists() && !path.toFile().canWrite()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
OutputStream outputstream = Files.newOutputStream(java_nio_file_path);
|
||||
OutputStream outputstream = Files.newOutputStream(path);
|
||||
Throwable throwable = null;
|
||||
|
||||
@@ -90,7 +110,7 @@
|
||||
@@ -92,7 +112,7 @@
|
||||
private static <V extends Number> Function<String, V> a(Function<String, V> function) {
|
||||
return (s) -> {
|
||||
try {
|
||||
@@ -53,7 +53,7 @@
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return null;
|
||||
}
|
||||
@@ -109,7 +129,7 @@
|
||||
@@ -111,7 +131,7 @@
|
||||
|
||||
@Nullable
|
||||
private String c(String s) {
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -137,7 +157,7 @@
|
||||
@@ -139,7 +159,7 @@
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
this.properties.put(s, function1.apply(v1));
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
protected <V> V a(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
|
||||
@@ -166,7 +186,7 @@
|
||||
@@ -168,7 +188,7 @@
|
||||
}
|
||||
|
||||
protected int getInt(String s, int i) {
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
protected PropertyManager<T>.EditableProperty<Integer> b(String s, int i) {
|
||||
@@ -178,7 +198,7 @@
|
||||
@@ -180,7 +200,7 @@
|
||||
}
|
||||
|
||||
protected long getLong(String s, long i) {
|
||||
@@ -89,7 +89,7 @@
|
||||
}
|
||||
|
||||
protected boolean getBoolean(String s, boolean flag) {
|
||||
@@ -201,7 +221,7 @@
|
||||
@@ -203,7 +223,7 @@
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
public class EditableProperty<V> implements Supplier<V> {
|
||||
|
||||
@@ -209,7 +229,7 @@
|
||||
@@ -211,7 +231,7 @@
|
||||
private final V c;
|
||||
private final Function<V, String> d;
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
this.b = s;
|
||||
this.c = object;
|
||||
this.d = function;
|
||||
@@ -223,7 +243,7 @@
|
||||
@@ -225,7 +245,7 @@
|
||||
Properties properties = PropertyManager.this.a();
|
||||
|
||||
properties.put(this.b, this.d.apply(v0));
|
||||
|
||||
Reference in New Issue
Block a user