Reworked COTW config options + made COTW item configurable

Adresses #1481 partially
This commit is contained in:
TfT_02 2014-03-23 14:31:51 +01:00
parent 04e5dda127
commit 0fe3ad7432
6 changed files with 62 additions and 40 deletions

View File

@ -21,8 +21,9 @@ Version 1.4.08-dev
+ Added new experience bonus perk 'mcmmo.perks.xp.customboost.<skillname>' multiplies incoming XP by the boost amount defined in the experience config
+ Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default
+ Added support for multiple mod config files, naming can be done as either armor.<modname>.yml or <modname>.armor.yml
+ Added config options to configure the items used in "Call of the Wild"
= Fixed bug where healthbars wouldn't display if skills were disabled
= Fixed bug with Call of The Wild entities despawning
= Fixed bug with "Call of the Wild" entities despawning
= Fixed bug with updating (very) old user data.
= Fixed bug with checking maximum durability of mod items.
= Fixed exploit involving Call of The Wild.

View File

@ -91,9 +91,9 @@ public class TamingCommand extends SkillCommand {
if (canCallWild) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13")));
messages.add(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWOcelotCost()));
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWWolfCost()));
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWHorseCost()));
messages.add(LocaleLoader.getString("Taming.Effect.14", Config.getInstance().getTamingCOTWCost(EntityType.OCELOT)));
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWCost(EntityType.WOLF)));
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWCost(EntityType.HORSE)));
}
return messages;

View File

@ -182,20 +182,40 @@ public class Config extends AutoUpdateConfigLoader {
reason.add("Cannot use the same item for Repair and Salvage anvils!");
}
if (getTamingCOTWWolfCost() < 1) {
reason.add("Skills.Taming.Call_Of_The_Wild.Bones_Required should be at least 1!");
if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
}
if (getTamingCOTWOcelotCost() < 1) {
reason.add("Skills.Taming.Call_Of_The_Wild.Fish_Required should be at least 1!");
if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
}
if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot_Amount should be greater than 0!");
if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
}
if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
}
if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
}
if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
}
if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf_Amount should be greater than 0!");
reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
}
if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
}
if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
}
return noErrorsInConfig(reason);
@ -448,11 +468,10 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
/* Taming */
public int getTamingCOTWHorseCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Apples_Required", 10); }
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
public Material getTamingCOTWMaterial(EntityType type) { return Material.matchMaterial(config.getString("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Material")); }
public int getTamingCOTWCost(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Item_Amount"); }
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type) + ".Summon_Amount"); }
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ "_Amount"); }
/* Woodcutting */
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }

View File

@ -6,6 +6,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -596,21 +597,14 @@ public class PlayerListener implements Listener {
Material type = heldItem.getType();
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
switch (type) {
case APPLE:
tamingManager.summonHorse();
break;
case BONE:
tamingManager.summonWolf();
break;
case RAW_FISH:
tamingManager.summonOcelot();
break;
default:
break;
if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.WOLF)) {
tamingManager.summonWolf();
}
else if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.OCELOT)) {
tamingManager.summonOcelot();
}
else if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.HORSE)) {
tamingManager.summonHorse();
}
break;

View File

@ -146,7 +146,7 @@ public class TamingManager extends SkillManager {
return;
}
callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWOcelotCost());
callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWCost(EntityType.OCELOT));
}
/**
@ -157,7 +157,7 @@ public class TamingManager extends SkillManager {
return;
}
callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWWolfCost());
callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWCost(EntityType.WOLF));
}
/**
@ -168,7 +168,7 @@ public class TamingManager extends SkillManager {
return;
}
callOfTheWild(EntityType.HORSE, Config.getInstance().getTamingCOTWHorseCost());
callOfTheWild(EntityType.HORSE, Config.getInstance().getTamingCOTWCost(EntityType.HORSE));
}
/**

View File

@ -317,16 +317,24 @@ Skills:
Enabled_For_PVE: true
Level_Cap: 0
Call_Of_The_Wild:
Bones_Required: 10
Fish_Required: 10
Apples_Required: 10
# Item_Material: Material of the item needed to summon the pet
# Item_Amount: Amount of items required to summon the pet
# Summon_Amount: Amount of pets to summon when using Call Of The Wild
Wolf:
Item_Material: BONE
Item_Amount: 10
Summon_Amount: 1
Ocelot:
Item_Material: RAW_FISH
Item_Amount: 10
Summon_Amount: 1
Horse:
Item_Material: APPLE
Item_Amount: 10
Summon_Amount: 1
# Range to check for nearby pets when using Call Of The Wild, 0 will disable the check
Range: 40.0
# Amount of pets to summon when using Call Of The Wild
Wolf_Amount: 1
Ocelot_Amount: 1
Horse_Amount: 1
Unarmed:
Enabled_For_PVP: true
Enabled_For_PVE: true