mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
parent
8e874ddeb0
commit
50c6753bf4
7
pom.xml
7
pom.xml
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>3.2.9</version>
|
||||
<version>3.2.10</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
@ -147,6 +147,11 @@
|
||||
<artifactId>javax.websocket-api</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.spongepowered</groupId>
|
||||
<artifactId>sponge</artifactId>
|
||||
<version>1.8-1519-2.1DEV-693</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.spongepowered</groupId>
|
||||
<artifactId>spongeapi</artifactId>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<Plot>() {
|
||||
@Override
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<Direction, org.spongepowered.api.world.Location<World>> relatives = event.getRelatives();
|
||||
event.filterDirections(new Predicate<Direction>() {
|
||||
|
||||
@Override
|
||||
public boolean test(Direction dir) {
|
||||
if (cancelled.get()) {
|
||||
return true;
|
||||
}
|
||||
org.spongepowered.api.world.Location<World> 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<World> 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<Direction, org.spongepowered.api.world.Location<World>> relatives = event.getRelatives();
|
||||
// event.filterDirections(new Predicate<Direction>() {
|
||||
//
|
||||
// @Override
|
||||
// public boolean test(Direction dir) {
|
||||
// if (cancelled.get()) {
|
||||
// return true;
|
||||
// }
|
||||
// org.spongepowered.api.world.Location<World> 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<World> 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> T getCause(Cause cause, Class<T> 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.<Player> 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.<Player> getCause(event.getCause(), Player.class);
|
||||
if (player == null) {
|
||||
event.setCancelled(true);
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user