Search in sources :

Example 1 with TileEntityKeycardReader

use of org.freeforums.geforce.securitycraft.tileentity.TileEntityKeycardReader in project SecurityCraft by Geforce132.

the class HelpfulMethods method checkForModule.

public static boolean checkForModule(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, EnumCustomModules module) {
    TileEntity te = par1World.getTileEntity(par2, par3, par4);
    if (te == null || !(te instanceof CustomizableSCTE)) {
        return false;
    }
    if (te instanceof TileEntityKeypad) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been whitelisted on this keypad.", EnumChatFormatting.GREEN);
            new ScheduleUpdate(par1World, 3, par2, par3, par4);
            return true;
        }
        if (module == EnumCustomModules.BLACKLIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.BLACKLIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.BLACKLIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been blacklisted on this keypad.", EnumChatFormatting.RED);
            return true;
        }
    } else if (te instanceof TileEntityKeycardReader) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been whitelisted on this reader.", EnumChatFormatting.GREEN);
            ((TileEntityKeycardReader) te).setIsProvidingPower(true);
            new ScheduleKeycardUpdate(3, par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4));
            par1World.notifyBlocksOfNeighborChange(par2, par3, par4, par1World.getBlock(par2, par3, par4));
            return true;
        }
        if (module == EnumCustomModules.BLACKLIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.BLACKLIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.BLACKLIST).contains(par5EntityPlayer.getCommandSenderName())) {
            HelpfulMethods.sendMessageToPlayer(par5EntityPlayer, "You have been blacklisted on this reader.", EnumChatFormatting.RED);
            return true;
        }
    } else if (te instanceof TileEntityRetinalScanner) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            return true;
        }
    } else if (te instanceof TileEntityInventoryScanner) {
        if (module == EnumCustomModules.WHITELIST && ((CustomizableSCTE) te).hasModule(EnumCustomModules.WHITELIST) && HelpfulMethods.getPlayersFromModule(par1World, par2, par3, par4, EnumCustomModules.WHITELIST).contains(par5EntityPlayer.getCommandSenderName())) {
            return true;
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) CustomizableSCTE(org.freeforums.geforce.securitycraft.tileentity.CustomizableSCTE) TileEntityRetinalScanner(org.freeforums.geforce.securitycraft.tileentity.TileEntityRetinalScanner) ScheduleUpdate(org.freeforums.geforce.securitycraft.timers.ScheduleUpdate) TileEntityInventoryScanner(org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner) ScheduleKeycardUpdate(org.freeforums.geforce.securitycraft.timers.ScheduleKeycardUpdate) TileEntityKeycardReader(org.freeforums.geforce.securitycraft.tileentity.TileEntityKeycardReader) TileEntityKeypad(org.freeforums.geforce.securitycraft.tileentity.TileEntityKeypad)

Aggregations

TileEntity (net.minecraft.tileentity.TileEntity)1 CustomizableSCTE (org.freeforums.geforce.securitycraft.tileentity.CustomizableSCTE)1 TileEntityInventoryScanner (org.freeforums.geforce.securitycraft.tileentity.TileEntityInventoryScanner)1 TileEntityKeycardReader (org.freeforums.geforce.securitycraft.tileentity.TileEntityKeycardReader)1 TileEntityKeypad (org.freeforums.geforce.securitycraft.tileentity.TileEntityKeypad)1 TileEntityRetinalScanner (org.freeforums.geforce.securitycraft.tileentity.TileEntityRetinalScanner)1 ScheduleKeycardUpdate (org.freeforums.geforce.securitycraft.timers.ScheduleKeycardUpdate)1 ScheduleUpdate (org.freeforums.geforce.securitycraft.timers.ScheduleUpdate)1