/**
  * This method is called when a player joins the server.
  *
  * @param event The Event that was fired.
  */
 @EventHandler
 public void playerJoin(PlayerJoinEvent event) {
   Player p = event.getPlayer();
   if (!p.hasPlayedBefore()) {
     this.plugin.log(Level.FINER, "Player joined for the FIRST time!");
     if (plugin.getMVConfig().getFirstSpawnOverride()) {
       this.plugin.log(
           Level.FINE,
           "Moving NEW player to(firstspawnoverride): "
               + worldManager.getFirstSpawnWorld().getSpawnLocation());
       this.sendPlayerToDefaultWorld(p);
     }
     return;
   } else {
     this.plugin.log(Level.FINER, "Player joined AGAIN!");
     if (this.plugin.getMVConfig().getEnforceAccess() // check this only if we're enforcing access!
         && !this.plugin
             .getMVPerms()
             .hasPermission(p, "multiverse.access." + p.getWorld().getName(), false)) {
       p.sendMessage("[MV] - Sorry you can't be in this world anymore!");
       this.sendPlayerToDefaultWorld(p);
     }
   }
   // Handle the Players GameMode setting for the new world.
   this.handleGameModeAndFlight(event.getPlayer(), event.getPlayer().getWorld());
   playerWorld.put(p.getName(), p.getWorld().getName());
 }
Beispiel #2
0
  @EventHandler(priority = EventPriority.LOW)
  public void onJoin(PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    String prefix =
        ChatColor.translateAlternateColorCodes(
            '&',
            Core.chat.getGroupPrefix(Bukkit.getWorlds().get(0), Core.chat.getPrimaryGroup(player)));
    player.setDisplayName(prefix + player.getName());
    if (!player.hasPermission(
        ConfigUtil.get().getConfig().getString("joinleavemessage.permission"))) {
      event.setJoinMessage(null);
    } else {
      event.setJoinMessage(
          ChatColor.translateAlternateColorCodes(
              '&',
              ConfigUtil.get()
                  .getConfig()
                  .getString("joinleavemessage.join-message")
                  .replaceAll("%player%", player.getDisplayName())));
    }

    if (ConfigUtil.get().getConfig().getBoolean("tp-to-spawn")) {
      Location teleportTo =
          LocationUtil.get().deserialize(ConfigUtil.get().getConfig().getString("spawn.location"));
      event.getPlayer().teleport(teleportTo);
    }

    EconomyUtil.get().createRowForPlayer(player);
  }
 @Override
 public void onPlayerJoin(PlayerJoinEvent event) {
   Player triggerMessage = event.getPlayer();
   plugin.triggerMessages(triggerMessage, "onlogin");
   if (plugin.triggerMessages(triggerMessage, "onlogin|override")) {
     event.setJoinMessage("");
   }
   return;
 }
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onPlayerJoins(PlayerJoinEvent event) {
   plugin
       .getServer()
       .getScheduler()
       .runTask(plugin, new AddIgnoreSleepTask(plugin, event.getPlayer().getName()));
 }
 @EventHandler()
 public void onPJoin(PlayerJoinEvent e) {
   Player p = e.getPlayer();
   if (plugin.newVersion == null) return;
   if (!plugin.newVersion.contains(plugin.version)
       && !plugin.version.contains("pre")
       && plugin.isAuthorized(p, "rcmds.updates")) {
     String newV = plugin.newVersion.split("RoyalCommands")[1].trim().substring(1);
     p.sendMessage(
         ChatColor.BLUE
             + "RoyalCommands "
             + ChatColor.GRAY
             + "v"
             + newV
             + ChatColor.BLUE
             + " is out! You are running "
             + ChatColor.GRAY
             + "v"
             + plugin.version
             + ChatColor.BLUE
             + ".");
     p.sendMessage(
         ChatColor.BLUE
             + "Get the new version at "
             + ChatColor.DARK_AQUA
             + "http://dev.bukkit.org/server-mods/royalcommands"
             + ChatColor.BLUE
             + ".");
   }
 }
  @EventHandler
  public void playerJoinEvent(PlayerJoinEvent e) {
    Player p = e.getPlayer();

    HealthManager.checkPlayerHealth(p, p.getWorld());

    RaceManager.addPlayerToRaceMap(p);
  }
 @EventHandler(priority = EventPriority.LOWEST)
 public void onPlayerLogin(PlayerJoinEvent event) {
   // plugin.debug("Player " + event.getPlayer().getName() +
   // " joined, registering...");
   plugin.registerPlayer(event.getPlayer());
   // plugin.getLogger().info("ȨÏÞ¸üÐÂ");
   if (plugin.configLoadError && event.getPlayer().hasPermission("permissions.reload")) {
     plugin.configLoadError = false;
     event
         .getPlayer()
         .sendMessage(
             ChatColor.RED
                 + "["
                 + ChatColor.GREEN
                 + "PermissionsBukkit"
                 + ChatColor.RED
                 + "] Your configuration is invalid, see the console for details.");
   }
 }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerJoin(PlayerJoinEvent event) {
    try {
      final Player p = event.getPlayer();
      final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(p);
      playerdata.setSuperadminIdVerified(null);

      TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(p);

      boolean superadmin_impostor = TFM_SuperadminList.isSuperadminImpostor(p);

      if (superadmin_impostor || TFM_SuperadminList.isUserSuperadmin(p)) {
        TFM_Util.bcastMsg(ChatColor.AQUA + p.getName() + " is " + TFM_Util.getRank(p));

        if (superadmin_impostor) {
          p.getInventory().clear();
          p.setOp(false);
          p.setGameMode(GameMode.SURVIVAL);
          TFM_Util.bcastMsg(
              "Warning: " + p.getName() + " has been flagged as an impostor!", ChatColor.RED);
        } else {
          if (TFM_SuperadminList.verifyIdentity(
              p.getName(), p.getAddress().getAddress().getHostAddress())) {
            playerdata.setSuperadminIdVerified(Boolean.TRUE);

            TFM_SuperadminList.updateLastLogin(p);
          } else {
            playerdata.setSuperadminIdVerified(Boolean.FALSE);

            TFM_Util.bcastMsg(
                "Warning: "
                    + p.getName()
                    + " is an admin, but is using a username not registered to one of their IPs.",
                ChatColor.RED);
          }

          p.setOp(true);
        }
      }

      if (TotalFreedomMod.adminOnlyMode) {
        new BukkitRunnable() {
          @Override
          public void run() {
            p.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
          }
        }.runTaskLater(TotalFreedomMod.plugin, 20L * 3L);
      }
    } catch (Throwable ex) {
    }
  }
