本文整理汇总了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));
}
}
}
示例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;
}
示例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);
}
}
示例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 + "'.");
}
}
示例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;
}
示例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));
}
}
}
示例7: AddMin
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public AddMin() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.isOp()) {
noreload.put(player.getName(), true);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
}
}
示例13: hasSpecPermission
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean hasSpecPermission(Player player) {
return player.isOp() || player.hasPermission("swr.spectateshop");
}
示例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);
}
示例15: hasColorPermission
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean hasColorPermission(Player player) {
return player.isOp() || player.hasPermission("swr.colorshop");
}