From d5e048a6f4b48195bbd9f74b420817079aeb52ae Mon Sep 17 00:00:00 2001 From: Staartvin Date: Sun, 16 Aug 2015 17:25:17 +0200 Subject: [PATCH] Point to new Maven Repo Signed-off-by: Staartvin --- pom.xml | 95 ++--- .../plugins/pluginlibrary/PluginLibrary.java | 328 +++++++++--------- 2 files changed, 213 insertions(+), 210 deletions(-) diff --git a/pom.xml b/pom.xml index 99ac83a..c9471e8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,47 +1,50 @@ - - 4.0.0 - PluginLibrary - PluginLibrary - 1.0 - PluginLibrary - - src - - - src - - **/*.java - - - - - true - ${basedir} - - *.yml - - - - - - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - - - - - - git-Staartvin - Staartvin's Git based repo - https://github.com/Staartvin/maven-repo/raw/master/ - - - + + 4.0.0 + PluginLibrary + PluginLibrary + 1.0 + PluginLibrary + + src + + + src + + **/*.java + + + + + true + ${basedir} + + *.yml + + + + + + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + + + + + + Staartvin-Bitbucket-repo + https://bitbucket.org/Staartvin/maven-repo/raw/master/ + + + + stats-repo-snapshots + http://nexus.lolmewn.nl/content/repositories/snapshots/ + + + \ No newline at end of file diff --git a/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java b/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java index 4ede7b8..c45d866 100644 --- a/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java +++ b/src/me/staartvin/plugins/pluginlibrary/PluginLibrary.java @@ -1,164 +1,164 @@ -package me.staartvin.plugins.pluginlibrary; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import me.staartvin.plugins.pluginlibrary.hooks.LibraryHook; -import me.staartvin.plugins.pluginlibrary.hooks.customstats.CustomStatsManager; -import net.md_5.bungee.api.ChatColor; - -import org.bukkit.plugin.java.JavaPlugin; - -/** - * Main class of PluginLibrary - *