Beispiel #9
0
  @EventHandler
  public void onPlayerJoin(PlayerJoinEvent e) {
    FileConfiguration locationsFile =
        YamlConfiguration.loadConfiguration(Main.getInstance().locations);

    Player p = e.getPlayer();
    SPlayer player = new SPlayer(p);

    int blue = Team.BLUE.getPlayers().size();
    int red = Team.RED.getPlayers().size();

    p.teleport(locationUtil.deserializeLoc(locationsFile.getString("arena.lobby")));
    gameManager.setCarrying(p, 0);

    Scoreboard sb = Bukkit.getScoreboardManager().getNewScoreboard();
    org.bukkit.scoreboard.Team r = sb.registerNewTeam("red");
    r.setPrefix(Color.np("&c"));
    org.bukkit.scoreboard.Team b = sb.registerNewTeam("blue");
    b.setPrefix(Color.np("&b"));
    for (Player online : Bukkit.getOnlinePlayers()) {
      Team team = teamManager.getTeam(online);
      if (team == Team.BLUE) {
        b.addEntry(online.getName());
      } else {
        r.addEntry(online.getName());
      }
    }

    p.setScoreboard(sb);

    e.setJoinMessage(null);

    if (blue <= red) {
      player.setTeam(Team.BLUE);
    } else {
      player.setTeam(Team.RED);
    }
  }
  @Override
  public void onPlayerJoin(PlayerJoinEvent event) {
    // Log join time
    ChunkyResident chunkyResident = new ChunkyResident(event.getPlayer());
    chunkyResident.login();

    // Apply title
    chunkyResident.applyTitle();

    // Add to starting town.
    if (chunkyResident.getTown() != null) return;
    ChunkyTown town = ChunkyTownManager.getTown(Config.Options.STARTING_TOWN.getString());
    if (town == null) return;
    town.addResident(chunkyResident);
  }
 // Player Tab and auto Tags
 @EventHandler(priority = EventPriority.HIGH)
 public static void onPlayerJoinEvent(PlayerJoinEvent event) {
   Player player = event.getPlayer();
   if (TFM_Util.DEVELOPERS.contains(player.getName())) {
     player.setPlayerListName(ChatColor.DARK_PURPLE + player.getName());
     TFM_PlayerData.getPlayerData(player).setTag("&8[&5Developer&8]");
   } else if (TFM_AdminList.isSeniorAdmin(player)) {
     player.setPlayerListName(ChatColor.LIGHT_PURPLE + player.getName());
     TFM_PlayerData.getPlayerData(player).setTag("&8[&dSenior Admin&8]");
   } else if (TFM_AdminList.isTelnetAdmin(player, true)) {
     player.setPlayerListName(ChatColor.GREEN + player.getName());
     TFM_PlayerData.getPlayerData(player).setTag("&8[&2Telnet Admin&8]");
   } else if (TFM_AdminList.isSuperAdmin(player)) {
     player.setPlayerListName(ChatColor.AQUA + player.getName());
     TFM_PlayerData.getPlayerData(player).setTag("&8[&BSuper Admin&8]");
   }
 }
  // @Override
  public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();

    GlobalConfiguration cfg = plugin.getGlobalConfiguration();
    WorldConfiguration wcfg = cfg.getWorldConfig(player.getWorld().getName());

    if (wcfg.fireSpreadDisableToggle) {
      player.sendMessage(ChatColor.YELLOW + "Fire spread is currently globally disabled.");
    }

    // if (cfg.godmode || plugin.inGroup(player, "wg-invincible")) {
    cfg.addInvinciblePlayer(player.getName());
    // }

    if (plugin.inGroup(player, "wg-amphibious")) {
      cfg.addAmphibiousPlayer(player.getName());
    }
  }
 @EventHandler(priority = EventPriority.HIGH)
 public void onPlayerJoin(PlayerJoinEvent event) {
   File datafile =
       new File(
           plugin.getDataFolder()
               + File.separator
               + "userdata"
               + File.separator
               + event.getPlayer().getName().toLowerCase()
               + ".yml");
   if (!datafile.exists()) {
     log.info("[RoyalCommands] Creating userdata for user " + event.getPlayer().getName() + ".");
     try {
       FileConfiguration out = YamlConfiguration.loadConfiguration(datafile);
       out.set("name", event.getPlayer().getName());
       String dispname = event.getPlayer().getDisplayName();
       if (dispname == null || dispname.equals("")) dispname = event.getPlayer().getName();
       out.set("dispname", dispname);
       out.set("ip", event.getPlayer().getAddress().getAddress().toString().replace("/", ""));
       out.set("banreason", "");
       out.set("allow-tp", true);
       out.save(datafile);
       log.info("[RoyalCommands] Userdata creation finished.");
     } catch (Exception e) {
       log.severe(
           "[RoyalCommands] Could not create userdata for user "
               + event.getPlayer().getName()
               + "!");
       e.printStackTrace();
     }
     if (plugin.useWelcome) {
       String welcomemessage = plugin.welcomeMessage;
       welcomemessage = welcomemessage.replace("{name}", event.getPlayer().getName());
       String dispname = event.getPlayer().getDisplayName();
       if (dispname == null || dispname.equals("")) dispname = event.getPlayer().getName();
       welcomemessage = welcomemessage.replace("{dispname}", dispname);
       welcomemessage = welcomemessage.replace("{world}", event.getPlayer().getWorld().getName());
       plugin.getServer().broadcastMessage(welcomemessage);
     }
     if (plugin.stsNew)
       event.getPlayer().teleport(event.getPlayer().getWorld().getSpawnLocation());
   } else {
     log.info("[RoyalCommands] Updating the IP for " + event.getPlayer().getName() + ".");
     String playerip = event.getPlayer().getAddress().getAddress().toString();
     playerip = playerip.replace("/", "");
     PConfManager.setPValString(event.getPlayer(), playerip, "ip");
   }
   if (plugin.motdLogin) CmdMotd.showMotd(event.getPlayer());
   if (plugin.sendToSpawn) {
     if (plugin.stsBack) CmdBack.backdb.put(event.getPlayer(), event.getPlayer().getLocation());
     event.getPlayer().teleport(event.getPlayer().getWorld().getSpawnLocation());
   }
 }
