From faff625187700517ea85b8ead04a720cdaf0cf53 Mon Sep 17 00:00:00 2001 From: NuclearW Date: Wed, 14 Dec 2011 12:16:34 -0500 Subject: [PATCH] Move all commands into own classes Added PlayerCommandPreprocess to support aliasing functionality --- src/com/gmail/nossr50/command/Commands.java | 1647 ----------------- .../commands/general/AddxpCommand.java | 86 + .../commands/general/ClearmyspawnCommand.java | 46 + .../commands/general/MmoeditCommand.java | 83 + .../commands/general/MmoupdateCommand.java | 39 + .../commands/general/MyspawnCommand.java | 58 + .../commands/general/StatsCommand.java | 85 + .../commands/general/WhoisCommand.java | 98 + .../commands/general/XprateCommand.java | 126 ++ .../nossr50/commands/mc/McabilityCommand.java | 45 + .../gmail/nossr50/commands/mc/MccCommand.java | 73 + .../nossr50/commands/mc/McgodCommand.java | 48 + .../nossr50/commands/mc/McmmoCommand.java | 48 + .../nossr50/commands/mc/McrefreshCommand.java | 93 + .../nossr50/commands/mc/MctopCommand.java | 199 ++ .../nossr50/commands/party/ACommand.java | 86 + .../nossr50/commands/party/AcceptCommand.java | 52 + .../nossr50/commands/party/InviteCommand.java | 73 + .../nossr50/commands/party/PCommand.java | 101 + .../nossr50/commands/party/PartyCommand.java | 192 ++ .../nossr50/commands/party/PtpCommand.java | 62 + .../commands/skills/AcrobaticsCommand.java | 52 + .../commands/skills/ArcheryCommand.java | 63 + .../nossr50/commands/skills/AxesCommand.java | 62 + .../commands/skills/ExcavationCommand.java | 46 + .../commands/skills/FishingCommand.java | 47 + .../commands/skills/HerbalismCommand.java | 63 + .../commands/skills/MiningCommand.java | 48 + .../commands/skills/RepairCommand.java | 53 + .../commands/skills/SwordsCommand.java | 69 + .../commands/skills/TamingCommand.java | 70 + .../commands/skills/UnarmedCommand.java | 74 + .../commands/skills/WoodcuttingCommand.java | 56 + .../nossr50/commands/spout/MchudCommand.java | 50 + .../nossr50/commands/spout/XplockCommand.java | 62 + .../nossr50/listeners/mcPlayerListener.java | 16 +- src/com/gmail/nossr50/mcMMO.java | 113 +- 37 files changed, 2628 insertions(+), 1656 deletions(-) delete mode 100644 src/com/gmail/nossr50/command/Commands.java create mode 100644 src/com/gmail/nossr50/commands/general/AddxpCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/MmoeditCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/MmoupdateCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/MyspawnCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/StatsCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/WhoisCommand.java create mode 100644 src/com/gmail/nossr50/commands/general/XprateCommand.java create mode 100644 src/com/gmail/nossr50/commands/mc/McabilityCommand.java create mode 100644 src/com/gmail/nossr50/commands/mc/MccCommand.java create mode 100644 src/com/gmail/nossr50/commands/mc/McgodCommand.java create mode 100644 src/com/gmail/nossr50/commands/mc/McmmoCommand.java create mode 100644 src/com/gmail/nossr50/commands/mc/McrefreshCommand.java create mode 100644 src/com/gmail/nossr50/commands/mc/MctopCommand.java create mode 100644 src/com/gmail/nossr50/commands/party/ACommand.java create mode 100644 src/com/gmail/nossr50/commands/party/AcceptCommand.java create mode 100644 src/com/gmail/nossr50/commands/party/InviteCommand.java create mode 100644 src/com/gmail/nossr50/commands/party/PCommand.java create mode 100644 src/com/gmail/nossr50/commands/party/PartyCommand.java create mode 100644 src/com/gmail/nossr50/commands/party/PtpCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/ArcheryCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/AxesCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/ExcavationCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/FishingCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/HerbalismCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/MiningCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/RepairCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/SwordsCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/TamingCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/UnarmedCommand.java create mode 100644 src/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java create mode 100644 src/com/gmail/nossr50/commands/spout/MchudCommand.java create mode 100644 src/com/gmail/nossr50/commands/spout/XplockCommand.java diff --git a/src/com/gmail/nossr50/command/Commands.java b/src/com/gmail/nossr50/command/Commands.java deleted file mode 100644 index 93b02963d..000000000 --- a/src/com/gmail/nossr50/command/Commands.java +++ /dev/null @@ -1,1647 +0,0 @@ -/* - This file is part of mcMMO. - - mcMMO is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - mcMMO is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with mcMMO. If not, see . -*/ -package com.gmail.nossr50.command; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.getspout.spoutapi.player.SpoutPlayer; - -import com.gmail.nossr50.Leaderboard; -import com.gmail.nossr50.Users; -import com.gmail.nossr50.m; -import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.mcPermissions; -import com.gmail.nossr50.config.LoadProperties; -import com.gmail.nossr50.datatypes.HUDType; -import com.gmail.nossr50.datatypes.HUDmmo; -import com.gmail.nossr50.datatypes.PlayerProfile; -import com.gmail.nossr50.datatypes.SkillType; -import com.gmail.nossr50.locale.mcLocale; -import com.gmail.nossr50.party.Party; -import com.gmail.nossr50.skills.Fishing; -import com.gmail.nossr50.skills.Repair; -import com.gmail.nossr50.skills.Skills; -import com.gmail.nossr50.spout.SpoutStuff; - -public class Commands -{ - //Setup some vars - public static final Logger log = Logger.getLogger("Minecraft"); - public static boolean xpevent = false; - static int oldrate = LoadProperties.xpGainMultiplier; - - - public static boolean isPlayer(String playerName){ - for(Player herp : Bukkit.getServer().getOnlinePlayers()){ - if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){ - return true; - } - } - return false; - } - - public static Player getPlayer(String playerName){ - for(Player herp : Bukkit.getServer().getOnlinePlayers()){ - if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){ - return herp; - } - } - return null; - } - - public static boolean processCommands(CommandSender sender, Command command, String label, String[] args) - { - Player player = null; - PlayerProfile PP = null; - if(sender instanceof Player) - { - player = (Player) sender; - PP = Users.getProfile(player); - } - - String[] split = new String[args.length + 1]; - split[0] = label; - for(int a = 0; a < args.length; a++){ - split[a + 1] = args[a]; - } - - //Check if the command is an MMO related help command - if(label.equalsIgnoreCase("taming") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillTaming").toLowerCase())){ - float skillvalue = (float)PP.getSkillLevel(SkillType.TAMING); - - String percentage = String.valueOf((skillvalue / 1000) * 100); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillTaming")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainTaming")})); - if(mcPermissions.getInstance().taming(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming1_0"), mcLocale.getString("m.EffectsTaming1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming2_0"), mcLocale.getString("m.EffectsTaming2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming3_0"), mcLocale.getString("m.EffectsTaming3_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming4_0"), mcLocale.getString("m.EffectsTaming4_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming7_0"), mcLocale.getString("m.EffectsTaming7_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTaming7_2", new Object[] {LoadProperties.bonesConsumedByCOTW})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - if(PP.getSkillLevel(SkillType.TAMING) < 100) - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming1")})); - else - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming1_0"), mcLocale.getString("m.AbilBonusTaming1_1")})); - if(PP.getSkillLevel(SkillType.TAMING) < 250) - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming2")})); - else - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming2_0"), mcLocale.getString("m.AbilBonusTaming2_1")})); - if(PP.getSkillLevel(SkillType.TAMING) < 500) - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming3")})); - else - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming3_0"), mcLocale.getString("m.AbilBonusTaming3_1")})); - if(PP.getSkillLevel(SkillType.TAMING) < 750) - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming4")})); - else - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming4_0"), mcLocale.getString("m.AbilBonusTaming4_1")})); - player.sendMessage(mcLocale.getString("m.TamingGoreChance", new Object[] {percentage})); - } - else if(label.equalsIgnoreCase("woodcutting") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillWoodCutting").toLowerCase())){ - float skillvalue = (float)PP.getSkillLevel(SkillType.WOODCUTTING); - int ticks = 2; - int x = PP.getSkillLevel(SkillType.WOODCUTTING); - while(x >= 50){ - x-=50; - ticks++; - } - String percentage = String.valueOf((skillvalue / 1000) * 100); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillWoodCutting")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainWoodCutting")})); - if(mcPermissions.getInstance().woodcutting(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting1_0"), mcLocale.getString("m.EffectsWoodCutting1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting2_0"), mcLocale.getString("m.EffectsWoodCutting2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting3_0"), mcLocale.getString("m.EffectsWoodCutting3_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - if(PP.getSkillLevel(SkillType.WOODCUTTING) < 100) - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockWoodCutting1")})); - else - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusWoodCutting1_0"), mcLocale.getString("m.AbilBonusWoodCutting1_1")})); - player.sendMessage(mcLocale.getString("m.WoodCuttingDoubleDropChance", new Object[] {percentage})); - player.sendMessage(mcLocale.getString("m.WoodCuttingTreeFellerLength", new Object[] {ticks})); - } - else if(label.equalsIgnoreCase("archery") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillArchery").toLowerCase())){ - float skillvalue = (float)PP.getSkillLevel(SkillType.ARCHERY); - String percentage = String.valueOf((skillvalue / 1000) * 100); - - int ignition = 20; - if(PP.getSkillLevel(SkillType.ARCHERY) >= 200) - ignition+=20; - if(PP.getSkillLevel(SkillType.ARCHERY) >= 400) - ignition+=20; - if(PP.getSkillLevel(SkillType.ARCHERY) >= 600) - ignition+=20; - if(PP.getSkillLevel(SkillType.ARCHERY) >= 800) - ignition+=20; - if(PP.getSkillLevel(SkillType.ARCHERY) >= 1000) - ignition+=20; - - String percentagedaze; - if(PP.getSkillLevel(SkillType.ARCHERY) < 1000){ - percentagedaze = String.valueOf((skillvalue / 2000) * 100); - } else { - percentagedaze = "50"; - } - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillArchery")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainArchery")})); - if(mcPermissions.getInstance().archery(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery4_0"), mcLocale.getString("m.EffectsArchery4_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.ArcheryDazeChance", new Object[] {percentagedaze})); - player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] {percentage})); - player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] {(ignition / 20)})); - } - else if(label.equalsIgnoreCase("axes") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAxes"))){ - String percentage; - float skillvalue = (float)PP.getSkillLevel(SkillType.AXES); - if(PP.getSkillLevel(SkillType.AXES) < 750){ - percentage = String.valueOf((skillvalue / 1000) * 100); - } else { - percentage = "75"; - } - int ticks = 2; - int x = PP.getSkillLevel(SkillType.AXES); - while(x >= 50){ - x-=50; - ticks++; - } - - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillAxes")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainAxes")})); - if(mcPermissions.getInstance().axes(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes1_0"), mcLocale.getString("m.EffectsAxes1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes2_0"), mcLocale.getString("m.EffectsAxes2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes3_0"), mcLocale.getString("m.EffectsAxes3_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.AxesCritChance", new Object[] {percentage})); - if(PP.getSkillLevel(SkillType.AXES) < 500){ - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockAxes1")})); - } else { - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1")})); - } - player.sendMessage(mcLocale.getString("m.AxesSkullLength", new Object[] {ticks})); - } - else if(label.equalsIgnoreCase("swords") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillSwords").toLowerCase())){ - int bleedrank = 2; - String percentage, counterattackpercentage; - float skillvalue = (float)PP.getSkillLevel(SkillType.SWORDS); - if(PP.getSkillLevel(SkillType.SWORDS) < 750){ - percentage = String.valueOf((skillvalue / 1000) * 100); - } else { - percentage = "75"; - } - if(skillvalue >= 750) - bleedrank+=1; - - if(PP.getSkillLevel(SkillType.SWORDS) <= 600){ - counterattackpercentage = String.valueOf((skillvalue / 2000) * 100); - } else { - counterattackpercentage = "30"; - } - - int ticks = 2; - int x = PP.getSkillLevel(SkillType.SWORDS); - while(x >= 50){ - x-=50; - ticks++; - } - - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillSwords")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainSwords")})); - if(mcPermissions.getInstance().swords(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords3_0"), mcLocale.getString("m.EffectsSwords3_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords5_0"), mcLocale.getString("m.EffectsSwords5_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.SwordsCounterAttChance", new Object[] {counterattackpercentage})); - player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] {bleedrank})); - player.sendMessage(mcLocale.getString("m.SwordsTickNote")); - player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] {percentage})); - player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] {ticks})); - - } - else if(label.equalsIgnoreCase("acrobatics") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAcrobatics").toLowerCase())){ - 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})); - } - else if(label.equalsIgnoreCase("mining") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillMining"))){ - float skillvalue = (float)PP.getSkillLevel(SkillType.MINING); - String percentage = String.valueOf((skillvalue / 1000) * 100); - int ticks = 2; - int x = PP.getSkillLevel(SkillType.MINING); - while(x >= 50){ - x-=50; - ticks++; - } - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillMining")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainMining")})); - if(mcPermissions.getInstance().mining(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsMining1_0"), mcLocale.getString("m.EffectsMining1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsMining2_0"), mcLocale.getString("m.EffectsMining2_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.MiningDoubleDropChance", new Object[] {percentage})); - player.sendMessage(mcLocale.getString("m.MiningSuperBreakerLength", new Object[] {ticks})); - } - else if(label.equalsIgnoreCase("repair") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillRepair").toLowerCase())){ - float skillvalue = (float)PP.getSkillLevel(SkillType.REPAIR); - String percentage = String.valueOf((skillvalue / 1000) * 100); - String repairmastery = String.valueOf((skillvalue / 500) * 100); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillRepair")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainRepair")})); - if(mcPermissions.getInstance().repair(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair1_0"), mcLocale.getString("m.EffectsRepair1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair2_0"), mcLocale.getString("m.EffectsRepair2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair3_0"), mcLocale.getString("m.EffectsRepair3_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair4_0", new Object[]{LoadProperties.repairdiamondlevel}), mcLocale.getString("m.EffectsRepair4_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair5_0"), mcLocale.getString("m.EffectsRepair5_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] {repairmastery})); - player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] {percentage})); - player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] {Repair.getArcaneForgingRank(PP)})); - player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] {Repair.getEnchantChance(Repair.getArcaneForgingRank(PP))})); - player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] {Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP))})); - player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones")); - player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones2")); - - } - else if(label.equals("fishing")){ - //float skillvalue = (float)PP.getSkillLevel(SkillType.FISHING); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillFishing")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainFishing")})); - if(mcPermissions.getInstance().fishing(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsFishing1_0"), mcLocale.getString("m.EffectsFishing1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsFishing2_0"), mcLocale.getString("m.EffectsFishing2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsFishing3_0"), mcLocale.getString("m.EffectsFishing3_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.FishingRank", new Object[] {Fishing.getFishingLootTier(PP)})); - player.sendMessage(mcLocale.getString("m.FishingMagicInfo")); - if(PP.getSkillLevel(SkillType.FISHING) < 150) - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockFishing1")})); - else - player.sendMessage(mcLocale.getString("m.ShakeInfo", new Object[] {Fishing.getFishingLootTier(PP)})); - } - else if(label.equalsIgnoreCase("unarmed")){ - String percentage, arrowpercentage; - float skillvalue = (float)PP.getSkillLevel(SkillType.UNARMED); - - if(PP.getSkillLevel(SkillType.UNARMED) < 1000){ - percentage = String.valueOf((skillvalue / 4000) * 100); - } else { - percentage = "25"; - } - - if(PP.getSkillLevel(SkillType.UNARMED) < 1000){ - arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); - } else { - arrowpercentage = "50"; - } - - - int ticks = 2; - int x = PP.getSkillLevel(SkillType.UNARMED); - while(x >= 50){ - x-=50; - ticks++; - } - - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillUnarmed")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainUnarmed")})); - if(mcPermissions.getInstance().unarmed(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed1_0"), mcLocale.getString("m.EffectsUnarmed1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed2_0"), mcLocale.getString("m.EffectsUnarmed2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed3_0"), mcLocale.getString("m.EffectsUnarmed3_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed4_0"), mcLocale.getString("m.EffectsUnarmed4_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed5_0"), mcLocale.getString("m.EffectsUnarmed5_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.UnarmedArrowDeflectChance", new Object[] {arrowpercentage})); - player.sendMessage(mcLocale.getString("m.UnarmedDisarmChance", new Object[] {percentage})); - if(PP.getSkillLevel(SkillType.UNARMED) < 250){ - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockUnarmed1")})); - } else if(PP.getSkillLevel(SkillType.UNARMED) >= 250 && PP.getSkillLevel(SkillType.UNARMED) < 500){ - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusUnarmed1_0"), mcLocale.getString("m.AbilBonusUnarmed1_1")})); - player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockUnarmed2")})); - } else { - player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1")})); - } - player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] {ticks})); - } - else if(label.equalsIgnoreCase("herbalism") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillHerbalism").toLowerCase())){ - int bonus = 0; - if(PP.getSkillLevel(SkillType.HERBALISM) >= 200) - bonus++; - if(PP.getSkillLevel(SkillType.HERBALISM) >= 400) - bonus++; - if(PP.getSkillLevel(SkillType.HERBALISM) >= 600) - bonus++; - - int ticks = 2; - int x = PP.getSkillLevel(SkillType.HERBALISM); - while(x >= 50){ - x-=50; - ticks++; - } - - float skillvalue = (float)PP.getSkillLevel(SkillType.HERBALISM); - String percentage = String.valueOf((skillvalue / 1000) * 100); - String gpercentage = String.valueOf((skillvalue / 1500) * 100); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillHerbalism")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainHerbalism")})); - if(mcPermissions.getInstance().herbalism(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism3_0"), mcLocale.getString("m.EffectsHerbalism3_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism5_0"), mcLocale.getString("m.EffectsHerbalism5_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.HerbalismGreenTerraLength", new Object[] {ticks})); - player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbChance", new Object[] {gpercentage})); - player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbStage", new Object[] {bonus})); - player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] {percentage})); - } - - else if(label.equalsIgnoreCase("excavation") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillExcavation").toLowerCase())) - { - int ticks = 2; - int x = PP.getSkillLevel(SkillType.EXCAVATION); - while(x >= 50){ - x-=50; - ticks++; - } - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillExcavation")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainExcavation")})); - if(mcPermissions.getInstance().excavation(player)) - player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION)})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] {ticks})); - } - - else if(label.equalsIgnoreCase("sorcery") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillSorcery").toLowerCase())) - { - /* - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillExcavation")})); - player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainExcavation")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1")})); - player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1")})); - player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); - player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] {ticks})); - */ - } - - else if(LoadProperties.mcmmoEnable && label.equalsIgnoreCase(LoadProperties.mcmmo)) - { - player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"mcMMO"+ChatColor.RED+"[]-----"); - String description = mcLocale.getString("mcMMO.Description", new Object[] {LoadProperties.mcc}); - String[] mcSplit = description.split(","); - - for(String x : mcSplit) - { - player.sendMessage(x); - } - if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer) - { - SpoutPlayer sPlayer = (SpoutPlayer)player; - if(LoadProperties.donateMessage) - sPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE); - } - else - { - if(LoadProperties.donateMessage) - player.sendMessage(ChatColor.GREEN+"If you like my work you can donate via Paypal: nossr50@gmail.com"); - } - } - else if(LoadProperties.mccEnable && label.equalsIgnoreCase(LoadProperties.mcc)) - { - player.sendMessage(ChatColor.RED+"---[]"+ChatColor.YELLOW+"mcMMO Commands"+ChatColor.RED+"[]---"); - if(mcPermissions.getInstance().party(player)){ - player.sendMessage(mcLocale.getString("m.mccPartyCommands")); - player.sendMessage(LoadProperties.party+" "+mcLocale.getString("m.mccParty")); - player.sendMessage(LoadProperties.party+" q "+mcLocale.getString("m.mccPartyQ")); - if(mcPermissions.getInstance().partyChat(player)) - player.sendMessage("/p "+mcLocale.getString("m.mccPartyToggle")); - player.sendMessage(LoadProperties.invite+" "+mcLocale.getString("m.mccPartyInvite")); - player.sendMessage(LoadProperties.accept+" "+mcLocale.getString("m.mccPartyAccept")); - if(mcPermissions.getInstance().partyTeleport(player)) - player.sendMessage(LoadProperties.ptp+" "+mcLocale.getString("m.mccPartyTeleport")); - } - player.sendMessage(mcLocale.getString("m.mccOtherCommands")); - player.sendMessage(LoadProperties.stats+ChatColor.RED+" "+mcLocale.getString("m.mccStats")); - player.sendMessage("/mctop "+ChatColor.RED+mcLocale.getString("m.mccLeaderboards")); - if(mcPermissions.getInstance().mySpawn(player)){ - player.sendMessage(LoadProperties.myspawn+" "+ChatColor.RED+mcLocale.getString("m.mccMySpawn")); - player.sendMessage(LoadProperties.clearmyspawn+" "+ChatColor.RED+mcLocale.getString("m.mccClearMySpawn")); - } - if(mcPermissions.getInstance().mcAbility(player)) - player.sendMessage(LoadProperties.mcability+ChatColor.RED+" "+mcLocale.getString("m.mccToggleAbility")); - if(mcPermissions.getInstance().adminChat(player)){ - player.sendMessage("/a "+ChatColor.RED+mcLocale.getString("m.mccAdminToggle")); - } - if(mcPermissions.getInstance().whois(player)) - player.sendMessage(LoadProperties.whois+" "+mcLocale.getString("m.mccWhois")); - if(mcPermissions.getInstance().mmoedit(player)){ - //player.sendMessage(LoadProperties.mmoedit+" [skill] [newvalue] "+ChatColor.RED+"Modify the designated skill value"); - player.sendMessage(LoadProperties.mmoedit+mcLocale.getString("m.mccMmoedit")); - } - if(mcPermissions.getInstance().mcgod(player)) - player.sendMessage(LoadProperties.mcgod+ChatColor.RED+" "+mcLocale.getString("m.mccMcGod")); - player.sendMessage(mcLocale.getString("m.mccSkillInfo")); - player.sendMessage(LoadProperties.mcmmo+" "+mcLocale.getString("m.mccModDescription")); - } - else if(LoadProperties.mcabilityEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.mcability)){ - if(PP.getAbilityUse()){ - player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff")); - PP.toggleAbilityUse(); - } else { - player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn")); - PP.toggleAbilityUse(); - } - } - else if (LoadProperties.xprateEnable && label.equalsIgnoreCase(LoadProperties.xprate)) - { - if(sender instanceof Player) - { - if(!mcPermissions.getInstance().admin(player)) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length <= 1) - { - player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate})); - player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate})); - } - if(split.length == 2 && split[1].equalsIgnoreCase("reset")) - { - if(xpevent) - { - for(Player x : Bukkit.getServer().getOnlinePlayers()) - x.sendMessage(mcLocale.getString("Commands.xprate.over")); - xpevent = !xpevent; - LoadProperties.xpGainMultiplier = oldrate; - } else - { - LoadProperties.xpGainMultiplier = oldrate; - } - } - if(split.length >= 2 && m.isInt(split[1])) - { - oldrate = LoadProperties.xpGainMultiplier; - - if(split.length >= 3 && (split[2].equalsIgnoreCase("true") || split[2].equalsIgnoreCase("false"))) - { - if(split[2].equalsIgnoreCase("true")) - xpevent = true; - else - xpevent = false; - } else - { - player.sendMessage(mcLocale.getString("Commands.xprate.proper3")); - return true; - } - LoadProperties.xpGainMultiplier = m.getInt(split[1]); - if(xpevent = true) - for(Player x : Bukkit.getServer().getOnlinePlayers()) - { - x.sendMessage(mcLocale.getString("Commands.xprate.started")); - x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier})); - } - } - } else - { - if(split.length <= 1) - { - System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate})); - System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate})); - } - - if(split.length == 2 && split[1].equalsIgnoreCase("reset")) - { - if(xpevent) - { - for(Player x : Bukkit.getServer().getOnlinePlayers()) - x.sendMessage(mcLocale.getString("Commands.xprate.over")); - xpevent = !xpevent; - LoadProperties.xpGainMultiplier = oldrate; - } else - { - LoadProperties.xpGainMultiplier = oldrate; - } - } - - if(split.length >= 2 && m.isInt(split[1])) - { - oldrate = LoadProperties.xpGainMultiplier; - - if(split.length >= 3 && (split[2].equalsIgnoreCase("true") || split[2].equalsIgnoreCase("false"))) - { - if(split[2].equalsIgnoreCase("true")) - xpevent = true; - else - xpevent = false; - } else - { - System.out.println(mcLocale.getString("Commands.xprate.proper3")); - return true; - } - LoadProperties.xpGainMultiplier = m.getInt(split[1]); - if(xpevent = true) - for(Player x : Bukkit.getServer().getOnlinePlayers()) - { - x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!"); - x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!"); - } - } - } - } - /* - * FFS -> MySQL - */ - else if(label.equalsIgnoreCase("mmoupdate")) - { - if(!mcPermissions.getInstance().admin(player)) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - player.sendMessage(ChatColor.GRAY+"Starting conversion..."); - Users.clearUsers(); - m.convertToMySQL(); - for(Player x : Bukkit.getServer().getOnlinePlayers()) - { - Users.addUser(x); - } - player.sendMessage(ChatColor.GREEN+"Conversion finished!"); - } - - /* - * LEADER BOARD COMMAND - */ - else if(LoadProperties.mctopEnable && label.equalsIgnoreCase(LoadProperties.mctop)){ - - if(LoadProperties.useMySQL == false){ - /* - * POWER LEVEL INFO RETRIEVAL - */ - if(split.length == 1){ - int p = 1; - String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); - int n = 1 * p; //Position - for(String x : info){ - if(x != null){ - String digit = String.valueOf(n); - if(n < 10) - digit ="0"+String.valueOf(n); - String[] splitx = x.split(":"); - //Format: 1. Playername - skill value - player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]); - n++; - } - } - } - if(split.length >= 2 && m.isInt(split[1])){ - int p = 1; - //Grab page value if specified - if(split.length >= 2){ - if(m.isInt(split[1])){ - p = Integer.valueOf(split[1]); - } - } - int pt = p; - if(p > 1){ - pt -= 1; - pt += (pt * 10); - pt = 10; - } - String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); - int n = 1 * pt; //Position - for(String x : info){ - if(x != null){ - String digit = String.valueOf(n); - if(n < 10) - digit ="0"+String.valueOf(n); - String[] splitx = x.split(":"); - //Format: 1. Playername - skill value - player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]); - n++; - } - } - } - /* - * SKILL SPECIFIED INFO RETRIEVAL - */ - if(split.length >= 2 && Skills.isSkill(split[1])) - { - int p = 1; - //Grab page value if specified - if(split.length >= 3) - { - if(m.isInt(split[2])){ - p = Integer.valueOf(split[2]); - } - } - int pt = p; - if(p > 1){ - pt -= 1; - pt += (pt * 10); - pt = 10; - } - String firstLetter = split[1].substring(0,1); // Get first letter - String remainder = split[1].substring(1); // Get remainder of word. - String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); - - String[] info = Leaderboard.retrieveInfo(split[1].toUpperCase(), p); - player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] {capitalized})); - int n = 1 * pt; //Position - for(String x : info) - { - if(x != null) - { - String digit = String.valueOf(n); - if(n < 10) - digit ="0"+String.valueOf(n); - String[] splitx = x.split(":"); - //Format: 1. Playername - skill value - player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]); - n++; - } - } - } - } else { - /* - * MYSQL LEADERBOARDS - */ - String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing"; - if(split.length >= 2 && Skills.isSkill(split[1])){ - /* - * Create a nice consistent capitalized leaderboard name - */ - String lowercase = split[1].toLowerCase(); //For the query - String firstLetter = split[1].substring(0,1); //Get first letter - String remainder = split[1].substring(1); //Get remainder of word. - String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); - - player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] {capitalized})); - if(split.length >= 3 && m.isInt(split[2])){ - int n = 1; //For the page number - int n2 = Integer.valueOf(split[2]); - if(n2 > 1){ - //Figure out the 'page' here - n = 10; - n = n * (n2-1); - } - //If a page number is specified - HashMap> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM " - +LoadProperties.MySQLtablePrefix+"skills WHERE "+lowercase+" > 0 ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC "); - - for(int i=n;i<=n+10;i++){ - if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) - break; - HashMap> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0)); - } - return true; - } - //If no page number is specified - HashMap> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM " - +LoadProperties.MySQLtablePrefix+"skills WHERE "+lowercase+" > 0 ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC "); - for(int i=1;i<=10;i++){ //i<=userslist.size() - if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) - break; - HashMap> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0)); - } - return true; - } - if(split.length >= 1){ - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); - if(split.length >= 2 && m.isInt(split[1])){ - int n = 1; //For the page number - int n2 = Integer.valueOf(split[1]); - if(n2 > 1){ - //Figure out the 'page' here - n = 10; - n = n * (n2-1); - } - //If a page number is specified - HashMap> userslist = mcMMO.database.Read("SELECT "+powerlevel+", user_id FROM " - +LoadProperties.MySQLtablePrefix+"skills WHERE "+powerlevel+" > 0 ORDER BY "+powerlevel+" DESC "); - for(int i=n;i<=n+10;i++){ - if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) - break; - HashMap> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0)); - } - return true; - } - HashMap> userslist = mcMMO.database.Read("SELECT "+powerlevel+", user_id FROM " - +LoadProperties.MySQLtablePrefix+"skills WHERE "+powerlevel+" > 0 ORDER BY "+powerlevel+" DESC "); - for(int i=1;i<=10;i++){ - if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) - break; - HashMap> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); - player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0)); - //System.out.println(username.get(1).get(0)); - //System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1)); - } - } - } - } - - else if(LoadProperties.mcrefreshEnable && label.equalsIgnoreCase(LoadProperties.mcrefresh)){ - - if(!mcPermissions.getInstance().mcrefresh(player)){ - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length >= 2 && isPlayer(split[1])){ - player.sendMessage("You have refreshed "+split[1]+"'s cooldowns!"); - player = getPlayer(split[1]); - } - /* - * PREP MODES - */ - PP = Users.getProfile(player); - PP.setRecentlyHurt((long) 0); - PP.setHoePreparationMode(false); - PP.setAxePreparationMode(false); - PP.setFistsPreparationMode(false); - PP.setSwordsPreparationMode(false); - PP.setPickaxePreparationMode(false); - /* - * GREEN TERRA - */ - PP.setGreenTerraMode(false); - PP.setGreenTerraDeactivatedTimeStamp((long) 0); - - /* - * GIGA DRILL BREAKER - */ - PP.setGigaDrillBreakerMode(false); - PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0); - /* - * SERRATED STRIKE - */ - PP.setSerratedStrikesMode(false); - PP.setSerratedStrikesDeactivatedTimeStamp((long) 0); - /* - * SUPER BREAKER - */ - PP.setSuperBreakerMode(false); - PP.setSuperBreakerDeactivatedTimeStamp((long) 0); - /* - * TREE FELLER - */ - PP.setTreeFellerMode(false); - PP.setTreeFellerDeactivatedTimeStamp((long) 0); - /* - * BERSERK - */ - PP.setBerserkMode(false); - PP.setBerserkDeactivatedTimeStamp((long)0); - - player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed")); - } - /* - * GODMODE COMMAND - */ - else if(LoadProperties.mcgodEnable && label.equalsIgnoreCase(LoadProperties.mcgod)) - { - if(mcPermissions.permissionsEnabled) - { - if(!mcPermissions.getInstance().mcgod(player)) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(PP.getGodMode()) - { - player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled")); - PP.toggleGodMode(); - } else - { - player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled")); - PP.toggleGodMode(); - } - } - } - else if(LoadProperties.clearmyspawnEnable && LoadProperties.enableMySpawn && label.equalsIgnoreCase(LoadProperties.clearmyspawn) && mcPermissions.getInstance().mySpawn(player)) - { - double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX(); - double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY(); - double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ(); - String worldname = Bukkit.getServer().getWorlds().get(0).getName(); - PP.setMySpawn(x, y, z, worldname); - player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnCleared")); - } - else if(LoadProperties.mmoeditEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(""+LoadProperties.mmoedit)) - { - if(sender instanceof Player) - { - if(!mcPermissions.getInstance().mmoedit(player)) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length < 3) - { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); - return true; - } - if(split.length == 4) - { - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) - { - int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); - player.sendMessage(ChatColor.RED+split[2]+" has been modified."); - } - } - else if(split.length == 3) - { - if(m.isInt(split[2]) && Skills.isSkill(split[1])) - { - int newvalue = Integer.valueOf(split[2]); - PP.modifyskill(Skills.getSkillType(split[1]), newvalue); - player.sendMessage(ChatColor.RED+split[1]+" has been modified."); - } - } else - { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); - } - } else { - //If they do it wrong, inform them - if(split.length < 3) - { - System.out.println("Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); - return true; - } - else if(split.length == 4) - { - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) - { - int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue); - System.out.println(split[2]+" has been modified for "+getPlayer(split[1]).getName()+"."); - } - } - else - { - System.out.println("Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue"); - } - } - } - /* - * ADD EXPERIENCE COMMAND - */ - else if(LoadProperties.addxpEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.addxp)) - { - if(sender instanceof Player) - { - if(!mcPermissions.getInstance().mmoedit(player)){ - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length < 3){ - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); - return true; - } - if(split.length == 4){ - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) - { - int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).addXP(Skills.getSkillType(split[2]), newvalue, getPlayer(split[1])); - getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); - player.sendMessage(ChatColor.RED+split[2]+" has been modified."); - Skills.XpCheckAll(getPlayer(split[1])); - } - } - else if(split.length == 3 && m.isInt(split[2]) && Skills.isSkill(split[1])) - { - int newvalue = Integer.valueOf(split[2]); - Users.getProfile(player).addXP(Skills.getSkillType(split[1]), newvalue, player); - player.sendMessage(ChatColor.RED+split[1]+" has been modified."); - } else { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.addxp+" playername skillname xp"); - } - } else { - if(split.length < 3) - { - System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp"); - return true; - } else if(split.length == 4) - { - if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2])) - { - int newvalue = Integer.valueOf(split[3]); - Users.getProfile(getPlayer(split[1])).addXP(Skills.getSkillType(split[2]), newvalue, getPlayer(split[1])); - getPlayer(split[1]).sendMessage(ChatColor.GREEN+"Experience granted!"); - System.out.println(split[2]+" has been modified for "+getPlayer(split[1]).getName()+"."); - Skills.XpCheckAll(getPlayer(split[1])); - } - } else { - System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp"); - } - } - } - else if(LoadProperties.ptpEnable && label.equalsIgnoreCase(LoadProperties.ptp) && PP.inParty()) - { - if(!mcPermissions.getInstance().partyTeleport(player)) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(split.length < 2) - { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.ptp+" "); - return true; - } - if(!isPlayer(split[1])) - { - player.sendMessage("That is not a valid player"); - } - if(isPlayer(split[1])) - { - Player target = getPlayer(split[1]); - PlayerProfile PPt = Users.getProfile(target); - if(PP.getParty().equals(PPt.getParty())) - { - player.teleport(target); - player.sendMessage(ChatColor.GREEN+"You have teleported to "+target.getName()); - target.sendMessage(ChatColor.GREEN+player.getName() + " has teleported to you."); - } - } - } - /* - * WHOIS COMMAND - */ - else if(LoadProperties.whoisEnable && label.equalsIgnoreCase(LoadProperties.whois) && mcPermissions.getInstance().whois(player)){ - if(split.length < 2){ - player.sendMessage(ChatColor.RED + "Proper usage is /"+LoadProperties.whois+" "); - return true; - } - //if split[1] is a player - if(isPlayer(split[1])) - { - Player target = getPlayer(split[1]); - PlayerProfile PPt = Users.getProfile(target); - - player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~"); - player.sendMessage(target.getName()); - if(PPt.inParty()) - player.sendMessage("Party: "+PPt.getParty()); - player.sendMessage("Health: "+target.getHealth()+ChatColor.GRAY+" (20 is full health)"); - player.sendMessage("OP: " + target.isOp()); - player.sendMessage(ChatColor.GREEN+"mcMMO Stats for "+ChatColor.YELLOW+target.getName()); - - player.sendMessage(ChatColor.GOLD+"-=GATHERING SKILLS=-"); - if(mcPermissions.getInstance().excavation(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION))); - if(mcPermissions.getInstance().fishing(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING))); - if(mcPermissions.getInstance().herbalism(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM))); - if(mcPermissions.getInstance().mining(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING))); - if(mcPermissions.getInstance().woodcutting(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING))); - - player.sendMessage(ChatColor.GOLD+"-=COMBAT SKILLS=-"); - if(mcPermissions.getInstance().axes(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES))); - if(mcPermissions.getInstance().archery(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY))); - //if(mcPermissions.getInstance().sorcery(target)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PPt.getSkill("sorcery"), PPt.getSkill("sorceryXP"), PPt.getXpToLevel("excavation"))); - if(mcPermissions.getInstance().swords(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS))); - if(mcPermissions.getInstance().taming(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING))); - if(mcPermissions.getInstance().unarmed(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED))); - - player.sendMessage(ChatColor.GOLD+"-=MISC SKILLS=-"); - if(mcPermissions.getInstance().acrobatics(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); - //if(mcPermissions.getInstance().alchemy(target)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PPt.getSkillLevel(SkillType.ALCHEMY), PPt.getSkillXpLevel(SkillType.ALCHEMY), PPt.getXpToLevel(SkillType.ALCHEMY))); - //if(mcPermissions.getInstance().enchanting(target)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PPt.getSkillLevel(SkillType.ENCHANTING), PPt.getSkillXpLevel(SkillType.ENCHANTING), PPt.getXpToLevel(SkillType.ENCHANTING))); - if(mcPermissions.getInstance().repair(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); - - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") +ChatColor.GREEN+(m.getPowerLevel(target))); - } - } - /* - * STATS COMMAND - */ - else if(LoadProperties.statsEnable && label.equalsIgnoreCase(LoadProperties.stats)) - { - - player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats")); - - if(mcPermissions.getEnabled()) - player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote")); - - ChatColor header = ChatColor.GOLD; - - if(Skills.hasGatheringSkills(player)){ - player.sendMessage(header+"-=GATHERING SKILLS=-"); - if(mcPermissions.getInstance().excavation(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION))); - if(mcPermissions.getInstance().fishing(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING))); - if(mcPermissions.getInstance().herbalism(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM))); - if(mcPermissions.getInstance().mining(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING))); - if(mcPermissions.getInstance().woodcutting(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING))); - } - if(Skills.hasCombatSkills(player)){ - player.sendMessage(header+"-=COMBAT SKILLS=-"); - if(mcPermissions.getInstance().axes(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES))); - if(mcPermissions.getInstance().archery(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY))); - //if(mcPermissions.getInstance().sorcery(player)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PP.getSkill("sorcery"), PP.getSkill("sorceryXP"), PP.getXpToLevel("excavation"))); - if(mcPermissions.getInstance().swords(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS))); - if(mcPermissions.getInstance().taming(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING))); - if(mcPermissions.getInstance().unarmed(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED))); - } - - if(Skills.hasMiscSkills(player)){ - player.sendMessage(header+"-=MISC SKILLS=-"); - if(mcPermissions.getInstance().acrobatics(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS))); - //if(mcPermissions.getInstance().alchemy(player)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PP.getSkillLevel(SkillType.ALCHEMY), PP.getSkillXpLevel(SkillType.ALCHEMY), PP.getXpToLevel(SkillType.ALCHEMY))); - //if(mcPermissions.getInstance().enchanting(player)) - //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PP.getSkillLevel(SkillType.ENCHANTING), PP.getSkillXpLevel(SkillType.ENCHANTING), PP.getXpToLevel(SkillType.ENCHANTING))); - if(mcPermissions.getInstance().repair(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR))); - } - player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel")+ChatColor.GREEN+(m.getPowerLevel(player))); - } - //Invite Command - else if(LoadProperties.inviteEnable && label.equalsIgnoreCase(LoadProperties.invite) && mcPermissions.getInstance().party(player)){ - - Party Pinstance = Party.getInstance(); - - if(!PP.inParty()) - { - player.sendMessage(mcLocale.getString("mcPlayerListener.NotInParty")); - return true; - } - if(split.length < 2) - { - player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.invite+" "); - return true; - } - if(PP.inParty() && split.length >= 2 && isPlayer(split[1])) - { - if(Pinstance.canInvite(player, PP)) { - Player target = getPlayer(split[1]); - PlayerProfile PPt = Users.getProfile(target); - PPt.modifyInvite(PP.getParty()); - - - player.sendMessage(mcLocale.getString("mcPlayerListener.InviteSuccess")); - //target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName()); - target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] {PPt.getInvite(), player.getName()})); - //target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+LoadProperties.accept+ChatColor.YELLOW+" to accept the invite"); - target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] {LoadProperties.accept})); - } else { - player.sendMessage(mcLocale.getString("Party.Locked")); - return true; - } - } - } - //Accept invite - else if(LoadProperties.acceptEnable && label.equalsIgnoreCase(LoadProperties.accept) && mcPermissions.getInstance().party(player)) - { - if(PP.hasPartyInvite()) - { - Party Pinstance = Party.getInstance(); - - if(PP.inParty()) - { - Pinstance.removeFromParty(player, PP); - } - PP.acceptInvite(); - Pinstance.addToParty(player, PP, PP.getParty(), true); - - } else - { - player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites")); - } - } - //Party command - else if(LoadProperties.partyEnable && label.equalsIgnoreCase(LoadProperties.party)) - { - if(!mcPermissions.getInstance().party(player)) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - - Party Pinstance = Party.getInstance(); - - if(PP.inParty() && (!Pinstance.isParty(PP.getParty()) || !Pinstance.isInParty(player, PP))) - { - Pinstance.addToParty(player, PP, PP.getParty(), false); - } - - if(args.length == 0 && !PP.inParty()) - { - player.sendMessage(mcLocale.getString("Party.Help1", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help2", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help3", new Object[] {LoadProperties.party})); - return true; - } else if(args.length == 0 && PP.inParty()) - { - String tempList = ""; - int x = 0; - for(Player p : Bukkit.getServer().getOnlinePlayers()) - { - if(PP.getParty().equals(Users.getProfile(p).getParty())) - { - if(p != null && x+1 >= Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) - { - if(Pinstance.isPartyLeader(p.getName(), PP.getParty())) - { - tempList+=ChatColor.GOLD+p.getName(); - x++; - } - else - { - tempList+= ChatColor.WHITE+p.getName(); - x++; - } - } - if(p != null && x < Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) - { - if(Pinstance.isPartyLeader(p.getName(), PP.getParty())) - { - tempList+=ChatColor.GOLD+p.getName()+", "; - x++; - } - else - { - tempList+= ChatColor.WHITE+p.getName()+", "; - x++; - } - } - } - } - player.sendMessage(mcLocale.getString("mcPlayerListener.YouAreInParty", new Object[] {PP.getParty()})); - player.sendMessage(mcLocale.getString("mcPlayerListener.PartyMembers")+" ("+tempList+ChatColor.GREEN+")"); - return true; - } else if(args.length == 1) - { - if(args[0].equals("q") && PP.inParty()) - { - Pinstance.removeFromParty(player, PP); - - player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); - return true; - } else if (args[0].equalsIgnoreCase("?")) { - player.sendMessage(mcLocale.getString("Party.Help4", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help2", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help5", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help6", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help7", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help8", new Object[] {LoadProperties.party})); - player.sendMessage(mcLocale.getString("Party.Help9", new Object[] {LoadProperties.party})); - } else if (args[0].equalsIgnoreCase("lock")) - { - if(PP.inParty()) - { - if(Pinstance.isPartyLeader(player.getName(), PP.getParty())) - { - Pinstance.lockParty(PP.getParty()); - player.sendMessage(mcLocale.getString("Party.Locked")); - } else - { - player.sendMessage(mcLocale.getString("Party.NotOwner")); - } - } else - { - player.sendMessage(mcLocale.getString("Party.InvalidName")); - } - } else if (args[0].equalsIgnoreCase("unlock")) - { - if(PP.inParty()) - { - if(Pinstance.isPartyLeader(player.getName(), PP.getParty())) - { - Pinstance.unlockParty(PP.getParty()); - player.sendMessage(mcLocale.getString("Party.Unlocked")); - } else - { - player.sendMessage(mcLocale.getString("Party.NotOwner")); - } - } else - { - player.sendMessage(mcLocale.getString("Party.InvalidName")); - } - //Party debugging command. - //} else if (args[0].equalsIgnoreCase("dump")) { - // Pinstance.dump(player); - } else - { - if(PP.inParty()) - { - Pinstance.removeFromParty(player, PP); - } - Pinstance.addToParty(player, PP, args[0], false); - return true; - } - } else if(args.length == 2 && PP.inParty()) - { - if(args[0].equalsIgnoreCase("password")) - { - if(Pinstance.isPartyLeader(player.getName(), PP.getParty())) - { - if(Pinstance.isPartyLocked(PP.getParty())) - { - Pinstance.setPartyPassword(PP.getParty(), args[1]); - player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] {args[1]})); - } else - { - player.sendMessage(mcLocale.getString("Party.IsntLocked")); - } - } else - { - player.sendMessage(mcLocale.getString("Party.NotOwner")); - } - } else if(args[0].equalsIgnoreCase("kick")) - { - if(Pinstance.isPartyLeader(player.getName(), PP.getParty())) - { - if(Pinstance.isPartyLocked(PP.getParty())) - { - Player tPlayer = null; - if(Bukkit.getServer().getPlayer(args[1]) != null) tPlayer = Bukkit.getServer().getPlayer(args[1]); - if(tPlayer == null) - { - player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] {args[1]})); - } - if(!Pinstance.inSameParty(player, tPlayer)) - { - player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] {tPlayer.getName()})); - } else - { - //Not an admin - if(!mcPermissions.getInstance().admin(player)) - { - //Can't kick an admin - if(mcPermissions.getInstance().admin(tPlayer)) - { - player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] {tPlayer.getName()})); - } - } - PlayerProfile tPP = Users.getProfile(tPlayer); - - Pinstance.removeFromParty(tPlayer, tPP); - - tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); - } - } else { - player.sendMessage(mcLocale.getString("Party.IsntLocked")); - } - } else { - player.sendMessage(mcLocale.getString("Party.NotOwner")); - } - } else if(args[0].equalsIgnoreCase("owner")) - { - if(Pinstance.isPartyLeader(player.getName(), PP.getParty())) - { - Player tPlayer = null; - if(Bukkit.getServer().getPlayer(args[1]) != null) tPlayer = Bukkit.getServer().getPlayer(args[1]); - if(tPlayer == null) - { - player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] {args[1]})); - } - if(!Pinstance.inSameParty(player, tPlayer)) - { - player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] {tPlayer.getName()})); - } else - { - Pinstance.setPartyLeader(PP.getParty(), tPlayer.getName()); - } - } else - { - player.sendMessage(mcLocale.getString("Party.NotOwner")); - } - } else - { - Pinstance.removeFromParty(player, PP); - Pinstance.addToParty(player, PP, args[0], false, args[1]); - } - } else if(args.length == 2 && !PP.inParty()) - { - Pinstance.addToParty(player, PP, args[0], false, args[1]); - } - } - else if(LoadProperties.partyEnable && label.equalsIgnoreCase("p")){ - - // Console message? - if(!(sender instanceof Player)) - { - if(args.length < 2) return true; - String pMessage = args[1]; - for (int i = 2; i <= args.length - 1; i++) { - pMessage = pMessage + " " + args[i]; - } - - String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE - + "*Console*" + ChatColor.GREEN + ") "; - - log.log(Level.INFO, - "[P](" + args[0] + ")" + "<*Console*> " - + pMessage); - - for(Player herp : Bukkit.getServer().getOnlinePlayers()) { - if(Users.getProfile(herp).inParty()) { - if(Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) { - herp.sendMessage(pPrefix + pMessage); - } - } - } - return true; - } - - if(!mcPermissions.getInstance().party(player)){ - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - - // Not a toggle, a message - - if (args.length >= 1) { - String pMessage = args[0]; - for (int i = 1; i <= args.length - 1; i++) { - pMessage = pMessage + " " + args[i]; - } - String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE - + player.getDisplayName() + ChatColor.GREEN + ") "; - - log.log(Level.INFO, - "[P](" + PP.getParty() + ")" + "<" + player.getDisplayName() - + "> " + pMessage); - - for (Player herp : Bukkit.getServer().getOnlinePlayers()) { - if (Users.getProfile(herp).inParty()) { - if (Party.getInstance().inSameParty(herp, player)) - herp.sendMessage(pPrefix + pMessage); - } - } - - return true; - } - - if(PP.getAdminChatMode()) - PP.toggleAdminChat(); - - PP.togglePartyChat(); - - if(PP.getPartyChatMode()){ - //player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On"); - player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOn")); - } else { - //player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off"); - player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOff")); - } - } - - else if(label.equalsIgnoreCase("a")){ - // Console message? - if(!(sender instanceof Player) && args.length >= 1) - { - String aMessage = args[0]; - for (int i = 1; i <= args.length - 1; i++) { - aMessage = aMessage + " " + args[i]; - } - - String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE - + "*Console*" + ChatColor.AQUA + "} "; - - log.log(Level.INFO, "[A]<*Console*> " - + aMessage); - - for (Player herp : Bukkit.getServer().getOnlinePlayers()) { - if (mcPermissions.getInstance().adminChat(herp) || herp.isOp()) - herp.sendMessage(aPrefix + aMessage); - } - return true; - } - - if(!mcPermissions.getInstance().adminChat(player) && !player.isOp()) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - - // Not a toggle, a message - - if (args.length >= 1) { - String aMessage = args[0]; - for (int i = 1; i <= args.length - 1; i++) { - aMessage = aMessage + " " + args[i]; - } - - String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE - + player.getDisplayName() + ChatColor.AQUA + "} "; - log.log(Level.INFO, "[A]<" + player.getDisplayName() + "> " - + aMessage); - for (Player herp : Bukkit.getServer().getOnlinePlayers()) { - if (mcPermissions.getInstance().adminChat(herp) || herp.isOp()) - herp.sendMessage(aPrefix + aMessage); - } - return true; - } - - if(PP.getPartyChatMode()) - PP.togglePartyChat(); - - PP.toggleAdminChat(); - - if(PP.getAdminChatMode()) - { - player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn")); - //player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On"); - } else { - player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff")); - //player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off"); - } - } - - /* - * MYSPAWN - */ - else if(LoadProperties.myspawnEnable && LoadProperties.enableMySpawn && label.equalsIgnoreCase(LoadProperties.myspawn)) - { - if(!mcPermissions.getInstance().mySpawn(player)){ - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - if(System.currentTimeMillis() < (PP.getMySpawnATS()*1000) + 3600000){ - long x = (((PP.getMySpawnATS()*1000) + 3600000) - System.currentTimeMillis()); - int y = (int) (x/60000); - int z = (int) ((x/1000) - (y*60)); - player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnTimeNotice", new Object[] {y, z})); - return true; - } - PP.setMySpawnATS(System.currentTimeMillis()); - if(PP.getMySpawn(player) != null) - { - Location mySpawn = PP.getMySpawn(player); - - if(mySpawn != null){ - //It's done twice because it acts oddly when you are in another world - player.teleport(mySpawn); - player.teleport(mySpawn); - } - } else { - player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnNotExist")); - } - } - else if(LoadProperties.spoutEnabled && LoadProperties.xpbar && LoadProperties.xplockEnable && label.equalsIgnoreCase(LoadProperties.xplock)) - { - if(split.length >= 2 && Skills.isSkill(split[1]) && mcPermissions.permission(player, "mcmmo.skills."+Skills.getSkillType(split[1]).toString().toLowerCase())) - { - if(PP.getXpBarLocked()) - { - PP.setSkillLock(Skills.getSkillType(split[1])); - player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] {m.getCapitalized(PP.getSkillLock().toString())})); - } - else - { - PP.setSkillLock(Skills.getSkillType(split[1])); - PP.toggleXpBarLocked(); - player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] {m.getCapitalized(PP.getSkillLock().toString())})); - } - SpoutStuff.updateXpBar(player); - } else if (split.length < 2) - { - if(PP.getXpBarLocked()) - { - PP.toggleXpBarLocked(); - player.sendMessage(mcLocale.getString("Commands.xplock.unlocked")); - } else if(PP.getLastGained() != null) - { - PP.toggleXpBarLocked(); - PP.setSkillLock(PP.getLastGained()); - player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] {m.getCapitalized(PP.getSkillLock().toString())})); - } - } - else if (split.length >= 2 && !Skills.isSkill(split[1])) - { - player.sendMessage("Commands.xplock.invalid"); - } - else if(split.length >= 2 && Skills.isSkill(split[1]) && !mcPermissions.permission(player, "mcmmo.skills."+Skills.getSkillType(split[1]).toString().toLowerCase())) - { - player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); - return true; - } - } - else if (LoadProperties.spoutEnabled && label.equalsIgnoreCase("mchud")) - { - if(split.length >= 2) - { - for(HUDType x : HUDType.values()) - { - if(x.toString().toLowerCase().equals(split[1].toLowerCase())) - { - if(SpoutStuff.playerHUDs.containsKey(player)) - { - SpoutStuff.playerHUDs.get(player).resetHUD(); - SpoutStuff.playerHUDs.remove(player); - PP.setHUDType(x); - SpoutStuff.playerHUDs.put(player, new HUDmmo(player)); - } - } - } - } - } - return true; - } -} diff --git a/src/com/gmail/nossr50/commands/general/AddxpCommand.java b/src/com/gmail/nossr50/commands/general/AddxpCommand.java new file mode 100644 index 000000000..07be75230 --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/AddxpCommand.java @@ -0,0 +1,86 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; + +public class AddxpCommand implements CommandExecutor { + private final mcMMO plugin; + + public AddxpCommand(mcMMO instance) { + this.plugin = instance; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!mcPermissions.permissionsEnabled) { + sender.sendMessage("This command requires permissions."); + return true; + } + + if (!LoadProperties.addxpEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + if (args.length < 2) { + // No console aliasing yet + // System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp"); + System.out.println("Usage is /addxp playername skillname xp"); + return true; + } else if (args.length == 3) { + if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { + int newvalue = Integer.valueOf(args[2]); + Users.getProfile(plugin.getServer().getPlayer(args[0])).addXP(Skills.getSkillType(args[1]), newvalue, plugin.getServer().getPlayer(args[0])); + plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!"); + System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + "."); + Skills.XpCheckAll(plugin.getServer().getPlayer(args[0])); + } + } else { + // No console aliasing yet + // System.out.println("Usage is /"+LoadProperties.addxp+" playername skillname xp"); + System.out.println("Usage is /addxp playername skillname xp"); + } + return true; + } + + Player player = (Player) sender; + + if (!mcPermissions.getInstance().mmoedit(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if (args.length < 2) { + player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.addxp + " playername skillname xp"); + return true; + } + if (args.length == 3) { + if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { + int newvalue = Integer.valueOf(args[2]); + Users.getProfile(plugin.getServer().getPlayer(args[0])).addXP(Skills.getSkillType(args[1]), newvalue, plugin.getServer().getPlayer(args[0])); + plugin.getServer().getPlayer(args[0]).sendMessage(ChatColor.GREEN + "Experience granted!"); + player.sendMessage(ChatColor.RED + args[1] + " has been modified."); + Skills.XpCheckAll(plugin.getServer().getPlayer(args[0])); + } + } else if (args.length == 2 && m.isInt(args[1]) && Skills.isSkill(args[0])) { + int newvalue = Integer.valueOf(args[1]); + Users.getProfile(player).addXP(Skills.getSkillType(args[0]), newvalue, player); + player.sendMessage(ChatColor.RED + args[0] + " has been modified."); + } else { + player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.addxp + " playername skillname xp"); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java b/src/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java new file mode 100644 index 000000000..49739c2f9 --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/ClearmyspawnCommand.java @@ -0,0 +1,46 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class ClearmyspawnCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.clearmyspawnEnable || !LoadProperties.enableMySpawn) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().mySpawn(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX(); + double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY(); + double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ(); + String worldname = Bukkit.getServer().getWorlds().get(0).getName(); + PP.setMySpawn(x, y, z, worldname); + player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnCleared")); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/MmoeditCommand.java b/src/com/gmail/nossr50/commands/general/MmoeditCommand.java new file mode 100644 index 000000000..de8abca25 --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/MmoeditCommand.java @@ -0,0 +1,83 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; + +public class MmoeditCommand implements CommandExecutor { + private final mcMMO plugin; + + public MmoeditCommand(mcMMO instance) { + this.plugin = instance; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!mcPermissions.permissionsEnabled) { + sender.sendMessage("This command requires permissions."); + return true; + } + + if (!LoadProperties.mmoeditEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + if (args.length < 2) { + System.out.println("Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + return true; + } else if (args.length == 3) { + if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { + int newvalue = Integer.valueOf(args[2]); + Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue); + System.out.println(args[1] + " has been modified for " + plugin.getServer().getPlayer(args[0]).getName() + "."); + } + } else { + System.out.println("Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + } + + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().mmoedit(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if (args.length < 2) { + player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + return true; + } + if (args.length == 3) { + if ((plugin.getServer().getPlayer(args[0]) != null) && m.isInt(args[2]) && Skills.isSkill(args[1])) { + int newvalue = Integer.valueOf(args[2]); + Users.getProfile(plugin.getServer().getPlayer(args[0])).modifyskill(Skills.getSkillType(args[1]), newvalue); + player.sendMessage(ChatColor.RED + args[1] + " has been modified."); + } + } else if (args.length == 2) { + if (m.isInt(args[1]) && Skills.isSkill(args[0])) { + int newvalue = Integer.valueOf(args[1]); + PP.modifyskill(Skills.getSkillType(args[0]), newvalue); + player.sendMessage(ChatColor.RED + args[0] + " has been modified."); + } + } else { + player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.mmoedit + " playername skillname newvalue"); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/MmoupdateCommand.java b/src/com/gmail/nossr50/commands/general/MmoupdateCommand.java new file mode 100644 index 000000000..ee92648e6 --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/MmoupdateCommand.java @@ -0,0 +1,39 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.locale.mcLocale; + +public class MmoupdateCommand 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."); + return true; + } + + Player player = (Player) sender; + + if (!mcPermissions.getInstance().admin(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + player.sendMessage(ChatColor.GRAY + "Starting conversion..."); + Users.clearUsers(); + m.convertToMySQL(); + for (Player x : Bukkit.getServer().getOnlinePlayers()) { + Users.addUser(x); + } + player.sendMessage(ChatColor.GREEN + "Conversion finished!"); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/MyspawnCommand.java b/src/com/gmail/nossr50/commands/general/MyspawnCommand.java new file mode 100644 index 000000000..6142e2fb1 --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/MyspawnCommand.java @@ -0,0 +1,58 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class MyspawnCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.myspawnEnable || !LoadProperties.enableMySpawn) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().mySpawn(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if (System.currentTimeMillis() < (PP.getMySpawnATS() * 1000) + 3600000) { + long x = (((PP.getMySpawnATS() * 1000) + 3600000) - System.currentTimeMillis()); + int y = (int) (x / 60000); + int z = (int) ((x / 1000) - (y * 60)); + player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnTimeNotice", new Object[] { y, z })); + return true; + } + PP.setMySpawnATS(System.currentTimeMillis()); + if (PP.getMySpawn(player) != null) { + Location mySpawn = PP.getMySpawn(player); + + if (mySpawn != null) { + // It's done twice because it acts oddly when you are in another world + player.teleport(mySpawn); + player.teleport(mySpawn); + } + } else { + player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnNotExist")); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/StatsCommand.java b/src/com/gmail/nossr50/commands/general/StatsCommand.java new file mode 100644 index 000000000..65b1f7e9e --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/StatsCommand.java @@ -0,0 +1,85 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; + +public class StatsCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.statsEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats")); + + if (mcPermissions.getEnabled()) + player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote")); + + ChatColor header = ChatColor.GOLD; + + if (Skills.hasGatheringSkills(player)) { + player.sendMessage(header + "-=GATHERING SKILLS=-"); + if (mcPermissions.getInstance().excavation(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION))); + if (mcPermissions.getInstance().fishing(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING))); + if (mcPermissions.getInstance().herbalism(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM))); + if (mcPermissions.getInstance().mining(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING))); + if (mcPermissions.getInstance().woodcutting(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING))); + } + if (Skills.hasCombatSkills(player)) { + player.sendMessage(header + "-=COMBAT SKILLS=-"); + if (mcPermissions.getInstance().axes(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES))); + if (mcPermissions.getInstance().archery(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY))); + // if(mcPermissions.getInstance().sorcery(player)) + // player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PP.getSkill("sorcery"), PP.getSkill("sorceryXP"), PP.getXpToLevel("excavation"))); + if (mcPermissions.getInstance().swords(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS))); + if (mcPermissions.getInstance().taming(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING))); + if (mcPermissions.getInstance().unarmed(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED))); + } + + if (Skills.hasMiscSkills(player)) { + player.sendMessage(header + "-=MISC SKILLS=-"); + if (mcPermissions.getInstance().acrobatics(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS))); + // if(mcPermissions.getInstance().alchemy(player)) + // player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PP.getSkillLevel(SkillType.ALCHEMY), PP.getSkillXpLevel(SkillType.ALCHEMY), PP.getXpToLevel(SkillType.ALCHEMY))); + // if(mcPermissions.getInstance().enchanting(player)) + // player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PP.getSkillLevel(SkillType.ENCHANTING), PP.getSkillXpLevel(SkillType.ENCHANTING), PP.getXpToLevel(SkillType.ENCHANTING))); + if (mcPermissions.getInstance().repair(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR))); + } + player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(player))); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/WhoisCommand.java b/src/com/gmail/nossr50/commands/general/WhoisCommand.java new file mode 100644 index 000000000..854125a60 --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/WhoisCommand.java @@ -0,0 +1,98 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; + +public class WhoisCommand implements CommandExecutor { + private final mcMMO plugin; + + public WhoisCommand(mcMMO instance) { + this.plugin = instance; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.whoisEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + Player player = (Player) sender; + + if (!mcPermissions.getInstance().whois(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + if (args.length < 1) { + player.sendMessage(ChatColor.RED + "Proper usage is /" + LoadProperties.whois + " "); + return true; + } + // if split[1] is a player + if (plugin.getServer().getPlayer(args[0]) != null) { + Player target = plugin.getServer().getPlayer(args[0]); + PlayerProfile PPt = Users.getProfile(target); + + player.sendMessage(ChatColor.GREEN + "~~WHOIS RESULTS~~"); + player.sendMessage(target.getName()); + if (PPt.inParty()) + player.sendMessage("Party: " + PPt.getParty()); + player.sendMessage("Health: " + target.getHealth() + ChatColor.GRAY + " (20 is full health)"); + player.sendMessage("OP: " + target.isOp()); + player.sendMessage(ChatColor.GREEN + "mcMMO Stats for " + ChatColor.YELLOW + target.getName()); + + player.sendMessage(ChatColor.GOLD + "-=GATHERING SKILLS=-"); + if (mcPermissions.getInstance().excavation(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ExcavationSkill"), PPt.getSkillLevel(SkillType.EXCAVATION), PPt.getSkillXpLevel(SkillType.EXCAVATION), PPt.getXpToLevel(SkillType.EXCAVATION))); + if (mcPermissions.getInstance().fishing(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.FishingSkill"), PPt.getSkillLevel(SkillType.FISHING), PPt.getSkillXpLevel(SkillType.FISHING), PPt.getXpToLevel(SkillType.FISHING))); + if (mcPermissions.getInstance().herbalism(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.HerbalismSkill"), PPt.getSkillLevel(SkillType.HERBALISM), PPt.getSkillXpLevel(SkillType.HERBALISM), PPt.getXpToLevel(SkillType.HERBALISM))); + if (mcPermissions.getInstance().mining(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.MiningSkill"), PPt.getSkillLevel(SkillType.MINING), PPt.getSkillXpLevel(SkillType.MINING), PPt.getXpToLevel(SkillType.MINING))); + if (mcPermissions.getInstance().woodcutting(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.WoodcuttingSkill"), PPt.getSkillLevel(SkillType.WOODCUTTING), PPt.getSkillXpLevel(SkillType.WOODCUTTING), PPt.getXpToLevel(SkillType.WOODCUTTING))); + + player.sendMessage(ChatColor.GOLD + "-=COMBAT SKILLS=-"); + if (mcPermissions.getInstance().axes(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AxesSkill"), PPt.getSkillLevel(SkillType.AXES), PPt.getSkillXpLevel(SkillType.AXES), PPt.getXpToLevel(SkillType.AXES))); + if (mcPermissions.getInstance().archery(player)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.ArcherySkill"), PPt.getSkillLevel(SkillType.ARCHERY), PPt.getSkillXpLevel(SkillType.ARCHERY), PPt.getXpToLevel(SkillType.ARCHERY))); + // if(mcPermissions.getInstance().sorcery(target)) + // player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SorcerySkill"), PPt.getSkill("sorcery"), PPt.getSkill("sorceryXP"), PPt.getXpToLevel("excavation"))); + if (mcPermissions.getInstance().swords(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.SwordsSkill"), PPt.getSkillLevel(SkillType.SWORDS), PPt.getSkillXpLevel(SkillType.SWORDS), PPt.getXpToLevel(SkillType.SWORDS))); + if (mcPermissions.getInstance().taming(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.TamingSkill"), PPt.getSkillLevel(SkillType.TAMING), PPt.getSkillXpLevel(SkillType.TAMING), PPt.getXpToLevel(SkillType.TAMING))); + if (mcPermissions.getInstance().unarmed(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.UnarmedSkill"), PPt.getSkillLevel(SkillType.UNARMED), PPt.getSkillXpLevel(SkillType.UNARMED), PPt.getXpToLevel(SkillType.UNARMED))); + + player.sendMessage(ChatColor.GOLD + "-=MISC SKILLS=-"); + if (mcPermissions.getInstance().acrobatics(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); + // if(mcPermissions.getInstance().alchemy(target)) + // player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PPt.getSkillLevel(SkillType.ALCHEMY), PPt.getSkillXpLevel(SkillType.ALCHEMY), PPt.getXpToLevel(SkillType.ALCHEMY))); + // if(mcPermissions.getInstance().enchanting(target)) + // player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PPt.getSkillLevel(SkillType.ENCHANTING), PPt.getSkillXpLevel(SkillType.ENCHANTING), PPt.getXpToLevel(SkillType.ENCHANTING))); + if (mcPermissions.getInstance().repair(target)) + player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); + + player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevel") + ChatColor.GREEN + (m.getPowerLevel(target))); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/general/XprateCommand.java b/src/com/gmail/nossr50/commands/general/XprateCommand.java new file mode 100644 index 000000000..000576d7e --- /dev/null +++ b/src/com/gmail/nossr50/commands/general/XprateCommand.java @@ -0,0 +1,126 @@ +package com.gmail.nossr50.commands.general; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.locale.mcLocale; + +public class XprateCommand implements CommandExecutor { + private static int oldrate = LoadProperties.xpGainMultiplier; + + public static boolean xpevent = false; + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.xprateEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + if(args.length <= 0) + { + System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate})); + System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate})); + } + + if(args.length == 1 && args[0].equalsIgnoreCase("reset")) + { + if(xpevent) + { + for(Player x : Bukkit.getServer().getOnlinePlayers()) + x.sendMessage(mcLocale.getString("Commands.xprate.over")); + xpevent = !xpevent; + LoadProperties.xpGainMultiplier = oldrate; + } else + { + LoadProperties.xpGainMultiplier = oldrate; + } + } + + if(args.length >= 1 && m.isInt(args[0])) + { + oldrate = LoadProperties.xpGainMultiplier; + + if(args.length >= 2 && (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false"))) + { + if(args[1].equalsIgnoreCase("true")) + xpevent = true; + else + xpevent = false; + } else + { + System.out.println(mcLocale.getString("Commands.xprate.proper3")); + return true; + } + LoadProperties.xpGainMultiplier = m.getInt(args[0]); + if(xpevent = true) + for(Player x : Bukkit.getServer().getOnlinePlayers()) + { + x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!"); + x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!"); + } + } + + return true; + } + + Player player = (Player) sender; + + if(!mcPermissions.getInstance().admin(player)) + { + player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if(args.length <= 0) + { + player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate})); + player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate})); + } + if(args.length == 1 && args[0].equalsIgnoreCase("reset")) + { + if(xpevent) + { + for(Player x : Bukkit.getServer().getOnlinePlayers()) + x.sendMessage(mcLocale.getString("Commands.xprate.over")); + xpevent = !xpevent; + LoadProperties.xpGainMultiplier = oldrate; + } else + { + LoadProperties.xpGainMultiplier = oldrate; + } + } + if(args.length >= 1 && m.isInt(args[0])) + { + oldrate = LoadProperties.xpGainMultiplier; + + if(args.length >= 2 && (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false"))) + { + if(args[1].equalsIgnoreCase("true")) + xpevent = true; + else + xpevent = false; + } else + { + player.sendMessage(mcLocale.getString("Commands.xprate.proper3")); + return true; + } + LoadProperties.xpGainMultiplier = m.getInt(args[0]); + if(xpevent = true) + for(Player x : Bukkit.getServer().getOnlinePlayers()) + { + x.sendMessage(mcLocale.getString("Commands.xprate.started")); + x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier})); + } + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/mc/McabilityCommand.java b/src/com/gmail/nossr50/commands/mc/McabilityCommand.java new file mode 100644 index 000000000..f4acc72a2 --- /dev/null +++ b/src/com/gmail/nossr50/commands/mc/McabilityCommand.java @@ -0,0 +1,45 @@ +package com.gmail.nossr50.commands.mc; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class McabilityCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!mcPermissions.permissionsEnabled) { + sender.sendMessage("This command requires permissions."); + return true; + } + + if (!LoadProperties.mcabilityEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (PP.getAbilityUse()) { + player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff")); + PP.toggleAbilityUse(); + } else { + player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn")); + PP.toggleAbilityUse(); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/mc/MccCommand.java b/src/com/gmail/nossr50/commands/mc/MccCommand.java new file mode 100644 index 000000000..6fa895720 --- /dev/null +++ b/src/com/gmail/nossr50/commands/mc/MccCommand.java @@ -0,0 +1,73 @@ +package com.gmail.nossr50.commands.mc; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.locale.mcLocale; + +public class MccCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.mccEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + + player.sendMessage(ChatColor.RED + "---[]" + ChatColor.YELLOW + "mcMMO Commands" + ChatColor.RED + "[]---"); + + if (mcPermissions.getInstance().party(player)) { + player.sendMessage(mcLocale.getString("m.mccPartyCommands")); + player.sendMessage(LoadProperties.party + " " + mcLocale.getString("m.mccParty")); + player.sendMessage(LoadProperties.party + " q " + mcLocale.getString("m.mccPartyQ")); + + if (mcPermissions.getInstance().partyChat(player)) + player.sendMessage("/p " + mcLocale.getString("m.mccPartyToggle")); + + player.sendMessage(LoadProperties.invite + " " + mcLocale.getString("m.mccPartyInvite")); + player.sendMessage(LoadProperties.accept + " " + mcLocale.getString("m.mccPartyAccept")); + + if (mcPermissions.getInstance().partyTeleport(player)) + player.sendMessage(LoadProperties.ptp + " " + mcLocale.getString("m.mccPartyTeleport")); + } + player.sendMessage(mcLocale.getString("m.mccOtherCommands")); + player.sendMessage(LoadProperties.stats + ChatColor.RED + " " + mcLocale.getString("m.mccStats")); + player.sendMessage("/mctop " + ChatColor.RED + mcLocale.getString("m.mccLeaderboards")); + + if (mcPermissions.getInstance().mySpawn(player)) { + player.sendMessage(LoadProperties.myspawn + " " + ChatColor.RED + mcLocale.getString("m.mccMySpawn")); + player.sendMessage(LoadProperties.clearmyspawn + " " + ChatColor.RED + mcLocale.getString("m.mccClearMySpawn")); + } + + if (mcPermissions.getInstance().mcAbility(player)) + player.sendMessage(LoadProperties.mcability + ChatColor.RED + " " + mcLocale.getString("m.mccToggleAbility")); + + if (mcPermissions.getInstance().adminChat(player)) + player.sendMessage("/a " + ChatColor.RED + mcLocale.getString("m.mccAdminToggle")); + + if (mcPermissions.getInstance().whois(player)) + player.sendMessage(LoadProperties.whois + " " + mcLocale.getString("m.mccWhois")); + + if (mcPermissions.getInstance().mmoedit(player)) + player.sendMessage(LoadProperties.mmoedit + mcLocale.getString("m.mccMmoedit")); + + if (mcPermissions.getInstance().mcgod(player)) + player.sendMessage(LoadProperties.mcgod + ChatColor.RED + " " + mcLocale.getString("m.mccMcGod")); + + player.sendMessage(mcLocale.getString("m.mccSkillInfo")); + player.sendMessage(LoadProperties.mcmmo + " " + mcLocale.getString("m.mccModDescription")); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/mc/McgodCommand.java b/src/com/gmail/nossr50/commands/mc/McgodCommand.java new file mode 100644 index 000000000..116fef919 --- /dev/null +++ b/src/com/gmail/nossr50/commands/mc/McgodCommand.java @@ -0,0 +1,48 @@ +package com.gmail.nossr50.commands.mc; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class McgodCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.mcgodEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (mcPermissions.permissionsEnabled) { + if (!mcPermissions.getInstance().mcgod(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + if (PP.getGodMode()) { + player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled")); + PP.toggleGodMode(); + } else { + player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled")); + PP.toggleGodMode(); + } + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/mc/McmmoCommand.java b/src/com/gmail/nossr50/commands/mc/McmmoCommand.java new file mode 100644 index 000000000..0888ebac4 --- /dev/null +++ b/src/com/gmail/nossr50/commands/mc/McmmoCommand.java @@ -0,0 +1,48 @@ +package com.gmail.nossr50.commands.mc; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.getspout.spoutapi.player.SpoutPlayer; + +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.locale.mcLocale; + +public class McmmoCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.mcmmoEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + + player.sendMessage(ChatColor.RED + "-----[]" + ChatColor.GREEN + "mcMMO" + ChatColor.RED + "[]-----"); + String description = mcLocale.getString("mcMMO.Description", new Object[] { LoadProperties.mcc }); + String[] mcSplit = description.split(","); + + for (String x : mcSplit) { + player.sendMessage(x); + } + + if (LoadProperties.spoutEnabled && player instanceof SpoutPlayer) { + SpoutPlayer sPlayer = (SpoutPlayer) player; + if (LoadProperties.donateMessage) + sPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE); + } else { + if (LoadProperties.donateMessage) + player.sendMessage(ChatColor.GREEN + "If you like my work you can donate via Paypal: nossr50@gmail.com"); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/mc/McrefreshCommand.java b/src/com/gmail/nossr50/commands/mc/McrefreshCommand.java new file mode 100644 index 000000000..41fa78077 --- /dev/null +++ b/src/com/gmail/nossr50/commands/mc/McrefreshCommand.java @@ -0,0 +1,93 @@ +package com.gmail.nossr50.commands.mc; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class McrefreshCommand implements CommandExecutor { + private final mcMMO plugin; + + public McrefreshCommand(mcMMO instance) { + this.plugin = instance; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.mcrefreshEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().mcrefresh(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if (args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) { + player.sendMessage("You have refreshed " + args[0] + "'s cooldowns!"); + player = plugin.getServer().getPlayer(args[0]); + } + + /* + * PREP MODES + */ + PP = Users.getProfile(player); + PP.setRecentlyHurt((long) 0); + PP.setHoePreparationMode(false); + PP.setAxePreparationMode(false); + PP.setFistsPreparationMode(false); + PP.setSwordsPreparationMode(false); + PP.setPickaxePreparationMode(false); + /* + * GREEN TERRA + */ + PP.setGreenTerraMode(false); + PP.setGreenTerraDeactivatedTimeStamp((long) 0); + + /* + * GIGA DRILL BREAKER + */ + PP.setGigaDrillBreakerMode(false); + PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0); + /* + * SERRATED STRIKE + */ + PP.setSerratedStrikesMode(false); + PP.setSerratedStrikesDeactivatedTimeStamp((long) 0); + /* + * SUPER BREAKER + */ + PP.setSuperBreakerMode(false); + PP.setSuperBreakerDeactivatedTimeStamp((long) 0); + /* + * TREE FELLER + */ + PP.setTreeFellerMode(false); + PP.setTreeFellerDeactivatedTimeStamp((long) 0); + /* + * BERSERK + */ + PP.setBerserkMode(false); + PP.setBerserkDeactivatedTimeStamp((long) 0); + + player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed")); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/mc/MctopCommand.java b/src/com/gmail/nossr50/commands/mc/MctopCommand.java new file mode 100644 index 000000000..5b6b30292 --- /dev/null +++ b/src/com/gmail/nossr50/commands/mc/MctopCommand.java @@ -0,0 +1,199 @@ +package com.gmail.nossr50.commands.mc; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Leaderboard; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; + +public class MctopCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.mctopEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + + if (LoadProperties.useMySQL == false) { + /* + * POWER LEVEL INFO RETRIEVAL + */ + if (args.length == 0) { + int p = 1; + String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); + player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); + int n = 1 * p; // Position + for (String x : info) { + if (x != null) { + String digit = String.valueOf(n); + if (n < 10) + digit = "0" + String.valueOf(n); + String[] splitx = x.split(":"); + // Format: 1. Playername - skill value + player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); + n++; + } + } + } + if (args.length >= 1 && m.isInt(args[0])) { + int p = 1; + // Grab page value if specified + if (args.length >= 1) { + if (m.isInt(args[0])) { + p = Integer.valueOf(args[0]); + } + } + int pt = p; + if (p > 1) { + pt -= 1; + pt += (pt * 10); + pt = 10; + } + String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p); + player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); + int n = 1 * pt; // Position + for (String x : info) { + if (x != null) { + String digit = String.valueOf(n); + if (n < 10) + digit = "0" + String.valueOf(n); + String[] splitx = x.split(":"); + // Format: 1. Playername - skill value + player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); + n++; + } + } + } + /* + * SKILL SPECIFIED INFO RETRIEVAL + */ + if (args.length >= 1 && Skills.isSkill(args[0])) { + int p = 1; + // Grab page value if specified + if (args.length >= 2) { + if (m.isInt(args[1])) { + p = Integer.valueOf(args[1]); + } + } + int pt = p; + if (p > 1) { + pt -= 1; + pt += (pt * 10); + pt = 10; + } + String firstLetter = args[0].substring(0, 1); // Get first letter + String remainder = args[0].substring(1); // Get remainder of word. + String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); + + String[] info = Leaderboard.retrieveInfo(args[0].toUpperCase(), p); + player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized })); + int n = 1 * pt; // Position + for (String x : info) { + if (x != null) { + String digit = String.valueOf(n); + if (n < 10) + digit = "0" + String.valueOf(n); + String[] splitx = x.split(":"); + // Format: 1. Playername - skill value + player.sendMessage(digit + ". " + ChatColor.GREEN + splitx[1] + " - " + ChatColor.WHITE + splitx[0]); + n++; + } + } + } + } else { + /* + * MYSQL LEADERBOARDS + */ + String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing"; + if (args.length >= 1 && Skills.isSkill(args[0])) { + /* + * Create a nice consistent capitalized leaderboard name + */ + String lowercase = args[0].toLowerCase(); // For the query + String firstLetter = args[0].substring(0, 1); // Get first letter + String remainder = args[0].substring(1); // Get remainder of word. + String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase(); + + player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] { capitalized })); + if (args.length >= 2 && m.isInt(args[1])) { + int n = 1; // For the page number + int n2 = Integer.valueOf(args[1]); + if (n2 > 1) { + // Figure out the 'page' here + n = 10; + n = n * (n2 - 1); + } + // If a page number is specified + HashMap> userslist = mcMMO.database.Read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC "); + + for (int i = n; i <= n + 10; i++) { + if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) + break; + HashMap> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); + player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + } + return true; + } + // If no page number is specified + HashMap> userslist = mcMMO.database.Read("SELECT " + lowercase + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + lowercase + " > 0 ORDER BY `" + LoadProperties.MySQLtablePrefix + "skills`.`" + lowercase + "` DESC "); + for (int i = 1; i <= 10; i++) { // i<=userslist.size() + if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) + break; + HashMap> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); + player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + } + return true; + } + if (args.length >= 0) { + player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard")); + if (args.length >= 1 && m.isInt(args[0])) { + int n = 1; // For the page number + int n2 = Integer.valueOf(args[0]); + if (n2 > 1) { + // Figure out the 'page' here + n = 10; + n = n * (n2 - 1); + } + // If a page number is specified + HashMap> userslist = mcMMO.database.Read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC "); + for (int i = n; i <= n + 10; i++) { + if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) + break; + HashMap> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); + player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + } + return true; + } + HashMap> userslist = mcMMO.database.Read("SELECT " + powerlevel + ", user_id FROM " + LoadProperties.MySQLtablePrefix + "skills WHERE " + powerlevel + " > 0 ORDER BY " + powerlevel + " DESC "); + for (int i = 1; i <= 10; i++) { + if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null) + break; + HashMap> username = mcMMO.database.Read("SELECT user FROM " + LoadProperties.MySQLtablePrefix + "users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'"); + player.sendMessage(String.valueOf(i) + ". " + ChatColor.GREEN + userslist.get(i).get(0) + " - " + ChatColor.WHITE + username.get(1).get(0)); + // System.out.println(username.get(1).get(0)); + // System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1)); + } + } + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/party/ACommand.java b/src/com/gmail/nossr50/commands/party/ACommand.java new file mode 100644 index 000000000..25f1f7bd6 --- /dev/null +++ b/src/com/gmail/nossr50/commands/party/ACommand.java @@ -0,0 +1,86 @@ +package com.gmail.nossr50.commands.party; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class ACommand implements CommandExecutor { + private Logger log; + + public ACommand() { + this.log = Logger.getLogger("Minecraft"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + + // Console message? + if (!(sender instanceof Player) && args.length >= 1) { + String aMessage = args[0]; + for (int i = 1; i <= args.length - 1; i++) { + aMessage = aMessage + " " + args[i]; + } + + String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + "*Console*" + ChatColor.AQUA + "} "; + + log.log(Level.INFO, "[A]<*Console*> " + aMessage); + + for (Player herp : Bukkit.getServer().getOnlinePlayers()) { + if (mcPermissions.getInstance().adminChat(herp) || herp.isOp()) + herp.sendMessage(aPrefix + aMessage); + } + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().adminChat(player) && !player.isOp()) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + // Not a toggle, a message + + if (args.length >= 1) { + String aMessage = args[0]; + for (int i = 1; i <= args.length - 1; i++) { + aMessage = aMessage + " " + args[i]; + } + + String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + player.getDisplayName() + ChatColor.AQUA + "} "; + log.log(Level.INFO, "[A]<" + player.getDisplayName() + "> " + aMessage); + for (Player herp : Bukkit.getServer().getOnlinePlayers()) { + if (mcPermissions.getInstance().adminChat(herp) || herp.isOp()) + herp.sendMessage(aPrefix + aMessage); + } + return true; + } + + if (PP.getPartyChatMode()) + PP.togglePartyChat(); + + PP.toggleAdminChat(); + + if (PP.getAdminChatMode()) { + player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOn")); + // player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.GREEN + "On"); + } else { + player.sendMessage(mcLocale.getString("mcPlayerListener.AdminChatOff")); + // player.sendMessage(ChatColor.AQUA + "Admin chat toggled " + ChatColor.RED + "Off"); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/party/AcceptCommand.java b/src/com/gmail/nossr50/commands/party/AcceptCommand.java new file mode 100644 index 000000000..1cc73d060 --- /dev/null +++ b/src/com/gmail/nossr50/commands/party/AcceptCommand.java @@ -0,0 +1,52 @@ +package com.gmail.nossr50.commands.party; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.party.Party; + +public class AcceptCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.acceptEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().party(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + if (PP.hasPartyInvite()) { + Party Pinstance = Party.getInstance(); + + if (PP.inParty()) { + Pinstance.removeFromParty(player, PP); + } + PP.acceptInvite(); + Pinstance.addToParty(player, PP, PP.getParty(), true); + + } else { + player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites")); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/party/InviteCommand.java b/src/com/gmail/nossr50/commands/party/InviteCommand.java new file mode 100644 index 000000000..c432ce247 --- /dev/null +++ b/src/com/gmail/nossr50/commands/party/InviteCommand.java @@ -0,0 +1,73 @@ +package com.gmail.nossr50.commands.party; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.party.Party; + +public class InviteCommand implements CommandExecutor { + private final mcMMO plugin; + + public InviteCommand(mcMMO instance) { + this.plugin = instance; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.inviteEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().party(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + Party Pinstance = Party.getInstance(); + + if (!PP.inParty()) { + player.sendMessage(mcLocale.getString("mcPlayerListener.NotInParty")); + return true; + } + if (args.length < 1) { + player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.invite + " "); + return true; + } + if (PP.inParty() && args.length >= 1 && (plugin.getServer().getPlayer(args[0]) != null)) { + if (Pinstance.canInvite(player, PP)) { + Player target = plugin.getServer().getPlayer(args[0]); + PlayerProfile PPt = Users.getProfile(target); + PPt.modifyInvite(PP.getParty()); + + player.sendMessage(mcLocale.getString("mcPlayerListener.InviteSuccess")); + // target.sendMessage(ChatColor.RED+"ALERT: "+ChatColor.GREEN+"You have received a party invite for "+PPt.getInvite()+" from "+player.getName()); + target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite1", new Object[] { PPt.getInvite(), player.getName() })); + // target.sendMessage(ChatColor.YELLOW+"Type "+ChatColor.GREEN+LoadProperties.accept+ChatColor.YELLOW+" to accept the invite"); + target.sendMessage(mcLocale.getString("mcPlayerListener.ReceivedInvite2", new Object[] { LoadProperties.accept })); + } else { + player.sendMessage(mcLocale.getString("Party.Locked")); + return true; + } + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/party/PCommand.java b/src/com/gmail/nossr50/commands/party/PCommand.java new file mode 100644 index 000000000..e4dd624d2 --- /dev/null +++ b/src/com/gmail/nossr50/commands/party/PCommand.java @@ -0,0 +1,101 @@ +package com.gmail.nossr50.commands.party; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.party.Party; + +public class PCommand implements CommandExecutor { + private Logger log; + + public PCommand() { + this.log = Logger.getLogger("Minecraft"); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.partyEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + // Console message? + if (!(sender instanceof Player)) { + if (args.length < 2) + return true; + String pMessage = args[1]; + for (int i = 2; i <= args.length - 1; i++) { + pMessage = pMessage + " " + args[i]; + } + + String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + "*Console*" + ChatColor.GREEN + ") "; + + log.log(Level.INFO, "[P](" + args[0] + ")" + "<*Console*> " + pMessage); + + for (Player herp : Bukkit.getServer().getOnlinePlayers()) { + if (Users.getProfile(herp).inParty()) { + if (Users.getProfile(herp).getParty().equalsIgnoreCase(args[0])) { + herp.sendMessage(pPrefix + pMessage); + } + } + } + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().party(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + // Not a toggle, a message + + if (args.length >= 1) { + String pMessage = args[0]; + for (int i = 1; i <= args.length - 1; i++) { + pMessage = pMessage + " " + args[i]; + } + String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + player.getDisplayName() + ChatColor.GREEN + ") "; + + log.log(Level.INFO, "[P](" + PP.getParty() + ")" + "<" + player.getDisplayName() + "> " + pMessage); + + for (Player herp : Bukkit.getServer().getOnlinePlayers()) { + if (Users.getProfile(herp).inParty()) { + if (Party.getInstance().inSameParty(herp, player)) + herp.sendMessage(pPrefix + pMessage); + } + } + + return true; + } + + if (PP.getAdminChatMode()) + PP.toggleAdminChat(); + + PP.togglePartyChat(); + + if (PP.getPartyChatMode()) { + // player.sendMessage(ChatColor.GREEN + "Party Chat Toggled On"); + player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOn")); + } else { + // player.sendMessage(ChatColor.GREEN + "Party Chat Toggled " + ChatColor.RED + "Off"); + player.sendMessage(mcLocale.getString("mcPlayerListener.PartyChatOff")); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/party/PartyCommand.java b/src/com/gmail/nossr50/commands/party/PartyCommand.java new file mode 100644 index 000000000..2972b630f --- /dev/null +++ b/src/com/gmail/nossr50/commands/party/PartyCommand.java @@ -0,0 +1,192 @@ +package com.gmail.nossr50.commands.party; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.party.Party; + +public class PartyCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.partyEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().party(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + Party Pinstance = Party.getInstance(); + + if (PP.inParty() && (!Pinstance.isParty(PP.getParty()) || !Pinstance.isInParty(player, PP))) { + Pinstance.addToParty(player, PP, PP.getParty(), false); + } + + if (args.length == 0 && !PP.inParty()) { + player.sendMessage(mcLocale.getString("Party.Help1", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help3", new Object[] { LoadProperties.party })); + return true; + } else if (args.length == 0 && PP.inParty()) { + String tempList = ""; + int x = 0; + for (Player p : Bukkit.getServer().getOnlinePlayers()) { + if (PP.getParty().equals(Users.getProfile(p).getParty())) { + if (p != null && x + 1 >= Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) { + if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) { + tempList += ChatColor.GOLD + p.getName(); + x++; + } else { + tempList += ChatColor.WHITE + p.getName(); + x++; + } + } + if (p != null && x < Pinstance.partyCount(player, Bukkit.getServer().getOnlinePlayers())) { + if (Pinstance.isPartyLeader(p.getName(), PP.getParty())) { + tempList += ChatColor.GOLD + p.getName() + ", "; + x++; + } else { + tempList += ChatColor.WHITE + p.getName() + ", "; + x++; + } + } + } + } + player.sendMessage(mcLocale.getString("mcPlayerListener.YouAreInParty", new Object[] { PP.getParty() })); + player.sendMessage(mcLocale.getString("mcPlayerListener.PartyMembers") + " (" + tempList + ChatColor.GREEN + ")"); + return true; + } else if (args.length == 1) { + if (args[0].equals("q") && PP.inParty()) { + Pinstance.removeFromParty(player, PP); + + player.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); + return true; + } else if (args[0].equalsIgnoreCase("?")) { + player.sendMessage(mcLocale.getString("Party.Help4", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help2", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help5", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help6", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help7", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help8", new Object[] { LoadProperties.party })); + player.sendMessage(mcLocale.getString("Party.Help9", new Object[] { LoadProperties.party })); + } else if (args[0].equalsIgnoreCase("lock")) { + if (PP.inParty()) { + if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { + Pinstance.lockParty(PP.getParty()); + player.sendMessage(mcLocale.getString("Party.Locked")); + } else { + player.sendMessage(mcLocale.getString("Party.NotOwner")); + } + } else { + player.sendMessage(mcLocale.getString("Party.InvalidName")); + } + } else if (args[0].equalsIgnoreCase("unlock")) { + if (PP.inParty()) { + if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { + Pinstance.unlockParty(PP.getParty()); + player.sendMessage(mcLocale.getString("Party.Unlocked")); + } else { + player.sendMessage(mcLocale.getString("Party.NotOwner")); + } + } else { + player.sendMessage(mcLocale.getString("Party.InvalidName")); + } + // Party debugging command. + // } else if (args[0].equalsIgnoreCase("dump")) { + // Pinstance.dump(player); + } else { + if (PP.inParty()) { + Pinstance.removeFromParty(player, PP); + } + Pinstance.addToParty(player, PP, args[0], false); + return true; + } + } else if (args.length == 2 && PP.inParty()) { + if (args[0].equalsIgnoreCase("password")) { + if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { + if (Pinstance.isPartyLocked(PP.getParty())) { + Pinstance.setPartyPassword(PP.getParty(), args[1]); + player.sendMessage(mcLocale.getString("Party.PasswordSet", new Object[] { args[1] })); + } else { + player.sendMessage(mcLocale.getString("Party.IsntLocked")); + } + } else { + player.sendMessage(mcLocale.getString("Party.NotOwner")); + } + } else if (args[0].equalsIgnoreCase("kick")) { + if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { + if (Pinstance.isPartyLocked(PP.getParty())) { + Player tPlayer = null; + if (Bukkit.getServer().getPlayer(args[1]) != null) + tPlayer = Bukkit.getServer().getPlayer(args[1]); + if (tPlayer == null) { + player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { args[1] })); + } + if (!Pinstance.inSameParty(player, tPlayer)) { + player.sendMessage(mcLocale.getString("Party.NotInYourParty", new Object[] { tPlayer.getName() })); + } else { + // Not an admin + if (!mcPermissions.getInstance().admin(player)) { + // Can't kick an admin + if (mcPermissions.getInstance().admin(tPlayer)) { + player.sendMessage(mcLocale.getString("Party.CouldNotKick", new Object[] { tPlayer.getName() })); + } + } + PlayerProfile tPP = Users.getProfile(tPlayer); + + Pinstance.removeFromParty(tPlayer, tPP); + + tPlayer.sendMessage(mcLocale.getString("mcPlayerListener.LeftParty")); + } + } else { + player.sendMessage(mcLocale.getString("Party.IsntLocked")); + } + } else { + player.sendMessage(mcLocale.getString("Party.NotOwner")); + } + } else if (args[0].equalsIgnoreCase("owner")) { + if (Pinstance.isPartyLeader(player.getName(), PP.getParty())) { + Player tPlayer = null; + if (Bukkit.getServer().getPlayer(args[1]) != null) + tPlayer = Bukkit.getServer().getPlayer(args[1]); + if (tPlayer == null) { + player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { args[1] })); + } + if (!Pinstance.inSameParty(player, tPlayer)) { + player.sendMessage(mcLocale.getString("Party.CouldNotSetOwner", new Object[] { tPlayer.getName() })); + } else { + Pinstance.setPartyLeader(PP.getParty(), tPlayer.getName()); + } + } else { + player.sendMessage(mcLocale.getString("Party.NotOwner")); + } + } else { + Pinstance.removeFromParty(player, PP); + Pinstance.addToParty(player, PP, args[0], false, args[1]); + } + } else if (args.length == 2 && !PP.inParty()) { + Pinstance.addToParty(player, PP, args[0], false, args[1]); + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/party/PtpCommand.java b/src/com/gmail/nossr50/commands/party/PtpCommand.java new file mode 100644 index 000000000..5a2d47c80 --- /dev/null +++ b/src/com/gmail/nossr50/commands/party/PtpCommand.java @@ -0,0 +1,62 @@ +package com.gmail.nossr50.commands.party; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; + +public class PtpCommand implements CommandExecutor { + private final mcMMO plugin; + + public PtpCommand(mcMMO instance) { + this.plugin = instance; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.ptpEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (!mcPermissions.getInstance().partyTeleport(player)) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + if (args.length < 1) { + player.sendMessage(ChatColor.RED + "Usage is /" + LoadProperties.ptp + " "); + return true; + } + if (plugin.getServer().getPlayer(args[0]) == null) { + player.sendMessage("That is not a valid player"); + } + + if (plugin.getServer().getPlayer(args[0]) != null) { + Player target = plugin.getServer().getPlayer(args[0]); + PlayerProfile PPt = Users.getProfile(target); + if (PP.getParty().equals(PPt.getParty())) { + player.teleport(target); + player.sendMessage(ChatColor.GREEN + "You have teleported to " + target.getName()); + target.sendMessage(ChatColor.GREEN + player.getName() + " has teleported to you."); + } + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java new file mode 100644 index 000000000..c22c19e59 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -0,0 +1,52 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +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."); + 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 })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/com/gmail/nossr50/commands/skills/ArcheryCommand.java new file mode 100644 index 000000000..a2a34c644 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -0,0 +1,63 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class ArcheryCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + float skillvalue = (float) PP.getSkillLevel(SkillType.ARCHERY); + String percentage = String.valueOf((skillvalue / 1000) * 100); + + int ignition = 20; + if (PP.getSkillLevel(SkillType.ARCHERY) >= 200) + ignition += 20; + if (PP.getSkillLevel(SkillType.ARCHERY) >= 400) + ignition += 20; + if (PP.getSkillLevel(SkillType.ARCHERY) >= 600) + ignition += 20; + if (PP.getSkillLevel(SkillType.ARCHERY) >= 800) + ignition += 20; + if (PP.getSkillLevel(SkillType.ARCHERY) >= 1000) + ignition += 20; + + String percentagedaze; + if (PP.getSkillLevel(SkillType.ARCHERY) < 1000) + percentagedaze = String.valueOf((skillvalue / 2000) * 100); + else + percentagedaze = "50"; + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillArchery") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainArchery") })); + + if (mcPermissions.getInstance().archery(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsArchery4_0"), mcLocale.getString("m.EffectsArchery4_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.ArcheryDazeChance", new Object[] { percentagedaze })); + player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] { percentage })); + player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] { (ignition / 20) })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/com/gmail/nossr50/commands/skills/AxesCommand.java new file mode 100644 index 000000000..1b14df8f9 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -0,0 +1,62 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class AxesCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + String percentage; + + float skillvalue = (float) PP.getSkillLevel(SkillType.AXES); + if (PP.getSkillLevel(SkillType.AXES) < 750) + percentage = String.valueOf((skillvalue / 1000) * 100); + else + percentage = "75"; + + int ticks = 2; + int x = PP.getSkillLevel(SkillType.AXES); + while (x >= 50) { + x -= 50; + ticks++; + } + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillAxes") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainAxes") })); + + if (mcPermissions.getInstance().axes(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes1_0"), mcLocale.getString("m.EffectsAxes1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes2_0"), mcLocale.getString("m.EffectsAxes2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsAxes3_0"), mcLocale.getString("m.EffectsAxes3_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.AxesCritChance", new Object[] { percentage })); + + if (PP.getSkillLevel(SkillType.AXES) < 500) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockAxes1") })); + else + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1") })); + + player.sendMessage(mcLocale.getString("m.AxesSkullLength", new Object[] { ticks })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/ExcavationCommand.java b/src/com/gmail/nossr50/commands/skills/ExcavationCommand.java new file mode 100644 index 000000000..14e424db0 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/ExcavationCommand.java @@ -0,0 +1,46 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class ExcavationCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + int ticks = 2; + int x = PP.getSkillLevel(SkillType.EXCAVATION); + while (x >= 50) { + x -= 50; + ticks++; + } + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillExcavation") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainExcavation") })); + + if (mcPermissions.getInstance().excavation(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] { ticks })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/com/gmail/nossr50/commands/skills/FishingCommand.java new file mode 100644 index 000000000..9d920300c --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -0,0 +1,47 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Fishing; + +public class FishingCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillFishing") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainFishing") })); + + if (mcPermissions.getInstance().fishing(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing1_0"), mcLocale.getString("m.EffectsFishing1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing2_0"), mcLocale.getString("m.EffectsFishing2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsFishing3_0"), mcLocale.getString("m.EffectsFishing3_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.FishingRank", new Object[] { Fishing.getFishingLootTier(PP) })); + player.sendMessage(mcLocale.getString("m.FishingMagicInfo")); + + if (PP.getSkillLevel(SkillType.FISHING) < 150) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockFishing1") })); + else + player.sendMessage(mcLocale.getString("m.ShakeInfo", new Object[] { Fishing.getFishingLootTier(PP) })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/com/gmail/nossr50/commands/skills/HerbalismCommand.java new file mode 100644 index 000000000..d43d7c2a9 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -0,0 +1,63 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class HerbalismCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + int bonus = 0; + if (PP.getSkillLevel(SkillType.HERBALISM) >= 200) + bonus++; + if (PP.getSkillLevel(SkillType.HERBALISM) >= 400) + bonus++; + if (PP.getSkillLevel(SkillType.HERBALISM) >= 600) + bonus++; + + int ticks = 2; + int x = PP.getSkillLevel(SkillType.HERBALISM); + while (x >= 50) { + x -= 50; + ticks++; + } + + float skillvalue = (float) PP.getSkillLevel(SkillType.HERBALISM); + + String percentage = String.valueOf((skillvalue / 1000) * 100); + String gpercentage = String.valueOf((skillvalue / 1500) * 100); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillHerbalism") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainHerbalism") })); + + if (mcPermissions.getInstance().herbalism(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism3_0"), mcLocale.getString("m.EffectsHerbalism3_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsHerbalism5_0"), mcLocale.getString("m.EffectsHerbalism5_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.HerbalismGreenTerraLength", new Object[] { ticks })); + player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbChance", new Object[] { gpercentage })); + player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbStage", new Object[] { bonus })); + player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] { percentage })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/com/gmail/nossr50/commands/skills/MiningCommand.java new file mode 100644 index 000000000..9256eb047 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -0,0 +1,48 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class MiningCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + float skillvalue = (float) PP.getSkillLevel(SkillType.MINING); + String percentage = String.valueOf((skillvalue / 1000) * 100); + int ticks = 2; + int x = PP.getSkillLevel(SkillType.MINING); + while (x >= 50) { + x -= 50; + ticks++; + } + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillMining") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainMining") })); + + if (mcPermissions.getInstance().mining(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining1_0"), mcLocale.getString("m.EffectsMining1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsMining2_0"), mcLocale.getString("m.EffectsMining2_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.MiningDoubleDropChance", new Object[] { percentage })); + player.sendMessage(mcLocale.getString("m.MiningSuperBreakerLength", new Object[] { ticks })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/com/gmail/nossr50/commands/skills/RepairCommand.java new file mode 100644 index 000000000..fad3291fd --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -0,0 +1,53 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Repair; + +public class RepairCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + float skillvalue = (float) PP.getSkillLevel(SkillType.REPAIR); + String percentage = String.valueOf((skillvalue / 1000) * 100); + String repairmastery = String.valueOf((skillvalue / 500) * 100); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillRepair") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainRepair") })); + + if (mcPermissions.getInstance().repair(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair1_0"), mcLocale.getString("m.EffectsRepair1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair2_0"), mcLocale.getString("m.EffectsRepair2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair3_0"), mcLocale.getString("m.EffectsRepair3_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair4_0", new Object[] { LoadProperties.repairdiamondlevel }), mcLocale.getString("m.EffectsRepair4_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsRepair5_0"), mcLocale.getString("m.EffectsRepair5_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] { repairmastery })); + player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] { percentage })); + player.sendMessage(mcLocale.getString("m.ArcaneForgingRank", new Object[] { Repair.getArcaneForgingRank(PP) })); + player.sendMessage(mcLocale.getString("m.ArcaneEnchantKeepChance", new Object[] { Repair.getEnchantChance(Repair.getArcaneForgingRank(PP)) })); + player.sendMessage(mcLocale.getString("m.ArcaneEnchantDowngradeChance", new Object[] { Repair.getDowngradeChance(Repair.getArcaneForgingRank(PP)) })); + player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones")); + player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones2")); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/com/gmail/nossr50/commands/skills/SwordsCommand.java new file mode 100644 index 000000000..41b30f45a --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -0,0 +1,69 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class SwordsCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + int bleedrank = 2; + String percentage, counterattackpercentage; + + float skillvalue = (float) PP.getSkillLevel(SkillType.SWORDS); + if (PP.getSkillLevel(SkillType.SWORDS) < 750) + percentage = String.valueOf((skillvalue / 1000) * 100); + else + percentage = "75"; + + if (skillvalue >= 750) + bleedrank += 1; + + if (PP.getSkillLevel(SkillType.SWORDS) <= 600) + counterattackpercentage = String.valueOf((skillvalue / 2000) * 100); + else + counterattackpercentage = "30"; + + int ticks = 2; + int x = PP.getSkillLevel(SkillType.SWORDS); + while (x >= 50) { + x -= 50; + ticks++; + } + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillSwords") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainSwords") })); + + if (mcPermissions.getInstance().swords(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords3_0"), mcLocale.getString("m.EffectsSwords3_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsSwords5_0"), mcLocale.getString("m.EffectsSwords5_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.SwordsCounterAttChance", new Object[] { counterattackpercentage })); + player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] { bleedrank })); + player.sendMessage(mcLocale.getString("m.SwordsTickNote")); + player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] { percentage })); + player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] { ticks })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/com/gmail/nossr50/commands/skills/TamingCommand.java new file mode 100644 index 000000000..ee1b11e94 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -0,0 +1,70 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class TamingCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + float skillvalue = (float) PP.getSkillLevel(SkillType.TAMING); + String percentage = String.valueOf((skillvalue / 1000) * 100); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillTaming") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainTaming") })); + + if (mcPermissions.getInstance().taming(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming1_0"), mcLocale.getString("m.EffectsTaming1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming2_0"), mcLocale.getString("m.EffectsTaming2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming3_0"), mcLocale.getString("m.EffectsTaming3_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming4_0"), mcLocale.getString("m.EffectsTaming4_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsTaming7_0"), mcLocale.getString("m.EffectsTaming7_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTaming7_2", new Object[] { LoadProperties.bonesConsumedByCOTW })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + + if (PP.getSkillLevel(SkillType.TAMING) < 100) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming1") })); + else + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming1_0"), mcLocale.getString("m.AbilBonusTaming1_1") })); + + if (PP.getSkillLevel(SkillType.TAMING) < 250) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming2") })); + else + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming2_0"), mcLocale.getString("m.AbilBonusTaming2_1") })); + + if (PP.getSkillLevel(SkillType.TAMING) < 500) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming3") })); + else + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming3_0"), mcLocale.getString("m.AbilBonusTaming3_1") })); + + if (PP.getSkillLevel(SkillType.TAMING) < 750) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockTaming4") })); + else + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusTaming4_0"), mcLocale.getString("m.AbilBonusTaming4_1") })); + + player.sendMessage(mcLocale.getString("m.TamingGoreChance", new Object[] { percentage })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/UnarmedCommand.java b/src/com/gmail/nossr50/commands/skills/UnarmedCommand.java new file mode 100644 index 000000000..4e6b4931e --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/UnarmedCommand.java @@ -0,0 +1,74 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class UnarmedCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + String percentage, arrowpercentage; + float skillvalue = (float) PP.getSkillLevel(SkillType.UNARMED); + + if (PP.getSkillLevel(SkillType.UNARMED) < 1000) + percentage = String.valueOf((skillvalue / 4000) * 100); + else + percentage = "25"; + + if (PP.getSkillLevel(SkillType.UNARMED) < 1000) + arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2); + else + arrowpercentage = "50"; + + int ticks = 2; + int x = PP.getSkillLevel(SkillType.UNARMED); + while (x >= 50) { + x -= 50; + ticks++; + } + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillUnarmed") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainUnarmed") })); + + if (mcPermissions.getInstance().unarmed(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed1_0"), mcLocale.getString("m.EffectsUnarmed1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed2_0"), mcLocale.getString("m.EffectsUnarmed2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed3_0"), mcLocale.getString("m.EffectsUnarmed3_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed4_0"), mcLocale.getString("m.EffectsUnarmed4_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsUnarmed5_0"), mcLocale.getString("m.EffectsUnarmed5_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + player.sendMessage(mcLocale.getString("m.UnarmedArrowDeflectChance", new Object[] { arrowpercentage })); + player.sendMessage(mcLocale.getString("m.UnarmedDisarmChance", new Object[] { percentage })); + + if (PP.getSkillLevel(SkillType.UNARMED) < 250) { + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockUnarmed1") })); + } else if (PP.getSkillLevel(SkillType.UNARMED) >= 250 && PP.getSkillLevel(SkillType.UNARMED) < 500) { + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed1_0"), mcLocale.getString("m.AbilBonusUnarmed1_1") })); + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockUnarmed2") })); + } else { + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1") })); + } + + player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] { ticks })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java new file mode 100644 index 000000000..466d8b3d8 --- /dev/null +++ b/src/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -0,0 +1,56 @@ +package com.gmail.nossr50.commands.skills; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; + +public class WoodcuttingCommand 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."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + float skillvalue = (float) PP.getSkillLevel(SkillType.WOODCUTTING); + int ticks = 2; + int x = PP.getSkillLevel(SkillType.WOODCUTTING); + while (x >= 50) { + x -= 50; + ticks++; + } + String percentage = String.valueOf((skillvalue / 1000) * 100); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillWoodCutting") })); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainWoodCutting") })); + + if (mcPermissions.getInstance().woodcutting(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING) })); + + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting1_0"), mcLocale.getString("m.EffectsWoodCutting1_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting2_0"), mcLocale.getString("m.EffectsWoodCutting2_1") })); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsWoodCutting3_0"), mcLocale.getString("m.EffectsWoodCutting3_1") })); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") })); + + if (PP.getSkillLevel(SkillType.WOODCUTTING) < 100) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] { mcLocale.getString("m.AbilLockWoodCutting1") })); + else + player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] { mcLocale.getString("m.AbilBonusWoodCutting1_0"), mcLocale.getString("m.AbilBonusWoodCutting1_1") })); + + player.sendMessage(mcLocale.getString("m.WoodCuttingDoubleDropChance", new Object[] { percentage })); + player.sendMessage(mcLocale.getString("m.WoodCuttingTreeFellerLength", new Object[] { ticks })); + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/spout/MchudCommand.java b/src/com/gmail/nossr50/commands/spout/MchudCommand.java new file mode 100644 index 000000000..a0f56bb9a --- /dev/null +++ b/src/com/gmail/nossr50/commands/spout/MchudCommand.java @@ -0,0 +1,50 @@ +package com.gmail.nossr50.commands.spout; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.HUDType; +import com.gmail.nossr50.datatypes.HUDmmo; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.spout.SpoutStuff; + +public class MchudCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.spoutEnabled) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if(args.length >= 1) + { + for(HUDType x : HUDType.values()) + { + if(x.toString().toLowerCase().equals(args[0].toLowerCase())) + { + if(SpoutStuff.playerHUDs.containsKey(player)) + { + SpoutStuff.playerHUDs.get(player).resetHUD(); + SpoutStuff.playerHUDs.remove(player); + PP.setHUDType(x); + SpoutStuff.playerHUDs.put(player, new HUDmmo(player)); + } + } + } + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/commands/spout/XplockCommand.java b/src/com/gmail/nossr50/commands/spout/XplockCommand.java new file mode 100644 index 000000000..90f7c6107 --- /dev/null +++ b/src/com/gmail/nossr50/commands/spout/XplockCommand.java @@ -0,0 +1,62 @@ +package com.gmail.nossr50.commands.spout; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gmail.nossr50.Users; +import com.gmail.nossr50.m; +import com.gmail.nossr50.mcPermissions; +import com.gmail.nossr50.config.LoadProperties; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.locale.mcLocale; +import com.gmail.nossr50.skills.Skills; +import com.gmail.nossr50.spout.SpoutStuff; + +public class XplockCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!LoadProperties.spoutEnabled || !LoadProperties.xpbar || !LoadProperties.xplockEnable) { + sender.sendMessage("This command is not enabled."); + return true; + } + + if (!(sender instanceof Player)) { + sender.sendMessage("This command does not support console useage."); + return true; + } + + Player player = (Player) sender; + PlayerProfile PP = Users.getProfile(player); + + if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) { + if (PP.getXpBarLocked()) { + PP.setSkillLock(Skills.getSkillType(args[0])); + player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) })); + } else { + PP.setSkillLock(Skills.getSkillType(args[0])); + PP.toggleXpBarLocked(); + player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) })); + } + SpoutStuff.updateXpBar(player); + } else if (args.length < 1) { + if (PP.getXpBarLocked()) { + PP.toggleXpBarLocked(); + player.sendMessage(mcLocale.getString("Commands.xplock.unlocked")); + } else if (PP.getLastGained() != null) { + PP.toggleXpBarLocked(); + PP.setSkillLock(PP.getLastGained()); + player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) })); + } + } else if (args.length >= 1 && !Skills.isSkill(args[0])) { + player.sendMessage("Commands.xplock.invalid"); + } else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) { + player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission")); + return true; + } + + return true; + } +} diff --git a/src/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/com/gmail/nossr50/listeners/mcPlayerListener.java index 6b91153a6..14f8c7621 100644 --- a/src/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -34,6 +34,7 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent.State; import org.bukkit.event.player.PlayerInteractEvent; @@ -49,7 +50,7 @@ import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcPermissions; -import com.gmail.nossr50.command.Commands; +import com.gmail.nossr50.commands.general.XprateCommand; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.spout.mmoHelper; @@ -158,7 +159,8 @@ public class mcPlayerListener extends PlayerListener player.sendMessage(mcLocale.getString("mcPlayerListener.MOTD", new Object[] {plugin.getDescription().getVersion(), LoadProperties.mcmmo})); player.sendMessage(mcLocale.getString("mcPlayerListener.WIKI")); } - if(Commands.xpevent) + //THIS IS VERY BAD WAY TO DO THINGS, NEED BETTER WAY + if(XprateCommand.xpevent) player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!"); } @@ -331,4 +333,14 @@ public class mcPlayerListener extends PlayerListener } } } + + public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { + String message = event.getMessage(); + if(!message.startsWith("/")) return; + String command = message.substring(1).split(" ")[0]; + if(plugin.aliasMap.containsKey(command)) { + event.setCancelled(true); + event.getPlayer().chat(message.replaceFirst(command, plugin.aliasMap.get(command))); + } + } } \ No newline at end of file diff --git a/src/com/gmail/nossr50/mcMMO.java b/src/com/gmail/nossr50/mcMMO.java index 9972325c5..b8aad4f8b 100644 --- a/src/com/gmail/nossr50/mcMMO.java +++ b/src/com/gmail/nossr50/mcMMO.java @@ -18,13 +18,18 @@ package com.gmail.nossr50; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; -import com.gmail.nossr50.command.Commands; +import com.gmail.nossr50.commands.skills.*; +import com.gmail.nossr50.commands.spout.*; +import com.gmail.nossr50.commands.mc.*; +import com.gmail.nossr50.commands.party.*; +import com.gmail.nossr50.commands.general.*; import com.gmail.nossr50.config.*; import com.gmail.nossr50.runnables.mcTimer; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.listeners.mcBlockListener; import com.gmail.nossr50.listeners.mcEntityListener; import com.gmail.nossr50.listeners.mcPlayerListener; +import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.skills.*; import com.nijikokun.bukkit.Permissions.Permissions; @@ -40,11 +45,10 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event; import org.bukkit.plugin.PluginDescriptionFile; @@ -84,6 +88,9 @@ public class mcMMO extends JavaPlugin private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION //private Timer mcMMO_SpellTimer = new Timer(true); + //Alias - Command + public HashMap aliasMap = new HashMap(); + public static Database database = null; public Misc misc = new Misc(this); @@ -142,6 +149,7 @@ public class mcMMO extends JavaPlugin pm.registerEvent(Event.Type.PLAYER_RESPAWN, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_PICKUP_ITEM, playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_FISH, playerListener, Priority.Normal, this); + pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Priority.Lowest, this); //Block Stuff pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Highest, this); @@ -169,6 +177,8 @@ public class mcMMO extends JavaPlugin Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, mcMMO_Timer, 0, 20); + registerCommands(); + //Spout Stuff if(LoadProperties.spoutEnabled) { @@ -257,10 +267,99 @@ public class mcMMO extends JavaPlugin Bukkit.getServer().getScheduler().cancelTasks(this); System.out.println("mcMMO was disabled."); } - - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) - { - return Commands.processCommands(sender, command, label, args); + + private void registerCommands() { + //Register aliases with the aliasmap (used in the playercommandpreprocessevent to ugly alias them to actual commands) + //Skills commands + aliasMap.put(mcLocale.getString("m.SkillAcrobatics").toLowerCase(), "acrobatics"); + aliasMap.put(mcLocale.getString("m.SkillArchery").toLowerCase(), "archery"); + aliasMap.put(mcLocale.getString("m.SkillAxes").toLowerCase(), "axes"); + aliasMap.put(mcLocale.getString("m.SkillExcavation").toLowerCase(), "excavation"); + aliasMap.put(mcLocale.getString("m.SkillFishing").toLowerCase(), "fishing"); + aliasMap.put(mcLocale.getString("m.SkillHerbalism").toLowerCase(), "herbalism"); + aliasMap.put(mcLocale.getString("m.SkillMining").toLowerCase(), "mining"); + aliasMap.put(mcLocale.getString("m.SkillRepair").toLowerCase(), "repair"); + aliasMap.put(mcLocale.getString("m.SkillSwords").toLowerCase(), "swords"); + aliasMap.put(mcLocale.getString("m.SkillTaming").toLowerCase(), "taming"); + aliasMap.put(mcLocale.getString("m.SkillUnarmed").toLowerCase(), "unarmed"); + aliasMap.put(mcLocale.getString("m.SkillWoodCutting").toLowerCase(), "woodcutting"); + + //Mc* commands + aliasMap.put(LoadProperties.mcability, "mcability"); + aliasMap.put(LoadProperties.mcc, "mcc"); + aliasMap.put(LoadProperties.mcgod, "mcgod"); + aliasMap.put(LoadProperties.mcmmo, "mcmmo"); + aliasMap.put(LoadProperties.mcrefresh, "mcrefresh"); + aliasMap.put(LoadProperties.mctop, "mctop"); + + //Party commands + aliasMap.put(LoadProperties.accept, "accept"); + //aliasMap.put(null, "a"); + aliasMap.put(LoadProperties.invite, "invite"); + aliasMap.put(LoadProperties.party, "party"); + //aliasMap.put(null, "p"); + aliasMap.put(LoadProperties.ptp, "ptp"); + + //Other commands + aliasMap.put(LoadProperties.addxp, "addxp"); + aliasMap.put(LoadProperties.clearmyspawn, "clearmyspawn"); + aliasMap.put(LoadProperties.mmoedit, "mmoedit"); + //aliasMap.put(key, "mmoupdate"); + aliasMap.put(LoadProperties.myspawn, "myspawn"); + aliasMap.put(LoadProperties.stats, "stats"); + aliasMap.put(LoadProperties.whois, "whois"); + aliasMap.put(LoadProperties.xprate, "xprate"); + + //Spout commands + //aliasMap.put(null, "mchud"); + aliasMap.put(LoadProperties.xplock, "xplock"); + + + //Register commands + //Skills commands + getCommand("acrobatics").setExecutor(new AcrobaticsCommand()); + getCommand("archery").setExecutor(new ArcheryCommand()); + getCommand("axes").setExecutor(new AxesCommand()); + getCommand("excavation").setExecutor(new ExcavationCommand()); + getCommand("fishing").setExecutor(new FishingCommand()); + getCommand("herbalism").setExecutor(new HerbalismCommand()); + getCommand("mining").setExecutor(new MiningCommand()); + getCommand("repair").setExecutor(new RepairCommand()); + getCommand("swords").setExecutor(new SwordsCommand()); + getCommand("taming").setExecutor(new TamingCommand()); + getCommand("unarmed").setExecutor(new UnarmedCommand()); + getCommand("woodcutting").setExecutor(new WoodcuttingCommand()); + + //Mc* commands + getCommand("mcability").setExecutor(new McabilityCommand()); + getCommand("mcc").setExecutor(new MccCommand()); + getCommand("mcgod").setExecutor(new McgodCommand()); + getCommand("mcmmo").setExecutor(new McmmoCommand()); + getCommand("mcrefresh").setExecutor(new McrefreshCommand(this)); + getCommand("mctop").setExecutor(new MctopCommand()); + + //Party commands + getCommand("accept").setExecutor(new AcceptCommand()); + getCommand("a").setExecutor(new ACommand()); + getCommand("invite").setExecutor(new InviteCommand(this)); + getCommand("party").setExecutor(new PartyCommand()); + getCommand("p").setExecutor(new PCommand()); + getCommand("ptp").setExecutor(new PtpCommand(this)); + + //Other commands + getCommand("addxp").setExecutor(new AddxpCommand(this)); + getCommand("clearmyspawn").setExecutor(new ClearmyspawnCommand()); + getCommand("mmoedit").setExecutor(new MmoeditCommand(this)); + getCommand("mmoupdate").setExecutor(new MmoupdateCommand()); + getCommand("myspawn").setExecutor(new MyspawnCommand()); + getCommand("stats").setExecutor(new StatsCommand()); + getCommand("whois").setExecutor(new WhoisCommand(this)); + getCommand("xprate").setExecutor(new XprateCommand()); + + //Spout commands + getCommand("mchud").setExecutor(new MchudCommand()); + getCommand("xplock").setExecutor(new XplockCommand()); + } /*