Java Code Examples for org.bukkit.permissions.PermissionDefault#FALSE

The following examples show how to use org.bukkit.permissions.PermissionDefault#FALSE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultPermissions.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: PGMConfig.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
public Group(ConfigurationSection config) throws TextException {
  this.id = config.getName();
  final String prefix = config.getString("prefix");
  this.prefix = prefix == null ? null : parseComponentLegacy(prefix);
  final PermissionDefault def =
      id.equalsIgnoreCase("op")
          ? PermissionDefault.OP
          : id.equalsIgnoreCase("default") ? PermissionDefault.TRUE : PermissionDefault.FALSE;
  this.permission = getPermission(config, id, def, "permissions");
  this.observerPermission =
      getPermission(config, id, PermissionDefault.FALSE, "observer-permissions");
  this.participantPermission =
      getPermission(config, id, PermissionDefault.FALSE, "participant-permissions");
}
 
Example 3
Source File: ChannelMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: PermissionGroupListener.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: ListenerCombatChecks.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
private boolean canBypass(Player player) {
    if(player == null) return false;

    FileConfiguration config = this.plugin.getConfig("config.yml");
    String bypassPermission = config.getString("combat.bypass-permission");
    if(bypassPermission == null || bypassPermission.isEmpty()) return false;
    
    Permission permission = new Permission(bypassPermission, "Bypass permission for CombatLogX.", PermissionDefault.FALSE);
    return player.hasPermission(permission);
}
 
Example 6
Source File: JyCommandExecutor.java    From minecraft-python with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	if (!(sender instanceof Player))
		return false;
	Player player = (Player) sender;
	Permission p = new Permission("chatcommands", PermissionDefault.FALSE);
	if (!player.hasPermission(p)) {
		plugin.send(player, ChatColor.RED + "You don't have permission to use this command");
		return false;
	}
	
	if (cmd.getName().equals("py") && sender instanceof Player && args.length > 0) {
		String command = argsToString(args);
		plugin.send(player, ChatColor.AQUA + command);
		commandServer.command(player, command);
		return true;
	} else if (cmd.getName().equals("pyrestart") && sender instanceof Player) {
		plugin.send(player, "Restarting Python. Please wait...");
		commandServer.setupInterpreter(player);
		plugin.send(player, "Done!\n");
		return true;
	} else if (cmd.getName().equals("pyload") && sender instanceof Player && args.length == 1) {
		File match = MinecraftPyServerUtils.matchPythonFile(args[0]);
		if (match != null) {
			plugin.send(player, "Executing file: " + match.getName());
			commandServer.file(player, match);
			return true;
		} else {
			plugin.send(player, "Sorry, couldn't find this Python file");
		}
	}
	return false;
}
 
Example 7
Source File: ChannelMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
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;
}
 
Example 8
Source File: GroupData.java    From NametagEdit with GNU General Public License v3.0 4 votes vote down vote up
public void setPermission(String permission) {
    this.permission = permission;
    bukkitPermission = new Permission(permission, PermissionDefault.FALSE);
}