Command updates - Repair (Finally done!)

This commit is contained in:
GJ 2012-05-01 16:29:52 -04:00
parent c95f388d8d
commit 798bd46d0a
5 changed files with 117 additions and 48 deletions

View File

@ -25,6 +25,7 @@ Version 1.3.07
! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick ! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick
! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server ! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server
! Changed the permission node for Blast Mining detonation to mcmmo.ability.blastmining.detonate (was mcmmo.skills.blastmining) for the sake of consistency ! Changed the permission node for Blast Mining detonation to mcmmo.ability.blastmining.detonate (was mcmmo.skills.blastmining) for the sake of consistency
! Changed skill commands to only display what you have permissions for
- Removed some unused permission nodes - Removed some unused permission nodes
- Removed a few config options in favor of permissions nodes (Hunger Bonus, Armor/Tool Repair, Instant Wheat Regrowth) - Removed a few config options in favor of permissions nodes (Hunger Bonus, Armor/Tool Repair, Instant Wheat Regrowth)
- Removed level requirement for repairing string tools from the config file - Removed level requirement for repairing string tools from the config file

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -11,12 +13,22 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Page; import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class TamingCommand implements CommandExecutor { public class TamingCommand implements CommandExecutor {
private float skillValue; private float skillValue;
private String goreChance; private String goreChance;
private boolean canBeastLore;
private boolean canGore;
private boolean canSharpenedClaws;
private boolean canEnvironmentallyAware;
private boolean canThickFur;
private boolean canShockProof;
private boolean canCallWild;
private boolean canFastFood;
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (CommandHelper.noConsoleUsage(sender)) { if (CommandHelper.noConsoleUsage(sender)) {
@ -32,61 +44,102 @@ public class TamingCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.TAMING); skillValue = (float) PP.getSkillLevel(SkillType.TAMING);
dataCalculations(skillValue); dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Taming.SkillName") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Taming.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Taming") })); player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Taming") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) }));
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") })); if (canBeastLore || canCallWild || canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1") })); player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13") }));
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17") }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.14", new Object[] { Config.getInstance().getTamingCOTWOcelotCost() }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.15", new Object[] { Config.getInstance().getTamingCOTWWolfCost() }));
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
if (PP.getSkillLevel(SkillType.TAMING) < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 250) { if (canBeastLore) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.1") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.0"), LocaleLoader.getString("Taming.Effect.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 500) { if (canGore) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.2") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.2"), LocaleLoader.getString("Taming.Effect.3") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 750) { if (canSharpenedClaws) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.3") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.4"), LocaleLoader.getString("Taming.Effect.5") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7") }));
} }
if (PP.getSkillLevel(SkillType.TAMING) < 50) { if (canEnvironmentallyAware) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.4") })); player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.6"), LocaleLoader.getString("Taming.Effect.7") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9") }));
} }
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance })); if (canThickFur) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.8"), LocaleLoader.getString("Taming.Effect.9") }));
}
if (canShockProof) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.10"), LocaleLoader.getString("Taming.Effect.11") }));
}
if (canFastFood) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.16"), LocaleLoader.getString("Taming.Effect.17") }));
}
if (canCallWild) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Taming.Effect.12"), LocaleLoader.getString("Taming.Effect.13") }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.14", new Object[] { Config.getInstance().getTamingCOTWOcelotCost() }));
player.sendMessage(LocaleLoader.getString("Taming.Effect.15", new Object[] { Config.getInstance().getTamingCOTWWolfCost() }));
}
if (canEnvironmentallyAware || canFastFood || canGore || canSharpenedClaws || canShockProof || canThickFur) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
}
if (canFastFood) {
if (PP.getSkillLevel(SkillType.TAMING) < 50) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.4") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9") }));
}
}
if (canEnvironmentallyAware) {
if (PP.getSkillLevel(SkillType.TAMING) < 100) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1") }));
}
}
if (canThickFur) {
if (PP.getSkillLevel(SkillType.TAMING) < 250) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3") }));
}
}
if (canShockProof) {
if (PP.getSkillLevel(SkillType.TAMING) < 500) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.2") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5") }));
}
}
if (canSharpenedClaws) {
if (PP.getSkillLevel(SkillType.TAMING) < 750) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Taming.Ability.Locked.3") }));
}
else {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7") }));
}
}
if (canGore) {
player.sendMessage(LocaleLoader.getString("Taming.Combat.Chance.Gore", new Object[] { goreChance }));
}
Page.grabGuidePageForSkill(SkillType.TAMING, player, args); Page.grabGuidePageForSkill(SkillType.TAMING, player, args);
@ -94,11 +147,26 @@ public class TamingCommand implements CommandExecutor {
} }
private void dataCalculations(float skillValue) { private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
if (skillValue >= 1000) { if (skillValue >= 1000) {
goreChance = "100"; goreChance = "100.00%";
} }
else { else {
goreChance = String.valueOf(skillValue / 10); goreChance = percent.format(skillValue / 1000);
} }
} }
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canBeastLore = permInstance.beastLore(player);
canCallWild = permInstance.callOfTheWild(player);
canEnvironmentallyAware = permInstance.environmentallyAware(player);
canFastFood = permInstance.fastFoodService(player);
canGore = permInstance.gore(player);
canSharpenedClaws = permInstance.sharpenedClaws(player);
canShockProof = permInstance.shockProof(player);
canThickFur = permInstance.thickFur(player);
}
} }

