mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
parent
8e874ddeb0
commit
50c6753bf4
7
pom.xml
7
pom.xml
@ -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>3.2.9</version>
|
<version>3.2.10</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
@ -147,6 +147,11 @@
|
|||||||
<artifactId>javax.websocket-api</artifactId>
|
<artifactId>javax.websocket-api</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--<dependency>
|
||||||
|
<groupId>org.spongepowered</groupId>
|
||||||
|
<artifactId>sponge</artifactId>
|
||||||
|
<version>1.8-1519-2.1DEV-693</version>
|
||||||
|
</dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spongepowered</groupId>
|
<groupId>org.spongepowered</groupId>
|
||||||
<artifactId>spongeapi</artifactId>
|
<artifactId>spongeapi</artifactId>
|
||||||
|
@ -122,11 +122,6 @@ public interface IPlotMain {
|
|||||||
*/
|
*/
|
||||||
boolean initWorldEdit();
|
boolean initWorldEdit();
|
||||||
|
|
||||||
/**
|
|
||||||
* Register TNT related events (if TNT protection is enabled)
|
|
||||||
*/
|
|
||||||
void registerTNTListener();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the economy provider
|
* Get the economy provider
|
||||||
* @return
|
* @return
|
||||||
|
@ -191,9 +191,6 @@ public class PS {
|
|||||||
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
|
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
|
||||||
}
|
}
|
||||||
IMP.startMetrics();
|
IMP.startMetrics();
|
||||||
if (Settings.TNT_LISTENER) {
|
|
||||||
IMP.registerTNTListener();
|
|
||||||
}
|
|
||||||
if (Settings.CHUNK_PROCESSOR) {
|
if (Settings.CHUNK_PROCESSOR) {
|
||||||
IMP.registerChunkProcessor();
|
IMP.registerChunkProcessor();
|
||||||
}
|
}
|
||||||
@ -1754,7 +1751,6 @@ public class PS {
|
|||||||
// Protection
|
// Protection
|
||||||
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
|
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
|
||||||
options.put("protection.redstone.disable-unoccupied", Settings.REDSTONE_DISABLER_UNOCCUPIED);
|
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);
|
options.put("protection.piston.falling-blocks", Settings.PISTON_FALLING_BLOCK_CHECK);
|
||||||
|
|
||||||
// Clusters
|
// Clusters
|
||||||
@ -1885,7 +1881,6 @@ public class PS {
|
|||||||
Settings.REDSTONE_DISABLER = config.getBoolean("protection.redstone.disable-offline");
|
Settings.REDSTONE_DISABLER = config.getBoolean("protection.redstone.disable-offline");
|
||||||
Settings.REDSTONE_DISABLER_UNOCCUPIED = config.getBoolean("protection.redstone.disable-unoccupied");
|
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");
|
Settings.PISTON_FALLING_BLOCK_CHECK = config.getBoolean("protection.piston.falling-blocks");
|
||||||
|
|
||||||
// Clusters
|
// Clusters
|
||||||
|
@ -50,7 +50,7 @@ public class Alias extends SetCommand {
|
|||||||
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
|
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!StringMan.isAlphanumericUnd(alias)) {
|
if (alias.contains(" ") || !StringMan.isAsciiPrintable(alias)) {
|
||||||
C.NOT_VALID_VALUE.send(plr);
|
C.NOT_VALID_VALUE.send(plr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -164,29 +164,13 @@ public class list extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
String match;
|
|
||||||
if (args.length == 2) {
|
|
||||||
match = args[1];
|
|
||||||
} else {
|
|
||||||
match = null;
|
|
||||||
}
|
|
||||||
for (final Plot plot : PS.get().getPlots()) {
|
for (final Plot plot : PS.get().getPlots()) {
|
||||||
final Flag flag = plot.getFlags().get("done");
|
final Flag flag = plot.getFlags().get("done");
|
||||||
if (flag == null) {
|
if (flag == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (match != null) {
|
|
||||||
try {
|
|
||||||
if (flag.getValueString().matches(match)) {
|
|
||||||
plots.add(plot);
|
plots.add(plot);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
plots.add(plot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Collections.sort(plots, new Comparator<Plot>() {
|
Collections.sort(plots, new Comparator<Plot>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(final Plot a, final Plot b) {
|
public int compare(final Plot a, final Plot b) {
|
||||||
|
@ -78,10 +78,6 @@ public class Settings {
|
|||||||
public static int CHUNK_PROCESSOR_MAX_BLOCKSTATES = 4096;
|
public static int CHUNK_PROCESSOR_MAX_BLOCKSTATES = 4096;
|
||||||
public static int CHUNK_PROCESSOR_MAX_ENTITIES = 512;
|
public static int CHUNK_PROCESSOR_MAX_ENTITIES = 512;
|
||||||
public static boolean CHUNK_PROCESSOR_DISABLE_PHYSICS = false;
|
public static boolean CHUNK_PROCESSOR_DISABLE_PHYSICS = false;
|
||||||
/**
|
|
||||||
* TNT listener
|
|
||||||
*/
|
|
||||||
public static boolean TNT_LISTENER = false;
|
|
||||||
/**
|
/**
|
||||||
* Redstone disabler
|
* Redstone disabler
|
||||||
*/
|
*/
|
||||||
|
@ -14,9 +14,6 @@ public class Permissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPermission(final CommandCaller player, String perm) {
|
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)) {
|
if (player.hasPermission(perm)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -45,9 +42,16 @@ public class Permissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
|
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())) {
|
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;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (player.hasPermission(stub + ".*")) {
|
if (player.hasPermission(stub + ".*")) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -519,11 +519,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
return new BukkitEventUtil();
|
return new BukkitEventUtil();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerTNTListener() {
|
|
||||||
// No longer here
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unregister(final PlotPlayer player) {
|
public void unregister(final PlotPlayer player) {
|
||||||
BukkitUtil.removePlayer(player.getName());
|
BukkitUtil.removePlayer(player.getName());
|
||||||
|
@ -431,10 +431,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onJoin(final PlayerJoinEvent event) {
|
public void onJoin(final PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
BukkitUtil.removePlayer(player.getName());
|
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
player.saveData();
|
player.saveData();
|
||||||
}
|
}
|
||||||
|
BukkitUtil.getPlayer(event.getPlayer()).unregister();;
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
|
||||||
// Set last location
|
// Set last location
|
||||||
@ -668,10 +668,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
if (MainUtil.isPlotAreaAbs(loc)) {
|
||||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MainUtil.isPlotAreaAbs(loc)) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
|
||||||
event.setCancelled(true);
|
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
|
@Override
|
||||||
public UUIDHandlerImplementation initUUIDHandler() {
|
public UUIDHandlerImplementation initUUIDHandler() {
|
||||||
UUIDWrapper wrapper;
|
UUIDWrapper wrapper;
|
||||||
|
@ -3,11 +3,9 @@ package com.plotsquared.sponge.listener;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.spongepowered.api.GameProfile;
|
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.Listener;
|
||||||
import org.spongepowered.api.event.action.LightningEvent;
|
import org.spongepowered.api.event.action.LightningEvent;
|
||||||
import org.spongepowered.api.event.action.MessageEvent;
|
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.ChangeBlockEvent;
|
||||||
import org.spongepowered.api.event.block.GrowBlockEvent;
|
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.InteractBlockEvent;
|
||||||
import org.spongepowered.api.event.block.MoveBlockEvent;
|
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.cause.Cause;
|
||||||
import org.spongepowered.api.event.command.SendCommandEvent;
|
import org.spongepowered.api.event.command.SendCommandEvent;
|
||||||
import org.spongepowered.api.event.entity.BreedEntityEvent;
|
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.event.world.ExplosionEvent;
|
||||||
import org.spongepowered.api.text.Text;
|
import org.spongepowered.api.text.Text;
|
||||||
import org.spongepowered.api.text.Texts;
|
import org.spongepowered.api.text.Texts;
|
||||||
import org.spongepowered.api.util.Direction;
|
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
import org.spongepowered.api.world.extent.Extent;
|
import org.spongepowered.api.world.extent.Extent;
|
||||||
|
|
||||||
@ -104,56 +97,56 @@ public class MainListener {
|
|||||||
* - enderman harvest
|
* - enderman harvest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Listener
|
// @Listener
|
||||||
public void onFluidSpread(final NotifyNeighborBlockEvent.Spread event) {
|
// public void onFluidSpread(final NotifyNeighborBlockEvent event) {
|
||||||
onPhysics(event);
|
// onPhysics(event);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Listener
|
// @Listener
|
||||||
public void onFluidSpread(final NotifyNeighborBlockEvent.Burn event) {
|
// public void onFluidSpread(final NotifyNeighborBlockEvent.Burn event) {
|
||||||
onPhysics(event);
|
// onPhysics(event);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Listener
|
// @Listener
|
||||||
public void onFluidSpread(final NotifyNeighborBlockEvent.Ignite event) {
|
// public void onFluidSpread(final NotifyNeighborBlockEvent.Ignite event) {
|
||||||
onPhysics(event);
|
// onPhysics(event);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Listener
|
// @Listener
|
||||||
public void onFluidSpread(final NotifyNeighborBlockEvent.Power event) {
|
// public void onFluidSpread(final NotifyNeighborBlockEvent.Power event) {
|
||||||
// TODO redstone
|
// // TODO redstone
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void onPhysics(final NotifyNeighborBlockEvent event) {
|
// public void onPhysics(final NotifyNeighborBlockEvent event) {
|
||||||
final AtomicBoolean cancelled = new AtomicBoolean(false);
|
// final AtomicBoolean cancelled = new AtomicBoolean(false);
|
||||||
final Map<Direction, org.spongepowered.api.world.Location<World>> relatives = event.getRelatives();
|
// final Map<Direction, org.spongepowered.api.world.Location<World>> relatives = event.getRelatives();
|
||||||
event.filterDirections(new Predicate<Direction>() {
|
// event.filterDirections(new Predicate<Direction>() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public boolean test(Direction dir) {
|
// public boolean test(Direction dir) {
|
||||||
if (cancelled.get()) {
|
// if (cancelled.get()) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
org.spongepowered.api.world.Location<World> loc = relatives.get(dir);
|
// org.spongepowered.api.world.Location<World> loc = relatives.get(dir);
|
||||||
com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getName(), loc);
|
// com.intellectualcrafters.plot.object.Location plotloc = SpongeUtil.getLocation(loc.getExtent().getName(), loc);
|
||||||
Plot plot = MainUtil.getPlot(plotloc);
|
// Plot plot = MainUtil.getPlot(plotloc);
|
||||||
if (plot == null) {
|
// if (plot == null) {
|
||||||
if (MainUtil.isPlotAreaAbs(plotloc)) {
|
// if (MainUtil.isPlotAreaAbs(plotloc)) {
|
||||||
cancelled.set(true);
|
// cancelled.set(true);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
cancelled.set(true);
|
// cancelled.set(true);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
org.spongepowered.api.world.Location<World> relative = loc.getRelative(dir);
|
// org.spongepowered.api.world.Location<World> relative = loc.getRelative(dir);
|
||||||
com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getName(), relative);
|
// com.intellectualcrafters.plot.object.Location relLoc = SpongeUtil.getLocation(relative.getExtent().getName(), relative);
|
||||||
if (plot.equals(MainUtil.getPlot(relLoc))) {
|
// if (plot.equals(MainUtil.getPlot(relLoc))) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
public <T> T getCause(Cause cause, Class<T> clazz) {
|
public <T> T getCause(Cause cause, Class<T> clazz) {
|
||||||
Optional<?> root = cause.root();
|
Optional<?> root = cause.root();
|
||||||
@ -502,12 +495,27 @@ public class MainListener {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
public void onBlockBreak(final HarvestBlockEvent event) {
|
public void onBlockBreak(final ChangeBlockEvent.Decay event) {
|
||||||
|
onBlockChange(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Listener
|
@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);
|
Player player = this.<Player> getCause(event.getCause(), Player.class);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -591,7 +599,7 @@ public class MainListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
public void onBlockPlace(final PlaceBlockEvent event) {
|
public void onBlockPlace(final ChangeBlockEvent.Place event) {
|
||||||
Player player = this.<Player> getCause(event.getCause(), Player.class);
|
Player player = this.<Player> getCause(event.getCause(), Player.class);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user