Check if Essentials is present

#77
This commit is contained in:
Norbi Peti 2019-11-06 15:46:59 +01:00
parent 8f75998b58
commit dea1a46f55
6 changed files with 33 additions and 24 deletions

View file

@ -9,16 +9,28 @@
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false"> <processorPath useClasspath="false">
<entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" /> <entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" />
<entry name="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar" />
<entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-20180712.012057-156.jar" /> <entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-20180712.012057-156.jar" />
<entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" /> <entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" />
<entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" /> <entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" />
<entry name="$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar" />
<entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" /> <entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" />
<entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" /> <entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" />
</processorPath> </processorPath>
<module name="BuildConfigUpdater" /> <module name="BuildConfigUpdater" />
</profile> </profile>
<profile name="Annotation profile for ButtonProcessor" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" />
<entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-20180712.012057-156.jar" />
<entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" />
<entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" />
<entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" />
<entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" />
</processorPath>
<module name="ButtonProcessor" />
</profile>
<profile name="Annotation profile for ButtonCore Parent" enabled="true"> <profile name="Annotation profile for ButtonCore Parent" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
@ -32,11 +44,9 @@
<entry name="$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.10.1/byte-buddy-agent-1.10.1.jar" /> <entry name="$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.10.1/byte-buddy-agent-1.10.1.jar" />
<entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.10/lombok-1.18.10.jar" /> <entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.10/lombok-1.18.10.jar" />
<entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" /> <entry name="$PROJECT_DIR$/ButtonProcessor/target/classes" />
<entry name="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar" />
<entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-20180712.012057-156.jar" /> <entry name="$MAVEN_REPOSITORY$/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-20180712.012057-156.jar" />
<entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" /> <entry name="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" />
<entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" /> <entry name="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" />
<entry name="$MAVEN_REPOSITORY$/com/google/guava/guava/21.0/guava-21.0.jar" />
<entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" /> <entry name="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar" />
<entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" /> <entry name="$MAVEN_REPOSITORY$/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-20180712.114550-97.jar" />
</processorPath> </processorPath>
@ -44,12 +54,12 @@
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
<module name="BuildConfigUpdater" target="8" /> <module name="BuildConfigUpdater" target="1.5" />
<module name="ButtonCore" target="1.5" /> <module name="ButtonCore" target="1.5" />
<module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" target="12" /> <module name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" target="13" />
<module name="ButtonProcessor" target="8" /> <module name="ButtonProcessor" target="1.5" />
<module name="ChunkArchive" target="1.8" /> <module name="ChunkArchive" target="1.8" />
<module name="CorePOM" target="12" /> <module name="CorePOM" target="13" />
<module name="RandomTeleport" target="1.8" /> <module name="RandomTeleport" target="1.8" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
</component> </component>

View file

@ -47,6 +47,7 @@ import java.util.logging.Logger;
public class MainPlugin extends ButtonPlugin { public class MainPlugin extends ButtonPlugin {
public static MainPlugin Instance; public static MainPlugin Instance;
public static Permission permission; public static Permission permission;
@Nullable
public static Essentials ess; public static Essentials ess;
private Logger logger; private Logger logger;
@ -124,7 +125,8 @@ public class MainPlugin extends ButtonPlugin {
TBMCCoreAPI.SendException("Failed to write plugin list!", e); 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() + "."); logger.info(pdf.getName() + " has been Enabled (V." + pdf.getVersion() + ") Test: " + test().get() + ".");
} }

View file

@ -89,11 +89,15 @@ public class SpawnComponent extends Component<MainPlugin> implements PluginMessa
@Command2.Subcommand @Command2.Subcommand
public void def(Player player) { public void def(Player player) {
if (targetServer().get().length() == 0) { if (targetServer().get().length() == 0) {
player.sendMessage("§bTeleporting to spawn."); player.sendMessage("§bTeleporting to spawn...");
try { 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) { } catch (Exception e) {
e.printStackTrace(); player.sendMessage("§cFailed to teleport: " + e);
} }
return; return;
} }

View file

@ -1,7 +1,7 @@
name: ChromaCore name: ChromaCore
main: buttondevteam.core.MainPlugin main: buttondevteam.core.MainPlugin
version: 1.0 version: 1.0
author: TBMCPlugins author: NorbiPeti
commands: commands:
updateplugin: updateplugin:
description: Update a TBMC plugin description: Update a TBMC plugin
@ -21,4 +21,5 @@ depend:
softdepend: softdepend:
- Towny - Towny
- Votifier - Votifier
- Multiverse-Core - Multiverse-Core
- Essentials

View file

@ -16,5 +16,7 @@
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
</component> </component>
</module> </module>

View file

@ -56,16 +56,6 @@
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
</plugins>
</build> </build>
<repositories> <repositories>