mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Command update - Swords
This commit is contained in:
parent
edaa51593b
commit
cc60f2f308
@ -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;
|
||||||
@ -10,6 +12,7 @@ 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 SwordsCommand implements CommandExecutor {
|
public class SwordsCommand implements CommandExecutor {
|
||||||
@ -19,6 +22,10 @@ public class SwordsCommand implements CommandExecutor {
|
|||||||
private String bleedChance;
|
private String bleedChance;
|
||||||
private String serratedStrikesLength;
|
private String serratedStrikesLength;
|
||||||
|
|
||||||
|
private boolean canCounter;
|
||||||
|
private boolean canSerratedStrike;
|
||||||
|
private boolean canBleed;
|
||||||
|
|
||||||
@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)) {
|
||||||
@ -34,23 +41,46 @@ public class SwordsCommand implements CommandExecutor {
|
|||||||
|
|
||||||
skillValue = (float) PP.getSkillLevel(SkillType.SWORDS);
|
skillValue = (float) PP.getSkillLevel(SkillType.SWORDS);
|
||||||
dataCalculations(skillValue);
|
dataCalculations(skillValue);
|
||||||
|
permissionsCheck(player);
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Swords.SkillName") }));
|
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Swords.SkillName") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Swords") }));
|
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Swords") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
|
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) }));
|
||||||
|
|
||||||
|
if (canBleed || canCounter || canSerratedStrike) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canCounter) {
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1") }));
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.0"), LocaleLoader.getString("Swords.Effect.1") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canSerratedStrike) {
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3") }));
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.2"), LocaleLoader.getString("Swords.Effect.3") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5") }));
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.4"), LocaleLoader.getString("Swords.Effect.5") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7") }));
|
}
|
||||||
|
|
||||||
|
if (canBleed) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Swords.Effect.6"), LocaleLoader.getString("Swords.Effect.7") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canBleed || canCounter || canSerratedStrike) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canCounter) {
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Counter.Chance", new Object[] { counterAttackChance }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canBleed) {
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Length", new Object[] { bleedLength }));
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Note"));
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
|
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleed.Chance", new Object[] { bleedChance }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canSerratedStrike) {
|
||||||
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", new Object[] { serratedStrikesLength }));
|
player.sendMessage(LocaleLoader.getString("Swords.SS.Length", new Object[] { serratedStrikesLength }));
|
||||||
|
}
|
||||||
|
|
||||||
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);
|
Page.grabGuidePageForSkill(SkillType.SWORDS, player, args);
|
||||||
|
|
||||||
@ -58,22 +88,32 @@ public class SwordsCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void dataCalculations(float skillValue) {
|
private void dataCalculations(float skillValue) {
|
||||||
|
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
|
|
||||||
serratedStrikesLength = String.valueOf(2 + ((int) skillValue / 50));
|
serratedStrikesLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||||
|
|
||||||
if (skillValue >= 750) {
|
if (skillValue >= 750) {
|
||||||
bleedLength = "3";
|
bleedLength = "3";
|
||||||
bleedChance = "75";
|
bleedChance = "75.00%";
|
||||||
counterAttackChance = "30";
|
counterAttackChance = "30.00%";
|
||||||
}
|
}
|
||||||
else if (skillValue >= 600) {
|
else if (skillValue >= 600) {
|
||||||
bleedLength = "2";
|
bleedLength = "2";
|
||||||
bleedChance = String.valueOf(skillValue / 10);
|
bleedChance = percent.format(skillValue / 1000);
|
||||||
counterAttackChance = "30";
|
counterAttackChance = "30.00%";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bleedLength = "2";
|
bleedLength = "2";
|
||||||
bleedChance = String.valueOf(skillValue / 10);
|
bleedChance = percent.format(skillValue / 1000);
|
||||||
counterAttackChance = String.valueOf(skillValue / 20);
|
counterAttackChance = percent.format(skillValue / 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void permissionsCheck(Player player) {
|
||||||
|
Permissions permInstance = Permissions.getInstance();
|
||||||
|
|
||||||
|
canBleed = permInstance.swordsBleed(player);
|
||||||
|
canCounter = permInstance.counterAttack(player);
|
||||||
|
canSerratedStrike = permInstance.serratedStrikes(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,8 +220,8 @@ Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0}
|
|||||||
Repair.Skillup=[[YELLOW]]Repair skill increased by {0}. Total ({1})
|
Repair.Skillup=[[YELLOW]]Repair skill increased by {0}. Total ({1})
|
||||||
|
|
||||||
##Arcane Forging
|
##Arcane Forging
|
||||||
Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}%
|
Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}
|
||||||
Repair.Arcane.Chance.Success=[[GRAY]]AF Success Rate: [[YELLOW]]{0}%
|
Repair.Arcane.Chance.Success=[[GRAY]]AF Success Rate: [[YELLOW]]{0}
|
||||||
Repair.Arcane.Downgrade=[[RED]]Arcane power has decreased for this item.
|
Repair.Arcane.Downgrade=[[RED]]Arcane power has decreased for this item.
|
||||||
Repair.Arcane.Fail=[[RED]]Arcane power has permanently left the item.
|
Repair.Arcane.Fail=[[RED]]Arcane power has permanently left the item.
|
||||||
Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments.
|
Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments.
|
||||||
@ -231,15 +231,14 @@ Repair.Arcane.Rank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4
|
|||||||
#SWORDS
|
#SWORDS
|
||||||
Swords.Ability.Lower=[[GRAY]]**YOU LOWER YOUR SWORD**
|
Swords.Ability.Lower=[[GRAY]]**YOU LOWER YOUR SWORD**
|
||||||
Swords.Ability.Ready=[[GREEN]]**YOU READY YOUR SWORD**
|
Swords.Ability.Ready=[[GREEN]]**YOU READY YOUR SWORD**
|
||||||
Swords.Combat.Bleed.Chance=[[RED]]Bleed Chance: [[YELLOW]]{0} %
|
Swords.Combat.Bleed.Chance=[[RED]]Bleed Chance: [[YELLOW]]{0}
|
||||||
Swords.Combat.Bleed.Length=[[RED]]Bleed Length: [[YELLOW]]{0} ticks
|
Swords.Combat.Bleed.Length=[[RED]]Bleed Length: [[YELLOW]]{0} ticks
|
||||||
Swords.Combat.Bleed.Note=[[GRAY]]NOTE: [[YELLOW]]1 Tick happens every 2 seconds
|
Swords.Combat.Bleed.Note=[[GRAY]]NOTE: [[YELLOW]]1 Tick happens every 2 seconds
|
||||||
Swords.Combat.Bleeding.Stopped=[[GRAY]]The bleeding has [[GREEN]]stopped[[GRAY]]!
|
Swords.Combat.Bleeding.Stopped=[[GRAY]]The bleeding has [[GREEN]]stopped[[GRAY]]!
|
||||||
Swords.Combat.Bleeding=[[GREEN]]**ENEMY BLEEDING**
|
Swords.Combat.Bleeding=[[GREEN]]**ENEMY BLEEDING**
|
||||||
Swords.Combat.Counter.Chance=[[RED]]Counter Attack Chance: [[YELLOW]]{0}%
|
Swords.Combat.Counter.Chance=[[RED]]Counter Attack Chance: [[YELLOW]]{0}
|
||||||
Swords.Combat.Counter.Hit=[[DARK_RED]]Hit with a counter-attack!
|
Swords.Combat.Counter.Hit=[[DARK_RED]]Hit with a counter-attack!
|
||||||
Swords.Combat.Countered=[[GREEN]]**COUNTER-ATTACKED**
|
Swords.Combat.Countered=[[GREEN]]**COUNTER-ATTACKED**
|
||||||
Swords.Combat.Parry.Chance=[[RED]]Parry Chance: [[YELLOW]]{0} %
|
|
||||||
Swords.Combat.SS.Struck=[[DARK_RED]]Struck by SERRATED STRIKES!
|
Swords.Combat.SS.Struck=[[DARK_RED]]Struck by SERRATED STRIKES!
|
||||||
Swords.Effect.0=Counter Attack
|
Swords.Effect.0=Counter Attack
|
||||||
Swords.Effect.1=Reflect 50% of damage taken
|
Swords.Effect.1=Reflect 50% of damage taken
|
||||||
|
Loading…
Reference in New Issue
Block a user