Minor messaround with land claiming.

This commit is contained in:
Olof Larsson
2013-04-19 14:24:35 +02:00
parent c6739c4aa9
commit 9770cb8983
7 changed files with 42 additions and 52 deletions

View File

@ -5,7 +5,6 @@ import java.util.Set;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.RegisteredServiceProvider;
import com.massivecraft.factions.ConfServer;
@ -71,12 +70,11 @@ public class Econ
// UTIL
// -------------------------------------------- //
public static boolean payForAction(double cost, CommandSender sender, String actionDescription)
public static boolean payForAction(double cost, FPlayer fsender, String actionDescription)
{
if (!isEnabled()) return true;
if (cost == 0D) return true;
FPlayer fsender = FPlayer.get(sender);
if (fsender.isUsingAdminMode()) return true;
Faction fsenderFaction = fsender.getFaction();

View File

@ -1,6 +1,8 @@
package com.massivecraft.factions.integration;
import com.massivecraft.factions.Factions;
import com.massivecraft.mcore.ps.PS;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -79,16 +81,23 @@ public class Worldguard
// Returns:
// True: Regions found within chunk
// False: No regions found within chunk
public static boolean checkForRegionsInChunk(Location loc)
public static boolean checkForRegionsInChunk(PS psChunk)
{
if ( ! enabled)
// No WG hooks so we'll always bypass this check.
if (!enabled) return false;
World world = null;
Chunk chunk = null;
try
{
world = psChunk.asBukkitWorld(true);
chunk = psChunk.asBukkitChunk(true);
}
catch (Exception e)
{
// No WG hooks so we'll always bypass this check.
return false;
}
World world = loc.getWorld();
Chunk chunk = world.getChunkAt(loc);
int minChunkX = chunk.getX() << 4;
int minChunkZ = chunk.getZ() << 4;
int maxChunkX = minChunkX + 15;