當前位置: 首頁>>代碼示例>>Java>>正文


Java PermissionDefault類代碼示例

本文整理匯總了Java中org.bukkit.permissions.PermissionDefault的典型用法代碼示例。如果您正苦於以下問題:Java PermissionDefault類的具體用法?Java PermissionDefault怎麽用?Java PermissionDefault使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PermissionDefault類屬於org.bukkit.permissions包,在下文中一共展示了PermissionDefault類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCraft

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@EventHandler
public void onCraft(CraftItemEvent e)
{
	Player p = (Player) e.getWhoClicked();
	if(e.getRecipe() instanceof ShapedRecipe)
	{
		ShapedRecipe sr = (ShapedRecipe) e.getRecipe();
		if(Bukkit.getBukkitVersion().contains("1.11"))
		{
			for(BagBase  bb : Util.getBags())
			{
				if(((ShapedRecipe)bb.getRecipe()).getShape().equals(sr.getShape()))
				{
					if(!hasPermission(new Permission("bag.craft." + bb.getName(), PermissionDefault.TRUE), p))
					e.setCancelled(true);					
				}
			}
		}
		else
		if(sr.getKey().getNamespace().startsWith("bag_"))
		{
			if(!hasPermission(new Permission("bag.craft." + sr.getKey().getKey(), PermissionDefault.TRUE), p))
			e.setCancelled(true);
		}
	}
}
 
開發者ID:benfah,項目名稱:Bags2,代碼行數:27,代碼來源:CraftListener.java

示例2: onEnable

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@Override
public void onEnable() {
    // Ensure parsing errors show in the console on Lobby servers,
    // since PGM is not around to do that.
    mapdevLogger.setUseParentHandlers(true);

    this.getServer().getPluginManager().registerEvents(new EnvironmentControlListener(), this);
    this.getServer().getPluginManager().registerEvents(new Gizmos(), this);
    this.getServer().getMessenger().registerOutgoingPluginChannel(this, BUNGEE_CHANNEL);

    this.setupScoreboard();
    this.loadConfig();

    for(Gizmo gizmo : Gizmos.gizmos) {
        Bukkit.getPluginManager().addPermission(new Permission(gizmo.getPermissionNode(), PermissionDefault.FALSE));
    }

    Settings settings = new Settings(this);
    settings.register();

    navigatorInterface.setOpenButtonSlot(Slot.Hotbar.forPosition(0));
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:23,代碼來源:Lobby.java

示例3: enable

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@Override
public void enable() {
    final PermissionAttachment attachment = Bukkit.getConsoleSender().addAttachment(plugin);
    Stream.of(
        PERMISSION,
        PERMISSION_GET,
        PERMISSION_SET,
        PERMISSION_ANY,
        PERMISSION_ANY_GET,
        PERMISSION_ANY_SET,
        PERMISSION_IMMEDIATE
    ).forEach(name -> {
        final Permission permission = new Permission(name, PermissionDefault.FALSE);
        pluginManager.addPermission(permission);
        attachment.setPermission(permission, true);
    });
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:18,代碼來源:NicknameCommands.java

示例4: registerPermission

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
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;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:18,代碼來源:DefaultPermissions.java

示例5: processPermission

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
/**
 * Processes a command.
 *
 * @param permissionAnnotation The annotation.
 * @return The generated permission metadata.
 */
protected Map<String, Object> processPermission (Permission permissionAnnotation) {
        Map<String, Object> permission = new HashMap<> ();

        if (!"".equals (permissionAnnotation.description ())) {
                permission.put ("description", permissionAnnotation.description ());
        }
        if (PermissionDefault.OP != permissionAnnotation.defaultValue ()) {
                permission.put ("default", permissionAnnotation.defaultValue ().toString ().toLowerCase ());
        }

        if (permissionAnnotation.children ().length > 0) {
                Map<String, Boolean> childrenList = new HashMap<> ();
                for (ChildPermission childPermission : permissionAnnotation.children ()) {
                        childrenList.put (childPermission.value (), childPermission.inherit ());
                }
                permission.put ("children", childrenList);
        }

        return permission;
}
 
開發者ID:LordAkkarin,項目名稱:bukkit-plugin-annotations,代碼行數:27,代碼來源:PluginAnnotationProcessor.java

示例6: onCommand

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	if (cmd.getName().equalsIgnoreCase("cloudpacks")) {
		if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
			sendHelp(sender);
			return true;
		}
		
		if (args.length >= 1) {
			if (args[0].equalsIgnoreCase("list")) {
				if (args.length >= 2) {
					if (sender.hasPermission(new Permission("cloudpacks.list.other", PermissionDefault.OP))) {
						OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]);
						
					}
				}
			} else if (args[0].equalsIgnoreCase("give")) {
				
				
			} else if (args[0].equalsIgnoreCase("givekey")) {
				
			}
		}
		
	}
	return true;
}
 