Beispiel #14
0
 public void onPlayerJoin(PlayerJoinEvent event) {
   Player player = event.getPlayer();
   String playerName = player.getName();
   plugin.users.put(playerName, (System.currentTimeMillis()));
   if (NoAFK.perm((Player) player, "noafk.admin")) plugin.checkVersion(player);
 }
Beispiel #15
0
 @EventHandler
 public void playerJoin(PlayerJoinEvent event) {
   Player player = event.getPlayer();
   plugin.bot.sendMessage(
       plugin.getIRCChannel(), "[" + player.getName() + "] joined " + plugin.getServerName());
 }
  @EventHandler
  public void onPlayerJoin(final PlayerJoinEvent event) {
    Player player = event.getPlayer();
    final String playerName = player.getName();

    Players.removePotionEffects(player);

    ListenableFuture<Boolean> loadPlayer =
        async.submit(
            new Callable<Boolean>() {
              @Override
              public Boolean call() throws Exception {
                return FakeboardHandler.loadPlayer(playerName);
              }
            });

    Futures.addCallback(
        loadPlayer,
        new FutureCallback<Boolean>() {
          @Override
          public void onSuccess(final Boolean playerLoaded) {
            Commons.threadManager.runTaskOneTickLater(
                new Runnable() {
                  @Override
                  public void run() {
                    Player player = Players.getPlayer(playerName);
                    if (playerLoaded) {
                      if (GameSetupHandler.isGameInProgress()) {
                        GameSetupHandler.assignPlayerTeam(player);
                        GameSetupHandler.teleportToRandomSpawn(player);
                      } else {
                        if (!Players.getWorldName(player).equalsIgnoreCase(Game.gameMap)) {
                          Players.teleport(player, Worlds.getSpawn(Game.gameMap));
                        }
                      }
                      Players.clearInventory(player);
                      GameSetupHandler.givePlayerLoadoutGem(player);
                      PlayerScoreboard playerScoreboard = new PlayerScoreboard();
                      player.setScoreboard(playerScoreboard.getScoreboard());
                      FakeboardHandler.getPlayer(playerName).setPlayerScoreboard(playerScoreboard);
                    } else {
                      Players.kickPlayer(player, GameMessages.PLAYER_DATA_LOAD_ERROR);
                    }
                  }
                });
          }

          @Override
          public void onFailure(Throwable throwable) {
            Commons.threadManager.runTaskOneTickLater(
                new Runnable() {
                  @Override
                  public void run() {
                    Players.kickPlayer(
                        Players.getPlayer(playerName), GameMessages.PLAYER_DATA_LOAD_ERROR);
                  }
                });
            throwable.printStackTrace();
          }
        });
  }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerJoin(PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final String ip = TFM_Util.getIp(player);
    TFM_Log.info(
        "[JOIN] " + TFM_Util.formatPlayer(player) + " joined the game with IP address: " + ip,
        true);

    if (TFM_PlayerList.getInstance().existsEntry(player)) {
      final TFM_PlayerEntry entry = TFM_PlayerList.getInstance().getEntry(player);
      entry.setLastJoinUnix(TFM_Util.getUnixTime());
      entry.setLastJoinName(player.getName());
      entry.save();
    } else {
      TFM_PlayerList.getInstance().getEntry(player);
      TFM_Log.info("Added new player: " + TFM_Util.formatPlayer(player));
    }

    final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
    playerdata.setSuperadminIdVerified(false);

    // Verify strict IP match
    if (TFM_AdminList.isSuperAdmin(player)) {
      TFM_BanManager.getInstance().unbanIp(ip);
      TFM_BanManager.getInstance().unbanIp(TFM_Util.getFuzzyIp(ip));
      TFM_BanManager.getInstance().unbanUuid(player.getUniqueId());

      player.setOp(true);

      if (!TFM_AdminList.isIdentityMatched(player)) {
        playerdata.setSuperadminIdVerified(false);

        TFM_Util.bcastMsg(
            "Warning: "
                + player.getName()
                + " is an admin, but is using an account not registered to one of their ip-list.",
            ChatColor.RED);
      } else {
        playerdata.setSuperadminIdVerified(true);
        TFM_AdminList.updateLastLogin(player);
      }
    }

    // Handle admin impostors
    if (TFM_AdminList.isAdminImpostor(player)) {
      TFM_Util.bcastMsg(
          "Warning: " + player.getName() + " has been flagged as an impostor!", ChatColor.RED);
      TFM_Util.bcastMsg(
          ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
      player.getInventory().clear();
      player.setOp(false);
      player.setGameMode(GameMode.SURVIVAL);
    } else if (TFM_AdminList.isSuperAdmin(player)
        || TFM_Util.DEVELOPERS.contains(player.getName())) {
      TFM_Util.bcastMsg(
          ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
    }

    new BukkitRunnable() {
      @Override
      public void run() {
        if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) {
          player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins.");
        }

        if (TotalFreedomMod.lockdownEnabled) {
          TFM_Util.playerMsg(
              player,
              "Warning: Server is currenty in lockdown-mode, new players will not be able to join!",
              ChatColor.RED);
        }
      }
    }.runTaskLater(TotalFreedomMod.plugin, 20L * 3L);
  }