diff --git a/pom.xml b/pom.xml
index 4de151a..84a9abf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,17 +3,15 @@
4.0.0
cn.CityCraft
RealBackpacks
- 0.1.5-SNAPSHOT
+ 0.1.5
RealBackpacks
${project.name}
src
- src
-
- **/*.java
-
+ src/main/resources
+ true
@@ -25,6 +23,34 @@
1.7
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.3
+
+ false
+ true
+
+
+ cn.citycraft:PluginHelper
+
+
+
+
+ cn.citycraft.PluginHelper
+ ${project.groupId}.${project.artifactId}
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
@@ -32,6 +58,10 @@
spigot-repo
https://hub.spigotmc.org/nexus/content/groups/public/
+
+ sumcraft-repo
+ http://ci.sumcraft.net:8080/plugin/repository/everything/
+
@@ -40,13 +70,19 @@
jar
1.8.3-R0.1-SNAPSHOT
-
+
net.milkbowl.vault
VaultAPI
1.5
system
${project.basedir}/lib/Vault.jar
+
+ cn.citycraft
+ PluginHelper
+ jar
+ 1.0
+
UTF-8
diff --git a/src/cn/citycraft/RealBackpacks/config/Config.java b/src/cn/citycraft/RealBackpacks/config/Config.java
deleted file mode 100644
index b4e096c..0000000
--- a/src/cn/citycraft/RealBackpacks/config/Config.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package cn.citycraft.RealBackpacks.config;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.bukkit.plugin.Plugin;
-
-
-
-public class Config extends ConfigLoader {
- private static String CONFIG_NAME = "config.yml";
- private static FileConfig instance;
- private static File file;
-
- public Config(Plugin p) {
- super(p, CONFIG_NAME);
- file = new File(p.getDataFolder(), CONFIG_NAME);
- instance = super.getInstance();
- }
-
- public static void load(Plugin p) {
- new Config(p);
- }
-
- public static FileConfig getInstance() {
- return instance;
- }
-
- public static String getMessage(String path) {
- String message = instance.getString(path).replaceAll("&", "§");
- return message;
- }
-
- public static String[] getStringArray(String path) {
- return instance.getStringList(path).toArray(new String[0]);
- }
-
- public static void save(){
- try {
- instance.save(file);
- } catch (IOException e) {
- saveError(file);
- e.printStackTrace();
- }
- }
-}
diff --git a/src/cn/citycraft/RealBackpacks/config/ConfigLoader.java b/src/cn/citycraft/RealBackpacks/config/ConfigLoader.java
deleted file mode 100644
index e024fa8..0000000
--- a/src/cn/citycraft/RealBackpacks/config/ConfigLoader.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package cn.citycraft.RealBackpacks.config;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.bukkit.plugin.Plugin;
-
-public class ConfigLoader extends FileConfig {
- protected static FileConfig config;
- protected static boolean tip = true;
- protected static Plugin plugin;
-
- public ConfigLoader(Plugin p, File file) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, file, null, true);
- }
-
- public ConfigLoader(Plugin p, File file, boolean res) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, file, null, res);
- }
-
- public ConfigLoader(Plugin p, File file, String ver) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, file, ver, true);
- }
-
- public ConfigLoader(Plugin p, File file, String ver, boolean res) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, file, ver, res);
- }
-
- public ConfigLoader(Plugin p, String filename) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, new File(p.getDataFolder(), filename), null,
- true);
- }
-
- public ConfigLoader(Plugin p, String filename, boolean res) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, new File(p.getDataFolder(), filename), null, res);
- }
-
- public ConfigLoader(Plugin p, String filename, String ver) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, new File(p.getDataFolder(), filename), ver, true);
- }
-
- public ConfigLoader(Plugin p, String filename, String ver, boolean res) {
- ConfigLoader.plugin = p;
- config = loadConfig(p, new File(p.getDataFolder(), filename), ver, true);
- }
-
- public static FileConfig getInstance() {
- return config;
- }
-
- public FileConfig loadConfig(Plugin p, File file, String ver, boolean res) {
- tip = res ;
- if (!file.getParentFile().exists()) {
- file.getParentFile().mkdirs();
- p.getLogger().info("创建新的文件夹" + file.getParentFile().getAbsolutePath() + "...");
- }
- if (!file.exists()) {
- fileCreate(p, file, res);
- } else {
- if (ver != null) {
- FileConfig configcheck = init(file);
- String version = configcheck.getString("version");
- if (version == null || !version.equals(ver)) {
- p.saveResource(file.getName(), true);
- p.getLogger().warning(
- "配置文件: " + file.getName() + " 版本过低 正在升级...");
- }
- }
- }
- if (tip)
- p.getLogger().info(
- "载入配置文件: " + file.getName()
- + (ver != null ? " 版本: " + ver : ""));
- return init(file);
- }
-
- private void fileCreate(Plugin p, File file, boolean res) {
- if (res) {
- p.saveResource(file.getName(), false);
- } else {
- try {
- p.getLogger().info("创建新的配置文件" + file.getAbsolutePath() + "...");
- file.createNewFile();
- } catch (IOException e) {
- p.getLogger().info("配置文件" + file.getName() + "创建失败...");
- e.printStackTrace();
- }
- }
- }
-
- public static void saveError(File file) {
- plugin.getLogger().info("配置文件" + file.getName() + "保存错误...");
- }
-
-}
diff --git a/src/cn/citycraft/RealBackpacks/config/FileConfig.java b/src/cn/citycraft/RealBackpacks/config/FileConfig.java
deleted file mode 100644
index 3187efc..0000000
--- a/src/cn/citycraft/RealBackpacks/config/FileConfig.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package cn.citycraft.RealBackpacks.config;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.logging.Level;
-
-import org.apache.commons.lang.Validate;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.Configuration;
-import org.bukkit.configuration.InvalidConfigurationException;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.configuration.file.YamlConstructor;
-import org.bukkit.configuration.file.YamlRepresenter;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.representer.Representer;
-
-import com.google.common.base.Charsets;
-import com.google.common.io.Files;
-
-/**
- * An implementation of {@link Configuration} which saves all files in Yaml. Note that this
- * implementation is not synchronized.
- */
-public class FileConfig extends YamlConfiguration {
-
- public static FileConfig init(File file) {
- return FileConfig.loadConfiguration(file);
- }
-
- public static FileConfig loadConfiguration(File file) {
- Validate.notNull(file, "File cannot be null");
- FileConfig config = new FileConfig();
- try {
- config.load(file);
- } catch (FileNotFoundException ex) {
- } catch (IOException ex) {
- Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
- } catch (InvalidConfigurationException ex) {
- Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
- }
- return config;
- }
-
- protected final DumperOptions yamlOptions = new DumperOptions();
-
- protected final Representer yamlRepresenter = new YamlRepresenter();
-
- protected final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions);
-
- @Override
- public void load(File file) throws FileNotFoundException, IOException, InvalidConfigurationException {
- Validate.notNull(file, "File cannot be null");
- final FileInputStream stream = new FileInputStream(file);
- load(new InputStreamReader(stream, Charsets.UTF_8));
- }
-
- @Override
- public void load(Reader reader) throws IOException, InvalidConfigurationException {
- BufferedReader input = (reader instanceof BufferedReader) ? (BufferedReader) reader
- : new BufferedReader(reader);
- StringBuilder builder = new StringBuilder();
- try {
- String line;
- while ((line = input.readLine()) != null) {
- builder.append(line);
- builder.append('\n');
- }
- } finally {
- input.close();
- }
- loadFromString(builder.toString());
- }
-
- @Override
- public void save(File file) throws IOException {
- Validate.notNull(file, "File cannot be null");
- Files.createParentDirs(file);
- String data = saveToString();
- Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8);
- try {
- writer.write(data);
- } finally {
- writer.close();
- }
- }
-
- @Override
- public String saveToString() {
- yamlOptions.setIndent(options().indent());
- yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- String header = buildHeader();
- String dump = yaml.dump(getValues(false));
- if (dump.equals(BLANK_CONFIG)) {
- dump = "";
- }
- return header + dump;
- }
-}
diff --git a/src/cn/citycraft/RealBackpacks/config/PlayerConfig.java b/src/cn/citycraft/RealBackpacks/config/PlayerConfig.java
deleted file mode 100644
index 344eb79..0000000
--- a/src/cn/citycraft/RealBackpacks/config/PlayerConfig.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cn.citycraft.RealBackpacks.config;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-
-public class PlayerConfig extends ConfigLoader {
- private static String CONFIG_FOLDER = "userdate";
- private static FileConfig instance;
- private static File file;
-
- public PlayerConfig(Plugin p, String player) {
- super(p, CONFIG_FOLDER + File.separator + player + ".yml", false);
- file = new File(p.getDataFolder(), CONFIG_FOLDER + File.separator
- + player + ".yml");
- instance = super.getInstance();
- }
-
- public static FileConfig getInstance(Plugin p, Player player) {
- new PlayerConfig(p, player.getName());
- return instance;
- }
-
- public static FileConfig getInstance(Plugin p, String player) {
- new PlayerConfig(p, player);
- return instance;
- }
-
- public static String getMessage(String path) {
- String message = instance.getString(path).replaceAll("&", "§");
- return message;
- }
-
- public static String[] getStringArray(String path) {
- return instance.getStringList(path).toArray(new String[0]);
- }
-
- public static void save() {
- try {
- instance.save(file);
- } catch (IOException e) {
- saveError(file);
- e.printStackTrace();
- }
- }
-}
diff --git a/src/cn/citycraft/RealBackpacks/json/JSONArray.java b/src/cn/citycraft/RealBackpacks/json/JSONArray.java
deleted file mode 100644
index 520f48d..0000000
--- a/src/cn/citycraft/RealBackpacks/json/JSONArray.java
+++ /dev/null
@@ -1,419 +0,0 @@
-package cn.citycraft.RealBackpacks.json;
-
-/*
- * Copyright (c) 2002 JSON.org
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * The Software shall be used for Good, not Evil.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-public class JSONArray {
-
- private final ArrayList