From d90e3085ffaa34b38fcf75de48594ca009b8ce24 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 17 Aug 2023 09:37:27 +0100 Subject: [PATCH 1/9] feat: note prevented fake player access to chunks Only logging for now, can use this data in future to show players which fake players may need to be permitted. --- .../mods/ftbchunks/FTBChunksWorldConfig.java | 1 + .../ftbchunks/data/ChunkTeamDataImpl.java | 49 +++++++++++++++++++ .../mods/ftbchunks/data/ClaimedChunkImpl.java | 1 + .../data/ClaimedChunkManagerImpl.java | 6 ++- 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java b/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java index e1857d4d..c376c43c 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java @@ -36,6 +36,7 @@ public interface FTBChunksWorldConfig { EnumValue PARTY_LIMIT_MODE = CONFIG.addEnum("party_limit_mode", PartyLimitMode.NAME_MAP).comment("Method by which party claim & force-load limits are calculated.","LARGEST: use the limits of the member with the largest limits","SUM: add up all the members' limits","OWNER: use the party owner's limits only","AVERAGE: use the average of all members' limits."); BooleanValue REQUIRE_GAME_STAGE = CONFIG.addBoolean("require_game_stage", false).comment("If true, the player must have the 'ftbchunks_mapping' Game stage to be able to use the map and minimap.\nRequires KubeJS and/or Gamestages to be installed."); BooleanValue LOCATION_MODE_OVERRIDE = CONFIG.addBoolean("location_mode_override", false).comment("If true, \"Location Visibility\" team settings are ignored, and all players can see each other anywhere on the map."); + IntValue MAX_PREVENTED_LOG_AGE = CONFIG.addInt("max_prevented_log_age", 7, 1, Integer.MAX_VALUE).comment("Maximum time in days to keep logs of prevented fakeplayer access to a team's claims."); static int getMaxClaimedChunks(ChunkTeamDataImpl playerData, ServerPlayer player) { if (player != null) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java index 867fe433..84ac57ed 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java @@ -1,5 +1,7 @@ package dev.ftb.mods.ftbchunks.data; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import dev.architectury.hooks.level.entity.PlayerHooks; import dev.ftb.mods.ftbchunks.FTBChunks; import dev.ftb.mods.ftbchunks.FTBChunksExpected; @@ -27,6 +29,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; @@ -64,6 +67,8 @@ public class ChunkTeamDataImpl implements ChunkTeamData { private Collection claimedChunkCache; private Collection forcedChunkCache; + private final Map preventedAccess = new HashMap<>(); + public ChunkTeamDataImpl(ClaimedChunkManagerImpl manager, Path file, Team team) { this.manager = manager; this.file = file; @@ -354,6 +359,12 @@ public SNBTCompoundTag serializeNBT() { tag.put("member_data", memberTag); } + if (!preventedAccess.isEmpty()) { + SNBTCompoundTag p = new SNBTCompoundTag(); + preventedAccess.forEach((id, element) -> p.put(id.toString(), PreventedAccess.CODEC.encodeStart(NbtOps.INSTANCE, element).result().orElseThrow())); + tag.put("prevented_access", p); + } + return tag; } @@ -391,6 +402,15 @@ public void deserializeNBT(CompoundTag tag) { e.printStackTrace(); } } + + preventedAccess.clear(); + if (tag.contains("prevented_access")) { + CompoundTag p = tag.getCompound("prevented_access"); + for (String key : p.getAllKeys()) { + preventedAccess.put(UUID.fromString(key), PreventedAccess.CODEC.parse(NbtOps.INSTANCE, p.getCompound(key)).result().orElseThrow()); + } + prunePreventedLog(); + } } @Override @@ -680,4 +700,33 @@ public void clearClaimCaches() { claimedChunkCache = null; forcedChunkCache = null; } + + + public void logPreventedAccess(ServerPlayer player, long when) { + preventedAccess.put(player.getUUID(), new PreventedAccess(player.getGameProfile().getName(), when)); + markDirty(); + } + + private void prunePreventedLog() { + Set toRemove = new HashSet<>(); + long now = System.currentTimeMillis(); + long max = FTBChunksWorldConfig.MAX_PREVENTED_LOG_AGE.get() * 86400L * 1000L; + preventedAccess.forEach((id, el) -> { + if (now - el.when() > max) { + toRemove.add(id); + } + }); + if (!toRemove.isEmpty()) { + toRemove.forEach(preventedAccess::remove); + markDirty(); + } + } + + private record PreventedAccess(String name, long when) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.STRING.fieldOf("name").forGetter(PreventedAccess::name), + Codec.LONG.fieldOf("when").forGetter(PreventedAccess::when) + ).apply(instance, PreventedAccess::new) + ); + } } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java index b2e098b8..3b1ed40e 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java @@ -199,4 +199,5 @@ public static ClaimedChunkImpl deserializeNBT(ChunkTeamDataImpl data, ResourceKe chunk.forceLoadExpiryTime = tag.getLong("expiry_time"); return chunk; } + } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java index 0c297478..1f8dd926 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java @@ -210,9 +210,13 @@ public boolean shouldPreventInteraction(@Nullable Entity actor, InteractionHand ClaimedChunkImpl chunk = getChunk(new ChunkDimPos(player.level(), pos)); if (chunk != null) { ProtectionPolicy policy = protection.getProtectionPolicy(player, pos, hand, chunk, targetEntity); - return policy.isOverride() ? + boolean prevented = policy.isOverride() ? policy.shouldPreventInteraction() : !player.isSpectator() && (isFake || !getBypassProtection(player.getUUID())); + if (prevented && isFake) { + chunk.getTeamData().logPreventedAccess(player, System.currentTimeMillis()); + } + return prevented; } else if (FTBChunksWorldConfig.noWilderness(player)) { ProtectionPolicy override = protection.getProtectionPolicy(player, pos, hand, null, targetEntity); if (override.isOverride()) { From c92f3d5554db4c3dd8f43f057f5505485f0e8e91 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 17 Aug 2023 10:58:55 +0100 Subject: [PATCH 2/9] chore: remove all cross-mod compat code Moving it all into FTB XMod Compat --- build.gradle | 7 - common/build.gradle | 5 - .../dev/ftb/mods/ftbchunks/FTBChunks.java | 10 +- .../mods/ftbchunks/FTBChunksWorldConfig.java | 21 +-- .../ftbchunks/client/FTBChunksClient.java | 6 - .../integration/PermissionsHelper.java | 33 ++-- .../integration/PermissionsProvider.java | 21 --- .../ftbranks/FTBRanksIntegration.java | 91 ----------- .../integration/kubejs/AfterEventJS.java | 36 ----- .../integration/kubejs/BeforeEventJS.java | 28 ---- .../kubejs/FTBChunksKubeJSPlugin.java | 44 ----- .../luckperms/LuckPermsIntegration.java | 53 ------ .../stages/EntityTagStageHelper.java | 25 --- .../stages/GameStagesStageHelper.java | 47 ------ .../integration/stages/KubeJSStageHelper.java | 27 ---- .../integration/stages/StageHelper.java | 29 ---- .../integration/waystones/WaystoneData.java | 7 - .../waystones/WaystoneMapIcon.java | 40 ----- .../waystones/WaystonesIntegration.java | 30 ---- .../mods/ftbchunks/util/DimensionFilter.java | 13 ++ fabric/build.gradle | 47 ++---- .../FTBChunksProtectionProvider.java | 153 ------------------ .../compat/waystones/WaystonesCompat.java | 20 --- .../ftbchunks/fabric/FTBChunksFabric.java | 11 -- .../fabric/GameStagesStageHelperImpl.java | 23 --- forge/build.gradle | 32 +--- .../compat/waystones/WaystonesCompat.java | 20 --- .../mods/ftbchunks/forge/FTBChunksForge.java | 6 - .../forge/GameStagesStageHelperImpl.java | 23 --- forge/src/main/resources/META-INF/mods.toml | 21 --- gradle.properties | 18 +-- 31 files changed, 61 insertions(+), 886 deletions(-) delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsProvider.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/ftbranks/FTBRanksIntegration.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/AfterEventJS.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/BeforeEventJS.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/FTBChunksKubeJSPlugin.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/luckperms/LuckPermsIntegration.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/EntityTagStageHelper.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/GameStagesStageHelper.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/KubeJSStageHelper.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/StageHelper.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneData.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneMapIcon.java delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystonesIntegration.java delete mode 100644 fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/commonprot/FTBChunksProtectionProvider.java delete mode 100644 fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java delete mode 100644 fabric/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/fabric/GameStagesStageHelperImpl.java delete mode 100644 forge/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java delete mode 100644 forge/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/forge/GameStagesStageHelperImpl.java diff --git a/build.gradle b/build.gradle index 71eeb4d9..16c554a2 100644 --- a/build.gradle +++ b/build.gradle @@ -45,13 +45,6 @@ allprojects { url "https://maven.architectury.dev/" } - maven { - url "https://www.cursemaven.com" - content { - includeGroup "curse.maven" - } - } - maven { url "https://maven.saps.dev/releases" content { diff --git a/common/build.gradle b/common/build.gradle index 42b31a7c..9425a549 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -4,11 +4,6 @@ dependencies { modImplementation("dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams:${rootProject.ftb_teams_version}") { transitive = false } - modImplementation("dev.ftb.mods:ftb-ranks:${rootProject.ftb_ranks_version}") { transitive = false } - modImplementation("dev.latvian.mods:rhino:${rootProject.rhino_version}") { transitive = false } - modImplementation("dev.latvian.mods:kubejs:${rootProject.kubejs_version}") { transitive = false } - - compileOnly 'net.luckperms:api:5.4' } def ENV = System.getenv() diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunks.java b/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunks.java index e191ff6b..ac155956 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunks.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunks.java @@ -6,7 +6,6 @@ import dev.architectury.event.EventResult; import dev.architectury.event.events.common.*; import dev.architectury.hooks.level.entity.PlayerHooks; -import dev.architectury.platform.Platform; import dev.architectury.registry.registries.Registrar; import dev.architectury.registry.registries.RegistrarManager; import dev.architectury.utils.Env; @@ -20,9 +19,8 @@ import dev.ftb.mods.ftbchunks.data.ClaimExpirationManager; import dev.ftb.mods.ftbchunks.data.ClaimedChunkImpl; import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl; -import dev.ftb.mods.ftbchunks.integration.ftbranks.FTBRanksIntegration; -import dev.ftb.mods.ftbchunks.integration.stages.StageHelper; import dev.ftb.mods.ftbchunks.net.*; +import dev.ftb.mods.ftblibrary.integration.stages.StageHelper; import dev.ftb.mods.ftblibrary.math.ChunkDimPos; import dev.ftb.mods.ftblibrary.math.MathUtils; import dev.ftb.mods.ftblibrary.math.XZ; @@ -132,10 +130,6 @@ public FTBChunks() { TickEvent.SERVER_POST.register(this::serverTickPost); TickEvent.PLAYER_POST.register(this::playerTickPost); - if (Platform.isModLoaded("ftbranks")) { - FTBRanksIntegration.registerEvents(); - } - EnvExecutor.runInEnv(Env.CLIENT, () -> FTBChunksClient.INSTANCE::init); } @@ -399,7 +393,7 @@ private void playerCloned(ServerPlayer oldPlayer, ServerPlayer newPlayer, boolea private void playerChangedDimension(ServerPlayer serverPlayer, ResourceKey oldLevel, ResourceKey newLevel) { LongRangePlayerTracker.INSTANCE.stopTracking(serverPlayer); - StageHelper.INSTANCE.get().sync(serverPlayer); + StageHelper.INSTANCE.getProvider().sync(serverPlayer); } private void teamConfig(TeamCollectPropertiesEvent event) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java b/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java index c376c43c..06cf5899 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java @@ -1,13 +1,14 @@ package dev.ftb.mods.ftbchunks; +import dev.ftb.mods.ftbchunks.api.ChunkTeamData; import dev.ftb.mods.ftbchunks.api.ProtectionPolicy; import dev.ftb.mods.ftbchunks.data.AllyMode; -import dev.ftb.mods.ftbchunks.data.ChunkTeamDataImpl; import dev.ftb.mods.ftbchunks.data.ForceLoadMode; import dev.ftb.mods.ftbchunks.data.PartyLimitMode; import dev.ftb.mods.ftbchunks.integration.PermissionsHelper; -import dev.ftb.mods.ftbchunks.integration.stages.StageHelper; +import dev.ftb.mods.ftbchunks.util.DimensionFilter; import dev.ftb.mods.ftblibrary.config.NameMap; +import dev.ftb.mods.ftblibrary.integration.stages.StageHelper; import dev.ftb.mods.ftblibrary.snbt.config.*; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; @@ -26,6 +27,7 @@ public interface FTBChunksWorldConfig { StringListValue CLAIM_DIMENSION_BLACKLIST = CONFIG.addStringList("claim_dimension_blacklist", Collections.emptyList()).comment("Dimension ID's where chunks may not be claimed. Add \"minecraft:the_end\" to this list if you want to disable chunk claiming in The End, or \"othermod:*\" to disable chunk claiming in *all* dimensions added by \"othermod\""); StringListValue CLAIM_DIMENSION_WHITELIST = CONFIG.addStringList("claim_dimension_whitelist", Collections.emptyList()).comment("Dimension ID's where chunks may be claimed. If non-empty, chunks may be claimed *only* in these dimensions (and the dimension is not in \"claim_dimension_blacklist\"). Same syntax as for \"claim_dimension_blacklist\"."); BooleanValue NO_WILDERNESS = CONFIG.addBoolean("no_wilderness", false).comment("Requires you to claim chunks in order to edit and interact with blocks"); + StringListValue NO_WILDERNESS_DIMENSIONS = CONFIG.addStringList("no_wilderness_dimensions", Collections.emptyList()).comment("Dimension ID's where the no_wilderness rule is enforced - building is only allowed in claimed chunks. If this is non-empty, it overrides the 'no_wilderness' setting."); BooleanValue FORCE_DISABLE_MINIMAP = CONFIG.addBoolean("force_disable_minimap", false).comment("Minimap for clients connecting to this server will be disabled"); DoubleValue MAX_IDLE_DAYS_BEFORE_UNCLAIM = CONFIG.addDouble("max_idle_days_before_unclaim", 0D, 0D, 3650D).comment("Maximum time (in real-world days) where if no player in a team logs in, the team automatically loses their claims.", "Prevents chunks being claimed indefinitely by teams who no longer play.","Default of 0 means no automatic loss of claims."); DoubleValue MAX_IDLE_DAYS_BEFORE_UNFORCE = CONFIG.addDouble("max_idle_days_before_unforce", 0D, 0D, 3650D).comment("Maximum time (in real-world days) where if no player in a team logs in, any forceloaded chunks owned by the team are no longer forceloaded.", "Prevents chunks being forceloaded indefinitely by teams who no longer play.","Default of 0 means no automatic loss of forceloading."); @@ -38,17 +40,17 @@ public interface FTBChunksWorldConfig { BooleanValue LOCATION_MODE_OVERRIDE = CONFIG.addBoolean("location_mode_override", false).comment("If true, \"Location Visibility\" team settings are ignored, and all players can see each other anywhere on the map."); IntValue MAX_PREVENTED_LOG_AGE = CONFIG.addInt("max_prevented_log_age", 7, 1, Integer.MAX_VALUE).comment("Maximum time in days to keep logs of prevented fakeplayer access to a team's claims."); - static int getMaxClaimedChunks(ChunkTeamDataImpl playerData, ServerPlayer player) { + static int getMaxClaimedChunks(ChunkTeamData playerData, ServerPlayer player) { if (player != null) { - return PermissionsHelper.getInstance().getMaxClaimedChunks(player, MAX_CLAIMED_CHUNKS.get()) + playerData.getExtraClaimChunks(); + return PermissionsHelper.getMaxClaimedChunks(player, MAX_CLAIMED_CHUNKS.get()) + playerData.getExtraClaimChunks(); } return MAX_CLAIMED_CHUNKS.get() + playerData.getExtraClaimChunks(); } - static int getMaxForceLoadedChunks(ChunkTeamDataImpl playerData, ServerPlayer player) { + static int getMaxForceLoadedChunks(ChunkTeamData playerData, ServerPlayer player) { if (player != null) { - return PermissionsHelper.getInstance().getMaxForceLoadedChunks(player, MAX_FORCE_LOADED_CHUNKS.get()) + playerData.getExtraForceLoadChunks(); + return PermissionsHelper.getMaxForceLoadedChunks(player, MAX_FORCE_LOADED_CHUNKS.get()) + playerData.getExtraForceLoadChunks(); } return MAX_FORCE_LOADED_CHUNKS.get() + playerData.getExtraForceLoadChunks(); @@ -56,19 +58,20 @@ static int getMaxForceLoadedChunks(ChunkTeamDataImpl playerData, ServerPlayer pl static boolean canPlayerOfflineForceload(ServerPlayer player) { // note: purely checking the player's own permission here; not interested in server defaults or party data - return player != null && PermissionsHelper.getInstance().getChunkLoadOffline(player, false); + return player != null && PermissionsHelper.getChunkLoadOffline(player, false); } static boolean noWilderness(ServerPlayer player) { if (player != null) { - return PermissionsHelper.getInstance().getNoWilderness(player, NO_WILDERNESS.get()); + return DimensionFilter.isNoWildernessDimension(player.level().dimension()) + || PermissionsHelper.getNoWilderness(player, NO_WILDERNESS.get()); } return NO_WILDERNESS.get(); } static boolean playerHasMapStage(Player player) { - return !REQUIRE_GAME_STAGE.get() || StageHelper.INSTANCE.get().has(player, "ftbchunks_mapping"); + return !REQUIRE_GAME_STAGE.get() || StageHelper.getInstance().getProvider().has(player, "ftbchunks_mapping"); } static boolean shouldShowMinimap(Player player) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index c1d77035..66a562d2 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -12,7 +12,6 @@ import dev.architectury.event.events.client.*; import dev.architectury.hooks.client.screen.ScreenAccess; import dev.architectury.injectables.annotations.ExpectPlatform; -import dev.architectury.platform.Platform; import dev.architectury.registry.ReloadListenerRegistry; import dev.architectury.registry.client.keymappings.KeyMappingRegistry; import dev.ftb.mods.ftbchunks.ColorMapLoader; @@ -30,7 +29,6 @@ import dev.ftb.mods.ftbchunks.client.map.*; import dev.ftb.mods.ftbchunks.client.map.color.ColorUtils; import dev.ftb.mods.ftbchunks.client.mapicon.*; -import dev.ftb.mods.ftbchunks.integration.waystones.WaystonesIntegration; import dev.ftb.mods.ftbchunks.net.PartialPackets; import dev.ftb.mods.ftbchunks.net.SendGeneralDataPacket.GeneralChunkData; import dev.ftb.mods.ftblibrary.config.StringConfig; @@ -172,10 +170,6 @@ public void init() { // RefreshMinimapIconsEvent.EVENT.register(this::refreshMinimapIcons); ClientReloadShadersEvent.EVENT.register(this::reloadShaders); registerPlatform(); - - if (Platform.isModLoaded("waystones")) { - WaystonesIntegration.initClient(); - } } private void registerKeys() { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsHelper.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsHelper.java index e9f8f083..51dbeb1e 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsHelper.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsHelper.java @@ -1,11 +1,7 @@ package dev.ftb.mods.ftbchunks.integration; -import com.google.common.base.Suppliers; -import dev.architectury.platform.Platform; -import dev.ftb.mods.ftbchunks.integration.ftbranks.FTBRanksIntegration; -import dev.ftb.mods.ftbchunks.integration.luckperms.LuckPermsIntegration; - -import java.util.function.Supplier; +import dev.ftb.mods.ftblibrary.integration.permissions.PermissionHelper; +import net.minecraft.server.level.ServerPlayer; public class PermissionsHelper { public static final String MAX_CLAIMED_PERM = "ftbchunks.max_claimed"; @@ -13,18 +9,19 @@ public class PermissionsHelper { public static final String CHUNK_LOAD_OFFLINE_PERM = "ftbchunks.chunk_load_offline"; public static final String NO_WILDERNESS_PERM = "ftbchunks.no_wilderness"; - private static final Supplier INSTANCE = Suppliers.memoize(() -> { - if (Platform.isModLoaded("ftbranks")) { - return new FTBRanksIntegration(); - } else if (Platform.isModLoaded("luckperms")) { - return new LuckPermsIntegration(); - } else { - return new PermissionsProvider() { }; - } - } - ); + public static int getMaxClaimedChunks(ServerPlayer player, int def) { + return PermissionHelper.INSTANCE.getProvider().getIntegerPermission(player, MAX_CLAIMED_PERM, def); + } + + public static int getMaxForceLoadedChunks(ServerPlayer player, int def) { + return PermissionHelper.INSTANCE.getProvider().getIntegerPermission(player, MAX_FORCE_LOADED_PERM, def); + } + + public static boolean getChunkLoadOffline(ServerPlayer player, boolean def) { + return PermissionHelper.INSTANCE.getProvider().getBooleanPermission(player, CHUNK_LOAD_OFFLINE_PERM, def); + } - public static PermissionsProvider getInstance() { - return INSTANCE.get(); + public static boolean getNoWilderness(ServerPlayer player, boolean def) { + return PermissionHelper.INSTANCE.getProvider().getBooleanPermission(player, NO_WILDERNESS_PERM, def); } } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsProvider.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsProvider.java deleted file mode 100644 index 4d7cf906..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/PermissionsProvider.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration; - -import net.minecraft.server.level.ServerPlayer; - -public interface PermissionsProvider { - default int getMaxClaimedChunks(ServerPlayer player, int def) { - return def; - } - - default int getMaxForceLoadedChunks(ServerPlayer player, int def) { - return def; - } - - default boolean getChunkLoadOffline(ServerPlayer player, boolean def) { - return def; - } - - default boolean getNoWilderness(ServerPlayer player, boolean def) { - return def; - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/ftbranks/FTBRanksIntegration.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/ftbranks/FTBRanksIntegration.java deleted file mode 100644 index 256d9514..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/ftbranks/FTBRanksIntegration.java +++ /dev/null @@ -1,91 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.ftbranks; - -import com.mojang.authlib.GameProfile; -import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; -import dev.ftb.mods.ftbchunks.data.ChunkTeamDataImpl; -import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl; -import dev.ftb.mods.ftbchunks.integration.PermissionsHelper; -import dev.ftb.mods.ftbchunks.integration.PermissionsProvider; -import dev.ftb.mods.ftbranks.api.FTBRanksAPI; -import dev.ftb.mods.ftbranks.api.RankManager; -import dev.ftb.mods.ftbranks.api.event.*; -import dev.ftb.mods.ftbteams.api.FTBTeamsAPI; -import net.minecraft.server.level.ServerPlayer; - -import static dev.ftb.mods.ftbchunks.integration.PermissionsHelper.*; - -public class FTBRanksIntegration implements PermissionsProvider { - @Override - public int getMaxClaimedChunks(ServerPlayer player, int def) { - return Math.max(FTBRanksAPI.getPermissionValue(player, MAX_CLAIMED_PERM).asInteger().orElse(def), 0); - } - - @Override - public int getMaxForceLoadedChunks(ServerPlayer player, int def) { - return Math.max(FTBRanksAPI.getPermissionValue(player, MAX_FORCE_LOADED_PERM).asInteger().orElse(def), 0); - } - - @Override - public boolean getChunkLoadOffline(ServerPlayer player, boolean def) { - return FTBRanksAPI.getPermissionValue(player, CHUNK_LOAD_OFFLINE_PERM).asBoolean().orElse(def); - } - - @Override - public boolean getNoWilderness(ServerPlayer player, boolean def) { - return FTBRanksAPI.getPermissionValue(player, NO_WILDERNESS_PERM).asBoolean().orElse(def); - } - - public static void registerEvents() { - RankEvent.ADD_PLAYER.register(FTBRanksIntegration::playerAdded); - RankEvent.REMOVE_PLAYER.register(FTBRanksIntegration::playerRemoved); - RankEvent.PERMISSION_CHANGED.register(FTBRanksIntegration::permissionSet); - RankEvent.RELOADED.register(FTBRanksIntegration::ranksReloaded); - RankEvent.CONDITION_CHANGED.register(FTBRanksIntegration::conditionChanged); - } - - // ---------------------- event listeners below here ------------------ - - private static void playerAdded(PlayerAddedToRankEvent event) { - updateForPlayer(event.getManager(), event.getPlayer()); - } - - private static void playerRemoved(PlayerRemovedFromRankEvent event) { - updateForPlayer(event.getManager(), event.getPlayer()); - } - - private static void permissionSet(PermissionNodeChangedEvent event) { - String node = event.getNode(); - if (node.equals(MAX_CLAIMED_PERM) || node.equals(MAX_FORCE_LOADED_PERM) || node.equals(CHUNK_LOAD_OFFLINE_PERM)) { - updateAll(event.getManager()); - } - } - - private static void ranksReloaded(RanksReloadedEvent event) { - updateAll(event.getManager()); - } - - private static void conditionChanged(ConditionChangedEvent event) { - updateAll(event.getManager()); - } - - private static void updateAll(RankManager manager) { - if (FTBChunksAPI.api().isManagerLoaded()) { - manager.getServer().getPlayerList().getPlayers().forEach(player -> { - ChunkTeamDataImpl data = ClaimedChunkManagerImpl.getInstance().getOrCreateData(player); - data.setForceLoadMember(player.getUUID(), PermissionsHelper.getInstance().getChunkLoadOffline(player, false)); - }); - FTBTeamsAPI.api().getManager().getTeams().forEach(team -> ClaimedChunkManagerImpl.getInstance().getOrCreateData(team).updateLimits()); - } - } - - private static void updateForPlayer(RankManager manager, GameProfile profile) { - FTBTeamsAPI.api().getManager().getTeamForPlayerID(profile.getId()).ifPresent(team -> { - ChunkTeamDataImpl teamData = ClaimedChunkManagerImpl.getInstance().getOrCreateData(team); - ServerPlayer player = manager.getServer().getPlayerList().getPlayer(profile.getId()); - if (player != null) { - teamData.setForceLoadMember(player.getUUID(), PermissionsHelper.getInstance().getChunkLoadOffline(player, false)); - } - teamData.updateLimits(); - }); - } -} \ No newline at end of file diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/AfterEventJS.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/AfterEventJS.java deleted file mode 100644 index 137826ae..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/AfterEventJS.java +++ /dev/null @@ -1,36 +0,0 @@ -//package dev.ftb.mods.ftbchunks.integration.kubejs; -// -//import dev.ftb.mods.ftbchunks.data.ClaimedChunk; -//import dev.latvian.mods.kubejs.entity.EntityEventJS; -//import dev.latvian.mods.kubejs.entity.EntityJS; -//import dev.latvian.mods.kubejs.level.LevelJS; -//import dev.latvian.mods.kubejs.player.ServerPlayerJS; -//import net.minecraft.commands.CommandSourceStack; -//import net.minecraft.server.level.ServerPlayer; -//import org.jetbrains.annotations.Nullable; -// -//public class AfterEventJS extends EntityEventJS { -// public final CommandSourceStack source; -// public final ClaimedChunk chunk; -// -// public AfterEventJS(CommandSourceStack s, ClaimedChunk c) { -// source = s; -// chunk = c; -// } -// -// @Override -// public LevelJS getLevel() { -// return levelOf(source.getLevel()); -// } -// -// @Override -// @Nullable -// public EntityJS getEntity() { -// return source.getEntity() != null ? entityOf(source.getEntity()) : null; -// } -// -// @Nullable -// public ServerPlayerJS getPlayer() { -// return source.getEntity() instanceof ServerPlayer ? (ServerPlayerJS) getEntity() : null; -// } -//} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/BeforeEventJS.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/BeforeEventJS.java deleted file mode 100644 index 2e22e9a6..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/BeforeEventJS.java +++ /dev/null @@ -1,28 +0,0 @@ -//package dev.ftb.mods.ftbchunks.integration.kubejs; -// -//import dev.ftb.mods.ftbchunks.data.ClaimResult; -//import dev.ftb.mods.ftbchunks.data.ClaimedChunk; -//import net.minecraft.commands.CommandSourceStack; -// -//public class BeforeEventJS extends AfterEventJS { -// private ClaimResult result; -// -// public BeforeEventJS(CommandSourceStack source, ClaimedChunk chunk) { -// super(source, chunk); -// result = chunk; -// } -// -// public ClaimResult getResult() { -// return result; -// } -// -// public void setResult(ClaimResult r) { -// cancel(); -// result = r; -// } -// -// @Override -// public boolean canCancel() { -// return true; -// } -//} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/FTBChunksKubeJSPlugin.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/FTBChunksKubeJSPlugin.java deleted file mode 100644 index 8ea239f9..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/kubejs/FTBChunksKubeJSPlugin.java +++ /dev/null @@ -1,44 +0,0 @@ -//package dev.ftb.mods.ftbchunks.integration.kubejs; -// -//import dev.architectury.event.CompoundEventResult; -//import dev.ftb.mods.ftbchunks.data.ClaimResult; -//import dev.ftb.mods.ftbchunks.data.ClaimResults; -//import dev.ftb.mods.ftbchunks.data.ClaimedChunk; -//import dev.ftb.mods.ftbchunks.event.ClaimedChunkEvent; -//import dev.latvian.mods.kubejs.KubeJSPlugin; -//import dev.latvian.mods.kubejs.script.ScriptType; -//import dev.latvian.mods.rhino.util.wrap.TypeWrappers; -//import net.minecraft.commands.CommandSourceStack; -// -//public class FTBChunksKubeJSPlugin extends KubeJSPlugin { -// @Override -// public void init() { -// ClaimedChunkEvent.BEFORE_CLAIM.register((source, chunk) -> before(source, chunk, "ftbchunks.before.claim")); -// ClaimedChunkEvent.BEFORE_LOAD.register((source, chunk) -> before(source, chunk, "ftbchunks.before.load")); -// ClaimedChunkEvent.BEFORE_UNCLAIM.register((source, chunk) -> before(source, chunk, "ftbchunks.before.unclaim")); -// ClaimedChunkEvent.BEFORE_UNLOAD.register((source, chunk) -> before(source, chunk, "ftbchunks.before.unload")); -// ClaimedChunkEvent.AFTER_CLAIM.register((source, chunk) -> after(source, chunk, "ftbchunks.after.claim")); -// ClaimedChunkEvent.AFTER_LOAD.register((source, chunk) -> after(source, chunk, "ftbchunks.after.load")); -// ClaimedChunkEvent.AFTER_UNCLAIM.register((source, chunk) -> after(source, chunk, "ftbchunks.after.unclaim")); -// ClaimedChunkEvent.AFTER_UNLOAD.register((source, chunk) -> after(source, chunk, "ftbchunks.after.unload")); -// } -// -// @Override -// public void addTypeWrappers(ScriptType type, TypeWrappers typeWrappers) { -// typeWrappers.register(ClaimResult.class, o -> ClaimResults.valueOf(o.toString().toUpperCase())); -// } -// -// private CompoundEventResult before(CommandSourceStack source, ClaimedChunk chunk, String id) { -// BeforeEventJS e = new BeforeEventJS(source, chunk); -// -// if (e.post(ScriptType.SERVER, id) && e.getResult() != null) { -// return CompoundEventResult.interrupt(false, e.getResult()); -// } -// -// return CompoundEventResult.pass(); -// } -// -// private void after(CommandSourceStack source, ClaimedChunk chunk, String id) { -// new AfterEventJS(source, chunk).post(ScriptType.SERVER, id); -// } -//} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/luckperms/LuckPermsIntegration.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/luckperms/LuckPermsIntegration.java deleted file mode 100644 index 962061bb..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/luckperms/LuckPermsIntegration.java +++ /dev/null @@ -1,53 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.luckperms; - -import dev.ftb.mods.ftbchunks.integration.PermissionsProvider; -import net.luckperms.api.LuckPerms; -import net.luckperms.api.LuckPermsProvider; -import net.luckperms.api.model.user.User; -import net.luckperms.api.query.QueryOptions; -import net.minecraft.server.level.ServerPlayer; - -import java.util.Optional; -import java.util.UUID; - -import static dev.ftb.mods.ftbchunks.integration.PermissionsHelper.*; - -public class LuckPermsIntegration implements PermissionsProvider { - @Override - public int getMaxClaimedChunks(ServerPlayer player, int def) { - return Math.max(getMetaData(player.getUUID(), MAX_CLAIMED_PERM).map(Integer::parseInt).orElse(def), 0); - } - - @Override - public int getMaxForceLoadedChunks(ServerPlayer player, int def) { - return Math.max(getMetaData(player.getUUID(), MAX_FORCE_LOADED_PERM).map(Integer::parseInt).orElse(def), 0); - } - - @Override - public boolean getChunkLoadOffline(ServerPlayer player, boolean def) { - return getMetaData(player.getUUID(), CHUNK_LOAD_OFFLINE_PERM).map(Boolean::parseBoolean).orElse(def); - } - - @Override - public boolean getNoWilderness(ServerPlayer player, boolean def) { - return getMetaData(player.getUUID(), NO_WILDERNESS_PERM).map(Boolean::parseBoolean).orElse(def); - } - - private static Optional getMetaData(UUID uuid, String meta) { - LuckPerms luckperms = LuckPermsProvider.get(); - Optional metaValue = Optional.empty(); - try { - User user = luckperms.getUserManager().getUser(uuid); - if (user != null) { - Optional context = luckperms.getContextManager().getQueryOptions(user); - if (context.isPresent()) { - metaValue = Optional.ofNullable(user.getCachedData().getMetaData(context.get()).getMetaValue(meta)); - } - } - } catch (IllegalStateException e) { - System.err.println("Error on fetching user with luckperms"); - System.err.println(e.getMessage()); - } - return metaValue; - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/EntityTagStageHelper.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/EntityTagStageHelper.java deleted file mode 100644 index 3df47b33..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/EntityTagStageHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.stages; - -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; - -public class EntityTagStageHelper extends StageHelper { - @Override - public boolean has(Player player, String stage) { - return player.getTags().contains(stage); - } - - @Override - public void add(ServerPlayer player, String stage) { - player.addTag(stage); - } - - @Override - public void remove(ServerPlayer player, String stage) { - player.removeTag(stage); - } - - @Override - public void sync(ServerPlayer player) { - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/GameStagesStageHelper.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/GameStagesStageHelper.java deleted file mode 100644 index d1ae8477..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/GameStagesStageHelper.java +++ /dev/null @@ -1,47 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.stages; - -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; - -public class GameStagesStageHelper extends StageHelper { - @Override - public boolean has(Player player, String stage) { - return hasStage(player, stage); - } - - @Override - public void add(ServerPlayer player, String stage) { - addStage(player, stage); - } - - @Override - public void remove(ServerPlayer player, String stage) { - removeStage(player, stage); - } - - @Override - public void sync(ServerPlayer player) { - syncStages(player); - } - - @ExpectPlatform - public static boolean hasStage(Player player, String stage) { - throw new AssertionError(); - } - - @ExpectPlatform - public static void addStage(Player player, String stage) { - throw new AssertionError(); - } - - @ExpectPlatform - public static void removeStage(Player player, String stage) { - throw new AssertionError(); - } - - @ExpectPlatform - public static void syncStages(ServerPlayer player) { - throw new AssertionError(); - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/KubeJSStageHelper.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/KubeJSStageHelper.java deleted file mode 100644 index f1ad3abb..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/KubeJSStageHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.stages; - -import dev.latvian.mods.kubejs.stages.Stages; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; - -public class KubeJSStageHelper extends StageHelper { - @Override - public boolean has(Player player, String stage) { - return Stages.get(player).has(stage); - } - - @Override - public void add(ServerPlayer player, String stage) { - Stages.get(player).add(stage); - } - - @Override - public void remove(ServerPlayer player, String stage) { - Stages.get(player).remove(stage); - } - - @Override - public void sync(ServerPlayer player) { - Stages.get(player).sync(); - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/StageHelper.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/StageHelper.java deleted file mode 100644 index 59d9aea3..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/StageHelper.java +++ /dev/null @@ -1,29 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.stages; - -import com.google.common.base.Suppliers; -import dev.architectury.platform.Platform; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; - -import java.util.function.Supplier; - -public abstract class StageHelper { - public static final Supplier INSTANCE = Suppliers.memoize(() -> { - if (Platform.isModLoaded("kubejs")) { - return new KubeJSStageHelper(); - } else if (Platform.isModLoaded("gamestages")) { - return new GameStagesStageHelper(); - } else { - return new EntityTagStageHelper(); - } - } - ); - - public abstract boolean has(Player player, String stage); - - public abstract void add(ServerPlayer player, String stage); - - public abstract void remove(ServerPlayer player, String stage); - - public abstract void sync(ServerPlayer player); -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneData.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneData.java deleted file mode 100644 index c384226f..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneData.java +++ /dev/null @@ -1,7 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.waystones; - -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.Level; - -public record WaystoneData(ResourceKey dimension, WaystoneMapIcon icon) { -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneMapIcon.java deleted file mode 100644 index 357b2a8b..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystoneMapIcon.java +++ /dev/null @@ -1,40 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.waystones; - -import dev.ftb.mods.ftbchunks.client.mapicon.StaticMapIcon; -import dev.ftb.mods.ftblibrary.icon.Color4I; -import dev.ftb.mods.ftblibrary.icon.Icon; -import dev.ftb.mods.ftblibrary.util.TooltipList; -import net.minecraft.ChatFormatting; -import net.minecraft.core.BlockPos; - -public class WaystoneMapIcon extends StaticMapIcon { - private static final Icon ICON = Icon.getIcon("ftbchunks:textures/waystone.png"); - private static final Icon ICON_GLOBAL = ICON.withTint(Color4I.rgb(0xEB78E5)); - - private final String name; - private final boolean global; - - public WaystoneMapIcon(BlockPos pos, String name, boolean global) { - super(pos); - - this.name = name; - this.global = global; - icon = this.global ? ICON_GLOBAL : ICON; - } - - @Override - public int getPriority() { - return 50; - } - - @Override - public void addTooltip(TooltipList list) { - list.string(name); - - if (global) { - list.styledString("Global", ChatFormatting.LIGHT_PURPLE); - } - - super.addTooltip(list); - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystonesIntegration.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystonesIntegration.java deleted file mode 100644 index 1f6d1947..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/waystones/WaystonesIntegration.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.waystones; - -import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; -import dev.ftb.mods.ftbchunks.api.client.event.MapIconEvent; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.Level; - -import java.util.*; - -public class WaystonesIntegration { - private static final Map, List> WAYSTONES = new HashMap<>(); - - public static void initClient() { - MapIconEvent.MINIMAP.register(WaystonesIntegration::mapWidgets); - MapIconEvent.LARGE_MAP.register(WaystonesIntegration::mapWidgets); - } - - public static void updateWaystones(List waystoneData) { - WAYSTONES.clear(); - - waystoneData.forEach(w -> WAYSTONES.computeIfAbsent(w.dimension(), k -> new ArrayList<>()).add(w.icon())); - - FTBChunksAPI.clientApi().requestMinimapIconRefresh(); - } - - public static void mapWidgets(MapIconEvent event) { - WAYSTONES.getOrDefault(event.getDimension(), Collections.emptyList()) - .forEach(event::add); - } -} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java b/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java index 65df6d02..f3131d3e 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java @@ -13,12 +13,17 @@ public class DimensionFilter { private static WildcardedRLMatcher dimensionMatcherB = null; private static WildcardedRLMatcher dimensionMatcherW = null; + private static WildcardedRLMatcher noWilderness = null; public static boolean isDimensionOK(ResourceKey levelKey) { ResourceLocation name = levelKey.location(); return !getDimensionBlacklist().test(name) && (getDimensionWhitelist().isEmpty() || getDimensionWhitelist().test(name)); } + public static boolean isNoWildernessDimension(ResourceKey levelKey) { + return getNoWildernessList().test(levelKey.location()); + } + private static WildcardedRLMatcher getDimensionWhitelist() { if (dimensionMatcherW == null) { dimensionMatcherW = new WildcardedRLMatcher(FTBChunksWorldConfig.CLAIM_DIMENSION_WHITELIST.get()); @@ -33,9 +38,17 @@ private static WildcardedRLMatcher getDimensionBlacklist() { return dimensionMatcherB; } + private static WildcardedRLMatcher getNoWildernessList() { + if (noWilderness == null) { + noWilderness = new WildcardedRLMatcher(FTBChunksWorldConfig.NO_WILDERNESS_DIMENSIONS.get()); + } + return noWilderness; + } + public static void clearMatcherCaches() { dimensionMatcherB = null; dimensionMatcherW = null; + noWilderness = null; } private static class WildcardedRLMatcher implements Predicate { diff --git a/fabric/build.gradle b/fabric/build.gradle index 40774184..c54fbc37 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -38,20 +38,20 @@ artifacts { dev(jar) } -repositories { - maven { - url "https://maven.blamejared.com" - content { - includeGroup "com.faux.ingredientextension" - } - } - maven { - url "https://maven.nucleoid.xyz/" - content { - includeGroup "eu.pb4" - } - } -} +//repositories { +// maven { +// url "https://maven.blamejared.com" +// content { +// includeGroup "com.faux.ingredientextension" +// } +// } +// maven { +// url "https://maven.nucleoid.xyz/" +// content { +// includeGroup "eu.pb4" +// } +// } +//} dependencies { modApi "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" @@ -60,24 +60,9 @@ dependencies { modImplementation("dev.ftb.mods:ftb-library-fabric:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams-fabric:${rootProject.ftb_teams_version}") { transitive = false } - modImplementation("dev.ftb.mods:ftb-ranks-fabric:${rootProject.ftb_ranks_version}") { transitive = false } - modCompileOnlyApi("dev.latvian.mods:kubejs-fabric:${rootProject.kubejs_version}") - //modImplementation("dev.latvian.mods:kubejs-fabric:${rootProject.kubejs_version}") -// modImplementation("dev.latvian.mods:rhino-fabric:${rootProject.rhino_version}") - -// modImplementation("curse.maven:auth-me-356643:3725468") - modImplementation("curse.maven:cloth-config-348521:4573053") - - // compile-only because for some reason loom isn't deobfuscating these... - modCompileOnly("curse.maven:balm-fabric-500525:${balm_fabric_version}") { transitive = false } - modCompileOnly("curse.maven:waystones-fabric-500087:${waystones_fabric_version}") { transitive = false } - - modCompileOnly("eu.pb4:common-protection-api:${common_prot_api_version}") { transitive = false } common(project(path: ":common", configuration: "dev")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } - - compileOnly "net.luckperms:api:5.4" } apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle" @@ -98,9 +83,7 @@ processResources { "fabricapiversion": project.fabric_api_version, "mcversion": project.minecraft_version, "ftblibraryversion": project.ftb_library_version, - "ftbteamsversion": project.ftb_teams_version, - "ftbranksversion": project.ftb_ranks_version, - "kubejsversion": project.kubejs_version + "ftbteamsversion": project.ftb_teams_version } } diff --git a/fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/commonprot/FTBChunksProtectionProvider.java b/fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/commonprot/FTBChunksProtectionProvider.java deleted file mode 100644 index 7d7f06b7..00000000 --- a/fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/commonprot/FTBChunksProtectionProvider.java +++ /dev/null @@ -1,153 +0,0 @@ -package dev.ftb.mods.ftbchunks.compat.commonprot; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.mojang.authlib.GameProfile; -import dev.ftb.mods.ftbchunks.FTBChunks; -import dev.ftb.mods.ftbchunks.FTBChunksExpected; -import dev.ftb.mods.ftbchunks.FTBChunksWorldConfig; -import dev.ftb.mods.ftbchunks.api.Protection; -import dev.ftb.mods.ftbchunks.data.ClaimedChunkImpl; -import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl; -import dev.ftb.mods.ftblibrary.math.ChunkDimPos; -import eu.pb4.common.protection.api.CommonProtection; -import eu.pb4.common.protection.api.ProtectionProvider; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.minecraft.core.BlockPos; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Explosion; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.AABB; -import org.jetbrains.annotations.Nullable; - -import java.util.concurrent.TimeUnit; - -public class FTBChunksProtectionProvider implements ProtectionProvider { - public static ResourceLocation ID = new ResourceLocation(FTBChunks.MOD_ID, "provider"); - private static LoadingCache FAKE_PLAYERS = null; - - public static void init() { - CommonProtection.register(ID, new FTBChunksProtectionProvider()); - - ServerLifecycleEvents.SERVER_STARTING.register(server -> { - FAKE_PLAYERS = CacheBuilder.newBuilder() - .initialCapacity(64) - .expireAfterWrite( - 30, TimeUnit.SECONDS) - .softValues() - .build(CacheLoader.from((profile) -> new OfflineServerPlayer(server.overworld(), profile))); - }); - - ServerLifecycleEvents.SERVER_STOPPED.register(server -> { - FAKE_PLAYERS = null; - }); - } - - @Override - public boolean isProtected(Level world, BlockPos pos) { - return ClaimedChunkManagerImpl.getInstance().getChunk(new ChunkDimPos(world, pos)) != null; - } - - @Override - public boolean isAreaProtected(Level world, AABB area) { - int minCX = (int) Math.floor(area.minX / 16); - int minCZ = (int) Math.floor(area.minX / 16); - int maxCX = (int) Math.ceil(area.maxX / 16); - int maxCZ = (int) Math.ceil(area.maxZ / 16); - - for (int cx = minCX; cx < maxCX; cx++) { - for (int cz = minCZ; cz < maxCZ; cz++) { - if (ClaimedChunkManagerImpl.getInstance().getChunk(new ChunkDimPos(world.dimension(), cx, cz)) != null) { - return true; - } - } - } - - return false; - } - - @Override - public boolean canBreakBlock(Level world, BlockPos pos, GameProfile profile, Player player) { - player = tryResolvePlayer(world, profile); - - if (player == null) return true; - - return !ClaimedChunkManagerImpl.getInstance().shouldPreventInteraction(player, InteractionHand.MAIN_HAND, pos, FTBChunksExpected.getBlockBreakProtection(), null); - } - - @Override - public boolean canExplodeBlock(Level world, BlockPos pos, Explosion explosion, GameProfile profile, Player player) { - if (explosion.source == null && !FTBChunksWorldConfig.PROTECT_UNKNOWN_EXPLOSIONS.get()) { - return true; - } - - ChunkDimPos chunkPos = new ChunkDimPos(world, pos); - ClaimedChunkImpl chunk = ClaimedChunkManagerImpl.getInstance().getChunk(chunkPos); - - return chunk == null || chunk.allowExplosions(); - } - - @Override - public boolean canPlaceBlock(Level world, BlockPos pos, GameProfile profile, Player player) { - player = tryResolvePlayer(world, profile); - - if (player == null) return true; - - return !ClaimedChunkManagerImpl.getInstance().shouldPreventInteraction(player, InteractionHand.MAIN_HAND, pos, FTBChunksExpected.getBlockPlaceProtection(), null); - } - - @Override - public boolean canInteractBlock(Level world, BlockPos pos, GameProfile profile, Player player) { - player = tryResolvePlayer(world, profile); - - if (player == null) return true; - - return !ClaimedChunkManagerImpl.getInstance().shouldPreventInteraction(player, InteractionHand.MAIN_HAND, pos, FTBChunksExpected.getBlockInteractProtection(), null); - - } - - @Override - public boolean canInteractEntity(Level world, Entity entity, GameProfile profile, Player player) { - player = tryResolvePlayer(world, profile); - - if (player == null) return true; - - return !ClaimedChunkManagerImpl.getInstance().shouldPreventInteraction(player, InteractionHand.MAIN_HAND, entity.blockPosition(), Protection.INTERACT_ENTITY, entity); - } - - @Override - public boolean canDamageEntity(Level world, Entity entity, GameProfile profile, Player player) { - if (entity instanceof LivingEntity) return true; - - player = tryResolvePlayer(world, profile); - - if (player == null) return true; - - return !ClaimedChunkManagerImpl.getInstance().shouldPreventInteraction(player, InteractionHand.MAIN_HAND, entity.blockPosition(), Protection.ATTACK_NONLIVING_ENTITY, entity); - } - - public static @Nullable ServerPlayer tryResolvePlayer(Level l, GameProfile profile) { - if (!(l instanceof ServerLevel sl)) { - return null; - } - - ServerPlayer online = sl.getServer().getPlayerList().getPlayer(profile.getId()); - - if (online != null) return online; - - return FAKE_PLAYERS.getUnchecked(profile); - } - - private static class OfflineServerPlayer extends ServerPlayer { - public OfflineServerPlayer(ServerLevel serverLevel, GameProfile gameProfile) { - super(serverLevel.getServer(), serverLevel, gameProfile); - } - } -} diff --git a/fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java b/fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java deleted file mode 100644 index b57849ac..00000000 --- a/fabric/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.ftb.mods.ftbchunks.compat.waystones; - -import dev.ftb.mods.ftbchunks.integration.waystones.WaystoneData; -import dev.ftb.mods.ftbchunks.integration.waystones.WaystoneMapIcon; -import dev.ftb.mods.ftbchunks.integration.waystones.WaystonesIntegration; -import net.blay09.mods.balm.api.Balm; -import net.blay09.mods.waystones.api.KnownWaystonesEvent; - -public class WaystonesCompat { - public static void init() { - Balm.getEvents().onEvent(KnownWaystonesEvent.class, WaystonesCompat::onKnownWaystones); - } - - public static void onKnownWaystones(KnownWaystonesEvent event) { - WaystonesIntegration.updateWaystones(event.getWaystones().stream() - .map(w -> new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.isGlobal()))) - .toList() - ); - } -} diff --git a/fabric/src/main/java/dev/ftb/mods/ftbchunks/fabric/FTBChunksFabric.java b/fabric/src/main/java/dev/ftb/mods/ftbchunks/fabric/FTBChunksFabric.java index e92159f4..8abc432d 100644 --- a/fabric/src/main/java/dev/ftb/mods/ftbchunks/fabric/FTBChunksFabric.java +++ b/fabric/src/main/java/dev/ftb/mods/ftbchunks/fabric/FTBChunksFabric.java @@ -1,9 +1,6 @@ package dev.ftb.mods.ftbchunks.fabric; -import dev.architectury.platform.Platform; import dev.ftb.mods.ftbchunks.FTBChunks; -import dev.ftb.mods.ftbchunks.compat.commonprot.FTBChunksProtectionProvider; -import dev.ftb.mods.ftbchunks.compat.waystones.WaystonesCompat; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; import net.minecraft.server.level.ServerPlayer; @@ -20,13 +17,5 @@ public void onInitialize() { } return true; }); - - if (Platform.isModLoaded("waystones")) { - WaystonesCompat.init(); - } - - if (Platform.isModLoaded("common-protection-api")) { - FTBChunksProtectionProvider.init(); - } } } diff --git a/fabric/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/fabric/GameStagesStageHelperImpl.java b/fabric/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/fabric/GameStagesStageHelperImpl.java deleted file mode 100644 index 4390a25c..00000000 --- a/fabric/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/fabric/GameStagesStageHelperImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.stages.fabric; - -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; - -/** - * Dummy no-op implementation since there's no Gamestages on Fabric. - * This shouldn't ever get loaded, but just in case... - */ -public class GameStagesStageHelperImpl { - public static boolean hasStage(Player player, String stage) { - return false; - } - - public static void addStage(Player player, String stage) { - } - - public static void removeStage(Player player, String stage) { - } - - public static void syncStages(ServerPlayer player) { - } -} diff --git a/forge/build.gradle b/forge/build.gradle index 1812a1b0..0a406022 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -34,43 +34,15 @@ artifacts { dev(jar) } -repositories { - maven { - name "ModMaven (JEI)" - url "https://modmaven.dev/" - content { - includeGroup "mezz.jei" - } - } - maven { - url "https://maven.blamejared.com" - content { - includeGroup "net.darkhax.gamestages" - } - } -} - dependencies { forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" modImplementation("dev.ftb.mods:ftb-library-forge:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams-forge:${rootProject.ftb_teams_version}") { transitive = false } - modImplementation("dev.ftb.mods:ftb-ranks-forge:${rootProject.ftb_ranks_version}") { transitive = false } - //modImplementation("dev.latvian.mods:kubejs-forge:${rootProject.kubejs_version}") - modCompileOnlyApi("dev.latvian.mods:kubejs-forge:${rootProject.kubejs_version}") -// modImplementation("dev.latvian.mods:rhino-forge:${rootProject.rhino_version}") { transitive = false } - -// modLocalRuntime("me.shedaniel:RoughlyEnoughItems-forge:12.0.625") - modCompileOnlyApi("curse.maven:balm-531761:${balm_forge_version}") - modCompileOnlyApi("curse.maven:waystones-245755:${waystones_forge_version}") - - modCompileOnlyApi "net.darkhax.gamestages:GameStages-Forge-1.19.2:${rootProject.gamestages_version}" common(project(path: ":common", configuration: "dev")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false } - - compileOnly "net.luckperms:api:5.4" } apply from: "https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/extra-local-mods.gradle" @@ -91,9 +63,7 @@ processResources { "forgeshortversion": project.forge_version.split("\\.")[0], "mcversion": project.minecraft_version, "ftblibraryversion": project.ftb_library_version, - "ftbteamsversion": project.ftb_teams_version, - "ftbranksversion": project.ftb_ranks_version, - "kubejsversion": project.kubejs_version + "ftbteamsversion": project.ftb_teams_version } } diff --git a/forge/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java b/forge/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java deleted file mode 100644 index b57849ac..00000000 --- a/forge/src/main/java/dev/ftb/mods/ftbchunks/compat/waystones/WaystonesCompat.java +++ /dev/null @@ -1,20 +0,0 @@ -package dev.ftb.mods.ftbchunks.compat.waystones; - -import dev.ftb.mods.ftbchunks.integration.waystones.WaystoneData; -import dev.ftb.mods.ftbchunks.integration.waystones.WaystoneMapIcon; -import dev.ftb.mods.ftbchunks.integration.waystones.WaystonesIntegration; -import net.blay09.mods.balm.api.Balm; -import net.blay09.mods.waystones.api.KnownWaystonesEvent; - -public class WaystonesCompat { - public static void init() { - Balm.getEvents().onEvent(KnownWaystonesEvent.class, WaystonesCompat::onKnownWaystones); - } - - public static void onKnownWaystones(KnownWaystonesEvent event) { - WaystonesIntegration.updateWaystones(event.getWaystones().stream() - .map(w -> new WaystoneData(w.getDimension(), new WaystoneMapIcon(w.getPos(), w.getName(), w.isGlobal()))) - .toList() - ); - } -} diff --git a/forge/src/main/java/dev/ftb/mods/ftbchunks/forge/FTBChunksForge.java b/forge/src/main/java/dev/ftb/mods/ftbchunks/forge/FTBChunksForge.java index 87b4f8ba..5e72a538 100644 --- a/forge/src/main/java/dev/ftb/mods/ftbchunks/forge/FTBChunksForge.java +++ b/forge/src/main/java/dev/ftb/mods/ftbchunks/forge/FTBChunksForge.java @@ -1,10 +1,8 @@ package dev.ftb.mods.ftbchunks.forge; -import dev.architectury.platform.Platform; import dev.architectury.platform.forge.EventBuses; import dev.ftb.mods.ftbchunks.FTBChunks; import dev.ftb.mods.ftbchunks.api.Protection; -import dev.ftb.mods.ftbchunks.compat.waystones.WaystonesCompat; import dev.ftb.mods.ftbchunks.data.ClaimedChunkImpl; import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl; import dev.ftb.mods.ftblibrary.math.ChunkDimPos; @@ -32,10 +30,6 @@ public FTBChunksForge() { FTBChunks.instance = new FTBChunks(); ForgeChunkManager.setForcedChunkLoadingCallback(FTBChunks.MOD_ID, this::validateLoadedChunks); - - if (Platform.isModLoaded("waystones")) { - WaystonesCompat.init(); - } } /** diff --git a/forge/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/forge/GameStagesStageHelperImpl.java b/forge/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/forge/GameStagesStageHelperImpl.java deleted file mode 100644 index c645c55f..00000000 --- a/forge/src/main/java/dev/ftb/mods/ftbchunks/integration/stages/forge/GameStagesStageHelperImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package dev.ftb.mods.ftbchunks.integration.stages.forge; - -import net.darkhax.gamestages.GameStageHelper; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; - -public class GameStagesStageHelperImpl { - public static boolean hasStage(Player player, String stage) { - return GameStageHelper.hasStage(player, stage); - } - - public static void addStage(Player player, String stage) { - if (player instanceof ServerPlayer sp) GameStageHelper.addStage(sp, stage); - } - - public static void removeStage(Player player, String stage) { - if (player instanceof ServerPlayer sp) GameStageHelper.removeStage(sp, stage); - } - - public static void syncStages(ServerPlayer player) { - GameStageHelper.syncPlayer(player); - } -} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index bef25fbb..e3661f5d 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -48,24 +48,3 @@ mandatory = true versionRange = "[${ftbteamsversion},)" ordering = "AFTER" side = "BOTH" - -[[dependencies.ftbchunks]] -modId = "ftbranks" -mandatory = false -versionRange = "[${ftbranksversion},)" -ordering = "AFTER" -side = "BOTH" - -[[dependencies.ftbchunks]] -modId = "kubejs" -mandatory = false -versionRange = "[${kubejsversion},)" -ordering = "AFTER" -side = "BOTH" - -[[dependencies.ftbchunks]] -modId = "luckperms" -mandatory = false -versionRange = "[5.4.83,)" -ordering = "AFTER" -side = "SERVER" \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e628c432..4ce2bcb3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,29 +5,17 @@ org.gradle.daemon=false mod_id=ftbchunks archives_base_name=ftb-chunks maven_group=dev.ftb.mods -mod_version=2001.1.4 +mod_version=2001.2.0 mod_author=FTB Team minecraft_version=1.20.1 -forge_version=47.0.16 +forge_version=47.1.3 architectury_version=9.0.8 fabric_loader_version=0.14.21 fabric_api_version=0.83.1+1.20.1 -ftb_library_version=2001.1.2 +ftb_library_version=2001.1.3-SNAPSHOT ftb_teams_version=2001.1.4 -ftb_ranks_version=2001.1.3 - -# Compat -waystones_forge_version=4584510 -waystones_fabric_version=4584500 -balm_forge_version=4584620 -balm_fabric_version=4584618 -gamestages_version=11.0.2 -common_prot_api_version=1.0.0 -kubejs_version=1902.6.0-build.119 -rhino_version=1902.2.2-build.264 -ingredient_extension_api_version=2.0.9 curseforge_id_forge=314906 curseforge_id_fabric=472657 From e5bbf7c4b133a9e18814fb0e89b82df1961061a6 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 17 Aug 2023 11:09:46 +0100 Subject: [PATCH 3/9] fix: remove xmod stuff from fabric.mod.json --- fabric/src/main/resources/fabric.mod.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 0664c181..32b4f95c 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -31,10 +31,5 @@ "architectury": ">=${archversion}", "ftblibrary": ">=${ftblibraryversion}", "ftbteams": ">=${ftbteamsversion}" - }, - "breaks": { - "kubejs": "<${kubejsversion}-", - "ftbranks": "<${ftbranksversion}-", - "luckperms": "<5.4.83" } } From bc338e9c1ea7465f316eac1bd45d24acef1dd23f Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 17 Aug 2023 11:55:19 +0100 Subject: [PATCH 4/9] chore: a few more changes for xmod compat support --- .../ftb/mods/ftbchunks/api/ChunkTeamData.java | 10 ++++++ .../ftbchunks/client/FTBChunksClient.java | 6 +++- .../client/mapicon/EntityMapIcon.java | 1 + .../client/mapicon/WaypointMapIcon.java | 1 + .../ftbchunks/data/ChunkTeamDataImpl.java | 31 ++++++++++++------- .../InWorldMapIcon.java | 2 +- .../StaticMapIcon.java | 2 +- .../TrackedPlayerMapIcon.java | 2 +- 8 files changed, 40 insertions(+), 15 deletions(-) rename common/src/main/java/dev/ftb/mods/ftbchunks/{client/mapicon => integration}/InWorldMapIcon.java (78%) rename common/src/main/java/dev/ftb/mods/ftbchunks/{client/mapicon => integration}/StaticMapIcon.java (95%) rename common/src/main/java/dev/ftb/mods/ftbchunks/{client/mapicon => integration}/TrackedPlayerMapIcon.java (97%) diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/api/ChunkTeamData.java b/common/src/main/java/dev/ftb/mods/ftbchunks/api/ChunkTeamData.java index d9661005..3a561c05 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/api/ChunkTeamData.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/api/ChunkTeamData.java @@ -205,4 +205,14 @@ public interface ChunkTeamData { * @return the last login time for this team. */ long getLastLoginTime(); + + /** + * If the given player is an online player, update the team data based on their offline forceloading permissions. + * Intended for use by external permission mods such as FTB Ranks; call this when permissions change. + *

+ * If the given player is not currently online or not a member of this team, this is a no-op. + * + * @param playerId ID of the player to check + */ + void checkMemberForceLoading(UUID playerId); } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index 66a562d2..724b01bb 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -28,7 +28,11 @@ import dev.ftb.mods.ftbchunks.client.gui.WaypointEditorScreen; import dev.ftb.mods.ftbchunks.client.map.*; import dev.ftb.mods.ftbchunks.client.map.color.ColorUtils; -import dev.ftb.mods.ftbchunks.client.mapicon.*; +import dev.ftb.mods.ftbchunks.client.mapicon.EntityIcons; +import dev.ftb.mods.ftbchunks.client.mapicon.EntityMapIcon; +import dev.ftb.mods.ftbchunks.client.mapicon.MapIconComparator; +import dev.ftb.mods.ftbchunks.integration.InWorldMapIcon; +import dev.ftb.mods.ftbchunks.integration.TrackedPlayerMapIcon; import dev.ftb.mods.ftbchunks.net.PartialPackets; import dev.ftb.mods.ftbchunks.net.SendGeneralDataPacket.GeneralChunkData; import dev.ftb.mods.ftblibrary.config.StringConfig; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java index b3f94aab..5027be61 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java @@ -5,6 +5,7 @@ import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; import dev.ftb.mods.ftbchunks.api.client.icon.MapType; import dev.ftb.mods.ftbchunks.client.FTBChunksClientConfig; +import dev.ftb.mods.ftbchunks.integration.StaticMapIcon; import dev.ftb.mods.ftblibrary.icon.Color4I; import dev.ftb.mods.ftblibrary.icon.Icon; import dev.ftb.mods.ftblibrary.icon.ImageIcon; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java index 766a31cf..84b1f444 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java @@ -5,6 +5,7 @@ import dev.ftb.mods.ftbchunks.api.client.icon.WaypointIcon; import dev.ftb.mods.ftbchunks.client.gui.LargeMapScreen; import dev.ftb.mods.ftbchunks.client.map.WaypointImpl; +import dev.ftb.mods.ftbchunks.integration.StaticMapIcon; import dev.ftb.mods.ftblibrary.config.StringConfig; import dev.ftb.mods.ftblibrary.icon.Color4I; import dev.ftb.mods.ftblibrary.icon.Icon; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java index 84ac57ed..d4319d1a 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java @@ -101,7 +101,7 @@ public Path getFile() { public TeamManager getTeamManager() { return manager.getTeamManager(); } - + @Override public Team getTeam() { return team; @@ -439,17 +439,17 @@ public int getExtraForceLoadChunks() { return extraForceLoadChunks; } - public void setForceLoadMember(UUID id, boolean val) { - long oldForceCount = memberData.values().stream().filter(TeamMemberData::isOfflineForceLoader).count(); - getTeamMemberData(id).setOfflineForceLoader(val); - long newForceCount = memberData.values().stream().filter(TeamMemberData::isOfflineForceLoader).count(); - - if (oldForceCount != newForceCount) { - FTBChunks.LOGGER.debug("team {}: set force load member {} = {}", team.getId(), id, val); - markDirty(); - canForceLoadChunks = null; - manager.clearForceLoadedCache(); + public boolean setForceLoadMember(UUID id, boolean val) { + if (val == getTeamMemberData(id).isOfflineForceLoader()) { + return false; } + + getTeamMemberData(id).setOfflineForceLoader(val); + FTBChunks.LOGGER.debug("team {}: set force load member {} = {}", team.getId(), id, val); + markDirty(); + canForceLoadChunks = null; + manager.clearForceLoadedCache(); + return true; } @NotNull @@ -701,6 +701,15 @@ public void clearClaimCaches() { forcedChunkCache = null; } + @Override + public void checkMemberForceLoading(UUID playerId) { + if (isTeamMember(playerId)) { + ServerPlayer player = manager.getMinecraftServer().getPlayerList().getPlayer(playerId); + if (player != null && setForceLoadMember(playerId, FTBChunksWorldConfig.canPlayerOfflineForceload(player))) { + updateLimits(); + } + } + } public void logPreventedAccess(ServerPlayer player, long when) { preventedAccess.put(player.getUUID(), new PreventedAccess(player.getGameProfile().getName(), when)); diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/InWorldMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/InWorldMapIcon.java similarity index 78% rename from common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/InWorldMapIcon.java rename to common/src/main/java/dev/ftb/mods/ftbchunks/integration/InWorldMapIcon.java index a3f2c316..34978fe2 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/InWorldMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/InWorldMapIcon.java @@ -1,4 +1,4 @@ -package dev.ftb.mods.ftbchunks.client.mapicon; +package dev.ftb.mods.ftbchunks.integration; import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/StaticMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/StaticMapIcon.java similarity index 95% rename from common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/StaticMapIcon.java rename to common/src/main/java/dev/ftb/mods/ftbchunks/integration/StaticMapIcon.java index a1f0855c..92ce6c39 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/StaticMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/StaticMapIcon.java @@ -1,4 +1,4 @@ -package dev.ftb.mods.ftbchunks.client.mapicon; +package dev.ftb.mods.ftbchunks.integration; import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; import dev.ftb.mods.ftbchunks.client.gui.LargeMapScreen; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/TrackedPlayerMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/TrackedPlayerMapIcon.java similarity index 97% rename from common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/TrackedPlayerMapIcon.java rename to common/src/main/java/dev/ftb/mods/ftbchunks/integration/TrackedPlayerMapIcon.java index 2967fc9a..73947b53 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/TrackedPlayerMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/integration/TrackedPlayerMapIcon.java @@ -1,4 +1,4 @@ -package dev.ftb.mods.ftbchunks.client.mapicon; +package dev.ftb.mods.ftbchunks.integration; import com.mojang.authlib.GameProfile; import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; From 42e6a7fedcd1c063eb93bae36ece8137d76d5da9 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 17 Aug 2023 12:10:04 +0100 Subject: [PATCH 5/9] fix: back out some of previous class moves --- .../java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java | 6 +----- .../ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java | 1 - .../{integration => client/mapicon}/InWorldMapIcon.java | 2 +- .../{integration => client/mapicon}/StaticMapIcon.java | 2 +- .../mapicon}/TrackedPlayerMapIcon.java | 2 +- .../ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java | 1 - 6 files changed, 4 insertions(+), 10 deletions(-) rename common/src/main/java/dev/ftb/mods/ftbchunks/{integration => client/mapicon}/InWorldMapIcon.java (78%) rename common/src/main/java/dev/ftb/mods/ftbchunks/{integration => client/mapicon}/StaticMapIcon.java (95%) rename common/src/main/java/dev/ftb/mods/ftbchunks/{integration => client/mapicon}/TrackedPlayerMapIcon.java (97%) diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index 724b01bb..66a562d2 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -28,11 +28,7 @@ import dev.ftb.mods.ftbchunks.client.gui.WaypointEditorScreen; import dev.ftb.mods.ftbchunks.client.map.*; import dev.ftb.mods.ftbchunks.client.map.color.ColorUtils; -import dev.ftb.mods.ftbchunks.client.mapicon.EntityIcons; -import dev.ftb.mods.ftbchunks.client.mapicon.EntityMapIcon; -import dev.ftb.mods.ftbchunks.client.mapicon.MapIconComparator; -import dev.ftb.mods.ftbchunks.integration.InWorldMapIcon; -import dev.ftb.mods.ftbchunks.integration.TrackedPlayerMapIcon; +import dev.ftb.mods.ftbchunks.client.mapicon.*; import dev.ftb.mods.ftbchunks.net.PartialPackets; import dev.ftb.mods.ftbchunks.net.SendGeneralDataPacket.GeneralChunkData; import dev.ftb.mods.ftblibrary.config.StringConfig; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java index 5027be61..b3f94aab 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityMapIcon.java @@ -5,7 +5,6 @@ import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; import dev.ftb.mods.ftbchunks.api.client.icon.MapType; import dev.ftb.mods.ftbchunks.client.FTBChunksClientConfig; -import dev.ftb.mods.ftbchunks.integration.StaticMapIcon; import dev.ftb.mods.ftblibrary.icon.Color4I; import dev.ftb.mods.ftblibrary.icon.Icon; import dev.ftb.mods.ftblibrary.icon.ImageIcon; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/InWorldMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/InWorldMapIcon.java similarity index 78% rename from common/src/main/java/dev/ftb/mods/ftbchunks/integration/InWorldMapIcon.java rename to common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/InWorldMapIcon.java index 34978fe2..a3f2c316 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/InWorldMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/InWorldMapIcon.java @@ -1,4 +1,4 @@ -package dev.ftb.mods.ftbchunks.integration; +package dev.ftb.mods.ftbchunks.client.mapicon; import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/StaticMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/StaticMapIcon.java similarity index 95% rename from common/src/main/java/dev/ftb/mods/ftbchunks/integration/StaticMapIcon.java rename to common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/StaticMapIcon.java index 92ce6c39..a1f0855c 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/StaticMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/StaticMapIcon.java @@ -1,4 +1,4 @@ -package dev.ftb.mods.ftbchunks.integration; +package dev.ftb.mods.ftbchunks.client.mapicon; import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; import dev.ftb.mods.ftbchunks.client.gui.LargeMapScreen; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/TrackedPlayerMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/TrackedPlayerMapIcon.java similarity index 97% rename from common/src/main/java/dev/ftb/mods/ftbchunks/integration/TrackedPlayerMapIcon.java rename to common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/TrackedPlayerMapIcon.java index 73947b53..2967fc9a 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/integration/TrackedPlayerMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/TrackedPlayerMapIcon.java @@ -1,4 +1,4 @@ -package dev.ftb.mods.ftbchunks.integration; +package dev.ftb.mods.ftbchunks.client.mapicon; import com.mojang.authlib.GameProfile; import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon; diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java index 84b1f444..766a31cf 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/WaypointMapIcon.java @@ -5,7 +5,6 @@ import dev.ftb.mods.ftbchunks.api.client.icon.WaypointIcon; import dev.ftb.mods.ftbchunks.client.gui.LargeMapScreen; import dev.ftb.mods.ftbchunks.client.map.WaypointImpl; -import dev.ftb.mods.ftbchunks.integration.StaticMapIcon; import dev.ftb.mods.ftblibrary.config.StringConfig; import dev.ftb.mods.ftblibrary.icon.Color4I; import dev.ftb.mods.ftblibrary.icon.Icon; From c83565c36c88b85b9310a306a679c1f2882f7192 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Mon, 21 Aug 2023 16:44:59 +0100 Subject: [PATCH 6/9] fix: fix claim/load cache invalidation issue --- CHANGELOG.md | 5 +++++ .../dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java | 2 +- .../dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java | 8 ++++++++ .../ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java | 6 +----- .../src/main/resources/assets/ftbchunks/lang/en_us.json | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2076542a..4495510f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2001.1.5] + +### Fixed +* Fixed cache invalidation issue when (un)claiming/loading chunks which caused client/server desync + ## [2001.1.4] ### Fixed diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java index d4319d1a..2797126f 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java @@ -673,7 +673,7 @@ public void deleteMemberData(UUID playerId) { private boolean hasChunkChanged(ClaimedChunkImpl chunk) { String s = chunk == null ? "-" : chunk.getTeamData().getTeamId().toString(); - if (lastChunkID.equals(s)) { + if (!lastChunkID.equals(s)) { lastChunkID = s; return true; } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java index 3b1ed40e..7f3ccef4 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkImpl.java @@ -73,6 +73,7 @@ public MutableComponent getMessage() { public void setClaimedTime(long t) { time = t; teamData.getManager().clearForceLoadedCache(); + teamData.clearClaimCaches(); sendUpdateToAll(); } @@ -92,8 +93,13 @@ public boolean isActuallyForceLoaded() { } public void setForceLoadedTime(long time) { + if (forceLoaded == time) { + return; + } + forceLoaded = time; teamData.getManager().clearForceLoadedCache(); + teamData.clearClaimCaches(); sendUpdateToAll(); ServerLevel level = teamData.getManager().getMinecraftServer().getLevel(pos.dimension()); @@ -137,6 +143,7 @@ public void unload(CommandSourceStack source) { if (isForceLoaded()) { setForceLoadedTime(0L); ClaimedChunkEvent.AFTER_UNLOAD.invoker().after(source, this); + teamData.clearClaimCaches(); teamData.markDirty(); forceLoadExpiryTime = 0L; } @@ -148,6 +155,7 @@ public void unclaim(CommandSourceStack source, boolean sync) { teamData.getManager().unregisterClaim(pos); ClaimedChunkEvent.AFTER_UNCLAIM.invoker().after(source, this); + teamData.clearClaimCaches(); teamData.markDirty(); if (sync) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java index 1f8dd926..37aed95b 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ClaimedChunkManagerImpl.java @@ -267,14 +267,10 @@ public boolean isChunkForceLoaded(ChunkDimPos chunkDimPos) { public void registerClaim(ChunkDimPos pos, ClaimedChunk chunk) { if (chunk instanceof ClaimedChunkImpl impl) { claimedChunks.put(pos, impl); - impl.getTeamData().clearClaimCaches(); } } public void unregisterClaim(ChunkDimPos pos) { - if (claimedChunks.containsKey(pos)) { - claimedChunks.get(pos).getTeamData().clearClaimCaches(); - claimedChunks.remove(pos); - } + claimedChunks.remove(pos); } } diff --git a/common/src/main/resources/assets/ftbchunks/lang/en_us.json b/common/src/main/resources/assets/ftbchunks/lang/en_us.json index 29a33499..6a87510f 100644 --- a/common/src/main/resources/assets/ftbchunks/lang/en_us.json +++ b/common/src/main/resources/assets/ftbchunks/lang/en_us.json @@ -176,7 +176,7 @@ "ftbchunks.claim_result": "Chunks modified: %d / %d", "ftbchunks.claim_result.other": "Unknown issues", "ftbchunks.claim_result.not_owner": "Not the chunk owner", - "ftbchunks.claim_result.not_enough_power": "Claim/forceload limit reached", + "ftbchunks.claim_result.not_enough_power": "Chunk limit reached", "ftbchunks.claim_result.already_claimed": "Chunk already claimed", "ftbchunks.claim_result.dimension_forbidden": "Claiming forbidden in this dimension", "ftbchunks.claim_result.not_claimed": "Chunk not claimed", From a1fe27a48bf05d4655ee5e5011f79903fcb0a10c Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 24 Aug 2023 11:31:58 +0100 Subject: [PATCH 7/9] build: bump ftb library dep version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4ce2bcb3..06941442 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ architectury_version=9.0.8 fabric_loader_version=0.14.21 fabric_api_version=0.83.1+1.20.1 -ftb_library_version=2001.1.3-SNAPSHOT +ftb_library_version=2001.1.3 ftb_teams_version=2001.1.4 curseforge_id_forge=314906 From 4219b394f5f3f9a6860a7008e651a744c669d613 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Thu, 24 Aug 2023 16:58:33 +0100 Subject: [PATCH 8/9] chore: changelog updated --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4495510f..cb792fd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2001.2.0] + +### Changed +* All cross-mod integration has been moved to the **FTB XMod Compat** mod + * This includes: FTB Ranks / Luckperms, Waystones, Game Stages (Forge only) and Common Protection API (Fabric only) + ## [2001.1.5] ### Fixed From 667667b11f99e75abbf5a599ec5b8fcc91251041 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Fri, 25 Aug 2023 11:27:07 +0100 Subject: [PATCH 9/9] chore: a couple of minor translation updates --- common/src/main/resources/assets/ftbchunks/lang/en_us.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/resources/assets/ftbchunks/lang/en_us.json b/common/src/main/resources/assets/ftbchunks/lang/en_us.json index 6a87510f..919d7c98 100644 --- a/common/src/main/resources/assets/ftbchunks/lang/en_us.json +++ b/common/src/main/resources/assets/ftbchunks/lang/en_us.json @@ -154,13 +154,15 @@ "ftbchunks.claim_dimension_whitelist.tooltip": "Whitelist for dimension ID's where chunks may be claimed. If non-empty, dimension *must* be in this list (and also not in \"Dimension Blacklist\".\nSame syntax as for \"Dimension Blacklist\"", "ftbchunks.no_wilderness": "Protect Unclaimed Regions", "ftbchunks.no_wilderness.tooltip": "If true, chunks must be claimed before they can be built on", + "ftbchunks.no_wilderness_dimensions": "Protect Unclaimed Regions Per-Dimension", + "ftbchunks.no_wilderness_dimensions.tooltip": "List of dimension ID's where chunks must be claimed before modifying.\nE.g. add \"minecraft:the_nether\" to require chunks to be claimed in the Nether.\nWildcards are allowed, e.g. \"othermod:*\" matches all dimensions added by \"othermod\"", "ftbchunks.force_disable_minimap": "Disable Minimap for Clients", "ftbchunks.max_idle_days_before_unclaim": "Max Idle Days Before Unclaim", "ftbchunks.max_idle_days_before_unclaim.tooltip": "If no team member logs in for this many days, the team's claims will be released.\nSetting this to 0 disables auto-unclaiming.", "ftbchunks.max_idle_days_before_unforce": "Max Idle Days Before Unforceload", "ftbchunks.max_idle_days_before_unforce.tooltip": "If no team member logs in for this many days, any force-loaded chunks will no longer be force-loaded.\nSetting this to 0 disables auto-unforceloading.", "ftbchunks.long_range_tracker_interval": "Long Range Player Tracker Interval", - "ftbchunks.long_range_tracker_interval.tooltip": "Interval in ticks to send updates to clients with long-range player tracking data.\nLower values mean more frequent updates but more server load and network traffic;\n be careful with this, especially on busy servers.\nSetting this to 0 disables long-range tracking.", + "ftbchunks.long_range_tracker_interval.tooltip": "Interval in ticks to send updates to clients with long-range player tracking data.\nLower values mean more frequent updates but more server load and network traffic; be careful with this, especially on busy servers.\nSetting this to 0 disables long-range tracking.", "ftbchunks.protect_unknown_explosions": "Prevent Explosions from Unknown Sources", "ftbchunks.protect_unknown_explosions.tooltip": "Some explosion sources (e.g. Ghasts) can't be determined in code.\nIf this setting is true, damage from these explosion is prevented in protected chunks.", "ftbchunks.hard_team_claim_limit": "Hard Max Team Claim Limit", @@ -173,6 +175,8 @@ "ftbchunks.require_game_stage.tooltip": "If true, players must have the 'ftbchunks_mapping' game stage (KubeJS and/or Gamestages required) to be able to open the map or see the minimap", "ftbchunks.location_mode_override": "Override Team \"Location Visibility\"", "ftbchunks.location_mode_override.tooltip": "If true, team \"Location Visibility\" settings are ignored, and all players can see each other anywhere on the map", + "ftbchunks.max_prevented_log_age": "Fake Player Prevented Access Log Age", + "ftbchunks.max_prevented_log_age.tooltip": "Age in days to keep logs of prevented fake player access\nNote: not fully implemented feature; will be used in future to display & control access by fake players to your claims", "ftbchunks.claim_result": "Chunks modified: %d / %d", "ftbchunks.claim_result.other": "Unknown issues", "ftbchunks.claim_result.not_owner": "Not the chunk owner",