Ported commands to new configuration system

This commit is contained in:
Alexander Meech 2019-08-16 16:53:28 -04:00
parent b1d5130309
commit c4185ef178
61 changed files with 737 additions and 248 deletions

View file

@ -5,7 +5,6 @@ import java.util.ArrayList;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public interface ComboAbility { public interface ComboAbility {

View file

@ -20,25 +20,18 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentSkipListMap;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import sun.reflect.ReflectionFactory;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import co.aikar.timings.lib.MCTiming;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.Element.SubElement;
@ -55,8 +48,6 @@ import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.attribute.AttributeModifier; import com.projectkorra.projectkorra.attribute.AttributeModifier;
import com.projectkorra.projectkorra.attribute.AttributePriority; import com.projectkorra.projectkorra.attribute.AttributePriority;
import com.projectkorra.projectkorra.configuration.better.Config;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig; import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
import com.projectkorra.projectkorra.event.AbilityEndEvent; import com.projectkorra.projectkorra.event.AbilityEndEvent;
import com.projectkorra.projectkorra.event.AbilityProgressEvent; import com.projectkorra.projectkorra.event.AbilityProgressEvent;
@ -64,6 +55,9 @@ import com.projectkorra.projectkorra.event.AbilityStartEvent;
import com.projectkorra.projectkorra.util.FlightHandler; import com.projectkorra.projectkorra.util.FlightHandler;
import com.projectkorra.projectkorra.util.TimeUtil; import com.projectkorra.projectkorra.util.TimeUtil;
import co.aikar.timings.lib.MCTiming;
import sun.reflect.ReflectionFactory;
/** /**
* CoreAbility provides default implementation of an Ability, including methods * CoreAbility provides default implementation of an Ability, including methods
* to control the life cycle of a specific instance. CoreAbility also provides a * to control the life cycle of a specific instance. CoreAbility also provides a
@ -80,7 +74,7 @@ import com.projectkorra.projectkorra.util.TimeUtil;
* @see #registerAddonAbilities(String) * @see #registerAddonAbilities(String)
* @see #registerPluginAbilities(JavaPlugin, String) * @see #registerPluginAbilities(JavaPlugin, String)
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked", "unlikely-arg-type", "restriction" })
public abstract class CoreAbility<C extends AbilityConfig> implements Ability { public abstract class CoreAbility<C extends AbilityConfig> implements Ability {
private static final Set<CoreAbility> INSTANCES = Collections.newSetFromMap(new ConcurrentHashMap<CoreAbility, Boolean>()); private static final Set<CoreAbility> INSTANCES = Collections.newSetFromMap(new ConcurrentHashMap<CoreAbility, Boolean>());

View file

@ -14,6 +14,7 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
* *
* @see CollisionManager * @see CollisionManager
*/ */
@SuppressWarnings("rawtypes")
public class Collision { public class Collision {
private CoreAbility abilityFirst; private CoreAbility abilityFirst;
private CoreAbility abilitySecond; private CoreAbility abilitySecond;

View file

@ -60,6 +60,7 @@ import com.projectkorra.projectkorra.waterbending.ice.IceSpikeBlast;
* @see Collision * @see Collision
* @see CollisionManager * @see CollisionManager
*/ */
@SuppressWarnings("rawtypes")
public class CollisionInitializer { public class CollisionInitializer {
private final CollisionManager collisionManager; private final CollisionManager collisionManager;

View file

@ -33,6 +33,7 @@ import com.projectkorra.projectkorra.event.AbilityCollisionEvent;
* cancelled, abilityFirst.handleCollision, and finally * cancelled, abilityFirst.handleCollision, and finally
* abilitySecond.handleCollision. * abilitySecond.handleCollision.
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" })
public class CollisionManager { public class CollisionManager {
/* /*

View file

@ -21,6 +21,7 @@ import com.projectkorra.projectkorra.earthbending.combo.EarthDomeOthers;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.ReflectionHandler; import com.projectkorra.projectkorra.util.ReflectionHandler;
@SuppressWarnings("rawtypes")
public class ComboManager { public class ComboManager {
private static final long CLEANUP_DELAY = 20 * 60; private static final long CLEANUP_DELAY = 20 * 60;
private static final Map<String, ArrayList<AbilityInformation>> RECENTLY_USED = new ConcurrentHashMap<>(); private static final Map<String, ArrayList<AbilityInformation>> RECENTLY_USED = new ConcurrentHashMap<>();

View file

@ -15,6 +15,7 @@ import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility; import com.projectkorra.projectkorra.ability.PassiveAbility;
@SuppressWarnings({ "rawtypes", "unlikely-arg-type" })
public class PassiveManager { public class PassiveManager {
private static final Map<String, CoreAbility> PASSIVES = new HashMap<>(); private static final Map<String, CoreAbility> PASSIVES = new HashMap<>();

View file

@ -13,7 +13,9 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.AddCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.CommandPropertiesConfig;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent;
@ -21,7 +23,7 @@ import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent;
/** /**
* Executor for /bending add. Extends {@link PKCommand}. * Executor for /bending add. Extends {@link PKCommand}.
*/ */
public class AddCommand extends PKCommand { public class AddCommand extends PKCommand<AddCommandConfig> {
private final String playerNotFound; private final String playerNotFound;
private final String invalidElement; private final String invalidElement;
@ -38,23 +40,23 @@ public class AddCommand extends PKCommand {
private final String alreadyHasAllElementsOther; private final String alreadyHasAllElementsOther;
private final String alreadyHasAllElements; private final String alreadyHasAllElements;
public AddCommand() { public AddCommand(final AddCommandConfig config) {
super("add", "/bending add <Element/SubElement> [Player]", ConfigManager.languageConfig.get().getString("Commands.Add.Description"), new String[] { "add", "a" }); super(config, "add", "/bending add <Element/SubElement> [Player]", config.Description, new String[] { "add", "a" });
this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Add.PlayerNotFound"); this.playerNotFound = config.PlayerNotFound;
this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Add.InvalidElement"); this.invalidElement = config.InvalidElement;
this.addedOtherCFW = ConfigManager.languageConfig.get().getString("Commands.Add.Other.SuccessfullyAddedCFW"); this.addedOtherCFW = config.SuccessfullyAddedCFW_Other;
this.addedOtherAE = ConfigManager.languageConfig.get().getString("Commands.Add.Other.SuccessfullyAddedAE"); this.addedOtherAE = config.SuccessfullyAddedAE_Other;
this.addedCFW = ConfigManager.languageConfig.get().getString("Commands.Add.SuccessfullyAddedCFW"); this.addedCFW = config.SuccessfullyAddedCFW;
this.addedAE = ConfigManager.languageConfig.get().getString("Commands.Add.SuccessfullyAddedAE"); this.addedAE = config.SuccessfullyAddedAE;
this.addedOtherAll = ConfigManager.languageConfig.get().getString("Commands.Add.Other.SuccessfullyAddedAll"); this.addedOtherAll = config.SuccessfullyAddedAll_Other;
this.addedAll = ConfigManager.languageConfig.get().getString("Commands.Add.SuccessfullyAddedAll"); this.addedAll = config.SuccessfullyAddedAll;
this.alreadyHasElementOther = ConfigManager.languageConfig.get().getString("Commands.Add.Other.AlreadyHasElement"); this.alreadyHasElementOther = config.AlreadyHasElement_Other;
this.alreadyHasElement = ConfigManager.languageConfig.get().getString("Commands.Add.AlreadyHasElement"); this.alreadyHasElement = config.AlreadyHasElement;
this.alreadyHasSubElementOther = ConfigManager.languageConfig.get().getString("Commands.Add.Other.AlreadyHasSubElement"); this.alreadyHasSubElementOther = config.AlreadyHasSubElement_Other;
this.alreadyHasSubElement = ConfigManager.languageConfig.get().getString("Commands.Add.AlreadyHasSubElement"); this.alreadyHasSubElement = config.AlreadyHasSubElement;
this.alreadyHasAllElementsOther = ConfigManager.languageConfig.get().getString("Commands.Add.Other.AlreadyHasAllElements"); this.alreadyHasAllElementsOther = config.AlreadyHasAllElements_Other;
this.alreadyHasAllElements = ConfigManager.languageConfig.get().getString("Commands.Add.AlreadyHasAllElements"); this.alreadyHasAllElements = config.AlreadyHasAllElements;
} }
@Override @Override
@ -94,7 +96,7 @@ public class AddCommand extends PKCommand {
GeneralMethods.createBendingPlayer(target.getUniqueId(), target.getName()); GeneralMethods.createBendingPlayer(target.getUniqueId(), target.getName());
bPlayer = BendingPlayer.getBendingPlayer(target); bPlayer = BendingPlayer.getBendingPlayer(target);
} else if (bPlayer.isPermaRemoved()) { // ignore permabanned users. } else if (bPlayer.isPermaRemoved()) { // ignore permabanned users.
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved")); GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.getConfig(CommandPropertiesConfig.class).BendingPermanentlyRemoved_Other);
return; return;
} }

View file

@ -12,8 +12,8 @@ import org.bukkit.command.TabCompleter;
/** /**
* Completes tabbing for the bending command/subcommands. * Completes tabbing for the bending command/subcommands.
* *
* @author StrangeOne101
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" })
public class BendingTabComplete implements TabCompleter { public class BendingTabComplete implements TabCompleter {
@Override @Override

View file

@ -16,14 +16,13 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ComboAbility; import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility; import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.BindCommandConfig; import com.projectkorra.projectkorra.configuration.better.configs.commands.BindCommandConfig;
/** /**
* Executor for /bending bind. Extends {@link PKCommand}. * Executor for /bending bind. Extends {@link PKCommand}.
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public class BindCommand extends PKCommand { public class BindCommand extends PKCommand<BindCommandConfig> {
private final String abilityDoesntExist; private final String abilityDoesntExist;
private final String wrongNumber; private final String wrongNumber;
@ -34,17 +33,17 @@ public class BindCommand extends PKCommand {
private final String noSubElement; private final String noSubElement;
private final String unbindable; private final String unbindable;
public BindCommand() { public BindCommand(final BindCommandConfig config) {
super("bind", "/bending bind <Ability> [Slot]", ConfigManager.getConfig(BindCommandConfig.class).Description, new String[] { "bind", "b" }); super(config, "bind", "/bending bind <Ability> [Slot]", config.Description, new String[] { "bind", "b" });
this.abilityDoesntExist = ConfigManager.getConfig(BindCommandConfig.class).AbilityDoesntExistMessage; this.abilityDoesntExist = config.AbilityDoesntExistMessage;
this.wrongNumber = ConfigManager.getConfig(BindCommandConfig.class).WrongNumberMessage; this.wrongNumber = config.WrongNumberMessage;
this.loadingInfo = ConfigManager.getConfig(BindCommandConfig.class).LoadingInfoMessage; this.loadingInfo = config.LoadingInfoMessage;
this.toggledElementOff = ConfigManager.getConfig(BindCommandConfig.class).ElementToggledOffMessage; this.toggledElementOff = config.ElementToggledOffMessage;
this.noElement = ConfigManager.getConfig(BindCommandConfig.class).NoElementMessage; this.noElement = config.NoElementMessage;
this.noElementAE = ConfigManager.getConfig(BindCommandConfig.class).NoElementMessageAE; this.noElementAE = config.NoElementMessageAE;
this.noSubElement = ConfigManager.getConfig(BindCommandConfig.class).NoSubElementMessage; this.noSubElement = config.NoSubElementMessage;
this.unbindable = ConfigManager.getConfig(BindCommandConfig.class).UnbindableMessage; this.unbindable = config.UnbindableMessage;
} }
@Override @Override

View file

@ -6,25 +6,25 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.CheckCommandConfig;
/** /**
* Executor for /bending check. Extends {@link PKCommand}. * Executor for /bending check. Extends {@link PKCommand}.
*/ */
public class CheckCommand extends PKCommand { public class CheckCommand extends PKCommand<CheckCommandConfig> {
private final String newVersionAvailable; private final String newVersionAvailable;
private final String curVersion; private final String curVersion;
private final String newVersion; private final String newVersion;
private final String upToDate; private final String upToDate;
public CheckCommand() { public CheckCommand(final CheckCommandConfig config) {
super("check", "/bending check", ConfigManager.languageConfig.get().getString("Commands.Check.Description"), new String[] { "check", "chk" }); super(config, "check", "/bending check", config.Description, new String[] { "check", "chk" });
this.newVersionAvailable = ConfigManager.languageConfig.get().getString("Commands.Check.NewVersionAvailable"); this.newVersionAvailable = config.NewVersionAvailable;
this.curVersion = ConfigManager.languageConfig.get().getString("Commands.Check.CurrentVersion"); this.curVersion = config.CurrentVersion;
this.newVersion = ConfigManager.languageConfig.get().getString("Commands.Check.LatestVersion"); this.newVersion = config.LatestVersion;
this.upToDate = ConfigManager.languageConfig.get().getString("Commands.Check.UpToDate"); this.upToDate = config.UpToDate;
} }
@Override @Override

View file

@ -14,7 +14,10 @@ import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.ChooseCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.CommandPropertiesConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.GeneralPropertiesConfig;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent;
@ -23,7 +26,7 @@ import com.projectkorra.projectkorra.util.TimeUtil;
/** /**
* Executor for /bending choose. Extends {@link PKCommand}. * Executor for /bending choose. Extends {@link PKCommand}.
*/ */
public class ChooseCommand extends PKCommand { public class ChooseCommand extends PKCommand<ChooseCommandConfig> {
private final String invalidElement; private final String invalidElement;
private final String playerNotFound; private final String playerNotFound;
@ -34,17 +37,17 @@ public class ChooseCommand extends PKCommand {
private final String chosenOtherAE; private final String chosenOtherAE;
private final long cooldown; private final long cooldown;
public ChooseCommand() { public ChooseCommand(final ChooseCommandConfig config) {
super("choose", "/bending choose <Element> [Player]", ConfigManager.languageConfig.get().getString("Commands.Choose.Description"), new String[] { "choose", "ch" }); super(config, "choose", "/bending choose <Element> [Player]", config.Description, new String[] { "choose", "ch" });
this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Choose.PlayerNotFound"); this.playerNotFound = config.PlayerNotFound;
this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Choose.InvalidElement"); this.invalidElement = config.InvalidElement;
this.onCooldown = ConfigManager.languageConfig.get().getString("Commands.Choose.OnCooldown"); this.onCooldown = config.OnCooldown;
this.chosenCFW = ConfigManager.languageConfig.get().getString("Commands.Choose.SuccessfullyChosenCFW"); this.chosenCFW = config.SuccessfullyChosenCFW;
this.chosenAE = ConfigManager.languageConfig.get().getString("Commands.Choose.SuccessfullyChosenAE"); this.chosenAE = config.SuccessfullyChosenAE;
this.chosenOtherCFW = ConfigManager.languageConfig.get().getString("Commands.Choose.Other.SuccessfullyChosenCFW"); this.chosenOtherCFW = config.SuccessfullyChosenCFW_Other;
this.chosenOtherAE = ConfigManager.languageConfig.get().getString("Commands.Choose.Other.SuccessfullyChosenAE"); this.chosenOtherAE = config.SuccessfullyChosenAE_Other;
this.cooldown = ConfigManager.defaultConfig.get().getLong("Properties.ChooseCooldown"); this.cooldown = ConfigManager.getConfig(GeneralPropertiesConfig.class).ChooseCooldown;
} }
@Override @Override
@ -62,7 +65,7 @@ public class ChooseCommand extends PKCommand {
bPlayer = BendingPlayer.getBendingPlayer(sender.getName()); bPlayer = BendingPlayer.getBendingPlayer(sender.getName());
} }
if (bPlayer.isPermaRemoved()) { if (bPlayer.isPermaRemoved()) {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved")); GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.getConfig(CommandPropertiesConfig.class).BendingPermanentlyRemoved);
return; return;
} }
if (!bPlayer.getElements().isEmpty() && !sender.hasPermission("bending.command.rechoose")) { if (!bPlayer.getElements().isEmpty() && !sender.hasPermission("bending.command.rechoose")) {

View file

@ -11,12 +11,12 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.ClearCommandConfig;
/** /**
* Executor for /bending clear. Extends {@link PKCommand}. * Executor for /bending clear. Extends {@link PKCommand}.
*/ */
public class ClearCommand extends PKCommand { public class ClearCommand extends PKCommand<ClearCommandConfig> {
private final String cantEditBinds; private final String cantEditBinds;
private final String cleared; private final String cleared;
@ -24,14 +24,14 @@ public class ClearCommand extends PKCommand {
private final String clearedSlot; private final String clearedSlot;
private final String alreadyEmpty; private final String alreadyEmpty;
public ClearCommand() { public ClearCommand(final ClearCommandConfig config) {
super("clear", "/bending clear [Slot]", ConfigManager.languageConfig.get().getString("Commands.Clear.Description"), new String[] { "clear", "cl", "c" }); super(config, "clear", "/bending clear [Slot]", config.Description, new String[] { "clear", "cl", "c" });
this.cantEditBinds = ConfigManager.languageConfig.get().getString("Commands.Clear.CantEditBinds"); this.cantEditBinds = config.CantEditBinds;
this.cleared = ConfigManager.languageConfig.get().getString("Commands.Clear.Cleared"); this.cleared = config.Cleared;
this.wrongNumber = ConfigManager.languageConfig.get().getString("Commands.Clear.WrongNumber"); this.wrongNumber = config.WrongNumber;
this.clearedSlot = ConfigManager.languageConfig.get().getString("Commands.Clear.ClearedSlot"); this.clearedSlot = config.ClearedSlot;
this.alreadyEmpty = ConfigManager.languageConfig.get().getString("Commands.Clear.AlreadyEmpty"); this.alreadyEmpty = config.AlreadyEmpty;
} }
@Override @Override

View file

@ -10,7 +10,27 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.AddCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.BindCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.CheckCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.ChooseCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.ClearCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.CopyCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.DebugCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.DisplayCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.HelpCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.InvincibleCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.PermaremoveCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.PresetCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.ReloadCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.RemoveCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.StatsCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.ToggleCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.VersionCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.commands.WhoCommandConfig;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class Commands { public class Commands {
private final ProjectKorra plugin; private final ProjectKorra plugin;
@ -77,24 +97,24 @@ public class Commands {
/** /**
* Set of all of the Classes which extend Command * Set of all of the Classes which extend Command
*/ */
new AddCommand(); new AddCommand(ConfigManager.getConfig(AddCommandConfig.class));
new BindCommand(); new BindCommand(ConfigManager.getConfig(BindCommandConfig.class));
new CheckCommand(); new CheckCommand(ConfigManager.getConfig(CheckCommandConfig.class));
new ChooseCommand(); new ChooseCommand(ConfigManager.getConfig(ChooseCommandConfig.class));
new ClearCommand(); new ClearCommand(ConfigManager.getConfig(ClearCommandConfig.class));
new CopyCommand(); new CopyCommand(ConfigManager.getConfig(CopyCommandConfig.class));
new DebugCommand(); new DebugCommand(ConfigManager.getConfig(DebugCommandConfig.class));
new DisplayCommand(); new DisplayCommand(ConfigManager.getConfig(DisplayCommandConfig.class));
new HelpCommand(); new HelpCommand(ConfigManager.getConfig(HelpCommandConfig.class));
new InvincibleCommand(); new InvincibleCommand(ConfigManager.getConfig(InvincibleCommandConfig.class));
new PermaremoveCommand(); new PermaremoveCommand(ConfigManager.getConfig(PermaremoveCommandConfig.class));
new PresetCommand(); new PresetCommand(ConfigManager.getConfig(PresetCommandConfig.class));
new ReloadCommand(); new ReloadCommand(ConfigManager.getConfig(ReloadCommandConfig.class));
new RemoveCommand(); new RemoveCommand(ConfigManager.getConfig(RemoveCommandConfig.class));
new StatsCommand(); new StatsCommand(ConfigManager.getConfig(StatsCommandConfig.class));
new ToggleCommand(); new ToggleCommand(ConfigManager.getConfig(ToggleCommandConfig.class));
new VersionCommand(); new VersionCommand(ConfigManager.getConfig(VersionCommandConfig.class));
new WhoCommand(); new WhoCommand(ConfigManager.getConfig(WhoCommandConfig.class));
final CommandExecutor exe = (s, c, label, args) -> { final CommandExecutor exe = (s, c, label, args) -> {
if (Arrays.asList(commandaliases).contains(label.toLowerCase())) { if (Arrays.asList(commandaliases).contains(label.toLowerCase())) {

View file

@ -13,22 +13,25 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.CopyCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.CommandPropertiesConfig;
public class CopyCommand extends PKCommand { @SuppressWarnings({ "rawtypes", "unchecked" })
public class CopyCommand extends PKCommand<CopyCommandConfig> {
private final String playerNotFound; private final String playerNotFound;
private final String copied; private final String copied;
private final String failedToBindAll; private final String failedToBindAll;
private final String copiedOther; private final String copiedOther;
public CopyCommand() { public CopyCommand(final CopyCommandConfig config) {
super("copy", "/bending copy <Player> [Player]", ConfigManager.languageConfig.get().getString("Commands.Copy.Description"), new String[] { "copy", "co" }); super(config, "copy", "/bending copy <Player> [Player]", config.Description, new String[] { "copy", "co" });
this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Copy.PlayerNotFound"); this.playerNotFound = config.PlayerNotFound;
this.copied = ConfigManager.languageConfig.get().getString("Commands.Copy.SuccessfullyCopied"); this.copied = config.SuccessfullyCopied;
this.failedToBindAll = ConfigManager.languageConfig.get().getString("Commands.Copy.FailedToBindAll"); this.failedToBindAll = config.FailedToBindAll;
this.copiedOther = ConfigManager.languageConfig.get().getString("Commands.Copy.Other.SuccessfullyCopied"); this.copiedOther = config.SuccessfullyCopied_Other;
} }
@Override @Override
@ -90,9 +93,9 @@ public class CopyCommand extends PKCommand {
} }
if (orig.isPermaRemoved()) { if (orig.isPermaRemoved()) {
if (self) { if (self) {
GeneralMethods.sendBrandingMessage(player, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved")); GeneralMethods.sendBrandingMessage(player, ChatColor.RED + ConfigManager.getConfig(CommandPropertiesConfig.class).BendingPermanentlyRemoved);
} else { } else {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved")); GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.getConfig(CommandPropertiesConfig.class).BendingPermanentlyRemoved_Other);
} }
return false; return false;
} }

View file

@ -6,15 +6,15 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.DebugCommandConfig;
/** /**
* Executor for /bending debug. Extends {@link PKCommand}. * Executor for /bending debug. Extends {@link PKCommand}.
*/ */
public class DebugCommand extends PKCommand { public class DebugCommand extends PKCommand<DebugCommandConfig> {
public DebugCommand() { public DebugCommand(final DebugCommandConfig config) {
super("debug", "/bending debug", ConfigManager.languageConfig.get().getString("Commands.Debug.Description"), new String[] { "debug", "de" }); super(config, "debug", "/bending debug", config.Description, new String[] { "debug", "de" });
} }
@Override @Override
@ -27,7 +27,7 @@ public class DebugCommand extends PKCommand {
} }
GeneralMethods.runDebug(); GeneralMethods.runDebug();
sender.sendMessage(ChatColor.GREEN + ConfigManager.languageConfig.get().getString("Commands.Debug.SuccessfullyExported")); sender.sendMessage(ChatColor.GREEN + config.SuccessfullyExported);
} }
/** /**

View file

@ -20,12 +20,15 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.SubAbility; import com.projectkorra.projectkorra.ability.SubAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.ability.util.ComboManager;
import com.projectkorra.projectkorra.ability.util.PassiveManager; import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.DisplayCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.CommandPropertiesConfig;
/** /**
* Executor for /bending display. Extends {@link PKCommand}. * Executor for /bending display. Extends {@link PKCommand}.
*/ */
public class DisplayCommand extends PKCommand { @SuppressWarnings("rawtypes")
public class DisplayCommand extends PKCommand<DisplayCommandConfig> {
private final String noCombosAvailable; private final String noCombosAvailable;
private final String noPassivesAvailable; private final String noPassivesAvailable;
@ -34,15 +37,15 @@ public class DisplayCommand extends PKCommand {
private final String noAbilitiesAvailable; private final String noAbilitiesAvailable;
private final String noBinds; private final String noBinds;
public DisplayCommand() { public DisplayCommand(final DisplayCommandConfig config) {
super("display", "/bending display <Element>", ConfigManager.languageConfig.get().getString("Commands.Display.Description"), new String[] { "display", "dis", "d" }); super(config, "display", "/bending display <Element>", config.Description, new String[] { "display", "dis", "d" });
this.noCombosAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoCombosAvailable"); this.noCombosAvailable = config.NoCombosAvailable;
this.noPassivesAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoPassivesAvailable"); this.noPassivesAvailable = config.NoPassivesAvailable;
this.noAbilitiesAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoAbilitiesAvailable"); this.noAbilitiesAvailable = config.NoAbilitiesAvailable;
this.invalidArgument = ConfigManager.languageConfig.get().getString("Commands.Display.InvalidArgument"); this.invalidArgument = config.InvalidArgument;
this.playersOnly = ConfigManager.languageConfig.get().getString("Commands.Display.PlayersOnly"); this.playersOnly = ConfigManager.getConfig(CommandPropertiesConfig.class).MustBePlayer;
this.noBinds = ConfigManager.languageConfig.get().getString("Commands.Display.NoBinds"); this.noBinds = config.NoBinds;
} }
@Override @Override

View file

@ -16,12 +16,20 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility; import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.ability.util.ComboManager;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.HelpCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.AirPropertiesConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.AvatarPropertiesConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.ChiPropertiesConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.EarthPropertiesConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.FirePropertiesConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
/** /**
* Executor for /bending help. Extends {@link PKCommand}. * Executor for /bending help. Extends {@link PKCommand}.
*/ */
public class HelpCommand extends PKCommand { @SuppressWarnings("rawtypes")
public class HelpCommand extends PKCommand<HelpCommandConfig> {
private final String required; private final String required;
private final String optional; private final String optional;
@ -39,24 +47,24 @@ public class HelpCommand extends PKCommand {
private final String spiritsUsage; private final String spiritsUsage;
private final String itemsUsage; private final String itemsUsage;
public HelpCommand() { public HelpCommand(final HelpCommandConfig config) {
super("help", "/bending help <Page/Topic>", ConfigManager.languageConfig.get().getString("Commands.Help.Description"), new String[] { "help", "h" }); super(config, "help", "/bending help <Page/Topic>", config.Description, new String[] { "help", "h" });
this.required = ConfigManager.languageConfig.get().getString("Commands.Help.Required"); this.required = config.Required;
this.optional = ConfigManager.languageConfig.get().getString("Commands.Help.Optional"); this.optional = config.Optional;
this.properUsage = ConfigManager.languageConfig.get().getString("Commands.Help.ProperUsage"); this.properUsage = config.ProperUsage;
this.learnMore = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.LearnMore"); this.learnMore = config.LearnMore;
this.air = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Air"); this.air = ConfigManager.getConfig(AirPropertiesConfig.class).Description;
this.water = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Water"); this.water = ConfigManager.getConfig(WaterPropertiesConfig.class).Description;
this.earth = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Earth"); this.earth = ConfigManager.getConfig(EarthPropertiesConfig.class).Description;
this.fire = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Fire"); this.fire = ConfigManager.getConfig(FirePropertiesConfig.class).Description;
this.chi = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Chi"); this.chi = ConfigManager.getConfig(ChiPropertiesConfig.class).Description;
this.avatar = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Avatar"); this.avatar = ConfigManager.getConfig(AvatarPropertiesConfig.class).Description;
this.invalidTopic = ConfigManager.languageConfig.get().getString("Commands.Help.InvalidTopic"); this.invalidTopic = config.InvalidTopic;
this.usage = ConfigManager.languageConfig.get().getString("Commands.Help.Usage"); this.usage = config.Usage;
this.rpgUsage = ConfigManager.languageConfig.get().getString("Command.Help.RPGUsage"); this.rpgUsage = config.RPGUsage;
this.spiritsUsage = ConfigManager.languageConfig.get().getString("Commands.Help.SpiritsUsage"); this.spiritsUsage = config.SpiritsUsage;
this.itemsUsage = ConfigManager.languageConfig.get().getString("Commands.Help.ItemsUsage"); this.itemsUsage = config.ItemsUsage;
} }
@Override @Override

View file

@ -6,15 +6,15 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.InvincibleCommandConfig;
/** /**
* Executor for /bending invincible. Extends {@link PKCommand}. * Executor for /bending invincible. Extends {@link PKCommand}.
*/ */
public class InvincibleCommand extends PKCommand { public class InvincibleCommand extends PKCommand<InvincibleCommandConfig> {
public InvincibleCommand() { public InvincibleCommand(final InvincibleCommandConfig config) {
super("invincible", "/bending invincible", ConfigManager.languageConfig.get().getString("Commands.Invincible.Description"), new String[] { "invincible", "inv", "i" }); super(config, "invincible", "/bending invincible", config.Description, new String[] { "invincible", "inv", "i" });
} }
@ -26,10 +26,10 @@ public class InvincibleCommand extends PKCommand {
if (!Commands.invincible.contains(sender.getName())) { if (!Commands.invincible.contains(sender.getName())) {
Commands.invincible.add(sender.getName()); Commands.invincible.add(sender.getName());
GeneralMethods.sendBrandingMessage(sender, ChatColor.GREEN + ConfigManager.languageConfig.get().getString("Commands.Invincible.ToggledOn")); GeneralMethods.sendBrandingMessage(sender, ChatColor.GREEN + config.ToggledOn);
} else { } else {
Commands.invincible.remove(sender.getName()); Commands.invincible.remove(sender.getName());
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Invincible.ToggledOff")); GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + config.ToggledOff);
} }
} }

View file

@ -14,15 +14,17 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.CommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.CommandPropertiesConfig;
/** /**
* Abstract representation of a command executor. Implements {@link SubCommand}. * Abstract representation of a command executor. Implements {@link SubCommand}.
* *
* @author kingbirdy
* *
*/ */
public abstract class PKCommand implements SubCommand { @SuppressWarnings("rawtypes")
public abstract class PKCommand<C extends CommandConfig> implements SubCommand<C> {
protected String noPermissionMessage, mustBePlayerMessage; protected String noPermissionMessage, mustBePlayerMessage;
@ -43,19 +45,25 @@ public abstract class PKCommand implements SubCommand {
* String[] of all possible aliases of the command. * String[] of all possible aliases of the command.
*/ */
private final String[] aliases; private final String[] aliases;
/**
* Language config of the command
*/
protected final C config;
/** /**
* List of all command executors which extends PKCommand * List of all command executors which extends PKCommand
*/ */
public static Map<String, PKCommand> instances = new HashMap<String, PKCommand>(); public static Map<String, PKCommand> instances = new HashMap<String, PKCommand>();
public PKCommand(final String name, final String properUse, final String description, final String[] aliases) { public PKCommand(final C config, final String name, final String properUse, final String description, final String[] aliases) {
this.name = name; this.name = name;
this.properUse = properUse; this.properUse = properUse;
this.description = description; this.description = description;
this.aliases = aliases; this.aliases = aliases;
this.config = config;
this.noPermissionMessage = ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.NoPermission"); CommandPropertiesConfig properties = ConfigManager.getConfig(CommandPropertiesConfig.class);
this.mustBePlayerMessage = ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.MustBePlayer"); this.noPermissionMessage = ChatColor.RED + properties.NoPermission;
this.mustBePlayerMessage = ChatColor.RED + properties.MustBePlayer;
instances.put(name, this); instances.put(name, this);
} }
@ -79,6 +87,11 @@ public abstract class PKCommand implements SubCommand {
public String[] getAliases() { public String[] getAliases() {
return this.aliases; return this.aliases;
} }
@Override
public C getLanguageConfig() {
return this.config;
}
@Override @Override
public void help(final CommandSender sender, final boolean description) { public void help(final CommandSender sender, final boolean description) {

View file

@ -10,14 +10,14 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.PermaremoveCommandConfig;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
/** /**
* Executor for /bending permaremove. Extends {@link PKCommand}. * Executor for /bending permaremove. Extends {@link PKCommand}.
*/ */
public class PermaremoveCommand extends PKCommand { public class PermaremoveCommand extends PKCommand<PermaremoveCommandConfig> {
private final String playerIsOffline; private final String playerIsOffline;
private final String restored; private final String restored;
@ -25,14 +25,14 @@ public class PermaremoveCommand extends PKCommand {
private final String removed; private final String removed;
private final String removedConfirm; private final String removedConfirm;
public PermaremoveCommand() { public PermaremoveCommand(final PermaremoveCommandConfig config) {
super("permaremove", "/bending permaremove <Player>", ConfigManager.languageConfig.get().getString("Commands.PermaRemove.Description"), new String[] { "permaremove", "premove", "permremove", "pr" }); super(config, "permaremove", "/bending permaremove <Player>", config.Description, new String[] { "permaremove", "premove", "permremove", "pr" });
this.playerIsOffline = ConfigManager.languageConfig.get().getString("Commands.PermaRemove.PlayerOffline"); this.playerIsOffline = config.PlayerOffline;
this.restored = ConfigManager.languageConfig.get().getString("Commands.PermaRemove.Restored"); this.restored = config.Restored;
this.restoredConfirm = ConfigManager.languageConfig.get().getString("Commands.PermaRemove.RestoredConfirm"); this.restoredConfirm = config.Restored_Other;
this.removed = ConfigManager.languageConfig.get().getString("Commands.PermaRemove.Removed"); this.removed = config.Removed;
this.removedConfirm = ConfigManager.languageConfig.get().getString("Commands.PermaRemove.RemovedConfirm"); this.removedConfirm = config.Removed_Other;
} }
@Override @Override

View file

@ -2,7 +2,6 @@ package com.projectkorra.projectkorra.command;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -13,13 +12,15 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.commands.PresetCommandConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.CommandPropertiesConfig;
import com.projectkorra.projectkorra.object.Preset; import com.projectkorra.projectkorra.object.Preset;
/** /**
* Executor for /bending preset. Extends {@link PKCommand}. * Executor for /bending preset. Extends {@link PKCommand}.
*/ */
public class PresetCommand extends PKCommand { public class PresetCommand extends PKCommand<PresetCommandConfig> {
private static final String[] createaliases = { "create", "c", "save" }; private static final String[] createaliases = { "create", "c", "save" };
private static final String[] deletealiases = { "delete", "d", "del" }; private static final String[] deletealiases = { "delete", "d", "del" };
@ -41,23 +42,23 @@ public class PresetCommand extends PKCommand {
private final String createdNewPreset; private final String createdNewPreset;
private final String cantEditBinds; private final String cantEditBinds;
public PresetCommand() { public PresetCommand(final PresetCommandConfig config) {
super("preset", "/bending preset <Bind/Create/Delete/List> [Preset]", ConfigManager.languageConfig.get().getString("Commands.Preset.Description"), new String[] { "preset", "presets", "pre", "set", "p" }); super(config, "preset", "/bending preset <Bind/Create/Delete/List> [Preset]", config.Description, new String[] { "preset", "presets", "pre", "set", "p" });
this.noPresets = ConfigManager.languageConfig.get().getString("Commands.Preset.NoPresets"); this.noPresets = config.NoPresets;
this.noPresetName = ConfigManager.languageConfig.get().getString("Commands.Preset.NoPresetName"); this.noPresetName = config.NoPresetName;
this.deletePreset = ConfigManager.languageConfig.get().getString("Commands.Preset.Delete"); this.deletePreset = config.Delete;
this.noPresetNameExternal = ConfigManager.languageConfig.get().getString("Commands.Preset.External.NoPresetName"); this.noPresetNameExternal = config.NoPresetName_External;
this.bendingRemoved = ConfigManager.languageConfig.get().getString("Commands.Preset.BendingPermanentlyRemoved"); this.bendingRemoved = ConfigManager.getConfig(CommandPropertiesConfig.class).BendingPermanentlyRemoved;
this.bound = ConfigManager.languageConfig.get().getString("Commands.Preset.SuccesfullyBound"); this.bound = config.SuccessfullyBound;
this.failedToBindAll = ConfigManager.languageConfig.get().getString("Commands.Preset.FailedToBindAll"); this.failedToBindAll = config.FailedToBindAll;
this.bendingRemovedOther = ConfigManager.languageConfig.get().getString("Commands.Preset.Other.BendingPermanentlyRemoved"); this.bendingRemovedOther = ConfigManager.getConfig(CommandPropertiesConfig.class).BendingPermanentlyRemoved_Other;
this.boundOtherConfirm = ConfigManager.languageConfig.get().getString("Commands.Preset.Other.SuccesfullyBoundConfirm"); this.boundOtherConfirm = config.SuccessfullyBound_Other;
this.succesfullyCopied = ConfigManager.languageConfig.get().getString("Commands.Preset.SuccesfullyCopied"); this.succesfullyCopied = config.SuccessfullyCopied;
this.reachedMax = ConfigManager.languageConfig.get().getString("Commands.Preset.MaxPresets"); this.reachedMax = config.MaxPresets;
this.alreadyExists = ConfigManager.languageConfig.get().getString("Commands.Preset.AlreadyExists"); this.alreadyExists = config.AlreadyExists;
this.createdNewPreset = ConfigManager.languageConfig.get().getString("Commands.Preset.Created"); this.createdNewPreset = config.Created;
this.cantEditBinds = ConfigManager.languageConfig.get().getString("Commands.Preset.CantEditBinds"); this.cantEditBinds = config.CantEditBinds;
} }
@Override @Override
@ -173,7 +174,7 @@ public class PresetCommand extends PKCommand {
} }
return; return;
} else { } else {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + config.PlayerNotFound);
} }
} else if (this.hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) { } else if (this.hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) {
if (!Preset.presetExists(player, name)) { if (!Preset.presetExists(player, name)) {
@ -203,7 +204,7 @@ public class PresetCommand extends PKCommand {
} }
return; return;
} else { } else {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + config.PlayerNotFound);
} }
} }
} else if (Arrays.asList(createaliases).contains(args.get(0)) && this.hasPermission(sender, "create")) { // bending preset create name. } else if (Arrays.asList(createaliases).contains(args.get(0)) && this.hasPermission(sender, "create")) { // bending preset create name.

View file

@ -6,15 +6,15 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.ReloadCommandConfig;
/** /**
* Executor for /bending reload. Extends {@link PKCommand}. * Executor for /bending reload. Extends {@link PKCommand}.
*/ */
public class ReloadCommand extends PKCommand { public class ReloadCommand extends PKCommand<ReloadCommandConfig> {
public ReloadCommand() { public ReloadCommand(final ReloadCommandConfig config) {
super("reload", "/bending reload", ConfigManager.languageConfig.get().getString("Commands.Reload.Description"), new String[] { "reload", "r" }); super(config, "reload", "/bending reload", config.Description, new String[] { "reload", "r" });
} }
@Override @Override
@ -23,7 +23,7 @@ public class ReloadCommand extends PKCommand {
return; return;
} }
GeneralMethods.reloadPlugin(sender); GeneralMethods.reloadPlugin(sender);
sender.sendMessage(ChatColor.AQUA + ConfigManager.languageConfig.get().getString("Commands.Reload.SuccessfullyReloaded")); sender.sendMessage(ChatColor.AQUA + config.SuccessfullyReloaded);
} }
} }

View file

@ -12,7 +12,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.RemoveCommandConfig;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result; import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent; import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent;
@ -20,22 +20,22 @@ import com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent;
/** /**
* Executor for /bending remove. Extends {@link PKCommand}. * Executor for /bending remove. Extends {@link PKCommand}.
*/ */
public class RemoveCommand extends PKCommand { public class RemoveCommand extends PKCommand<RemoveCommandConfig> {
private final String succesfullyRemovedElementSelf, wrongElementSelf, invalidElement, playerOffline, wrongElementTarget, succesfullyRemovedElementTarget, succesfullyRemovedElementTargetConfirm, succesfullyRemovedAllElementsTarget, succesfullyRemovedAllElementsTargetConfirm; private final String succesfullyRemovedElementSelf, wrongElementSelf, invalidElement, playerOffline, wrongElementTarget, succesfullyRemovedElementTarget, succesfullyRemovedElementTargetConfirm, succesfullyRemovedAllElementsTarget, succesfullyRemovedAllElementsTargetConfirm;
public RemoveCommand() { public RemoveCommand(final RemoveCommandConfig config) {
super("remove", "/bending remove <Player> [Element]", ConfigManager.languageConfig.get().getString("Commands.Remove.Description"), new String[] { "remove", "rm" }); super(config, "remove", "/bending remove <Player> [Element]", config.Description, new String[] { "remove", "rm" });
this.succesfullyRemovedElementSelf = ConfigManager.languageConfig.get().getString("Commands.Remove.RemovedElement"); this.succesfullyRemovedElementSelf = config.RemovedElement;
this.succesfullyRemovedAllElementsTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedAllElements"); this.succesfullyRemovedAllElementsTarget = config.RemovedAllElements_ByOther;
this.succesfullyRemovedAllElementsTargetConfirm = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedAllElementsConfirm"); this.succesfullyRemovedAllElementsTargetConfirm = config.RemovedAllElements_Other;
this.succesfullyRemovedElementTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedElement"); this.succesfullyRemovedElementTarget = config.RemovedElement_ByOther;
this.succesfullyRemovedElementTargetConfirm = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.RemovedElementConfirm"); this.succesfullyRemovedElementTargetConfirm = config.RemovedAllElements_Other;
this.invalidElement = ConfigManager.languageConfig.get().getString("Commands.Remove.InvalidElement"); this.invalidElement = config.InvalidElement;
this.wrongElementSelf = ConfigManager.languageConfig.get().getString("Commands.Remove.WrongElement"); this.wrongElementSelf = config.WrongElement;
this.wrongElementTarget = ConfigManager.languageConfig.get().getString("Commands.Remove.Other.WrongElement"); this.wrongElementTarget = config.WrongElement_Other;
this.playerOffline = ConfigManager.languageConfig.get().getString("Commands.Remove.PlayerOffline"); this.playerOffline = config.PlayerOffline;
} }
@Override @Override

View file

@ -20,12 +20,13 @@ import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.StatsCommandConfig;
import com.projectkorra.projectkorra.storage.DBConnection; import com.projectkorra.projectkorra.storage.DBConnection;
import com.projectkorra.projectkorra.util.Statistic; import com.projectkorra.projectkorra.util.Statistic;
import com.projectkorra.projectkorra.util.StatisticsMethods; import com.projectkorra.projectkorra.util.StatisticsMethods;
public class StatsCommand extends PKCommand { @SuppressWarnings("rawtypes")
public class StatsCommand extends PKCommand<StatsCommandConfig> {
private static final String[] getaliases = { "get", "g" }; private static final String[] getaliases = { "get", "g" };
private static final String[] leaderboardaliases = { "leaderboard", "lb", "l" }; private static final String[] leaderboardaliases = { "leaderboard", "lb", "l" };
@ -35,13 +36,13 @@ public class StatsCommand extends PKCommand {
private final String invalidStatistic; private final String invalidStatistic;
private final String invalidPlayer; private final String invalidPlayer;
public StatsCommand() { public StatsCommand(final StatsCommandConfig config) {
super("stats", "/bending stats <get/leaderboard> <ability/element/all> <statistic> [player/page]", ConfigManager.languageConfig.get().getString("Commands.Stats.Description"), new String[] { "statistics", "stats" }); super(config, "stats", "/bending stats <get/leaderboard> <ability/element/all> <statistic> [player/page]", config.Description, new String[] { "statistics", "stats" });
this.invalidLookup = ConfigManager.languageConfig.get().getString("Commands.Stats.InvalidLookup"); this.invalidLookup = config.InvalidLookup;
this.invalidSearchType = ConfigManager.languageConfig.get().getString("Commands.Stats.InvalidSearchType"); this.invalidSearchType = config.InvalidSearchType;
this.invalidStatistic = ConfigManager.languageConfig.get().getString("Commands.Stats.InvalidStatistic"); this.invalidStatistic = config.InvalidStatistic;
this.invalidPlayer = ConfigManager.languageConfig.get().getString("Commands.Stats.InvalidPlayer"); this.invalidPlayer = config.InvalidPlayer;
} }
@Override @Override

View file

@ -4,10 +4,12 @@ import java.util.List;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.projectkorra.projectkorra.configuration.better.configs.commands.CommandConfig;
/** /**
* Interface representation of a command executor. * Interface representation of a command executor.
*/ */
public interface SubCommand { public interface SubCommand<C extends CommandConfig> {
/** /**
* Gets the name of the command. * Gets the name of the command.
* *
@ -36,6 +38,12 @@ public interface SubCommand {
* @return the description * @return the description
*/ */
public String getDescription(); public String getDescription();
/**
* Gets the language config of the command.
* @return the config
*/
public C getLanguageConfig();
/** /**
* Outputs the correct usage, and optionally the description, of a command * Outputs the correct usage, and optionally the description, of a command

View file

@ -7,41 +7,38 @@ import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.ToggleCommandConfig;
/** /**
* Executor for /bending toggle. Extends {@link PKCommand}. * Executor for /bending toggle. Extends {@link PKCommand}.
*/ */
public class ToggleCommand extends PKCommand { public class ToggleCommand extends PKCommand<ToggleCommandConfig> {
private final String toggledOffForAll, toggleOffSelf, toggleOnSelf, toggleOffAll, toggleOnAll, toggledOffSingleElement, toggledOnSingleElement, wrongElementOther, toggledOnOtherElementConfirm, toggledOffOtherElementConfirm, toggledOnOtherElement, toggledOffOtherElement, wrongElement, notFound; private final String toggledOffForAll, toggleOffSelf, toggleOnSelf, toggleOffAll, toggleOnAll, toggledOffSingleElement, toggledOnSingleElement, wrongElementOther, toggledOnOtherElementConfirm, toggledOffOtherElementConfirm, toggledOnOtherElement, toggledOffOtherElement, wrongElement, notFound;
public ToggleCommand() { public ToggleCommand(final ToggleCommandConfig config) {
super("toggle", "/bending toggle <All/Element/Player> [Player]", ConfigManager.languageConfig.get().getString("Commands.Toggle.Description"), new String[] { "toggle", "t" }); super(config, "toggle", "/bending toggle <All/Element/Player> [Player]", config.Description, new String[] { "toggle", "t" });
final FileConfiguration c = ConfigManager.languageConfig.get(); this.toggledOffForAll = config.ToggledOffForAll;
this.toggleOffSelf = config.ToggledOff;
this.toggledOffForAll = c.getString("Commands.Toggle.All.ToggledOffForAll"); this.toggleOnSelf = config.ToggledOn;
this.toggleOffSelf = c.getString("Commands.Toggle.ToggledOff"); this.toggleOffAll = config.ToggledOff_All;
this.toggleOnSelf = c.getString("Commands.Toggle.ToggledOn"); this.toggleOnAll = config.ToggledOn_All;
this.toggleOffAll = c.getString("Commands.Toggle.All.ToggleOff"); this.toggledOffSingleElement = config.ToggledOffSingleElement;
this.toggleOnAll = c.getString("Commands.Toggle.All.ToggleOn"); this.toggledOnSingleElement = config.ToggledOnSingleElement;
this.toggledOffSingleElement = c.getString("Commands.Toggle.ToggleOffSingleElement"); this.wrongElementOther = config.WrongElement_Other;
this.toggledOnSingleElement = c.getString("Commands.Toggle.ToggleOnSingleElement"); this.toggledOnOtherElementConfirm = config.ToggledOn_Other;
this.wrongElementOther = c.getString("Commands.Toggle.Other.WrongElement"); this.toggledOffOtherElementConfirm = config.ToggledOff_Other;
this.toggledOnOtherElementConfirm = c.getString("Commands.Toggle.Other.ToggledOnElementConfirm"); this.toggledOnOtherElement = config.ToggledOn_ByOther;
this.toggledOffOtherElementConfirm = c.getString("Commands.Toggle.Other.ToggledOffElementConfirm"); this.toggledOffOtherElement = config.ToggledOff_ByOther;
this.toggledOnOtherElement = c.getString("Commands.Toggle.Other.ToggledOnElementByOther"); this.wrongElement = config.WrongElement;
this.toggledOffOtherElement = c.getString("Commands.Toggle.Other.ToggledOffElementByOther"); this.notFound = config.PlayerNotFound;
this.wrongElement = c.getString("Commands.Toggle.WrongElement");
this.notFound = c.getString("Commands.Toggle.Other.PlayerNotFound");
} }
@Override @Override

View file

@ -7,15 +7,15 @@ import org.bukkit.command.CommandSender;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.VersionCommandConfig;
/** /**
* Executor for /bending version. Extends {@link PKCommand}. * Executor for /bending version. Extends {@link PKCommand}.
*/ */
public class VersionCommand extends PKCommand { public class VersionCommand extends PKCommand<VersionCommandConfig> {
public VersionCommand() { public VersionCommand(final VersionCommandConfig config) {
super("version", "/bending version", ConfigManager.languageConfig.get().getString("Commands.Version.Description"), new String[] { "version", "v" }); super(config, "version", "/bending version", config.Description, new String[] { "version", "v" });
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,25 +29,26 @@ import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.better.configs.commands.WhoCommandConfig;
/** /**
* Executor for /bending who. Extends {@link PKCommand}. * Executor for /bending who. Extends {@link PKCommand}.
*/ */
public class WhoCommand extends PKCommand { @SuppressWarnings({ "rawtypes", "deprecation" })
public class WhoCommand extends PKCommand<WhoCommandConfig> {
/** /**
* Map storage of all ProjectKorra staffs' UUIDs and titles * Map storage of all ProjectKorra staffs' UUIDs and titles
*/ */
final Map<String, String> staff = new HashMap<>(); final Map<String, String> staff = Collections.synchronizedMap(new HashMap<>());
private final String databaseOverload, noPlayersOnline, playerOffline; private final String databaseOverload, noPlayersOnline, playerOffline;
public WhoCommand() { public WhoCommand(final WhoCommandConfig config) {
super("who", "/bending who [Page/Player]", ConfigManager.languageConfig.get().getString("Commands.Who.Description"), new String[] { "who", "w" }); super(config, "who", "/bending who [Page/Player]", config.Description, new String[] { "who", "w" });
this.databaseOverload = ConfigManager.languageConfig.get().getString("Commands.Who.DatabaseOverload"); this.databaseOverload = config.DatabaseOverload;
this.noPlayersOnline = ConfigManager.languageConfig.get().getString("Commands.Who.NoPlayersOnline"); this.noPlayersOnline = config.NoPlayersOnline;
this.playerOffline = ConfigManager.languageConfig.get().getString("Commands.Who.PlayerOffline"); this.playerOffline = config.PlayerOffline;
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override

View file

@ -0,0 +1,29 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class AddCommandConfig extends CommandConfig {
public final String PlayerNotFound = "";
public final String InvalidElement = "";
public final String SuccessfullyAddedCFW_Other = "";
public final String SuccessfullyAddedCFW = "";
public final String SuccessfullyAddedAE_Other = "";
public final String SuccessfullyAddedAE = "";
public final String SuccessfullyAddedAll_Other = "";
public final String SuccessfullyAddedAll = "";
public final String AlreadyHasElement_Other = "";
public final String AlreadyHasElement = "";
public final String AlreadyHasSubElement_Other = "";
public final String AlreadyHasSubElement = "";
public final String AlreadyHasAllElements_Other = "";
public final String AlreadyHasAllElements = "";
public AddCommandConfig() {
super("");
}
@Override
public String getName() {
return "Add";
}
}

View file

@ -1,10 +1,7 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands; package com.projectkorra.projectkorra.configuration.better.configs.commands;
import com.projectkorra.projectkorra.configuration.better.Config; public class BindCommandConfig extends CommandConfig {
public class BindCommandConfig implements Config {
public final String Description = "";
public final String SuccessfullyBoundMessage = ""; public final String SuccessfullyBoundMessage = "";
public final String AbilityDoesntExistMessage = ""; public final String AbilityDoesntExistMessage = "";
public final String WrongNumberMessage = ""; public final String WrongNumberMessage = "";
@ -15,14 +12,13 @@ public class BindCommandConfig implements Config {
public final String NoSubElementMessage = ""; public final String NoSubElementMessage = "";
public final String UnbindableMessage = ""; public final String UnbindableMessage = "";
public BindCommandConfig() {
super("");
}
@Override @Override
public String getName() { public String getName() {
return "Bind"; return "Bind";
} }
@Override
public String[] getParents() {
return new String[] { "Commands" };
}
} }

View file

@ -0,0 +1,19 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class CheckCommandConfig extends CommandConfig {
public final String NewVersionAvailable = "";
public final String CurrentVersion = "";
public final String LatestVersion = "";
public final String UpToDate = "";
public CheckCommandConfig() {
super("");
}
@Override
public String getName() {
return "Check";
}
}

View file

@ -0,0 +1,22 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class ChooseCommandConfig extends CommandConfig {
public final String PlayerNotFound = "";
public final String InvalidElement = "";
public final String OnCooldown = "";
public final String SuccessfullyChosenCFW_Other = "";
public final String SuccessfullyChosenCFW = "";
public final String SuccessfullyChosenAE_Other = "";
public final String SuccessfullyChosenAE = "";
public ChooseCommandConfig() {
super("");
}
@Override
public String getName() {
return "Choose";
}
}

View file

@ -0,0 +1,20 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class ClearCommandConfig extends CommandConfig {
public final String CantEditBinds = "";
public final String Cleared = "";
public final String WrongNumber = "";
public final String ClearedSlot = "";
public final String AlreadyEmpty = "";
public ClearCommandConfig() {
super("");
}
@Override
public String getName() {
return "Clear";
}
}

View file

@ -0,0 +1,18 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
import com.projectkorra.projectkorra.configuration.better.Config;
public abstract class CommandConfig implements Config {
public final String Description;
public CommandConfig(String description) {
Description = description;
}
@Override
public String[] getParents() {
return new String[] { "Commands" };
}
}

View file

@ -0,0 +1,19 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class CopyCommandConfig extends CommandConfig {
public final String PlayerNotFound = "";
public final String SuccessfullyCopied = "";
public final String SuccessfullyCopied_Other = "";
public final String FailedToBindAll = "";
public CopyCommandConfig() {
super("");
}
@Override
public String getName() {
return "Copy";
}
}

View file

@ -0,0 +1,16 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class DebugCommandConfig extends CommandConfig {
public final String SuccessfullyExported = "";
public DebugCommandConfig() {
super("");
}
@Override
public String getName() {
return "Debug";
}
}

View file

@ -0,0 +1,20 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class DisplayCommandConfig extends CommandConfig {
public final String NoCombosAvailable = "";
public final String NoPassivesAvailable = "";
public final String NoAbilitiesAvailable = "";
public final String InvalidArgument = "";
public final String NoBinds = "";
public DisplayCommandConfig() {
super("");
}
@Override
public String getName() {
return "Display";
}
}

View file

@ -0,0 +1,24 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class HelpCommandConfig extends CommandConfig {
public final String Required = "";
public final String Optional = "";
public final String ProperUsage = "";
public final String LearnMore = "";
public final String InvalidTopic = "";
public final String Usage = "";
public final String RPGUsage = "";
public final String SpiritsUsage = "";
public final String ItemsUsage = "";
public HelpCommandConfig() {
super("");
}
@Override
public String getName() {
return "Help";
}
}

View file

@ -0,0 +1,17 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class InvincibleCommandConfig extends CommandConfig {
public final String ToggledOn = "";
public final String ToggledOff = "";
public InvincibleCommandConfig() {
super("");
}
@Override
public String getName() {
return "Invincible";
}
}

View file

@ -0,0 +1,20 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class PermaremoveCommandConfig extends CommandConfig {
public final String PlayerOffline = "";
public final String Restored = "";
public final String Restored_Other = "";
public final String Removed = "";
public final String Removed_Other = "";
public PermaremoveCommandConfig() {
super("");
}
@Override
public String getName() {
return "Permaremove";
}
}

View file

@ -0,0 +1,28 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class PresetCommandConfig extends CommandConfig {
public final String NoPresets = "";
public final String NoPresetName = "";
public final String NoPresetName_External = "";
public final String Delete = "";
public final String SuccessfullyBound = "";
public final String SuccessfullyBound_Other = "";
public final String FailedToBindAll = "";
public final String SuccessfullyCopied = "";
public final String MaxPresets = "";
public final String AlreadyExists = "";
public final String Created = "";
public final String CantEditBinds = "";
public final String PlayerNotFound = "";
public PresetCommandConfig() {
super("");
}
@Override
public String getName() {
return "Preset";
}
}

View file

@ -0,0 +1,16 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class ReloadCommandConfig extends CommandConfig {
public final String SuccessfullyReloaded = "";
public ReloadCommandConfig() {
super("");
}
@Override
public String getName() {
return "Reload";
}
}

View file

@ -0,0 +1,24 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class RemoveCommandConfig extends CommandConfig {
public final String RemovedElement = "";
public final String RemovedElement_Other = "";
public final String RemovedElement_ByOther = "";
public final String RemovedAllElements_Other = "";
public final String RemovedAllElements_ByOther = "";
public final String InvalidElement = "";
public final String WrongElement = "";
public final String WrongElement_Other = "";
public final String PlayerOffline = "";
public RemoveCommandConfig() {
super("");
}
@Override
public String getName() {
return "Remove";
}
}

View file

@ -0,0 +1,19 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class StatsCommandConfig extends CommandConfig {
public final String InvalidLookup = "";
public final String InvalidSearchType = "";
public final String InvalidStatistic = "";
public final String InvalidPlayer = "";
public StatsCommandConfig() {
super("");
}
@Override
public String getName() {
return "Stats";
}
}

View file

@ -0,0 +1,33 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class ToggleCommandConfig extends CommandConfig {
public final String ToggledOn = "";
public final String ToggledOn_ByOther = "";
public final String ToggledOn_Other = "";
public final String ToggledOn_All = "";
public final String ToggledOff = "";
public final String ToggledOff_ByOther = "";
public final String ToggledOff_Other = "";
public final String ToggledOff_All = "";
public final String ToggledOffForAll = "";
public final String ToggledOffSingleElement = "";
public final String ToggledOffSingleElement_ByOther = "";
public final String ToggledOffSingleElement_Other = "";
public final String ToggledOnSingleElement = "";
public final String ToggledOnSingleElement_ByOther = "";
public final String ToggledOnSingleElement_Other = "";
public final String WrongElement = "";
public final String WrongElement_Other = "";
public final String PlayerNotFound = "";
public ToggleCommandConfig() {
super("");
}
@Override
public String getName() {
return "Toggle";
}
}

View file

@ -0,0 +1,14 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class VersionCommandConfig extends CommandConfig {
public VersionCommandConfig() {
super("");
}
@Override
public String getName() {
return "Version";
}
}

View file

@ -0,0 +1,18 @@
package com.projectkorra.projectkorra.configuration.better.configs.commands;
public class WhoCommandConfig extends CommandConfig {
public final String DatabaseOverload = "";
public final String NoPlayersOnline = "";
public final String PlayerOffline = "";
public WhoCommandConfig() {
super("");
}
@Override
public String getName() {
return "Who";
}
}

View file

@ -7,6 +7,8 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
public class AirPropertiesConfig implements Config { public class AirPropertiesConfig implements Config {
public final String Description = "";
public final ParticleEffect Particles = ParticleEffect.SPELL; public final ParticleEffect Particles = ParticleEffect.SPELL;
public final boolean PlaySound = true; public final boolean PlaySound = true;

View file

@ -0,0 +1,19 @@
package com.projectkorra.projectkorra.configuration.better.configs.properties;
import com.projectkorra.projectkorra.configuration.better.Config;
public class AvatarPropertiesConfig implements Config {
public final String Description = "";
@Override
public String getName() {
return "Avatar";
}
@Override
public String[] getParents() {
return new String[] { "Properties" };
}
}

View file

@ -4,6 +4,8 @@ import com.projectkorra.projectkorra.configuration.better.Config;
public class ChiPropertiesConfig implements Config { public class ChiPropertiesConfig implements Config {
public final String Description = "";
public final double BlockChiChance = 0; public final double BlockChiChance = 0;
public final long BlockChiDuration = 0; public final long BlockChiDuration = 0;

View file

@ -0,0 +1,23 @@
package com.projectkorra.projectkorra.configuration.better.configs.properties;
import com.projectkorra.projectkorra.configuration.better.Config;
public class CommandPropertiesConfig implements Config {
public final String NoPermission = "";
public final String MustBePlayer = "";
public final String BendingPermanentlyRemoved = "";
public final String BendingPermanentlyRemoved_Other = "";
@Override
public String getName() {
return "Command";
}
@Override
public String[] getParents() {
return new String[] { "Properties" };
}
}

View file

@ -7,6 +7,8 @@ import com.projectkorra.projectkorra.configuration.better.Config;
public class EarthPropertiesConfig implements Config { public class EarthPropertiesConfig implements Config {
public final String Description = "";
public final Material[] EarthBlocks = {}; public final Material[] EarthBlocks = {};
public final boolean RevertEarthbending = true; public final boolean RevertEarthbending = true;

View file

@ -7,6 +7,8 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
public class FirePropertiesConfig implements Config { public class FirePropertiesConfig implements Config {
public final String Description = "";
public final boolean Griefing = true; public final boolean Griefing = true;
public final long RevertTicks = 0; public final long RevertTicks = 0;
public final double DayFactor = 0; public final double DayFactor = 0;

View file

@ -18,6 +18,8 @@ public class GeneralPropertiesConfig implements Config {
public final long GlobalCooldown = 0; public final long GlobalCooldown = 0;
public final long ChooseCooldown = 0;
public final boolean TogglePassivesWithAllBending = true; public final boolean TogglePassivesWithAllBending = true;
public final int MaxPresets = 0; public final int MaxPresets = 0;

View file

@ -7,6 +7,8 @@ import com.projectkorra.projectkorra.configuration.better.Config;
public class WaterPropertiesConfig implements Config { public class WaterPropertiesConfig implements Config {
public final String Description = "";
public final Material[] WaterBlocks = {}; public final Material[] WaterBlocks = {};
public final double NightFactor = 0; public final double NightFactor = 0;

View file

@ -19,6 +19,7 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
* @author Simplicitee * @author Simplicitee
* *
*/ */
@SuppressWarnings("rawtypes")
public class MovementHandler { public class MovementHandler {
public static Set<MovementHandler> handlers = new HashSet<>(); public static Set<MovementHandler> handlers = new HashSet<>();

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.util;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
@SuppressWarnings("rawtypes")
public enum Statistic { public enum Statistic {
PLAYER_KILLS("PlayerKills", "player kills"), PLAYER_DAMAGE("PlayerDamage", "player damage"), TOTAL_KILLS("TotalKills", "total kills"), TOTAL_DAMAGE("TotalDamage", "total damage"); PLAYER_KILLS("PlayerKills", "player kills"), PLAYER_DAMAGE("PlayerDamage", "player damage"), TOTAL_KILLS("TotalKills", "total kills"), TOTAL_DAMAGE("TotalDamage", "total damage");

View file

@ -18,6 +18,7 @@ import com.projectkorra.projectkorra.storage.DBConnection;
import com.projectkorra.projectkorra.storage.MySQL; import com.projectkorra.projectkorra.storage.MySQL;
import com.projectkorra.projectkorra.storage.SQLite; import com.projectkorra.projectkorra.storage.SQLite;
@SuppressWarnings("rawtypes")
public class StatisticsManager extends Manager implements Runnable { public class StatisticsManager extends Manager implements Runnable {
/** /**

View file

@ -12,6 +12,7 @@ import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.storage.DBConnection; import com.projectkorra.projectkorra.storage.DBConnection;
@SuppressWarnings("rawtypes")
public class StatisticsMethods { public class StatisticsMethods {
/** /**

View file

@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
@SuppressWarnings("rawtypes")
public class TempArmor { public class TempArmor {
private static Map<LivingEntity, PriorityQueue<TempArmor>> INSTANCES = new ConcurrentHashMap<>(); private static Map<LivingEntity, PriorityQueue<TempArmor>> INSTANCES = new ConcurrentHashMap<>();