Compare commits
10 Commits
ce9cff1578
...
655f735bc1
Author | SHA1 | Date |
---|---|---|
Ryan Fox | 655f735bc1 | |
Flemmli97 | 964c9db6b7 | |
Flemmli97 | 624aebe480 | |
Flemmli97 | d4502be70b | |
Flemmli97 | f5e2e84de1 | |
Flemmli97 | 23ad7dbc0a | |
Flemmli97 | 50a5262239 | |
Flemmli97 | 0c92980953 | |
Flemmli97 | 24a66f91f8 | |
Flemmli97 | a3e5a32548 |
15
Changelog.md
15
Changelog.md
|
@ -1,3 +1,18 @@
|
|||
Flan 1.8.4.3
|
||||
================
|
||||
- Update forge version to 45.0.59
|
||||
|
||||
Flan 1.8.4.2
|
||||
================
|
||||
- Fabric: Fix mixin crash
|
||||
|
||||
Flan 1.8.4.1
|
||||
================
|
||||
- Update to 1.19.4
|
||||
<i>
|
||||
- Fabric: Add harvest with ease compat
|
||||
</i>
|
||||
|
||||
Flan 1.8.4
|
||||
================
|
||||
- Fix /flan group ignoring subclaim mode
|
||||
|
|
29
build.gradle
29
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
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.datafixers.util.Pair;
|
|||
import io.github.flemmli97.flan.config.ConfigHandler;
|
||||
import io.github.flemmli97.flan.platform.CrossPlatformStuff;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.item.BoneMealItem;
|
||||
|
@ -70,7 +70,7 @@ public class ObjectToPermissionMap {
|
|||
boolean remove = sub[1].equals("NONE");
|
||||
if (s.startsWith("@")) {
|
||||
ResourceLocation res = new ResourceLocation(sub[0].substring(1));
|
||||
Optional<HolderSet.Named<Item>> t = Registry.ITEM.getTags().filter(p -> p.getFirst().location().equals(res))
|
||||
Optional<HolderSet.Named<Item>> t = BuiltInRegistries.ITEM.getTags().filter(p -> p.getFirst().location().equals(res))
|
||||
.map(Pair::getSecond).findFirst();
|
||||
t.ifPresent(holders -> holders.forEach(i -> {
|
||||
if (remove)
|
||||
|
@ -90,7 +90,7 @@ public class ObjectToPermissionMap {
|
|||
boolean remove = sub[1].equals("NONE");
|
||||
if (s.startsWith("@")) {
|
||||
ResourceLocation res = new ResourceLocation(sub[0].substring(1));
|
||||
Optional<HolderSet.Named<Block>> t = Registry.BLOCK.getTags().filter(p -> p.getFirst().location().equals(res))
|
||||
Optional<HolderSet.Named<Block>> t = BuiltInRegistries.BLOCK.getTags().filter(p -> p.getFirst().location().equals(res))
|
||||
.map(Pair::getSecond).findFirst();
|
||||
t.ifPresent(holders -> holders.forEach(i -> {
|
||||
if (remove)
|
||||
|
|
|
@ -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<Claim> all = ClaimStorage.get(creator.getLevel()).allClaimsFromPlayer(creator.getUUID());
|
||||
Collection<Claim> 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) {
|
||||
|
@ -141,13 +141,13 @@ public class Claim implements IPermissionContainer {
|
|||
}
|
||||
|
||||
private BlockPos getInitCenterPos() {
|
||||
BlockPos center = new BlockPos(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);
|
||||
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.FULL).getHeight(Heightmap.Types.MOTION_BLOCKING, center.getX() & 15, center.getZ() & 15);
|
||||
return new BlockPos(center.getX(), y + 1, center.getZ());
|
||||
}
|
||||
|
||||
private BlockPos getDefaultCenterPos() {
|
||||
BlockPos center = new BlockPos(this.minX + (this.maxX - this.minX) * 0.5, 0, this.minZ + (this.maxZ - this.minZ) * 0.5);
|
||||
BlockPos center = BlockPos.containing(this.minX + (this.maxX - this.minX) * 0.5, 0, this.minZ + (this.maxZ - this.minZ) * 0.5);
|
||||
return new BlockPos(center.getX(), 255, 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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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<File, List<File>> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.github.flemmli97.flan.claim;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.particles.DustParticleOptions;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class ParticleIndicators {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PermHelper {
|
|||
|
||||
public static Claim checkReturn(ServerPlayer player, ClaimPermission perm, Consumer<Optional<Boolean>> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,15 +156,15 @@ public class CommandClaim {
|
|||
|
||||
private static int reloadConfig(CommandContext<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<GameProfile> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> context, Collection<GameProfile> 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<Level, Collection<Claim>> 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;
|
||||
}
|
||||
|
@ -497,13 +497,13 @@ public class CommandClaim {
|
|||
private static int adminDelete(CommandContext<CommandSourceStack> context) {
|
||||
CommandSourceStack src = context.getSource();
|
||||
ClaimStorage storage = ClaimStorage.get(src.getLevel());
|
||||
Claim claim = storage.getClaimAt(new BlockPos(src.getPosition()));
|
||||
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<CommandSourceStack> 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<CommandSourceStack> context) {
|
||||
CommandSourceStack src = context.getSource();
|
||||
Collection<Claim> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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<CommandSourceStack> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,17 +24,17 @@ public class CommandHelp {
|
|||
return helpMessage(context, page, nodes);
|
||||
}
|
||||
|
||||
public static int helpMessage(CommandContext<CommandSourceStack> context, int page, Collection<CommandNode<CommandSourceStack>> nodes) {
|
||||
public static int helpMessage(CommandContext<CommandSourceStack> context, int reqPage, Collection<CommandNode<CommandSourceStack>> nodes) {
|
||||
List<String> 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<CommandSourceStack> 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;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class CommandHelpers {
|
|||
|
||||
public static CompletableFuture<Suggestions> permSuggestions(CommandContext<CommandSourceStack> context, SuggestionsBuilder build, boolean group) {
|
||||
ServerLevel world = context.getSource().getLevel();
|
||||
Claim claim = ClaimStorage.get(world).getClaimAt(new BlockPos(context.getSource().getPosition()));
|
||||
Claim claim = ClaimStorage.get(world).getClaimAt(BlockPos.containing(context.getSource().getPosition()));
|
||||
boolean admin = claim != null && claim.isAdminClaim();
|
||||
List<String> allowedPerms = new ArrayList<>();
|
||||
for (ClaimPermission perm : PermissionRegistry.getPerms()) {
|
||||
|
@ -63,7 +63,7 @@ public class CommandHelpers {
|
|||
public static CompletableFuture<Suggestions> groupSuggestion(CommandContext<CommandSourceStack> context, SuggestionsBuilder build) throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
List<String> 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();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class BuySellHandler {
|
|||
ItemEntity itemEntity = player.drop(toGive, false);
|
||||
if (itemEntity != null) {
|
||||
itemEntity.setNoPickUpDelay();
|
||||
itemEntity.setOwner(player.getUUID());
|
||||
itemEntity.setTarget(player.getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class BlockInteractEvents {
|
|||
if (owner instanceof ServerPlayer)
|
||||
player = (ServerPlayer) owner;
|
||||
} else if (entity instanceof ItemEntity) {
|
||||
Entity owner = ((ServerLevel) world).getEntity(((ItemEntity) entity).getThrower());
|
||||
Entity owner = ((ItemEntity) entity).getOwner();
|
||||
if (owner instanceof ServerPlayer)
|
||||
player = (ServerPlayer) owner;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public class BlockInteractEvents {
|
|||
return !claim.canInteract((ServerPlayer) owner, PermissionRegistry.TRAMPLE, pos, true);
|
||||
}
|
||||
} else if (entity instanceof ItemEntity) {
|
||||
Entity owner = serverWorld.getEntity(((ItemEntity) entity).getThrower());
|
||||
Entity owner = ((ItemEntity) entity).getOwner();
|
||||
if (owner instanceof ServerPlayer) {
|
||||
ClaimStorage storage = ClaimStorage.get(serverWorld);
|
||||
IPermissionContainer claim = storage.getForPermissionCheck(pos);
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.tags.DamageTypeTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
@ -119,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;
|
||||
|
@ -136,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);
|
||||
|
@ -165,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);
|
||||
}
|
||||
|
@ -188,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.isExplosion() && !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;
|
||||
|
@ -200,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) {
|
||||
|
@ -215,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)
|
||||
|
@ -236,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)
|
||||
|
@ -248,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;
|
||||
|
@ -269,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++) {
|
||||
|
@ -284,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) {
|
||||
|
@ -300,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;
|
||||
}
|
||||
|
@ -314,7 +315,7 @@ public class EntityInteractEvents {
|
|||
public static void updateClaim(ServerPlayer player, Claim currentClaim, Consumer<Claim> 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;
|
||||
|
@ -385,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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -10,8 +10,11 @@ import io.github.flemmli97.flan.player.LogoutTracker;
|
|||
import io.github.flemmli97.flan.player.PlayerClaimData;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.worldgen.features.CaveFeatures;
|
||||
import net.minecraft.data.worldgen.features.NetherFeatures;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -20,6 +23,8 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.GrassBlock;
|
||||
import net.minecraft.world.level.block.MossBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NetherForestVegetationConfig;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.TwistingVinesConfig;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.VegetationPatchConfiguration;
|
||||
|
@ -43,35 +48,46 @@ 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<ConfiguredFeature<?, ?>> registry = serverPlayer.level().registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
|
||||
if (state.getBlock() instanceof MossBlock) {
|
||||
VegetationPatchConfiguration cfg = CaveFeatures.MOSS_PATCH_BONEMEAL.value().config();
|
||||
range = cfg.xzRadius.getMaxValue() + 1;
|
||||
pos.set(pos.getX(), pos.getY() + cfg.verticalRange + 1, pos.getZ());
|
||||
VegetationPatchConfiguration cfg = featureRange(registry, CaveFeatures.MOSS_PATCH_BONEMEAL, VegetationPatchConfiguration.class);
|
||||
if (cfg != null) {
|
||||
range = cfg.xzRadius.getMaxValue() + 1;
|
||||
pos.set(pos.getX(), pos.getY() + cfg.verticalRange + 1, pos.getZ());
|
||||
}
|
||||
} else if (state.getBlock() instanceof GrassBlock) {
|
||||
range = 4;
|
||||
} else if (state.is(Blocks.CRIMSON_NYLIUM)) {
|
||||
NetherForestVegetationConfig cfg = NetherFeatures.CRIMSON_FOREST_VEGETATION_BONEMEAL.value().config();
|
||||
range = cfg.spreadWidth;
|
||||
pos.set(pos.getX(), pos.getY() + cfg.spreadHeight + 1, pos.getZ());
|
||||
NetherForestVegetationConfig cfg = featureRange(registry, NetherFeatures.CRIMSON_FOREST_VEGETATION_BONEMEAL, NetherForestVegetationConfig.class);
|
||||
if (cfg != null) {
|
||||
range = cfg.spreadWidth;
|
||||
pos.set(pos.getX(), pos.getY() + cfg.spreadHeight + 1, pos.getZ());
|
||||
}
|
||||
} else if (state.is(Blocks.WARPED_NYLIUM)) {
|
||||
NetherForestVegetationConfig cfg = NetherFeatures.WARPED_FOREST_VEGETATION_BONEMEAL.value().config();
|
||||
NetherForestVegetationConfig cfg2 = NetherFeatures.NETHER_SPROUTS_BONEMEAL.value().config();
|
||||
TwistingVinesConfig cfg3 = NetherFeatures.TWISTING_VINES_BONEMEAL.value().config();
|
||||
range = Math.max(Math.max(cfg.spreadWidth, cfg2.spreadWidth), cfg3.spreadWidth());
|
||||
int y = Math.max(Math.max(cfg.spreadHeight, cfg2.spreadHeight), cfg3.spreadHeight());
|
||||
NetherForestVegetationConfig cfg = featureRange(registry, NetherFeatures.WARPED_FOREST_VEGETATION_BONEMEAL, NetherForestVegetationConfig.class);
|
||||
NetherForestVegetationConfig cfg2 = featureRange(registry, NetherFeatures.NETHER_SPROUTS_BONEMEAL, NetherForestVegetationConfig.class);
|
||||
TwistingVinesConfig cfg3 = featureRange(registry, NetherFeatures.TWISTING_VINES_BONEMEAL, TwistingVinesConfig.class);
|
||||
int w1 = cfg == null ? 0 : cfg.spreadWidth;
|
||||
int w2 = cfg2 == null ? 0 : cfg2.spreadWidth;
|
||||
int w3 = cfg3 == null ? 0 : cfg3.spreadWidth();
|
||||
int h1 = cfg == null ? 0 : cfg.spreadHeight;
|
||||
int h2 = cfg2 == null ? 0 : cfg2.spreadHeight;
|
||||
int h3 = cfg3 == null ? 0 : cfg3.spreadHeight();
|
||||
range = Math.max(Math.max(w1, w2), w3);
|
||||
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;
|
||||
}
|
||||
|
@ -82,16 +98,25 @@ 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")
|
||||
public static <T extends FeatureConfiguration> T featureRange(Registry<ConfiguredFeature<?, ?>> registry, ResourceKey<ConfiguredFeature<?, ?>> key, Class<T> clss) {
|
||||
return registry.getHolder(key).map(r -> {
|
||||
if (clss.isInstance(r.value().config()))
|
||||
return (T) r.value().config();
|
||||
return null;
|
||||
}).orElse(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -157,8 +157,8 @@ public class ClaimMenuScreenHandler extends ServerOnlyScreenHandler<Claim> {
|
|||
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);
|
||||
|
|
|
@ -7,6 +7,8 @@ import io.github.flemmli97.flan.config.Config;
|
|||
import io.github.flemmli97.flan.config.ConfigHandler;
|
||||
import io.github.flemmli97.flan.player.PlayerClaimData;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -80,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)));
|
||||
|
@ -103,7 +105,12 @@ public class ServerScreenHelper {
|
|||
|
||||
public static void playSongToPlayer(ServerPlayer player, SoundEvent 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(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<SoundEvent> 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()));
|
||||
}
|
||||
|
||||
public static Component coloredGuiText(String text, ChatFormatting... formattings) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public abstract class AllayMixin {
|
|||
private void onWantingPickup(ItemStack stack, CallbackInfoReturnable<Boolean> 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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<DisplayBox> set) {
|
||||
if (Flan.ftbChunks && ConfigHandler.config.ftbChunksCheck) {
|
||||
ServerLevel level = claim.getWorld();
|
||||
int[] chunks = ClaimStorage.getChunkPos(claim);
|
||||
Map<FTBChunksTeamData, List<ChunkPos>> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<Level> 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<GameProfile> prof = claim.getWorld().getServer().getProfileCache().get(claim.getOwner());
|
||||
return prof.map(GameProfile::getName).orElse("UNKOWN") + "'s Claim";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<UUID, Long> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.function.BiFunction;
|
|||
public class TeleportUtils {
|
||||
|
||||
public static BlockPos roundedBlockPos(Vec3 pos) {
|
||||
return new BlockPos(pos);
|
||||
return BlockPos.containing(pos);
|
||||
}
|
||||
|
||||
public static Vec3 getTeleportPos(ServerPlayer player, Vec3 playerPos, ClaimStorage storage, int[] dim, BlockPos.MutableBlockPos bPos, BiFunction<Claim, BlockPos, Boolean> check) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,14 @@ configurations {
|
|||
developmentFabric.extendsFrom common
|
||||
}
|
||||
|
||||
loom {
|
||||
runs {
|
||||
client {
|
||||
vmArgs "-Dmixin.debug.export=true"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
|
@ -70,11 +78,9 @@ 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}"
|
||||
|
||||
modRuntimeOnly "dev.ftb.mods:ftb-chunks-fabric:${rootProject.ftb_chunks}"
|
||||
//modRuntimeOnly "dev.ftb.mods:ftb-chunks-fabric:${rootProject.ftb_chunks}"
|
||||
//CompileOnly cause too many dependency
|
||||
modCompileOnly goml_reserved
|
||||
modCompileOnly include("com.jamieswhiteshirt:rtree-3i-lite-fabric:0.3.0")
|
||||
|
@ -86,7 +92,8 @@ processResources {
|
|||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
expand "version": project.version, "homepage": curse_page_fabric,
|
||||
"mcversion": minecraft_version, "fabric_version": fabric_version
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +157,10 @@ publishing {
|
|||
classifier "sources"
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
artifact(remapApiJar)
|
||||
artifact(remapApiJar) {
|
||||
classifier "api"
|
||||
builtBy remapApiJar
|
||||
}
|
||||
artifactId project.archives_base_name
|
||||
version project.version + "-fabric"
|
||||
}
|
||||
|
@ -167,4 +177,4 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package io.github.flemmli97.flan.fabric.mixin;
|
||||
|
||||
import io.github.flemmli97.flan.event.WorldEvents;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(Level.class)
|
||||
public abstract class LevelMixin {
|
||||
|
||||
@Inject(method = "explode(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/damagesource/DamageSource;Lnet/minecraft/world/level/ExplosionDamageCalculator;DDDFZLnet/minecraft/world/level/Level$ExplosionInteraction;Z)Lnet/minecraft/world/level/Explosion;",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Explosion;explode()V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void explosionHook(Entity source, DamageSource damageSource, ExplosionDamageCalculator damageCalculator, double x, double y, double z, float radius, boolean fire, Level.ExplosionInteraction explosionInteraction, boolean spawnParticles, CallbackInfoReturnable<Explosion> info, Explosion.BlockInteraction interaction, Explosion explosion) {
|
||||
if ((Object) this instanceof ServerLevel serverLevel)
|
||||
WorldEvents.modifyExplosion(explosion, serverLevel);
|
||||
}
|
||||
}
|
|
@ -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<InteractionResult> 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();
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package io.github.flemmli97.flan.fabric.mixin;
|
||||
|
||||
import io.github.flemmli97.flan.event.WorldEvents;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(ServerLevel.class)
|
||||
public abstract class ServerWorldMixin {
|
||||
|
||||
@Inject(method = "explode", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Explosion;explode()V", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void explosionHook(Entity entity, DamageSource damageSource, ExplosionDamageCalculator explosionBehavior, double d, double e, double f, float g, boolean bl, Explosion.BlockInteraction destructionType, CallbackInfoReturnable<Explosion> info, Explosion explosion) {
|
||||
WorldEvents.modifyExplosion(explosion, (ServerLevel) (Object) this);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import io.github.flemmli97.flan.SimpleRegistryWrapper;
|
|||
import io.github.flemmli97.flan.fabric.FabricRegistryWrapper;
|
||||
import io.github.flemmli97.flan.platform.CrossPlatformStuff;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.WorldlyContainerHolder;
|
||||
|
@ -25,22 +25,22 @@ public class CrossPlatformStuffImpl implements CrossPlatformStuff {
|
|||
|
||||
@Override
|
||||
public SimpleRegistryWrapper<MobEffect> registryStatusEffects() {
|
||||
return new FabricRegistryWrapper<>(Registry.MOB_EFFECT);
|
||||
return new FabricRegistryWrapper<>(BuiltInRegistries.MOB_EFFECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleRegistryWrapper<Block> registryBlocks() {
|
||||
return new FabricRegistryWrapper<>(Registry.BLOCK);
|
||||
return new FabricRegistryWrapper<>(BuiltInRegistries.BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleRegistryWrapper<Item> registryItems() {
|
||||
return new FabricRegistryWrapper<>(Registry.ITEM);
|
||||
return new FabricRegistryWrapper<>(BuiltInRegistries.ITEM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleRegistryWrapper<EntityType<?>> registryEntities() {
|
||||
return new FabricRegistryWrapper<>(Registry.ENTITY_TYPE);
|
||||
return new FabricRegistryWrapper<>(BuiltInRegistries.ENTITY_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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<DisplayBox> 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))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"Flemmli97"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/flan",
|
||||
"homepage": "${homepage}",
|
||||
"issues": "https://github.com/Flemmli97/Flan/issues",
|
||||
"sources": "https://github.com/Flemmli97/Flan"
|
||||
},
|
||||
|
@ -25,7 +25,7 @@
|
|||
"flan.fabric.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabric": ">=0.57.0",
|
||||
"minecraft": ">=1.19"
|
||||
"fabric": ">=${fabric_version}",
|
||||
"minecraft": ">=${mcversion}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"package": "io.github.flemmli97.flan.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"mixins": [
|
||||
"ServerWorldMixin",
|
||||
"LevelMixin",
|
||||
"SpawnHelperMixin",
|
||||
"PlayerInteractEntityMixin",
|
||||
"ProjectileMixin",
|
||||
|
|
|
@ -38,7 +38,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
forge "net.minecraftforge:forge:${rootProject.forge_version}"
|
||||
forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
||||
|
@ -46,7 +46,7 @@ dependencies {
|
|||
modCompileOnly "dev.ftb.mods:ftb-ranks-forge:${ftb_ranks}"
|
||||
modCompileOnly dicemcmm
|
||||
|
||||
modRuntimeOnly "dev.ftb.mods:ftb-chunks-forge:${rootProject.ftb_chunks}"
|
||||
//modRuntimeOnly "dev.ftb.mods:ftb-chunks-forge:${rootProject.ftb_chunks}"
|
||||
//CompileOnly cause dependencies
|
||||
modCompileOnly "com.ldtteam:minecolonies:${rootProject.minecolonies}"
|
||||
}
|
||||
|
@ -54,8 +54,10 @@ dependencies {
|
|||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
def loader_version = (forge_version =~ /([0-9]+)\.([0-9]+)\.([0-9]+)/)[0][1]
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand "version": project.version
|
||||
expand "version": project.version, "loader_version": loader_version, "homepage": curse_page_forge,
|
||||
"mcversion": minecraft_version, "forge_version": forge_version
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +116,10 @@ publishing {
|
|||
classifier "sources"
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
artifact(remapApiJar)
|
||||
artifact(remapApiJar) {
|
||||
classifier "api"
|
||||
builtBy remapApiJar
|
||||
}
|
||||
artifactId project.archives_base_name
|
||||
version project.version + "-forge"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.github.flemmli97.flan.forge.forgeevent;
|
|||
|
||||
import io.github.flemmli97.flan.event.WorldEvents;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.living.MobSpawnEvent;
|
||||
import net.minecraftforge.event.level.ExplosionEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class WorldEventsForge {
|
|||
WorldEvents.modifyExplosion(event.getExplosion(), (ServerLevel) event.getLevel());
|
||||
}
|
||||
|
||||
public static void preventMobSpawn(LivingSpawnEvent.CheckSpawn event) {
|
||||
public static void preventMobSpawn(MobSpawnEvent.FinalizeSpawn event) {
|
||||
if (!(event.getLevel() instanceof ServerLevel))
|
||||
return;
|
||||
if (WorldEvents.preventMobSpawn((ServerLevel) event.getLevel(), event.getEntity()))
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
modLoader="javafml"
|
||||
loaderVersion="[41,)"
|
||||
loaderVersion="[${loader_version},)"
|
||||
license="All rights reserved"
|
||||
issueTrackerURL="https://github.com/Flemmli97/Flan/issues"
|
||||
[[mods]]
|
||||
modId="flan"
|
||||
version="${version}"
|
||||
displayName="Flan"
|
||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/flan-forge"
|
||||
displayURL="${homepage}"
|
||||
logoFile="icon.png"
|
||||
authors="Flemmli97"
|
||||
description='''Flan (Forge version): A serverside claiming mod'''
|
||||
[[dependencies.flan]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.19,)"
|
||||
versionRange="[${mcversion},)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.flan]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[41.1.0,)"
|
||||
versionRange="[${forge_version},)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
|
|
@ -1,36 +1,32 @@
|
|||
org.gradle.jvmargs=-Xmx2G
|
||||
enabled_platforms=fabric,forge
|
||||
minecraft_version=1.19.2
|
||||
parchment_version=1.19.2:2022.11.27
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
enabled_platforms=fabric
|
||||
minecraft_version=1.20
|
||||
parchment_version=1.19.3:2023.03.12
|
||||
|
||||
# Forge Properties
|
||||
forge_version=1.19.2-43.2.3
|
||||
# Fabric Properties
|
||||
loader_version=0.14.11
|
||||
loader_version=0.14.21
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.8.4
|
||||
mod_version=1.8.4.3
|
||||
maven_group=io.github.flemmli97
|
||||
archives_base_name=flan
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.70.0+1.19.2
|
||||
fabric_version=0.83.0+1.20
|
||||
fabric_permissions_api=0.2-SNAPSHOT
|
||||
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
|
||||
dynmap_fabric=curse.maven:dynmap-59433:3840510
|
||||
diamond_economy=curse.maven:diamondeconomy-534301:3837320
|
||||
harvest_with_ease_fabric=curse.maven:harvestwithease-602171:4442026
|
||||
#
|
||||
dynmap_fabric=curse.maven:dynmap-59433:4512919
|
||||
diamond_economy=curse.maven:diamondeconomy-534301:4453952
|
||||
harvest_with_ease_fabric=curse.maven:harvestwithease-602171:4487309
|
||||
octo_economy_api=com.github.ExcessiveAmountsOfZombies:OctoEconomyApi:5137175b1c
|
||||
eights_economy=curse.maven:eightseconomy-559967:3836124
|
||||
goml_reserved=curse.maven:goml-572651:4105762
|
||||
minecolonies=1.19.2-1.0.999-ALPHA
|
||||
eights_economy=curse.maven:eightseconomy-559967:4520933
|
||||
goml_reserved=curse.maven:goml-572651:4435272
|
||||
minecolonies=1.19.4-1.0.1328-BETA
|
||||
# Not updated
|
||||
player_ability_lib=1.2.2
|
||||
dicemcmm=curse.maven:dicemcmoney-406972:3827507
|
||||
|
||||
# Curse properties
|
||||
curse_versions=1.19, 1.19.1, 1.19.2, Java 17
|
||||
curse_versions=1.19.4, Java 17
|
||||
curse_page_fabric=https://www.curseforge.com/minecraft/mc-mods/flan
|
||||
curse_id_fabric=404578
|
||||
curse_dep_fabric=fabric-api
|
||||
|
@ -40,5 +36,5 @@ curse_dep_forge=
|
|||
|
||||
# Other
|
||||
project_name=Flan
|
||||
full_changelog=https://github.com/Flemmli97/Flan/blob/1.19/Changelog.md
|
||||
full_changelog=https://github.com/Flemmli97/Flan/blob/1.19.4/Changelog.md
|
||||
discord_role=852113509243682817
|
||||
|
|
|
@ -13,6 +13,5 @@ pluginManagement {
|
|||
|
||||
include("common")
|
||||
include("fabric")
|
||||
include("forge")
|
||||
|
||||
rootProject.name = "Flan"
|
||||
|
|
Loading…
Reference in New Issue