Updated EtzCore to 1.3

Moved necessary hooks to non-main classes
Added Maven Dependencies
master
Etzelia 2018-09-28 23:14:20 -05:00
parent 8ad681d9f7
commit 30960fbceb
5 changed files with 47 additions and 44 deletions

56
pom.xml
View File

@ -3,7 +3,7 @@
<groupId>xyz.etztech</groupId>
<artifactId>DeluxeGroups</artifactId>
<!-- Version is used in plugin.yml -->
<version>1.1</version>
<version>1.2</version>
<packaging>jar</packaging>
<!-- Plugin Information -->
@ -12,31 +12,6 @@
<description>A plugin used to add group channels to DeluxeChat. (or any chat plugin, really)</description>
<url>http://www.etztech.xyz</url>
<licenses>
<license>
<name>Zlib License</name>
<url>http://opensource.org/licenses/Zlib</url>
<comments>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.</comments>
</license>
</licenses>
<developers>
<developer>
@ -57,21 +32,25 @@
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.dynmap</groupId>
<artifactId>DynmapCoreAPI</artifactId>
<version>2.0</version>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>1.9.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xyz.etztech</groupId>
<artifactId>EtzCore</artifactId>
<version>1.0</version>
<version>1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
@ -132,8 +111,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
@ -151,6 +130,19 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -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;
}

View File

@ -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<String> 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);
}
}

View File

@ -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();

View File

@ -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");