開發者ID:MrEminent42,項目名稱:CloudPacks,代碼行數:27,代碼來源:CloudPackCommand.java

示例7: registerPermissions

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
/**
 * Registers permissions that depend on the user's configuration file (for MultipleAchievements; for instance for
 * stone breaks, achievement.count.breaks.stone will be registered).
 */
private void registerPermissions() {
	getLogger().info("Registering permissions...");

	PluginManager pluginManager = getServer().getPluginManager();
	for (MultipleAchievements category : MultipleAchievements.values()) {
		for (String section : config.getConfigurationSection(category.toString()).getKeys(false)) {
			int startOfMetadata = section.indexOf(':');
			if (startOfMetadata > -1) {
				// Permission ignores metadata (eg. sand:1) for Breaks, Places and Crafts categories.
				section = section.substring(0, startOfMetadata);
			}
			if (category == MultipleAchievements.PLAYERCOMMANDS) {
				// Permissions don't take spaces into account for this category.
				section = StringUtils.replace(section, " ", "");
			}

			// Bukkit only allows permissions to be set once, check to ensure they were not previously set when
			// performing /aach reload.
			if (pluginManager.getPermission(category.toPermName() + "." + section) == null) {
				pluginManager.addPermission(
						new Permission(category.toPermName() + "." + section, PermissionDefault.TRUE));
			}
		}
	}
}
 
開發者ID:PyvesB,項目名稱:AdvancedAchievements,代碼行數:30,代碼來源:AdvancedAchievements.java

示例8: registerPermissions

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
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);

    commands.recalculatePermissibles();
    return commands;
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:24,代碼來源:CommandPermissions.java

