Make GameRule a FeatureDependant (#12429)

This commit is contained in:
DerEchtePilz
2025-04-14 13:21:14 +02:00
committed by GitHub
parent 91bfb6fb7e
commit 121a7bf4eb
4 changed files with 25 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package org.bukkit;
import com.google.common.base.Preconditions;
import io.papermc.paper.world.flag.FeatureDependant;
import java.util.HashMap;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
@@ -15,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
*
* @param <T> type of rule (Boolean or Integer)
*/
public final class GameRule<T> implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
public final class GameRule<T> implements net.kyori.adventure.translation.Translatable, FeatureDependant {
private static Map<String, GameRule<?>> gameRules = new HashMap<>();
// Boolean rules
@@ -377,10 +378,9 @@ public final class GameRule<T> implements net.kyori.adventure.translation.Transl
return gameRules.values().toArray(new GameRule<?>[gameRules.size()]);
}
// Paper start
@Override
public @NotNull String translationKey() {
return "gamerule." + this.name;
}
// Paper end
}