Read summon item from config in /taming command

This commit is contained in:
TfT_02 2014-04-21 15:19:37 +02:00
parent 8e5340ebc3
commit 63b332216e
3 changed files with 15 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
public class TamingCommand extends SkillCommand { public class TamingCommand extends SkillCommand {
private String goreChance; private String goreChance;
@ -91,9 +92,13 @@ public class TamingCommand extends SkillCommand {
if (canCallWild) { if (canCallWild) {
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13"))); 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().getTamingCOTWCost(EntityType.OCELOT))); int costOcelot = Config.getInstance().getTamingCOTWCost(EntityType.OCELOT);
messages.add(LocaleLoader.getString("Taming.Effect.15", Config.getInstance().getTamingCOTWCost(EntityType.WOLF))); String itemOcelot = StringUtils.getPrettyItemString(Config.getInstance().getTamingCOTWMaterial(EntityType.OCELOT));
messages.add(LocaleLoader.getString("Taming.Effect.20", Config.getInstance().getTamingCOTWCost(EntityType.HORSE))); int costWolf = Config.getInstance().getTamingCOTWCost(EntityType.WOLF);
String itemWolf = StringUtils.getPrettyItemString(Config.getInstance().getTamingCOTWMaterial(EntityType.WOLF));
int costHorse = Config.getInstance().getTamingCOTWCost(EntityType.HORSE);
String itemHorse = StringUtils.getPrettyItemString(Config.getInstance().getTamingCOTWMaterial(EntityType.HORSE));
messages.add(LocaleLoader.getString("Taming.Effect.14", costOcelot, itemOcelot, costWolf, itemWolf, costHorse, itemHorse));
} }
return messages; return messages;

View File

@ -362,7 +362,8 @@ public class TamingManager extends SkillManager {
return true; return true;
} }
int summonAmount = summonedEntities.get(entityType).size(); List<TrackedTamingEntity> trackedEntities = getTrackedEntities(entityType);
int summonAmount = trackedEntities == null ? 0 : trackedEntities.size();
if (summonAmount >= maxAmountSummons) { if (summonAmount >= maxAmountSummons) {
player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.TooMany", maxAmountSummons)); player.sendMessage(LocaleLoader.getString("Taming.Summon.Fail.TooMany", maxAmountSummons));
@ -382,6 +383,10 @@ public class TamingManager extends SkillManager {
summonedEntities.get(livingEntity.getType()).add(trackedEntity); summonedEntities.get(livingEntity.getType()).add(trackedEntity);
} }
protected static List<TrackedTamingEntity> getTrackedEntities(EntityType entityType) {
return summonedEntities.get(entityType);
}
protected static void removeFromTracker(TrackedTamingEntity trackedEntity) { protected static void removeFromTracker(TrackedTamingEntity trackedEntity) {
summonedEntities.get(trackedEntity.getLivingEntity().getType()).remove(trackedEntity); summonedEntities.get(trackedEntity.getLivingEntity().getType()).remove(trackedEntity);
} }

View File

@ -340,9 +340,7 @@ Taming.Effect.10=Shock Proof
Taming.Effect.11=Explosive Damage Reduction Taming.Effect.11=Explosive Damage Reduction
Taming.Effect.12=Call of the Wild Taming.Effect.12=Call of the Wild
Taming.Effect.13=Summon an animal to your side Taming.Effect.13=Summon an animal to your side
Taming.Effect.14=[[GRAY]]COTW (Ocelot): Crouch and left-click with {0} Fish in hand Taming.Effect.14=[[GRAY]]COTW: Crouch and left-click with\n {0} {1} (Ocelot), {2} {3} (Wolf), {4} {5} (Horse)
Taming.Effect.15=[[GRAY]]COTW (Wolf): Crouch and left-click with {0} Bones in hand
Taming.Effect.20=[[GRAY]]COTW (Horse): Crouch and left-click with {0} Apples in hand
Taming.Effect.16=Fast Food Service Taming.Effect.16=Fast Food Service
Taming.Effect.17=Chance for wolves to heal on attack Taming.Effect.17=Chance for wolves to heal on attack
Taming.Effect.18=Holy Hound Taming.Effect.18=Holy Hound