本文整理汇总了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();
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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!");
}
}
示例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();
}
}
示例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());
}
}
示例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);
}
}
示例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!";
}
}
示例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);
}
示例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 + "...");
}
}
示例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 + "...");
}
}
示例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");
}
}