Java Code Examples for org.bukkit.permissions.Permission#recalculatePermissibles()

The following examples show how to use org.bukkit.permissions.Permission#recalculatePermissibles() . 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: CommandPermissions.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
public static Permission registerPermissions(Permission parent) {
    Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla minecraft commands", parent);

    DefaultPermissions.registerPermission(PREFIX + "kill", "Allows the user to commit suicide", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "me", "Allows the user to perform a chat action", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "tell", "Allows the user to privately message another player", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "say", "Allows the user to talk as the console", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "give", "Allows the user to give items to players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "teleport", "Allows the user to teleport players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "kick", "Allows the user to kick players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "stop", "Allows the user to stop the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "toggledownfall", "Allows the user to toggle rain on/off for a given world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "defaultgamemode", "Allows the user to change the default gamemode of the server", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "effect", "Allows the user to add/remove effects on players", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "selector", "Allows the use of selectors", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "trigger", "Allows the use of the trigger command", PermissionDefault.TRUE, commands);

    commands.recalculatePermissibles();
    return commands;
}
 
Example 2
Source File: DefaultPermissions.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public static void registerCorePermissions() {
    Permission parent = registerPermission(ROOT, "Gives the user the ability to use all CraftBukkit utilities and commands");

    CommandPermissions.registerPermissions(parent);
    BroadcastPermissions.registerPermissions(parent);

    parent.recalculatePermissibles();
}
 
Example 3
Source File: CommandPermissions.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public static Permission registerPermissions(Permission parent) {
    Permission commands = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all CraftBukkit commands", parent);

    DefaultPermissions.registerPermission(PREFIX + "help", "Allows the user to view the vanilla help menu", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "plugins", "Allows the user to view the list of plugins running on this server", PermissionDefault.TRUE, commands);
    DefaultPermissions.registerPermission(PREFIX + "reload", "Allows the user to reload the server settings", PermissionDefault.OP, commands);
    DefaultPermissions.registerPermission(PREFIX + "version", "Allows the user to view the version of the server", PermissionDefault.TRUE, commands);

    commands.recalculatePermissibles();
    return commands;
}
 
Example 4
Source File: ConfigurableKit.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@Override
public boolean Initialize()
{
	//TODO------Change all the class instances to use this one instance instead of KitConfig.getInstance()
	instance = KitConfig.getInstance();
	int x = 0;
	ConfigurationSection sec = instance.getKitSection(getInternalName());
	if(sec == null)
	{
		sec = instance.createKitSection(getInternalName());
		x++;
	}
	
	x += ConfigManager.setDefaultIfNotSet(sec, "Name", getInternalName());
	x += ConfigManager.setDefaultIfNotSet(sec, "Kit Description", getDefaultDescription());
	x += ConfigManager.setDefaultIfNotSet(sec, "Disable", false);
	x += ConfigManager.setDefaultIfNotSet(sec, "Free", false);
	x += setDefaults(sec);
	
	if(x > 0)
		instance.saveConfig();
	
	this.isFree = sec.getBoolean("Free");
	
	if(sec.getBoolean("Disable"))
		return false;
	
	loadKitStuff(sec);
	if(instance.useDefaultPermissions())
	{
		Permission perm = new Permission("Anni.Kits."+getName());
		perm.setDefault(PermissionDefault.FALSE);
		Bukkit.getPluginManager().addPermission(perm);
		perm.recalculatePermissibles();
	}
	icon = getIcon();
	setUp();
	this.loadout = getFinalLoadout().addNavCompass().finalizeLoadout();
	return true;
}
 
Example 5
Source File: AnniCommand.java    From AnnihilationPro with MIT License 5 votes vote down vote up
public static void registerArgument(AnniArgument argument)
{
	if(argument != null)
	{
		if(argument.getPermission() != null)
		{
			Permission perm = new Permission(argument.getPermission());
			Bukkit.getPluginManager().addPermission(perm);
			perm.recalculatePermissibles();
		}
		arguments.put(argument.getArgumentName().toLowerCase(), argument);
		recalcItemMenu();
	}
}
 
Example 6
Source File: MySubCommand.java    From NBTEditor with GNU General Public License v3.0 5 votes vote down vote up
void setupPermissions(String name, Permission parent) {
	String permName = parent.getName();
	if (permName.endsWith(".*")) {
		permName = permName.substring(0, permName.length() - 2);
	}
	_perm = new Permission(permName + "." + name);
	_perm.addParent(parent, true);
	for (Entry<String, MySubCommand> entry : _subCommands.entrySet()) {
		entry.getValue().setupPermissions(entry.getKey(), _perm);
	}
	Bukkit.getPluginManager().addPermission(_perm);
	parent.recalculatePermissibles();
}
 
Example 7
Source File: CraftDefaultPermissions.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public static void registerCorePermissions() {
    Permission parent = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla utilities and commands");
    CommandPermissions.registerPermissions(parent);
    DefaultPermissions.registerPermission(ROOT + ".autocraft", "Gives the user the ability to use autocraft functionality", PermissionDefault.OP, parent);
    parent.recalculatePermissibles();
}
 
Example 8
Source File: BroadcastPermissions.java    From Kettle with GNU General Public License v3.0 3 votes vote down vote up
public static Permission registerPermissions(Permission parent) {
    Permission broadcasts = DefaultPermissions.registerPermission(ROOT, "Allows the user to receive all broadcast messages", parent);

    DefaultPermissions.registerPermission(PREFIX + "admin", "Allows the user to receive administrative broadcasts", PermissionDefault.OP, broadcasts);
    DefaultPermissions.registerPermission(PREFIX + "user", "Allows the user to receive user broadcasts", PermissionDefault.TRUE, broadcasts);

    broadcasts.recalculatePermissibles();

    return broadcasts;
}