示例#1
0
  @Override
  public void prepare(CastContext context, ConfigurationSection parameters) {
    track = parameters.getBoolean("track", true);
    loot = parameters.getBoolean("loot", false);
    force = parameters.getBoolean("force", false);
    setTarget = parameters.getBoolean("set_target", false);
    speed = parameters.getDouble("speed", 0);
    direction = ConfigurationUtils.getVector(parameters, "direction");
    dyOffset = parameters.getDouble("dy_offset", 0);

    if (parameters.contains("type")) {
      String mobType = parameters.getString("type");
      entityData = context.getController().getMob(mobType);
      if (entityData == null) {
        entityData =
            new com.elmakers.mine.bukkit.entity.EntityData(context.getController(), parameters);
      }
    }

    if (parameters.contains("reason")) {
      String reasonText = parameters.getString("reason").toUpperCase();
      try {
        spawnReason = CreatureSpawnEvent.SpawnReason.valueOf(reasonText);
      } catch (Exception ex) {
        spawnReason = CreatureSpawnEvent.SpawnReason.EGG;
      }
    }
  }
 @Override
 public void prepare(CastContext context, ConfigurationSection parameters) {
   super.prepare(context, parameters);
   targetEntityLocation = parameters.getBoolean("target_entity");
   targetSelf = parameters.getBoolean("target_caster");
   sourceAtTarget = parameters.getBoolean("source_at_target");
   targetOffset = ConfigurationUtils.getVector(parameters, "target_offset");
   sourceOffset = ConfigurationUtils.getVector(parameters, "source_offset");
   randomTargetOffset = ConfigurationUtils.getVector(parameters, "random_target_offset");
   randomSourceOffset = ConfigurationUtils.getVector(parameters, "random_source_offset");
   sourceDirection = ConfigurationUtils.getVector(parameters, "source_direction");
   targetDirection = ConfigurationUtils.getVector(parameters, "target_direction");
   sourceDirectionOffset = ConfigurationUtils.getVector(parameters, "source_direction_offset");
   targetDirectionOffset = ConfigurationUtils.getVector(parameters, "source_direction_offset");
   persistTarget = parameters.getBoolean("persist_target", false);
   attachBlock = parameters.getBoolean("target_attachment", false);
   if (parameters.contains("target_direction_speed")) {
     targetDirectionSpeed = parameters.getDouble("target_direction_speed");
   } else {
     targetDirectionSpeed = null;
   }
   if (parameters.contains("source_direction_speed")) {
     sourceDirectionSpeed = parameters.getDouble("source_direction_speed");
   } else {
     sourceDirectionSpeed = null;
   }
 }
 private static Location loadLocation(ConfigurationSection section) {
   String world = section.getString("world");
   double x = section.getDouble("x");
   double y = section.getDouble("y");
   double z = section.getDouble("z");
   return new Location(Bukkit.getWorld(world), x, y, z);
 }
示例#4
0
 @Override
 public void prepare(CastContext context, ConfigurationSection parameters) {
   super.prepare(context, parameters);
   useHitbox = parameters.getBoolean("hitbox", false);
   range = parameters.getDouble("range", 32);
   fov = parameters.getDouble("fov", 0.3);
   closeRange = parameters.getDouble("close_range", 1);
   closeFOV = parameters.getDouble("close_fov", 0.5);
 }
示例#5
0
 // Location
 public static Location loadLocation(final ConfigurationSection config, World world) {
   if (config == null) return null;
   if (world == null) world = Bukkit.getWorld(config.getString("world"));
   return new Location(
       world,
       config.getDouble("x"),
       config.getDouble("y"),
       config.getDouble("z"),
       (float) config.getDouble("yaw", 0d),
       (float) config.getDouble("pitch", 0d));
 }
  /**
   * Loads a ShippedPackage from a loaded configuration section.
   *
   * @param source Configuration section where to load the ShippedPackage.
   * @return A ShippedPackage object built from configuration file.
   */
  public static ShippedPackage loadShippedPackage(ConfigurationSection source) {
    long date = Long.parseLong(source.getName());
    int cost = source.getInt("cost");
    ConfigurationSection location = source.getConfigurationSection("location");
    Location loc =
        new Location(
            Bukkit.getWorld(location.getString("world")),
            location.getDouble("x"),
            location.getDouble("y"),
            location.getDouble("z"));

    ConfigurationSection contents = source.getConfigurationSection("contents");
    return new ShippedPackage(loadItemStack(contents).toArray(new ItemStack[0]), cost, loc, date);
  }
 private double weight(ChatColor color) {
   ConfigurationSection colorSection = getConfig().getConfigurationSection("colors");
   for (String colorName : colorSection.getKeys(false)) {
     ConfigurationSection singleColor = colorSection.getConfigurationSection(colorName);
     if (singleColor.getString("code").equals(String.valueOf(color.getChar()))) {
       return singleColor.getDouble("weight");
     }
   }
   return 0.0;
 }
