本文整理匯總了Java中vg.civcraft.mc.namelayer.permission.PermissionType類的典型用法代碼示例。如果您正苦於以下問題:Java PermissionType類的具體用法?Java PermissionType怎麽用?Java PermissionType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PermissionType類屬於vg.civcraft.mc.namelayer.permission包,在下文中一共展示了PermissionType類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isPlayerInUnpermittedBastion
import vg.civcraft.mc.namelayer.permission.PermissionType; //導入依賴的package包/類
@Override
public boolean isPlayerInUnpermittedBastion(Player player) {
if (!isBastionEnabled()) {
return false;
}
try {
final BastionBlockManager manager = Bastion.getBastionManager();
Set<BastionBlock> bastions = manager.getBlockingBastions(player.getLocation());
PermissionType perm = PermissionType.getPermission(NameLayerPermissions.BASTION_ALLOW_EXILED);
for (BastionBlock bastion : bastions) {
if (!bastion.permAccess(player, perm)) {
return true;
}
}
} catch(Exception ex) {
ex.printStackTrace();
}
return false;
}
示例2: getPlayerInUnpermittedBastion
import vg.civcraft.mc.namelayer.permission.PermissionType; //導入依賴的package包/類
@Override
public List<BastionWrapper> getPlayerInUnpermittedBastion(Player player) {
if (!isBastionEnabled()) {
return new ArrayList<>();
}
try {
final BastionBlockManager manager = Bastion.getBastionManager();
Set<BastionBlock> bastions = manager.getBlockingBastions(player.getLocation());
List<BastionWrapper> wrapper = new LinkedList<>();
PermissionType perm = PermissionType.getPermission(NameLayerPermissions.BASTION_ALLOW_EXILED);
for (BastionBlock bastion : bastions) {
if (!bastion.permAccess(player, perm)) {
wrapper.add(new BastionWrapper(bastion));
}
}
return wrapper;
} catch(Exception ex) {
ex.printStackTrace();
}
return new ArrayList<>();
}
示例3: init
import vg.civcraft.mc.namelayer.permission.PermissionType; //導入依賴的package包/類
public void init() {
this.blockManager = Bastion.getBastionManager();
this.groupManager = Bastion.getGroupManager();
LinkedList <PlayerType> memberAndAbove = new LinkedList<PlayerType>();
memberAndAbove.add(PlayerType.MEMBERS);
memberAndAbove.add(PlayerType.MODS);
memberAndAbove.add(PlayerType.ADMINS);
memberAndAbove.add(PlayerType.OWNER);
PermissionType.registerPermission(PERMISSION_UNDRAW, memberAndAbove, "Allows undrawing bridges/gates above bastions");
}
示例4: hasBastionAccess
import vg.civcraft.mc.namelayer.permission.PermissionType; //導入依賴的package包/類
private boolean hasBastionAccess(List<Player> players, Block block, ICitadel citadel) {
PermissionType perm = PermissionType.getPermission(PERMISSION_UNDRAW);
Location loc = block.getLocation();
Set<BastionBlock> bastions = this.blockManager.getBlockingBastions(loc);
if (bastions == null) return true;
ReinforcementManager reinManager = Citadel.getReinforcementManager();
Group citadelGroup = citadel.getGroupName() != null ? GroupManager.getGroup(citadel.getGroupName()) : null;
for(BastionBlock bastion : bastions) {
if(bastion.getType().isOnlyDirectDestruction() || !bastion.inField(loc)) continue;
Reinforcement rein = reinManager.getReinforcement(bastion.getLocation());
PlayerReinforcement playerRein = rein != null && (rein instanceof PlayerReinforcement) ? (PlayerReinforcement)rein : null;
if(playerRein == null) continue;
if(players == null) return false;
if(citadel.useJukeAlert() && !citadel.getGroupName().equalsIgnoreCase(playerRein.getGroup().getName())) {
return false;
} else if(citadelGroup == null || !this.groupManager.isAllowedGroup(playerRein.getGroup(), citadelGroup)) {
boolean hasAccess = false;
for (Player player : players) {
if (bastion.permAccess(player, perm)) {
hasAccess = true;
break;
}
}
if (!hasAccess) return false;
}
}
return true;
}
示例5: registerBastionPermissions
import vg.civcraft.mc.namelayer.permission.PermissionType; //導入依賴的package包/類
private void registerBastionPermissions() {
if(!this.getServer().getPluginManager().isPluginEnabled("NameLayer")) return;
LinkedList<GroupManager.PlayerType> memberAndAbove = new LinkedList<>();
memberAndAbove.add(GroupManager.PlayerType.MEMBERS);
memberAndAbove.add(GroupManager.PlayerType.MODS);
memberAndAbove.add(GroupManager.PlayerType.ADMINS);
memberAndAbove.add(GroupManager.PlayerType.OWNER);
PermissionType.registerPermission(NameLayerPermissions.BASTION_ALLOW_EXILED, memberAndAbove);
}
示例6: handleInteraction
import vg.civcraft.mc.namelayer.permission.PermissionType; //導入依賴的package包/類
/**
* Responds to player interaction events
*
* @param e The PlayerInteractionEvent
*/
public void handleInteraction(PlayerInteractEvent e) {
//if the player left clicked a block
if (!e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
return;
}
Player player = e.getPlayer();
//If the player was holding a item matching the interaction material
if (!player.getItemInHand().getType().equals(Material.STICK)) {
return;
}
Location bukkitLocation = e.getClickedBlock().getLocation();
//Checks if permissions are active and block is reinforced
if (ContraptionsPlugin.PERMISSIONS && reinforcementManager.isReinforced(bukkitLocation)) {
if (((PlayerReinforcement) reinforcementManager.getReinforcement(bukkitLocation)).isAccessible(player, PermissionType.CHESTS)) {
Response response = new Response(false, "You don't have permission to interact with Contraptions at this block");
response.conveyTo(player);
return;
}
}
BlockLocation location = new BlockLocation(bukkitLocation);
Contraption contraption = dao.getContraption(location);
//If a contraption doesn't exist on bukkitLocation
if (contraption == null) {
createContraption(location, player).conveyTo(player);
} //If contraption exists at bukkitLocation
else {
contraption.trigger().conveyTo(player);
}
}