mirror of
https://github.com/CodeMC/WorldGuardWrapper.git
synced 2024-11-10 05:05:20 +01:00
Use compile scope for implementations
This commit is contained in:
parent
74399248f3
commit
6ed239a176
|
@ -24,13 +24,11 @@
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>worldguardwrapper-implementation-v6</artifactId>
|
<artifactId>worldguardwrapper-implementation-v6</artifactId>
|
||||||
<version>1.1.1-SNAPSHOT</version>
|
<version>1.1.1-SNAPSHOT</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>worldguardwrapper-implementation-v7</artifactId>
|
<artifactId>worldguardwrapper-implementation-v7</artifactId>
|
||||||
<version>1.1.1-SNAPSHOT</version>
|
<version>1.1.1-SNAPSHOT</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -23,24 +23,23 @@ public class WorldGuardWrapper implements IWorldGuardImplementation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delegate
|
@Delegate
|
||||||
private IWorldGuardImplementation delegate;
|
private IWorldGuardImplementation implementation;
|
||||||
private Listener eventListener;
|
private Listener listener;
|
||||||
|
|
||||||
private WorldGuardWrapper() {
|
private WorldGuardWrapper() {
|
||||||
String version;
|
boolean legacy;
|
||||||
try {
|
try {
|
||||||
Class.forName("com.sk89q.worldguard.WorldGuard");
|
Class.forName("com.sk89q.worldguard.WorldGuard");
|
||||||
version = "v7";
|
legacy = false;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
version = "v6";
|
legacy = true;
|
||||||
}
|
}
|
||||||
try {
|
if (legacy) {
|
||||||
delegate = (IWorldGuardImplementation) Class.forName("org.codemc.worldguardwrapper.implementation."
|
implementation = new org.codemc.worldguardwrapper.implementation.v6.WorldGuardImplementation();
|
||||||
+ version + ".WorldGuardImplementation").newInstance();
|
listener = new org.codemc.worldguardwrapper.implementation.v6.event.EventListener();
|
||||||
eventListener = (Listener) Class.forName("new org.codemc.worldguardwrapper.implementation."
|
} else {
|
||||||
+ version + ".event.EventListener").newInstance();
|
implementation = new org.codemc.worldguardwrapper.implementation.v7.WorldGuardImplementation();
|
||||||
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
|
listener = new org.codemc.worldguardwrapper.implementation.v7.event.EventListener();
|
||||||
throw new RuntimeException("Unable to initialize WorldGuard implementation " + version, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +50,7 @@ public class WorldGuardWrapper implements IWorldGuardImplementation {
|
||||||
* @param plugin the plugin instance
|
* @param plugin the plugin instance
|
||||||
*/
|
*/
|
||||||
public void registerEvents(JavaPlugin plugin) {
|
public void registerEvents(JavaPlugin plugin) {
|
||||||
Bukkit.getPluginManager().registerEvents(eventListener, plugin);
|
Bukkit.getPluginManager().registerEvents(listener, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user