コード例 #1
0
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onClassChange(ClassChangeEvent event) {

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

    if (toclass.isSecondary()) {
      secclass = event.getTo();
    } else if (toclass.isPrimary()) {
      primclass = event.getTo();
    }

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

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

    if (secclass != null) {

      test +=
          "\n"
              + ChatColor.DARK_GREEN
              + "Prof: "
              + ChatColor.GREEN
              + secclass
              + "\n"
              + ChatColor.DARK_GREEN
              + "LvL/Exp: "
              + ChatColor.GREEN
              + hero.getLevel(secclass)
              + " / "
              + xpsec;
    } else {
      test +=
          "\n"
              + ChatColor.DARK_GREEN
              + "You Dont have a"
              + "\n"
              + ChatColor.DARK_GREEN
              + "Secondary Class!";
    }
    plugin.getGUI().updateLabel(sp, test);
  }
コード例 #2
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);
      }
    }
  }
コード例 #3
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);
    }
  }
コード例 #4
0
 @EventHandler
 public void onPlayerQuit(PlayerQuitEvent event) {
   plugin.getGUI().clearPlayer(event.getPlayer().getName());
 }
コード例 #5
0
  @EventHandler(priority = EventPriority.HIGHEST)
  public void onExpChange(ExperienceChangeEvent event) {

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

    double xpprim = hero.currentXPToNextLevel(primclass);
    double xpsec = hero.currentXPToNextLevel(secclass);
    int xpprimround = 0;
    int xpsecround = 0;

    if (event.getHeroClass().isPrimary()) {
      double getprim = event.getExpChange();
      xpprimround = (int) Math.round(xpprim + getprim);
    } else if (event.getHeroClass().isSecondary()) {
      double getsec = event.getExpChange();
      xpsecround = (int) Math.round(xpsec + getsec);
    }

    if (hero != null) {

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

      if (secclass != null) {

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