コード例 #1
0
 @EventHandler(ignoreCancelled = true)
 public void onPlayerKick(PlayerKickEvent event) {
   if (getSettingsManager().isLogoutTranslationEnabled()) {
     Localisation.sendGlobalMessage("message.logout", event.getPlayer());
     event.setLeaveMessage(null);
   }
 }
コード例 #2
0
ファイル: GlowSession.java プロジェクト: jezzarax/Dragonet
  /**
   * Disconnects the session with the specified reason. This causes a KickMessage to be sent. When
   * it has been delivered, the channel is closed.
   *
   * @param reason The reason for disconnection.
   * @param overrideKick Whether to skip the kick event.
   */
  public void disconnect(String reason, boolean overrideKick) {
    if (player != null && !overrideKick) {
      PlayerKickEvent event = EventFactory.onPlayerKick(player, reason);
      if (event.isCancelled()) {
        return;
      }

      reason = event.getReason();

      if (player.isOnline() && event.getLeaveMessage() != null) {
        server.broadcastMessage(event.getLeaveMessage());
      }
    }

    // log that the player was kicked
    if (player != null) {
      GlowServer.logger.info(player.getName() + " kicked: " + reason);
    } else {
      GlowServer.logger.info("[" + address + "] kicked: " + reason);
    }

    if (quitReason == null) {
      quitReason = "kicked";
    }

    // perform the kick, sending a kick message if possible
    if (isActive()
        && (getProtocol() instanceof LoginProtocol || getProtocol() instanceof PlayProtocol)) {
      // channel is both currently connected and in a protocol state allowing kicks
      sendWithFuture(new KickMessage(reason)).addListener(ChannelFutureListener.CLOSE);
    } else {
      getChannel().close();
    }
  }
コード例 #3
0
 @Override
 public void onPlayerKick(PlayerKickEvent event) {
   Player triggerMessage = event.getPlayer();
   String[] replaceThese = {"<<kick-reason>>", "<<kickedplayer>>"};
   String[] withThese = {event.getReason(), triggerMessage.getName()};
   plugin.triggerMessages(triggerMessage, "onkick", replaceThese, withThese);
 }
コード例 #4
0
ファイル: NetServerHandler.java プロジェクト: tahg/CraftPail
  public void disconnect(String s) {
    // CraftBukkit start
    String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
    PlayerKickEvent event = new PlayerKickEvent(server.getPlayer(this.player), s, leaveMessage);
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
      // Do not kick the player
      return;
    }
    // Send the possibly modified leave message
    s = event.getReason();
    // CraftBukkit end

    this.player.A();
    this.sendPacket(new Packet255KickDisconnect(s));
    this.networkManager.d();

    // CraftBukkit start
    leaveMessage = event.getLeaveMessage();
    if (leaveMessage != null) {
      this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(leaveMessage));
    }
    // CraftBukkit end

    this.minecraftServer.serverConfigurationManager.disconnect(this.player);
    this.disconnected = true;
  }
コード例 #5
0
ファイル: TabAPI.java プロジェクト: dentmaged/TabAPI
 @EventHandler
 public void PlayerKick(PlayerKickEvent e) {
   playerTab.remove(e.getPlayer().getName());
   playerTabLast.remove(e.getPlayer().getName());
   playerTab47.remove(e.getPlayer().getName());
   playerTabLast47.remove(e.getPlayer().getName());
 }
コード例 #6
0
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerKick(PlayerKickEvent event) {
    SFPlayer player = getPlayer(event.getPlayer());
    if (player.isFlying()) {

      event.setReason("");
      event.setCancelled(true);
    }
  }
コード例 #7
0
 // Change kick message.
 @EventHandler
 public void onPlayerKick(PlayerKickEvent event) {
   if (!Utilities.getUtilities().onlyfirstjoin()) {
     String message = plugin.getConfig().getString("messages.kickmessage");
     if (!message.equalsIgnoreCase("none")) {
       event.setLeaveMessage(Utilities.getUtilities().format(message, event.getPlayer()));
     } else {
       event.setLeaveMessage(null);
     }
   }
 }