示例#8
0
 @Override
 public void prepare(CastContext context, ConfigurationSection parameters) {
   super.prepare(context, parameters);
   double damage = parameters.getDouble("damage", 1);
   entityDamage = parameters.getDouble("entity_damage", damage);
   playerDamage = parameters.getDouble("player_damage", damage);
   elementalDamage = parameters.getDouble("elemental_damage", damage);
   if (parameters.contains("percentage")) {
     percentage = parameters.getDouble("percentage");
   } else {
     percentage = null;
   }
   magicDamage = parameters.getBoolean("magic_damage", true);
   magicEntityDamage = parameters.getBoolean("magic_entity_damage", true);
   if (parameters.contains("knockback_resistance")) {
     knockbackResistance = parameters.getDouble("knockback_resistance");
   } else {
     knockbackResistance = null;
   }
 }
  private void loadPersistConfig(ConfigurationSection config) {
    persistConfig = new PersistConfig();

    persistConfig.databaseName = config.getString("file_path");
    persistConfig.enabled = config.getBoolean("persistence_enabled");
    persistConfig.unloadBatchPeriod = config.getInt("unload_batch_period");
    persistConfig.unloadBatchMaxTime = config.getInt("unload_batch_max_time");
    persistConfig.growEventLoadChance = config.getDouble("grow_event_load_chance");
    persistConfig.logDB = config.getBoolean("log_db");

    LOG.info("[RealisticBiomes] Persistence enabled: " + persistConfig.enabled);
    LOG.info("[RealisticBiomes] Database: " + persistConfig.databaseName);
  }
 /**
  * Storage for a tracked material from the config
  *
  * @param type the type of material
  * @param section the configuration section to load
  */
 public DurabilityMaterial(Material type, ConfigurationSection section) {
   this.type = type;
   this.blastRadius = section.getInt("BlastRadius", 0);
   this.dura = section.getInt("Durability.Amount", 5);
   this.enabled = section.getBoolean("Durability.Enabled", true);
   this.chanceToDrop = section.getDouble("Durability.ChanceToDrop", 0.7);
   this.resetEnabled = section.getBoolean("Durability.ResetEnabled", false);
   this.resetTime = section.getLong("Durability.ResetAfter", 10000L);
   this.tntEnabled = section.getBoolean("EnabledFor.TNT", true);
   this.cannonsEnabled = section.getBoolean("EnabledFor.Cannons", false);
   this.creepersEnabled = section.getBoolean("EnabledFor.Creepers", false);
   this.ghastsEnabled = section.getBoolean("EnabledFor.Ghasts", false);
   this.withersEnabled = section.getBoolean("EnabledFor.Minecarts", false);
   this.tntMinecartsEnabled = section.getBoolean("EnabledFor.Withers", false);
 }
  private void load() {

    ConfigurationSection lotsSection = data.getConfigurationSection("lots");

    for (String uuidString : lotsSection.getKeys(false)) {

      ConfigurationSection singleLotSection = lotsSection.getConfigurationSection(uuidString);

      ItemStack item = singleLotSection.getItemStack("item");
      boolean started = singleLotSection.getBoolean("started");
      double price = singleLotSection.getDouble("price");
      String lastBidPlayerName = singleLotSection.getString("lastBidPlayerName");
      UUID lastBidPlayerUuid =
          singleLotSection.isSet("lastBidPlayerUuid")
              ? UUID.fromString(singleLotSection.getString("lastBidPlayerUuid"))
              : null;
      double lastBidPrice = singleLotSection.getDouble("lastBidPrice");
      double minimumIncrement = singleLotSection.getDouble("minimumIncrement");
      long preserveTimeExpire = singleLotSection.getLong("preserveTimeExpire");
      long auctionDurationExpire = singleLotSection.getLong("auctionDurationExpire");

      Lot lot =
          new Lot(
              UUID.fromString(uuidString),
              item,
              started,
              price,
              lastBidPlayerName,
              lastBidPlayerUuid,
              lastBidPrice,
              minimumIncrement,
              preserveTimeExpire,
              auctionDurationExpire);
      lots.add(lot);
    }
  }
  public Map<UUID, Double> getDeposit(Lot lot) {

    HashMap<UUID, Double> result = new HashMap<>();

    String path =
        new StringBuilder(49).append("lots.").append(lot.getUuid()).append(".deposit").toString();
    ConfigurationSection singleLotDepositSection = data.getConfigurationSection(path);

    for (String uuidString : singleLotDepositSection.getKeys(false)) {

      UUID uuid = UUID.fromString(uuidString);
      result.put(uuid, singleLotDepositSection.getDouble(uuidString));
    }

    return result;
  }
示例#13
0
  public ConfigData(FileConfiguration config) {
    for (Ability ability : Ability.values()) {
      ConfigurationSection conf = config.getConfigurationSection(ability.name());

      if (conf != null) {
        int item = conf.getInt("Item");
        List<String> types = (List<String>) conf.getList("ArmorTypes");
        if ((item != 0) && (types != null) && !types.isEmpty()) {
          abilities.add(new AbilityInfo(ability, ArmorUtils.materialName(item), item, types));

          switch (ability) {
            case MOON:
              jumpNum = conf.getInt("JumpBoost");
              break;
            case SCUBA:
              scubaHasteNum = conf.getInt("Haste");
              scubaTime = conf.getInt("ScubaTime");
              break;
            case SPEED:
              speedNum = conf.getInt("SpeedBoost");
              speedHasteNum = conf.getInt("Haste");
              break;
            case LAVA:
              lavaTime = conf.getInt("LavaTime");
              break;
            case RAGE:
              rageLightningDamage = conf.getInt("LightningDamage");
              rageFireTime = conf.getInt("FireTime");
              break;
            case CREEPER:
              creeperAbilityExplosion = conf.getInt("ExplosionSize");
              creeperBlockDamage = conf.getBoolean("BlockDamage");
              break;
            case MINER:
              minerHasteNum = conf.getInt("Haste");
              break;
            case ASSASSIN:
              assassinDamage = conf.getInt("SneakDamage");
              break;
            case VAMPIRE:
              vampirePercent = conf.getDouble("VampirePercent", 25);
              break;
          }
        }
      }
    }
  }
示例#14
0
 @Override
 public void loadSettings(FileConfiguration config) {
   ConfigurationSection sectionE = config.getConfigurationSection("Skills.Weaponry.Entities");
   ConfigurationSection section = config.getConfigurationSection("Skills.Weaponry");
   if (sectionE.getKeys(false) != null) {
     for (String s : sectionE.getKeys(false)) {
       if (EntityType.valueOf(s.toUpperCase()) != null) {
         EntityType type = EntityType.valueOf(s.toUpperCase());
         Double val = sectionE.getDouble(s);
         entities.put(type, val);
       }
     }
   }
   if (section.getStringList("Weapons") != null) {
     for (String s : section.getStringList("Weapons")) {
       if (Material.valueOf(s.toUpperCase()) != null) {
         Material type = Material.valueOf(s.toUpperCase());
         weapons.add(type);
       }
     }
   }
 }
