Beispiel #1
0
  @EventHandler
  public void onPlayerQuit(PlayerQuitEvent e) {
    Player p = e.getPlayer();

    if (Config.getConfig().getBoolean("options.set-fly-on-join.fly")) p.setAllowFlight(false);

    if (Config.getConfig().getBoolean("broadcast.player-quit.enabled")) {
      if (Config.getConfig().getBoolean("broadcast.player-quit.hide")) {
        e.setQuitMessage(null);
      } else {
        e.setQuitMessage(
            ChatColor.translateAlternateColorCodes(
                '&',
                Config.getConfig()
                    .getString("broadcast.player-quit.message")
                    .replaceAll("%player%", e.getPlayer().getName())));
      }
    }

    if (pvp.containsKey(p)) {
      if (pvp.get(p).isSync()) pvp.get(p).cancel();

      pvp.remove(p);
    }

    if (Commands.delay.containsKey(p)) {
      if (Commands.delay.get(p).getTask().isSync()) Commands.delay.get(p).getTask().cancel();

      Commands.delay.remove(p);
    }
  }
 // Quit Handling
 @EventHandler
 public void onPlayerQuit(PlayerQuitEvent event) {
   if (!Utilities.getUtilities().onlyfirstjoin()) {
     String message = plugin.getConfig().getString("messages.leavemessage");
     if (!message.equalsIgnoreCase("none")) {
       event.setQuitMessage(Utilities.getUtilities().format(message, event.getPlayer()));
     } else {
       event.setQuitMessage(null);
     }
   }
 }
Beispiel #3
0
 @EventHandler
 public void onQuit(PlayerQuitEvent event) {
   Player player = event.getPlayer();
   if (player.isOp()) {
     event.setQuitMessage(
         plugin.getConfig().getString("Messages.Quit.OP").replace("%player%", player.getName()));
   } else if (!player.hasPermission("gcpvp.vip")) {
     event.setQuitMessage(null);
   } else {
     plugin.getConfig().getString("Messages.Quit.VIP");
     event.setQuitMessage(
         plugin.getConfig().getString("Messages.Quit.VIP").replace("%player%", player.getName()));
   }
 }
Beispiel #4
0
 @EventHandler
 public void onLeave(PlayerQuitEvent event) {
   Player player = event.getPlayer();
   if (!player.hasPermission(
       ConfigUtil.get().getConfig().getString("joinleavemessage.permission"))) {
     event.setQuitMessage(null);
   } else {
     event.setQuitMessage(
         ChatColor.translateAlternateColorCodes(
             '&',
             ConfigUtil.get()
                 .getConfig()
                 .getString("joinleavemessage.quit-message")
                 .replaceAll("%player%", player.getDisplayName())));
   }
 }
Beispiel #5
0
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerQuit(final PlayerQuitEvent e) {
    Player player = e.getPlayer();
    SCPlayer scPlayer = getSCPlayer(player.getUniqueId());

    e.setQuitMessage(null);

    if (scPlayer.isCombatTagged()) {
      player.setHealth(0);
      scPlayer.removeCombatTag();
      broadcast(
          new FancyMessage(scPlayer.getTag())
              .tooltip(scPlayer.getHoverText())
              .then(" §5has logged off while in combat!"));
    }

    if (rankManager.getRank(player.getUniqueId()).getId() >= Rank.MOD.getId())
      staff(
          new FancyMessage("§9[STAFF] ")
              .then(scPlayer.getTag())
              .tooltip(scPlayer.getHoverText())
              .then(" §edisconnected."));

    removeSCPlayer(player.getUniqueId());
  }
 @EventHandler(ignoreCancelled = true)
 public void onPlayerQuit(PlayerQuitEvent event) {
   if (getSettingsManager().isLogoutTranslationEnabled()) {
     Localisation.sendGlobalMessage("message.logout", event.getPlayer());
     event.setQuitMessage(null);
   }
 }
  @EventHandler(priority = EventPriority.MONITOR)
  public void quitHandler(PlayerQuitEvent event) {
    // update their spam status
    plugin.spamManager.playerQuit(event.getPlayer());

    // set their persistance
    plugin.ph.setOfflineChannel(
        event.getPlayer().getName(), plugin.channelManager.getPlayerChannel(event.getPlayer()));
    plugin.ph.setOfflineVerbosity(
        event.getPlayer().getName(), plugin.chatManager.getVerbosity(event.getPlayer()));

    // remove them from their channel
    plugin.channelManager.removePlayer(event.getPlayer());
    // and remove them from the VoxelChat list
    plugin.chatManager.disableVoxelChat(event.getPlayer());

    // turn off the global join notification
    event.setQuitMessage("");

    // and do our own custom notification
    Player[] players = plugin.getServer().getOnlinePlayers();
    for (int i = 0; i < players.length; i++) {
      if (plugin.chatManager.getVerbosity(players[i]).compareTo(Verbosity.SHOWSOME) >= 0) {
        // they want these messages! show them!
        // TODO: custom join / leave messages
        ColourHandler.sendMessage(
            players[i],
            plugin.permissions.getUser(event.getPlayer()).getPrefix()
                + event.getPlayer().getName()
                + " &ehas left the game!");
      }
    }
  }
  // <Index = 2>
  @EventHandler
  public void onPlayerQuit(PlayerQuitEvent event) {
    Player p = event.getPlayer();
    final String pName = p.getName();

    event.setQuitMessage(ChatMessages.WHITE + pName + ChatMessages.quitMessage);

    Bukkit.getScheduler()
        .scheduleSyncDelayedTask(
            plugin,
            new Runnable() {
              @Override
              public void run() {
                if (Main.lobbyBoolean == false && Bukkit.getOnlinePlayers().size() < 2) {
                  Main.gameTimer = 5;
                }
              }
            },
            100);
    Bukkit.getScheduler()
        .scheduleSyncDelayedTask(
            Main.getInstance(),
            new Runnable() {
              @Override
              public void run() {
                if (!Bukkit.getOfflinePlayer(pName).isOnline())
                  ScoreboardHandler.removePlayer(pName);
              }
            },
            300L);
  }
