Compare commits
3 Commits
1.21.4-3e7
...
1.21.4-1eb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eba4e1a05 | ||
|
|
741b00c9be | ||
|
|
b1e3a300a2 |
@@ -31,7 +31,7 @@ index 9aace993c6c18f1a50610e4766225485984b8167..419c1c7e14691a472b70ed548ecb928c
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
index f96fc1391167dea48cac1caa464b9026657df89a..5485d02c1eff4d0dcc69cf74f4ce5e485e3a95bf 100644
|
||||
index f96fc1391167dea48cac1caa464b9026657df89a..eb869e574cee0d206684d5585c664a5f1d01ab65 100644
|
||||
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
@@ -27,15 +27,43 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
@@ -87,7 +87,7 @@ index f96fc1391167dea48cac1caa464b9026657df89a..5485d02c1eff4d0dcc69cf74f4ce5e48
|
||||
- // SPIGOT-7856: End platform not dropping items after replacing blocks
|
||||
- if (dropBlocks) {
|
||||
- blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null));
|
||||
+ if (flag21) {
|
||||
+ if (flag21 && !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
|
||||
+ // Luminol start - When updated replace it with newer code
|
||||
+ if (dropBlocks) {
|
||||
+ java.util.function.Consumer<? super org.bukkit.craftbukkit.block.CraftBlockState> beforeRun = state -> level.destroyBlock(state.getPosition(), !blockList1.contains(state.getPosition()), null);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/BasicTransferLogic.java
|
||||
@@ -1,0 +_,7 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+public class BasicTransferLogic {
|
||||
+ public Object transform(Object obj) {
|
||||
+ return obj;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,8 +1,9 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
@@ -1,0 +_,226 @@
|
||||
@@ -1,0 +_,268 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import io.papermc.paper.threadedregions.RegionizedServer;
|
||||
+import me.earthme.luminol.commands.LuminolConfigCommand;
|
||||
@@ -128,6 +129,33 @@
|
||||
+ final Object currentValue = field.get(null);
|
||||
+
|
||||
+ if (!configFileInstance.contains(fullConfigKeyName)){
|
||||
+ for (RemovedConfig removedConfig : field.getAnnotationsByType(RemovedConfig.class)) {
|
||||
+ final String oldConfigKeyName = String.join(".", removedConfig.category()) + "." + removedConfig.name();
|
||||
+ Object oldValue = configFileInstance.get(oldConfigKeyName);
|
||||
+ if (oldValue != null) {
|
||||
+ boolean success = true;
|
||||
+ if (removedConfig.transfer()) {
|
||||
+ try {
|
||||
+ Object oldValueTransferred = ((BasicTransferLogic)removedConfig.transferLogic().getDeclaredConstructor().newInstance()).transform(oldValue);
|
||||
+ configFileInstance.add(fullConfigKeyName, oldValueTransferred);
|
||||
+ } catch (Exception e) {
|
||||
+ success = false;
|
||||
+ logger.error("Failed to transfer removed config {}!", removedConfig.name());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (success) {
|
||||
+ removeConfig(oldConfigKeyName, removedConfig.category());
|
||||
+ }
|
||||
+ final String comments = configInfo.comments();
|
||||
+
|
||||
+ if (!comments.isBlank()){
|
||||
+ configFileInstance.setComment(fullConfigKeyName,comments);
|
||||
+ }
|
||||
+ if (configFileInstance.get(fullConfigKeyName) != null) break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (configFileInstance.get(fullConfigKeyName) != null) continue;
|
||||
+ if (currentValue == null){
|
||||
+ throw new UnsupportedOperationException("Config " + singleConfigModule.getBaseName() + "tried to add an null default value!");
|
||||
+ }
|
||||
@@ -148,6 +176,20 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void removeConfig(String name,String[] keys) {
|
||||
+ configFileInstance.remove(name);
|
||||
+ if (configFileInstance.get(String.join(".", keys)) instanceof UnmodifiableConfig) {
|
||||
+ removeConfig(keys);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void removeConfig(String[] keys) {
|
||||
+ configFileInstance.remove(String.join(".", keys));
|
||||
+ if (configFileInstance.get(String.join(".", Arrays.copyOfRange(keys, 1, keys.length))) instanceof UnmodifiableConfig) {
|
||||
+ removeConfig(Arrays.copyOfRange(keys, 1, keys.length));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull Set<Class<?>> getClasses(String pack) {
|
||||
+ Set<Class<?>> classes = new LinkedHashSet<>();
|
||||
+ String packageDirName = pack.replace('.', '/');
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/RemovedConfig.java
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import java.lang.annotation.*;
|
||||
+
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Repeatable(RemovedConfig.List.class)
|
||||
+public @interface RemovedConfig {
|
||||
+ String name() default "";
|
||||
+
|
||||
+ String[] category() default "";
|
||||
+
|
||||
+ boolean transfer() default true;
|
||||
+
|
||||
+ Class<?> transferLogic() default BasicTransferLogic.class;
|
||||
+
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ @interface List {
|
||||
+ RemovedConfig[] value();
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user