mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Moved the trigger for validateSelection into TFM's WorldEdit.
This commit is contained in:
parent
4cde6a53ba
commit
05ad222148
@ -262,11 +262,6 @@ public class TFM_PlayerListener implements Listener
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getMaterial() == Material.WOOD_AXE)
|
||||
{
|
||||
TFM_WorldEditBridge.getInstance().validateSelection(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
|
@ -71,7 +71,6 @@ public class TFM_ProtectedArea implements Serializable
|
||||
|
||||
return false;
|
||||
}
|
||||
//
|
||||
|
||||
private static boolean cubeIntersectsSphere(Vector min, Vector max, Vector sphere, double radius)
|
||||
{
|
||||
@ -110,7 +109,6 @@ public class TFM_ProtectedArea implements Serializable
|
||||
return v * v;
|
||||
}
|
||||
|
||||
//
|
||||
public static void addProtectedArea(String label, Location location, double radius)
|
||||
{
|
||||
TFM_ProtectedArea.protectedAreas.put(label.toLowerCase(), new TFM_ProtectedArea(location, radius));
|
||||
|
@ -1,13 +1,16 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class TFM_WorldEditBridge
|
||||
{
|
||||
@ -113,24 +116,40 @@ public class TFM_WorldEditBridge
|
||||
}
|
||||
}
|
||||
|
||||
public void validateSelection(Player player)
|
||||
public void validateSelection(final Player player)
|
||||
{
|
||||
if (TFM_SuperadminList.isUserSuperadmin(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
LocalSession session = getPlayerSession(player);
|
||||
final LocalSession session = getPlayerSession(player);
|
||||
if (session != null)
|
||||
{
|
||||
LocalWorld selectionWorld = session.getSelectionWorld();
|
||||
Region selection = session.getSelection(selectionWorld);
|
||||
final LocalWorld selectionWorld = session.getSelectionWorld();
|
||||
final Region selection = session.getSelection(selectionWorld);
|
||||
if (TFM_ProtectedArea.isInProtectedArea(
|
||||
getBukkitVector(selection.getMinimumPoint()),
|
||||
getBukkitVector(selection.getMaximumPoint()),
|
||||
selectionWorld.getName()))
|
||||
{
|
||||
TFM_Util.bcastMsg("(DEBUG MSG: " + player.getName() + " has selected part of a protected area.");
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared.");
|
||||
session.getRegionSelector(selectionWorld).clear();
|
||||
}
|
||||
}.runTaskLater(TotalFreedomMod.plugin, 1L);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IncompleteRegionException ex)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
|
Loading…
Reference in New Issue
Block a user