Ejemplo n.º 1
0
 @EventHandler(ignoreCancelled = true)
 public void onPlayerKick(PlayerKickEvent event) {
   if (getSettingsManager().isLogoutTranslationEnabled()) {
     Localisation.sendGlobalMessage("message.logout", event.getPlayer());
     event.setLeaveMessage(null);
   }
 }
Ejemplo n.º 2
0
  /**
   * 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();
    }
  }
Ejemplo n.º 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);
 }
Ejemplo n.º 4
0
  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;
  }
Ejemplo n.º 5
0
 @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());
 }
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerKick(PlayerKickEvent event) {
    SFPlayer player = getPlayer(event.getPlayer());
    if (player.isFlying()) {

      event.setReason("");
      event.setCancelled(true);
    }
  }
Ejemplo n.º 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);
     }
   }
 }
Ejemplo n.º 8
0
  @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.");
    }
  }
 @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."));
     }
   }
 }
Ejemplo n.º 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("");
     }
   }
 }
Ejemplo n.º 11
0
 @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);
   }
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 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());
 }
  @Override
  public void onPlayerKick(PlayerKickEvent event) {
    Player player = event.getPlayer();
    String playerName = player.getName();

    plugin.getPlayerData().remove(playerName);
  }
Ejemplo n.º 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) {
   }
 }
 @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();
   }
 }
  @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());
  }
  @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);
  }
Ejemplo n.º 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);
   }
 }
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerKick(PlayerKickEvent event) {
   playerLeave(event.getPlayer());
 }
Ejemplo n.º 21
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onPlayerKickEvent(PlayerKickEvent event) {
   event.setLeaveMessage(null);
   this.onExit(event.getPlayer());
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 23
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onPlayerKick(final PlayerKickEvent event) {
   onLeave(event.getPlayer());
 }
 @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());
 }
Ejemplo n.º 25
0
 @EventHandler
 public void onPlayerKick(PlayerKickEvent event) {
   removePlayer(event.getPlayer());
 }
Ejemplo n.º 26
0
 @EventHandler(priority = EventPriority.NORMAL)
 public void onPlayerKick(PlayerKickEvent event) {
   Slogger.playerList.remove(event.getPlayer().getName());
 }
Ejemplo n.º 27
0
 @Override
 public void onPlayerKick(PlayerKickEvent event) {
   TMB.getInstance().removeScreen(event.getPlayer());
 }
Ejemplo n.º 28
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerLeave2(PlayerKickEvent e) {
   if (!e.isCancelled()) delayTime.remove(e.getPlayer());
 }