Example #1
0
  // <Index = 1>
  @EventHandler
  public void onPlayerJoin(PlayerJoinEvent event) {
    Player p = event.getPlayer();
    String pName = p.getName();

    event.setJoinMessage(ChatMessages.WHITE + pName + ChatMessages.joinMessage);

    if (!ScoreboardHandler.isOnBoard(p)) ScoreboardHandler.initPlayer(p);

    if (Main.lobbyBoolean) ScoreboardHandler.hide(p);
    else ScoreboardHandler.sendBoard(p);

    Main.playerClasses.put(pName, "default");
    p.setGameMode(GameMode.SURVIVAL);
    InventoryClear.clear(p);
    p.sendMessage(" ");
    p.sendMessage(ChatMessages.welcomeMessage);
    p.sendMessage(ChatMessages.welcomeMessage2);
    p.sendMessage(" ");
    p.sendMessage(ChatMessages.alphaTestMessage1);
    p.sendMessage(ChatMessages.alphaTestMessage2);
    p.sendMessage(" ");
    Healer.simulateRespawn(p);
    if (Main.lobbyBoolean == true) {
      plugin.teleportHandle.teleportServerLobby(p);
    } else {
      plugin.teleportHandle.teleportToMapLobby(p);
      p.sendMessage(ChatMessages.selectedMapIs.replace("%%MAP%%", Main.selectedMap));
    }
  }
Example #2
0
 // <Index = 3>
 @EventHandler
 public void onPlayerDeath(PlayerDeathEvent event) {
   Player att = event.getEntity().getKiller();
   String pName = event.getEntity().getName();
   if (att instanceof Player && att.getEntityId() != event.getEntity().getEntityId()) {
     String aName = att.getName();
     SQL.addKill(aName);
     SQL.addMoney(aName, SQL.getMoney(pName) > SQL.getMoney(aName) ? 10 : 5);
     ScoreboardHandler.addKill(aName);
   }
   SQL.addDeath(pName);
   event.getDrops().clear();
 }