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


Java Bukkit.getPlayerExact方法代码示例

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


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

示例1: Cheak

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private int Cheak(String[] args) {
	if (args[0] == null) {
		return 0;
	} else if (Bukkit.getPlayerExact(args[0]) == null) {
		return 3;
	} else if (args[1] == null) {
		return 0;
	} else if (CheckPS(args[1]) == false) {
		return 4;
	} else if (args[2] == null) {
		return 0;
	} else if (args[3] == null) {
		return 0;
	} else if (CheakColor(args[3]) == false) {
		return 1;
	} else if (CheakFormat(args[4]) == false) {
		return 2;
	} else
		return 233;
}
 
开发者ID:CBM1014,项目名称:MelonNametag,代码行数:21,代码来源:Commands.java

示例2: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (!(sender instanceof Player)) {
        Chat.player(sender, "&cThis command is only available for players!");
        return true;
    }
    Player p = (Player) sender;
    if (args.length == 0) {
    	Chat.player(sender, "&cUse command like this: /team [message]");
    	return true;
    }
    StringBuilder sb = new StringBuilder();
    for (String arg : args) {
    	sb.append(arg);
    	sb.append(" ");
    }
    Team team = Team.getTeam(p);
    for (String s : team.getMembers()) {
    	Player t = Bukkit.getPlayerExact(s);
    	Chat.player(t, "&2/team &7" + team.getColor() + p.getName() + "&f: " + sb.toString());
    	return true;
    }
    
    return true;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:26,代码来源:TeamChatCmd.java

