本文整理汇总了Java中org.bukkit.entity.Player.kickPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java Player.kickPlayer方法的具体用法?Java Player.kickPlayer怎么用?Java Player.kickPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.kickPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
protected void onCommand(CommandSender sender, String[] args) {
if (!Utils.isVisible(sender, args[0]))
return;
Player p = Bukkit.getPlayer(args[0]);
String reason = args.length > 1 ? String.join(" ", Utils.shift(args)) : "Kicked by an operator.";
p.kickPlayer(reason);
sender.sendMessage("Kicked " + p.getName() + (reason != null && reason.length() > 0 ? " for " + reason : "") + ".");
DiscordAPI.sendMessage(DiscordChannel.ORYX, sender.getName() + " kicked " + p.getName() + " for ``" + reason + "``.");
}
示例2: preLoad
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private VPPlayer preLoad(Player player) {
VPPlayer playerPlus = getPlayer(player);
if(playerPlus == null){
player.kickPlayer("§4CRITCAL ERROR");
return null;
}
playerPlus.setRealName(player.getName());
playerPlus.setPlayer(player);
VanillaPlusCore.getChannelManager().init(playerPlus);
VanillaPlusCore.getStatManager().load(playerPlus);
VanillaPlusCore.getAchievementManager().load(playerPlus);
VanillaPlusCore.getTitleManager().load(playerPlus);
VanillaPlusCore.getCurrencyManager().load(playerPlus);
return playerPlus;
}
示例3: onPlayerMoveWhenNotLoaded
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerMoveWhenNotLoaded(PlayerMoveEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.isAllowedWorld(player.getWorld()) || InventoryManager.playerIsLoaded(player)) {
return;
}
if (PlayerLoader.isPreparedPlayer(player)) {
PlayerLoader.removePlayer(player);
player.kickPlayer(RPGInventory.getLanguage().getMessage("error.rp.denied"));
event.setCancelled(true);
} else {
Location toLocation = event.getTo();
Location newLocation = event.getFrom().clone();
//noinspection deprecation
if (!player.isOnGround()) {
newLocation.setY(toLocation.getY());
}
newLocation.setPitch(toLocation.getPitch());
newLocation.setYaw(toLocation.getYaw());
event.setTo(newLocation);
}
}
示例4: executePlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void executePlayer(Player p, PlayerData pd, String[] args) {
if (pd.getRank() == Rank.BUILDER)
return;
if (args.length == 0) {
p.sendMessage(ChatColor.RED + "/kick <player> <reason>");
p.sendMessage(ChatColor.RED + "WARNING: Do not abuse staff privileges.");
} else if (args.length == 1) {
p.sendMessage(ChatColor.RED + "You must give a reason for kicking!");
p.sendMessage(ChatColor.RED + "/kick <player> <reason>");
} else if (args.length >= 2) {
Player p2 = plugin.getServer().getPlayer(args[0]);
if (p2 != null && p2.isValid() && p2.isOnline()) {
StringBuilder sb = new StringBuilder();
for (int k = 1; k < args.length; k++) {
sb.append(args[k]);
sb.append(' ');
}
String reason = sb.toString().trim();
String announce = ChatColor.YELLOW + p2.getName() + ChatColor.RED + " was kicked by " + ChatColor.YELLOW + p.getName() + ChatColor.RED + " for: " + ChatColor.WHITE + ChatColor.BOLD + reason + ".";
RMessages.announce(ChatColor.GRAY + "> " + announce);
p2.kickPlayer("You were kicked by " + p.getName() + " for: " + reason + ".");
} else {
p.sendMessage("User is not online.");
}
}
}
示例5: RestartServer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void RestartServer(String message){
AzureAPI.log("开始以理由 " + message +"重启服务器...");
List<Player> players = AzurePlayerList.players();
int ps = players.size();
for(int i=0;i<ps;i++){
Player player = players.get(i);
player.kickPlayer(loggerPrefix + message);
}
Bukkit.shutdown();
}
示例6: kickAllUndownloaded
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void kickAllUndownloaded()
{
for (UUID id : currentlyDownloading)
{
Player player = Bukkit.getPlayer(id);
if (player != null)
player.kickPlayer(rejectMessage);
}
currentlyDownloading.clear();
}
示例7: handleKick
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void handleKick(Player player, Deathban deathban) {
/* 155 */ if (this.plugin.getEotwHandler().isEndOfTheWorld()) {
/* 156 */ player.kickPlayer(ChatColor.RED + "Deathbanned for the entirety of the map due to EOTW.\nVisit www.hcriots.com for SOTW info!");
/* */ } else {
/* 158 */ player.kickPlayer(ChatColor.RED + "You are now Deathbanned \n Duration: " + ChatColor.WHITE + DurationFormatter.getRemaining(deathban.getRemaining(), true, false) + "" + ChatColor.WHITE + deathban.getReason());
/* */ }
/* */ }
示例8: onCommand
import org.bukkit.entity.Player; //导入方法依赖的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;
}
示例9: kickPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void kickPlayer(Player p, String msg)
{
if (!this.api.getPlugin().isEnabled())
{
p.kickPlayer(msg);
return;
}
if (!p.isOnline())
return;
this.api.getPlayerManager().connectToServer(p.getUniqueId(), "lobby");
}
示例10: leave
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Lets a player leave the game
*
* @param player player
* @return success
*/
@Override
public synchronized boolean leave(Player player) {
final boolean success = super.leave(player);
player.kickPlayer(this.arena.getTeamMeta().getLeaveMessage());
return success;
}
示例11: startGame
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* See SamaGamesAPI
*/
@Override
public void startGame()
{
List<UUID> uuids = new ArrayList<>();
uuids.addAll(this.getInGamePlayers().keySet());
for (UUID uuid : uuids)
{
Player player = Bukkit.getPlayer(uuid);
if (player == null)
continue;
if (this.getPlayerTeam(uuid) == null)
{
SurvivalTeam team;
if (this.teamBalancing)
team = this.teams.stream().filter(t -> !t.isFull() && !t.isLocked()).sorted((t1, t2) -> t1.getPlayersUUID().size() - t2.getPlayersUUID().size()).findFirst().orElse(null);
else
team = this.teams.stream().filter(t -> !t.isFull() && !t.isLocked()).findFirst().orElse(null);
if (team == null)
player.kickPlayer(ChatColor.RED + "Aucune team était apte à vous reçevoir, vous avez été réenvoyé dans le hub.");
else
team.join(uuid);
}
}
super.startGame();
}
示例12: teleportDeathMatch
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* See {@link RunBasedGame}
*/
@Override
public void teleportDeathMatch()
{
Collections.shuffle(this.spawns);
Iterator<Location> locationIterator = this.spawns.iterator();
List<UUID> players = new ArrayList<>();
players.addAll(this.getInGamePlayers().keySet());
for (UUID uuid : players)
{
Player player = Bukkit.getPlayer(uuid);
if (player == null)
{
this.gamePlayers.remove(uuid);
continue;
}
if (!locationIterator.hasNext())
{
player.kickPlayer(ChatColor.RED + "Plus de place dans la partie.");
this.gamePlayers.remove(uuid);
continue;
}
this.removeEffects(player);
Location location = locationIterator.next();
Location destination = new Location(location.getWorld(), location.getX() * 4 / 10, 150.0, location.getZ() * 4 / 10);
ChunkUtils.loadDestination(player, destination, 3);
Bukkit.getScheduler().runTaskLater(plugin, () -> player.teleport(destination), 2);
}
}
示例13: kickPlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void kickPlayer(Player player, Reason reason, String message) {
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', "&4[SuperiorCraft > SuperiorSecure] You were kicked for " + reason.getReadableName() + "\n" + message));
}
示例14: executeAction
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void executeAction() {
Player player = this.server.getPlayerExact(this.player);
if(player != null) player.kickPlayer(ChatColor.DARK_RED + "You were poll-kicked.");
this.server.broadcastMessage(ChatColor.RED + this.player + ChatColor.YELLOW + " has been kicked.");
}
示例15: check
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void check(Player p) {
if (warnLevels.getOrDefault(p.getName(), 0) > KICK_THRESHOLD) {
p.kickPlayer(PREFIX + "Kicked for reaching SakiShield suspicion threshold.");
RMessages.announce(PREFIX + p.getName() + " was kicked for reaching the suspicion threshold.");
}
}