mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Perm checks for abilities display - Acrobatics.
This commit is contained in:
parent
48b3998443
commit
e650c2f534
@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcPermissions;
|
||||||
import com.gmail.nossr50.commands.CommandHelper;
|
import com.gmail.nossr50.commands.CommandHelper;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
@ -18,6 +19,10 @@ public class AcrobaticsCommand implements CommandExecutor {
|
|||||||
private String rollChance;
|
private String rollChance;
|
||||||
private String gracefulRollChance;
|
private String gracefulRollChance;
|
||||||
|
|
||||||
|
private boolean canDodge;
|
||||||
|
private boolean canRoll;
|
||||||
|
private boolean canGracefulRoll;
|
||||||
|
|
||||||
@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)) {
|
||||||
@ -33,20 +38,43 @@ public class AcrobaticsCommand implements CommandExecutor {
|
|||||||
|
|
||||||
skillValue = (float) PP.getSkillLevel(SkillType.ACROBATICS);
|
skillValue = (float) PP.getSkillLevel(SkillType.ACROBATICS);
|
||||||
dataCalculations(skillValue);
|
dataCalculations(skillValue);
|
||||||
|
permissionsCheck(player);
|
||||||
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Acrobatics.SkillName") }));
|
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Acrobatics.SkillName") }));
|
||||||
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Acrobatics") }));
|
player.sendMessage(mcLocale.getString("Commands.XPGain", new Object[] { mcLocale.getString("Commands.XPGain.Acrobatics") }));
|
||||||
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
|
player.sendMessage(mcLocale.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) }));
|
||||||
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") }));
|
if (canDodge || canGracefulRoll || canRoll) {
|
||||||
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.0"), mcLocale.getString("Acrobatics.Effect.1") }));
|
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Effects.Effects") }));
|
||||||
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.2"), mcLocale.getString("Acrobatics.Effect.3") }));
|
}
|
||||||
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.4"), mcLocale.getString("Acrobatics.Effect.5") }));
|
|
||||||
|
|
||||||
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") }));
|
if (canRoll) {
|
||||||
player.sendMessage(mcLocale.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
|
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.0"), mcLocale.getString("Acrobatics.Effect.1") }));
|
||||||
player.sendMessage(mcLocale.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
|
}
|
||||||
player.sendMessage(mcLocale.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
|
|
||||||
|
if (canGracefulRoll) {
|
||||||
|
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.2"), mcLocale.getString("Acrobatics.Effect.3") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canDodge) {
|
||||||
|
player.sendMessage(mcLocale.getString("Effects.Template", new Object[] { mcLocale.getString("Acrobatics.Effect.4"), mcLocale.getString("Acrobatics.Effect.5") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canDodge || canGracefulRoll || canRoll) {
|
||||||
|
player.sendMessage(mcLocale.getString("Skills.Header", new Object[] { mcLocale.getString("Commands.Stats.Self") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canRoll) {
|
||||||
|
player.sendMessage(mcLocale.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canGracefulRoll) {
|
||||||
|
player.sendMessage(mcLocale.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canDodge) {
|
||||||
|
player.sendMessage(mcLocale.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
|
||||||
|
}
|
||||||
|
|
||||||
Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args);
|
Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args);
|
||||||
|
|
||||||
@ -75,4 +103,11 @@ public class AcrobaticsCommand implements CommandExecutor {
|
|||||||
gracefulRollChance = String.valueOf(skillValue / 5);
|
gracefulRollChance = String.valueOf(skillValue / 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void permissionsCheck(Player player) {
|
||||||
|
mcPermissions permInstance = mcPermissions.getInstance();
|
||||||
|
canDodge = permInstance.dodge(player);
|
||||||
|
canRoll = permInstance.roll(player);
|
||||||
|
canGracefulRoll = permInstance.gracefulRoll(player);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user