Major refactoring. This WILL break any mcMMO-related plugin that

does not properly hook into the API classes. 

This consolidates the skill-related classes into their own individual
packages, and moves several misc skill classes into the main Skill
package as well. This also moves all Party & Spout related files into
their own respective packages as well.
This commit is contained in:
GJ
2013-01-22 12:43:25 -05:00
parent 00d50953ad
commit 6b0e7a9c61
95 changed files with 233 additions and 239 deletions

View File

@@ -1,61 +0,0 @@
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.HudType;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users;
public class MchudCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"mchud", "<DISABLED | STANDARD | SMALL | RETRO>"});
String invalid = LocaleLoader.getString("Commands.mchud.Invalid");
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
Player player = (Player) sender;
PlayerProfile playerProfile = Users.getProfile(player);
SpoutHud spoutHud = playerProfile.getSpoutHud();
if (spoutHud == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
switch (args.length) {
case 1:
for (HudType hudType : HudType.values()) {
if (hudType.toString().equalsIgnoreCase(args[0])) {
playerProfile.setHudType(hudType);
spoutHud.initializeXpBar();
spoutHud.updateXpBar();
return true;
}
}
player.sendMessage(invalid);
return true;
default:
player.sendMessage(usage);
return true;
}
}
}

View File

@@ -1,89 +0,0 @@
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.mcMMO;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users;
public class XplockCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String usage = LocaleLoader.getString("Commands.Usage.1", new Object[] {"xplock", "[skill]"});
if (CommandHelper.noConsoleUsage(sender)) {
return true;
}
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled() || !Config.getInstance().getCommandXPLockEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
Player player = (Player) sender;
PlayerProfile playerProfile = Users.getProfile(player);
SpoutHud spoutHud = playerProfile.getSpoutHud();
if (spoutHud == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
switch (args.length) {
case 0:
if (spoutHud.getXpBarLocked()) {
spoutHud.toggleXpBarLocked();
player.sendMessage(LocaleLoader.getString("Commands.xplock.unlocked"));
return true;
}
SkillType lastGained = spoutHud.getLastGained();
if (lastGained != null) {
spoutHud.toggleXpBarLocked();
spoutHud.setSkillLock(lastGained);
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(lastGained.toString()) }));
}
else {
player.sendMessage(usage);
}
return true;
case 1:
if (Skills.isSkill(args[0])) {
if (Permissions.hasPermission(player, "mcmmo.skills." + args[0].toLowerCase())) {
spoutHud.setXpBarLocked(true);
spoutHud.setSkillLock(Skills.getSkillType(args[0]));
spoutHud.updateXpBar();
player.sendMessage(LocaleLoader.getString("Commands.xplock.locked", new Object[] { Misc.getCapitalized(args[0]) }));
}
else {
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
}
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true;
default:
player.sendMessage(usage);
return true;
}
}
}