diff --git a/build.gradle b/build.gradle index bde3592..b6f1752 100644 --- a/build.gradle +++ b/build.gradle @@ -135,25 +135,6 @@ curseforge { } } } - project { - id = "${curse_id_forge}" - "${project.curse_versions}".split(', ').each { - addGameVersion "${it}" - } - addGameVersion "Forge" - mainArtifact(project(":forge").tasks.getByName('remapJar')) { - def txt = changelog(1).replace("\n-", "\n\n- ") - txt = txt + "\n\n" + "For past versions see: ${project.full_changelog}" - changelog = txt - changelogType = "markdown" - releaseType = 'release' - } - /*relations { - "${project.curse_dep_forge}".split(', ').each { - requiredDependency "${it}" - } - }*/ - } } def discordNotif(fabric, forge) { @@ -214,16 +195,6 @@ afterEvaluate { discordNotif(true, false) } } - - task buildUploadForge(group: "publishing") { - dependsOn cleanAll, ":forge:build", ":forge:publish", "curseforge${curse_id_forge}" - project("forge").build.mustRunAfter cleanAll - project("forge").publish.mustRunAfter ":forge:build" - tasks.findByName("curseforge${curse_id_forge}").mustRunAfter ":forge:publish" - doLast { - discordNotif(false, true) - } - } } tasks.getByName("curseforge").dependsOn buildAll diff --git a/common/build.gradle b/common/build.gradle index 49b4500..1c94ba7 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -25,9 +25,6 @@ dependencies { implementation group: 'org.yaml', name: 'snakeyaml', version: '1.25' shadowCommon group: 'org.yaml', name: 'snakeyaml', version: '1.25' - modImplementation dynmap_fabric - - modImplementation "dev.ftb.mods:ftb-chunks:${rootProject.ftb_chunks}" implementation 'com.github.BlueMap-Minecraft:BlueMapAPI:v2.2.1' } @@ -46,12 +43,6 @@ transformProductionFabric { input.set shadowJar.archiveFile } -// Use the shadow jar instead of normal jar to shadow yaml lib properly into forge builds -transformProductionForge { - dependsOn shadowJar - input.set shadowJar.archiveFile -} - publishing { publications { mavenCommon(MavenPublication) { @@ -68,4 +59,4 @@ publishing { repositories { // Add repositories to publish to here. } -} \ No newline at end of file +} diff --git a/common/src/main/java/io/github/flemmli97/flan/api/ClaimHandler.java b/common/src/main/java/io/github/flemmli97/flan/api/ClaimHandler.java index c3f9071..4603b32 100644 --- a/common/src/main/java/io/github/flemmli97/flan/api/ClaimHandler.java +++ b/common/src/main/java/io/github/flemmli97/flan/api/ClaimHandler.java @@ -20,7 +20,7 @@ public class ClaimHandler { * Check if a player can do an interaction at the given position */ public static boolean canInteract(ServerPlayer player, BlockPos pos, ClaimPermission permission) { - return ClaimStorage.get(player.getLevel()).getClaimAt(pos).canInteract(player, permission, pos); + return ClaimStorage.get(player.serverLevel()).getClaimAt(pos).canInteract(player, permission, pos); } /** diff --git a/common/src/main/java/io/github/flemmli97/flan/claim/Claim.java b/common/src/main/java/io/github/flemmli97/flan/claim/Claim.java index aa8af3f..c9df5d7 100644 --- a/common/src/main/java/io/github/flemmli97/flan/claim/Claim.java +++ b/common/src/main/java/io/github/flemmli97/flan/claim/Claim.java @@ -89,9 +89,9 @@ public class Claim implements IPermissionContainer { //New claim public Claim(BlockPos pos1, BlockPos pos2, ServerPlayer creator) { - this(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ(), Math.min(pos1.getY(), pos2.getY()), creator.getUUID(), creator.getLevel(), PlayerClaimData.get(creator).playerDefaultGroups().isEmpty()); + this(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ(), Math.min(pos1.getY(), pos2.getY()), creator.getUUID(), creator.serverLevel(), PlayerClaimData.get(creator).playerDefaultGroups().isEmpty()); PlayerClaimData.get(creator).playerDefaultGroups().forEach((s, m) -> m.forEach((perm, bool) -> this.editPerms(null, s, perm, bool ? 1 : 0, true))); - Collection all = ClaimStorage.get(creator.getLevel()).allClaimsFromPlayer(creator.getUUID()); + Collection all = ClaimStorage.get(creator.serverLevel()).allClaimsFromPlayer(creator.getUUID()); String name = String.format(ConfigHandler.config.defaultClaimName, creator.getName(), all.size()); if (!name.isEmpty()) { for (Claim claim : all) { @@ -142,7 +142,7 @@ public class Claim implements IPermissionContainer { private BlockPos getInitCenterPos() { BlockPos center = BlockPos.containing(this.minX + (this.maxX - this.minX) * 0.5, 0, this.minZ + (this.maxZ - this.minZ) * 0.5); - int y = this.world.getChunk(center.getX() >> 4, center.getZ() >> 4, ChunkStatus.HEIGHTMAPS).getHeight(Heightmap.Types.MOTION_BLOCKING, center.getX() & 15, center.getZ() & 15); + int y = this.world.getChunk(center.getX() >> 4, center.getZ() >> 4, ChunkStatus.FULL).getHeight(Heightmap.Types.MOTION_BLOCKING, center.getX() & 15, center.getZ() & 15); return new BlockPos(center.getX(), y + 1, center.getZ()); } @@ -580,7 +580,7 @@ public class Claim implements IPermissionContainer { } public void applyEffects(ServerPlayer player) { - if (player.level.getGameTime() % 80 == 0) + if (player.level().getGameTime() % 80 == 0) this.potions.forEach((effect, amp) -> player.forceAddEffect(new MobEffectInstance(effect, effect == MobEffects.NIGHT_VISION ? 400 : 200, amp - 1, true, false), null)); } diff --git a/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java b/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java index 02dfb3c..40e88a6 100644 --- a/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java +++ b/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java @@ -165,7 +165,7 @@ public class ClaimStorage implements IPermissionStorage { public void toggleAdminClaim(ServerPlayer player, Claim claim, boolean toggle) { Flan.log("Set claim {} to an admin claim", claim); - this.deleteClaim(claim, false, EnumEditMode.DEFAULT, player.getLevel()); + this.deleteClaim(claim, false, EnumEditMode.DEFAULT, player.serverLevel()); if (toggle) claim.getOwnerPlayer().ifPresent(o -> PlayerClaimData.get(o).updateScoreboard()); claim.toggleAdminClaim(player, toggle); @@ -177,7 +177,7 @@ public class ClaimStorage implements IPermissionStorage { public boolean resizeClaim(Claim claim, BlockPos from, BlockPos to, ServerPlayer player) { int[] dims = claim.getDimensions(); BlockPos opposite = new BlockPos(dims[0] == from.getX() ? dims[1] : dims[0], dims[4], dims[2] == from.getZ() ? dims[3] : dims[2]); - Claim newClaim = new Claim(opposite, to, player.getUUID(), player.getLevel()); + Claim newClaim = new Claim(opposite, to, player.getUUID(), player.serverLevel()); if (newClaim.getPlane() < ConfigHandler.config.minClaimsize) { player.displayClientMessage(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("minClaimSize"), ConfigHandler.config.minClaimsize), ChatFormatting.RED), false); return false; @@ -198,7 +198,7 @@ public class ClaimStorage implements IPermissionStorage { boolean enoughBlocks = claim.isAdminClaim() || data.isAdminIgnoreClaim() || newData.canUseClaimBlocks(diff); if (enoughBlocks) { Flan.log("Resizing claim {}", claim); - this.deleteClaim(claim, false, EnumEditMode.DEFAULT, player.getLevel()); + this.deleteClaim(claim, false, EnumEditMode.DEFAULT, player.serverLevel()); claim.copySizes(newClaim); this.addClaim(claim); data.addDisplayClaim(claim, EnumDisplayType.MAIN, player.blockPosition().getY()); @@ -410,7 +410,7 @@ public class ClaimStorage implements IPermissionStorage { Yaml yml = new Yaml(); File griefPrevention = server.getWorldPath(LevelResource.ROOT).resolve("plugins/GriefPreventionData/ClaimData").toFile(); if (!griefPrevention.exists()) { - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("cantFindData"), griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("cantFindData"), griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false); return false; } Map> subClaimMap = new HashMap<>(); @@ -444,7 +444,7 @@ public class ClaimStorage implements IPermissionStorage { try { intFileMap.put(Integer.valueOf(f.getName().replace(".yml", "")), f); } catch (NumberFormatException e) { - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), f.getName(), ChatFormatting.RED)), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), f.getName(), ChatFormatting.RED)), false); } } } @@ -477,16 +477,16 @@ public class ClaimStorage implements IPermissionStorage { parentClaim.getB().setClaimID(storage.generateUUID()); storage.addClaim(parentClaim.getB()); } else { - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("readConflict"), parent.getName(), conflicts), ChatFormatting.DARK_RED), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("readConflict"), parent.getName(), conflicts), ChatFormatting.DARK_RED), false); for (DisplayBox claim : conflicts) { DisplayBox.Box dim = claim.box(); MutableComponent text = PermHelper.simpleColoredText(String.format("@[x=%d;z=%d]", dim.minX(), dim.minZ()), ChatFormatting.RED); text.setStyle(text.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/tp @s " + dim.minX() + " ~ " + dim.minZ())).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.coordinates.tooltip")))); - src.sendSuccess(text, false); + src.sendSuccess(() -> text, false); } } } catch (Exception e) { - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), parent.getName(), ChatFormatting.RED)), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), parent.getName(), ChatFormatting.RED)), false); e.printStackTrace(); } } diff --git a/common/src/main/java/io/github/flemmli97/flan/claim/PermHelper.java b/common/src/main/java/io/github/flemmli97/flan/claim/PermHelper.java index 11b01ff..22fb09e 100644 --- a/common/src/main/java/io/github/flemmli97/flan/claim/PermHelper.java +++ b/common/src/main/java/io/github/flemmli97/flan/claim/PermHelper.java @@ -26,7 +26,7 @@ public class PermHelper { public static Claim checkReturn(ServerPlayer player, ClaimPermission perm, Consumer> cons) { BlockPos pos = player.blockPosition(); - Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(pos); + Claim claim = ClaimStorage.get(player.serverLevel()).getClaimAt(pos); return check(player, pos, claim, perm, cons) ? claim : null; } diff --git a/common/src/main/java/io/github/flemmli97/flan/commands/CommandClaim.java b/common/src/main/java/io/github/flemmli97/flan/commands/CommandClaim.java index 1e9fd22..470e02e 100644 --- a/common/src/main/java/io/github/flemmli97/flan/commands/CommandClaim.java +++ b/common/src/main/java/io/github/flemmli97/flan/commands/CommandClaim.java @@ -156,15 +156,15 @@ public class CommandClaim { private static int reloadConfig(CommandContext context) { ConfigHandler.reloadConfigs(context.getSource().getServer()); - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("configReload")), true); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("configReload")), true); return Command.SINGLE_SUCCESS; } private static int addClaim(CommandContext context) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - if (!ItemInteractEvents.canClaimWorld(player.getLevel(), player)) + if (!ItemInteractEvents.canClaimWorld(player.serverLevel(), player)) return 0; - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); BlockPos from = BlockPosArgument.getLoadedBlockPos(context, "from"); BlockPos to = BlockPosArgument.getLoadedBlockPos(context, "to"); storage.createClaim(from, to, player); @@ -181,9 +181,9 @@ public class CommandClaim { private static int addClaimRect(CommandContext context, int x, int z) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - if (!ItemInteractEvents.canClaimWorld(player.getLevel(), player)) + if (!ItemInteractEvents.canClaimWorld(player.serverLevel(), player)) return 0; - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); boolean evenX = x % 2 == 0; boolean evenZ = z % 2 == 0; BlockPos from = player.blockPosition().offset(evenX ? -(int) ((x - 1) * 0.5) : -(int) (x * 0.5), -5, evenZ ? -(int) ((z - 1) * 0.5) : -(int) (z * 0.5)); @@ -196,11 +196,11 @@ public class CommandClaim { ServerPlayer player = context.getSource().getPlayerOrException(); Collection profs = GameProfileArgument.getGameProfiles(context, "player"); if (profs.size() != 1) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("onlyOnePlayer"), ChatFormatting.RED), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("onlyOnePlayer"), ChatFormatting.RED), false); return 0; } GameProfile prof = profs.iterator().next(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim == null) { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); @@ -231,7 +231,7 @@ public class CommandClaim { private static int openMenu(CommandContext context) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); PlayerClaimData data = PlayerClaimData.get(player); - Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(player.blockPosition()); + Claim claim = ClaimStorage.get(player.serverLevel()).getClaimAt(player.blockPosition()); if (claim == null) { PermHelper.noClaimMessage(player); return 0; @@ -253,10 +253,10 @@ public class CommandClaim { ServerPlayer player = context.getSource().getPlayerOrException(); PlayerClaimData data = PlayerClaimData.get(player); if (data.setTrappedRescue()) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedRescue"), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedRescue"), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } else { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedFail"), ChatFormatting.RED), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("trappedFail"), ChatFormatting.RED), false); } return 0; } @@ -268,7 +268,7 @@ public class CommandClaim { Claim claim = PermHelper.checkReturn(player, PermissionRegistry.EDITPERMS, PermHelper.genericNoPermMessage(player)); if (claim == null) return 0; - boolean nameUsed = ClaimStorage.get(player.getLevel()).allClaimsFromPlayer(claim.getOwner()) + boolean nameUsed = ClaimStorage.get(player.serverLevel()).allClaimsFromPlayer(claim.getOwner()) .stream().map(Claim::getClaimName).anyMatch(name -> name.equals(StringArgumentType.getString(context, "name"))); if (!nameUsed) { String name = StringArgumentType.getString(context, "name"); @@ -278,7 +278,7 @@ public class CommandClaim { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimNameUsed"), ChatFormatting.DARK_RED), false); } } else { - Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(player.blockPosition()); + Claim claim = ClaimStorage.get(player.serverLevel()).getClaimAt(player.blockPosition()); Claim sub = claim.getSubClaim(player.blockPosition()); if (sub != null && (claim.canInteract(player, PermissionRegistry.EDITPERMS, player.blockPosition()) || sub.canInteract(player, PermissionRegistry.EDITPERMS, player.blockPosition()))) { boolean nameUsed = claim.getAllSubclaims() @@ -291,7 +291,7 @@ public class CommandClaim { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("claimNameUsedSub"), ChatFormatting.DARK_RED), false); } } else if (claim.canInteract(player, PermissionRegistry.EDITPERMS, player.blockPosition())) { - boolean nameUsed = ClaimStorage.get(player.getLevel()).allClaimsFromPlayer(claim.getOwner()) + boolean nameUsed = ClaimStorage.get(player.serverLevel()).allClaimsFromPlayer(claim.getOwner()) .stream().map(Claim::getClaimName).anyMatch(name -> name.equals(StringArgumentType.getString(context, "name"))); if (!nameUsed) { String name = StringArgumentType.getString(context, "name"); @@ -310,7 +310,7 @@ public class CommandClaim { ServerPlayer player = context.getSource().getPlayerOrException(); PlayerClaimData data = PlayerClaimData.get(player); data.unlockDeathItems(); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDrops"), ConfigHandler.config.dropTicks), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDrops"), ConfigHandler.config.dropTicks), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } @@ -325,7 +325,7 @@ public class CommandClaim { success.add(prof.getName()); } } - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDropsMulti"), success), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("unlockDropsMulti"), success), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } @@ -341,7 +341,7 @@ public class CommandClaim { private static int claimInfo(CommandContext context, Claim.InfoType infoType) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(player.blockPosition()); + Claim claim = ClaimStorage.get(player.serverLevel()).getClaimAt(player.blockPosition()); PlayerClaimData data = PlayerClaimData.get(player); if (claim == null) { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); @@ -365,7 +365,7 @@ public class CommandClaim { private static int deleteClaim(CommandContext context) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); boolean check = PermHelper.check(player, player.blockPosition(), claim, PermissionRegistry.EDITCLAIM, b -> { if (!b.isPresent()) @@ -377,7 +377,7 @@ public class CommandClaim { }); if (!check) return 0; - storage.deleteClaim(claim, true, PlayerClaimData.get(player).getEditMode(), player.getLevel()); + storage.deleteClaim(claim, true, PlayerClaimData.get(player).getEditMode(), player.serverLevel()); return Command.SINGLE_SUCCESS; } @@ -387,7 +387,7 @@ public class CommandClaim { if (data.confirmedDeleteAll()) { for (ServerLevel world : player.getServer().getAllLevels()) { ClaimStorage storage = ClaimStorage.get(world); - storage.allClaimsFromPlayer(player.getUUID()).forEach((claim) -> storage.deleteClaim(claim, true, PlayerClaimData.get(player).getEditMode(), player.getLevel())); + storage.allClaimsFromPlayer(player.getUUID()).forEach((claim) -> storage.deleteClaim(claim, true, PlayerClaimData.get(player).getEditMode(), player.serverLevel())); } player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteAllClaim"), ChatFormatting.GOLD), false); data.setConfirmDeleteAll(false); @@ -400,7 +400,7 @@ public class CommandClaim { private static int deleteSubClaim(CommandContext context) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim == null) { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); @@ -442,7 +442,7 @@ public class CommandClaim { private static int listClaims(CommandContext context, Collection profs) throws CommandSyntaxException { if (profs.size() != 1) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("onlyOnePlayer"), ChatFormatting.RED), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("onlyOnePlayer"), ChatFormatting.RED), false); return 0; } GameProfile prof = profs.iterator().next(); @@ -462,18 +462,18 @@ public class CommandClaim { if (ConfigHandler.config.maxClaimBlocks != -1) { if (player != null) { PlayerClaimData data = PlayerClaimData.get(player); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"), + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"), data.getClaimBlocks(), data.getAdditionalClaims(), data.usedClaimBlocks(), data.remainingClaimBlocks()), ChatFormatting.GOLD), false); } else { OfflinePlayerData data = new OfflinePlayerData(server, of); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"), + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("claimBlocksFormat"), data.claimBlocks, data.getAdditionalClaims(), data.usedClaimBlocks(), data.remainingClaimBlocks()), ChatFormatting.GOLD), false); } } - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("listClaims"), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("listClaims"), ChatFormatting.GOLD), false); for (Map.Entry> entry : claims.entrySet()) for (Claim claim : entry.getValue()) - context.getSource().sendSuccess(PermHelper.simpleColoredText( + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText( entry.getKey().dimension().location().toString() + " # " + claim.formattedClaim(), ChatFormatting.YELLOW), false); return Command.SINGLE_SUCCESS; } @@ -499,11 +499,11 @@ public class CommandClaim { ClaimStorage storage = ClaimStorage.get(src.getLevel()); Claim claim = storage.getClaimAt(BlockPos.containing(src.getPosition())); if (claim == null) { - src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); return 0; } storage.deleteClaim(claim, true, EnumEditMode.DEFAULT, src.getLevel()); - src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaim"), ChatFormatting.RED), true); + src.sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaim"), ChatFormatting.RED), true); return Command.SINGLE_SUCCESS; } @@ -525,39 +525,39 @@ public class CommandClaim { } players.add(prof.getName()); } - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("adminDeleteAll"), players), ChatFormatting.GOLD), true); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("adminDeleteAll"), players), ChatFormatting.GOLD), true); return Command.SINGLE_SUCCESS; } private static int toggleAdminClaim(CommandContext context) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim == null) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("noClaim"), ChatFormatting.RED), false); return 0; } storage.toggleAdminClaim(player, claim, BoolArgumentType.getBool(context, "toggle")); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("setAdminClaim"), claim.isAdminClaim()), ChatFormatting.GOLD), true); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("setAdminClaim"), claim.isAdminClaim()), ChatFormatting.GOLD), true); return Command.SINGLE_SUCCESS; } private static int listAdminClaims(CommandContext context) { CommandSourceStack src = context.getSource(); Collection claims = ClaimStorage.get(src.getLevel()).getAdminClaims(); - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("listAdminClaims"), src.getLevel().dimension().location()), ChatFormatting.GOLD), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("listAdminClaims"), src.getLevel().dimension().location()), ChatFormatting.GOLD), false); for (Claim claim : claims) - src.sendSuccess(PermHelper.simpleColoredText(claim.formattedClaim(), ChatFormatting.YELLOW), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(claim.formattedClaim(), ChatFormatting.YELLOW), false); return Command.SINGLE_SUCCESS; } private static int readGriefPreventionData(CommandContext context) { CommandSourceStack src = context.getSource(); - src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionData"), ChatFormatting.GOLD), true); + src.sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionData"), ChatFormatting.GOLD), true); if (ClaimStorage.readGriefPreventionData(src.getServer(), src)) - src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionClaimDataSuccess"), ChatFormatting.GOLD), true); + src.sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionClaimDataSuccess"), ChatFormatting.GOLD), true); if (PlayerClaimData.readGriefPreventionPlayerData(src.getServer(), src)) - src.sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionPlayerDataSuccess"), ChatFormatting.GOLD), true); + src.sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("readGriefpreventionPlayerDataSuccess"), ChatFormatting.GOLD), true); return Command.SINGLE_SUCCESS; } @@ -574,7 +574,7 @@ public class CommandClaim { PlayerClaimData.editForOfflinePlayer(src.getServer(), prof.getId(), amount); players.add(prof.getName()); } - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("giveClaimBlocks"), players, amount), ChatFormatting.GOLD), true); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("giveClaimBlocks"), players, amount), ChatFormatting.GOLD), true); return Command.SINGLE_SUCCESS; } @@ -589,7 +589,7 @@ public class CommandClaim { private static int modifyGroup(CommandContext context, boolean remove) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); String group = StringArgumentType.getString(context, "group"); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim == null) { PermHelper.noClaimMessage(player); @@ -637,7 +637,7 @@ public class CommandClaim { private static int modifyPlayer(CommandContext context, String group, boolean force) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim == null) { PermHelper.noClaimMessage(player); @@ -682,7 +682,7 @@ public class CommandClaim { private static int modifyFakePlayer(CommandContext context, boolean remove) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim == null) { PermHelper.noClaimMessage(player); @@ -729,7 +729,7 @@ public class CommandClaim { private static int editPerms(CommandContext context, String group, int mode) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); - Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(player.blockPosition()); + Claim claim = ClaimStorage.get(player.serverLevel()).getClaimAt(player.blockPosition()); PlayerClaimData data = PlayerClaimData.get(player); if (data.getEditMode() == EnumEditMode.SUBCLAIM) { Claim sub = claim.getSubClaim(player.blockPosition()); @@ -800,7 +800,7 @@ public class CommandClaim { if (claim == null) return 0; claim.setHomePos(player.blockPosition()); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("setHome"), player.blockPosition().getX(), player.blockPosition().getY(), player.blockPosition().getZ()), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("setHome"), player.blockPosition().getX(), player.blockPosition().getY(), player.blockPosition().getZ()), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } @@ -810,7 +810,7 @@ public class CommandClaim { if (claim == null) return 0; - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); int amount = IntegerArgumentType.getInteger(context, "distance"); int[] dims = claim.getDimensions(); int x = dims[0]; @@ -843,7 +843,7 @@ public class CommandClaim { public static int teleport(CommandContext context, UUID owner) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); String name = StringArgumentType.getString(context, "claim"); - return ClaimStorage.get(player.getLevel()).allClaimsFromPlayer(owner) + return ClaimStorage.get(player.serverLevel()).allClaimsFromPlayer(owner) .stream().filter(claim -> { if (claim.getClaimName().isEmpty()) return claim.getClaimID().toString().equals(name); @@ -853,12 +853,12 @@ public class CommandClaim { if (claim.canInteract(player, PermissionRegistry.TELEPORT, pos, false)) { PlayerClaimData data = PlayerClaimData.get(player); if (data.setTeleportTo(pos)) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("teleportHome"), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("teleportHome"), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("teleportHomeFail"), ChatFormatting.RED), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("teleportHomeFail"), ChatFormatting.RED), false); } else - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermissionSimple"), ChatFormatting.DARK_RED), false); return 0; }).orElse(0); } @@ -905,17 +905,17 @@ public class CommandClaim { } } MutableComponent cmdFeed = Component.translatable(feedback, text).withStyle(ChatFormatting.GOLD); - context.getSource().sendSuccess(cmdFeed, false); + context.getSource().sendSuccess(() -> cmdFeed, false); return Command.SINGLE_SUCCESS; } private static int sellClaimBlocks(CommandContext context) throws CommandSyntaxException { - boolean b = ConfigHandler.config.buySellHandler.sell(context.getSource().getPlayerOrException(), Math.max(0, IntegerArgumentType.getInteger(context, "amount")), m -> context.getSource().sendSuccess(m, false)); + boolean b = ConfigHandler.config.buySellHandler.sell(context.getSource().getPlayerOrException(), Math.max(0, IntegerArgumentType.getInteger(context, "amount")), m -> context.getSource().sendSuccess(() -> m, false)); return b ? Command.SINGLE_SUCCESS : 0; } private static int buyClaimBlocks(CommandContext context) throws CommandSyntaxException { - boolean b = ConfigHandler.config.buySellHandler.buy(context.getSource().getPlayerOrException(), Math.max(0, IntegerArgumentType.getInteger(context, "amount")), m -> context.getSource().sendSuccess(m, false)); + boolean b = ConfigHandler.config.buySellHandler.buy(context.getSource().getPlayerOrException(), Math.max(0, IntegerArgumentType.getInteger(context, "amount")), m -> context.getSource().sendSuccess(() -> m, false)); return b ? Command.SINGLE_SUCCESS : 0; } } diff --git a/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelp.java b/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelp.java index 3cbcd78..0d1d41f 100644 --- a/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelp.java +++ b/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelp.java @@ -24,17 +24,17 @@ public class CommandHelp { return helpMessage(context, page, nodes); } - public static int helpMessage(CommandContext context, int page, Collection> nodes) { + public static int helpMessage(CommandContext context, int reqPage, Collection> nodes) { List subCommands = registeredCommands(context, nodes); subCommands.remove("?"); int max = subCommands.size() / 8; - if (page > max) - page = max; - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("helpHeader"), page), ChatFormatting.GOLD), false); - for (int i = 8 * page; i < 8 * (page + 1); i++) + final int page = reqPage > max ? max : reqPage; + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("helpHeader"), page), ChatFormatting.GOLD), false); + for (Integer i = 8 * page; i < 8 * (page + 1); i++) if (i < subCommands.size()) { MutableComponent cmdText = PermHelper.simpleColoredText("- " + subCommands.get(i), ChatFormatting.GRAY); - context.getSource().sendSuccess(cmdText.withStyle(cmdText.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/flan help cmd " + subCommands.get(i)))), false); + MutableComponent finalText = cmdText.withStyle(cmdText.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/flan help cmd " + subCommands.get(i)))); + context.getSource().sendSuccess(() -> finalText, false); } MutableComponent pageText = PermHelper.simpleColoredText((page > 0 ? " " : "") + " ", ChatFormatting.DARK_GREEN); if (page > 0) { @@ -47,7 +47,8 @@ public class CommandHelp { pageTextNext.withStyle(Style.EMPTY.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/flan help " + (page + 1)))); pageText = pageText.append(pageTextNext); } - context.getSource().sendSuccess(pageText, false); + MutableComponent finalText = pageText; + context.getSource().sendSuccess(() -> finalText, false); return Command.SINGLE_SUCCESS; } @@ -58,20 +59,21 @@ public class CommandHelp { public static int helpCmd(CommandContext context, String command) { String[] cmdHelp = ConfigHandler.langManager.getArray("command." + command); - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("helpCmdHeader"), ChatFormatting.DARK_GREEN), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("helpCmdHeader"), ChatFormatting.DARK_GREEN), false); for (int i = 0; i < cmdHelp.length; i++) { + String helpString = cmdHelp[i]; if (i == 0) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("helpCmdSyntax"), cmdHelp[i]), ChatFormatting.GOLD), false); - context.getSource().sendSuccess(PermHelper.simpleColoredText(""), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("helpCmdSyntax"), helpString), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(""), false); } else { - context.getSource().sendSuccess(PermHelper.simpleColoredText(cmdHelp[i], ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(helpString, ChatFormatting.GOLD), false); } } if (command.equals("help")) { - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.langManager.get("wiki"), ChatFormatting.GOLD), false); + context.getSource().sendSuccess(() -> PermHelper.simpleColoredText(ConfigHandler.langManager.get("wiki"), ChatFormatting.GOLD), false); MutableComponent wiki = PermHelper.simpleColoredText("https://github.com/Flemmli97/Flan/wiki", ChatFormatting.GREEN); wiki.setStyle(wiki.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/Flemmli97/Flan/wiki"))); - context.getSource().sendSuccess(wiki, false); + context.getSource().sendSuccess(() -> wiki, false); } return Command.SINGLE_SUCCESS; } diff --git a/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelpers.java b/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelpers.java index 3d2f483..4d3f063 100644 --- a/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelpers.java +++ b/common/src/main/java/io/github/flemmli97/flan/commands/CommandHelpers.java @@ -63,7 +63,7 @@ public class CommandHelpers { public static CompletableFuture groupSuggestion(CommandContext context, SuggestionsBuilder build) throws CommandSyntaxException { ServerPlayer player = context.getSource().getPlayerOrException(); List list = new ArrayList<>(); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(player.blockPosition()); if (claim != null && claim.canInteract(player, PermissionRegistry.EDITPERMS, player.blockPosition())) { list = claim.groups(); diff --git a/common/src/main/java/io/github/flemmli97/flan/event/BlockInteractEvents.java b/common/src/main/java/io/github/flemmli97/flan/event/BlockInteractEvents.java index 883ac45..7854451 100644 --- a/common/src/main/java/io/github/flemmli97/flan/event/BlockInteractEvents.java +++ b/common/src/main/java/io/github/flemmli97/flan/event/BlockInteractEvents.java @@ -164,13 +164,13 @@ public class BlockInteractEvents { } public static boolean preventFallOn(Entity entity, double heightDifference, boolean onGround, BlockState landedState, BlockPos landedPosition) { - if (entity.level.isClientSide) + if (entity.level().isClientSide) return false; if (entity instanceof ServerPlayer) { ClaimPermission perm = ObjectToPermissionMap.getFromBlock(landedState.getBlock()); if (perm != PermissionRegistry.TRAMPLE) return false; - ClaimStorage storage = ClaimStorage.get((ServerLevel) entity.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) entity.level()); IPermissionContainer claim = storage.getForPermissionCheck(landedPosition); if (claim == null) return false; @@ -181,7 +181,7 @@ public class BlockInteractEvents { ClaimPermission perm = ObjectToPermissionMap.getFromBlock(landedState.getBlock()); if (perm != PermissionRegistry.TRAMPLE) return false; - ClaimStorage storage = ClaimStorage.get((ServerLevel) entity.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) entity.level()); IPermissionContainer claim = storage.getForPermissionCheck(landedPosition); return !claim.canInteract((ServerPlayer) owner, perm, landedPosition, true); } diff --git a/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java b/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java index cb14e83..ac8e7f8 100644 --- a/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java +++ b/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java @@ -120,14 +120,14 @@ public class EntityInteractEvents { } public static boolean projectileHit(Projectile proj, HitResult res) { - if (proj.level.isClientSide) + if (proj.level().isClientSide) return false; Entity owner = proj.getOwner(); if (owner instanceof ServerPlayer player) { if (res.getType() == HitResult.Type.BLOCK) { BlockHitResult blockRes = (BlockHitResult) res; BlockPos pos = blockRes.getBlockPos(); - BlockState state = proj.level.getBlockState(pos); + BlockState state = proj.level().getBlockState(pos); ClaimPermission perm; if (proj instanceof ThrownEnderpearl) perm = PermissionRegistry.ENDERPEARL; @@ -137,19 +137,19 @@ public class EntityInteractEvents { perm = ObjectToPermissionMap.getFromBlock(state.getBlock()); if (perm != PermissionRegistry.ENDERPEARL && perm != PermissionRegistry.TARGETBLOCK && perm != PermissionRegistry.PROJECTILES) return false; - ClaimStorage storage = ClaimStorage.get((ServerLevel) proj.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) proj.level()); IPermissionContainer claim = storage.getForPermissionCheck(pos); if (claim == null) return false; boolean flag = !claim.canInteract(player, perm, pos, true); if (flag) { if (proj instanceof AbstractArrow pers) { - ((IPersistentProjectileVars) pers).setInBlockState(pers.level.getBlockState(pos)); + ((IPersistentProjectileVars) pers).setInBlockState(pers.level().getBlockState(pos)); Vec3 vec3d = blockRes.getLocation().subtract(pers.getX(), pers.getY(), pers.getZ()); pers.setDeltaMovement(vec3d); Vec3 vec3d2 = vec3d.normalize().scale(0.05000000074505806D); pers.setPosRaw(pers.getX() - vec3d2.x, pers.getY() - vec3d2.y, pers.getZ() - vec3d2.z); - pers.playSound(((IPersistentProjectileVars) pers).getSoundEvent(), 1.0F, 1.2F / (pers.level.random.nextFloat() * 0.2F + 0.9F)); + pers.playSound(((IPersistentProjectileVars) pers).getSoundEvent(), 1.0F, 1.2F / (pers.level().random.nextFloat() * 0.2F + 0.9F)); ((IPersistentProjectileVars) pers).setInGround(true); pers.shakeTime = 7; pers.setCritArrow(false); @@ -166,7 +166,7 @@ public class EntityInteractEvents { return flag; } else if (res.getType() == HitResult.Type.ENTITY) { if (proj instanceof ThrownEnderpearl) { - ClaimStorage storage = ClaimStorage.get((ServerLevel) proj.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) proj.level()); IPermissionContainer claim = storage.getForPermissionCheck(proj.blockPosition()); return claim.canInteract(player, PermissionRegistry.ENDERPEARL, proj.blockPosition(), true); } @@ -189,8 +189,8 @@ public class EntityInteractEvents { public static boolean preventDamage(Entity entity, DamageSource source) { if (source.getEntity() instanceof ServerPlayer) return attackSimple((ServerPlayer) source.getEntity(), entity, true) != InteractionResult.PASS; - else if (source.is(DamageTypeTags.IS_EXPLOSION) && !entity.level.isClientSide && !(entity instanceof ServerPlayer || entity instanceof Enemy)) { - IPermissionContainer claim = ClaimStorage.get((ServerLevel) entity.level).getForPermissionCheck(entity.blockPosition()); + else if (source.is(DamageTypeTags.IS_EXPLOSION) && !entity.level().isClientSide && !(entity instanceof ServerPlayer || entity instanceof Enemy)) { + IPermissionContainer claim = ClaimStorage.get((ServerLevel) entity.level()).getForPermissionCheck(entity.blockPosition()); return claim != null && !claim.canInteract(null, PermissionRegistry.EXPLOSIONS, entity.blockPosition()); } return false; @@ -201,7 +201,7 @@ public class EntityInteractEvents { return InteractionResult.PASS; if (entity instanceof Enemy) return InteractionResult.PASS; - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); BlockPos pos = entity.blockPosition(); IPermissionContainer claim = storage.getForPermissionCheck(pos); if (claim != null) { @@ -216,7 +216,7 @@ public class EntityInteractEvents { public static boolean xpAbsorb(Player player) { if (player instanceof ServerPlayer) { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level()); BlockPos pos = player.blockPosition(); IPermissionContainer claim = storage.getForPermissionCheck(pos); if (claim != null) @@ -237,7 +237,7 @@ public class EntityInteractEvents { } if (sPlayer.getUUID().equals(ownedItem.getPlayerOrigin())) return true; - ClaimStorage storage = ClaimStorage.get(sPlayer.getLevel()); + ClaimStorage storage = ClaimStorage.get(sPlayer.serverLevel()); BlockPos pos = sPlayer.blockPosition(); IPermissionContainer claim = storage.getForPermissionCheck(pos); if (claim != null) @@ -249,7 +249,7 @@ public class EntityInteractEvents { public static boolean canDropItem(Player player, ItemStack stack) { if (!player.isDeadOrDying() && player instanceof ServerPlayer) { - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level()); BlockPos pos = player.blockPosition(); IPermissionContainer claim = storage.getForPermissionCheck(pos); boolean allow = true; @@ -270,9 +270,9 @@ public class EntityInteractEvents { } public static boolean witherCanDestroy(WitherBoss wither) { - if (wither.level.isClientSide) + if (wither.level().isClientSide) return true; - ClaimStorage storage = ClaimStorage.get((ServerLevel) wither.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) wither.level()); BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); for (int x = -1; x <= 1; x++) for (int z = -1; z <= 1; z++) { @@ -285,15 +285,15 @@ public class EntityInteractEvents { } public static boolean canEndermanInteract(EnderMan enderman, BlockPos pos) { - if (enderman.level.isClientSide) + if (enderman.level().isClientSide) return true; - ClaimStorage storage = ClaimStorage.get((ServerLevel) enderman.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) enderman.level()); IPermissionContainer claim = storage.getForPermissionCheck(pos); return claim.canInteract(null, PermissionRegistry.ENDERMAN, pos, false); } public static boolean canSnowGolemInteract(SnowGolem snowgolem) { - if (snowgolem.level.isClientSide) + if (snowgolem.level().isClientSide) return true; int x, y, z; for (int l = 0; l < 4; ++l) { @@ -301,7 +301,7 @@ public class EntityInteractEvents { y = Mth.floor(snowgolem.getY()); z = Mth.floor(snowgolem.getZ() + (l / 2 % 2 * 2 - 1) * 0.25F); BlockPos pos = new BlockPos(x, y, z); - IPermissionContainer claim = ClaimStorage.get((ServerLevel) snowgolem.level).getForPermissionCheck(pos); + IPermissionContainer claim = ClaimStorage.get((ServerLevel) snowgolem.level()).getForPermissionCheck(pos); if (!claim.canInteract(null, PermissionRegistry.SNOWGOLEM, pos, false)) return false; } @@ -315,7 +315,7 @@ public class EntityInteractEvents { public static void updateClaim(ServerPlayer player, Claim currentClaim, Consumer cons) { Vec3 pos = player.position(); BlockPos rounded = TeleportUtils.roundedBlockPos(pos.add(0, player.getStandingEyeHeight(player.getPose(), player.getDimensions(player.getPose())), 0)); - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); if (currentClaim != null) { if (!currentClaim.intersects(player.getBoundingBox())) { boolean isSub = currentClaim.parentClaim() != null; @@ -386,9 +386,9 @@ public class EntityInteractEvents { } public static boolean preventLightningConvert(Entity entity) { - if (entity.level.isClientSide || entity instanceof Enemy) + if (entity.level().isClientSide || entity instanceof Enemy) return false; - ClaimStorage storage = ClaimStorage.get((ServerLevel) entity.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) entity.level()); IPermissionContainer claim = storage.getForPermissionCheck(entity.blockPosition()); return !claim.canInteract(null, PermissionRegistry.LIGHTNING, entity.blockPosition(), false); } diff --git a/common/src/main/java/io/github/flemmli97/flan/event/ItemInteractEvents.java b/common/src/main/java/io/github/flemmli97/flan/event/ItemInteractEvents.java index e0d33f1..206d5c1 100644 --- a/common/src/main/java/io/github/flemmli97/flan/event/ItemInteractEvents.java +++ b/common/src/main/java/io/github/flemmli97/flan/event/ItemInteractEvents.java @@ -153,11 +153,11 @@ public class ItemInteractEvents { if (data.isAdminIgnoreClaim()) return true; if (ConfigHandler.config.worldWhitelist) { - if (!cantClaimInWorld(player.getLevel())) { + if (!cantClaimInWorld(player.serverLevel())) { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("landClaimDisabledWorld"), ChatFormatting.DARK_RED), false); return false; } - } else if (cantClaimInWorld(player.getLevel())) { + } else if (cantClaimInWorld(player.serverLevel())) { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("landClaimDisabledWorld"), ChatFormatting.DARK_RED), false); return false; } @@ -169,9 +169,9 @@ public class ItemInteractEvents { player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("noPermission"), ChatFormatting.DARK_RED), true); return; } - if (!canClaimWorld(player.getLevel(), player)) + if (!canClaimWorld(player.serverLevel(), player)) return; - ClaimStorage storage = ClaimStorage.get(player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); Claim claim = storage.getClaimAt(target.offset(0, 255, 0)); PlayerClaimData data = PlayerClaimData.get(player); if (data.claimCooldown()) @@ -250,7 +250,7 @@ public class ItemInteractEvents { } public static void inspect(ServerPlayer player, BlockPos target) { - Claim claim = ClaimStorage.get(player.getLevel()).getClaimAt(target); + Claim claim = ClaimStorage.get(player.serverLevel()).getClaimAt(target); PlayerClaimData data = PlayerClaimData.get(player); if (data.claimCooldown()) return; diff --git a/common/src/main/java/io/github/flemmli97/flan/event/PlayerEvents.java b/common/src/main/java/io/github/flemmli97/flan/event/PlayerEvents.java index 6b4006f..f4125a4 100644 --- a/common/src/main/java/io/github/flemmli97/flan/event/PlayerEvents.java +++ b/common/src/main/java/io/github/flemmli97/flan/event/PlayerEvents.java @@ -48,17 +48,17 @@ public class PlayerEvents { public static boolean growBonemeal(UseOnContext context) { if (context.getPlayer() instanceof ServerPlayer serverPlayer) { - BlockState state = serverPlayer.level.getBlockState(context.getClickedPos()); + BlockState state = serverPlayer.serverLevel().getBlockState(context.getClickedPos()); BlockPos.MutableBlockPos pos = context.getClickedPos().mutable(); ClaimPermission perm = ObjectToPermissionMap.getFromItem(context.getItemInHand().getItem()); /** * {@link ItemInteractEvents#onItemUseBlock} handles this case already. * Sadly need to check again. In case its used in a claim. Less expensive than aoe check */ - if (!ClaimStorage.get(serverPlayer.getLevel()).getForPermissionCheck(pos).canInteract(serverPlayer, perm, pos, false)) + if (!ClaimStorage.get(serverPlayer.serverLevel()).getForPermissionCheck(pos).canInteract(serverPlayer, perm, pos, false)) return false; int range = 0; - Registry> registry = serverPlayer.level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE); + Registry> registry = serverPlayer.level().registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE); if (state.getBlock() instanceof MossBlock) { VegetationPatchConfiguration cfg = featureRange(registry, CaveFeatures.MOSS_PATCH_BONEMEAL, VegetationPatchConfiguration.class); if (cfg != null) { @@ -87,7 +87,7 @@ public class PlayerEvents { int y = Math.max(Math.max(h1, h2), h3); pos.set(pos.getX(), pos.getY() + y + 1, pos.getZ()); } - if (range > 0 && perm != null && !ClaimStorage.get(serverPlayer.getLevel()).canInteract(pos, range, serverPlayer, perm, false)) { + if (range > 0 && perm != null && !ClaimStorage.get(serverPlayer.serverLevel()).canInteract(pos, range, serverPlayer, perm, false)) { serverPlayer.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("tooCloseClaim"), ChatFormatting.DARK_RED), true); return true; } @@ -98,17 +98,17 @@ public class PlayerEvents { public static float canSpawnFromPlayer(Entity entity, float old) { BlockPos pos; if (entity instanceof ServerPlayer player && - !ClaimStorage.get(player.getLevel()).getForPermissionCheck(pos = player.blockPosition()).canInteract(player, PermissionRegistry.PLAYERMOBSPAWN, pos, false)) + !ClaimStorage.get(player.serverLevel()).getForPermissionCheck(pos = player.blockPosition()).canInteract(player, PermissionRegistry.PLAYERMOBSPAWN, pos, false)) return -1; return old; } public static boolean canWardenSpawnTrigger(BlockPos pos, ServerPlayer player) { - return ClaimStorage.get(player.getLevel()).getForPermissionCheck(pos).canInteract(player, PermissionRegistry.PLAYERMOBSPAWN, pos, false); + return ClaimStorage.get(player.serverLevel()).getForPermissionCheck(pos).canInteract(player, PermissionRegistry.PLAYERMOBSPAWN, pos, false); } public static boolean canSculkTrigger(BlockPos pos, ServerPlayer player) { - return ClaimStorage.get(player.getLevel()).getForPermissionCheck(pos).canInteract(player, PermissionRegistry.SCULK, pos, false); + return ClaimStorage.get(player.serverLevel()).getForPermissionCheck(pos).canInteract(player, PermissionRegistry.SCULK, pos, false); } @SuppressWarnings("unchecked") diff --git a/common/src/main/java/io/github/flemmli97/flan/event/WorldEvents.java b/common/src/main/java/io/github/flemmli97/flan/event/WorldEvents.java index c009a6c..64551d7 100644 --- a/common/src/main/java/io/github/flemmli97/flan/event/WorldEvents.java +++ b/common/src/main/java/io/github/flemmli97/flan/event/WorldEvents.java @@ -64,7 +64,7 @@ public class WorldEvents { } public static boolean canStartRaid(ServerPlayer player) { - IPermissionContainer claim = ClaimStorage.get(player.getLevel()).getForPermissionCheck(player.blockPosition()); + IPermissionContainer claim = ClaimStorage.get(player.serverLevel()).getForPermissionCheck(player.blockPosition()); return claim.canInteract(player, PermissionRegistry.RAID, player.blockPosition()); } @@ -81,7 +81,7 @@ public class WorldEvents { } public static boolean lightningFire(LightningBolt lightning) { - if (!(lightning.level instanceof ServerLevel world)) + if (!(lightning.level() instanceof ServerLevel world)) return true; BlockPos.MutableBlockPos mutable = lightning.blockPosition().mutable(); for (int x = -1; x <= 1; x++) diff --git a/common/src/main/java/io/github/flemmli97/flan/gui/ClaimMenuScreenHandler.java b/common/src/main/java/io/github/flemmli97/flan/gui/ClaimMenuScreenHandler.java index 3bdb0ca..17c0bd4 100644 --- a/common/src/main/java/io/github/flemmli97/flan/gui/ClaimMenuScreenHandler.java +++ b/common/src/main/java/io/github/flemmli97/flan/gui/ClaimMenuScreenHandler.java @@ -157,8 +157,8 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler { player.closeContainer(); player.getServer().execute(() -> ConfirmScreenHandler.openConfirmScreen(player, (bool) -> { if (bool) { - ClaimStorage storage = ClaimStorage.get(player.getLevel()); - storage.deleteClaim(this.claim, true, PlayerClaimData.get(player).getEditMode(), player.getLevel()); + ClaimStorage storage = ClaimStorage.get(player.serverLevel()); + storage.deleteClaim(this.claim, true, PlayerClaimData.get(player).getEditMode(), player.serverLevel()); player.closeContainer(); player.displayClientMessage(PermHelper.simpleColoredText(ConfigHandler.langManager.get("deleteClaim"), ChatFormatting.RED), false); ServerScreenHelper.playSongToPlayer(player, SoundEvents.ANVIL_PLACE, 1, 1f); diff --git a/common/src/main/java/io/github/flemmli97/flan/gui/ServerScreenHelper.java b/common/src/main/java/io/github/flemmli97/flan/gui/ServerScreenHelper.java index d8e30c6..d84a5ec 100644 --- a/common/src/main/java/io/github/flemmli97/flan/gui/ServerScreenHelper.java +++ b/common/src/main/java/io/github/flemmli97/flan/gui/ServerScreenHelper.java @@ -82,7 +82,7 @@ public class ServerScreenHelper { Component trans = ServerScreenHelper.coloredGuiText(pdesc, ChatFormatting.YELLOW); lore.add(StringTag.valueOf(Component.Serializer.toJson(trans))); } - Config.GlobalType global = ConfigHandler.config.getGlobal(player.getLevel(), perm); + Config.GlobalType global = ConfigHandler.config.getGlobal(player.serverLevel(), perm); if (!global.canModify()) { Component text = ServerScreenHelper.coloredGuiText(ConfigHandler.langManager.get("screenUneditable"), ChatFormatting.DARK_RED); lore.add(StringTag.valueOf(Component.Serializer.toJson(text))); @@ -105,12 +105,12 @@ public class ServerScreenHelper { public static void playSongToPlayer(ServerPlayer player, SoundEvent event, float vol, float pitch) { player.connection.send( - new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event), SoundSource.PLAYERS, player.position().x, player.position().y, player.position().z, vol, pitch, player.level.getRandom().nextLong())); + new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(event), SoundSource.PLAYERS, player.position().x, player.position().y, player.position().z, vol, pitch, player.level().getRandom().nextLong())); } public static void playSongToPlayer(ServerPlayer player, Holder event, float vol, float pitch) { player.connection.send( - new ClientboundSoundPacket(event, SoundSource.PLAYERS, player.position().x, player.position().y, player.position().z, vol, pitch, player.level.getRandom().nextLong())); + new ClientboundSoundPacket(event, SoundSource.PLAYERS, player.position().x, player.position().y, player.position().z, vol, pitch, player.level().getRandom().nextLong())); } public static Component coloredGuiText(String text, ChatFormatting... formattings) { diff --git a/common/src/main/java/io/github/flemmli97/flan/gui/StringResultScreenHandler.java b/common/src/main/java/io/github/flemmli97/flan/gui/StringResultScreenHandler.java index c9712d2..88a169f 100644 --- a/common/src/main/java/io/github/flemmli97/flan/gui/StringResultScreenHandler.java +++ b/common/src/main/java/io/github/flemmli97/flan/gui/StringResultScreenHandler.java @@ -133,8 +133,9 @@ public class StringResultScreenHandler extends AnvilMenu { } @Override - public void setItemName(String string) { + public boolean setItemName(String string) { this.name = string; this.createResult(); + return true; } } diff --git a/common/src/main/java/io/github/flemmli97/flan/mixin/AllayMixin.java b/common/src/main/java/io/github/flemmli97/flan/mixin/AllayMixin.java index 73c1342..404c95f 100644 --- a/common/src/main/java/io/github/flemmli97/flan/mixin/AllayMixin.java +++ b/common/src/main/java/io/github/flemmli97/flan/mixin/AllayMixin.java @@ -21,7 +21,7 @@ public abstract class AllayMixin { private void onWantingPickup(ItemStack stack, CallbackInfoReturnable info) { Allay allay = (Allay) (Object) this; if (AllayAi.getLikedPlayer(allay).map(p -> { - Claim claim = ClaimStorage.get(p.getLevel()).getClaimAt(allay.blockPosition()); + Claim claim = ClaimStorage.get(p.serverLevel()).getClaimAt(allay.blockPosition()); return claim != null && (!claim.canInteract(p, PermissionRegistry.PICKUP, allay.blockPosition(), false)); }).orElse(false)) info.setReturnValue(false); @@ -33,7 +33,7 @@ public abstract class AllayMixin { IOwnedItem ownedItem = (IOwnedItem) itemEntity; if (p.getUUID().equals(ownedItem.getPlayerOrigin())) return true; - Claim claim = ClaimStorage.get(p.getLevel()).getClaimAt(itemEntity.blockPosition()); + Claim claim = ClaimStorage.get(p.serverLevel()).getClaimAt(itemEntity.blockPosition()); return claim != null && !claim.canInteract(p, PermissionRegistry.PICKUP, itemEntity.blockPosition(), false); }).orElse(false)) info.cancel(); diff --git a/common/src/main/java/io/github/flemmli97/flan/mixin/DragonEggBlockMixin.java b/common/src/main/java/io/github/flemmli97/flan/mixin/DragonEggBlockMixin.java index 9c457ad..26afc98 100644 --- a/common/src/main/java/io/github/flemmli97/flan/mixin/DragonEggBlockMixin.java +++ b/common/src/main/java/io/github/flemmli97/flan/mixin/DragonEggBlockMixin.java @@ -52,7 +52,7 @@ public abstract class DragonEggBlockMixin { ClaimPermission perm = ObjectToPermissionMap.getFromBlock((DragonEggBlock) (Object) this); if (perm == null) perm = PermissionRegistry.INTERACTBLOCK; - if (!ClaimStorage.get(player.getLevel()).canInteract(pos, 16, player, perm, true)) + if (!ClaimStorage.get(player.serverLevel()).canInteract(pos, 16, player, perm, true)) info.cancel(); } } diff --git a/common/src/main/java/io/github/flemmli97/flan/mixin/SculkSensorMixin.java b/common/src/main/java/io/github/flemmli97/flan/mixin/SculkSensorMixin.java index bd87387..873f420 100644 --- a/common/src/main/java/io/github/flemmli97/flan/mixin/SculkSensorMixin.java +++ b/common/src/main/java/io/github/flemmli97/flan/mixin/SculkSensorMixin.java @@ -17,9 +17,8 @@ import javax.annotation.Nullable; @Mixin(SculkSensorBlock.class) public abstract class SculkSensorMixin { - @Inject(method = "activate", at = @At("HEAD"), cancellable = true) - private static void playerPermCheck(@Nullable Entity entity, Level level, BlockPos pos, BlockState state, int strength, CallbackInfo info) { + private void playerPermCheck(@Nullable Entity entity, Level level, BlockPos pos, BlockState state, int i, int j, CallbackInfo info) { ServerPlayer player = null; if (entity instanceof ServerPlayer p) player = p; diff --git a/common/src/main/java/io/github/flemmli97/flan/platform/integration/claiming/FTBChunks.java b/common/src/main/java/io/github/flemmli97/flan/platform/integration/claiming/FTBChunks.java deleted file mode 100644 index 5caf90e..0000000 --- a/common/src/main/java/io/github/flemmli97/flan/platform/integration/claiming/FTBChunks.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.github.flemmli97.flan.platform.integration.claiming; - -import dev.ftb.mods.ftbchunks.data.ClaimedChunk; -import dev.ftb.mods.ftbchunks.data.FTBChunksAPI; -import dev.ftb.mods.ftbchunks.data.FTBChunksTeamData; -import dev.ftb.mods.ftblibrary.math.ChunkDimPos; -import io.github.flemmli97.flan.Flan; -import io.github.flemmli97.flan.claim.Claim; -import io.github.flemmli97.flan.claim.ClaimStorage; -import io.github.flemmli97.flan.config.ConfigHandler; -import io.github.flemmli97.flan.player.display.DisplayBox; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class FTBChunks { - - public static void findConflicts(Claim claim, Set set) { - if (Flan.ftbChunks && ConfigHandler.config.ftbChunksCheck) { - ServerLevel level = claim.getWorld(); - int[] chunks = ClaimStorage.getChunkPos(claim); - Map> map = new HashMap<>(); - for (int x = chunks[0]; x <= chunks[1]; x++) - for (int z = chunks[2]; z <= chunks[3]; z++) { - ClaimedChunk chunk = FTBChunksAPI.getManager().getChunk(new ChunkDimPos(level.dimension(), x, z)); - if (chunk != null && !chunk.getTeamData().isTeamMember(claim.getOwner())) { - int blockX = x << 4; - int blockZ = z << 4; - //There is no reason to display it since ftb chunks has a map - set.add(new DisplayBox(blockX, level.getMinBuildHeight(), blockZ, blockX + 15, level.getMaxBuildHeight(), blockZ + 15, () -> true)); - } - } - } - } -} diff --git a/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/DynmapIntegration.java b/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/DynmapIntegration.java deleted file mode 100644 index 4743a8b..0000000 --- a/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/DynmapIntegration.java +++ /dev/null @@ -1,93 +0,0 @@ -package io.github.flemmli97.flan.platform.integration.webmap; - -import com.mojang.authlib.GameProfile; -import io.github.flemmli97.flan.claim.Claim; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.Level; -import org.dynmap.DynmapCommonAPI; -import org.dynmap.DynmapCommonAPIListener; -import org.dynmap.markers.AreaMarker; -import org.dynmap.markers.MarkerAPI; -import org.dynmap.markers.MarkerSet; - -import java.util.Optional; - -public class DynmapIntegration { - - private static MarkerSet markerSet; - private static final String markerID = "flan.claims", markerLabel = "Claims"; - - public static void reg() { - DynmapCommonAPIListener.register(new DynmapCommonAPIListener() { - @Override - public void apiEnabled(DynmapCommonAPI dynmapCommonAPI) { - MarkerAPI markerAPI = dynmapCommonAPI.getMarkerAPI(); - markerSet = markerAPI.createMarkerSet(markerID, markerLabel, dynmapCommonAPI.getMarkerAPI().getMarkerIcons(), false); - WebmapCalls.dynmapLoaded = true; - } - }); - } - - static void addClaimMarker(Claim claim) { - if (markerSet == null) - return; - int[] dim = claim.getDimensions(); - AreaMarker marker = markerSet.createAreaMarker(claim.getClaimID().toString(), claimLabel(claim), true, getWorldName(claim.getWorld()), new double[]{dim[0], dim[1]}, new double[]{dim[2], dim[3]}, false); - marker.setLineStyle(3, 0.8, lineColor(claim.isAdminClaim())); - marker.setFillStyle(0.2, fillColor(claim.isAdminClaim())); - } - - static void removeMarker(Claim claim) { - if (markerSet == null) - return; - AreaMarker marker = markerSet.findAreaMarker(claim.getClaimID().toString()); - if (marker != null) - marker.deleteMarker(); - } - - static void changeClaimName(Claim claim) { - if (markerSet == null) - return; - markerSet.findAreaMarker(claim.getClaimID().toString()) - .setLabel(claimLabel(claim)); - } - - static void changeClaimOwner(Claim claim) { - if (markerSet == null) - return; - if (claim.getClaimName() == null || claim.getClaimName().isEmpty()) - markerSet.findAreaMarker(claim.getClaimID().toString()) - .setLabel(claimLabel(claim)); - } - - private static String getWorldName(Level level) { - ResourceKey key = level.dimension(); - if (key == Level.OVERWORLD) { - return level.getServer().getWorldData().getLevelName(); - } else if (key == Level.END) { - return "DIM1"; - } else if (key == Level.NETHER) { - return "DIM-1"; - } - return key.location().getNamespace() + "_" + key.location().getPath(); - } - - private static int lineColor(boolean admin) { - return admin ? 0xb50909 : 0xffa200; - } - - private static int fillColor(boolean admin) { - return admin ? 0xff0000 : 0xe0e01d; - } - - private static String claimLabel(Claim claim) { - String name = claim.getClaimName(); - if (name == null || name.isEmpty()) { - if (claim.isAdminClaim()) - return "Admin Claim"; - Optional prof = claim.getWorld().getServer().getProfileCache().get(claim.getOwner()); - return prof.map(GameProfile::getName).orElse("UNKOWN") + "'s Claim"; - } - return name; - } -} \ No newline at end of file diff --git a/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/WebmapCalls.java b/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/WebmapCalls.java index 8a7e0d6..1160123 100644 --- a/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/WebmapCalls.java +++ b/common/src/main/java/io/github/flemmli97/flan/platform/integration/webmap/WebmapCalls.java @@ -4,33 +4,24 @@ import io.github.flemmli97.flan.claim.Claim; public class WebmapCalls { - public static boolean dynmapLoaded; public static boolean bluemapLoaded; public static void addClaimMarker(Claim claim) { - if (dynmapLoaded) - DynmapIntegration.addClaimMarker(claim); if (bluemapLoaded) BluemapIntegration.addClaimMarker(claim); } public static void removeMarker(Claim claim) { - if (dynmapLoaded) - DynmapIntegration.removeMarker(claim); if (bluemapLoaded) BluemapIntegration.removeMarker(claim); } public static void changeClaimName(Claim claim) { - if (dynmapLoaded) - DynmapIntegration.changeClaimName(claim); if (bluemapLoaded) BluemapIntegration.changeClaimName(claim); } public static void changeClaimOwner(Claim claim) { - if (dynmapLoaded) - DynmapIntegration.changeClaimOwner(claim); if (bluemapLoaded) BluemapIntegration.changeClaimOwner(claim); } diff --git a/common/src/main/java/io/github/flemmli97/flan/player/PlayerClaimData.java b/common/src/main/java/io/github/flemmli97/flan/player/PlayerClaimData.java index 1863eb2..3c7afb2 100644 --- a/common/src/main/java/io/github/flemmli97/flan/player/PlayerClaimData.java +++ b/common/src/main/java/io/github/flemmli97/flan/player/PlayerClaimData.java @@ -186,7 +186,7 @@ public class PlayerClaimData implements IPlayerData { public void addDisplayClaim(DisplayBox display, EnumDisplayType type, int height) { if (!display.isRemoved()) - this.displayToAdd.add(new ClaimDisplay(display, this.player.getLevel(), type, height)); + this.displayToAdd.add(new ClaimDisplay(display, this.player.serverLevel(), type, height)); } public EnumEditMode getEditMode() { @@ -205,12 +205,12 @@ public class PlayerClaimData implements IPlayerData { public void setEditingCorner(BlockPos pos) { if (pos != null) { - BlockState state = this.player.level.getBlockState(pos); - while (state.isAir() || state.getMaterial().isReplaceable()) { + BlockState state = this.player.level().getBlockState(pos); + while (state.isAir() || state.canBeReplaced()) { pos = pos.below(); - state = this.player.level.getBlockState(pos); + state = this.player.serverLevel().getBlockState(pos); } - this.cornerRenderPos = ClaimDisplay.getPosFrom(this.player.getLevel(), pos.getX(), pos.getZ(), pos.getY()); + this.cornerRenderPos = ClaimDisplay.getPosFrom(this.player.serverLevel(), pos.getX(), pos.getZ(), pos.getY()); } else this.cornerRenderPos = null; this.firstCorner = pos; @@ -238,7 +238,7 @@ public class PlayerClaimData implements IPlayerData { } public boolean editDefaultPerms(String group, ClaimPermission perm, int mode) { - if (PermissionRegistry.globalPerms().contains(perm) || ConfigHandler.config.globallyDefined(this.player.getLevel(), perm)) + if (PermissionRegistry.globalPerms().contains(perm) || ConfigHandler.config.globallyDefined(this.player.serverLevel(), perm)) return false; if (mode > 1) mode = -1; @@ -316,11 +316,11 @@ public class PlayerClaimData implements IPlayerData { if (this.tpPos != null) { BlockPos.MutableBlockPos tpTo = this.tpPos.mutable(); Vec3 offset = new Vec3(this.tpPos.getX() + 0.5, this.tpPos.getY() + 0.01, this.tpPos.getZ() + 0.5).subtract(this.player.position()); - int yHighest = this.player.level.getChunk(this.tpPos.getX() >> 4, this.tpPos.getZ() >> 4, ChunkStatus.HEIGHTMAPS).getHeight(Heightmap.Types.MOTION_BLOCKING, this.tpPos.getX() & 15, this.tpPos.getZ() & 15); + int yHighest = this.player.serverLevel().getChunk(this.tpPos.getX() >> 4, this.tpPos.getZ() >> 4, ChunkStatus.FULL).getHeight(Heightmap.Types.MOTION_BLOCKING, this.tpPos.getX() & 15, this.tpPos.getZ() & 15); AABB box = this.player.getBoundingBox().move(offset); if (tpTo.getY() < yHighest) { while (tpTo.getY() < yHighest) { - if (this.player.level.noCollision(this.player, box)) + if (this.player.serverLevel().noCollision(this.player, box)) break; tpTo.set(tpTo.getX(), tpTo.getY() + 1, tpTo.getZ()); box = box.move(0, 1, 0); @@ -333,7 +333,7 @@ public class PlayerClaimData implements IPlayerData { this.player.teleportToWithTicket(tpTo.getX() + 0.5, tpTo.getY(), tpTo.getZ() + 0.5); this.tpPos = null; } else { - Vec3 tp = TeleportUtils.getTeleportPos(this.player, this.player.position(), ClaimStorage.get(this.player.getLevel()), + Vec3 tp = TeleportUtils.getTeleportPos(this.player, this.player.position(), ClaimStorage.get(this.player.serverLevel()), ((IPlayerClaimImpl) this.player).getCurrentClaim().getDimensions(), TeleportUtils.roundedBlockPos(this.player.position()).mutable(), (claim, nPos) -> false); if (this.player.isPassenger()) @@ -408,7 +408,7 @@ public class PlayerClaimData implements IPlayerData { return false; if (this.calculateShouldDrop) { BlockPos rounded = TeleportUtils.roundedBlockPos(this.player.position().add(0, this.player.getStandingEyeHeight(this.player.getPose(), this.player.getDimensions(this.player.getPose())), 0)); - this.shouldProtectDrop = ClaimStorage.get(this.player.getLevel()).getForPermissionCheck(rounded) + this.shouldProtectDrop = ClaimStorage.get(this.player.serverLevel()).getForPermissionCheck(rounded) .canInteract(this.player, PermissionRegistry.LOCKITEMS, rounded) && !this.player.getServer().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY); this.calculateShouldDrop = false; @@ -429,7 +429,7 @@ public class PlayerClaimData implements IPlayerData { return; Map map = this.fakePlayerNotif.computeIfAbsent(claim.getClaimID(), o -> new HashMap<>()); Long last = map.get(fakePlayer.getUUID()); - if (last == null || this.player.getLevel().getGameTime() - 1200 > last) { + if (last == null || this.player.serverLevel().getGameTime() - 1200 > last) { Component claimMsg = Component.literal(String.format(ConfigHandler.langManager.get("fakePlayerNotification1"), claim.getWorld().dimension().location().toString(), pos)).withStyle(ChatFormatting.DARK_RED); this.player.sendSystemMessage(claimMsg); String cmdStr = String.format("/flan fakePlayer add %s", fakePlayer.getUUID().toString()); @@ -446,7 +446,7 @@ public class PlayerClaimData implements IPlayerData { .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(cmdStr)))); msg = Component.translatable(ConfigHandler.langManager.get("fakePlayerNotification3"), cmd); this.player.sendSystemMessage(msg); - map.put(fakePlayer.getUUID(), this.player.getLevel().getGameTime()); + map.put(fakePlayer.getUUID(), this.player.serverLevel().getGameTime()); } } @@ -551,7 +551,7 @@ public class PlayerClaimData implements IPlayerData { Flan.log("Reading grief prevention data"); File griefPrevention = server.getWorldPath(LevelResource.ROOT).resolve("plugins/GriefPreventionData/PlayerData").toFile(); if (!griefPrevention.exists()) { - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("cantFindData"), griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("cantFindData"), griefPrevention.getAbsolutePath()), ChatFormatting.DARK_RED), false); return false; } for (File f : griefPrevention.listFiles()) { @@ -586,9 +586,9 @@ public class PlayerClaimData implements IPlayerData { reader.close(); } } catch (Exception e) { - src.sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), f.getName(), ChatFormatting.RED)), false); + src.sendSuccess(() -> PermHelper.simpleColoredText(String.format(ConfigHandler.langManager.get("errorFile"), f.getName(), ChatFormatting.RED)), false); } } return true; } -} \ No newline at end of file +} diff --git a/common/src/main/java/io/github/flemmli97/flan/player/TeleportUtils.java b/common/src/main/java/io/github/flemmli97/flan/player/TeleportUtils.java index aadf81c..a354334 100644 --- a/common/src/main/java/io/github/flemmli97/flan/player/TeleportUtils.java +++ b/common/src/main/java/io/github/flemmli97/flan/player/TeleportUtils.java @@ -34,10 +34,10 @@ public class TeleportUtils { if (claim == null || check.apply(claim, bPos)) { Vec3 ret = pos.getB(); BlockPos rounded = roundedBlockPos(ret); - int y = player.getLevel().getChunk(rounded.getX() >> 4, rounded.getZ() >> 4, ChunkStatus.HEIGHTMAPS) + int y = player.level().getChunk(rounded.getX() >> 4, rounded.getZ() >> 4, ChunkStatus.FULL) .getHeight(Heightmap.Types.MOTION_BLOCKING, rounded.getX() & 15, rounded.getZ() & 15); Vec3 dest = new Vec3(ret.x, y + 1, ret.z); - if (player.level.noCollision(player, player.getBoundingBox().move(dest.subtract(player.position())))) + if (player.level().noCollision(player, player.getBoundingBox().move(dest.subtract(player.position())))) return dest; return new Vec3(rounded.getX() + 0.5, y + 1, rounded.getZ() + 0.5); } diff --git a/common/src/main/java/io/github/flemmli97/flan/player/display/ClaimDisplay.java b/common/src/main/java/io/github/flemmli97/flan/player/display/ClaimDisplay.java index a1e4a46..4a6ca7a 100644 --- a/common/src/main/java/io/github/flemmli97/flan/player/display/ClaimDisplay.java +++ b/common/src/main/java/io/github/flemmli97/flan/player/display/ClaimDisplay.java @@ -68,12 +68,12 @@ public class ClaimDisplay { return this.display.isRemoved(); DisplayBox.Box dims = this.display.box(); if (this.corners == null || this.changed(dims)) { - this.middlePoss = calculateDisplayPos(player.getLevel(), dims, this.height, this.display.excludedSides()); + this.middlePoss = calculateDisplayPos(player.serverLevel(), dims, this.height, this.display.excludedSides()); this.corners = new int[][]{ - getPosFrom(player.getLevel(), dims.minX(), dims.minZ(), this.height), - getPosFrom(player.getLevel(), dims.maxX(), dims.minZ(), this.height), - getPosFrom(player.getLevel(), dims.minX(), dims.maxZ(), this.height), - getPosFrom(player.getLevel(), dims.maxX(), dims.maxZ(), this.height), + getPosFrom(player.serverLevel(), dims.minX(), dims.minZ(), this.height), + getPosFrom(player.serverLevel(), dims.maxX(), dims.minZ(), this.height), + getPosFrom(player.serverLevel(), dims.minX(), dims.maxZ(), this.height), + getPosFrom(player.serverLevel(), dims.maxX(), dims.maxZ(), this.height), }; } for (int[] pos : this.corners) { @@ -149,15 +149,15 @@ public class ClaimDisplay { private static int[] nextAirAndWaterBlockFrom(LevelChunk chunk, int x, int y, int z) { BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(x, y, z); BlockState state = chunk.getBlockState(pos); - if (state.getMaterial().isReplaceable()) { + if (state.canBeReplaced()) { //Move Down - boolean startedInLiquid = state.getMaterial().isLiquid(); + boolean startedInLiquid = state.liquid(); boolean liquidCheck = false; int liquidHeight = pos.getY(); - while (state.getMaterial().isReplaceable() && !chunk.isOutsideBuildHeight(pos)) { + while (state.canBeReplaced() && !chunk.isOutsideBuildHeight(pos)) { pos.move(0, -1, 0); state = chunk.getBlockState(pos); - if (!startedInLiquid && !liquidCheck && state.getMaterial().isLiquid()) { + if (!startedInLiquid && !liquidCheck && state.liquid()) { liquidCheck = true; liquidHeight = pos.getY(); } @@ -166,26 +166,26 @@ public class ClaimDisplay { if (startedInLiquid) { pos.set(pos.getX(), liquidHeight + 1, pos.getZ()); state = chunk.getBlockState(pos); - while (state.getMaterial().isLiquid() && !chunk.isOutsideBuildHeight(pos)) { + while (state.liquid() && !chunk.isOutsideBuildHeight(pos)) { pos.move(0, 1, 0); state = chunk.getBlockState(pos); } - if (state.getMaterial().isReplaceable()) + if (state.canBeReplaced()) yRet[1] = pos.getY(); } return yRet; } //Move Up - while (!state.getMaterial().isReplaceable() && !chunk.isOutsideBuildHeight(pos)) { + while (!state.canBeReplaced() && !chunk.isOutsideBuildHeight(pos)) { pos.move(0, 1, 0); state = chunk.getBlockState(pos); } int[] yRet = {pos.getY(), pos.getY()}; - while (state.getMaterial().isLiquid() && !chunk.isOutsideBuildHeight(pos)) { + while (state.liquid() && !chunk.isOutsideBuildHeight(pos)) { pos.move(0, 1, 0); state = chunk.getBlockState(pos); } - if (state.getMaterial().isReplaceable()) + if (state.canBeReplaced()) yRet[1] = pos.getY(); return yRet; } diff --git a/fabric/build.gradle b/fabric/build.gradle index c9fc5b2..4861587 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -78,7 +78,7 @@ dependencies { modCompileOnly "io.github.ladysnake:PlayerAbilityLib:${rootProject.player_ability_lib}" - modCompileOnly "dev.ftb.mods:ftb-ranks-fabric:${rootProject.ftb_ranks}" + //modCompileOnly "dev.ftb.mods:ftb-ranks-fabric:${rootProject.ftb_ranks}" //modRuntimeOnly "dev.ftb.mods:ftb-chunks-fabric:${rootProject.ftb_chunks}" //CompileOnly cause too many dependency @@ -177,4 +177,4 @@ publishing { } } } -} \ No newline at end of file +} diff --git a/fabric/src/main/java/io/github/flemmli97/flan/fabric/FlanFabric.java b/fabric/src/main/java/io/github/flemmli97/flan/fabric/FlanFabric.java index 8aad502..785c1e4 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/fabric/FlanFabric.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/fabric/FlanFabric.java @@ -12,7 +12,6 @@ import io.github.flemmli97.flan.event.WorldEvents; import io.github.flemmli97.flan.fabric.integration.HarvestWithEase; import io.github.flemmli97.flan.fabric.platform.integration.playerability.PlayerAbilityEvents; import io.github.flemmli97.flan.platform.integration.webmap.BluemapIntegration; -import io.github.flemmli97.flan.platform.integration.webmap.DynmapIntegration; import io.github.flemmli97.flan.player.PlayerDataHandler; import io.github.flemmli97.flan.scoreboard.ClaimCriterias; import net.fabricmc.api.ModInitializer; @@ -71,8 +70,6 @@ public class FlanFabric implements ModInitializer { if (Flan.playerAbilityLib) PlayerAbilityEvents.register(); - if (FabricLoader.getInstance().isModLoaded("dynmap")) - DynmapIntegration.reg(); if (FabricLoader.getInstance().isModLoaded("harvestwithease")) HarvestWithEase.init(); ClaimCriterias.init(); diff --git a/fabric/src/main/java/io/github/flemmli97/flan/fabric/integration/HarvestWithEase.java b/fabric/src/main/java/io/github/flemmli97/flan/fabric/integration/HarvestWithEase.java index 0488b2f..61be999 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/fabric/integration/HarvestWithEase.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/fabric/integration/HarvestWithEase.java @@ -10,7 +10,7 @@ public class HarvestWithEase { public static void init() { HarvestWithEaseEvents.HARVEST_CHECK.register((level, blockState, blockPos, player, interactionHand, harvestCheckEvent) -> { if (player instanceof ServerPlayer serverPlayer) { - ClaimStorage storage = ClaimStorage.get(serverPlayer.getLevel()); + ClaimStorage storage = ClaimStorage.get(serverPlayer.serverLevel()); if (!storage.getForPermissionCheck(blockPos) .canInteract(serverPlayer, PermissionRegistry.BREAK, blockPos)) { harvestCheckEvent.setCanceled(true); diff --git a/fabric/src/main/java/io/github/flemmli97/flan/fabric/mixin/PlayerInteractEntityMixin.java b/fabric/src/main/java/io/github/flemmli97/flan/fabric/mixin/PlayerInteractEntityMixin.java index 5cc363f..b10cfea 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/fabric/mixin/PlayerInteractEntityMixin.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/fabric/mixin/PlayerInteractEntityMixin.java @@ -19,9 +19,9 @@ public abstract class PlayerInteractEntityMixin { @Inject(method = "interactOn", at = @At(value = "HEAD"), cancellable = true) private void interactOnEntity(Entity entity, InteractionHand interactionHand, CallbackInfoReturnable info) { - if (entity == null || !(entity.level instanceof ServerLevel)) + if (entity == null || !(entity.level() instanceof ServerLevel)) return; - InteractionResult result = EntityInteractEvents.useEntity((Player) (Object) this, entity.level, interactionHand, entity); + InteractionResult result = EntityInteractEvents.useEntity((Player) (Object) this, entity.level(), interactionHand, entity); if (result != InteractionResult.PASS) { info.setReturnValue(InteractionResult.PASS); info.cancel(); diff --git a/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/claiming/OtherClaimingModCheckImpl.java b/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/claiming/OtherClaimingModCheckImpl.java index a48a321..2ceda31 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/claiming/OtherClaimingModCheckImpl.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/claiming/OtherClaimingModCheckImpl.java @@ -5,7 +5,6 @@ import draylar.goml.api.ClaimUtils; import io.github.flemmli97.flan.Flan; import io.github.flemmli97.flan.claim.Claim; import io.github.flemmli97.flan.config.ConfigHandler; -import io.github.flemmli97.flan.platform.integration.claiming.FTBChunks; import io.github.flemmli97.flan.platform.integration.claiming.OtherClaimingModCheck; import io.github.flemmli97.flan.player.display.DisplayBox; @@ -14,7 +13,6 @@ import java.util.Set; public class OtherClaimingModCheckImpl implements OtherClaimingModCheck { public void findConflicts(Claim claim, Set set) { - FTBChunks.findConflicts(claim, set); if (Flan.gomlServer && ConfigHandler.config.gomlReservedCheck) { int[] dim = claim.getDimensions(); ClaimUtils.getClaimsInBox(claim.getWorld(), ClaimUtils.createBox(dim[0] - 1, dim[4], dim[2] - 1, dim[1] + 1, claim.getWorld().getMaxBuildHeight(), dim[3] + 1)) diff --git a/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/permissions/PermissionNodeHandlerImpl.java b/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/permissions/PermissionNodeHandlerImpl.java index ce4df43..236193b 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/permissions/PermissionNodeHandlerImpl.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/permissions/PermissionNodeHandlerImpl.java @@ -1,6 +1,5 @@ package io.github.flemmli97.flan.fabric.platform.integration.permissions; -import dev.ftb.mods.ftbranks.api.FTBRanksAPI; import io.github.flemmli97.flan.Flan; import io.github.flemmli97.flan.config.ConfigHandler; import io.github.flemmli97.flan.platform.integration.permissions.PermissionNodeHandler; @@ -18,9 +17,6 @@ public class PermissionNodeHandlerImpl implements PermissionNodeHandler { return Permissions.check(src, perm, ConfigHandler.config.permissionLevel); return Permissions.check(src, perm, true); } - if (Flan.ftbRanks && src.getEntity() instanceof ServerPlayer player) { - return FTBRanksAPI.getPermissionValue(player, perm).asBoolean().orElse(!adminCmd || player.hasPermissions(ConfigHandler.config.permissionLevel)); - } return !adminCmd || src.hasPermission(ConfigHandler.config.permissionLevel); } @@ -31,9 +27,6 @@ public class PermissionNodeHandlerImpl implements PermissionNodeHandler { return Permissions.check(src, perm, ConfigHandler.config.permissionLevel); return Permissions.check(src, perm, true); } - if (Flan.ftbRanks) { - return FTBRanksAPI.getPermissionValue(src, perm).asBoolean().orElse(!adminCmd || src.hasPermissions(ConfigHandler.config.permissionLevel)); - } return !adminCmd || src.hasPermissions(ConfigHandler.config.permissionLevel); } @@ -44,10 +37,6 @@ public class PermissionNodeHandlerImpl implements PermissionNodeHandler { int max = Options.get(src, perm, fallback, Integer::parseInt); return val <= max; } - if (Flan.ftbRanks) { - int max = FTBRanksAPI.getPermissionValue(src, perm).asInteger().orElse(fallback); - return val <= max; - } return val <= fallback; } @@ -56,9 +45,6 @@ public class PermissionNodeHandlerImpl implements PermissionNodeHandler { if (Flan.permissionAPI) { return Options.get(src, perm, fallback, Integer::parseInt); } - if (Flan.ftbRanks) { - return FTBRanksAPI.getPermissionValue(src, perm).asInteger().orElse(fallback); - } return fallback; } } diff --git a/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/playerability/PlayerAbilityEvents.java b/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/playerability/PlayerAbilityEvents.java index 89ce73a..d9306ee 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/playerability/PlayerAbilityEvents.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/fabric/platform/integration/playerability/PlayerAbilityEvents.java @@ -18,10 +18,10 @@ public class PlayerAbilityEvents { } public static boolean checkAbility(Player player, PlayerAbility ability, AbilitySource abilitySource) { - if (player.level.isClientSide) + if (player.level().isClientSide) return true; BlockPos pos = player.blockPosition(); - ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); + ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level()); IPermissionContainer claim = storage.getForPermissionCheck(pos); return claim.canInteract((ServerPlayer) player, PermissionRegistry.FLIGHT, pos, true); } diff --git a/gradle.properties b/gradle.properties index 2bb479b..52accbf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,10 @@ org.gradle.jvmargs=-Xmx3G -enabled_platforms=fabric,forge -minecraft_version=1.19.4 +enabled_platforms=fabric +minecraft_version=1.20 parchment_version=1.19.3:2023.03.12 -# Forge Properties -forge_version=45.0.59 # Fabric Properties -loader_version=0.14.17 +loader_version=0.14.21 # Mod Properties mod_version=1.8.4.3 @@ -14,7 +12,7 @@ maven_group=io.github.flemmli97 archives_base_name=flan # Dependencies -fabric_version=0.76.0+1.19.4 +fabric_version=0.83.0+1.20 fabric_permissions_api=0.2-SNAPSHOT dynmap_fabric=curse.maven:dynmap-59433:4512919 diamond_economy=curse.maven:diamondeconomy-534301:4453952 @@ -25,8 +23,6 @@ goml_reserved=curse.maven:goml-572651:4435272 minecolonies=1.19.4-1.0.1328-BETA # Not updated player_ability_lib=1.2.2 -ftb_ranks=1900.1.9-build.42 -ftb_chunks=1902.3.9-build.168 dicemcmm=curse.maven:dicemcmoney-406972:3827507 # Curse properties diff --git a/settings.gradle b/settings.gradle index 37e4376..45ea7f7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,6 +13,5 @@ pluginManagement { include("common") include("fabric") -include("forge") rootProject.name = "Flan"