This commit is contained in:
Brianna O'Keefe 2018-11-23 17:46:25 -05:00
parent cacc94db40
commit f7de0d1da9
10 changed files with 41 additions and 51 deletions

View File

@ -1,6 +1,5 @@
package com.songoda.ultimaterepairing;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.ultimaterepairing.command.CommandManager;
import com.songoda.ultimaterepairing.editor.Editor;
@ -13,7 +12,6 @@ import com.songoda.ultimaterepairing.handlers.ParticleHandler;
import com.songoda.ultimaterepairing.handlers.RepairHandler;
import com.songoda.ultimaterepairing.utils.Debugger;
import com.songoda.ultimaterepairing.utils.SettingsManager;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@ -36,6 +34,10 @@ public final class UltimateRepairing extends JavaPlugin implements Listener {
private Editor editor;
public static UltimateRepairing getInstance() {
return INSTANCE;
}
private boolean checkVersion() {
int workingVersion = 13;
int currentVersion = Integer.parseInt(Bukkit.getServer().getClass()
@ -144,8 +146,4 @@ public final class UltimateRepairing extends JavaPlugin implements Listener {
public CommandManager getCommandManager() {
return commandManager;
}
public static UltimateRepairing getInstance() {
return INSTANCE;
}
}

View File

@ -6,8 +6,6 @@ import org.bukkit.inventory.ItemStack;
public class PlayerAnvilData {
public enum RepairType { ECONOMY, ITEM, XP }
private Location location;
private int price;
private RepairType type;
@ -17,54 +15,54 @@ public class PlayerAnvilData {
private boolean inRepair;
private boolean beingRepaired;
public void setLocation(Location location) {
this.location = location;
}
public Location getLocation() {
return location;
}
public void setPrice(int price) {
this.price = price;
public void setLocation(Location location) {
this.location = location;
}
public int getPrice() {
return price;
}
public void setType(RepairType type) {
this.type = type;
public void setPrice(int price) {
this.price = price;
}
public RepairType getType() {
return type;
}
public void setItem(Item item) {
this.item = item;
public void setType(RepairType type) {
this.type = type;
}
public Item getItem() {
return item;
}
public void setToBeRepaired(ItemStack toBeRepaired) {
this.toBeRepaired = toBeRepaired;
public void setItem(Item item) {
this.item = item;
}
public ItemStack getToBeRepaired() {
return toBeRepaired;
}
public void setLocations(Location locations) {
this.locations = locations;
public void setToBeRepaired(ItemStack toBeRepaired) {
this.toBeRepaired = toBeRepaired;
}
public Location getLocations() {
return locations;
}
public void setLocations(Location locations) {
this.locations = locations;
}
public boolean getInRepair() {
return inRepair;
}
@ -80,4 +78,6 @@ public class PlayerAnvilData {
public void setBeingRepaired(boolean beingRepaired) {
this.beingRepaired = beingRepaired;
}
public enum RepairType {ECONOMY, ITEM, XP}
}

View File

@ -5,12 +5,8 @@ import org.bukkit.command.CommandSender;
public abstract class AbstractCommand {
public enum ReturnType { SUCCESS, FAILURE, SYNTAX_ERROR }
private final AbstractCommand parent;
private final String command;
private final boolean noConsole;
protected AbstractCommand(String command, AbstractCommand parent, boolean noConsole) {
@ -38,4 +34,6 @@ public abstract class AbstractCommand {
public abstract String getSyntax();
public abstract String getDescription();
public enum ReturnType {SUCCESS, FAILURE, SYNTAX_ERROR}
}

View File

@ -2,7 +2,10 @@ package com.songoda.ultimaterepairing.command;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimaterepairing.UltimateRepairing;
import com.songoda.ultimaterepairing.command.commands.*;
import com.songoda.ultimaterepairing.command.commands.CommandRPAnvil;
import com.songoda.ultimaterepairing.command.commands.CommandReload;
import com.songoda.ultimaterepairing.command.commands.CommandSettings;
import com.songoda.ultimaterepairing.command.commands.CommandUltimateRepairing;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

View File

@ -1,6 +1,5 @@
package com.songoda.ultimaterepairing.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimaterepairing.UltimateRepairing;
import com.songoda.ultimaterepairing.command.AbstractCommand;
import org.bukkit.command.CommandSender;

View File

@ -2,9 +2,7 @@ package com.songoda.ultimaterepairing.editor;
import com.songoda.arconix.api.ArconixAPI;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.ultimaterepairing.UltimateRepairing;
import com.songoda.ultimaterepairing.anvil.PlayerAnvilData;
import com.songoda.ultimaterepairing.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -27,7 +25,6 @@ public class Editor {
}
public void open(Player player, Block block) {
editing.put(player.getUniqueId(), block);

View File

@ -18,7 +18,8 @@ public class PlayerListeners implements Listener {
@EventHandler
public void onLeave(PlayerQuitEvent event) {
if (!instance.getRepairHandler().hasInstance(event.getPlayer()) || !instance.getRepairHandler().getDataFor(event.getPlayer()).getInRepair()) return;
if (!instance.getRepairHandler().hasInstance(event.getPlayer()) || !instance.getRepairHandler().getDataFor(event.getPlayer()).getInRepair())
return;
PlayerAnvilData playerData = instance.getRepairHandler().getDataFor(event.getPlayer());
instance.getRepairHandler().removeItem(playerData, event.getPlayer());

View File

@ -2,7 +2,6 @@ package com.songoda.ultimaterepairing.handlers;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.ultimaterepairing.Locale;
import com.songoda.ultimaterepairing.UltimateRepairing;
import com.songoda.ultimaterepairing.anvil.PlayerAnvilData;
import com.songoda.ultimaterepairing.anvil.PlayerAnvilData.RepairType;

View File

@ -25,15 +25,12 @@ import java.util.regex.Pattern;
*/
public class SettingsManager implements Listener {
private String pluginName = "UltimateRepairing";
private static final Pattern SETTINGS_PATTERN = Pattern.compile("(.{1,28}(?:\\s|$))|(.{0,28})", Pattern.DOTALL);
private static ConfigWrapper defs;
private Map<Player, String> cat = new HashMap<>();
private final UltimateRepairing instance;
private String pluginName = "UltimateRepairing";
private Map<Player, String> cat = new HashMap<>();
private Map<Player, String> current = new HashMap<>();
public SettingsManager(UltimateRepairing plugin) {
this.instance = plugin;
@ -44,8 +41,6 @@ public class SettingsManager implements Listener {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
private Map<Player, String> current = new HashMap<>();
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
ItemStack clickedItem = event.getCurrentItem();