Beispiel #9
0
  @EventHandler
  public void onPlayerQuit(PlayerQuitEvent e) {
    Player p = e.getPlayer();
    SPlayer player = new SPlayer(p);

    e.setQuitMessage(null);

    player.removePlayer();
  }
 @Override
 public void onPlayerQuit(PlayerQuitEvent event) {
   Player triggerMessage = event.getPlayer();
   plugin.triggerMessages(triggerMessage, "ondisconnect");
   if (plugin.triggerMessages(triggerMessage, "ondisconnect|override")) {
     event.setQuitMessage("");
   }
   plugin.deathCause.remove(triggerMessage.getEntityId());
   plugin.deathBringer.remove(triggerMessage.getEntityId());
   return;
 }
	@EventHandler(priority = EventPriority.MONITOR)
	public void onPlayerQuit(final PlayerQuitEvent event)
	{
		final String quitMessage = ess.getSettings().getData().getGeneral().getLeaveMessage();
		if (quitMessage != null)
		{
			final IText itOutput = new KeywordReplacer(new SimpleTextInput(quitMessage), userMap.getUser(event.getPlayer()), ess);
			final SimpleTextPager stPager = new SimpleTextPager(itOutput);
			event.setQuitMessage(FormatUtil.replaceFormat(stPager.getString(0)));
		}
		else
		{
			event.setQuitMessage(null);
		}


		final IUser user = userMap.getUser(event.getPlayer());

		final ISettings settings = ess.getSettings();
		if (settings.getData().getCommands().getGod().isRemoveOnDisconnect() && user.isGodModeEnabled())
		{
			user.setGodModeEnabled(false);
		}
		if (user.isVanished())
		{
			user.toggleVanished();
		}
		if (user.getData().getInventory() != null)
		{
			user.getPlayer().getInventory().setContents(user.getData().getInventory().getBukkitInventory());
			user.getData().setInventory(null);
		}
		user.updateActivity(false);
		//user.getPlayer().dispose();
		if (settings.getData().getGeneral().isPtClearOnQuit())
		{
			user.getData().clearAllPowertools();
			user.queueSave();
			user.sendMessage(_("§6All powertool commands have been cleared."));
		}
	}
Beispiel #12
0
  @EventHandler
  public void onQuit(PlayerQuitEvent e) {

    Player p = e.getPlayer();

    if (Join.pOnline < 5) {
      e.setQuitMessage(
          ChatUtils.getGamePrefix()
              + "Suite à la déconnexion de "
              + p.getName()
              + " le nombre de joueurs requis est inssufisant pour commencer la partie.");
    }
  }
  @EventHandler
  public void onPlayerLeave(PlayerQuitEvent e) {

    Player p = e.getPlayer();

    if (ArenaManager.isPlayerPlaying(p)) {

      e.setQuitMessage("");

      Arena arena = ArenaManager.getPlayersArena(p);
      ArenaManager.leave(arena, p, true);
    }
  }
 @EventHandler
 public void onLeave(PlayerQuitEvent e) {
   if (!plugin.getConfig().getBoolean("Complete")) return;
   e.setQuitMessage(null);
   Player p = e.getPlayer();
   if (plugin.spieler != null && plugin.spieler == p) {
     plugin.spieler = null;
     if (!plugin.bfinish) {
       SpeedBuilder.gm.Reset();
     }
   }
   if (plugin.spectating.contains(p)) {
     plugin.spectating.remove(p);
   }
 }
