Command update - Mining. Also fixed typo on new Herbalism permission.

This commit is contained in:
GJ 2012-05-01 10:39:50 -04:00
parent f7405a82e6
commit 44d22d93da
6 changed files with 132 additions and 76 deletions

View File

@ -23,6 +23,7 @@ Version 1.3.07
! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch
! 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 the permission node for Blast Mining detonation to mcmmo.ability.blastmining.detonate (was mcmmo.skills.blastmining) for the sake of consistency
- Removed some unused permission nodes
Version 1.3.06

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.commands.skills;
import java.text.DecimalFormat;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -9,16 +11,24 @@ import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Page;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class MiningCommand implements CommandExecutor {
private float skillValue;
private String doubleDropChance;
private String superBreakerLength;
private int blastMiningRank;
private int blastRadiusIncrease;
private int blastDamageDecrease;
private String blastMiningRank;
private String blastRadiusIncrease;
private String blastDamageDecrease;
private boolean canSuperBreaker;
private boolean canDoubleDrop;
private boolean canBlast;
private boolean canBiggerBombs;
private boolean canDemoExpert;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
@ -35,42 +45,74 @@ public class MiningCommand implements CommandExecutor {
skillValue = (float) PP.getSkillLevel(SkillType.MINING);
dataCalculations(skillValue);
permissionsCheck(player);
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Mining.SkillName") }));
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Mining") }));
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) }));
if (canBiggerBombs || canBlast || canDemoExpert || canDoubleDrop || canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
}
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.0"), LocaleLoader.getString("Mining.Effect.1") }));
}
if (canDoubleDrop) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.2"), LocaleLoader.getString("Mining.Effect.3") }));
}
if (canBlast) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.4"), LocaleLoader.getString("Mining.Effect.5") }));
}
if (canBiggerBombs) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.6"), LocaleLoader.getString("Mining.Effect.7") }));
}
if (canDemoExpert) {
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Mining.Effect.8"), LocaleLoader.getString("Mining.Effect.9") }));
}
if (canBiggerBombs || canBlast || canDemoExpert || canDoubleDrop || canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
}
if (canDoubleDrop) {
player.sendMessage(LocaleLoader.getString("Mining.Effect.DropChance", new Object[] { doubleDropChance }));
}
if (canSuperBreaker) {
player.sendMessage(LocaleLoader.getString("Mining.Ability.Length", new Object[] { superBreakerLength }));
}
if (canBlast) {
if (PP.getSkillLevel(SkillType.MINING) < 125) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.0") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (blastMiningRank - 1)) }));
player.sendMessage(LocaleLoader.getString("Mining.Blast.Rank", new Object[] { blastMiningRank, LocaleLoader.getString("Mining.Blast.Effect." + (Misc.getInt(blastMiningRank) - 1)) }));
}
}
if (canBiggerBombs) {
if (PP.getSkillLevel(SkillType.MINING) < 250) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.1") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Blast.Radius.Increase", new Object[] { blastRadiusIncrease }));
}
}
if (canDemoExpert) {
if (PP.getSkillLevel(SkillType.MINING) < 500) {
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template.Lock", new Object[] { LocaleLoader.getString("Mining.Ability.Locked.2") }));
}
else {
player.sendMessage(LocaleLoader.getString("Mining.Effect.Decrease", new Object[] { blastDamageDecrease }));
}
}
Page.grabGuidePageForSkill(SkillType.MINING, player, args);
@ -78,61 +120,73 @@ public class MiningCommand implements CommandExecutor {
}
private void dataCalculations(float skillValue) {
DecimalFormat percent = new DecimalFormat("##0.00%");
superBreakerLength = String.valueOf(2 + ((int) skillValue / 50));
if (skillValue >= 1000) {
blastMiningRank = 8;
blastDamageDecrease = 100;
blastRadiusIncrease = 4;
doubleDropChance = "100";
blastMiningRank = "8";
blastDamageDecrease = "100.00%";
blastRadiusIncrease = "4";
doubleDropChance = "100.00%";
}
else if (skillValue >= 875) {
blastMiningRank = 7;
blastDamageDecrease = 50;
blastRadiusIncrease = 3;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "7";
blastDamageDecrease = "50.00%";
blastRadiusIncrease = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 750) {
blastMiningRank = 6;
blastDamageDecrease = 50;
blastRadiusIncrease = 3;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "6";
blastDamageDecrease = "50.00%";
blastRadiusIncrease = "3";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 625) {
blastMiningRank = 5;
blastDamageDecrease = 25;
blastRadiusIncrease = 2;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "5";
blastDamageDecrease = "25.00%";
blastRadiusIncrease = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 500) {
blastMiningRank = 4;
blastDamageDecrease = 25;
blastRadiusIncrease = 2;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "4";
blastDamageDecrease = "25.00%";
blastRadiusIncrease = "2";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 375) {
blastMiningRank = 3;
blastDamageDecrease = 0;
blastRadiusIncrease = 1;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "3";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 250) {
blastMiningRank = 2;
blastDamageDecrease = 0;
blastRadiusIncrease = 1;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "2";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "1";
doubleDropChance = percent.format(skillValue / 1000);
}
else if (skillValue >= 125) {
blastMiningRank = 1;
blastDamageDecrease = 0;
blastRadiusIncrease = 0;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "1";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "0";
doubleDropChance = percent.format(skillValue / 1000);
}
else {
blastMiningRank = 0;
blastDamageDecrease = 0;
blastRadiusIncrease = 0;
doubleDropChance = String.valueOf(skillValue / 10);
blastMiningRank = "0";
blastDamageDecrease = "0.00%";
blastRadiusIncrease = "0";
doubleDropChance = percent.format(skillValue / 1000);
}
}
private void permissionsCheck(Player player) {
Permissions permInstance = Permissions.getInstance();
canBiggerBombs = permInstance.biggerBombs(player);
canBlast = permInstance.blastMining(player);
canDemoExpert = permInstance.demolitionsExpertise(player);
canDoubleDrop = permInstance.miningDoubleDrops(player);
canSuperBreaker = permInstance.superBreaker(player);
}
}