示例9: registerPermissions

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
public static void registerPermissions() {
	addPermission(new Permission("zephyrus.command.spelltome", "Permission to use the '/spelltome' command", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.command.teach", "Permission to use the '/teach' command", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.command.aspects", "Permission to use the '/aspects' command", PermissionDefault.TRUE));
	addPermission(new Permission("zephyrus.command.bind", "Permission to use the '/bind' command", PermissionDefault.TRUE));
	addPermission(new Permission("zephyrus.command.book", "Permission to use the '/book' command", PermissionDefault.TRUE));
	addPermission(new Permission("zephyrus.command.cast", "Permission to use the '/cast' command", PermissionDefault.TRUE));
	addPermission(new Permission("zephyrus.command.level", "Permission to check level with '/level'", PermissionDefault.TRUE));
	addPermission(new Permission("zephyrus.command.level.add", "Permission to increase level with '/level add'", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.command.level.other", "Permission to check other player's level with '/level <player>'", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.command.mana", "Permission to check mana with '/mana'", PermissionDefault.TRUE));
	addPermission(new Permission("zephyrus.command.mana.restore", "Permission to restore mana with '/mana restore'", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.command.mana.other", "Permission to check other player's mana with '/mana <player>'", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.command.book.bypass", "Permission to ignore the book limit of '/book'", PermissionDefault.FALSE));
	addPermission(new Permission("zephyrus.shop.create", "Allows user to create shops", PermissionDefault.OP));
	addPermission(new Permission("zephyrus.shop.use", "Allows user to use shops", PermissionDefault.TRUE));
	for (Permission permission : permissions) {
		Bukkit.getPluginManager().addPermission(permission);
	}
}
 
開發者ID:mcardy,項目名稱:Zephyrus-II,代碼行數:21,代碼來源:PermissionsManager.java

示例10: registerSpell

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@Override
public void registerSpell(Spell spell) {
	if (spellConfig.getConfig().getBoolean(spell.getDefaultName() + ".Enabled")) {
		this.spellList.add(spell);
		PermissionsManager.addPermission(new Permission("zephyrus.spell.learn." + spell.getDefaultName().toLowerCase()));
		PermissionsManager.addPermission(new Permission("zephyrus.spell.cast." + spell.getDefaultName().toLowerCase(),
				"Permission to cast the " + spell.getDefaultName() + " spell", PermissionDefault.FALSE));
		if (spell instanceof Configurable) {
			((Configurable) spell).loadConfiguration(spellConfig.getConfig().getConfigurationSection(
					spell.getDefaultName()));
		}
		if (spell instanceof Listener) {
			Bukkit.getPluginManager().registerEvents((Listener) spell, Zephyrus.getPlugin());
		}
	}
}
 
開發者ID:mcardy,項目名稱:Zephyrus-II,代碼行數:17,代碼來源:CoreSpellManager.java

示例11: UpdateChecker

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
public UpdateChecker(Plugin plugin, String spigotFullId) {
    this.plugin = plugin;
    this.spigotId = spigotFullId;
    try {
        this.spigotUrl = new URL("https://www.spigotmc.org/resources/" + spigotId + "/");
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException("Invalid spigot id: " + spigotId);
    }
    this.logger = plugin.getLogger();
    permission = new Permission(plugin.getName() + ".update");
    permission.setDefault(PermissionDefault.OP);
    Bukkit.getPluginManager().addPermission(permission);
    setInterval(20*60*30);//30 minutes
    message = buildMessage();
}
 
開發者ID:upperlevel,項目名稱:uppercore,代碼行數:16,代碼來源:UpdateChecker.java

示例12: ChannelMatchModule

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@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);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:8,代碼來源:ChannelMatchModule.java

示例13: configure

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@Override
protected void configure() {
    requestStaticInjection(RaindropUtil.class);

    new PluginFacetBinder(binder())
        .register(RaindropCommands.class);

    final PermissionBinder permissions = new PermissionBinder(binder());
    for(int i = RaindropConstants.MULTIPLIER_MAX; i > 0; i = i - RaindropConstants.MULTIPLIER_INCREMENT) {
        permissions.bindPermission().toInstance(new Permission("raindrops.multiplier." + i, PermissionDefault.FALSE));
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:13,代碼來源:RaindropManifest.java

示例14: updatePermission

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
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;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:9,代碼來源:PermissionGroupListener.java

示例15: testValueFromEnum

import org.bukkit.permissions.PermissionDefault; //導入依賴的package包/類
@Test
public void testValueFromEnum() throws InputException {
    Class[] inputTypes = {
            WeatherType.class,
            EquipmentSlot.class,
            MainHand.class,
            PermissionDefault.class
    };

    String[] input = {
            "downfall",
            "HeAd",
            "lEfT",
            "NOT_OP"
    };

    Object[] output = InputFormatter.getTypesFromInput(inputTypes, Arrays.asList(input), null);

    // First let's make sure we didn't lose anything, or get anything
    assertEquals(inputTypes.length, output.length);

    // Next let's make sure everything is the right type
    assertTrue(output[0] instanceof WeatherType);
    assertTrue(output[1] instanceof EquipmentSlot);
    assertTrue(output[2] instanceof MainHand);
    assertTrue(output[3] instanceof PermissionDefault);

    // Finally, let's make sure the values are correct
    assertSame(output[0], WeatherType.DOWNFALL);
    assertSame(output[1], EquipmentSlot.HEAD);
    assertSame(output[2], MainHand.LEFT);
    assertSame(output[3], PermissionDefault.NOT_OP);
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:34,代碼來源:InputFormatterTest.java


注:本文中的org.bukkit.permissions.PermissionDefault類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。