コード例 #1
0
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onPlayerDamage(SkillDamageEvent event) {
    if (event.getEntity() instanceof Player) {

      Player p = (Player) event.getEntity();
      Hero hero = plugin.getHeroManager().getHero(p);
      HeroClass primclass = hero.getHeroClass();
      HeroClass secclass = hero.getSecondClass();
      SpoutPlayer sp = SpoutManager.getPlayer(p);

      int xpprim = (int) Math.round(hero.currentXPToNextLevel(primclass));
      int xpsec = (int) Math.round(hero.currentXPToNextLevel(secclass));

      if (hero != null) {

        String text =
            primclass
                + ": "
                + ChatColor.RED
                + hero.getHealth()
                + " / "
                + hero.getMaxHealth()
                + "\n"
                + ChatColor.DARK_RED
                + "Lvl/Exp: "
                + ChatColor.RED
                + hero.getLevel(primclass)
                + " / "
                + xpprim;

        if (secclass != null) {

          text +=
              "\n"
                  + ChatColor.DARK_GREEN
                  + "Prof: "
                  + ChatColor.GREEN
                  + secclass
                  + "\n"
                  + ChatColor.DARK_GREEN
                  + "LvL/Exp: "
                  + ChatColor.GREEN
                  + hero.getLevel(secclass)
                  + " / "
                  + xpsec;
        } else {
          text +=
              "\n"
                  + ChatColor.DARK_GREEN
                  + "You Dont have a"
                  + "\n"
                  + ChatColor.DARK_GREEN
                  + "Secondary Class!";
        }
        plugin.getGUI().updateLabel(sp, text);
      }
    }
  }
コード例 #2
0
  @EventHandler
  public void onSpoutCraftLogin(SpoutCraftEnableEvent event) {

    Player p = event.getPlayer();
    Hero hero = plugin.getHeroManager().getHero(p);
    HeroClass primclass = hero.getHeroClass();
    HeroClass secclass = hero.getSecondClass();
    SpoutPlayer sp = SpoutManager.getPlayer(p);

    int xpprim = (int) Math.round(hero.currentXPToNextLevel(primclass));
    int xpsec = (int) Math.round(hero.currentXPToNextLevel(secclass));

    if (hero != null) {

      String text =
          primclass
              + ": "
              + ChatColor.RED
              + hero.getHealth()
              + " / "
              + hero.getMaxHealth()
              + "\n"
              + ChatColor.DARK_RED
              + "Lvl/Exp: "
              + ChatColor.RED
              + hero.getLevel(primclass)
              + " / "
              + xpprim;

      if (secclass != null) {
        text +=
            "\n"
                + ChatColor.DARK_GREEN
                + "Prof: "
                + ChatColor.GREEN
                + secclass
                + "\n"
                + ChatColor.DARK_GREEN
                + "LvL/Exp: "
                + ChatColor.GREEN
                + hero.getLevel(secclass)
                + " / "
                + xpsec;
      } else {
        text +=
            "\n"
                + ChatColor.DARK_GREEN
                + "You Dont have a"
                + "\n"
                + ChatColor.DARK_GREEN
                + "Secondary Class!";
      }
      plugin.getGUI().updateLabel(sp, text);
    }
  }