diff --git a/pom.xml b/pom.xml index 1208607..b345f58 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xyz.etztech DeluxeGroups - 1.1 + 1.2 jar @@ -12,31 +12,6 @@ A plugin used to add group channels to DeluxeChat. (or any chat plugin, really) http://www.etztech.xyz - - - Zlib License - http://opensource.org/licenses/Zlib - Copyright (c) 2017 EtzTech - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. - - @@ -57,21 +32,25 @@ org.spigotmc spigot-api 1.13.1-R0.1-SNAPSHOT + provided - org.dynmap - DynmapCoreAPI - 2.0 + us.dynmap + dynmap-api + 1.9.4 + provided xyz.etztech EtzCore - 1.0 + 1.3 + compile commons-lang commons-lang 2.6 + provided @@ -132,8 +111,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 8 + 8 @@ -151,6 +130,19 @@ + + org.apache.maven.plugins + maven-shade-plugin + 3.1.1 + + + package + + shade + + + + \ No newline at end of file diff --git a/src/main/java/xyz/etztech/deluxegroups/DeluxeGroups.java b/src/main/java/xyz/etztech/deluxegroups/DeluxeGroups.java index 593b28e..5dd79c4 100644 --- a/src/main/java/xyz/etztech/deluxegroups/DeluxeGroups.java +++ b/src/main/java/xyz/etztech/deluxegroups/DeluxeGroups.java @@ -6,9 +6,9 @@ import org.bukkit.OfflinePlayer; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; -import org.dynmap.DynmapCommonAPI; import xyz.etztech.core.api.IMinecraftManager; +import xyz.etztech.core.maven.MavenLibrary; +import xyz.etztech.core.maven.MavenPlugin; import xyz.etztech.deluxegroups.command.CommandGroup; import xyz.etztech.deluxegroups.command.CommandMain; import xyz.etztech.deluxegroups.listeners.AsyncPlayerChatListener; @@ -20,7 +20,10 @@ import java.io.PrintWriter; import java.util.*; import java.util.logging.Logger; -public class DeluxeGroups extends JavaPlugin { + +@MavenLibrary(group = "us.dynmap", artifact = "dynmap-api", version = "1.9.4", repository = "http://repo.mikeprimm.com/") +@MavenLibrary(group = "commons-lang", artifact = "commons-lang", version = "2.6") +public class DeluxeGroups extends MavenPlugin { private static DeluxeGroups instance; @@ -35,7 +38,7 @@ public class DeluxeGroups extends JavaPlugin { AsyncPlayerChatListener chatListener; // Dynmap API - private static DynmapCommonAPI dynmap = null; + private static Object dynmap = null; // MinecraftManager API private static IMinecraftManager minecraftManager = null; @@ -43,7 +46,7 @@ public class DeluxeGroups extends JavaPlugin { @Override - public void onEnable() { + public void enable() { instance = this; saveDefaultConfig(); @@ -59,9 +62,8 @@ public class DeluxeGroups extends JavaPlugin { // Dynmap integration if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) { - dynmap = (DynmapCommonAPI) Bukkit.getPluginManager().getPlugin("dynmap"); - Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "IMPORTANT: Disabling Dynmap Game->Web Chat. All web chat will be handled by DeluxeGroups."); - dynmap.setDisableChatToWebProcessing(true); + dynmap = Bukkit.getPluginManager().getPlugin("dynmap"); + DeluxeUtil.setupDynmap(dynmap); getServer().getPluginManager().registerEvents(new SessionListener(), this); } @@ -87,7 +89,7 @@ public class DeluxeGroups extends JavaPlugin { } @Override - public void onDisable() { + public void disable() { log("Saving groups."); String root; for (DeluxeGroup group : groups.values()) { @@ -225,7 +227,7 @@ public class DeluxeGroups extends JavaPlugin { } } - public static DynmapCommonAPI getDynmap() { + public static Object getDynmap() { return dynmap; } diff --git a/src/main/java/xyz/etztech/deluxegroups/DeluxeUtil.java b/src/main/java/xyz/etztech/deluxegroups/DeluxeUtil.java index b4c53a8..2c9e6b4 100644 --- a/src/main/java/xyz/etztech/deluxegroups/DeluxeUtil.java +++ b/src/main/java/xyz/etztech/deluxegroups/DeluxeUtil.java @@ -1,7 +1,9 @@ package xyz.etztech.deluxegroups; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import org.dynmap.DynmapAPI; import java.io.PrintWriter; import java.text.SimpleDateFormat; @@ -44,4 +46,9 @@ public class DeluxeUtil { List no = new ArrayList<>(Arrays.asList("no", "false", "0")); return yes.contains(text) ? true : no.contains(text) ? false : null; } + + public static void setupDynmap(Object dynmap) { + Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "IMPORTANT: Disabling Dynmap Game->Web Chat. All web chat will be handled by DeluxeGroups."); + ((DynmapAPI) dynmap).setDisableChatToWebProcessing(true); + } } diff --git a/src/main/java/xyz/etztech/deluxegroups/listeners/AsyncPlayerChatListener.java b/src/main/java/xyz/etztech/deluxegroups/listeners/AsyncPlayerChatListener.java index ae121df..183bc35 100644 --- a/src/main/java/xyz/etztech/deluxegroups/listeners/AsyncPlayerChatListener.java +++ b/src/main/java/xyz/etztech/deluxegroups/listeners/AsyncPlayerChatListener.java @@ -7,6 +7,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.dynmap.DynmapAPI; import org.dynmap.DynmapCommonAPI; import xyz.etztech.core.api.IMinecraftManager; import xyz.etztech.deluxegroups.DeluxeGroup; @@ -41,7 +42,7 @@ public class AsyncPlayerChatListener implements Listener { return; } - DynmapCommonAPI dynmap = DeluxeGroups.getDynmap(); + DynmapAPI dynmap = (DynmapAPI) DeluxeGroups.getDynmap(); IMinecraftManager minecraftManager = DeluxeGroups.getMinecraftManager(); diff --git a/src/main/java/xyz/etztech/deluxegroups/listeners/SessionListener.java b/src/main/java/xyz/etztech/deluxegroups/listeners/SessionListener.java index 7eb9111..668a531 100644 --- a/src/main/java/xyz/etztech/deluxegroups/listeners/SessionListener.java +++ b/src/main/java/xyz/etztech/deluxegroups/listeners/SessionListener.java @@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.dynmap.DynmapAPI; import org.dynmap.DynmapCommonAPI; import xyz.etztech.deluxegroups.DeluxeGroups; @@ -22,7 +23,7 @@ public class SessionListener implements Listener { } private void handleEvent(Player player, boolean loggedIn) { - DynmapCommonAPI dynmap = DeluxeGroups.getDynmap(); + DynmapAPI dynmap = (DynmapAPI) DeluxeGroups.getDynmap(); if (dynmap != null) { dynmap.postPlayerJoinQuitToWeb(player.getName(), player.getName(), loggedIn); //dynmap.sendBroadcastToWeb("", player.getName() + " " + (loggedIn ? "joined" : "left") + " the server");