added flag "no-worldedit"

This commit is contained in:
Jesse Boyd 2015-01-22 16:26:16 -08:00
parent 4c8adcda68
commit fc869c0ec8
5 changed files with 16 additions and 2 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>PlotSquared</artifactId>
<version>2.5.11</version>
<version>2.5.12</version>
<name>PlotSquared</name>
<packaging>jar</packaging>
<build>

View File

@ -1020,7 +1020,7 @@ public class PlotMain extends JavaPlugin implements Listener {
}
private static void addPlusFlags() {
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp");
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit");
final List<String> intervalFlags = Arrays.asList("feed", "heal");
final List<String> stringFlags = Arrays.asList("greeting", "farewell");
for (final String flag : stringFlags) {

View File

@ -86,6 +86,14 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return null;
}
public static boolean isPlotFlagTrue(Plot plot, String strFlag) {
Flag flag = getPlotFlag(plot, strFlag);
if (flag == null) {
return false;
}
return flag.getValue().equals("true");
}
/**
* Get the value of a flag for a plot (ignores flag defaults)
* @param plot

View File

@ -244,6 +244,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler
public static void onBigBoom(final EntityExplodeEvent event) {
// TODO allow tnt explosion within some plots
// TODO prevent entity velocity from explosion in plotworld
final World world = event.getLocation().getWorld();
if (!isPlotWorld(world)) {
return;

View File

@ -27,6 +27,7 @@ import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.sk89q.worldedit.LocalSession;
@ -59,6 +60,9 @@ import com.sk89q.worldedit.regions.CuboidRegion;
if (id != null) {
final Plot plot = PlotMain.getPlots(l.getWorld()).get(id);
if (plot != null) {
if (FlagManager.isPlotFlagTrue(plot, "no-worldedit")) {
return;
}
boolean r;
r = ((plot.getOwner() != null) && plot.getOwner().equals(UUIDHandler.getUUID(p))) || plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(UUIDHandler.getUUID(p));
if (!r) {