mirror of
https://github.com/CodeMC/WorldGuardWrapper.git
synced 2024-11-10 05:05:20 +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 lombok.NonNull;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface IWorldGuardImplementation {
|
public interface IWorldGuardImplementation {
|
||||||
|
|
||||||
|
JavaPlugin getWorldGuardPlugin();
|
||||||
|
|
||||||
int getApiVersion();
|
int getApiVersion();
|
||||||
|
|
||||||
// String flag
|
// String flag
|
||||||
|
|
|
@ -13,6 +13,7 @@ import lombok.NonNull;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.codemc.worldguardwrapper.implementation.AbstractWorldGuardImplementation;
|
import org.codemc.worldguardwrapper.implementation.AbstractWorldGuardImplementation;
|
||||||
|
|
||||||
import java.util.Optional;
|
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));
|
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryState(wrapPlayer(player).orElse(null), stateFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JavaPlugin getWorldGuardPlugin() {
|
||||||
|
return WorldGuardPlugin.inst();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getApiVersion() {
|
public int getApiVersion() {
|
||||||
return 6;
|
return 6;
|
||||||
|
|
|
@ -17,22 +17,21 @@ import lombok.NonNull;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.codemc.worldguardwrapper.implementation.AbstractWorldGuardImplementation;
|
import org.codemc.worldguardwrapper.implementation.AbstractWorldGuardImplementation;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class WorldGuardImplementation extends AbstractWorldGuardImplementation {
|
public class WorldGuardImplementation extends AbstractWorldGuardImplementation {
|
||||||
|
|
||||||
private final WorldGuard core;
|
|
||||||
private final FlagRegistry flagRegistry;
|
private final FlagRegistry flagRegistry;
|
||||||
private final WorldGuardPlatform platform;
|
|
||||||
private final RegionContainer container;
|
private final RegionContainer container;
|
||||||
private final WorldGuardPlugin plugin;
|
private final WorldGuardPlugin plugin;
|
||||||
|
|
||||||
public WorldGuardImplementation() {
|
public WorldGuardImplementation() {
|
||||||
core = WorldGuard.getInstance();
|
WorldGuard core = WorldGuard.getInstance();
|
||||||
flagRegistry = core.getFlagRegistry();
|
flagRegistry = core.getFlagRegistry();
|
||||||
platform = core.getPlatform();
|
WorldGuardPlatform platform = core.getPlatform();
|
||||||
container = platform.getRegionContainer();
|
container = platform.getRegionContainer();
|
||||||
plugin = WorldGuardPlugin.inst();
|
plugin = WorldGuardPlugin.inst();
|
||||||
}
|
}
|
||||||
|
@ -57,6 +56,11 @@ public class WorldGuardImplementation extends AbstractWorldGuardImplementation {
|
||||||
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryState(wrapPlayer(player).orElse(null), stateFlags));
|
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryState(wrapPlayer(player).orElse(null), stateFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JavaPlugin getWorldGuardPlugin() {
|
||||||
|
return WorldGuardPlugin.inst();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getApiVersion() {
|
public int getApiVersion() {
|
||||||
return 7;
|
return 7;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user