diff --git a/pom.xml b/pom.xml
index f861585a4..3bd861baf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
UTF-8
PlotSquared
- 3.2.9
+ 3.2.10
PlotSquared
jar
@@ -147,6 +147,11 @@
javax.websocket-api
1.1
+
org.spongepowered
spongeapi
diff --git a/src/main/java/com/intellectualcrafters/plot/IPlotMain.java b/src/main/java/com/intellectualcrafters/plot/IPlotMain.java
index 5132c94c8..5e333a6f2 100644
--- a/src/main/java/com/intellectualcrafters/plot/IPlotMain.java
+++ b/src/main/java/com/intellectualcrafters/plot/IPlotMain.java
@@ -122,11 +122,6 @@ public interface IPlotMain {
*/
boolean initWorldEdit();
- /**
- * Register TNT related events (if TNT protection is enabled)
- */
- void registerTNTListener();
-
/**
* Get the economy provider
* @return
diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java
index 78ba23484..be1d67bdc 100644
--- a/src/main/java/com/intellectualcrafters/plot/PS.java
+++ b/src/main/java/com/intellectualcrafters/plot/PS.java
@@ -191,9 +191,6 @@ public class PS {
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
}
IMP.startMetrics();
- if (Settings.TNT_LISTENER) {
- IMP.registerTNTListener();
- }
if (Settings.CHUNK_PROCESSOR) {
IMP.registerChunkProcessor();
}
@@ -1754,7 +1751,6 @@ public class PS {
// Protection
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
options.put("protection.redstone.disable-unoccupied", Settings.REDSTONE_DISABLER_UNOCCUPIED);
- options.put("protection.tnt-listener.enabled", Settings.TNT_LISTENER);
options.put("protection.piston.falling-blocks", Settings.PISTON_FALLING_BLOCK_CHECK);
// Clusters
@@ -1885,7 +1881,6 @@ public class PS {
Settings.REDSTONE_DISABLER = config.getBoolean("protection.redstone.disable-offline");
Settings.REDSTONE_DISABLER_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied");
- Settings.TNT_LISTENER = config.getBoolean("protection.tnt-listener.enabled");
Settings.PISTON_FALLING_BLOCK_CHECK = config.getBoolean("protection.piston.falling-blocks");
// Clusters
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Alias.java b/src/main/java/com/intellectualcrafters/plot/commands/Alias.java
index 0affab706..81051fe4b 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Alias.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Alias.java
@@ -50,7 +50,7 @@ public class Alias extends SetCommand {
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
return false;
}
- if (!StringMan.isAlphanumericUnd(alias)) {
+ if (alias.contains(" ") || !StringMan.isAsciiPrintable(alias)) {
C.NOT_VALID_VALUE.send(plr);
return false;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/list.java b/src/main/java/com/intellectualcrafters/plot/commands/list.java
index b91783267..30d2ddda7 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/list.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/list.java
@@ -164,28 +164,12 @@ public class list extends SubCommand {
return false;
}
plots = new ArrayList<>();
- String match;
- if (args.length == 2) {
- match = args[1];
- } else {
- match = null;
- }
for (final Plot plot : PS.get().getPlots()) {
final Flag flag = plot.getFlags().get("done");
if (flag == null) {
continue;
}
- if (match != null) {
- try {
- if (flag.getValueString().matches(match)) {
- plots.add(plot);
- }
- } catch (final Exception e) {
- break;
- }
- } else {
- plots.add(plot);
- }
+ plots.add(plot);
}
Collections.sort(plots, new Comparator() {
@Override
diff --git a/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/src/main/java/com/intellectualcrafters/plot/config/Settings.java
index c68b7b8cf..889b27e75 100644
--- a/src/main/java/com/intellectualcrafters/plot/config/Settings.java
+++ b/src/main/java/com/intellectualcrafters/plot/config/Settings.java
@@ -78,10 +78,6 @@ public class Settings {
public static int CHUNK_PROCESSOR_MAX_BLOCKSTATES = 4096;
public static int CHUNK_PROCESSOR_MAX_ENTITIES = 512;
public static boolean CHUNK_PROCESSOR_DISABLE_PHYSICS = false;
- /**
- * TNT listener
- */
- public static boolean TNT_LISTENER = false;
/**
* Redstone disabler
*/
diff --git a/src/main/java/com/intellectualcrafters/plot/util/Permissions.java b/src/main/java/com/intellectualcrafters/plot/util/Permissions.java
index 6280ea373..ac2762d80 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/Permissions.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/Permissions.java
@@ -14,9 +14,6 @@ public class Permissions {
}
public static boolean hasPermission(final CommandCaller player, String perm) {
- if ((player == null) || player.hasPermission(C.PERMISSION_ADMIN.s()) || player.hasPermission(C.PERMISSION_STAR.s())) {
- return true;
- }
if (player.hasPermission(perm)) {
return true;
}
@@ -45,8 +42,15 @@ public class Permissions {
}
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
- if ((player == null) || player.hasPermission(C.PERMISSION_ADMIN.s()) || player.hasPermission(C.PERMISSION_STAR.s())) {
- return Integer.MAX_VALUE;
+ final String[] nodes = stub.split("\\.");
+ final StringBuilder n = new StringBuilder();
+ for (int i = 0; i < (nodes.length - 1); i++) {
+ n.append(nodes[i] + ("."));
+ if (!stub.equals(n + C.PERMISSION_STAR.s())) {
+ if (player.hasPermission(n + C.PERMISSION_STAR.s())) {
+ return Integer.MAX_VALUE;
+ }
+ }
}
if (player.hasPermission(stub + ".*")) {
return Integer.MAX_VALUE;
diff --git a/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/src/main/java/com/plotsquared/bukkit/BukkitMain.java
index 32807f713..ae3423714 100644
--- a/src/main/java/com/plotsquared/bukkit/BukkitMain.java
+++ b/src/main/java/com/plotsquared/bukkit/BukkitMain.java
@@ -519,11 +519,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
return new BukkitEventUtil();
}
- @Override
- public void registerTNTListener() {
- // No longer here
- }
-
@Override
public void unregister(final PlotPlayer player) {
BukkitUtil.removePlayer(player.getName());
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
index d25d80d42..47457b517 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
@@ -431,10 +431,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
- BukkitUtil.removePlayer(player.getName());
if (!player.hasPlayedBefore()) {
player.saveData();
}
+ BukkitUtil.getPlayer(event.getPlayer()).unregister();;
final PlotPlayer pp = BukkitUtil.getPlayer(player);
// Set last location
@@ -668,10 +668,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
return;
}
final PlotPlayer pp = BukkitUtil.getPlayer(player);
- if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
- return;
- }
if (MainUtil.isPlotAreaAbs(loc)) {
+ if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
+ return;
+ }
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
event.setCancelled(true);
}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeMain.java b/src/main/java/com/plotsquared/sponge/SpongeMain.java
index 02fdb0c79..3b1b66829 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeMain.java
+++ b/src/main/java/com/plotsquared/sponge/SpongeMain.java
@@ -530,12 +530,6 @@ public class SpongeMain implements IPlotMain, PluginContainer {
}
}
- @Override
- public void registerTNTListener() {
- // TODO Auto-generated method stub
- log("registerTNTListener is not implemented!");
- }
-
@Override
public UUIDHandlerImplementation initUUIDHandler() {
UUIDWrapper wrapper;
diff --git a/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/src/main/java/com/plotsquared/sponge/listener/MainListener.java
index d4836f846..35c882b2e 100644
--- a/src/main/java/com/plotsquared/sponge/listener/MainListener.java
+++ b/src/main/java/com/plotsquared/sponge/listener/MainListener.java
@@ -3,11 +3,9 @@ package com.plotsquared.sponge.listener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Predicate;
import org.spongepowered.api.GameProfile;
@@ -29,14 +27,10 @@ import org.spongepowered.api.entity.vehicle.minecart.Minecart;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.action.LightningEvent;
import org.spongepowered.api.event.action.MessageEvent;
-import org.spongepowered.api.event.block.BreakBlockEvent;
import org.spongepowered.api.event.block.ChangeBlockEvent;
import org.spongepowered.api.event.block.GrowBlockEvent;
-import org.spongepowered.api.event.block.HarvestBlockEvent;
import org.spongepowered.api.event.block.InteractBlockEvent;
import org.spongepowered.api.event.block.MoveBlockEvent;
-import org.spongepowered.api.event.block.NotifyNeighborBlockEvent;
-import org.spongepowered.api.event.block.PlaceBlockEvent;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.command.SendCommandEvent;
import org.spongepowered.api.event.entity.BreedEntityEvent;
@@ -46,7 +40,6 @@ import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.event.world.ExplosionEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts;
-import org.spongepowered.api.util.Direction;
import org.spongepowered.api.world.World;
import org.spongepowered.api.world.extent.Extent;
@@ -104,56 +97,56 @@ public class MainListener {
* - enderman harvest
*/
- @Listener
- public void onFluidSpread(final NotifyNeighborBlockEvent.Spread event) {
- onPhysics(event);
- }
-
- @Listener
- public void onFluidSpread(final NotifyNeighborBlockEvent.Burn event) {
- onPhysics(event);
- }
-
- @Listener
- public void onFluidSpread(final NotifyNeighborBlockEvent.Ignite event) {
- onPhysics(event);
- }
-
- @Listener
- public void onFluidSpread(final NotifyNeighborBlockEvent.Power event) {
- // TODO redstone
- }
-
- public void onPhysics(final NotifyNeighborBlockEvent event) {
- final AtomicBoolean cancelled = new AtomicBoolean(false);
- final Map> relatives = event.getRelatives();
- event.filterDirections(new Predicate() {
-
- @Override
- public boolean test(Direction dir) {
- if (cancelled.get()) {
- return true;
- }
- org.spongepowered.api.world.Location loc = relatives.get(dir);
- com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getName(), loc);
- Plot plot = MainUtil.getPlot(plotloc);
- if (plot == null) {
- if (MainUtil.isPlotAreaAbs(plotloc)) {
- cancelled.set(true);
- return false;
- }
- cancelled.set(true);
- return true;
- }
- org.spongepowered.api.world.Location relative = loc.getRelative(dir);
- com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getName(), relative);
- if (plot.equals(MainUtil.getPlot(relLoc))) {
- return true;
- }
- return false;
- }
- });
- }
+ // @Listener
+ // public void onFluidSpread(final NotifyNeighborBlockEvent event) {
+ // onPhysics(event);
+ // }
+ //
+ // @Listener
+ // public void onFluidSpread(final NotifyNeighborBlockEvent.Burn event) {
+ // onPhysics(event);
+ // }
+ //
+ // @Listener
+ // public void onFluidSpread(final NotifyNeighborBlockEvent.Ignite event) {
+ // onPhysics(event);
+ // }
+ //
+ // @Listener
+ // public void onFluidSpread(final NotifyNeighborBlockEvent.Power event) {
+ // // TODO redstone
+ // }
+ //
+ // public void onPhysics(final NotifyNeighborBlockEvent event) {
+ // final AtomicBoolean cancelled = new AtomicBoolean(false);
+ // final Map> relatives = event.getRelatives();
+ // event.filterDirections(new Predicate() {
+ //
+ // @Override
+ // public boolean test(Direction dir) {
+ // if (cancelled.get()) {
+ // return true;
+ // }
+ // org.spongepowered.api.world.Location loc = relatives.get(dir);
+ // com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getName(), loc);
+ // Plot plot = MainUtil.getPlot(plotloc);
+ // if (plot == null) {
+ // if (MainUtil.isPlotAreaAbs(plotloc)) {
+ // cancelled.set(true);
+ // return false;
+ // }
+ // cancelled.set(true);
+ // return true;
+ // }
+ // org.spongepowered.api.world.Location relative = loc.getRelative(dir);
+ // com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getName(), relative);
+ // if (plot.equals(MainUtil.getPlot(relLoc))) {
+ // return true;
+ // }
+ // return false;
+ // }
+ // });
+ // }
public T getCause(Cause cause, Class clazz) {
Optional> root = cause.root();
@@ -502,12 +495,27 @@ public class MainListener {
// }
@Listener
- public void onBlockBreak(final HarvestBlockEvent event) {
-
+ public void onBlockBreak(final ChangeBlockEvent.Decay event) {
+ onBlockChange(event);
}
@Listener
- public void onBlockBreak(final BreakBlockEvent event) {
+ public void onBlockBreak(final ChangeBlockEvent.Fluid event) {
+ onBlockChange(event);
+ }
+
+ @Listener
+ public void onBlockBreak(final ChangeBlockEvent.Grow event) {
+ onBlockChange(event);
+ }
+
+ @Listener
+ public void onBlockBreak(final ChangeBlockEvent.Modify event) {
+ onBlockChange(event);
+ }
+
+ @Listener
+ public void onBlockBreak(final ChangeBlockEvent.Break event) {
Player player = this. getCause(event.getCause(), Player.class);
if (player == null) {
event.setCancelled(true);
@@ -591,7 +599,7 @@ public class MainListener {
}
@Listener
- public void onBlockPlace(final PlaceBlockEvent event) {
+ public void onBlockPlace(final ChangeBlockEvent.Place event) {
Player player = this. getCause(event.getCause(), Player.class);
if (player == null) {
event.setCancelled(true);
diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar
index 4124602bc..644427658 100644
Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ
diff --git a/target/PlotSquared-Sponge.jar b/target/PlotSquared-Sponge.jar
index 8a71508c9..d47c605c7 100644
Binary files a/target/PlotSquared-Sponge.jar and b/target/PlotSquared-Sponge.jar differ