add back most mod integrations

This commit is contained in:
Flemmli97 2021-12-05 13:21:22 +01:00
parent 83c2a03b92
commit dd40e04fb4
8 changed files with 67 additions and 26 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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<CommandSourceStack> 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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}*/
}
}

View File

@ -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 {

View File

@ -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<CommandSourceStack> 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<CommandSourceStack> 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;
}
}

View File

@ -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