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


Java Player.kickPlayer方法代码示例

本文整理汇总了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 + "``.");
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:12,代码来源:CommandKick.java

示例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;
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:17,代码来源:PlayerManager.java

示例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);
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:26,代码来源:PlayerListener.java

示例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.");
        }
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaCore,代码行数:28,代码来源:KickCommand.java

示例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();
  }
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:11,代码来源:AzureAPI.java

示例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();
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:13,代码来源:ResourcePacksManagerImpl.java

示例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());
/*     */     }
/*     */   }
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:8,代码来源:DeathbanListener.java

示例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;
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:39,代码来源:BanCmd.java

示例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");
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:15,代码来源:GameManager.java

示例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;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:13,代码来源:BungeeGameEntity.java

示例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();
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:33,代码来源:SurvivalTeamGame.java

示例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);

    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:41,代码来源:RunBasedSoloGame.java

示例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));
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:4,代码来源:AntiCheat.java

示例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.");
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:PollKick.java

示例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.");
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaCore,代码行数:7,代码来源:SakiShieldCore.java


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