mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Added Kingdoms Support (#667)
• Added Kingdom Support • Fixed some bugs with `isRegionProtectedFromBuildPostCache`
This commit is contained in:
parent
4be85e8491
commit
7a046e793a
6 changed files with 69 additions and 4 deletions
BIN
lib/GLib.jar
Normal file
BIN
lib/GLib.jar
Normal file
Binary file not shown.
BIN
lib/Kingdoms.jar
Normal file
BIN
lib/Kingdoms.jar
Normal file
Binary file not shown.
16
pom.xml
16
pom.xml
|
@ -127,6 +127,22 @@
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/lib/worldguard-6.1.jar</systemPath>
|
<systemPath>${project.basedir}/lib/worldguard-6.1.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Kingdoms -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.kingdoms</groupId>
|
||||||
|
<artifactId>Kingdoms</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${project.basedir}/lib/Kingdoms.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
<!-- GLib -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.generallib</groupId>
|
||||||
|
<artifactId>GLib</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${project.basedir}/lib/GL.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -52,6 +52,13 @@ import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
import org.kingdoms.constants.StructureType;
|
||||||
|
import org.kingdoms.constants.kingdom.Kingdom;
|
||||||
|
import org.kingdoms.constants.land.Land;
|
||||||
|
import org.kingdoms.constants.land.SimpleChunkLocation;
|
||||||
|
import org.kingdoms.constants.land.SimpleLocation;
|
||||||
|
import org.kingdoms.constants.player.KingdomPlayer;
|
||||||
|
import org.kingdoms.manager.game.GameManagement;
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.Residence;
|
import com.bekvon.bukkit.residence.Residence;
|
||||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||||
|
@ -154,7 +161,6 @@ public class GeneralMethods {
|
||||||
getAbsorption = ReflectionHandler.getMethod("EntityPlayer", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
|
getAbsorption = ReflectionHandler.getMethod("EntityPlayer", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
|
||||||
setAbsorption = ReflectionHandler.getMethod("EntityPlayer", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
|
setAbsorption = ReflectionHandler.getMethod("EntityPlayer", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1246,6 +1252,7 @@ public class GeneralMethods {
|
||||||
boolean respectGriefPrevention = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.RespectGriefPrevention");
|
boolean respectGriefPrevention = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.RespectGriefPrevention");
|
||||||
boolean respectLWC = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.RespectLWC");
|
boolean respectLWC = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.RespectLWC");
|
||||||
boolean respectResidence = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.Residence.Respect");
|
boolean respectResidence = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.Residence.Respect");
|
||||||
|
boolean respectKingdoms = ConfigManager.defaultConfig.get().getBoolean("Properties.RegionProtection.Kingdoms");
|
||||||
|
|
||||||
boolean isIgnite = false;
|
boolean isIgnite = false;
|
||||||
boolean isExplosive = false;
|
boolean isExplosive = false;
|
||||||
|
@ -1274,6 +1281,7 @@ public class GeneralMethods {
|
||||||
Plugin massivecore = pm.getPlugin("MassiveCore");
|
Plugin massivecore = pm.getPlugin("MassiveCore");
|
||||||
Plugin lwc = pm.getPlugin("LWC");
|
Plugin lwc = pm.getPlugin("LWC");
|
||||||
Plugin residence = pm.getPlugin("Residence");
|
Plugin residence = pm.getPlugin("Residence");
|
||||||
|
Plugin kingdoms = pm.getPlugin("Kingdoms");
|
||||||
|
|
||||||
for (Location location : new Location[] { loc, player.getLocation() }) {
|
for (Location location : new Location[] { loc, player.getLocation() }) {
|
||||||
World world = location.getWorld();
|
World world = location.getWorld();
|
||||||
|
@ -1335,7 +1343,9 @@ public class GeneralMethods {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fcp != null && massivecore != null && respectFactions) {
|
if (fcp != null && massivecore != null && respectFactions) {
|
||||||
return !EngineMain.canPlayerBuildAt(player, PS.valueOf(loc.getBlock()), false);
|
if (!EngineMain.canPlayerBuildAt(player, PS.valueOf(loc.getBlock()), false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (twnp != null && respectTowny) {
|
if (twnp != null && respectTowny) {
|
||||||
|
@ -1395,7 +1405,45 @@ public class GeneralMethods {
|
||||||
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
|
ClaimedResidence res = Residence.getResidenceManager().getByLoc(loc);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
ResidencePermissions perms = res.getPermissions();
|
ResidencePermissions perms = res.getPermissions();
|
||||||
return perms.playerHas(player.getName(), ConfigManager.defaultConfig.get().getString("Properities.RegionProtection.Residence.Flag"), true);
|
if (perms.playerHas(player.getName(), ConfigManager.defaultConfig.get().getString("Properities.RegionProtection.Residence.Flag"), true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kingdoms != null && respectKingdoms) {
|
||||||
|
SimpleLocation location_ = new SimpleLocation(loc);
|
||||||
|
SimpleChunkLocation chunk = location_.toSimpleChunk();
|
||||||
|
Land land = GameManagement.getLandManager().getOrLoadLand(chunk);
|
||||||
|
|
||||||
|
if (land.getOwner() != null) {
|
||||||
|
KingdomPlayer kp = GameManagement.getPlayerManager().getSession(player);
|
||||||
|
|
||||||
|
if (!kp.isAdminMode()) {
|
||||||
|
if (land.getOwner().equals("SafeZone")) {
|
||||||
|
return true;
|
||||||
|
} else if (kp.getKingdom() == null) { //If the player isn't in a kingdom but it's claimed land
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Kingdom kingdom = kp.getKingdom();
|
||||||
|
String kingdomName = kingdom.getKingdomName();
|
||||||
|
if (!kingdomName.equals(land.getOwner())) //If the player's kingdom doesn't match
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//If it's within the nexus area, test for higher permission
|
||||||
|
if (land.getStructure() != null && land.getStructure().getType() == StructureType.NEXUS) {
|
||||||
|
if (!kp.getRank().isHigherOrEqualTo(kingdom.getPermissionsInfo().getBuildInNexus()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,6 +428,7 @@ public class ConfigManager {
|
||||||
config.addDefault("Properties.RegionProtection.RespectLWC", true);
|
config.addDefault("Properties.RegionProtection.RespectLWC", true);
|
||||||
config.addDefault("Properties.RegionProtection.Residence.Flag", "bending");
|
config.addDefault("Properties.RegionProtection.Residence.Flag", "bending");
|
||||||
config.addDefault("Properties.RegionProtection.Residence.Respect", true);
|
config.addDefault("Properties.RegionProtection.Residence.Respect", true);
|
||||||
|
config.addDefault("Properties.RegionProtection.Kingdoms", true);
|
||||||
config.addDefault("Properties.RegionProtection.CacheBlockTime", 5000);
|
config.addDefault("Properties.RegionProtection.CacheBlockTime", 5000);
|
||||||
|
|
||||||
config.addDefault("Properties.Air.CanBendWithWeapons", false);
|
config.addDefault("Properties.Air.CanBendWithWeapons", false);
|
||||||
|
|
|
@ -2,7 +2,7 @@ name: ProjectKorra
|
||||||
author: ProjectKorra
|
author: ProjectKorra
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: com.projectkorra.projectkorra.ProjectKorra
|
main: com.projectkorra.projectkorra.ProjectKorra
|
||||||
softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, NoCheatPlus, LWC, Residence]
|
softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, NoCheatPlus, LWC, Residence, Kingdoms]
|
||||||
commands:
|
commands:
|
||||||
projectkorra:
|
projectkorra:
|
||||||
aliases: [b,bending,mtla,tla,korra,pk,bend]
|
aliases: [b,bending,mtla,tla,korra,pk,bend]
|
||||||
|
|
Loading…
Reference in a new issue