1.0.0-SNAPSHOT-U66

+ Removed support for WorldGuard due to the current issues with not being able to find the right method
This commit is contained in:
Charles 2018-11-19 16:26:24 +08:00
parent 33c5438445
commit 1b72b14ddd
11 changed files with 238 additions and 141 deletions

27
.idea/compiler.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Core" />
<module name="FactionHelper" />
<module name="FactionsM" />
<module name="FactionsOne" />
<module name="FactionsUUID" />
<module name="LegacyFactions" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="Core" target="1.8" />
<module name="EpicBosses" target="1.8" />
<module name="FactionHelper" target="1.8" />
<module name="FactionsM" target="1.8" />
<module name="FactionsOne" target="1.8" />
<module name="FactionsUUID" target="1.8" />
<module name="LegacyFactions" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sk89q:FAWE:7.0.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/FAWE/7.0.0/FAWE-7.0.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/FAWE/7.0.0/FAWE-7.0.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/FAWE/7.0.0/FAWE-7.0.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.sk89q:worldguard:7.0.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/worldguard/7.0.0/worldguard-7.0.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/worldguard/7.0.0/worldguard-7.0.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/sk89q/worldguard/7.0.0/worldguard-7.0.0-sources.jar!/" />
</SOURCES>
</library>
</component>

11
.idea/misc.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

14
.idea/modules.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/plugin-modules/Core/Core.iml" filepath="$PROJECT_DIR$/plugin-modules/Core/Core.iml" />
<module fileurl="file://$PROJECT_DIR$/EpicBosses.iml" filepath="$PROJECT_DIR$/EpicBosses.iml" />
<module fileurl="file://$PROJECT_DIR$/plugin-modules/FactionHelper/FactionHelper.iml" filepath="$PROJECT_DIR$/plugin-modules/FactionHelper/FactionHelper.iml" />
<module fileurl="file://$PROJECT_DIR$/api-modules/FactionsM/FactionsM.iml" filepath="$PROJECT_DIR$/api-modules/FactionsM/FactionsM.iml" />
<module fileurl="file://$PROJECT_DIR$/api-modules/FactionsOne/FactionsOne.iml" filepath="$PROJECT_DIR$/api-modules/FactionsOne/FactionsOne.iml" />
<module fileurl="file://$PROJECT_DIR$/api-modules/FactionsUUID/FactionsUUID.iml" filepath="$PROJECT_DIR$/api-modules/FactionsUUID/FactionsUUID.iml" />
<module fileurl="file://$PROJECT_DIR$/api-modules/LegacyFactions/LegacyFactions.iml" filepath="$PROJECT_DIR$/api-modules/LegacyFactions/LegacyFactions.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -11,7 +11,7 @@ import utils.factions.FactionsM;
import utils.factions.FactionsOne;
import utils.factions.FactionsUUID;
import utils.factions.LegacyFactions;
import com.songoda.epicbosses.utils.worldguard.WorldGuardHelper;
import com.songoda.epicbosses.utils.dependencies.WorldGuardHelper;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;

View File

