本文整理匯總了Java中org.bukkit.permissions.PermissionDefault.FALSE屬性的典型用法代碼示例。如果您正苦於以下問題:Java PermissionDefault.FALSE屬性的具體用法?Java PermissionDefault.FALSE怎麽用?Java PermissionDefault.FALSE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.permissions.PermissionDefault
的用法示例。
在下文中一共展示了PermissionDefault.FALSE屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerPermission
public static Permission registerPermission(Permission perm, boolean withLegacy) {
Permission result = perm;
try {
Bukkit.getPluginManager().addPermission(perm);
} catch (IllegalArgumentException ex) {
result = Bukkit.getPluginManager().getPermission(perm.getName());
}
if (withLegacy) {
Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
legacy.getChildren().put(result.getName(), true);
registerPermission(perm, false);
}
return result;
}
示例2: ChannelMatchModule
@Inject ChannelMatchModule(Match match, Plugin plugin) {
this.matchListeningPermission = new Permission("pgm.chat.all." + match.getId() + ".receive", PermissionDefault.FALSE);
final OnlinePlayerMapAdapter<Boolean> map = new OnlinePlayerMapAdapter<>(plugin);
map.enable();
this.teamChatters = new DefaultMapAdapter<>(map, true, false);
}
示例3: updatePermission
private boolean updatePermission(String name, Map<String, Boolean> before, Map<String, Boolean> after) {
if(Objects.equals(before, after)) return false;
final Permission perm = new Permission(name, PermissionDefault.FALSE, after);
pluginManager.removePermission(perm);
pluginManager.addPermission(perm);
return true;
}
示例4: getAttribute
@Override
public boolean getAttribute(String key) {
key = "plotsquared_user_attributes." + key;
Permission perm = Bukkit.getServer().getPluginManager().getPermission(key);
if (perm == null) {
perm = new Permission(key, PermissionDefault.FALSE);
Bukkit.getServer().getPluginManager().addPermission(perm);
Bukkit.getServer().getPluginManager().recalculatePermissionDefaults(perm);
}
return player.hasPermission(key);
}
示例5: createChannelPermission
protected Permission createChannelPermission(Party party) {
Permission permission = new Permission("pgm.chat.team." + this.match.getId() + '-' + party.hashCode() + ".receive", PermissionDefault.FALSE);
getMatch().getPluginManager().addPermission(permission);
permission.addParent(matchListeningPermission, true);
return permission;
}
示例6: setPermission
public void setPermission(String permission) {
this.permission = permission;
bukkitPermission = new Permission(permission, PermissionDefault.FALSE);
}
示例7: reSyncGroups
public static void reSyncGroups(Player player, boolean clearAssignedRoles) {
if (player == null) return;
DiscordSRV.debug("Synchronizing player " + player.getName());
String discordId = DiscordSRV.getPlugin().getAccountLinkManager().getDiscordId(player.getUniqueId());
if (discordId == null) {
DiscordSRV.debug("Tried to sync groups for player " + player.getName() + " but their MC account is not linked to a Discord account");
return;
}
// get member
Member member = DiscordUtil.getMemberById(discordId);
if (member == null) {
DiscordSRV.debug("Tried to sync groups for player " + player.getName() + " but their MC account is not linked to a Discord account");
return;
}
// get all the roles to synchronize from the config
Map<Permission, Role> synchronizables = new HashMap<>();
for (String roleId : DiscordSRV.config().getStringList("GroupRoleSynchronizationRoleIdsToSync")) {
Role role = DiscordUtil.getRole(roleId);
if (role == null && !roleId.equals("12345678901234567890") && !roleId.equals("DISCORDROLENAME")) {
DiscordSRV.debug(LangUtil.InternalMessage.GROUP_SYNCHRONIZATION_COULD_NOT_FIND_ROLE.toString()
.replace("{rolename}", roleId)
);
continue;
}
Permission permission = new Permission("discordsrv.sync." + roleId, PermissionDefault.FALSE);
synchronizables.put(permission, role);
}
if (synchronizables.size() == 0) {
DiscordSRV.debug("Tried to sync groups but no synchronizables existed");
return;
}
List<Role> rolesToAdd = new ArrayList<>();
List<Role> rolesToRemove = new ArrayList<>();
for (Map.Entry<Permission, Role> pair : synchronizables.entrySet()) {
if (!clearAssignedRoles && player.hasPermission(pair.getKey())) {
rolesToAdd.add(pair.getValue());
} else {
rolesToRemove.add(pair.getValue());
}
}
// remove roles that the user already has from roles to add
rolesToAdd.removeAll(member.getRoles());
// remove roles that the user doesn't already have from roles to remove
rolesToRemove.removeIf(role -> !member.getRoles().contains(role));
List<String> changes = new ArrayList<>();
if (rolesToAdd.size() > 0) {
DiscordUtil.addRolesToMember(member, rolesToAdd);
changes.add("+ " + String.join("", rolesToAdd.stream().map(Role::toString).collect(Collectors.toList())));
}
if (rolesToRemove.size() > 0) {
DiscordUtil.removeRolesFromMember(member, rolesToRemove);
changes.add("- " + String.join("", rolesToRemove.stream().map(Role::toString).collect(Collectors.toList())));
}
DiscordSRV.debug("Synced player " + player.getName() + " (" + (changes.size() > 0 ? String.join(" | ", changes) : "no changes") + ")");
}
示例8: refreshPermissions
public void refreshPermissions(Player player) {
if(!this.listen.getAttachments().containsKey(player.getName())) {
this.listen.attachTo(player);
}
Map<String, Boolean> permissions = this.getPermsManager().getWorld(player.getWorld().getName()).getPlayer(player.getName()).getAllPermissions();
Permission positive = Bukkit.getServer().getPluginManager().getPermission("INTERNAL_PERMISSION." + player.getName());
Permission negative = Bukkit.getServer().getPluginManager().getPermission("INTERNAL_PERMISSION.-" + player.getName());
if(positive != null) {
Bukkit.getServer().getPluginManager().removePermission(positive);
}
if(negative != null) {
Bukkit.getServer().getPluginManager().removePermission(negative);
}
Map<String, Boolean> po = new HashMap<String, Boolean>();
Map<String, Boolean> ne = new HashMap<String, Boolean>();
for(String key : permissions.keySet()) {
if(!key.startsWith("INTERNAL_PERMISSION")) {
if(permissions.get(key)) {
po.put(key, true);
} else {
ne.put(key, false);
}
}
}
positive = new Permission("INTERNAL_PERMISSION." + player.getName(), PermissionDefault.FALSE, po);
negative = new Permission("INTERNAL_PERMISSION.-" + player.getName(), PermissionDefault.FALSE, ne);
Bukkit.getServer().getPluginManager().addPermission(positive);
Bukkit.getServer().getPluginManager().addPermission(negative);
player.recalculatePermissions();
if(this.getManager().isEnabled("Chat")) {
PeacecraftChat chat = (PeacecraftChat) this.getManager().getModule("Chat");
if(player.hasPermission(ChatPermissions.MOD)) {
chat.setMod(player.getName(), true);
} else {
chat.setMod(player.getName(), false);
}
}
}
示例9: getPermissionDefault
@Override
public PermissionDefault getPermissionDefault() {
return PermissionDefault.FALSE;
}
示例10: hasPermission
/**
* Checks if player has permission node, not including OP permissions
*
* @param player player
* @param permission Permission in question
* @return true if they have the permission
*/
public static boolean hasPermission(Player player, String permission) {
Permission perm = new Permission(permission, PermissionDefault.FALSE);
return player.hasPermission(perm);
}
示例11: getGroupNode
/**
* Gets the permission node that a player needs to have to be considered
* part of a group.
*
* @param groupName
* The name of the group.
* @return The permission node.
*/
public static Permission getGroupNode(String groupName) {
return new Permission(GROUP_PREFIX + groupName.toLowerCase(), PermissionDefault.FALSE);
}