From dea1a46f55f85d59b0ad1e4544cfa0844d819425 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 6 Nov 2019 15:46:59 +0100 Subject: [PATCH] Check if Essentials is present #77 --- .idea/compiler.xml | 26 +++++++++++++------ .../java/buttondevteam/core/MainPlugin.java | 4 ++- .../core/component/spawn/SpawnComponent.java | 10 ++++--- ButtonCore/src/main/resources/plugin.yml | 5 ++-- CorePOM/CorePOM.iml | 2 ++ CorePOM/pom.xml | 10 ------- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index d2dfceb..863d6fa 100755 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -9,16 +9,28 @@ - - + + + + + + + + + + + + + + @@ -32,11 +44,9 @@ - - @@ -44,12 +54,12 @@ - + - - + + - + diff --git a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java index d5b690b..0fbdca1 100755 --- a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java +++ b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java @@ -47,6 +47,7 @@ import java.util.logging.Logger; public class MainPlugin extends ButtonPlugin { public static MainPlugin Instance; public static Permission permission; + @Nullable public static Essentials ess; private Logger logger; @@ -124,7 +125,8 @@ public class MainPlugin extends ButtonPlugin { TBMCCoreAPI.SendException("Failed to write plugin list!", e); } } - ess = Essentials.getPlugin(Essentials.class); + if (getServer().getPluginManager().isPluginEnabled("Essentials")) + ess = Essentials.getPlugin(Essentials.class); logger.info(pdf.getName() + " has been Enabled (V." + pdf.getVersion() + ") Test: " + test().get() + "."); } diff --git a/ButtonCore/src/main/java/buttondevteam/core/component/spawn/SpawnComponent.java b/ButtonCore/src/main/java/buttondevteam/core/component/spawn/SpawnComponent.java index 7e0769b..2dab750 100644 --- a/ButtonCore/src/main/java/buttondevteam/core/component/spawn/SpawnComponent.java +++ b/ButtonCore/src/main/java/buttondevteam/core/component/spawn/SpawnComponent.java @@ -89,11 +89,15 @@ public class SpawnComponent extends Component implements PluginMessa @Command2.Subcommand public void def(Player player) { if (targetServer().get().length() == 0) { - player.sendMessage("§bTeleporting to spawn."); + player.sendMessage("§bTeleporting to spawn..."); try { - MainPlugin.ess.getUser(player).getTeleport().teleport(spawnloc, new Trade(BigDecimal.ZERO, MainPlugin.ess), PlayerTeleportEvent.TeleportCause.COMMAND); + if (MainPlugin.ess != null) + MainPlugin.ess.getUser(player).getTeleport() + .teleport(spawnloc, new Trade(BigDecimal.ZERO, MainPlugin.ess), PlayerTeleportEvent.TeleportCause.COMMAND); + else + player.teleport(spawnloc); } catch (Exception e) { - e.printStackTrace(); + player.sendMessage("§cFailed to teleport: " + e); } return; } diff --git a/ButtonCore/src/main/resources/plugin.yml b/ButtonCore/src/main/resources/plugin.yml index 81c2ccf..c277429 100755 --- a/ButtonCore/src/main/resources/plugin.yml +++ b/ButtonCore/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: ChromaCore main: buttondevteam.core.MainPlugin version: 1.0 -author: TBMCPlugins +author: NorbiPeti commands: updateplugin: description: Update a TBMC plugin @@ -21,4 +21,5 @@ depend: softdepend: - Towny - Votifier - - Multiverse-Core \ No newline at end of file + - Multiverse-Core + - Essentials \ No newline at end of file diff --git a/CorePOM/CorePOM.iml b/CorePOM/CorePOM.iml index 0e07dc2..7d05a81 100644 --- a/CorePOM/CorePOM.iml +++ b/CorePOM/CorePOM.iml @@ -16,5 +16,7 @@ + + \ No newline at end of file diff --git a/CorePOM/pom.xml b/CorePOM/pom.xml index 62bebbe..024d7eb 100755 --- a/CorePOM/pom.xml +++ b/CorePOM/pom.xml @@ -56,16 +56,6 @@ - - - org.apache.maven.plugins - maven-compiler-plugin - - 12 - 12 - - -