diff --git a/Changelog.md b/Changelog.md index c2fd204..e3d2ec8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +Flan 1.6.4 +====================== +- Add back all integrations with other mods + This assumes no breaking changes between the 1.17 version of those mods and 1.18 + FTBRanks integration for forge still missing + Flan 1.6.3 ====================== - Port to 1.18 diff --git a/fabric/build.gradle b/fabric/build.gradle index 5afddf9..f2f3df3 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -51,15 +51,19 @@ dependencies { common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } -/* + modImplementation "me.lucko:fabric-permissions-api:${rootProject.fabric_permissions_api}" - modCompileOnly "io.github.gunpowder:gunpowder-api:${rootProject.gunpowder_version}" - modRuntime "io.github.gunpowder:gunpowder-base:${rootProject.gunpowder_version}" - modRuntime "io.github.gunpowder:gunpowder-currency:${rootProject.gunpowder_currency_version}" + modCompileOnly("io.github.gunpowder:gunpowder-api:${rootProject.gunpowder_version}") { //Might need changes later + exclude group: "com.google.guava", module:"failureaccess" + } + modRuntime("io.github.gunpowder:gunpowder-base:${rootProject.gunpowder_version}") { + exclude group: "com.google.guava", module:"failureaccess" + } + modRuntime("io.github.gunpowder:gunpowder-currency:${rootProject.gunpowder_currency_version}") modImplementation "io.github.ladysnake:PlayerAbilityLib:${rootProject.player_ability_lib}" - modImplementation("dev.ftb.mods:ftb-ranks-fabric:1605.1.2-build.17")*/ + modImplementation("dev.ftb.mods:ftb-ranks-fabric:${rootProject.ftb_ranks}") } processResources { diff --git a/fabric/src/main/java/io/github/flemmli97/flan/integration/currency/fabric/CommandCurrencyImpl.java b/fabric/src/main/java/io/github/flemmli97/flan/integration/currency/fabric/CommandCurrencyImpl.java index 7c6abaa..d903827 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/integration/currency/fabric/CommandCurrencyImpl.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/integration/currency/fabric/CommandCurrencyImpl.java @@ -1,14 +1,21 @@ package io.github.flemmli97.flan.integration.currency.fabric; import com.mojang.brigadier.Command; +import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; import io.github.flemmli97.flan.Flan; import io.github.flemmli97.flan.claim.PermHelper; import io.github.flemmli97.flan.config.ConfigHandler; +import io.github.flemmli97.flan.player.PlayerClaimData; +import io.github.gunpowder.api.GunpowderMod; +import io.github.gunpowder.api.module.currency.dataholders.StoredBalance; +import io.github.gunpowder.api.module.currency.modelhandlers.BalanceHandler; import net.minecraft.ChatFormatting; import net.minecraft.commands.CommandSourceStack; +import java.math.BigDecimal; + public class CommandCurrencyImpl { public static int sellClaimBlocks(CommandContext context) throws CommandSyntaxException { @@ -16,7 +23,7 @@ public class CommandCurrencyImpl { context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false); return 0; } - /*if (ConfigHandler.config.sellPrice == -1) { + if (ConfigHandler.config.sellPrice == -1) { context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.sellDisabled, ChatFormatting.DARK_RED), false); return 0; } @@ -30,7 +37,7 @@ public class CommandCurrencyImpl { BigDecimal price = BigDecimal.valueOf(amount * ConfigHandler.config.sellPrice); bal.setBalance(bal.getBalance().add(price)); data.setAdditionalClaims(data.getAdditionalClaims() - amount); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false);*/ + context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } @@ -39,7 +46,7 @@ public class CommandCurrencyImpl { context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false); return 0; } - /*if (ConfigHandler.config.buyPrice == -1) { + if (ConfigHandler.config.buyPrice == -1) { context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyDisabled, ChatFormatting.DARK_RED), false); return 0; } @@ -53,7 +60,7 @@ public class CommandCurrencyImpl { context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.buySuccess, amount, price), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false);*/ + context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false); return 0; } } diff --git a/fabric/src/main/java/io/github/flemmli97/flan/integration/permissions/fabric/PermissionNodeHandlerImpl.java b/fabric/src/main/java/io/github/flemmli97/flan/integration/permissions/fabric/PermissionNodeHandlerImpl.java index b9c0bc2..f3e42a0 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/integration/permissions/fabric/PermissionNodeHandlerImpl.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/integration/permissions/fabric/PermissionNodeHandlerImpl.java @@ -1,13 +1,16 @@ package io.github.flemmli97.flan.integration.permissions.fabric; +import dev.ftb.mods.ftbranks.api.FTBRanksAPI; +import io.github.flemmli97.flan.Flan; import io.github.flemmli97.flan.config.ConfigHandler; +import me.lucko.fabric.api.permissions.v0.Permissions; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.level.ServerPlayer; public class PermissionNodeHandlerImpl { public static boolean perm(CommandSourceStack src, String perm, boolean adminCmd) { - /*if (Flan.permissionAPI) { + if (Flan.permissionAPI) { if (adminCmd) return Permissions.check(src, perm, ConfigHandler.config.permissionLevel); return Permissions.check(src, perm, true); @@ -15,27 +18,27 @@ public class PermissionNodeHandlerImpl { if (Flan.ftbRanks && src.getEntity() instanceof ServerPlayer) { ServerPlayer player = (ServerPlayer) src.getEntity(); return FTBRanksAPI.getPermissionValue(player, perm).asBoolean().orElse(!adminCmd || player.hasPermissions(ConfigHandler.config.permissionLevel)); - }*/ + } return !adminCmd || src.hasPermission(ConfigHandler.config.permissionLevel); } public static boolean perm(ServerPlayer src, String perm, boolean adminCmd) { - /*if (Flan.permissionAPI) { + if (Flan.permissionAPI) { if (adminCmd) 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); } public static boolean permBelowEqVal(ServerPlayer src, String perm, int val, int fallback) { - /*if (Flan.ftbRanks) { + if (Flan.ftbRanks) { int max = FTBRanksAPI.getPermissionValue(src, perm).asInteger().orElse(fallback); return val <= max; - }*/ + } return val <= fallback; } } diff --git a/fabric/src/main/java/io/github/flemmli97/flan/integration/playerability/PlayerAbilityEvents.java b/fabric/src/main/java/io/github/flemmli97/flan/integration/playerability/PlayerAbilityEvents.java index 618c486..5d02c2a 100644 --- a/fabric/src/main/java/io/github/flemmli97/flan/integration/playerability/PlayerAbilityEvents.java +++ b/fabric/src/main/java/io/github/flemmli97/flan/integration/playerability/PlayerAbilityEvents.java @@ -1,17 +1,28 @@ package io.github.flemmli97.flan.integration.playerability; +import io.github.flemmli97.flan.api.data.IPermissionContainer; +import io.github.flemmli97.flan.api.permission.PermissionRegistry; +import io.github.flemmli97.flan.claim.ClaimStorage; +import io.github.ladysnake.pal.AbilitySource; +import io.github.ladysnake.pal.PlayerAbility; +import io.github.ladysnake.pal.PlayerAbilityEnableCallback; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; + public class PlayerAbilityEvents { public static void register() { - //PlayerAbilityEnableCallback.EVENT.register(PlayerAbilityEvents::checkAbility); + PlayerAbilityEnableCallback.EVENT.register(PlayerAbilityEvents::checkAbility); } - /*public static boolean checkAbility(Player player, PlayerAbility ability, AbilitySource abilitySource) { + public static boolean checkAbility(Player player, PlayerAbility ability, AbilitySource abilitySource) { if (player.level.isClientSide) return true; BlockPos pos = player.blockPosition(); ClaimStorage storage = ClaimStorage.get((ServerLevel) player.level); IPermissionContainer claim = storage.getForPermissionCheck(pos); return claim.canInteract((ServerPlayer) player, PermissionRegistry.FLIGHT, pos, true); - }*/ + } } diff --git a/forge/build.gradle b/forge/build.gradle index ffad1ab..002cc11 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -39,8 +39,8 @@ dependencies { common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } - //modImplementation("dev.ftb.mods:ftb-ranks-forge:${ftb_ranks}") - //modImplementation(dicemcmm) + modImplementation("dev.ftb.mods:ftb-ranks-forge:${ftb_ranks}") + modImplementation(dicemcmm) } processResources { diff --git a/forge/src/main/java/io/github/flemmli97/flan/integration/currency/forge/CommandCurrencyImpl.java b/forge/src/main/java/io/github/flemmli97/flan/integration/currency/forge/CommandCurrencyImpl.java index 4f515f7..52cc963 100644 --- a/forge/src/main/java/io/github/flemmli97/flan/integration/currency/forge/CommandCurrencyImpl.java +++ b/forge/src/main/java/io/github/flemmli97/flan/integration/currency/forge/CommandCurrencyImpl.java @@ -1,14 +1,24 @@ package io.github.flemmli97.flan.integration.currency.forge; import com.mojang.brigadier.Command; +import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import dicemc.money.MoneyMod; +import dicemc.money.storage.MoneyWSD; +import io.github.flemmli97.flan.Flan; +import io.github.flemmli97.flan.claim.PermHelper; +import io.github.flemmli97.flan.config.ConfigHandler; +import io.github.flemmli97.flan.player.PlayerClaimData; +import net.minecraft.ChatFormatting; import net.minecraft.commands.CommandSourceStack; +import java.util.UUID; + public class CommandCurrencyImpl { public static int sellClaimBlocks(CommandContext context) throws CommandSyntaxException { - /*if (!Flan.diceMCMoneySign) { + if (!Flan.diceMCMoneySign) { context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false); return 0; } @@ -25,12 +35,12 @@ public class CommandCurrencyImpl { double price = amount * ConfigHandler.config.sellPrice; MoneyWSD.get(context.getSource().getLevel()).changeBalance(MoneyMod.AcctTypes.PLAYER.key, context.getSource().getPlayerOrException().getUUID(), price); data.setAdditionalClaims(data.getAdditionalClaims() - amount); - context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false);*/ + context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.sellSuccess, amount, price), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } public static int buyClaimBlocks(CommandContext context) throws CommandSyntaxException { - /*if (!Flan.diceMCMoneySign) { + if (!Flan.diceMCMoneySign) { context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.currencyMissing, ChatFormatting.DARK_RED), false); return 0; } @@ -50,7 +60,7 @@ public class CommandCurrencyImpl { context.getSource().sendSuccess(PermHelper.simpleColoredText(String.format(ConfigHandler.lang.buySuccess, amount, price), ChatFormatting.GOLD), false); return Command.SINGLE_SUCCESS; } - context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false);*/ + context.getSource().sendSuccess(PermHelper.simpleColoredText(ConfigHandler.lang.buyFail, ChatFormatting.DARK_RED), false); return 0; } } diff --git a/gradle.properties b/gradle.properties index f9b49ff..b22ae88 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,8 +21,8 @@ gunpowder_version=0.5.7+1.16.5 gunpowder_currency_version=1.0.2+gunpowder.0.3.7.mc.1.16.5 fabric_permissions_api=0.1-SNAPSHOT player_ability_lib=1.2.2 -ftb_ranks=1605.1.2-build.17 -dicemcmm=curse.maven:dicemcmoney-406972:3397211 +ftb_ranks=1605.1.5-build.16 +dicemcmm=curse.maven:dicemcmoney-406972:3548047 # Curse properties curse_versions=1.18, Java 17