mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
[DEBUG] WorldGuard Flag info
This build just prints info about worldguard flags to console. Nothing else has changed from last (working) dev. The debug messages may be spammy, so I recommend not updating quite yet.
This commit is contained in:
parent
d5a6c66c76
commit
6670a3263f
2
pom.xml
2
pom.xml
@ -136,7 +136,7 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.1-SNAPSHOT</version>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -2,6 +2,7 @@ package net.Indyuce.mmocore.comp.flags;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -14,6 +15,8 @@ import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
|
||||
public class WorldGuardFlags implements FlagPlugin {
|
||||
private final WorldGuard worldguard;
|
||||
private final WorldGuardPlugin worldguardPlugin;
|
||||
@ -30,7 +33,11 @@ public class WorldGuardFlags implements FlagPlugin {
|
||||
try {
|
||||
registry.register(flag);
|
||||
flags.put(customFlag.getPath(), flag);
|
||||
MMOCore.log(Level.INFO, "[FLAGDEBUG] Registered WG Flag\n"
|
||||
+ " - Info{name=" + flag.getName() + ",path=" + customFlag.getPath() + "}");
|
||||
} catch (Exception exception) {
|
||||
MMOCore.log(Level.SEVERE, "[FLAGDEBUG] FAILED to register WG Flag\n"
|
||||
+ " - Info{name=" + flag.getName() + ",path=" + customFlag.getPath() + "}");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -48,8 +55,14 @@ public class WorldGuardFlags implements FlagPlugin {
|
||||
|
||||
@Override
|
||||
public boolean isFlagAllowed(Player player, CustomFlag customFlag) {
|
||||
StateFlag flag = flags.get(customFlag.getPath());
|
||||
if(flag == null) MMOCore.log(Level.SEVERE, "[FLAGDEBUG] Found Null value WG Flag\n"
|
||||
+ " - Info{path=" + customFlag.getPath() + "}");
|
||||
else MMOCore.log(Level.INFO, "[FLAGDEBUG] Checking WG Flag\n"
|
||||
+ " - Info{name=" + flag.getName() + ",path=" + customFlag.getPath() + "}");
|
||||
|
||||
return getApplicableRegion(player.getLocation()).queryValue(worldguardPlugin.wrapPlayer(player),
|
||||
flags.get(customFlag.getPath())) != StateFlag.State.DENY;
|
||||
flag) != StateFlag.State.DENY;
|
||||
}
|
||||
|
||||
private ApplicableRegionSet getApplicableRegion(Location loc) {
|
||||
|
Loading…
Reference in New Issue
Block a user