From 3c748bca39e23b442860a1a86be205bcb7d34471 Mon Sep 17 00:00:00 2001 From: GJ Date: Sun, 22 Apr 2012 20:00:31 -0400 Subject: [PATCH] More updates. ALMOST DONE. --- .../nossr50/commands/party/ACommand.java | 11 ++- .../nossr50/commands/party/AcceptCommand.java | 1 - .../nossr50/commands/party/PCommand.java | 11 ++- .../commands/skills/AcrobaticsCommand.java | 78 +++++++++---------- .../nossr50/datatypes/PlayerProfile.java | 10 +-- 5 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/ACommand.java b/src/main/java/com/gmail/nossr50/commands/party/ACommand.java index 9c1b391cf..2a3d0823f 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/ACommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/ACommand.java @@ -65,9 +65,14 @@ public class ACommand implements CommandExecutor { Player player = (Player) sender; PP = Users.getProfile(player); - PP.toggleAdminChat(); - player.chat(message); - PP.toggleAdminChat(); + if (PP.getAdminChatMode()) { + player.chat(message); + } + else { + PP.toggleAdminChat(); + player.chat(message); + PP.toggleAdminChat(); + } } else { McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent("Console", message); diff --git a/src/main/java/com/gmail/nossr50/commands/party/AcceptCommand.java b/src/main/java/com/gmail/nossr50/commands/party/AcceptCommand.java index 7327128d9..8a1f53916 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/AcceptCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/AcceptCommand.java @@ -23,7 +23,6 @@ public class AcceptCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (CommandHelper.noConsoleUsage(sender)) { return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java index 211d0756f..e19a6198c 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java @@ -71,9 +71,14 @@ public class PCommand implements CommandExecutor { message = message + " " + args [i]; } - PP.togglePartyChat(); - player.chat(message); - PP.togglePartyChat(); + if (PP.getPartyChatMode()) { + player.chat(message); + } + else { + PP.togglePartyChat(); + player.chat(message); + PP.togglePartyChat(); + } } else { if (args.length < 2) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 4aab9bd05..300893186 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -14,48 +14,48 @@ import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.util.Page; public class AcrobaticsCommand implements CommandExecutor { - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (!(sender instanceof Player)) - { - sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale. - return true; - } + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (CommandHelper.noConsoleUsage(sender)) { + return true; + } if (CommandHelper.noCommandPermissions(sender, "mcmmo.skills.acrobatics")) { return true; } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + String dodgepercentage; + float skillvalue = (float) PP.getSkillLevel(SkillType.ACROBATICS); + String percentage = String.valueOf((skillvalue / 1000) * 100); + String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); + + if (PP.getSkillLevel(SkillType.ACROBATICS) <= 800) { + dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); + } + else { + dodgepercentage = "20"; + } + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAcrobatics") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAcrobatics") })); + + if (mcPermissions.getInstance().acrobatics(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics1_0"), mcLocale.getString("m.EffectsAcrobatics1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics2_0"), mcLocale.getString("m.EffectsAcrobatics2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics3_0"), mcLocale.getString("m.EffectsAcrobatics3_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.AcrobaticsRollChance", new Object[] { percentage })); + player.sendMessage(mcLocale.getString("m.AcrobaticsGracefulRollChance", new Object[] { gracepercentage })); + player.sendMessage(mcLocale.getString("m.AcrobaticsDodgeChance", new Object[] { dodgepercentage })); - Player player = (Player) sender; - PlayerProfile PP = Users.getProfile(player); - - String dodgepercentage; - float skillvalue = (float) PP.getSkillLevel(SkillType.ACROBATICS); - String percentage = String.valueOf((skillvalue / 1000) * 100); - String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2); - - if (PP.getSkillLevel(SkillType.ACROBATICS) <= 800) - dodgepercentage = String.valueOf((skillvalue / 4000 * 100)); - else - dodgepercentage = "20"; - - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAcrobatics") })); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAcrobatics") })); - - if (mcPermissions.getInstance().acrobatics(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS) })); - - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics1_0"), mcLocale.getString("m.EffectsAcrobatics1_1") })); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics2_0"), mcLocale.getString("m.EffectsAcrobatics2_1") })); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAcrobatics3_0"), mcLocale.getString("m.EffectsAcrobatics3_1") })); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); - player.sendMessage(mcLocale.getString("m.AcrobaticsRollChance", new Object[] { percentage })); - player.sendMessage(mcLocale.getString("m.AcrobaticsGracefulRollChance", new Object[] { gracepercentage })); - player.sendMessage(mcLocale.getString("m.AcrobaticsDodgeChance", new Object[] { dodgepercentage })); - - Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args); - - return true; - } + Page.grabGuidePageForSkill(SkillType.ACROBATICS, player, args); + + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index 89418d04c..7f43f8747 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -35,7 +35,7 @@ public class PlayerProfile { private boolean loaded = false; private boolean partyhud = true, spoutcraft = false, xpbarlocked = false; private boolean placedAnvil = false; - private boolean partyChatMode = false, partyChatOnly = false, adminChatMode = false; + private boolean partyChatMode = false, adminChatMode = false; private boolean godMode = false; private boolean greenTerraMode, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, skullSplitterMode, berserkMode; private boolean greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true, @@ -611,14 +611,6 @@ public class PlayerProfile { partyChatMode = !partyChatMode; } - public boolean getPartyChatOnlyToggle() { - return partyChatOnly; - } - - public void togglePartyChatOnly() { - partyChatOnly = !partyChatOnly; - } - /* * Bleed Stuff */