mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
Added Horses to the "Shake" ability.
Witches no longer drop water bottles from Shake, since they no longer drop them in Vanilla. Changed format of treasures.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
This commit is contained in:
parent
3bc029a0de
commit
797ac20567
@ -8,6 +8,7 @@ Key:
|
||||
- Removal
|
||||
|
||||
Version 1.4.07-dev
|
||||
+ Added Horses to the "Shake" ability
|
||||
+ Added ability to summon horses via "Call of the Wild" using apples
|
||||
+ Added XP gain to Taming for horses
|
||||
+ Added new permission nodes to allow more control over Taming and "Call of the Wild"
|
||||
@ -32,6 +33,8 @@ Version 1.4.07-dev
|
||||
= Fixed a bug where teleport location was never reset if warmup was set to 0 for "Chimaera Wing".
|
||||
= Fixed a bug where the "Dodge" DamageModifier wasn't being read from advanced.yml
|
||||
= Fixed a bug where squid were not awarding XP.
|
||||
! Changed format of treasures.yml. **YOU WILL NEED TO UPDATE YOUR FILE TO THE NEW FORMAT**
|
||||
! Witches no longer drop water bottles from Shake, since they no longer drop them in Vanilla.
|
||||
! Changed various values to double in advanced.yml for the sake of consistency.
|
||||
! Nerfed Archery damage to eliminate constant one-hit kills.
|
||||
! Changed the way Repair hands out XP, also added config options to control Repair XP
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.gmail.nossr50.config.treasure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Dye;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
@ -19,7 +17,6 @@ import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.Treasure;
|
||||
|
||||
public class TreasureConfig extends ConfigLoader {
|
||||
private static TreasureConfig instance;
|
||||
@ -45,6 +42,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromHorse = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>();
|
||||
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
|
||||
@ -75,47 +73,49 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
Map<String, Treasure> treasures = new HashMap<String, Treasure>();
|
||||
ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
|
||||
loadTreaures("Fishing");
|
||||
loadTreaures("Excavation");
|
||||
loadTreaures("Hylian");
|
||||
|
||||
for (EntityType entity : EntityType.values()) {
|
||||
if (entity.isAlive()) {
|
||||
loadTreaures("Shake." + entity.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadTreaures(String type) {
|
||||
boolean isFishing = type.equals("Fishing");
|
||||
boolean isShake = type.contains("Shake");
|
||||
boolean isExcavation = type.equals("Excavation");
|
||||
boolean isHylian = type.equals("Hylian");
|
||||
|
||||
ConfigurationSection treasureSection = config.getConfigurationSection(type);
|
||||
|
||||
if (treasureSection == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String treasureName : treasureSection.getKeys(false)) {
|
||||
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
/*
|
||||
* ID, Amount, and Data
|
||||
* Material, Amount, and Data
|
||||
*/
|
||||
Material material = treasureName.contains("POTION") ? Material.POTION : Material.matchMaterial(treasureName);
|
||||
int amount = config.getInt(type + "." + treasureName + ".Amount");
|
||||
int data = config.getInt(type + "." + treasureName + ".Data");
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".ID")) {
|
||||
reason.add("Missing ID");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Amount")) {
|
||||
reason.add("Missing Amount");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Data")) {
|
||||
reason.add("Missing Data");
|
||||
}
|
||||
|
||||
int id = config.getInt("Treasures." + treasureName + ".ID");
|
||||
int amount = config.getInt("Treasures." + treasureName + ".Amount");
|
||||
int data = config.getInt("Treasures." + treasureName + ".Data");
|
||||
|
||||
if (Material.getMaterial(id) == null) {
|
||||
reason.add("Invalid id: " + id);
|
||||
if (material == null) {
|
||||
reason.add("Invalid material: " + treasureName);
|
||||
}
|
||||
|
||||
if (amount < 1) {
|
||||
reason.add("Invalid amount: " + amount);
|
||||
}
|
||||
|
||||
if (id < 256 && (data > 127 || data < -128)) {
|
||||
if (material != null && material.isBlock() && (data > 127 || data < -128)) {
|
||||
reason.add("Invalid data: " + data);
|
||||
}
|
||||
|
||||
@ -123,27 +123,15 @@ public class TreasureConfig extends ConfigLoader {
|
||||
* XP, Drop Chance, and Drop Level
|
||||
*/
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".XP")) {
|
||||
reason.add("Missing XP");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Drop_Chance")) {
|
||||
reason.add("Missing Drop_Chance");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Drop_Level")) {
|
||||
reason.add("Missing Drop_Level");
|
||||
}
|
||||
|
||||
int xp = config.getInt("Treasures." + treasureName + ".XP");
|
||||
Double dropChance = config.getDouble("Treasures." + treasureName + ".Drop_Chance");
|
||||
int dropLevel = config.getInt("Treasures." + treasureName + ".Drop_Level");
|
||||
int xp = config.getInt(type + "." + treasureName + ".XP");
|
||||
double dropChance = config.getDouble(type + "." + treasureName + ".Drop_Chance");
|
||||
int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level");
|
||||
|
||||
if (xp < 0) {
|
||||
reason.add("Invalid xp: " + xp);
|
||||
}
|
||||
|
||||
if (dropChance < 0) {
|
||||
if (dropChance < 0.0D) {
|
||||
reason.add("Invalid Drop_Chance: " + dropChance);
|
||||
}
|
||||
|
||||
@ -152,298 +140,178 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
/*
|
||||
* Potions
|
||||
* Specific Types
|
||||
*/
|
||||
int maxLevel = 0;
|
||||
|
||||
if (isFishing) {
|
||||
maxLevel = config.getInt(type + "." + treasureName + ".Max_Level");
|
||||
|
||||
if (maxLevel < -1) {
|
||||
reason.add("Invalid Max_Level: " + maxLevel);
|
||||
}
|
||||
|
||||
if (maxLevel != -1 && maxLevel < dropLevel) {
|
||||
reason.add("Max_Level must be -1 or greater than Drop_Level!");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Itemstack
|
||||
*/
|
||||
ItemStack item = null;
|
||||
|
||||
if (config.contains("Treasures." + treasureName + ".Potion_Type")) {
|
||||
String potionType = config.getString("Treasures." + treasureName + ".Potion_Type");
|
||||
if (treasureName.contains("POTION")) {
|
||||
String potionType = treasureName.substring(7);
|
||||
|
||||
try {
|
||||
item = new Potion(PotionType.valueOf(potionType.toUpperCase())).toItemStack(amount);
|
||||
item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add("Invalid Potion_Type: " + potionType);
|
||||
}
|
||||
}
|
||||
else {
|
||||
item = (new MaterialData(id, (byte) data)).toItemStack(amount);
|
||||
}
|
||||
|
||||
/*
|
||||
* Drops From & Max Level
|
||||
*/
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
||||
reason.add("This can only be a fishing drop.");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Max_Level")) {
|
||||
reason.add("Missing Max_Level");
|
||||
}
|
||||
|
||||
int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
|
||||
|
||||
if (noErrorsInConfig(reason)) {
|
||||
FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
|
||||
treasures.put(treasureName, fTreasure);
|
||||
}
|
||||
}
|
||||
else if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Shake", false)) {
|
||||
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
||||
reason.add("This can only be a shake drop.");
|
||||
}
|
||||
|
||||
if (!config.contains("Treasures." + treasureName + ".Mob")) {
|
||||
reason.add("Missing Mob");
|
||||
}
|
||||
|
||||
String mobType = config.getString("Treasures." + treasureName + ".Mob");
|
||||
EntityType mob = null;
|
||||
else if (config.contains(type + "." + treasureName + ".Dye_Color")) {
|
||||
String color = config.getString("Fishing." + treasureName + ".Dye_Color");
|
||||
|
||||
try {
|
||||
mob = EntityType.valueOf(mobType.toUpperCase().trim());
|
||||
}
|
||||
catch (IllegalArgumentException ex){
|
||||
reason.add("Invalid Mob: " + mobType);
|
||||
}
|
||||
Dye dye = new Dye();
|
||||
dye.setColor(DyeColor.valueOf(color.toUpperCase().trim()));
|
||||
|
||||
if (noErrorsInConfig(reason)) {
|
||||
ShakeTreasure sTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel, mob);
|
||||
treasures.put(treasureName, sTreasure);
|
||||
item = dye.toItemStack(amount);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add("Invalid Dye_Color: " + color);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
HylianTreasure hTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) {
|
||||
eTreasure.setDropsFromDirt();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Grass", false)) {
|
||||
eTreasure.setDropsFromGrass();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Sand", false)) {
|
||||
eTreasure.setDropsFromSand();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Gravel", false)) {
|
||||
eTreasure.setDropsFromGravel();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Clay", false)) {
|
||||
eTreasure.setDropsFromClay();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Mycelium", false)) {
|
||||
eTreasure.setDropsFromMycel();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Soul_Sand", false)) {
|
||||
eTreasure.setDropsFromSoulSand();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Snow", false)) {
|
||||
eTreasure.setDropsFromSnow();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Bushes", false)) {
|
||||
hTreasure.setDropsFromBushes();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Flowers", false)) {
|
||||
hTreasure.setDropsFromFlowers();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Pots", false)) {
|
||||
hTreasure.setDropsFromPots();
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||
reason.add("This cannot also be a fishing drop.");
|
||||
}
|
||||
|
||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Shake", false)) {
|
||||
reason.add("This cannot also be a shake drop.");
|
||||
}
|
||||
|
||||
if (noErrorsInConfig(reason) && hTreasure.getDropsFrom() == (byte) 0x0) {
|
||||
treasures.put(treasureName, eTreasure);
|
||||
}
|
||||
else if (noErrorsInConfig(reason) && eTreasure.getDropsFrom() == (byte) 0x0) {
|
||||
treasures.put(treasureName, hTreasure);
|
||||
}
|
||||
item = new ItemStack(material, amount, (short) data);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
|
||||
List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
|
||||
List<String> hylianTreasures = config.getStringList("Hylian_Luck.Treasure");
|
||||
List<String> shakeTreasures = config.getStringList("Shake.Treasure");
|
||||
|
||||
for (Entry<String, Treasure> nextEntry : treasures.entrySet()) {
|
||||
String treasureKey = nextEntry.getKey();
|
||||
Treasure treasure = nextEntry.getValue();
|
||||
|
||||
if (treasure instanceof FishingTreasure) {
|
||||
if (fishingTreasures == null || !fishingTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
if (noErrorsInConfig(reason)) {
|
||||
if (isFishing) {
|
||||
fishingRewards.add(new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel));
|
||||
}
|
||||
else if (isShake) {
|
||||
ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
|
||||
|
||||
fishingRewards.add((FishingTreasure) treasure);
|
||||
}
|
||||
else if (treasure instanceof ShakeTreasure) {
|
||||
if (shakeTreasures == null || !shakeTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
if (type.equals("Shake.BLAZE")) {
|
||||
shakeFromBlaze.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.CAVE_SPIDER")) {
|
||||
shakeFromCaveSpider.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.CHICKEN")) {
|
||||
shakeFromChicken.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.COW")) {
|
||||
shakeFromCow.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.CREEPER")) {
|
||||
shakeFromCreeper.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.ENDERMAN")) {
|
||||
shakeFromEnderman.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.GHAST")) {
|
||||
shakeFromGhast.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.HORSE")) {
|
||||
shakeFromHorse.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.IRON_GOLEM")) {
|
||||
shakeFromIronGolem.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.MAGMA_CUBE")) {
|
||||
shakeFromMagmaCube.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.MUSHROOM_COW")) {
|
||||
shakeFromMushroomCow.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.PIG")) {
|
||||
shakeFromPig.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.PIG_ZOMBIE")) {
|
||||
shakeFromPigZombie.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SHEEP")) {
|
||||
shakeFromSheep.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SKELETON")) {
|
||||
shakeFromSkeleton.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SLIME")) {
|
||||
shakeFromSlime.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SPIDER")) {
|
||||
shakeFromSpider.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SNOWMAN")) {
|
||||
shakeFromSnowman.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.SQUID")) {
|
||||
shakeFromSquid.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.WITCH")) {
|
||||
shakeFromWitch.add(shakeTreasure);
|
||||
}
|
||||
else if (type.equals("Shake.ZOMBIE")) {
|
||||
shakeFromZombie.add(shakeTreasure);
|
||||
}
|
||||
}
|
||||
else if (isExcavation) {
|
||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||
|
||||
ShakeTreasure e = (ShakeTreasure) treasure;
|
||||
switch (e.getMob()) {
|
||||
case BLAZE:
|
||||
shakeFromBlaze.add(e);
|
||||
break;
|
||||
if (dropList.contains("Dirt")) {
|
||||
excavationFromDirt.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case CAVE_SPIDER:
|
||||
shakeFromCaveSpider.add(e);
|
||||
break;
|
||||
if (dropList.contains("Grass")) {
|
||||
excavationFromGrass.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case CHICKEN:
|
||||
shakeFromChicken.add(e);
|
||||
break;
|
||||
if (dropList.contains("Sand")) {
|
||||
excavationFromSand.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case COW:
|
||||
shakeFromCow.add(e);
|
||||
break;
|
||||
if (dropList.contains("Gravel")) {
|
||||
excavationFromGravel.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case CREEPER:
|
||||
shakeFromCreeper.add(e);
|
||||
break;
|
||||
if (dropList.contains("Clay")) {
|
||||
excavationFromClay.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case ENDERMAN:
|
||||
shakeFromEnderman.add(e);
|
||||
break;
|
||||
if (dropList.contains("Mycelium")) {
|
||||
excavationFromMycel.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case GHAST:
|
||||
shakeFromGhast.add(e);
|
||||
break;
|
||||
if (dropList.contains("Soul_Sand")) {
|
||||
excavationFromSoulSand.add(excavationTreasure);
|
||||
}
|
||||
|
||||
case IRON_GOLEM:
|
||||
shakeFromIronGolem.add(e);
|
||||
break;
|
||||
|
||||
case MAGMA_CUBE:
|
||||
shakeFromMagmaCube.add(e);
|
||||
break;
|
||||
|
||||
case MUSHROOM_COW:
|
||||
shakeFromMushroomCow.add(e);
|
||||
break;
|
||||
|
||||
case PIG:
|
||||
shakeFromPig.add(e);
|
||||
break;
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
shakeFromPigZombie.add(e);
|
||||
break;
|
||||
|
||||
case SHEEP:
|
||||
shakeFromSheep.add(e);
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
shakeFromSkeleton.add(e);
|
||||
break;
|
||||
|
||||
case SLIME:
|
||||
shakeFromSlime.add(e);
|
||||
break;
|
||||
|
||||
case SPIDER:
|
||||
shakeFromSpider.add(e);
|
||||
break;
|
||||
|
||||
case SNOWMAN:
|
||||
shakeFromSnowman.add(e);
|
||||
break;
|
||||
|
||||
case SQUID:
|
||||
shakeFromSquid.add(e);
|
||||
break;
|
||||
|
||||
case WITCH:
|
||||
shakeFromWitch.add(e);
|
||||
break;
|
||||
|
||||
case ZOMBIE:
|
||||
shakeFromZombie.add(e);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (treasure instanceof HylianTreasure) {
|
||||
if (hylianTreasures == null || !hylianTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
if (dropList.contains("Snow")) {
|
||||
excavationFromSnow.add(excavationTreasure);
|
||||
}
|
||||
}
|
||||
else if (isHylian) {
|
||||
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
||||
|
||||
HylianTreasure hTreasure = (HylianTreasure) treasure;
|
||||
if (dropList.contains("Bushes")) {
|
||||
hylianFromBushes.add(hylianTreasure);
|
||||
}
|
||||
|
||||
if (hTreasure.getDropsFromBushes()) {
|
||||
hylianFromBushes.add(hTreasure);
|
||||
}
|
||||
if (dropList.contains("Flowers")) {
|
||||
hylianFromFlowers.add(hylianTreasure);
|
||||
}
|
||||
|
||||
if (hTreasure.getDropsFromFlowers()) {
|
||||
hylianFromFlowers.add(hTreasure);
|
||||
}
|
||||
|
||||
if (hTreasure.getDropsFromPots()) {
|
||||
hylianFromPots.add(hTreasure);
|
||||
}
|
||||
}
|
||||
else if (treasure instanceof ExcavationTreasure) {
|
||||
if (excavationTreasures == null || !excavationTreasures.contains(treasureKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ExcavationTreasure eTreasure = (ExcavationTreasure) treasure;
|
||||
|
||||
if (eTreasure.getDropsFromDirt()) {
|
||||
excavationFromDirt.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromGrass()) {
|
||||
excavationFromGrass.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromSand()) {
|
||||
excavationFromSand.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromGravel()) {
|
||||
excavationFromGravel.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromClay()) {
|
||||
excavationFromClay.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromMycel()) {
|
||||
excavationFromMycel.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromSoulSand()) {
|
||||
excavationFromSoulSand.add(eTreasure);
|
||||
}
|
||||
|
||||
if (eTreasure.getDropsFromSnow()) {
|
||||
excavationFromSnow.add(eTreasure);
|
||||
if (dropList.contains("Pots")) {
|
||||
hylianFromPots.add(hylianTreasure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,138 +3,7 @@ package com.gmail.nossr50.datatypes.treasure;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ExcavationTreasure extends Treasure {
|
||||
// dirt | grass | sand | gravel | clay | mycel | soulsand | snow
|
||||
// 00000001 - dirt 1
|
||||
// 00000010 - grass 2
|
||||
// 00000100 - sand 4
|
||||
// 00001000 - gravel 8
|
||||
// 00010000 - clay 16
|
||||
// 00100000 - mycel 32
|
||||
// 01000000 - soulsand 64
|
||||
// 10000000 - snow 128
|
||||
private byte dropsFrom = 0x0;
|
||||
|
||||
public ExcavationTreasure(ItemStack drop, int xp, double dropChance, int dropLevel) {
|
||||
super(drop, xp, dropChance, dropLevel);
|
||||
}
|
||||
|
||||
// Raw getters and setters
|
||||
public byte getDropsFrom() {
|
||||
return dropsFrom;
|
||||
}
|
||||
|
||||
public void setDropsFrom(byte dropsFrom) {
|
||||
this.dropsFrom = dropsFrom;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean getDropsFromDirt() {
|
||||
return getDropFromMask(1);
|
||||
}
|
||||
|
||||
public boolean getDropsFromGrass() {
|
||||
return getDropFromMask(2);
|
||||
}
|
||||
|
||||
public boolean getDropsFromSand() {
|
||||
return getDropFromMask(4);
|
||||
}
|
||||
|
||||
public boolean getDropsFromGravel() {
|
||||
return getDropFromMask(8);
|
||||
}
|
||||
|
||||
public boolean getDropsFromClay() {
|
||||
return getDropFromMask(16);
|
||||
}
|
||||
|
||||
public boolean getDropsFromMycel() {
|
||||
return getDropFromMask(32);
|
||||
}
|
||||
|
||||
public boolean getDropsFromSoulSand() {
|
||||
return getDropFromMask(64);
|
||||
}
|
||||
|
||||
public boolean getDropsFromSnow() {
|
||||
return getDropFromMask(128);
|
||||
}
|
||||
|
||||
private boolean getDropFromMask(int mask) {
|
||||
return ((dropsFrom & mask) > 0) ? true : false;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setDropsFromDirt() {
|
||||
setDropFromMask(1);
|
||||
}
|
||||
|
||||
public void setDropsFromGrass() {
|
||||
setDropFromMask(2);
|
||||
}
|
||||
|
||||
public void setDropsFromSand() {
|
||||
setDropFromMask(4);
|
||||
}
|
||||
|
||||
public void setDropsFromGravel() {
|
||||
setDropFromMask(8);
|
||||
}
|
||||
|
||||
public void setDropsFromClay() {
|
||||
setDropFromMask(16);
|
||||
}
|
||||
|
||||
public void setDropsFromMycel() {
|
||||
setDropFromMask(32);
|
||||
}
|
||||
|
||||
public void setDropsFromSoulSand() {
|
||||
setDropFromMask(64);
|
||||
}
|
||||
|
||||
public void setDropsFromSnow() {
|
||||
setDropFromMask(128);
|
||||
}
|
||||
|
||||
private void setDropFromMask(int mask) {
|
||||
dropsFrom |= mask;
|
||||
}
|
||||
|
||||
// Un-setters
|
||||
public void unsetDropsFromDirt() {
|
||||
unsetDropFromMask(1);
|
||||
}
|
||||
|
||||
public void unsetDropsFromGrass() {
|
||||
unsetDropFromMask(2);
|
||||
}
|
||||
|
||||
public void unsetDropsFromSand() {
|
||||
unsetDropFromMask(4);
|
||||
}
|
||||
|
||||
public void unsetDropsFromGravel() {
|
||||
unsetDropFromMask(8);
|
||||
}
|
||||
|
||||
public void unsetDropsFromClay() {
|
||||
unsetDropFromMask(16);
|
||||
}
|
||||
|
||||
public void unsetDropsFromMycel() {
|
||||
unsetDropFromMask(32);
|
||||
}
|
||||
|
||||
public void unsetDropsFromSoulSand() {
|
||||
unsetDropFromMask(64);
|
||||
}
|
||||
|
||||
public void unsetDropsFromSnow() {
|
||||
unsetDropFromMask(128);
|
||||
}
|
||||
|
||||
private void unsetDropFromMask(int mask) {
|
||||
dropsFrom &= ~mask;
|
||||
}
|
||||
}
|
||||
|
@ -3,73 +3,7 @@ package com.gmail.nossr50.datatypes.treasure;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class HylianTreasure extends Treasure {
|
||||
// bushes | flowers | pots
|
||||
// 00000001 - bushes 1
|
||||
// 00000010 - flowers 2
|
||||
// 00000100 - pots 4
|
||||
private byte dropsFrom = 0x0;
|
||||
|
||||
public HylianTreasure(ItemStack drop, int xp, double dropChance, int dropLevel) {
|
||||
super(drop, xp, dropChance, dropLevel);
|
||||
}
|
||||
|
||||
// Raw getters and setters
|
||||
public byte getDropsFrom() {
|
||||
return dropsFrom;
|
||||
}
|
||||
|
||||
public void setDropsFrom(byte dropsFrom) {
|
||||
this.dropsFrom = dropsFrom;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public boolean getDropsFromBushes() {
|
||||
return getDropFromMask(1);
|
||||
}
|
||||
|
||||
public boolean getDropsFromFlowers() {
|
||||
return getDropFromMask(2);
|
||||
}
|
||||
|
||||
public boolean getDropsFromPots() {
|
||||
return getDropFromMask(4);
|
||||
}
|
||||
|
||||
private boolean getDropFromMask(int mask) {
|
||||
return ((dropsFrom & mask) > 0) ? true : false;
|
||||
}
|
||||
|
||||
// Setters
|
||||
public void setDropsFromBushes() {
|
||||
setDropFromMask(1);
|
||||
}
|
||||
|
||||
public void setDropsFromFlowers() {
|
||||
setDropFromMask(2);
|
||||
}
|
||||
|
||||
public void setDropsFromPots() {
|
||||
setDropFromMask(4);
|
||||
}
|
||||
|
||||
private void setDropFromMask(int mask) {
|
||||
dropsFrom |= mask;
|
||||
}
|
||||
|
||||
// Un-setters
|
||||
public void unsetDropsFromBushes() {
|
||||
unsetDropFromMask(1);
|
||||
}
|
||||
|
||||
public void unsetDropsFromFlowers() {
|
||||
unsetDropFromMask(2);
|
||||
}
|
||||
|
||||
public void unsetDropsFromPots() {
|
||||
unsetDropFromMask(4);
|
||||
}
|
||||
|
||||
private void unsetDropFromMask(int mask) {
|
||||
dropsFrom &= ~mask;
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,9 @@
|
||||
package com.gmail.nossr50.datatypes.treasure;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ShakeTreasure extends Treasure {
|
||||
private EntityType mob;
|
||||
|
||||
public ShakeTreasure(ItemStack drop, int xp, double dropChance, int dropLevel, EntityType mob) {
|
||||
public ShakeTreasure(ItemStack drop, int xp, double dropChance, int dropLevel) {
|
||||
super(drop, xp, dropChance, dropLevel);
|
||||
this.mob = mob;
|
||||
}
|
||||
|
||||
public EntityType getMob() {
|
||||
return mob;
|
||||
}
|
||||
|
||||
public void setMob(EntityType mob) {
|
||||
this.mob = mob;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user