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> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.5.11</version> <version>2.5.12</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -1020,7 +1020,7 @@ public class PlotMain extends JavaPlugin implements Listener {
} }
private static void addPlusFlags() { 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> intervalFlags = Arrays.asList("feed", "heal");
final List<String> stringFlags = Arrays.asList("greeting", "farewell"); final List<String> stringFlags = Arrays.asList("greeting", "farewell");
for (final String flag : stringFlags) { for (final String flag : stringFlags) {

View File

@ -86,6 +86,14 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return null; 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) * Get the value of a flag for a plot (ignores flag defaults)
* @param plot * @param plot

View File

@ -244,6 +244,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler @EventHandler
public static void onBigBoom(final EntityExplodeEvent event) { 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(); final World world = event.getLocation().getWorld();
if (!isPlotWorld(world)) { if (!isPlotWorld(world)) {
return; return;

View File

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