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


Java Player.setOp方法代码示例

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


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

示例1: 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()) {
            target.setOp(false);
            p.sendMessage("Deopped " + target.getName() + ".");
            target.sendMessage("You were deopped by " + p.getName() + ".");
        } else {
            p.sendMessage(target.getName() + " is not an op in the first place, lol.");
        }
    } else {
        p.sendMessage(ChatColor.RED + "Could not find online player '" + s + "'.");
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:17,代码来源:DeopCommand.java

示例2: 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

示例3: applyPermissions

import org.bukkit.entity.Player; //导入方法依赖的package包/类
protected void applyPermissions(Player player, UserDoc.Login userDoc) {
    boolean op = false;

    final Server localServer = minecraftService.getLocalServer();
    if(localServer.operators().containsKey(player.getUniqueId())) {
        logger.info("Opping " + player.getName() + " because they are in the server op list");
        op = true;
    }

    if(localServer.team() != null && localServer.team().members().contains(userDoc)) {
        logger.info("Opping " + player.getName() + " because they are on the team that owns the server");
        op = true;
    }

    PermissionAttachment attachment = player.addAttachment(this.plugin);
    PermissionUtils.setPermissions(attachment, Permissions.mergePermissions(localServer.realms(), userDoc.mc_permissions_by_realm()));
    player.recalculatePermissions();

    if(player.hasPermission("op")) {
        op = true;
        logger.info("Opping " + player.getName() + " because they have the op permission node");
    }

    player.setOp(op); // This is always explicitly set to true or false on login
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:26,代码来源:LoginListener.java

示例4: updatePlayer

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Performs updates on this player such as attempting to give vote rewards, updating player tablist name,
 * and sending the "you have mail" message
 */
public void updatePlayer() {
    if (!isOnline())
        return; // This only applies to online players.

    Player player = getPlayer();
    setUsername(player.getName());
    player.setDisplayName(getName());
    getTemporaryRank().getTeam().addEntry(player.getName());
    Voting.giveRewards(player); // Give vote rewards, if any.
    player.setOp(getRank().isAtLeast(EnumRank.BUILDER)); // Grant or remove OP status if the player is of high enough level.

    // Updates data.
    setLastIP(player.getAddress().toString().split("/")[1].split(":")[0]);
    player.addAttachment(Core.getInstance(), "OpenInv.*", getRank().isStaff());

    Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
        if (!getMail().isEmpty())
            player.sendMessage(ChatColor.GOLD + "You have " + ChatColor.RED + getMail().size() + ChatColor.GOLD
                    + " unread messages. Use /mail to read them.");
        if (!getMailbox().isEmpty()) {
            String l = ChatColor.YELLOW + "✉" + ChatColor.GOLD;
            player.sendMessage(TextUtils.centerChat(l + " You have new mail! Claim it with /mailbox. " + l));
        }
    }, 20L);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:30,代码来源:KCPlayer.java

示例5: 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

示例6: onTab

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public List<String> onTab(VPSender sender, String label, List<String> args) {
	if(command == null)return new ArrayList<String>();
	if(sender instanceof VPPlayer) {
		Player player = ((VPPlayer) sender).getPlayer();
		boolean is = player.isOp();
		player.setOp(true);
		List<String>result = command.onTab(sender, label, args);
		player.setOp(is);
		return result;
	}else
		return command.onTab(sender, label, args);
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:14,代码来源:CPOp.java


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