示例3: incrementUser

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void incrementUser(User user, String reason) {
    if(user == null) {
        System.err.println("User reported null!");
        return;
    }
    Player player = Bukkit.getPlayerExact(user.getName());
    if(player != null && user.getLevel() < MagicNumbers.MAX_WARN) {
        player.sendMessage(DynamicAC.prefix + "You've been warned for hacking!");
        if(reason.isEmpty()) {
            for (Player p : DynamicAC.instance.onlinestaff) {
                p.sendMessage(DynamicAC.prefix + player.getName() + " failed a check!");
            }
        }
        int warns = user.increment();
        user.serialize();
        DynamicAC.punishmentLog(user.getName() + " incremented to " + user.getLevel() + " at " + LocalDateTime.now()
                + ".");
        if (warns >= MagicNumbers.MAX_WARN && !player.isOnline()) {
            users.remove(user);
            user = null; // so it can be garbage collected
        }
    }
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:24,代码来源:UserManager.java

示例4: getDisplayName

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static String getDisplayName(@Nullable String username, CommandSender viewer) {
    if(username == null || username.trim().length() == 0 || username.trim().equalsIgnoreCase("CONSOLE")) {
        return CONSOLE_DISPLAY_NAME;
    } else {
        Player targetPlayer = Bukkit.getPlayerExact(username, viewer);
        if(targetPlayer == null) {
            return ChatColor.DARK_AQUA + username;
        } else {
            return targetPlayer.getDisplayName(viewer);
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:13,代码来源:CommandUtils.java

示例5: runCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private void runCommand(Command command) {
    Player player = Bukkit.getPlayerExact(command.getPlayer().getName());
    if (command.isRequiredOnline() && (player == null || !player.isOnline())) {
        return;
    }

    if (command.getRequiredSlots() > 0 && (player != null && player.isOnline())) {
        if (getEmptySlots(player.getInventory()) < command.getRequiredSlots()) {
            return;
        }
    }

    if (MCMarket.getApi().setExecuted(command.getId())) {
        plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, () -> {
            plugin.getServer().getScheduler().runTask(plugin, () -> plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command.getCommand()));
            if (command.isRepeat()) {
                long period = command.getRepeatPeriod() > 0 ? 20 * 60 * 60 * command.getRepeatPeriod() : 1;
                new BukkitRunnable() {
                    int executed = 0;

                    @Override
                    public void run() {
                        plugin.getServer().getScheduler().runTask(plugin, () -> plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command.getCommand()));
                        executed++;

                        if (executed >= command.getRepeatCycles()) {
                            cancel();
                        }
                    }
                }.runTaskTimerAsynchronously(plugin, period, period);
            }
        }, command.getDelay() > 0 ? 20 * command.getDelay() : 1);
    }
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:35,代码来源:PurchasesTask.java

示例6: updateSpectators

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static void updateSpectators() {
	for (String list : getSpectators()) {
		Player t = Bukkit.getPlayerExact(list);
		if (t == null || !t.isOnline())
			continue;
		
		t.setAllowFlight(true);
		
		for (Player p : Bukkit.getOnlinePlayers()) {
			if (getSpectators().contains(p.getName()))
				continue;
			p.hidePlayer(t);
		}
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:16,代码来源:Walls.java

示例7: getOwner

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public Player getOwner(){
	if(this.ownerIdentification == null){ return null; }
	if(this.ownerIdentification instanceof UUID){
		return Bukkit.getPlayer((UUID) ownerIdentification);
	}else{
		return Bukkit.getPlayerExact((String) this.ownerIdentification);
	}
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:10,代码来源:Pet.java

示例8: onCommand

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	if (Rank.getRank(sender.getName()).getType().getLevel() < RankType.MOD.getLevel()) {
		Chat.player(sender, "&cYou don't have permission to do this.");
		return true;
	}
    if (args.length < 2) {
    	Chat.player(sender, "&cUsage: /ban [username] [reason]");
    	return true;
    }
    
    String username = null;
    String reason = Chat.stripColor(StringUtils.join(args, " ", 1, args.length));
    
    Player p = Bukkit.getPlayerExact(args[0]);
    if (p != null)
    	username = p.getName();
    else {
    	String check = Hive.getInstance().getUsername(args[0]);
    	if (check != null)
    		username = check;
    }
    if (username == null) {
    	Chat.player(sender, "&cNo player found by the name of, " + args[0]);
    	return true;
    }
    String prefix = "INSERT INTO infractions (username,staff,type,reason) VALUES ";
    String content = "('" + username + "','" + sender.getName() + "','ban','" + reason + "')";
    Hive.getInstance().getDatabase().update(prefix + content);
    
    Chat.player(sender, "&4[Ban] &b" + username + " &7&ofor &c" + reason);
    
    Ban i = new Ban(username, reason, Hive.getInstance().getServerTime());
  	if (p != null && p.isOnline())
  		p.kickPlayer(i.getKickMessage());
  	
    return true;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:39,代码来源:BanCmd.java

示例9: getPlayerOf

import org.bukkit.Bukkit; //导入方法依赖的package包/类
/**
 * Returns the player represented by the given identification (retrieved by using this class)
 * <p/>
 * This method makes use of both player names and UUIDs to find the required online player
 *
 * @param identification identification to search with
 * @return player represented by the given identification, or null if the player is not online
 */
public static Player getPlayerOf(Object identification) {
    if (supportsUuid()) {
        if (identification instanceof UUID) {
            return Bukkit.getPlayer((UUID) identification);
        } else if (identification instanceof String) {
            return Bukkit.getPlayer(convertUUID((String) identification));
        }
    } else if (identification instanceof String) {
        return Bukkit.getPlayerExact((String) identification);
    }
    return null;
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:21,代码来源:UUIDMigration.java

示例10: reset

import org.bukkit.Bukkit; //导入方法依赖的package包/类
protected void reset() {
    Player player = Bukkit.getPlayerExact(playerName);
    if(player != null && player.isOnline()) {
        player.sendMessage(DynamicAC.prefix + "Your warn level was cleared!");
    }
    this.level = 0;
    serialize();
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:9,代码来源:User.java

示例11: update

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public void update() {
	if (entity != null) {
		//((CraftEntity) entity).getHandle().setEquipment(4, new net.minecraft.server.v1_5_R2.ItemStack(Item.DIAMOND_HELMET));
		//Chat.server(((CraftEntity) entity).getHandle().getEquipment().toString());
		Player owner = Bukkit.getPlayerExact(this.owner);
		if (owner == null)
			return;
        entity.setCustomName(nameColor + name);
        entity.setCustomNameVisible(true);
        if (entity instanceof Tameable) {
        	tamed = true;
        	((Tameable) entity).setTamed(true);
        	((Tameable) entity).setOwner(owner);
        }
        if (entity instanceof Ageable && age != null) {
        	if (getAge() == Age.BABY)
        		((Ageable) entity).setBaby();
        	((Ageable) entity).setAgeLock(true);
        }
        if (entity instanceof Zombie && age != null) {
        	if (getAge() == Age.BABY)
        		((Zombie) entity).setBaby(true);
        }
        if (entity instanceof Sheep && color != null) {
        	((Sheep) entity).setColor(getColor());
        }
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:29,代码来源:PetInstance.java

示例12: report

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private static void report(String playername, Player reporter, String reason, String... message) {
    Player player = Bukkit.getPlayerExact(playername);
    if (player == null) {
        reporter.sendMessage(ChatColor.RED + "That player cannot be found!");
        return;
    }
    for (Player p : DynamicAC.instance.onlinestaff) {
        p.sendMessage(DynamicAC.prefix + ChatColor.AQUA + reporter.getName() + " reported " + player.getName() +
                " for " + reason + " with this message: " + ChatColor.GOLD + (message[0] != null ? message[0] : "") + (message[1] != null ? message[1] : "") + (message[2] != null ? message[2] : "") + (message[3] != null ? message[3] : "") + (message[4] != null ? message[4] : "") + (message[5] != null ? message[5] : "") + (message[6] != null ? message[6] : "") + (message[7] != null ? message[7] : "") + (message[8] != null ? message[8] : "") + (message[9] != null ? message[9] : "") + (message[10] != null ? message[10] : ""));
    }
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:12,代码来源:CommandDispatcher.java

示例13: createThread

import org.bukkit.Bukkit; //导入方法依赖的package包/类
protected void createThread() {
    playerThread = new Thread(new Runnable() {
        @Override
        public void run() {
            while (!destroyed) {
                long startTime = System.currentTimeMillis();
                synchronized (SongPlayer.this) {
                    if (playing) {
                        calculateFade();
                        tick++;
                        if (tick > song.getLength()) {
                            playing = false;
                            tick = -1;
                            SongEndEvent event = new SongEndEvent(SongPlayer.this);
                            Bukkit.getPluginManager().callEvent(event);
                            if (autoDestroy) {
                                destroy();
                                return;
                            }
                        }
                        for (String s : playerList) {
                            @SuppressWarnings("deprecation")
                            Player p = Bukkit.getPlayerExact(s);
                            if (p == null) {
                                // offline...
                                continue;
                            }
                            playTick(p, tick);
                        }
                    }
                }
                long duration = System.currentTimeMillis() - startTime;
                float delayMillis = song.getDelay() * 50;
                if (duration < delayMillis) {
                    try {
                        Thread.sleep((long) (delayMillis - duration));
                    } catch (InterruptedException e) {
                        // do nothing
                    }
                }
            }
        }
    });
    playerThread.setPriority(Thread.MAX_PRIORITY);
    playerThread.start();
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:47,代码来源:SongPlayer.java

示例14: doesPlayerExist

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public static boolean doesPlayerExist(String name) {
    return Bukkit.getPlayerExact(name) != null;
}
 
开发者ID:OvercastNetwork,项目名称:ChatModerator,代码行数:4,代码来源:PatternUtils.java

示例15: createThread

import org.bukkit.Bukkit; //导入方法依赖的package包/类
protected void createThread() {
    playerThread = new Thread(new Runnable() {
        @Override
        public void run() {
            while (!destroyed) {
                long startTime = System.currentTimeMillis();
                synchronized (SongPlayer.this) {
                    if (playing) {
                        calculateFade();
                        tick++;
                        if (tick > song.getLength()) {
                            playing = false;
                            tick = -1;
                            SongEndEvent event = new SongEndEvent(SongPlayer.this);
                            Bukkit.getPluginManager().callEvent(event);
                            if (autoDestroy) {
                                destroy();
                                return;
                            }
                        }
                        for (String s : playerList) {
                            Player p = Bukkit.getPlayerExact(s);
                            if (p == null) {
                                // offline...
                                continue;
                            }
                            playTick(p, tick);
                        }
                    }
                }
                long duration = System.currentTimeMillis() - startTime;
                float delayMillis = song.getDelay() * 50;
                if (duration < delayMillis) {
                    try {
                        Thread.sleep((long) (delayMillis - duration));
                    } catch (InterruptedException e) {
                        // do nothing
                    }
                }
            }
        }
    });
    playerThread.setPriority(Thread.MAX_PRIORITY);
    playerThread.start();
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:46,代码来源:SongPlayer.java


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