forked from Minecraft/QoL
Merge branch 'master' of git.etztech.xyz:Etzelia/QoL
commit
d2c573d21c
47
pom.xml
47
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<groupId>xyz.etztech</groupId>
|
||||
<artifactId>QoL</artifactId>
|
||||
<!-- Version is used in plugin.yml -->
|
||||
<version>1.2</version>
|
||||
<version>1.3</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<!-- Plugin Information -->
|
||||
|
@ -12,31 +12,6 @@
|
|||
<description>A compilation plugin of various utilities.</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,31 +32,37 @@
|
|||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xyz.etztech</groupId>
|
||||
<artifactId>EtzCore</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.14-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>us.dynmap</groupId>
|
||||
<artifactId>dynmap-api</artifactId>
|
||||
<version>1.9.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@ -145,8 +126,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>
|
||||
|
@ -177,14 +158,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,28 +1,29 @@
|
|||
package xyz.etztech.qol;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
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.listeners.*;
|
||||
import xyz.etztech.qol.other.LinkCommand;
|
||||
import xyz.etztech.qol.other.TPSRunnable;
|
||||
import org.dynmap.DynmapAPI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
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 IEssentials essentials = null;
|
||||
private static DynmapAPI dynmap = null;
|
||||
private Object essentials = null;
|
||||
private Object dynmap = null;
|
||||
|
||||
public static FileConfiguration config;
|
||||
private Logger log = Logger.getLogger( "Minecraft" );
|
||||
|
@ -34,7 +35,7 @@ public class QoL extends JavaPlugin {
|
|||
private static List<LinkCommand> links = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
public void enable() {
|
||||
instance = this;
|
||||
saveDefaultConfig();
|
||||
reloadConfig();
|
||||
|
@ -43,13 +44,13 @@ public class QoL extends JavaPlugin {
|
|||
//Essentials hook
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("Essentials")) {
|
||||
log("Hooked into Essentials for TPS alert.");
|
||||
essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
|
||||
essentials = Bukkit.getPluginManager().getPlugin("Essentials");
|
||||
}
|
||||
|
||||
//Dynmap hook
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("dynmap")) {
|
||||
log("Hooked into Dynmap.");
|
||||
dynmap = (DynmapAPI) Bukkit.getPluginManager().getPlugin("dynmap");
|
||||
dynmap = Bukkit.getPluginManager().getPlugin("dynmap");
|
||||
}
|
||||
|
||||
if( isEnabled() ) {
|
||||
|
@ -188,9 +189,8 @@ public class QoL extends JavaPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
public void disable() {
|
||||
}
|
||||
|
||||
public void disablePlugin() {
|
||||
|
@ -251,18 +251,13 @@ public class QoL extends JavaPlugin {
|
|||
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) {
|
||||
Bukkit.getScheduler().runTask(QoL.instance, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
}
|
||||
});
|
||||
Bukkit.getScheduler().runTask(QoL.instance, () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class CommandPreprocessListener implements Listener {
|
|||
String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash
|
||||
|
||||
Player sender = event.getPlayer();
|
||||
DynmapAPI dynmap = plugin.getDynmap();
|
||||
DynmapAPI dynmap = (DynmapAPI) plugin.getDynmap();
|
||||
|
||||
// Spec dynmap hide
|
||||
if (base.equals("spec") && sender.hasPermission("SafeSpectate.spectate") && dynmap != null) {
|
||||
|
|
|
@ -18,7 +18,7 @@ public class TPSRunnable implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
IEssentials essentials = QoL.getEssentials();
|
||||
IEssentials essentials = (IEssentials) plugin.getEssentials();
|
||||
if (essentials != null) {
|
||||
double tps = essentials.getTimer().getAverageTPS();
|
||||
int threshold = plugin.getConfig().getInt("tps.threshold", 0);
|
||||
|
|
Loading…
Reference in New Issue