当前位置: 首页>>代码示例>>Java>>正文


Java Permission类代码示例

本文整理汇总了Java中net.milkbowl.vault.permission.Permission的典型用法代码示例。如果您正苦于以下问题:Java Permission类的具体用法?Java Permission怎么用?Java Permission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Permission类属于net.milkbowl.vault.permission包,在下文中一共展示了Permission类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hook

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
/**
 * Registers the LuckPerms implementation of {@link Permission} and {@link Chat} with
 * the service manager.
 *
 * @param plugin the plugin
 */
public void hook(LPBukkitPlugin plugin) {
    try {
        if (this.permissionHook == null) {
            this.permissionHook = new VaultPermissionHook(plugin);
        }

        if (this.chatHook == null) {
            this.chatHook = new VaultChatHook(plugin, this.permissionHook);
        }

        final ServicesManager sm = plugin.getServer().getServicesManager();
        sm.register(Permission.class, this.permissionHook, plugin, ServicePriority.High);
        sm.register(Chat.class, this.chatHook, plugin, ServicePriority.High);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:25,代码来源:VaultHookManager.java

示例2: onChat

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onChat(final AsyncPlayerChatEvent event) {
    final VaultMagic vm = this.vaultHook.getVaultMagic();
    if (vm == null) return;
    if (!vm.hasPermission()) return;
    final Permission permission = vm.getPermission();
    final Player player = event.getPlayer();
    final Titles titles = this.vaultHook.getChatterbox().getAPI().getTitleAPI().getTitles(player.getUniqueId());
    if (permission.hasGroupSupport()) {
        final String group = permission.getPrimaryGroup(player);
        if (group != null) {
            this.addChatterboxTitles(titles, group);
            if (vm.hasChat()) {
                this.addOtherGroupTitles(titles, group, vm.getChat(), player);
            }
        }
    }
    if (vm.hasChat()) {
        this.addOtherPlayerTitles(titles, vm.getChat(), player);
    }
}
 
开发者ID:Chatterbox,项目名称:Chatterbox,代码行数:22,代码来源:PlayerListener.java

示例3: onEnable

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
@Override
public void onEnable()
{
	ServicesManager sm = handler.getServer().getServicesManager();

	RegisteredServiceProvider<Permission> permProvider = sm.getRegistration(Permission.class);
	if (permProvider != null)
		perm = permProvider.getProvider();

	RegisteredServiceProvider<Economy> econProvider = sm.getRegistration(Economy.class);
	if (econProvider != null)
		econ = econProvider.getProvider();

	RegisteredServiceProvider<Chat> chatProvider = sm.getRegistration(Chat.class);
	if (chatProvider != null)
		chat = chatProvider.getProvider();
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:18,代码来源:VaultHandler.java

示例4: getVaultPermission

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
/**
 * Если Vault установлен на сервере и включён, а также имеется какой-нибудь плагин,
 * предоставляющий нужный интерфейс, он будет возвращён, иначе будет возвращено null.
 * @return net.milkbowl.vault.permission.Permission
 */
public Permission getVaultPermission()
{
	if(permission == null)
	{
		if(plugin.getServer().getPluginManager().isPluginEnabled("Vault"))
		{
			plugin.logger.info("Found Vault! Searching for permission plugin...");
			final ServicesManager servicesManager = plugin.getServer().getServicesManager();
			RegisteredServiceProvider<Permission> provider = servicesManager.getRegistration(Permission.class);
			if(provider != null)
				permission = provider.getProvider();
			if(permission != null && permission.isEnabled())
				plugin.logger.log(Level.INFO, "Using {0} as chat provider.", permission.getName());
		}
	}
	return permission;
}
 
开发者ID:RuBukkit,项目名称:RuBukkit-Template,代码行数:23,代码来源:IntegrateVault.java

示例5: ChatRenderer

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
public ChatRenderer(RedisChat plugin) {
	this.plugin = plugin;
	// setup vault perms for looking up players group. and vault chat for getting chat prefixes.
	RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager().getRegistration(Permission.class);
	vaultPerms = rsp.getProvider();
	if (vaultPerms == null) {
		throw new RuntimeException("Vault and a permissions plugin are required.");
	}

	RegisteredServiceProvider<Chat> rspc = plugin.getServer().getServicesManager().getRegistration(Chat.class);
	vaultChat = rspc.getProvider();
	if (vaultChat == null) {
		throw new RuntimeException("Vault and a permissions plugin are required.");
	}

	// Setup the "base" NBT Tag that we'll use to render sender's hover data
	this.baseTag = new NBTTagCompound();
	this.baseTag.set("id", new NBTTagShort((short) 1));
	this.baseTag.set("Damage", new NBTTagShort((short) 0));
	this.baseTag.set("Count", new NBTTagByte((byte) 1));
	NBTTagCompound tag = new NBTTagCompound();
	NBTTagCompound dispTag = new NBTTagCompound();
	tag.set("display", dispTag);
	this.baseTag.set("tag", tag);
}
 
开发者ID:ulchm,项目名称:RedisChat,代码行数:26,代码来源:ChatRenderer.java

示例6: run

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void run(String playerID) {
	Permission vault = VaultIntegrator.getPermission();
	String player = PlayerConverter.getPlayer(playerID).getName();
	if (add) {
		if (perm) {
			// world add perm
			vault.playerAdd(world, player, permission);
		} else {
			// world add group
			vault.playerAddGroup(world, player, permission);
		}
	} else {
		if (perm) {
			// world remove perm
			vault.playerRemove(world, player, permission);
		} else {
			// world remove group
			vault.playerRemoveGroup(world, player, permission);
		}
	}
}
 
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:24,代码来源:PermissionEvent.java

示例7: hook

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
@Override
public void hook() {
    RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager()
            .getRegistration(net.milkbowl.vault.permission.Permission.class);
    if (permissionProvider != null) {
        permission = permissionProvider.getProvider();
    }
    RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServer().getServicesManager()
            .getRegistration(net.milkbowl.vault.economy.Economy.class);
    if (economyProvider != null) {
        economy = economyProvider.getProvider();
    }
    if (economy != null) {
        plugin.registerEvents("money", MoneyEvent.class);
        plugin.registerConditions("money", MoneyCondition.class);
        plugin.registerVariable("money", MoneyVariable.class);
    } else {
        Debug.error("There is no economy plugin on the server!");
    }
    if (permission != null) {
        plugin.registerEvents("permission", PermissionEvent.class);
    } else {
        Debug.error("Could not get permission provider!");
    }
}
 
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:26,代码来源:VaultIntegrator.java

示例8: VaultHook

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
public VaultHook(xEssentials pl) {
	this.pl = pl;
	RegisteredServiceProvider<Economy> ep = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
	RegisteredServiceProvider<Chat> cp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
	RegisteredServiceProvider<Permission> pp = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);

	if(ep instanceof RegisteredServiceProvider) {
		this.econ = ep.getProvider();
	}
	if(cp instanceof RegisteredServiceProvider) {
		this.chat = cp.getProvider();
	}
	if(pp instanceof RegisteredServiceProvider) {
		this.perm = pp.getProvider();
	}

}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:18,代码来源:VaultHook.java

示例9: InitializePermissions

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
private void InitializePermissions()
{
	RegisteredServiceProvider<Permission> rsp = context.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
	permission = (Permission)rsp.getProvider();
	
	if (permission != null)
	{
		context.getLogger().log(Level.INFO, "Vault has detected and connected to {0}", permission.getName());
	}
	else
	{
		context.getLogger().warning("No compatible permissions plugin detected [Vault].");
		context.getLogger().warning("Disabling plugin.");
		context.getPlugin().getPluginLoader().disablePlugin(context.getPlugin());
	}
}
 
开发者ID:jayfella,项目名称:SimpleJail,代码行数:17,代码来源:PermissionHandler.java

示例10: playerHas

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
@Override
public boolean playerHas(String world, String player, String permission) {
    Player p = Bukkit.getServer().getPlayer(player);
    if (p == null) {
        Map<String, Boolean> perms = service.getPlayerPermissions(world, null, player);
        Boolean value = perms.get(permission.toLowerCase());
        if (value != null) {
            return value;
        }
        // Use default at this point
        org.bukkit.permissions.Permission perm = Bukkit.getPluginManager().getPermission(permission);
        if (perm != null) {
            OfflinePlayer op = Bukkit.getServer().getOfflinePlayer(player);
            return perm.getDefault().getValue(op != null ? op.isOp() : false);
        }
        // Have no clue
        return false;
    } else {
        return playerHas(p, permission);
    }
}
 
开发者ID:Realmcraft,项目名称:Vault,代码行数:22,代码来源:Permission_zPermissions.java

示例11: getPermTypeString

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
/**
 * Get using permission controller name
 * @return string controller name
 */
public String getPermTypeString(){
    // Switch by using permission controller
    switch (permType){
        case VAULT:
            return "Vault: " + Bukkit.getServer().getServicesManager().getRegistration(Permission.class).getProvider().getName();

        case PEX:
            return "PermissionsEx";

        case OPS:
            return "OPs";

        case SUPERPERMS:
            return "SuperPerms";

        default:
            return "Unknown! Please report this!";
    }
}
 
开发者ID:MCBans,项目名称:MCBansAssetGatway,代码行数:24,代码来源:PermissionHandler.java

示例12: setupVaultPermission

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
/**
 * Setup Vault plugin
 * @return boolean true if success
 */
private boolean setupVaultPermission(){
    Plugin vault = plugin.getServer().getPluginManager().getPlugin("Vault");
    if (vault == null) vault = plugin.getServer().getPluginManager().getPlugin("vault");
    if (vault == null) return false;
    try{
        RegisteredServiceProvider<net.milkbowl.vault.permission.Permission> permissionProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
        if (permissionProvider != null){
            vaultPermission = permissionProvider.getProvider();
        }
    }catch (Exception ex){
        log.warning("Unexpected error trying to setup Vault permissions!");
        ex.printStackTrace();
    }

    return (vaultPermission != null);
}
 
开发者ID:MCBans,项目名称:MCBansAssetGatway,代码行数:21,代码来源:PermissionHandler.java

示例13: addGroup

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
public static void addGroup(Permission permissionHandler, PlayerData pData, String group, CommandSender ranker) {
    if (permissionHandler == null || pData == null || group == null || ranker == null) {
        throw new IllegalArgumentException("One or more null arguments");
    }
    if (!permissionHandler.playerInGroup((String) null, pData.getUsername(), group)) {
        permissionHandler.playerAddGroup((String) null, pData.getUsername(), group);
        List<String> rawData;
        if (pData.hasExtraData("rankrecord")) {
            rawData = new ArrayList<String>(Arrays.asList(pData.getExtraData("rankrecord")));
        } else {
            rawData = new ArrayList<String>();
        }
        rawData.add("ADD " + ranker.getName() + " " + group + " " + System.currentTimeMillis());
        pData.addExtraData("rankrecord", rawData.toArray(new String[rawData.size()]));
        ranker.sendMessage(ColorList.DATA + group + ColorList.REG + " has been added to " + ColorList.NAME + pData.getUsername());
    } else {
        ranker.sendMessage(ColorList.DATA + group + ColorList.REG + " has already been added to " + ColorList.NAME + pData.getUsername() + ColorList.REG + "...");
    }
}
 
开发者ID:AndoxynPlugins,项目名称:RankData,代码行数:20,代码来源:RankTracker.java

示例14: removeGroup

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
public static void removeGroup(Permission permissionHandler, PlayerData pData, String group, CommandSender ranker) {
    if (permissionHandler == null || pData == null || group == null || ranker == null) {
        throw new IllegalArgumentException("One or more null arguments");
    }
    if (permissionHandler.playerInGroup((String) null, pData.getUsername(), group)) {
        permissionHandler.playerRemoveGroup((String) null, pData.getUsername(), group);
        List<String> rawData;
        if (pData.hasExtraData("rankrecord")) {
            rawData = new ArrayList<String>(Arrays.asList(pData.getExtraData("rankrecord")));
        } else {
            rawData = new ArrayList<String>();
        }
        rawData.add("REMOVE " + ranker.getName() + " " + group + " " + System.currentTimeMillis());
        pData.addExtraData("rankrecord", rawData.toArray(new String[rawData.size()]));
        ranker.sendMessage(ColorList.DATA + group + ColorList.REG + " has been removed from " + ColorList.NAME + pData.getUsername());
    } else {
        ranker.sendMessage(ColorList.DATA + group + ColorList.REG + " has already been removed from " + ColorList.NAME + pData.getUsername() + ColorList.REG + "...");
    }
}
 
开发者ID:AndoxynPlugins,项目名称:RankData,代码行数:20,代码来源:RankTracker.java

示例15: reload

import net.milkbowl.vault.permission.Permission; //导入依赖的package包/类
protected void reload() {
    Logger l = rankDataBukkit.getLogger();
    rankDataBukkit.getLogger().info("Starting Survivor Check");
    PlayerHandler handler = rankDataBukkit.getPlayerDataPlugin().getHandler();
    if (handler == null) {
        return;
    }
    List<? extends PlayerData> pDataList = rankDataBukkit.getPlayerDataPlugin().getHandler().getAllPlayerDatas();
    int foundReady = 0;
    for (int i = 0; i < pDataList.size(); i++) {
        PlayerData current = pDataList.get(i);
        Permission perm = PlayerDataStatic.getPermissionHandler();
        if (isReadyCheck(perm, current)) {
            foundReady++;
            setSurvivor(perm, current);
        }
    }
    if (foundReady != 0) {
        l.log(Level.INFO, "Added Survivor to {0} users", foundReady);
    } else {
        l.log(Level.INFO, "Done Checking Survivors");
    }
}
 
开发者ID:AndoxynPlugins,项目名称:RankData,代码行数:24,代码来源:SurvivorChecker.java


注:本文中的net.milkbowl.vault.permission.Permission类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。