mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-21 20:42:09 +00:00
Streamline codepaths and add SU compat for permission checking
This commit is contained in:
1 parent
bd76be4f6f
commit
5b0b9ba3c5
5 files changed
+211
-154
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package com.gtnewhorizon.structurelib.xmod;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import serverutils.data.ClaimedChunks;
|
||||
import serverutils.lib.data.ForgePlayer;
|
||||
import serverutils.lib.data.ForgeTeam;
|
||||
import serverutils.lib.data.Universe;
|
||||
import serverutils.lib.math.ChunkDimPos;
|
||||
|
||||
public class ServerUtilitiesCompat {
|
||||
|
||||
@Optional.Method(modid = "serverutilities")
|
||||
public static boolean checkPermission(World world, EntityPlayer actor, int x, int z) {
|
||||
final ForgeTeam owningTeam = ClaimedChunks.instance.getChunkTeam(new ChunkDimPos(x >> 4, z >> 4, world.provider.dimensionId));
|
||||
if (owningTeam == null) {
|
||||
return true;
|
||||
}
|
||||
final ForgePlayer currentPlayer = new ForgePlayer(Universe.get(), actor.getUniqueID(), actor.getCommandSenderName());
|
||||
return owningTeam.isAlly(currentPlayer) || owningTeam.isMember(currentPlayer);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user