Beispiel #15
0
 @EventHandler(priority = EventPriority.LOWEST)
 void playerQuit(PlayerQuitEvent event) {
   if (prefixOnQuit) {
     event.setQuitMessage(
         "["
             + plugin.getPlayerManager().getPlayer(event.getPlayer().getName()).getGroup()
             + "] "
             + event.getQuitMessage());
   }
   plugin.getPlayerManager().unregisterPlayer(event.getPlayer());
   if (plugin.getIRCBot() != null) {
     MinecraftQuitEvent evt = new MinecraftQuitEvent(event.getPlayer().getName());
     plugin.getServer().getPluginManager().callEvent(evt);
   }
 }
Beispiel #16
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void Quit(PlayerQuitEvent e) {
   Player p = e.getPlayer();
   boolean EMensagem = EssentialsLT.getInstance().getConfig().getBoolean("EMensagem");
   if (EMensagem) {
     if (p.hasPermission("membro")) {
       String saiu =
           EssentialsLT.getInstance()
               .getConfig()
               .getString("saiu")
               .replaceAll("&", "§")
               .replace("[nick]", p.getName());
       e.setQuitMessage(saiu);
     }
   }
 }
Beispiel #17
0
  @EventHandler
  public void onQuit(PlayerQuitEvent event) {
    event.setQuitMessage(null);
    GameArena gameArena = plugin.getGameArena();

    gameArena.purgePlayer(event.getPlayer());

    if (gameArena.isGameRunning()) {
      if (gameArena.shouldEnd()) {
        // Possibly deduct points?
        gameArena.endGame();
      }
    }

    Cooldowns.removeCooldowns(event.getPlayer());

    Profile profile = plugin.getRemovedProfile(event.getPlayer());
    new ProfileSaver(profile, plugin).runTaskAsynchronously(plugin);
  }
Beispiel #18
0
 @EventHandler
 public void onQuit(PlayerQuitEvent pqe) {
   Player player = pqe.getPlayer();
   Factions.pCount -= 1;
   pqe.setQuitMessage("");
   ParticleManager.setParticle(player, null);
   FlyHacks.log.put(player.getName(), 0);
   FlyHacks.fallD.put(player.getName(), 0F);
   Bukkit.getScheduler()
       .scheduleSyncDelayedTask(
           Factions.instance,
           new Runnable() {
             public void run() {
               for (Player pl : Bukkit.getOnlinePlayers()) {
                 ScoreboardManager.setScoreboard(pl);
               }
             }
           },
           1);
 }
Beispiel #19
0
 public void onPlayerLeave(PlayerQuitEvent event) {
   final Player player = event.getPlayer();
   final UUID playeru = player.getUniqueId();
   player.setHealth(20);
   event.setQuitMessage(null);
   Team.getTeam(player).remove(player);
   if (Game.noHit.contains(player)) {
     Game.noHit.remove(player);
     return;
   }
   if (!(player.isOp())) {
     Game.noJoin.add(playeru);
     Bukkit.getServer()
         .getScheduler()
         .scheduleSyncDelayedTask(
             Main.getInstance(),
             new Runnable() {
               public void run() {
                 Game.noJoin.remove(player);
               }
             },
             1200L);
   }
 }
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onPlayerQuitEvent(PlayerQuitEvent event) {
   event.setQuitMessage(null);
   this.onExit(event.getPlayer());
 }
 @EventHandler
 public void onPlayerQuit(PlayerQuitEvent event) {
   event.setQuitMessage(
       ChatColor.DARK_GRAY + "Quit> " + ChatColor.WHITE + event.getPlayer().getName());
   Lobby.get().removePlayer(event.getPlayer());
 }
  @EventHandler
  public void onPlayerQuit(PlayerQuitEvent event) {

    event.setQuitMessage(event.getPlayer().getDisplayName() + ChatColor.YELLOW + " left the game.");
    uncolorPlayer(event.getPlayer());
  }
 @EventHandler
 public void onPlayerQuit(PlayerQuitEvent e) {
   PermissionUser player = PermissionsEx.getUser(e.getPlayer());
   e.setQuitMessage(CoreUtils.colorize(CoreUtils.getPlayerDisplayName(player) + "&7 has left."));
 }