示例#15
0
 public static double getDouble(String path, double defVal) {
   return config.getDouble(path, defVal);
 }
示例#16
0
  // load Block locations of given world
  public void loadWorldData(String uuid, World world) {

    File file = new File(p.getDataFolder(), "data.yml");
    if (file.exists()) {

      FileConfiguration data = YamlConfiguration.loadConfiguration(file);

      // loading BCauldron
      if (data.contains("BCauldron." + uuid)) {
        ConfigurationSection section = data.getConfigurationSection("BCauldron." + uuid);
        for (String cauldron : section.getKeys(false)) {
          // block is splitted into x/y/z
          String block = section.getString(cauldron + ".block");
          if (block != null) {
            String[] splitted = block.split("/");
            if (splitted.length == 3) {

              Block worldBlock =
                  world.getBlockAt(
                      parseInt(splitted[0]), parseInt(splitted[1]), parseInt(splitted[2]));
              BIngredients ingredients =
                  loadIngredients(section.getConfigurationSection(cauldron + ".ingredients"));
              int state = section.getInt(cauldron + ".state", 1);

              new BCauldron(worldBlock, ingredients, state);
            } else {
              errorLog(
                  "Incomplete Block-Data in data.yml: "
                      + section.getCurrentPath()
                      + "."
                      + cauldron);
            }
          } else {
            errorLog(
                "Missing Block-Data in data.yml: " + section.getCurrentPath() + "." + cauldron);
          }
        }
      }

      // loading Barrel
      if (data.contains("Barrel." + uuid)) {
        ConfigurationSection section = data.getConfigurationSection("Barrel." + uuid);
        for (String barrel : section.getKeys(false)) {
          // block spigot is splitted into x/y/z
          String spigot = section.getString(barrel + ".spigot");
          if (spigot != null) {
            String[] splitted = spigot.split("/");
            if (splitted.length == 3) {

              // load itemStacks from invSection
              ConfigurationSection invSection = section.getConfigurationSection(barrel + ".inv");
              Block block =
                  world.getBlockAt(
                      parseInt(splitted[0]), parseInt(splitted[1]), parseInt(splitted[2]));
              float time = (float) section.getDouble(barrel + ".time", 0.0);
              byte sign = (byte) section.getInt(barrel + ".sign", 0);
              String[] st = section.getString(barrel + ".st", "").split(",");
              String[] wo = section.getString(barrel + ".wo", "").split(",");

              if (invSection != null) {
                new Barrel(block, sign, st, wo, invSection.getValues(true), time);
              } else {
                // Barrel has no inventory
                new Barrel(block, sign, st, wo, null, time);
              }

            } else {
              errorLog(
                  "Incomplete Block-Data in data.yml: " + section.getCurrentPath() + "." + barrel);
            }
          } else {
            errorLog("Missing Block-Data in data.yml: " + section.getCurrentPath() + "." + barrel);
          }
        }
      }

      // loading Wakeup
      if (data.contains("Wakeup." + uuid)) {
        ConfigurationSection section = data.getConfigurationSection("Wakeup." + uuid);
        for (String wakeup : section.getKeys(false)) {
          // loc of wakeup is splitted into x/y/z/pitch/yaw
          String loc = section.getString(wakeup);
          if (loc != null) {
            String[] splitted = loc.split("/");
            if (splitted.length == 5) {

              double x = NumberUtils.toDouble(splitted[0]);
              double y = NumberUtils.toDouble(splitted[1]);
              double z = NumberUtils.toDouble(splitted[2]);
              float pitch = NumberUtils.toFloat(splitted[3]);
              float yaw = NumberUtils.toFloat(splitted[4]);
              Location location = new Location(world, x, y, z, yaw, pitch);

              Wakeup.wakeups.add(new Wakeup(location));

            } else {
              errorLog(
                  "Incomplete Location-Data in data.yml: "
                      + section.getCurrentPath()
                      + "."
                      + wakeup);
            }
          }
        }
      }
    }
  }
示例#17
0
 @Override
 public double getDouble(String key) {
   return root.getDouble(getKeyFor(key), 0D);
 }
示例#18
0
 public static double getDouble(String path) {
   return config.getDouble(path);
 }