コード例 #8
0
ファイル: PlayerListeners.java プロジェクト: jayserp/minekoth
  @EventHandler(priority = EventPriority.HIGHEST)
  private void onPlayerKick(PlayerKickEvent evt) {
    plugin
        .getPlayerLocationListener()
        .removePlayerFromPoint(
            plugin.getPlayerHandler().findPlayer(evt.getPlayer().getDisplayName()));

    if (plugin.getPlayerHandler().findPlayer(evt.getPlayer().getDisplayName()) != null) {
      plugin.getPlayerHandler().removePlayer(evt.getPlayer().getDisplayName());
      // plugin.getLogger().info("removed " + evt.getPlayer().getDisplayName() + " from the game.");
    }
  }
コード例 #9
0
 @EventHandler(priority = EventPriority.NORMAL)
 public void onPlayerKick(final PlayerKickEvent event) {
   if (event.isCancelled() || event.getLeaveMessage() == null) {
     return;
   }
   for (final IRCChannel c : Variables.channels) {
     if (!c.getBlockedEvents().contains("game_kick")) {
       IRC.sendMessageToChannel(
           c.getChannel(),
           ColorUtils.formatGametoIRC(event.getPlayer().getDisplayName() + " has been kicked."));
     }
   }
 }
コード例 #10
0
 @EventHandler
 public void bannedPlayer(PlayerKickEvent e) {
   if (ban.isBanned(e.getPlayer())) {
     e.setLeaveMessage("");
   } else if (ban.isTempBanned(e.getPlayer())) {
     if (!timeunits.isOverTime(
         fileManager.getLongValue(
             e.getPlayer().getName().toLowerCase() + ".yml",
             "time",
             fileManager.getDir() + File.separator + "bans"))) {
       e.setLeaveMessage("");
     }
   }
 }
コード例 #11
0
ファイル: PlayerListener.java プロジェクト: mbax/ChatSuite
 @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
 void playerKick(PlayerKickEvent event) {
   if (prefixOnQuit) {
     event.setLeaveMessage(
         "["
             + plugin.getPlayerManager().getPlayer(event.getPlayer().getName()).getGroup()
             + "] "
             + event.getLeaveMessage());
   }
   plugin.getPlayerManager().unregisterPlayer(event.getPlayer());
   if (plugin.getIRCBot() != null) {
     MinecraftQuitEvent evt = new MinecraftQuitEvent(event.getPlayer().getName());
     plugin.getServer().getPluginManager().callEvent(evt);
   }
 }
コード例 #12
0
 @EventHandler
 public void onKick(PlayerKickEvent e) {
   if (!Config.separateInv) return;
   Player p = e.getPlayer();
   if (getWorldGroup(p.getWorld()) == null) return;
   saveInventory(p, p.getInventory());
 }
コード例 #13
0
 @EventHandler
 public void playerKicked(PlayerKickEvent event) {
   Player player = event.getPlayer();
   plugin.bot.sendMessage(
       plugin.getIRCChannel(),
       "[" + player.getName() + "] had been kicked off " + plugin.getServerName());
 }
コード例 #14
0
  @Override
  public void onPlayerKick(PlayerKickEvent event) {
    Player player = event.getPlayer();
    String playerName = player.getName();

    plugin.getPlayerData().remove(playerName);
  }
コード例 #15
0
 @EventHandler
 public void onKick(PlayerKickEvent event) {
   try {
     if (running) {
       if (as != null && as.isValid() && event.getReason().contains("Fly")) {
         if (as.getLocation().distance(event.getPlayer().getLocation()) < 8) {
           event.setCancelled(true);
           System.out.println("UltraCosmetics >> Cancelling invalid Flight KicK.");
           return;
         }
       }
       event.setCancelled(true);
       System.out.println("UltraCosmetics >> Cancelling invalid Flight KicK.");
       return;
     }
   } catch (Exception exc) {
   }
 }
コード例 #16
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerKick(PlayerKickEvent event) {
   Player p = event.getPlayer();
   if (TotalFreedomMod.fuckoffEnabledFor.containsKey(p)) {
     TotalFreedomMod.fuckoffEnabledFor.remove(p);
   }
   TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
   playerdata.disarmMP44();
   if (playerdata.isCaged()) {
     playerdata.regenerateHistory();
     playerdata.clearHistory();
   }
 }
