Version 1.3

Updated EtzCore to 1.2
Added Maven annotations
Cleaned up shaded jar (less than half the size)
master
Etzelia 2018-09-27 00:02:49 -05:00
parent 9ec2f05087
commit b124202175
4 changed files with 28 additions and 60 deletions

47
pom.xml
View File

@ -3,7 +3,7 @@
<groupId>xyz.etztech</groupId> <groupId>xyz.etztech</groupId>
<artifactId>QoL</artifactId> <artifactId>QoL</artifactId>
<!-- Version is used in plugin.yml --> <!-- Version is used in plugin.yml -->
<version>1.2</version> <version>1.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<!-- Plugin Information --> <!-- Plugin Information -->
@ -12,31 +12,6 @@
<description>A compilation plugin of various utilities.</description> <description>A compilation plugin of various utilities.</description>
<url>http://www.etztech.xyz</url> <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> <developers>
<developer> <developer>
@ -57,31 +32,37 @@
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.13.1-R0.1-SNAPSHOT</version> <version>1.13.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>xyz.etztech</groupId> <groupId>xyz.etztech</groupId>
<artifactId>EtzCore</artifactId> <artifactId>EtzCore</artifactId>
<version>1.0</version> <version>1.2</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.ess3</groupId> <groupId>net.ess3</groupId>
<artifactId>Essentials</artifactId> <artifactId>Essentials</artifactId>
<version>2.14-SNAPSHOT</version> <version>2.14-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>us.dynmap</groupId> <groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId> <artifactId>dynmap-api</artifactId>
<version>1.9.4</version> <version>1.9.4</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
<version>2.6</version> <version>2.6</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.5</version> <version>4.5.5</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -145,8 +126,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.7</source> <source>8</source>
<target>1.7</target> <target>8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -177,14 +158,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -1,28 +1,29 @@
package xyz.etztech.qol; package xyz.etztech.qol;
import com.earth2me.essentials.Essentials;
import net.ess3.api.IEssentials;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import xyz.etztech.core.maven.MavenLibrary;
import xyz.etztech.core.maven.MavenPlugin;
import xyz.etztech.qol.commands.*; import xyz.etztech.qol.commands.*;
import xyz.etztech.qol.listeners.*; import xyz.etztech.qol.listeners.*;
import xyz.etztech.qol.other.LinkCommand; import xyz.etztech.qol.other.LinkCommand;
import xyz.etztech.qol.other.TPSRunnable; import xyz.etztech.qol.other.TPSRunnable;
import org.dynmap.DynmapAPI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.logging.Logger; import java.util.logging.Logger;
public class QoL extends JavaPlugin { @MavenLibrary(group = "org.apache.httpcomponents", artifact = "httpclient", version = "4.5.5")
@MavenLibrary(group = "net.ess3", artifact = "Essentials", version = "2.13.1", repository = "http://repo.ess3.net/content/groups/essentials")
@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 QoL extends MavenPlugin {
private static QoL instance; private static QoL instance;
private static IEssentials essentials = null; private Object essentials = null;
private static DynmapAPI dynmap = null; private Object dynmap = null;
public static FileConfiguration config; public static FileConfiguration config;
private Logger log = Logger.getLogger( "Minecraft" ); private Logger log = Logger.getLogger( "Minecraft" );
@ -34,7 +35,7 @@ public class QoL extends JavaPlugin {
private static List<LinkCommand> links = new ArrayList<>(); private static List<LinkCommand> links = new ArrayList<>();
@Override @Override
public void onEnable() { public void enable() {
instance = this; instance = this;
saveDefaultConfig(); saveDefaultConfig();
reloadConfig(); reloadConfig();
@ -43,13 +44,13 @@ public class QoL extends JavaPlugin {
//Essentials hook //Essentials hook
if (Bukkit.getPluginManager().isPluginEnabled("Essentials")) { if (Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
log("Hooked into Essentials for TPS alert."); log("Hooked into Essentials for TPS alert.");
essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); essentials = Bukkit.getPluginManager().getPlugin("Essentials");
} }
//Dynmap hook //Dynmap hook
if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) { if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) {
log("Hooked into Dynmap."); log("Hooked into Dynmap.");
dynmap = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap"); dynmap = Bukkit.getPluginManager().getPlugin("dynmap");
} }
if( isEnabled() ) { if( isEnabled() ) {
@ -188,9 +189,8 @@ public class QoL extends JavaPlugin {
} }
} }
@Override @Override
public void onDisable() { public void disable() {
} }
public void disablePlugin() { public void disablePlugin() {
@ -251,18 +251,13 @@ public class QoL extends JavaPlugin {
return links; return links;
} }
public static IEssentials getEssentials() { return essentials; } public Object getEssentials() { return essentials; }
public static DynmapAPI getDynmap() { return dynmap; } public Object getDynmap() { return dynmap; }
private void runTask(final String command) { private void runTask(final String command) {
Bukkit.getScheduler().runTask(QoL.instance, new Runnable() { Bukkit.getScheduler().runTask(QoL.instance, () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
@Override
public void run() {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
}
});
} }

View File

@ -37,7 +37,7 @@ public class CommandPreprocessListener implements Listener {
String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash
Player sender = event.getPlayer(); Player sender = event.getPlayer();
DynmapAPI dynmap = plugin.getDynmap(); DynmapAPI dynmap = (DynmapAPI) plugin.getDynmap();
// Spec dynmap hide // Spec dynmap hide
if (base.equals("spec") && sender.hasPermission("SafeSpectate.spectate") && dynmap != null) { if (base.equals("spec") && sender.hasPermission("SafeSpectate.spectate") && dynmap != null) {

View File

@ -18,7 +18,7 @@ public class TPSRunnable implements Runnable {
@Override @Override
public void run() { public void run() {
IEssentials essentials = QoL.getEssentials(); IEssentials essentials = (IEssentials) plugin.getEssentials();
if (essentials != null) { if (essentials != null) {
double tps = essentials.getTimer().getAverageTPS(); double tps = essentials.getTimer().getAverageTPS();
int threshold = plugin.getConfig().getInt("tps.threshold", 0); int threshold = plugin.getConfig().getInt("tps.threshold", 0);