View File

@ -123,7 +123,7 @@ public class Combat {
Taming.fastFoodService(PPo, wolf, event); Taming.fastFoodService(PPo, wolf, event);
} }
if (Permissions.getInstance().sharpenedclaws(master)) { if (Permissions.getInstance().sharpenedClaws(master)) {
Taming.sharpenedClaws(PPo, event); Taming.sharpenedClaws(PPo, event);
} }

View File

@ -76,7 +76,7 @@ public class Permissions {
return player.hasPermission("mcmmo.ability.taming.fastfoodservice"); return player.hasPermission("mcmmo.ability.taming.fastfoodservice");
} }
public boolean sharpenedclaws(Player player) { public boolean sharpenedClaws(Player player) {
return player.hasPermission("mcmmo.ability.taming.sharpenedclaws"); return player.hasPermission("mcmmo.ability.taming.sharpenedclaws");
} }

View File

@ -274,7 +274,7 @@ Taming.Ability.Locked.1=LOCKED UNTIL 250+ SKILL (THICK FUR)
Taming.Ability.Locked.2=LOCKED UNTIL 500+ SKILL (SHOCK PROOF) Taming.Ability.Locked.2=LOCKED UNTIL 500+ SKILL (SHOCK PROOF)
Taming.Ability.Locked.3=LOCKED UNTIL 750+ SKILL (SHARPENED CLAWS) Taming.Ability.Locked.3=LOCKED UNTIL 750+ SKILL (SHARPENED CLAWS)
Taming.Ability.Locked.4=LOCKED UNTIL 50+ SKILL (FAST FOOD SERVICE) Taming.Ability.Locked.4=LOCKED UNTIL 50+ SKILL (FAST FOOD SERVICE)
Taming.Combat.Chance.Gore=[[RED]]Gore Chance: [[YELLOW]]{0}% Taming.Combat.Chance.Gore=[[RED]]Gore Chance: [[YELLOW]]{0}
Taming.Effect.0=Beast Lore Taming.Effect.0=Beast Lore
Taming.Effect.1=Bone-whacking inspects wolves & ocelots Taming.Effect.1=Bone-whacking inspects wolves & ocelots
Taming.Effect.10=Shock Proof Taming.Effect.10=Shock Proof
@ -305,8 +305,8 @@ Taming.Summon.Fail.Wolf=[[RED]]You have too many wolves nearby to summon any mor
Unarmed.Ability.Berserk.Length=[[RED]]Berserk Length: [[YELLOW]]{0}s Unarmed.Ability.Berserk.Length=[[RED]]Berserk Length: [[YELLOW]]{0}s
Unarmed.Ability.Bonus.0=Iron Arm Style Unarmed.Ability.Bonus.0=Iron Arm Style
Unarmed.Ability.Bonus.1=+{0} DMG Upgrade Unarmed.Ability.Bonus.1=+{0} DMG Upgrade
Unarmed.Ability.Chance.ArrowDeflect=[[RED]]Arrow Deflect Chance: [[YELLOW]]{0}% Unarmed.Ability.Chance.ArrowDeflect=[[RED]]Arrow Deflect Chance: [[YELLOW]]{0}
Unarmed.Ability.Chance.Disarm=[[RED]]Disarm Chance: [[YELLOW]]{0}% Unarmed.Ability.Chance.Disarm=[[RED]]Disarm Chance: [[YELLOW]]{0}
Unarmed.Ability.Lower=[[GRAY]]**YOU LOWER YOUR FISTS** Unarmed.Ability.Lower=[[GRAY]]**YOU LOWER YOUR FISTS**
Unarmed.Ability.Ready=[[GREEN]]**YOU READY YOUR FISTS** Unarmed.Ability.Ready=[[GREEN]]**YOU READY YOUR FISTS**
Unarmed.Effect.0=Berserk (ABILITY) Unarmed.Effect.0=Berserk (ABILITY)
@ -329,7 +329,7 @@ Unarmed.Skillup=[[YELLOW]]Unarmed skill increased by {0}. Total ({1})
#WOODCUTTING #WOODCUTTING
Woodcutting.Ability.0=Leaf Blower Woodcutting.Ability.0=Leaf Blower
Woodcutting.Ability.1=Blow away leaves Woodcutting.Ability.1=Blow away leaves
Woodcutting.Ability.Chance.DDrop=[[RED]]Double Drop Chance: [[YELLOW]]{0}% Woodcutting.Ability.Chance.DDrop=[[RED]]Double Drop Chance: [[YELLOW]]{0}
Woodcutting.Ability.Length=[[RED]]Tree Feller Length: [[YELLOW]]{0}s Woodcutting.Ability.Length=[[RED]]Tree Feller Length: [[YELLOW]]{0}s
Woodcutting.Ability.Locked.0=LOCKED UNTIL 100+ SKILL (LEAF BLOWER) Woodcutting.Ability.Locked.0=LOCKED UNTIL 100+ SKILL (LEAF BLOWER)
Woodcutting.Effect.0=Tree Feller (ABILITY) Woodcutting.Effect.0=Tree Feller (ABILITY)