View File

@ -336,6 +336,10 @@ public class Permissions {
return player.hasPermission("mcmmo.ability.blastmining.demolitionsexpertise");
}
public boolean blastMining(Player player) {
return player.hasPermission("mcmmo.ability.blastmining.detonate");
}
/*
* MCMMO.ITEM.*
*/
@ -392,10 +396,6 @@ public class Permissions {
return player.hasPermission("mcmmo.skills.mining");
}
public boolean blastMining(Player player) {
return player.hasPermission("mcmmo.skills.blastmining");
}
public boolean fishing(Player player) {
return player.hasPermission("mcmmo.skills.fishing");
}

View File

@ -271,7 +271,7 @@ Taming.Ability.Locked.3=LOCKED UNTIL 750+ SKILL (SHARPENED CLAWS)
Taming.Ability.Locked.4=LOCKED UNTIL 50+ SKILL (FAST FOOD SERVICE)
Taming.Combat.Chance.Gore=[[RED]]Gore Chance: [[YELLOW]]{0}%
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.11=Explosive Damage Reduction
Taming.Effect.12=Call of the Wild

View File

@ -318,7 +318,7 @@ permissions:
mcmmo.ability.herbalism.greenterra: true
mcmmo.ability.herbalism.greenthumbblocks: true
mcmmo.ability.herbalism.greenthumbwheat: true
mcmmo.ability.herbalism.foodbonus: true
mcmmo.ability.herbalism.farmersdiet: true
mcmmo.ability.herbalism.doubledrops:
description: Allows double drop chance from Herbalism
mcmmo.ability.herbalism.greenterra:
@ -385,12 +385,15 @@ permissions:
children:
mcmmo.ability.blastmining.biggerbombs: true
mcmmo.ability.blastmining.demolitionsexpertise: true
mcmmo.ability.blastmining.detonate: true
mcmmo.ability.blastmining.biggerbombs:
description: Allows access to the Bigger Bombs ability
mcmmo.ability.blastmining.demolitionsexpertise:
description: Allows access to the Demolitions Expertise ability
mcmmo.ability.blastmining.detonate:
description: Allows for remote TNT detonation
mcmmo.item.*:
description: Implies all mcmmo.item permissions.
description: Implies all mcmmo.item permissions
children:
mcmmo.item.chimaerawing: true
mcmmo.item.chimaerawing:
@ -461,5 +464,3 @@ permissions:
description: Allows access to the Axes skill
mcmmo.skills.acrobatics:
description: Allows access to the Acrobatics skill
mcmmo.skills.blastmining:
description: Allows access to the Blast Mining subskill for Mining