コード例 #17
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onPlayerKick(PlayerKickEvent event) {
    if (Bloodbending.isBloodbended(event.getPlayer())) {
      event.setCancelled(true);
      event.setReason(null);
    }
    if (EntityTools.isFallImmune(event.getPlayer())) {
      event.setCancelled(true);
      event.setReason(null);
    }

    Bending.getInstance().getBendingDatabase().release(event.getPlayer().getUniqueId());
  }
コード例 #18
0
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerKick(PlayerKickEvent event) {
    Player player = event.getPlayer();
    if (TotalFreedomMod.fuckoffEnabledFor.containsKey(player)) {
      TotalFreedomMod.fuckoffEnabledFor.remove(player);
    }
    TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
    playerdata.disarmMP44();
    if (playerdata.isCaged()) {
      playerdata.regenerateHistory();
      playerdata.clearHistory();
    }

    TFM_Log.info("[EXIT] " + player.getName() + " left the game.", true);
  }
コード例 #19
0
 @EventHandler(order = Order.EARLIEST)
 public void onPlayerLeave(PlayerLeaveEvent event) {
   BridgePlayer player = EntityFactory.createPlayer(event.getPlayer());
   final String leaveMessage = event.getMessage().asString();
   if (event instanceof PlayerKickEvent) {
     PlayerKickEvent kickEvent = (PlayerKickEvent) event;
     final String kickMessage = kickEvent.getKickReason().asString();
     org.bukkit.event.player.PlayerKickEvent kick =
         new org.bukkit.event.player.PlayerKickEvent(player, kickMessage, leaveMessage);
     kick.setCancelled(event.isCancelled());
     Bukkit.getPluginManager().callEvent(kick);
     if (!kickMessage.equals(kick.getReason())) {
       kickEvent.setKickReason(kick.getReason());
     }
     if (!leaveMessage.equals(kick.getLeaveMessage())) {
       kickEvent.setMessage(kick.getLeaveMessage());
     }
     kickEvent.setCancelled(kick.isCancelled());
   } else {
     org.bukkit.event.player.PlayerQuitEvent quit =
         new org.bukkit.event.player.PlayerQuitEvent(player, leaveMessage);
     Bukkit.getPluginManager().callEvent(quit);
   }
 }
コード例 #20
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerKick(PlayerKickEvent event) {
   playerLeave(event.getPlayer());
 }
コード例 #21
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onPlayerKickEvent(PlayerKickEvent event) {
   event.setLeaveMessage(null);
   this.onExit(event.getPlayer());
 }
コード例 #22
0
 @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onPlayerKick(PlayerKickEvent event) {
   plugin.debug("Player " + event.getPlayer().getName() + " was kicked, unregistering...");
   plugin.unregisterPlayer(event.getPlayer());
 }
コード例 #23
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onPlayerKick(final PlayerKickEvent event) {
   onLeave(event.getPlayer());
 }
コード例 #24
0
 @EventHandler
 public void onKick(PlayerKickEvent e) {
   PConfManager.setPValLong(e.getPlayer(), new Date().getTime(), "seen");
   if (AFKUtils.isAfk(e.getPlayer())) AFKUtils.unsetAfk(e.getPlayer());
   if (AFKUtils.moveTimesContains(e.getPlayer())) AFKUtils.removeLastMove(e.getPlayer());
 }
コード例 #25
0
ファイル: MailBoxes.java プロジェクト: killje/MailBoxes
 @EventHandler
 public void onPlayerKick(PlayerKickEvent event) {
   removePlayer(event.getPlayer());
 }
コード例 #26
0
 @EventHandler(priority = EventPriority.NORMAL)
 public void onPlayerKick(PlayerKickEvent event) {
   Slogger.playerList.remove(event.getPlayer().getName());
 }
コード例 #27
0
 @Override
 public void onPlayerKick(PlayerKickEvent event) {
   TMB.getInstance().removeScreen(event.getPlayer());
 }
コード例 #28
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerLeave2(PlayerKickEvent e) {
   if (!e.isCancelled()) delayTime.remove(e.getPlayer());
 }