Пример #1
0
    public Construct exec(Target t, Environment environment, Construct... args)
        throws ConfigRuntimeException {
      Static.checkPlugin("mcMMO", t);

      BukkitMCPlayer player = (BukkitMCPlayer) Static.GetPlayer(args[0], t);
      SkillType skill;
      int amount = 1;

      try {
        skill = SkillType.valueOf(args[1].val().toUpperCase());
      } catch (Exception e) {
        throw new ConfigRuntimeException(
            "Unknown McMMO skilltype for mcmmo_add_level, " + args[1].val(),
            Exceptions.ExceptionType.NotFoundException,
            t);
      }

      if (args.length == 3) {
        try {
          amount = Integer.parseInt(args[2].val());
        } catch (Exception e) {
          throw new ConfigRuntimeException(
              "Bad amount for mcmmo_add_level, " + args[2].val(),
              Exceptions.ExceptionType.RangeException,
              t);
        }
      }

      ExperienceAPI.addLevel(player._Player(), skill.name(), amount);

      return new CVoid(t);
    }
Пример #2
0
 @Override
 public void onStartup() {
   try {
     Static.checkPlugin("GriefPrevention", Target.UNKNOWN);
   } catch (Exception e) {
     System.out.println(
         "[CommandHelper] CHGriefPrevention Could not find GriefPrevention please make sure you have it installed.");
   }
   System.out.println("[CommandHelper] CHGriefPrevention: Initialized");
 }