示例#19
0
  // load all Data
  public void readData() {
    File file = new File(p.getDataFolder(), "data.yml");
    if (file.exists()) {

      FileConfiguration data = YamlConfiguration.loadConfiguration(file);

      // Check if data is the newest version
      String version = data.getString("Version", null);
      if (version != null) {
        if (!version.equals(DataSave.dataVersion)) {
          P.p.log("Data File is being updated...");
          new DataUpdater(data, file).update(version);
          data = YamlConfiguration.loadConfiguration(file);
          P.p.log("Data Updated to version: " + DataSave.dataVersion);
        }
      }

      // loading Ingredients into ingMap
      Map<String, BIngredients> ingMap = new HashMap<String, BIngredients>();
      ConfigurationSection section = data.getConfigurationSection("Ingredients");
      if (section != null) {
        for (String id : section.getKeys(false)) {
          ConfigurationSection matSection = section.getConfigurationSection(id + ".mats");
          if (matSection != null) {
            // matSection has all the materials + amount as Integers
            ArrayList<ItemStack> ingredients = deserializeIngredients(matSection);
            ingMap.put(id, new BIngredients(ingredients, section.getInt(id + ".cookedTime", 0)));
          } else {
            errorLog("Ingredient id: '" + id + "' incomplete in data.yml");
          }
        }
      }

      // loading Brew
      section = data.getConfigurationSection("Brew");
      if (section != null) {
        // All sections have the UID as name
        for (String uid : section.getKeys(false)) {
          BIngredients ingredients = getIngredients(ingMap, section.getString(uid + ".ingId"));
          int quality = section.getInt(uid + ".quality", 0);
          int distillRuns = section.getInt(uid + ".distillRuns", 0);
          float ageTime = (float) section.getDouble(uid + ".ageTime", 0.0);
          float wood = (float) section.getDouble(uid + ".wood", -1.0);
          String recipe = section.getString(uid + ".recipe", null);
          boolean unlabeled = section.getBoolean(uid + ".unlabeled", false);
          boolean persistent = section.getBoolean(uid + ".persist", false);
          boolean stat = section.getBoolean(uid + ".stat", false);

          new Brew(
              parseInt(uid),
              ingredients,
              quality,
              distillRuns,
              ageTime,
              wood,
              recipe,
              unlabeled,
              persistent,
              stat);
        }
      }

      // loading BPlayer
      section = data.getConfigurationSection("Player");
      if (section != null) {
        // keys have players name
        for (String name : section.getKeys(false)) {
          try {
            UUID.fromString(name);
            if (!useUUID) {
              continue;
            }
          } catch (IllegalArgumentException e) {
            if (useUUID) {
              continue;
            }
          }

          int quality = section.getInt(name + ".quality");
          int drunk = section.getInt(name + ".drunk");
          int offDrunk = section.getInt(name + ".offDrunk", 0);
          boolean passedOut = section.getBoolean(name + ".passedOut", false);

          new BPlayer(name, quality, drunk, offDrunk, passedOut);
        }
      }

      for (World world : p.getServer().getWorlds()) {
        if (world.getName().startsWith("DXL_")) {
          loadWorldData(getDxlName(world.getName()), world);
        } else {
          loadWorldData(world.getUID().toString(), world);
        }
      }

    } else {
      errorLog("No data.yml found, will create new one!");
    }
  }
  public boolean loadOld() {
    final YamlConfiguration confighandle =
        YamlConfiguration.loadConfiguration(
            new File(SimpleRegionMarket.getPluginDir() + "agents.yml"));

    TemplateHotel tokenHotel = null;
    TemplateSell tokenAgent = null;
    for (final TemplateMain token : TokenManager.tokenList) {
      if (token.id.equalsIgnoreCase("SELL")) {
        tokenAgent = (TemplateSell) token;
      }
      if (token.id.equalsIgnoreCase("HOTEL")) {
        tokenHotel = (TemplateHotel) token;
      }
    }
    if (tokenHotel == null || tokenAgent == null) {
      return false;
    }

    ConfigurationSection path;
    for (final String world : confighandle.getKeys(false)) {
      final World worldWorld = Bukkit.getWorld(world);
      if (worldWorld == null) {
        continue;
      }
      path = confighandle.getConfigurationSection(world);
      for (final String region : path.getKeys(false)) {
        final ProtectedRegion protectedRegion =
            SimpleRegionMarket.wgManager.getProtectedRegion(worldWorld, region);
        if (protectedRegion == null) {
          continue;
        }
        path = confighandle.getConfigurationSection(world).getConfigurationSection(region);
        for (final String signnr : path.getKeys(false)) {
          path =
              confighandle
                  .getConfigurationSection(world)
                  .getConfigurationSection(region)
                  .getConfigurationSection(signnr);
          if (path == null) {
            continue;
          }

          if (path.getInt("Mode") == 1) { // HOTEL
            if (!tokenHotel.entries.containsKey(world)) {
              tokenHotel.entries.put(world, new HashMap<String, HashMap<String, Object>>());
            }
            if (!tokenHotel.entries.get(world).containsKey(region)) {
              tokenHotel.entries.get(world).put(region, new HashMap<String, Object>());
              Utils.setEntry(tokenHotel, world, region, "price", path.getInt("Price"));
              Utils.setEntry(tokenHotel, world, region, "account", path.getInt("Account"));
              Utils.setEntry(tokenHotel, world, region, "renttime", path.getLong("RentTime"));
              if (path.isSet("ExpireDate")) {
                Utils.setEntry(tokenHotel, world, region, "taken", true);
                Utils.setEntry(tokenHotel, world, region, "owner", path.getString("RentBy"));
                Utils.setEntry(tokenHotel, world, region, "expiredate", path.getLong("ExpireDate"));
              } else {
                Utils.setEntry(tokenHotel, world, region, "taken", false);
              }
            }

            final ArrayList<Location> signLocations =
                Utils.getSignLocations(tokenHotel, world, region);
            signLocations.add(
                new Location(
                    worldWorld, path.getDouble("X"), path.getDouble("Y"), path.getDouble("Z")));
            if (signLocations.size() == 1) {
              Utils.setEntry(tokenHotel, world, region, "signs", signLocations);
            }
          } else { // SELL
            if (!tokenAgent.entries.containsKey(world)) {
              tokenAgent.entries.put(world, new HashMap<String, HashMap<String, Object>>());
            }
            if (!tokenAgent.entries.get(world).containsKey(region)) {
              tokenAgent.entries.get(world).put(region, new HashMap<String, Object>());
              Utils.setEntry(tokenAgent, world, region, "price", path.getInt("Price"));
              Utils.setEntry(tokenAgent, world, region, "account", path.getInt("Account"));
              Utils.setEntry(tokenAgent, world, region, "renttime", path.getLong("RentTime"));
              Utils.setEntry(tokenAgent, world, region, "taken", false);
            }

            final ArrayList<Location> signLocations =
                Utils.getSignLocations(tokenAgent, world, region);
            signLocations.add(
                new Location(
                    worldWorld, path.getDouble("X"), path.getDouble("Y"), path.getDouble("Z")));
            if (signLocations.size() == 1) {
              Utils.setEntry(tokenAgent, world, region, "signs", signLocations);
            }
          }
        }
      }
    }
    return true;
  }
