mirror of
https://github.com/CodeMC/WorldGuardWrapper.git
synced 2025-01-18 04:02:38 +01:00
Add getter for WG main class
This commit is contained in:
parent
21f175b19c
commit
275f497dff
|
@ -3,11 +3,14 @@ package org.codemc.worldguardwrapper.implementation;
|
|||
import lombok.NonNull;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface IWorldGuardImplementation {
|
||||
|
||||
JavaPlugin getWorldGuardPlugin();
|
||||
|
||||
int getApiVersion();
|
||||
|
||||
// String flag
|
||||
|
|
|
@ -13,6 +13,7 @@ import lombok.NonNull;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.codemc.worldguardwrapper.implementation.AbstractWorldGuardImplementation;
|
||||
|
||||
import java.util.Optional;
|
||||
|
@ -47,6 +48,11 @@ public class WorldGuardImplementation extends AbstractWorldGuardImplementation {
|
|||
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryState(wrapPlayer(player).orElse(null), stateFlags));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaPlugin getWorldGuardPlugin() {
|
||||
return WorldGuardPlugin.inst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getApiVersion() {
|
||||
return 6;
|
||||
|
|
|
@ -17,22 +17,21 @@ import lombok.NonNull;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.codemc.worldguardwrapper.implementation.AbstractWorldGuardImplementation;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class WorldGuardImplementation extends AbstractWorldGuardImplementation {
|
||||
|
||||
private final WorldGuard core;
|
||||
private final FlagRegistry flagRegistry;
|
||||
private final WorldGuardPlatform platform;
|
||||
private final RegionContainer container;
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
public WorldGuardImplementation() {
|
||||
core = WorldGuard.getInstance();
|
||||
WorldGuard core = WorldGuard.getInstance();
|
||||
flagRegistry = core.getFlagRegistry();
|
||||
platform = core.getPlatform();
|
||||
WorldGuardPlatform platform = core.getPlatform();
|
||||
container = platform.getRegionContainer();
|
||||
plugin = WorldGuardPlugin.inst();
|
||||
}
|
||||
|
@ -57,6 +56,11 @@ public class WorldGuardImplementation extends AbstractWorldGuardImplementation {
|
|||
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryState(wrapPlayer(player).orElse(null), stateFlags));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaPlugin getWorldGuardPlugin() {
|
||||
return WorldGuardPlugin.inst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getApiVersion() {
|
||||
return 7;
|
||||
|
|
Loading…
Reference in New Issue
Block a user