minor cleanup and tweaks to WorldGuard code
added/updated libs
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								lib/SpoutAPI.jar
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/SpoutAPI.jar
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/WorldEdit.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/WorldEdit.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								lib/WorldGuard.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/WorldGuard.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -63,7 +63,7 @@ public class Conf {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public static double autoLeaveAfterDaysOfInactivity = 14.0;
 | 
						public static double autoLeaveAfterDaysOfInactivity = 14.0;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static boolean worldGuardChecking = true;
 | 
						public static boolean worldGuardChecking = false;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static boolean homesEnabled = true;
 | 
						public static boolean homesEnabled = true;
 | 
				
			||||||
	public static boolean homesMustBeInClaimedTerritory = true;
 | 
						public static boolean homesMustBeInClaimedTerritory = true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ import java.util.logging.Level;
 | 
				
			|||||||
import java.util.Map.Entry;
 | 
					import java.util.Map.Entry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
 | 
					import org.bukkit.Location;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.gson.reflect.TypeToken;
 | 
					import com.google.gson.reflect.TypeToken;
 | 
				
			||||||
@@ -505,10 +506,11 @@ public class FPlayer {
 | 
				
			|||||||
		// return value is false on failure, true on success
 | 
							// return value is false on failure, true on success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Faction myFaction = getFaction();
 | 
							Faction myFaction = getFaction();
 | 
				
			||||||
		FLocation flocation = new FLocation(this);
 | 
							Location loc = this.getPlayer().getLocation();
 | 
				
			||||||
 | 
							FLocation flocation = new FLocation(loc);
 | 
				
			||||||
		Faction otherFaction = Board.getFactionAt(flocation);
 | 
							Faction otherFaction = Board.getFactionAt(flocation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (Worldguard.checkForRegionsInChunk(this.getPlayer().getLocation())) {
 | 
							if (Conf.worldGuardChecking && Worldguard.checkForRegionsInChunk(loc)) {
 | 
				
			||||||
			// Checks for WorldGuard regions in the chunk attempting to be claimed
 | 
								// Checks for WorldGuard regions in the chunk attempting to be claimed
 | 
				
			||||||
			sendMessage("This land is protected");
 | 
								sendMessage("This land is protected");
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,11 +36,11 @@ public class Worldguard {
 | 
				
			|||||||
		if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) {
 | 
							if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) {
 | 
				
			||||||
			enabled = false;
 | 
								enabled = false;
 | 
				
			||||||
			wg = null;
 | 
								wg = null;
 | 
				
			||||||
			System.out.println("[Factions] Could not hook to WorldGuard. WorldGuard checks are disabled.");
 | 
								Factions.log("Could not hook to WorldGuard. WorldGuard checks are disabled.");
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			wg = (WorldGuardPlugin) wgplug;
 | 
								wg = (WorldGuardPlugin) wgplug;
 | 
				
			||||||
			enabled = true;
 | 
								enabled = true;
 | 
				
			||||||
			System.out.println("[Factions] Successfully hooked to WorldGuard.");
 | 
								Factions.log("Successfully hooked to WorldGuard.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,7 +53,11 @@ public class Worldguard {
 | 
				
			|||||||
	//   True: PVP is allowed
 | 
						//   True: PVP is allowed
 | 
				
			||||||
	//   False: PVP is disallowed
 | 
						//   False: PVP is disallowed
 | 
				
			||||||
	public static boolean isPVP(Player player) {
 | 
						public static boolean isPVP(Player player) {
 | 
				
			||||||
		if(isEnabled()) {
 | 
							if(!enabled) {
 | 
				
			||||||
 | 
								// No WG hooks so we'll always bypass this check.
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Location loc = player.getLocation();
 | 
							Location loc = player.getLocation();
 | 
				
			||||||
		World world = loc.getWorld();
 | 
							World world = loc.getWorld();
 | 
				
			||||||
		Vector pt = toVector(loc);
 | 
							Vector pt = toVector(loc);
 | 
				
			||||||
@@ -61,10 +65,6 @@ public class Worldguard {
 | 
				
			|||||||
		RegionManager regionManager = wg.getRegionManager(world);
 | 
							RegionManager regionManager = wg.getRegionManager(world);
 | 
				
			||||||
		ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
 | 
							ApplicableRegionSet set = regionManager.getApplicableRegions(pt);
 | 
				
			||||||
		return set.allows(DefaultFlag.PVP);
 | 
							return set.allows(DefaultFlag.PVP);
 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			// No WG hooks so we'll always bypass this check.
 | 
					 | 
				
			||||||
			return true;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Check for Regions in chunk the chunk
 | 
						// Check for Regions in chunk the chunk
 | 
				
			||||||
@@ -72,11 +72,15 @@ public class Worldguard {
 | 
				
			|||||||
	//   True: Regions found within chunk
 | 
						//   True: Regions found within chunk
 | 
				
			||||||
	//   False: No regions found within chunk
 | 
						//   False: No regions found within chunk
 | 
				
			||||||
	public static boolean checkForRegionsInChunk(Location loc) {
 | 
						public static boolean checkForRegionsInChunk(Location loc) {
 | 
				
			||||||
		if(isEnabled()) {
 | 
							if(!enabled) {
 | 
				
			||||||
 | 
								// No WG hooks so we'll always bypass this check.
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		World world = loc.getWorld();
 | 
							World world = loc.getWorld();
 | 
				
			||||||
		Chunk chunk = world.getChunkAt(loc);
 | 
							Chunk chunk = world.getChunkAt(loc);
 | 
				
			||||||
			int minChunkX = chunk.getX() * 16;
 | 
							int minChunkX = chunk.getX() << 4;
 | 
				
			||||||
			int minChunkZ = chunk.getZ() * 16;
 | 
							int minChunkZ = chunk.getZ() << 4;
 | 
				
			||||||
		int maxChunkX = minChunkX + 15;
 | 
							int maxChunkX = minChunkX + 15;
 | 
				
			||||||
		int maxChunkZ = minChunkZ + 15;
 | 
							int maxChunkZ = minChunkZ + 15;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -94,7 +98,7 @@ public class Worldguard {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			overlaps = region.getIntersectingRegions(allregionslist);
 | 
								overlaps = region.getIntersectingRegions(allregionslist);
 | 
				
			||||||
				if(overlaps.isEmpty() || overlaps == null) {
 | 
								if(overlaps == null || overlaps.isEmpty()) {
 | 
				
			||||||
				foundregions = false;
 | 
									foundregions = false;
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				foundregions = true;
 | 
									foundregions = true;
 | 
				
			||||||
@@ -108,8 +112,5 @@ public class Worldguard {
 | 
				
			|||||||
		overlaps = null;
 | 
							overlaps = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return foundregions;
 | 
							return foundregions;
 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -9,9 +9,12 @@ softdepend:
 | 
				
			|||||||
  - iChat
 | 
					  - iChat
 | 
				
			||||||
  - LocalAreaChat
 | 
					  - LocalAreaChat
 | 
				
			||||||
  - nChat
 | 
					  - nChat
 | 
				
			||||||
 | 
					  - ChatManager
 | 
				
			||||||
  - AuthMe
 | 
					  - AuthMe
 | 
				
			||||||
  - iConomy
 | 
					  - iConomy
 | 
				
			||||||
  - Spout
 | 
					  - Spout
 | 
				
			||||||
 | 
					  - WorldEdit
 | 
				
			||||||
 | 
					  - WorldGuard
 | 
				
			||||||
commands:
 | 
					commands:
 | 
				
			||||||
  f:
 | 
					  f:
 | 
				
			||||||
    description: All of the Factions commands
 | 
					    description: All of the Factions commands
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user