示例#21
0
  /**
   * @see
   *     fr.ribesg.bukkit.ncore.config.AbstractConfig#handleValues(org.bukkit.configuration.file.YamlConfiguration)
   */
  @Override
  protected void handleValues(final YamlConfiguration config) throws InvalidConfigurationException {

    // #############
    // ## General ##
    // #############

    // spawnCommandBehaviour. Default: 1.
    // Possible values: 0,1
    setSpawnCommandBehaviour(config.getInt("spawnCommandBehaviour", 1));
    if (getSpawnCommandBehaviour() < 0 || getSpawnCommandBehaviour() > 1) {
      wrongValue("config.yml", "spawnCommandBehaviour", getSpawnCommandBehaviour(), 0);
      setSpawnCommandBehaviour(0);
    }

    // defaultRequiredPermission. Default: nworld.admin
    setDefaultRequiredPermission(config.getString("defaultRequiredPermission", "nworld.admin"));

    // defaultHidden. Default: true
    setDefaultHidden(config.getBoolean("defaultHidden", true));

    // ##############
    // ## Messages ##
    // ##############

    // broadcastOnWorldCreate. Default: 0.
    // Possible values: 0,1
    setBroadcastOnWorldCreate(config.getInt("broadcastOnWorldCreate", 0));
    if (getBroadcastOnWorldCreate() < 0 || getBroadcastOnWorldCreate() > 1) {
      wrongValue("config.yml", "broadcastOnWorldCreate", getBroadcastOnWorldCreate(), 0);
      setBroadcastOnWorldCreate(0);
    }

    // broadcastOnWorldLoad. Default: 0.
    // Possible values: 0,1
    setBroadcastOnWorldLoad(config.getInt("broadcastOnWorldLoad", 0));
    if (getBroadcastOnWorldLoad() < 0 || getBroadcastOnWorldLoad() > 1) {
      wrongValue("config.yml", "broadcastOnWorldLoad", getBroadcastOnWorldLoad(), 0);
      setBroadcastOnWorldLoad(0);
    }

    // broadcastOnWorldUnload. Default: 0.
    // Possible values: 0,1
    setBroadcastOnWorldUnload(config.getInt("broadcastOnWorldUnload", 0));
    if (getBroadcastOnWorldUnload() < 0 || getBroadcastOnWorldUnload() > 1) {
      wrongValue("config.yml", "broadcastOnWorldUnload", getBroadcastOnWorldUnload(), 0);
      setBroadcastOnWorldUnload(0);
    }

    // ############
    // ## Worlds ##
    // ############

    final Map<String, GeneralWorld> worldsMap = new HashMap<>();
    if (config.isConfigurationSection("stockWorlds")) {
      final ConfigurationSection stockWorldsSection = config.getConfigurationSection("stockWorlds");
      for (final String worldName : stockWorldsSection.getKeys(false)) {
        final ConfigurationSection worldSection =
            stockWorldsSection.getConfigurationSection(worldName);
        final GeneralWorld.WorldType type =
            worldName.endsWith("_the_end")
                ? GeneralWorld.WorldType.STOCK_END
                : worldName.endsWith("_nether")
                    ? GeneralWorld.WorldType.STOCK_NETHER
                    : GeneralWorld.WorldType.STOCK;
        boolean malformedWorldSection = false;
        NLocation spawnLocation = null;
        String requiredPermission = null;
        final boolean enabled = Bukkit.getWorld(worldName) != null;
        Boolean hidden = null;
        if (!worldSection.isConfigurationSection("spawnLocation")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: stockWorlds."
                  + worldName
                  + ".spawnLocation");
        } else {
          final ConfigurationSection spawnSection =
              worldSection.getConfigurationSection("spawnLocation");
          if (!spawnSection.isDouble("x")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: stockWorlds."
                    + worldName
                    + ".spawnLocation.x");
          } else if (!spawnSection.isDouble("y")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: stockWorlds."
                    + worldName
                    + ".spawnLocation.y");
          } else if (!spawnSection.isDouble("z")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: stockWorlds."
                    + worldName
                    + ".spawnLocation.z");
          } else if (!spawnSection.isDouble("yaw")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: stockWorlds."
                    + worldName
                    + ".spawnLocation.yaw");
          } else if (!spawnSection.isDouble("pitch")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: stockWorlds."
                    + worldName
                    + ".spawnLocation.pitch");
          } else {
            final double x = spawnSection.getDouble("x");
            final double y = spawnSection.getDouble("y");
            final double z = spawnSection.getDouble("z");
            final float yaw = (float) spawnSection.getDouble("yaw");
            final float pitch = (float) spawnSection.getDouble("pitch");
            spawnLocation = new NLocation(worldName, x, y, z, yaw, pitch);
          }
        }
        if (!worldSection.isString("requiredPermission")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: stockWorlds."
                  + worldName
                  + ".requiredPermission");
        } else {
          requiredPermission = worldSection.getString("requiredPermission");
        }
        if (!worldSection.isBoolean("hidden")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: stockWorlds." + worldName + ".hidden");
        } else {
          hidden = worldSection.getBoolean("hidden");
        }
        if (!malformedWorldSection) {
          worldsMap.put(
              worldName,
              new StockWorld(
                  plugin, worldName, type, spawnLocation, requiredPermission, enabled, hidden));
        } else {
          throw new InvalidConfigurationException("Malformed Configuration - Stopping everything");
        }
      }
    }
    if (config.isConfigurationSection("additionalWorlds")) {
      final ConfigurationSection additionalWorldsSection =
          config.getConfigurationSection("additionalWorlds");
      for (final String worldName : additionalWorldsSection.getKeys(false)) {
        final ConfigurationSection worldSection =
            additionalWorldsSection.getConfigurationSection(worldName);

        // If an error is found in the config
        boolean malformedWorldSection = false;

        // All variables to build the GeneralWorld objects

        // Main
        NLocation spawnLocation = null;
        Long seed = null;
        String requiredPermission = null;
        Boolean enabled = null;
        Boolean hidden = null;
        Boolean hasNether = null;
        Boolean hasEnd = null;

        // Nether
        NLocation netherSpawnLocation = null;
        String netherRequiredPermission = null;
        Boolean netherEnabled = null;
        Boolean netherHidden = null;

        // End
        NLocation endSpawnLocation = null;
        String endRequiredPermission = null;
        Boolean endEnabled = null;
        Boolean endHidden = null;

        if (!worldSection.isConfigurationSection("spawnLocation")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds."
                  + worldName
                  + ".spawnLocation");
        } else {
          final ConfigurationSection spawnSection =
              worldSection.getConfigurationSection("spawnLocation");
          if (!spawnSection.isDouble("x")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".spawnLocation.x");
          } else if (!spawnSection.isDouble("y")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".spawnLocation.y");
          } else if (!spawnSection.isDouble("z")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".spawnLocation.z");
          } else if (!spawnSection.isDouble("yaw")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".spawnLocation.yaw");
          } else if (!spawnSection.isDouble("pitch")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".spawnLocation.pitch");
          } else {
            final double x = spawnSection.getDouble("x");
            final double y = spawnSection.getDouble("y");
            final double z = spawnSection.getDouble("z");
            final float yaw = (float) spawnSection.getDouble("yaw");
            final float pitch = (float) spawnSection.getDouble("pitch");
            spawnLocation = new NLocation(worldName, x, y, z, yaw, pitch);
          }
        }
        if (!worldSection.isLong("seed") && !worldSection.isInt("seed")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds." + worldName + ".seed");
        } else {
          seed = worldSection.getLong("seed");
        }
        if (!worldSection.isString("requiredPermission")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds."
                  + worldName
                  + ".requiredPermission");
        } else {
          requiredPermission = worldSection.getString("requiredPermission");
        }
        if (!worldSection.isBoolean("enabled")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds." + worldName + ".enabled");
        } else {
          enabled = worldSection.getBoolean("enabled");
        }
        if (!worldSection.isBoolean("hidden")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds." + worldName + ".hidden");
        } else {
          hidden = worldSection.getBoolean("hidden");
        }
        if (!worldSection.isBoolean("hasNether")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds."
                  + worldName
                  + ".hasNether");
        } else {
          hasNether = worldSection.getBoolean("hasNether");
        }
        if (!worldSection.isConfigurationSection("netherWorld")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration section: additionalWorlds."
                  + worldName
                  + ".netherWorld");
        } else {
          final ConfigurationSection netherSection =
              worldSection.getConfigurationSection("netherWorld");
          if (!netherSection.isConfigurationSection("spawnLocation")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".netherWorld.spawnLocation");
          } else {
            final ConfigurationSection spawnSection =
                netherSection.getConfigurationSection("spawnLocation");
            if (!spawnSection.isDouble("x")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".netherWorld.spawnLocation.x");
            } else if (!spawnSection.isDouble("y")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".netherWorld.spawnLocation.y");
            } else if (!spawnSection.isDouble("z")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".netherWorld.spawnLocation.z");
            } else if (!spawnSection.isDouble("yaw")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".netherWorld.spawnLocation.yaw");
            } else if (!spawnSection.isDouble("pitch")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".netherWorld.spawnLocation.pitch");
            } else {
              final double x = spawnSection.getDouble("x");
              final double y = spawnSection.getDouble("y");
              final double z = spawnSection.getDouble("z");
              final float yaw = (float) spawnSection.getDouble("yaw");
              final float pitch = (float) spawnSection.getDouble("pitch");
              netherSpawnLocation = new NLocation(worldName + "_nether", x, y, z, yaw, pitch);
            }
          }
          if (!netherSection.isString("requiredPermission")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".netherWorld.requiredPermission");
          } else {
            netherRequiredPermission = netherSection.getString("requiredPermission");
          }
          if (!netherSection.isBoolean("enabled")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".netherWorld.enabled");
          } else {
            netherEnabled = netherSection.getBoolean("enabled");
          }
          if (!netherSection.isBoolean("hidden")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".netherWorld.hidden");
          } else {
            netherHidden = netherSection.getBoolean("hidden");
          }
        }
        if (!worldSection.isBoolean("hasEnd")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration value: additionalWorlds." + worldName + ".hasEnd");
        } else {
          hasEnd = worldSection.getBoolean("hasEnd");
        }
        if (!worldSection.isConfigurationSection("endWorld")) {
          malformedWorldSection = true;
          log.severe(
              "Missing or invalid configuration section: additionalWorlds."
                  + worldName
                  + ".endWorld");
        } else {
          final ConfigurationSection endSection = worldSection.getConfigurationSection("endWorld");
          if (!endSection.isConfigurationSection("spawnLocation")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".endWorld.spawnLocation");
          } else {
            final ConfigurationSection spawnSection =
                endSection.getConfigurationSection("spawnLocation");
            if (!spawnSection.isDouble("x")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".endWorld.spawnLocation.x");
            } else if (!spawnSection.isDouble("y")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".endWorld.spawnLocation.y");
            } else if (!spawnSection.isDouble("z")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".endWorld.spawnLocation.z");
            } else if (!spawnSection.isDouble("yaw")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".endWorld.spawnLocation.yaw");
            } else if (!spawnSection.isDouble("pitch")) {
              malformedWorldSection = true;
              log.severe(
                  "Missing or invalid configuration value: additionalWorlds."
                      + worldName
                      + ".endWorld.spawnLocation.pitch");
            } else {
              final double x = spawnSection.getDouble("x");
              final double y = spawnSection.getDouble("y");
              final double z = spawnSection.getDouble("z");
              final float yaw = (float) spawnSection.getDouble("yaw");
              final float pitch = (float) spawnSection.getDouble("pitch");
              endSpawnLocation = new NLocation(worldName + "_the_end", x, y, z, yaw, pitch);
            }
          }
          if (!endSection.isString("requiredPermission")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".endWorld.requiredPermission");
          } else {
            endRequiredPermission = endSection.getString("requiredPermission");
          }
          if (!endSection.isBoolean("enabled")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".endWorld.enabled");
          } else {
            endEnabled = endSection.getBoolean("enabled");
          }
          if (!endSection.isBoolean("hidden")) {
            malformedWorldSection = true;
            log.severe(
                "Missing or invalid configuration value: additionalWorlds."
                    + worldName
                    + ".endWorld.hidden");
          } else {
            endHidden = endSection.getBoolean("hidden");
          }
        }
        if (!malformedWorldSection) {
          final AdditionalWorld world =
              new AdditionalWorld(
                  plugin,
                  worldName,
                  seed,
                  spawnLocation,
                  requiredPermission,
                  enabled,
                  hidden,
                  hasNether,
                  hasEnd);
          worldsMap.put(worldName, world);
          if (hasNether) {
            final AdditionalSubWorld nether =
                new AdditionalSubWorld(
                    plugin,
                    world,
                    netherSpawnLocation,
                    netherRequiredPermission,
                    netherEnabled,
                    netherHidden,
                    World.Environment.NETHER);
            worldsMap.put(worldName + "_nether", nether);
          }

          if (hasEnd) {
            final AdditionalSubWorld end =
                new AdditionalSubWorld(
                    plugin,
                    world,
                    endSpawnLocation,
                    endRequiredPermission,
                    endEnabled,
                    endHidden,
                    World.Environment.THE_END);
            worldsMap.put(worldName + "_the_end", end);
          }
        } else {
          throw new InvalidConfigurationException("Malformed Configuration - Stopping everything");
        }
      }
    }
    worlds.putAll(worldsMap);

    // ###########
    // ## Warps ##
    // ###########

    final Map<String, Warp> warpsMap = new HashMap<>();
    if (config.isConfigurationSection("warps")) {
      final ConfigurationSection warpsSection = config.getConfigurationSection("warps");
      for (final String warpName : warpsSection.getKeys(false)) {
        final ConfigurationSection warpSection = warpsSection.getConfigurationSection(warpName);
        boolean malformedWarpSection = false;
        NLocation location = null;
        String requiredPermission = null;
        Boolean hidden = null;
        if (!warpSection.isConfigurationSection("location")) {
          malformedWarpSection = true;
          log.severe("Missing or invalid configuration value: warps." + warpName + ".location");
        } else {
          final ConfigurationSection locationSection =
              warpSection.getConfigurationSection("location");
          if (!locationSection.isString("worldName")) {
            malformedWarpSection = true;
            log.severe(
                "Missing or invalid configuration value: warps."
                    + warpName
                    + ".location.worldName");
          }
          if (!locationSection.isDouble("x")) {
            malformedWarpSection = true;
            log.severe("Missing or invalid configuration value: warps." + warpName + ".location.x");
          }
          if (!locationSection.isDouble("y")) {
            malformedWarpSection = true;
            log.severe("Missing or invalid configuration value: warps." + warpName + ".location.y");
          }
          if (!locationSection.isDouble("z")) {
            malformedWarpSection = true;
            log.severe("Missing or invalid configuration value: warps." + warpName + ".location.z");
          }
          if (!locationSection.isDouble("yaw")) {
            malformedWarpSection = true;
            log.severe(
                "Missing or invalid configuration value: warps." + warpName + ".location.yaw");
          }
          if (!locationSection.isDouble("pitch")) {
            malformedWarpSection = true;
            log.severe(
                "Missing or invalid configuration value: warps." + warpName + ".location.pitch");
          }
          if (!malformedWarpSection) {
            final String worldName = locationSection.getString("worldName");
            final double x = locationSection.getDouble("x");
            final double y = locationSection.getDouble("y");
            final double z = locationSection.getDouble("z");
            final float yaw = (float) locationSection.getDouble("yaw");
            final float pitch = (float) locationSection.getDouble("pitch");
            location = new NLocation(worldName, x, y, z, yaw, pitch);
          }
        }
        if (!warpSection.isString("requiredPermission")) {
          malformedWarpSection = true;
          log.severe(
              "Missing or invalid configuration value: warps." + warpName + ".requiredPermission");
        } else {
          requiredPermission = warpSection.getString("requiredPermission");
        }
        if (!warpSection.isBoolean("hidden")) {
          malformedWarpSection = true;
          log.severe("Missing or invalid configuration value: warps." + warpName + ".hidden");
        } else {
          hidden = warpSection.getBoolean("hidden");
        }
        if (!malformedWarpSection) {
          warpsMap.put(warpName, new Warp(warpName, location, false, requiredPermission, hidden));
        } else {
          throw new InvalidConfigurationException("Malformed Configuration - Stopping everything");
        }
      }
    }
    warps.putAll(warpsMap);
  }