- * Date created: 14:06:30 12 aug. 2015 - * - * @author Staartvin - * - */ -public class PluginLibrary extends JavaPlugin { - - private final List loadedLibraries = new ArrayList(); - private CustomStatsManager customStatsManager; - - @Override - public void onEnable() { - - loadedLibraries.clear(); - - //this is a test - logMessage(ChatColor.GOLD + "***== Loading libraries ==***"); - logMessage(ChatColor.GOLD + "***== Loaded " + ChatColor.WHITE - + loadLibraries() + ChatColor.GOLD + " libraries! ==***"); - - if (this.isLibraryLoaded(Library.STATS)) { - // Register custom stats so that Stats has special mobs and food eaten requirement. - setCustomStatsManager(new CustomStatsManager(this)); - this.getCustomStatsManager().registerCustomStats(); - } - - logMessage(ChatColor.GOLD + "Loaded libraries: " - + getLoadedLibrariesAsString()); - - logMessage(ChatColor.GREEN - + "*** Ready for plugins to send/retrieve data. ***"); - - logMessage(this.getDescription().getFullName() + " is now enabled!"); - } - - @Override - public void onDisable() { - - loadedLibraries.clear(); - - logMessage(this.getDescription().getFullName() + " is now disabled!"); - } - - /** - * Load all libraries, this will be done automatically by the plugin. - * - * @return how many libraries were loaded. - */ - public int loadLibraries() { - int count = 0; - - for (Library l : Library.values()) { - if (l.getHook().isAvailable()) { - - // One more library loaded. - if (l.getHook().hook()) { - loadedLibraries.add(l); - count++; - } - - } - } - - return count; - } - - public void logMessage(String message) { - // This makes sure it can support colours. - this.getServer().getConsoleSender() - .sendMessage(ChatColor.GRAY + "[PluginLibrary] " + message); - } - - /** - * Get a list of all loaded libraries.
- * This list is unmodifiable and when you try to alter it, it will give an - * {@link UnsupportedOperationException}. - * - * @return a list of loaded libraries. - */ - public List getLoadedLibraries() { - return Collections.unmodifiableList(loadedLibraries); - } - - /** - * Gets the library for a specific plugin.
- * Will throw a {@link IllegalArgumentException} when there is no library - * with the given name. - * - * @param pluginName Name of the plugin. Case-insensitive! - * @return {@link me.staartvin.plugins.pluginlibrary.LibraryHook} class or - * an error. - */ - public static LibraryHook getLibrary(String pluginName) { - return Library.getEnum(pluginName).getHook(); - } - - /** - * @see #getLibrary(String) - *
- * Returns the same as {@link #getLibrary(String)}. - * @param lib Library enum to get the library hook for. - * @return {@link me.staartvin.plugins.pluginlibrary.LibraryHook} class or - * an error. - */ - public static LibraryHook getLibrary(Library lib) { - return lib.getHook(); - } - - /** - * Checks to see whether the library is loaded and thus ready for use. - * - * @param lib Library to check. - * @return true if the library is loaded; false otherwise. - */ - public boolean isLibraryLoaded(Library lib) { - return loadedLibraries.contains(lib); - } - - public CustomStatsManager getCustomStatsManager() { - return customStatsManager; - } - - public void setCustomStatsManager(CustomStatsManager customStatsManager) { - this.customStatsManager = customStatsManager; - } - - private String getLoadedLibrariesAsString() { - StringBuilder builder = new StringBuilder(""); - - for (int i = 0, l = loadedLibraries.size(); i < l; i++) { - if (i == 0) { - builder.append(ChatColor.DARK_AQUA - + loadedLibraries.get(i).getPluginName() + ChatColor.RESET); - } else if (i == (l - 1)) { - builder.append(ChatColor.GRAY - + " and " - + (ChatColor.DARK_AQUA - + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); - } else { - builder.append(ChatColor.GRAY - + ", " - + (ChatColor.DARK_AQUA - + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); - } - } - - return builder.toString(); - } -} +package me.staartvin.plugins.pluginlibrary; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import me.staartvin.plugins.pluginlibrary.hooks.LibraryHook; +import me.staartvin.plugins.pluginlibrary.hooks.customstats.CustomStatsManager; +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.plugin.java.JavaPlugin; + +/** + * Main class of PluginLibrary + *

+ * Date created: 14:06:30 12 aug. 2015 + * + * @author Staartvin + * + */ +public class PluginLibrary extends JavaPlugin { + + private final List loadedLibraries = new ArrayList(); + private CustomStatsManager customStatsManager; + + @Override + public void onEnable() { + + loadedLibraries.clear(); + + //this is a test + logMessage(ChatColor.GOLD + "***== Loading libraries ==***"); + logMessage(ChatColor.GOLD + "***== Loaded " + ChatColor.WHITE + + loadLibraries() + ChatColor.GOLD + " libraries! ==***"); + + if (this.isLibraryLoaded(Library.STATS)) { + // Register custom stats so that Stats has special mobs and food eaten requirement. + setCustomStatsManager(new CustomStatsManager(this)); + this.getCustomStatsManager().registerCustomStats(); + } + + logMessage(ChatColor.GOLD + "Loaded libraries: " + + getLoadedLibrariesAsString()); + + logMessage(ChatColor.GREEN + + "*** Ready for plugins to send/retrieve data. ***"); + + logMessage(this.getDescription().getFullName() + " is now enabled!"); + } + + @Override + public void onDisable() { + + loadedLibraries.clear(); + + logMessage(this.getDescription().getFullName() + " is now disabled!"); + } + + /** + * Load all libraries, this will be done automatically by the plugin. + * + * @return how many libraries were loaded. + */ + public int loadLibraries() { + int count = 0; + + for (Library l : Library.values()) { + if (l.getHook().isAvailable()) { + + // One more library loaded. + if (l.getHook().hook()) { + loadedLibraries.add(l); + count++; + } + + } + } + + return count; + } + + public void logMessage(String message) { + // This makes sure it can support colours. + this.getServer().getConsoleSender() + .sendMessage(ChatColor.GRAY + "[PluginLibrary] " + message); + } + + /** + * Get a list of all loaded libraries.
+ * This list is unmodifiable and when you try to alter it, it will give an + * {@link UnsupportedOperationException}. + * + * @return a list of loaded libraries. + */ + public List getLoadedLibraries() { + return Collections.unmodifiableList(loadedLibraries); + } + + /** + * Gets the library for a specific plugin.
+ * Will throw a {@link IllegalArgumentException} when there is no library + * with the given name. + * + * @param pluginName Name of the plugin. Case-insensitive! + * @return {@link me.staartvin.plugins.pluginlibrary.LibraryHook} class or + * an error. + */ + public static LibraryHook getLibrary(String pluginName) { + return Library.getEnum(pluginName).getHook(); + } + + /** + * @see #getLibrary(String) + *
+ * Returns the same as {@link #getLibrary(String)}. + * @param lib Library enum to get the library hook for. + * @return {@link me.staartvin.plugins.pluginlibrary.LibraryHook} class or + * an error. + */ + public static LibraryHook getLibrary(Library lib) { + return lib.getHook(); + } + + /** + * Checks to see whether the library is loaded and thus ready for use. + * + * @param lib Library to check. + * @return true if the library is loaded; false otherwise. + */ + public boolean isLibraryLoaded(Library lib) { + return loadedLibraries.contains(lib); + } + + public CustomStatsManager getCustomStatsManager() { + return customStatsManager; + } + + public void setCustomStatsManager(CustomStatsManager customStatsManager) { + this.customStatsManager = customStatsManager; + } + + private String getLoadedLibrariesAsString() { + StringBuilder builder = new StringBuilder(""); + + for (int i = 0, l = loadedLibraries.size(); i < l; i++) { + if (i == 0) { + builder.append(ChatColor.DARK_AQUA + + loadedLibraries.get(i).getPluginName() + ChatColor.RESET); + } else if (i == (l - 1)) { + builder.append(ChatColor.GRAY + + " and " + + (ChatColor.DARK_AQUA + + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); + } else { + builder.append(ChatColor.GRAY + + ", " + + (ChatColor.DARK_AQUA + + loadedLibraries.get(i).getPluginName() + ChatColor.RESET)); + } + } + + return builder.toString(); + } +}