@ -54,19 +54,20 @@ public class BossLocationManager implements IReloadable {
}
if(this.bossHookManager.isWorldguardEnabld() && this.bossHookManager.getWorldGuardHelper() != null) {
List<String> currentRegions = this.bossHookManager.getWorldGuardHelper().getRegionNames(location);
boolean blocked = false;
if(currentRegions != null) {
for(String s : this.bossHookManager.getWorldguardBlockedRegions()) {
if(currentRegions.contains(s)) {
blocked = true;
break;
}
}
if(blocked) return false;
}
// TODO: Add Blocked regions support
// List<String> currentRegions = this.bossHookManager.getWorldGuardHelper().getRegionNames(location);
// boolean blocked = false;
//
// if(currentRegions != null) {
// for(String s : this.bossHookManager.getWorldguardBlockedRegions()) {
// if(currentRegions.contains(s)) {
// blocked = true;
// break;
// }
// }
//
// if(blocked) return false;
// }
}
if(this.bossHookManager.isFactionsEnabled() && this.bossHookManager.getFactionHelper() != null) {
@ -74,19 +75,19 @@ public class BossLocationManager implements IReloadable {
}
if(this.bossHookManager.isWorldguardEnabld() && this.bossHookManager.getWorldGuardHelper() != null) {
List<String> currentRegions = this.bossHookManager.getWorldGuardHelper().getRegionNames(location);
boolean allowed = false;
if(currentRegions != null) {
for(String s : this.bossHookManager.getWorldGuardSpawnRegions()) {
if(currentRegions.contains(s)) {
allowed = true;
break;
}
}
if(!allowed) return false;
}
// List<String> currentRegions = this.bossHookManager.getWorldGuardHelper().getRegionNames(location);
// boolean allowed = false;
//
// if(currentRegions != null) {
// for(String s : this.bossHookManager.getWorldGuardSpawnRegions()) {
// if(currentRegions.contains(s)) {
// allowed = true;
// break;
// }
// }
//
// if(!allowed) return false;
// }
}
if(this.bossHookManager.isAskyblockEnabled() && this.bossHookManager.getASkyblockHelper() != null) {

View File

@ -0,0 +1,122 @@
package com.songoda.epicbosses.utils.dependencies;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionQuery;
import com.songoda.epicbosses.utils.IWorldGuardHelper;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import java.util.LinkedList;
import java.util.List;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 16-Oct-18
*/
public class WorldGuardHelper implements IWorldGuardHelper {
private WorldGuard worldGuard;
@Override
public boolean isPvpAllowed(Location loc) {
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.PVP);
return state != StateFlag.State.DENY;
}
return true;
}
@Override
public boolean isBreakAllowed(Location loc) {
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.BLOCK_BREAK);
return state != StateFlag.State.DENY;
}
return true;
}
@Override
public boolean isExplosionsAllowed(Location loc) {
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.OTHER_EXPLOSION);
return state != StateFlag.State.DENY;
}
return true;
}
@Override
public List<String> getRegionNames(Location loc) {
if(Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
if(worldGuard == null) {
this.worldGuard = WorldGuard.getInstance();
}
// ApplicableRegionSet set = this.worldGuard.getRegionManager(loc.getWorld()).getApplicableRegions(loc);
// LinkedList<String> parentNames = new LinkedList<String>();
// LinkedList<String> regions = new LinkedList<String>();
//
// for(ProtectedRegion region : set) {
// String id = region.getId();
//
// regions.add(id);
//
// ProtectedRegion parent = region.getParent();
//
// while(parent != null) {
// parentNames.add(parent.getId());
// parent = parent.getParent();
// }
// }
//
// for(String name : parentNames) {
// regions.remove(name);
// }
//
// return regions;
}
return null;
}
@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;
// }
return true;
}
}

View File

@ -1,101 +0,0 @@
package com.songoda.epicbosses.utils.worldguard;
import com.sk89q.worldguard.bukkit.WGBukkit;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.songoda.epicbosses.utils.IWorldGuardHelper;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import java.util.LinkedList;
import java.util.List;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 16-Oct-18
*/
public class WorldGuardHelper implements IWorldGuardHelper {
@Override
public boolean isPvpAllowed(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.PVP) == StateFlag.State.DENY) return false;
}
return true;
}
@Override
public boolean isBreakAllowed(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.BLOCK_BREAK) == StateFlag.State.DENY) return false;
}
return true;
}
@Override
public boolean isExplosionsAllowed(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.OTHER_EXPLOSION) == StateFlag.State.DENY) return false;
}
return true;
}
@Override
public List<String> getRegionNames(Location loc) {
if(Bukkit.getServer().getPluginManager().getPlugin("WorldEdit") != null
&& Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
ApplicableRegionSet set = WGBukkit.getPlugin().getRegionManager(loc.getWorld()).getApplicableRegions(loc);
LinkedList<String> parentNames = new LinkedList<String>();
LinkedList<String> regions = new LinkedList<String>();
for(ProtectedRegion region : set) {
String id = region.getId();
regions.add(id);
ProtectedRegion parent = region.getParent();
while(parent != null) {
parentNames.add(parent.getId());
parent = parent.getParent();
}
}
for(String name : parentNames) {
regions.remove(name);
}
return regions;
}
return null;
}
@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;
}
return true;
}
}

17
pom.xml
View File

@ -19,7 +19,7 @@
</modules>
<properties>
<plugin.version>maven-version-number-SNAPSHOT-U65</plugin.version>
<plugin.version>maven-version-number-SNAPSHOT-U66</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>
@ -40,14 +40,14 @@
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>LATEST</version>
<artifactId>FAWE</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>6.2.2</version>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -110,15 +110,6 @@
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
<inherited>false</inherited>
</plugin>
<plugin>