示例#22
0
  public RPGItem(ConfigurationSection s) {

    name = s.getString("name");
    id = s.getInt("id");
    setDisplay(s.getString("display"), false);
    setType(
        s.getString("type", Plugin.plugin.getConfig().getString("defaults.sword", "Sword")), false);
    setHand(
        s.getString("hand", Plugin.plugin.getConfig().getString("defaults.hand", "One handed")),
        false);
    setLore(s.getString("lore"), false);
    description = (List<String>) s.getList("description", new ArrayList<String>());
    for (int i = 0; i < description.size(); i++) {
      description.set(i, ChatColor.translateAlternateColorCodes('&', description.get(i)));
    }
    quality = Quality.valueOf(s.getString("quality"));
    damageMin = s.getInt("damageMin");
    damageMax = s.getInt("damageMax");
    armour = s.getInt("armour", 0);
    item = new ItemStack(Material.valueOf(s.getString("item")));
    ItemMeta meta = item.getItemMeta();
    if (meta instanceof LeatherArmorMeta) {
      ((LeatherArmorMeta) meta).setColor(Color.fromRGB(s.getInt("item_colour", 0)));
    } else {
      item.setDurability((short) s.getInt("item_data", 0));
    }
    for (String locale : Locale.getLocales()) {
      localeMeta.put(locale, meta.clone());
    }
    ignoreWorldGuard = s.getBoolean("ignoreWorldGuard", false);

    // Powers
    ConfigurationSection powerList = s.getConfigurationSection("powers");
    if (powerList != null) {
      for (String sectionKey : powerList.getKeys(false)) {
        ConfigurationSection section = powerList.getConfigurationSection(sectionKey);
        try {
          if (!Power.powers.containsKey(section.getString("powerName"))) {
            // Invalid power
            continue;
          }
          Power pow = Power.powers.get(section.getString("powerName")).newInstance();
          pow.init(section);
          pow.item = this;
          addPower(pow, false);
        } catch (InstantiationException e) {
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        }
      }
    }
    encodedID = getMCEncodedID(id);

    // Recipes
    hasRecipe = s.getBoolean("hasRecipe", false);
    if (hasRecipe) {
      recipe = (List<ItemStack>) s.getList("recipe");
    }

    ConfigurationSection drops = s.getConfigurationSection("dropChances");
    if (drops != null) {
      for (String key : drops.getKeys(false)) {
        double chance = drops.getDouble(key, 0.0);
        chance = Math.min(chance, 100.0);
        if (chance > 0) {
          dropChances.put(key, chance);
          if (!Events.drops.containsKey(key)) {
            Events.drops.put(key, new HashSet<Integer>());
          }
          Set<Integer> set = Events.drops.get(key);
          set.add(getID());
        } else {
          dropChances.remove(key);
          if (Events.drops.containsKey(key)) {
            Set<Integer> set = Events.drops.get(key);
            set.remove(getID());
          }
        }
        dropChances.put(key, chance);
      }
    }
    if (item.getType().getMaxDurability() != 0) {
      hasBar = true;
    }
    maxDurability = s.getInt("maxDurability", item.getType().getMaxDurability());
    forceBar = s.getBoolean("forceBar", false);

    if (maxDurability == 0) {
      maxDurability = -1;
    }

    rebuild();
  }
 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
   if (!(sender instanceof Player)) {
     sender.sendMessage(ChatColor.RED + "Only players may use this command");
     return true;
   }
   if (args.length == 1) {
     if (args[0].equalsIgnoreCase("list")) {
       if (!plugin.getConfig().contains("drops")) {
         sender.sendMessage(ChatColor.RED + "No drops exist yet");
         return true;
       }
       sender.sendMessage(ChatColor.GOLD + "The following items can drop");
       ConfigurationSection cs = plugin.getConfig().getConfigurationSection("drops");
       for (String item : cs.getKeys(false)) {
         ConfigurationSection i = cs.getConfigurationSection(item);
         sender.sendMessage(
             ChatColor.AQUA
                 + item
                 + ChatColor.GOLD
                 + " | "
                 + ChatColor.AQUA
                 + ChatColor.stripColor(i.getItemStack("item").serialize().toString())
                 + ChatColor.GOLD
                 + " with weight "
                 + ChatColor.AQUA
                 + i.getDouble("weight"));
       }
     }
     return true;
   }
   if (args.length == 2) {
     if (args[0].equalsIgnoreCase("add")) {
       double weight = 1;
       try {
         weight = Double.parseDouble(args[1]);
       } catch (NumberFormatException e) {
         sender.sendMessage(ChatColor.RED + "That's not a number");
         return true;
       }
       if (weight <= 0) {
         sender.sendMessage(ChatColor.RED + "Weight must be greater than zero");
         return true;
       }
       ConfigurationSection cs = plugin.getConfig().getConfigurationSection("drops");
       int maxItem = 0;
       if (plugin.getConfig().contains("drops")) {
         for (String c : cs.getKeys(false)) {
           int crate = Integer.parseInt(c);
           if (crate > maxItem) {
             maxItem = crate;
           }
         }
       }
       maxItem++;
       ItemStack item = ((Player) sender).getItemInHand().clone();
       if (StrangeWeapon.isStrangeWeapon(item)) {
         item = new StrangeWeapon(item).clone();
       }
       plugin.getConfig().set("drops." + maxItem + ".item", item);
       plugin.getConfig().set("drops." + maxItem + ".weight", weight);
       sender.sendMessage(
           ChatColor.GOLD
               + "Added "
               + ChatColor.AQUA
               + ChatColor.stripColor(item.serialize().toString())
               + ChatColor.GOLD
               + " with weight "
               + weight);
       plugin.saveConfig();
       return true;
     }
     if (args[0].equalsIgnoreCase("remove")) {
       int item = 1;
       try {
         item = Integer.parseInt(args[1]);
       } catch (NumberFormatException e) {
         sender.sendMessage(ChatColor.RED + "That's not a number");
         return true;
       }
       plugin.getConfig().set("drops." + item, null);
       plugin.saveConfig();
       sender.sendMessage(
           ChatColor.GOLD
               + "Removed item "
               + ChatColor.AQUA
               + item
               + ChatColor.GOLD
               + " from the drop list");
       return true;
     }
   }
   sender.sendMessage(
       new String[] {
         ChatColor.RED + "Valid commands are:",
         ChatColor.GOLD
             + "list "
             + ChatColor.AQUA
             + "- "
             + ChatColor.RED
             + "List what items can drop and their weights",
         ChatColor.GOLD
             + "add "
             + ChatColor.YELLOW
             + "<weight> "
             + ChatColor.AQUA
             + "- "
             + ChatColor.RED
             + "Add the item you are holding to the drops list",
         ChatColor.GOLD
             + "remove "
             + ChatColor.YELLOW
             + "<id> "
             + ChatColor.AQUA
             + "- "
             + ChatColor.RED
             + "Remove the specified item from the drops list"
       });
   return true;
 }