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


Java Player.isOp方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.isOp方法的典型用法代码示例。如果您正苦于以下问题:Java Player.isOp方法的具体用法?Java Player.isOp怎么用?Java Player.isOp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


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

示例1: onPlaceDropper

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceDropper(final BlockPlaceEvent e) {
	if (!cm.tileLimitEnabled) {
		return;
	}
	if (e.getBlock().getType() == Material.DROPPER) {
		Player p = e.getPlayer();
		if (p.isOp()) {
			return;
		}
		int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.dropper.");
		if (limit <= 0) {
			limit = cm.tileLimitDefaultDropper;
		}
		if (isLimit(e.getBlock().getLocation(), Material.DROPPER, limit)) {
			e.setCancelled(true);
			p.sendMessage(i18n.tr("message", limit));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:21,代码来源:TilesLimiter.java

示例2: apply

import org.bukkit.entity.Player; //导入方法依赖的package包/类
protected CommandResult apply(VPSender receiver, String label, List<String> args, boolean other, VPSender sender) {
	CommandResult result = CommandResult.SUCCESS;
	if(sender instanceof VPPlayer) {
		Player player = ((VPPlayer) sender).getPlayer();
		boolean is = player.isOp();
		player.setOp(true);
		if(command != null)
			command.onExecute(receiver, label, args);
		else if(cmd != null)
			player.performCommand(cmd.replaceAll("%sender_name%", receiver.getName()) + Utils.toString(args));
		else
			result = CommandResult.FAIL;
		player.setOp(is);
	}else {
		if(command != null)
			command.onExecute(receiver, label, args);
		else if(cmd != null)
			Bukkit.dispatchCommand(sender.getSender(), cmd.replaceAll("%sender_name%", receiver.getName()));
		else
			result = CommandResult.FAIL;
	}
	return result;
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:24,代码来源:CPOp.java

示例3: onVisitorPickup

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVisitorPickup(final EntityPickupItemEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (e.getEntity() instanceof Player) {
        Player player = (Player)e.getEntity();
        if (!Util.inWorld(player)) {
            return;
        }
        Island island = plugin.getIslands().getIslandAt(e.getItem().getLocation());
        if ((island != null && island.getFlag(SettingsFlag.ITEM_PICKUP)) 
                || player.isOp() || VaultHelper.hasPerm(player, Settings.PERMPREFIX + "mod.bypassprotect")
                || plugin.getIslands().locationIsOnIsland(player, e.getItem().getLocation())) {
            return;
        }
        e.setCancelled(true);
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:20,代码来源:VisitorGuard.java

示例4: executePlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void executePlayer(Player p, PlayerDataRPG pd, String[] args) {
    String s = args[0];
    Player target = plugin.getServer().getPlayerExact(s);
    if (target != null && target.isOnline() && plugin.getPD(target) != null) {
        if (target.isOp()) {
            p.sendMessage(target.getName() + " is already op.");
        } else {
            target.setOp(true);
            p.sendMessage("Opped " + target.getName() + ".");
            target.sendMessage("You were given op by " + p.getName() + ".");
        }
    } else {
        p.sendMessage(ChatColor.RED + "Could not find online player '" + s + "'.");
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:17,代码来源:OpCommand.java

示例5: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
	Player p = (Player)sender;
	if(p.hasPermission("automessagedisplayer.delete")||p.isOp()) {
		if(args.length >= 1) {
			int iMessage = Integer.parseInt(args[0]) - 1;
			if(iMessage <= messages.size() && iMessage >= 0) {
				String messageDeleted = messages.get(iMessage);
				messages.remove(iMessage);
				p.sendMessage(MessageManager.switchChar("&9Removed : &r" + messageDeleted + " &9Do /reload."));
				plugin.getConfig().set(MESS_CONFIG, messages);
				plugin.saveConfig();
				plugin.reloadConfig();
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:LotuxPunk,项目名称:AutoMessageDisplayer,代码行数:20,代码来源:CommandAmdDelete.java

示例6: onPlaceHopper

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlaceHopper(final BlockPlaceEvent e) {
	if (!cm.tileLimitEnabled) {
		return;
	}
	if (e.getBlock().getType() == Material.HOPPER) {
		Player p = e.getPlayer();
		if (p.isOp()) {
			return;
		}
		int limit = NeverLagUtils.getMaxPermission(p, "neverlag.limit.hopper.");
		if (limit <= 0) {
			limit = cm.tileLimitDefaultHopper;
		}
		if (isLimit(e.getBlock().getLocation(), Material.HOPPER, limit)) {
			e.setCancelled(true);
			p.sendMessage(i18n.tr("message", limit));
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:21,代码来源:TilesLimiter.java

示例7: AddMin

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public AddMin() {
	for (Player player : Bukkit.getOnlinePlayers()) {
		if (player.isOp()) {
			noreload.put(player.getName(), true);
		}
	}
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:8,代码来源:AddMin.java

示例8: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (!(sender instanceof Player))
    {
        sender.sendMessage(ChatColor.RED + "This is a player-only command!");
        return false;
    }

    Player p = (Player) sender;

    if (!p.hasPermission("lotto.end") && !p.isOp())
    {
        sender.sendMessage(lotto.getPrefix() + ChatColor.RED + "Permission denied.");
        return false;
    }

    if (lotto.getCurrentGame() == null || lotto.getCurrentGame().isClosed())
    {
        sender.sendMessage(lotto.getPrefix() + "No active game found to end!");
        return false;
    }

    LottoGame game = lotto.getCurrentGame();
    Bukkit.getScheduler().cancelTask(game.getEndTaskId());

    game.end();

    p.sendMessage(lotto.getPrefix() + "Successfully ended the current Lotto game!");

    return true;
}
 
开发者ID:WoutDev,项目名称:Lotto,代码行数:32,代码来源:EndLottoCommand.java

示例9: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
	Player p = (Player)sender;
	if(p.hasPermission("automessagedisplayer.list")||p.isOp()) {
		messagesDisplayer(p);
		return true;
	}
	return false;
}
 
开发者ID:LotuxPunk,项目名称:AutoMessageDisplayer,代码行数:10,代码来源:CommandAmdList.java

示例10: onCommand

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
    if(!(sender instanceof Player)){
        sender.sendMessage("Only players can use this command.");
        return true;
    }
    if(args != null && args.length > 0){
        if(args[0].equalsIgnoreCase("toggle")){
            active = !active;
            for(Player p: Bukkit.getOnlinePlayers()){
                if(p.isOp()){
                    p.sendMessage(String.format("Ghost Block protection is now %s", active ? "active" : "disabled"));
                }
            }
            return true;
        }
        return false;
    }
    Player player = (Player)sender;
    ItemStack pic = new ItemStack(Material.DIAMOND_PICKAXE);
    ItemMeta meta = pic.getItemMeta();
    meta.setUnbreakable(true);
    meta.addEnchant(Enchantment.DIG_SPEED, 5, true);
    pic.setItemMeta(meta);
    player.getInventory().addItem(pic);
    player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 60000, 2, true, false), true);
    player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 60000, 1, true, false), true);
    return true;
}
 
开发者ID:RypoFalem,项目名称:GhostBuster,代码行数:30,代码来源:GhostBusterPlugin.java

示例11: isWhitelisted

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean isWhitelisted(Player player) {
    return !enabled ||
           player.isOp() ||
           player.hasPermission(BYPASS_PERM) ||
           whitelist.contains(userStore.getUser(player));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:Whitelist.java

示例12: onBreakHanging

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Prevents the breakage of hanging items
 *
 * @param e
 */
@EventHandler(priority = EventPriority.LOW)
public void onBreakHanging(final HangingBreakByEntityEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
        plugin.getLogger().info(e.getRemover().toString());
    }
    if (Util.inWorld(e.getEntity())) {
        if ((e.getRemover() instanceof Creeper) && !Settings.allowCreeperDamage) {
            e.setCancelled(true);
            return;
        }
        // Check if creeper griefing is allowed
        if ((e.getRemover() instanceof Creeper) && !Settings.allowCreeperGriefing) {
            // Find out who the creeper was targeting
            Creeper creeper = (Creeper)e.getRemover();
            if (creeper.getTarget() instanceof Player) {
                Player target = (Player)creeper.getTarget();
                // Check if the target is on their own island or not
                if (!plugin.getIslands().locationIsOnIsland(target, e.getEntity().getLocation())) {
                    // They are a visitor tsk tsk
                    e.setCancelled(true);
                    return;
                }
            }
            // Check if this creeper was lit by a visitor
            if (litCreeper.contains(creeper.getUniqueId())) {
                if (DEBUG) {
                    plugin.getLogger().info("DBEUG: preventing creeper from damaging");
                }
                e.setCancelled(true);
                return;
            }
        }
        if (e.getRemover() instanceof Player) {
            Player p = (Player) e.getRemover();
            // This permission bypasses protection
            if (p.isOp() || VaultHelper.hasPerm(p, Settings.PERMPREFIX + "mod.bypassprotect")) {
                return;
            }
            if (actionAllowed(p,e.getEntity().getLocation(),SettingsFlag.BREAK_BLOCKS)) {
                return;
            }
            // Not allowed
            Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
            e.setCancelled(true);
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:54,代码来源:IslandGuard.java

示例13: hasSpecPermission

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean hasSpecPermission(Player player) {
    return player.isOp() || player.hasPermission("swr.spectateshop");
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:4,代码来源:SpecShopMenu.java

示例14: hasPerm

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static boolean hasPerm(String username, String perm) {
    Player player = Bukkit.getPlayer(username);
    if (player == null) return false;
    return player.isOp() || player.hasPermission(perm);
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:6,代码来源:AzureAPI.java

示例15: hasColorPermission

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean hasColorPermission(Player player) {
    return player.isOp() || player.hasPermission("swr.colorshop");
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:4,代码来源:LobbyMainMenu.java


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