mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-20 13:52:19 +01:00
1.0.0-SNAPSHOT-U96
+ Completed the WorldGuardHelper class to support WorldGuard/Edit 7.0.0
This commit is contained in:
parent
8ea680893b
commit
4ac986d363
@ -3,7 +3,6 @@ package com.songoda.epicbosses.utils.dependencies;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitUtil;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
@ -15,7 +14,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -119,12 +117,17 @@ public class WorldGuardHelper implements IWorldGuardHelper {
|
||||
|
||||
@Override
|
||||
public boolean isMobSpawningAllowed(Location loc) {
|
||||
// if(Bukkit.getServer().getPluginManager().getPlugin("WorldEdit") != null
|
||||
// && Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||
// ApplicableRegionSet set = WGBukkit.getPlugin().getRegionManager(loc.getWorld()).getApplicableRegions(loc);
|
||||
//
|
||||
// if(set.queryState(null, DefaultFlag.MOB_SPAWNING) == StateFlag.State.DENY) return false;
|
||||
// }
|
||||
if(Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||
if(worldGuard == null) {
|
||||
this.worldGuard = WorldGuard.getInstance();
|
||||
}
|
||||
|
||||
RegionQuery regionQuery = this.worldGuard.getPlatform().getRegionContainer().createQuery();
|
||||
ApplicableRegionSet applicableRegionSet = regionQuery.getApplicableRegions(BukkitAdapter.adapt(loc));
|
||||
StateFlag.State state = applicableRegionSet.queryState(null, Flags.MOB_SPAWNING);
|
||||
|
||||
return state != StateFlag.State.DENY;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
2
pom.xml
2
pom.xml
@ -20,7 +20,7 @@
|
||||
|
||||
<properties>
|
||||
<!--<plugin.version>maven-version-number-SNAPSHOT-U90</plugin.version>-->
|
||||
<plugin.version>1.0.0-U95</plugin.version>
|
||||
<plugin.version>1.0.0-U96</plugin.version>
|
||||
<plugin.name>EpicBosses</plugin.name>
|
||||
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
|
||||
<plugin.author>AMinecraftDev</plugin.author>
|
||||
|
Loading…
Reference in New Issue
Block a user