Skip to content

Commit

Permalink
hotfix 10253 and 10250
Browse files Browse the repository at this point in the history
Apiary and permissions
  • Loading branch information
Raycoms committed Sep 22, 2024
1 parent a0b0e8d commit f099f7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.RegistryFriendlyByteBuf;
Expand Down Expand Up @@ -106,16 +107,23 @@ public int getMaxBuildingLevel()
public void deserializeNBT(@NotNull final HolderLookup.Provider provider, final CompoundTag compound)
{
super.deserializeNBT(provider, compound);
NBTUtils.streamCompound(compound.getList(NbtTagConstants.TAG_HIVES, Tag.TAG_COMPOUND))
.map(NBTUtils::readBlockPos)
.forEach(this.hives::add);
final ListTag hiveTag = compound.getList(NbtTagConstants.TAG_HIVES, Tag.TAG_INT_ARRAY);
for (Tag tag : hiveTag)
{
hives.add(NBTUtils.readBlockPos(tag));
}
}

@Override
public CompoundTag serializeNBT(@NotNull final HolderLookup.Provider provider)
{
final CompoundTag nbt = super.serializeNBT(provider);
nbt.put(NbtTagConstants.TAG_HIVES, this.hives.stream().map(NBTUtils::writeBlockPos).collect(NBTUtils.toListNBT()));
@NotNull final ListTag hivesTag = new ListTag();
for (@NotNull final BlockPos entry : hives)
{
hivesTag.add(NBTUtils.writeBlockPos(entry));
}
nbt.put(NbtTagConstants.TAG_HIVES, hivesTag);
return nbt;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ protected ChangePlayerRank(final RegistryFriendlyByteBuf buf, final PlayMessageT
protected void onExecute(final IPayloadContext ctxIn, final ServerPlayer player, final IColony colony)
{
final Rank rank = colony.getPermissions().getRanks().get(rankId);
if (rank != colony.getPermissions().getRankOwner())
{
return;
}
if (colony.getPermissions().hasPermission(player, Action.EDIT_PERMISSIONS) && rank != colony.getPermissions().getRankOwner())
{
colony.getPermissions().setPlayerRank(playerID, rank, colony.getWorld());
Expand Down

0 comments on commit f099f7c

Please sign in to comment.