mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
This commit is contained in:
1 parent
6a1657eaa6
commit
890bc954d4
1 file changed
+11
@@ -4,6 +4,7 @@ import java.util.UUID;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.MekanismClient;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.config.MekanismConfig.general;
|
||||
import mekanism.common.frequency.Frequency;
|
||||
import mekanism.common.security.IOwnerItem;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
@@ -20,6 +21,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
public final class SecurityUtils {
|
||||
|
||||
public static boolean canAccess(EntityPlayer player, ItemStack stack) {
|
||||
// If protection is disabled, access is always granted
|
||||
if (!general.allowProtection) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(stack.getItem() instanceof ISecurityItem) && stack.getItem() instanceof IOwnerItem) {
|
||||
UUID owner = ((IOwnerItem) stack.getItem()).getOwnerUUID(stack);
|
||||
|
||||
@@ -54,6 +60,11 @@ public final class SecurityUtils {
|
||||
}
|
||||
|
||||
private static boolean canAccess(SecurityMode mode, EntityPlayer player, UUID owner) {
|
||||
// If protection is disabled, access is always granted
|
||||
if (!general.allowProtection) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (owner == null || player.getUniqueID().equals(owner)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user