mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Add plot debugging and make tab completable aliases configurable
This commit is contained in:
parent
2d6e6ceaeb
commit
2b4e2fc793
@ -60,7 +60,6 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
|
|||||||
import org.bukkit.projectiles.ProjectileSource;
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -280,7 +279,7 @@ public class PaperListener implements Listener {
|
|||||||
}
|
}
|
||||||
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
||||||
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
||||||
final PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
final PlotPlayer<?> plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
||||||
Captions.TILE_ENTITY_CAP_REACHED.send(plotPlayer, Settings.Chunk_Processor.MAX_TILES);
|
Captions.TILE_ENTITY_CAP_REACHED.send(plotPlayer, Settings.Chunk_Processor.MAX_TILES);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setBuild(false);
|
event.setBuild(false);
|
||||||
@ -309,7 +308,7 @@ public class PaperListener implements Listener {
|
|||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
@ -334,14 +333,14 @@ public class PaperListener implements Listener {
|
|||||||
final String[] unprocessedArgs = buffer.split(Pattern.quote(" "));
|
final String[] unprocessedArgs = buffer.split(Pattern.quote(" "));
|
||||||
if (unprocessedArgs.length == 1) {
|
if (unprocessedArgs.length == 1) {
|
||||||
return; // We don't do anything in this case
|
return; // We don't do anything in this case
|
||||||
} else if (!Arrays.asList("plot", "plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap")
|
} else if (!Settings.Enabled_Components.TAB_COMPLETED_ALIASES
|
||||||
.contains(unprocessedArgs[0].toLowerCase(Locale.ENGLISH))) {
|
.contains(unprocessedArgs[0].toLowerCase(Locale.ENGLISH))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String[] args = new String[unprocessedArgs.length - 1];
|
final String[] args = new String[unprocessedArgs.length - 1];
|
||||||
System.arraycopy(unprocessedArgs, 1, args, 0, args.length);
|
System.arraycopy(unprocessedArgs, 1, args, 0, args.length);
|
||||||
try {
|
try {
|
||||||
final PlotPlayer player = BukkitUtil.getPlayer((Player) event.getSender());
|
final PlotPlayer<?> player = BukkitUtil.getPlayer((Player) event.getSender());
|
||||||
final Collection<Command> objects = MainCommand.getInstance().tab(player, args, buffer.endsWith(" "));
|
final Collection<Command> objects = MainCommand.getInstance().tab(player, args, buffer.endsWith(" "));
|
||||||
if (objects == null) {
|
if (objects == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -253,7 +253,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
int z = bloc.getBlockZ();
|
int z = bloc.getBlockZ();
|
||||||
int distance = Bukkit.getViewDistance() * 16;
|
int distance = Bukkit.getViewDistance() * 16;
|
||||||
|
|
||||||
for (final PlotPlayer player : PlotSquared.imp().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> player : PlotSquared.imp().getPlayerManager().getPlayers()) {
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
if (location.getWorld().equals(world)) {
|
if (location.getWorld().equals(world)) {
|
||||||
if (16 * Math.abs(location.getX() - x) / 16 > distance
|
if (16 * Math.abs(location.getX() - x) / 16 > distance
|
||||||
@ -313,7 +313,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Location location = BukkitUtil.getLocation(e.getEntity());
|
Location location = BukkitUtil.getLocation(e.getEntity());
|
||||||
if (location.isPlotArea()) {
|
if (location.isPlotArea()) {
|
||||||
if (e.getEntity() instanceof Player) {
|
if (e.getEntity() instanceof Player) {
|
||||||
PlotPlayer player = BukkitUtil.getPlayer((Player) e.getEntity());
|
PlotPlayer<Player> player = BukkitUtil.getPlayer((Player) e.getEntity());
|
||||||
Plot plot = player.getCurrentPlot();
|
Plot plot = player.getCurrentPlot();
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.isAdded(player.getUUID())) {
|
if (!plot.isAdded(player.getUUID())) {
|
||||||
@ -346,6 +346,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!plot.getFlag(RedstoneFlag.class)) {
|
if (!plot.getFlag(RedstoneFlag.class)) {
|
||||||
event.setNewCurrent(0);
|
event.setNewCurrent(0);
|
||||||
|
plot.debug("Redstone event was cancelled because redstone = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Settings.Redstone.DISABLE_OFFLINE) {
|
if (Settings.Redstone.DISABLE_OFFLINE) {
|
||||||
@ -372,12 +373,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (disable) {
|
if (disable) {
|
||||||
event.setNewCurrent(0);
|
event.setNewCurrent(0);
|
||||||
|
plot.debug("Redstone event was cancelled because no trusted player was in the plot");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
|
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
|
||||||
for (final PlotPlayer player : PlotSquared.imp().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> player : PlotSquared.imp().getPlayerManager().getPlayers()) {
|
||||||
if (plot.equals(player.getCurrentPlot())) {
|
if (plot.equals(player.getCurrentPlot())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -484,7 +486,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer<Player> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
@ -505,7 +507,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
ProjectileSource shooter = entity.getShooter();
|
ProjectileSource shooter = entity.getShooter();
|
||||||
if (shooter instanceof Player) {
|
if (shooter instanceof Player) {
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, Captions.PERMISSION_PROJECTILE_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, Captions.PERMISSION_PROJECTILE_UNOWNED)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
@ -547,7 +549,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer<Player> plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
Location location = plotPlayer.getLocation();
|
Location location = plotPlayer.getLocation();
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
@ -652,7 +654,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onConnect(PlayerJoinEvent event) {
|
public void onConnect(PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
BukkitUtil.removePlayer(player.getName());
|
BukkitUtil.removePlayer(player.getName());
|
||||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
final PlotPlayer<Player> pp = BukkitUtil.getPlayer(player);
|
||||||
|
|
||||||
Location location = pp.getLocation();
|
Location location = pp.getLocation();
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
@ -691,7 +693,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void playerRespawn(PlayerRespawnEvent event) {
|
public void playerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
PlotPlayer<Player> pp = BukkitUtil.getPlayer(player);
|
||||||
PlotSquared.get().getEventDispatcher().doRespawnTask(pp);
|
PlotSquared.get().getEventDispatcher().doRespawnTask(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,7 +960,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Set<Player> recipients = event.getRecipients();
|
Set<Player> recipients = event.getRecipients();
|
||||||
recipients.clear();
|
recipients.clear();
|
||||||
Set<Player> spies = new HashSet<>();
|
Set<Player> spies = new HashSet<>();
|
||||||
for (final PlotPlayer pp : PlotSquared.imp().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer<?> pp : PlotSquared.imp().getPlayerManager().getPlayers()) {
|
||||||
if (pp.getAttribute("chatspy")) {
|
if (pp.getAttribute("chatspy")) {
|
||||||
spies.add(((BukkitPlayer) pp).player);
|
spies.add(((BukkitPlayer) pp).player);
|
||||||
} else {
|
} else {
|
||||||
@ -1106,6 +1108,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
plot.debug("Explosion was cancelled because explosion = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1150,6 +1154,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (area != null) {
|
if (area != null) {
|
||||||
Plot plot = area.getOwnedPlot(location);
|
Plot plot = area.getOwnedPlot(location);
|
||||||
if (plot != null && plot.getFlag(MobPlaceFlag.class)) {
|
if (plot != null && plot.getFlag(MobPlaceFlag.class)) {
|
||||||
|
plot.debug(e.getType() + " could not change block because mob-place = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1179,6 +1184,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
BukkitPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
BukkitPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (plot.getFlag(IceFormFlag.class)) {
|
if (plot.getFlag(IceFormFlag.class)) {
|
||||||
|
plot.debug("Ice could not be formed because ice-form = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1187,6 +1193,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
BukkitPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
BukkitPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (!plot.isAdded(plotPlayer.getUUID())) {
|
if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
if (plot.getFlag(IceFormFlag.class)) {
|
if (plot.getFlag(IceFormFlag.class)) {
|
||||||
|
plot.debug("Ice could not be formed because ice-form = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1218,21 +1225,25 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
switch (event.getSource().getType()) {
|
switch (event.getSource().getType()) {
|
||||||
case GRASS_BLOCK:
|
case GRASS_BLOCK:
|
||||||
if (!plot.getFlag(GrassGrowFlag.class)) {
|
if (!plot.getFlag(GrassGrowFlag.class)) {
|
||||||
|
plot.debug("Grass could not grow because grass-grow = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MYCELIUM:
|
case MYCELIUM:
|
||||||
if (!plot.getFlag(MycelGrowFlag.class)) {
|
if (!plot.getFlag(MycelGrowFlag.class)) {
|
||||||
|
plot.debug("Mycelium could not grow because mycel-grow = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VINE:
|
case VINE:
|
||||||
if (!plot.getFlag(VineGrowFlag.class)) {
|
if (!plot.getFlag(VineGrowFlag.class)) {
|
||||||
|
plot.debug("Vine could not grow because vine-grow = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KELP:
|
case KELP:
|
||||||
if (!plot.getFlag(KelpGrowFlag.class)) {
|
if (!plot.getFlag(KelpGrowFlag.class)) {
|
||||||
|
plot.debug("Kelp could not grow because kelp-grow = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1259,6 +1270,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case SNOW:
|
case SNOW:
|
||||||
case SNOW_BLOCK:
|
case SNOW_BLOCK:
|
||||||
if (!plot.getFlag(SnowFormFlag.class)) {
|
if (!plot.getFlag(SnowFormFlag.class)) {
|
||||||
|
plot.debug("Snow could not form because snow-form = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -1266,6 +1278,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case FROSTED_ICE:
|
case FROSTED_ICE:
|
||||||
case PACKED_ICE:
|
case PACKED_ICE:
|
||||||
if (!plot.getFlag(IceFormFlag.class)) {
|
if (!plot.getFlag(IceFormFlag.class)) {
|
||||||
|
plot.debug("Ice could not form because ice-form = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1315,6 +1328,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
plot.debug(player.getName() + " could not break " + block.getType() +
|
||||||
|
" because it was not in the break flag");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1343,16 +1358,19 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
switch (block.getType()) {
|
switch (block.getType()) {
|
||||||
case ICE:
|
case ICE:
|
||||||
if (!plot.getFlag(IceMeltFlag.class)) {
|
if (!plot.getFlag(IceMeltFlag.class)) {
|
||||||
|
plot.debug("Ice could not melt because ice-melt = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SNOW:
|
case SNOW:
|
||||||
if (!plot.getFlag(SnowMeltFlag.class)) {
|
if (!plot.getFlag(SnowMeltFlag.class)) {
|
||||||
|
plot.debug("Snow could not melt because snow-melt = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FARMLAND:
|
case FARMLAND:
|
||||||
if (!plot.getFlag(SoilDryFlag.class)) {
|
if (!plot.getFlag(SoilDryFlag.class)) {
|
||||||
|
plot.debug("Soil could not dry because soil-dry = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1372,6 +1390,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case FIRE_CORAL_FAN:
|
case FIRE_CORAL_FAN:
|
||||||
case HORN_CORAL_FAN:
|
case HORN_CORAL_FAN:
|
||||||
if (!plot.getFlag(CoralDryFlag.class)) {
|
if (!plot.getFlag(CoralDryFlag.class)) {
|
||||||
|
plot.debug("Coral could not dry because coral-dry = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1390,6 +1409,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (plot != null
|
if (plot != null
|
||||||
&& plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
&& plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
||||||
.getBlock().isLiquid()) {
|
.getBlock().isLiquid()) {
|
||||||
|
plot.debug("Liquid could now flow because liquid-flow = disabled");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1413,11 +1433,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
|
plot.debug(event.getBlock().getType() + " could not update because disable-physics = true");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
if (plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
||||||
.getBlock().isLiquid()) {
|
.getBlock().isLiquid()) {
|
||||||
|
plot.debug("Liquid could not flow because liquid-flow = disabled");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
||||||
@ -1698,6 +1720,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_INTERACT_OTHER)) {
|
||||||
final ItemStack newStack = new ItemStack(newItem.getType(), newItem.getAmount());
|
final ItemStack newStack = new ItemStack(newItem.getType(), newItem.getAmount());
|
||||||
event.setCursor(newStack);
|
event.setCursor(newStack);
|
||||||
|
plot.debug(player.getName() + " could not creative-copy an item because prevent-creative-copy = true");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1845,6 +1868,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.interact.other");
|
"plots.admin.interact.other");
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
plot.debug(pp.getName() + " could not interact with " + entity.getType() + " bcause misc-interact = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1872,6 +1896,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Plot plot = area.getOwnedPlot(location);
|
Plot plot = area.getOwnedPlot(location);
|
||||||
if (plot == null || !plot.getFlag(ExplosionFlag.class)) {
|
if (plot == null || !plot.getFlag(ExplosionFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
if (plot != null) {
|
||||||
|
plot.debug("Explosion was cancelled because explosion = false");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
event.blockList().removeIf(
|
event.blockList().removeIf(
|
||||||
blox -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(blox.getLocation()))));
|
blox -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(blox.getLocation()))));
|
||||||
@ -2137,6 +2164,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Plot plot = area.getOwnedPlotAbs(location);
|
Plot plot = area.getOwnedPlotAbs(location);
|
||||||
if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) {
|
if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
plot.debug("Falling block event was cancelled because disable-physics = true");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getTo().hasGravity()) {
|
if (event.getTo().hasGravity()) {
|
||||||
@ -2172,6 +2200,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
|
|
||||||
Plot plot = location.getOwnedPlot();
|
Plot plot = location.getOwnedPlot();
|
||||||
if (plot == null || !plot.getFlag(BlockBurnFlag.class)) {
|
if (plot == null || !plot.getFlag(BlockBurnFlag.class)) {
|
||||||
|
plot.debug("Block burning was cancelled because block-burn = false");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2225,6 +2254,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (ignitingEntity != null) {
|
if (ignitingEntity != null) {
|
||||||
if (!plot.getFlag(BlockIgnitionFlag.class)) {
|
if (!plot.getFlag(BlockIgnitionFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
plot.debug("Block ignition was cancelled because block-ignition = false");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FIREBALL) {
|
if (igniteCause == BlockIgniteEvent.IgniteCause.FIREBALL) {
|
||||||
@ -2475,6 +2505,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
plot.debug(p.getName() + " could not break hanging entity because hanging-break = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (remover instanceof Projectile) {
|
} else if (remover instanceof Projectile) {
|
||||||
@ -2503,6 +2534,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
|
||||||
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
plot.debug(player.getName() + " could not break hanging entity because hanging-break = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2621,6 +2653,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.vehicle.break.other");
|
"plots.admin.vehicle.break.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
plot.debug(pp.getName() + " could not break vehicle because vehicle-break = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2815,6 +2848,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.destroy." + stub);
|
"plots.admin.destroy." + stub);
|
||||||
|
if (plot != null) {
|
||||||
|
plot.debug(player.getName() + " could not break armor stand because misc-break = false");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (EntityCategories.HOSTILE.contains(entityType)) {
|
} else if (EntityCategories.HOSTILE.contains(entityType)) {
|
||||||
@ -2825,6 +2861,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
|
if (plot != null) {
|
||||||
|
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false OR hostile-attack = false");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (EntityCategories.TAMEABLE.contains(entityType)) { // victim is tameable
|
} else if (EntityCategories.TAMEABLE.contains(entityType)) { // victim is tameable
|
||||||
@ -2835,6 +2874,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
|
if (plot != null) {
|
||||||
|
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false OR tamned-attack = false");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (EntityCategories.PLAYER.contains(entityType)) {
|
} else if (EntityCategories.PLAYER.contains(entityType)) {
|
||||||
@ -2843,6 +2885,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.pvp." + stub);
|
"plots.admin.pvp." + stub);
|
||||||
|
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -2856,6 +2899,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
} else if (EntityCategories.ANIMAL.contains(entityType)) { // victim is animal
|
} else if (EntityCategories.ANIMAL.contains(entityType)) { // victim is animal
|
||||||
if (plot != null && (plot.getFlag(AnimalAttackFlag.class) || plot
|
if (plot != null && (plot.getFlag(AnimalAttackFlag.class) || plot
|
||||||
.getFlag(PveFlag.class) || plot.isAdded(plotPlayer.getUUID()))) {
|
.getFlag(PveFlag.class) || plot.isAdded(plotPlayer.getUUID()))) {
|
||||||
|
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false OR animal-attack = false");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
@ -2874,6 +2918,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.pve." + stub);
|
"plots.admin.pve." + stub);
|
||||||
|
if (plot != null) {
|
||||||
|
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,13 @@ public class Debug extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, String.format("There are %d cached UUIDs", mappings.size()));
|
MainUtil.sendMessage(player, String.format("There are %d cached UUIDs", mappings.size()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (args.length > 0 && "debug-players".equalsIgnoreCase(args[0])) {
|
||||||
|
MainUtil.sendMessage(player, "Player in debug mode: " );
|
||||||
|
for (final PlotPlayer<?> pp : PlotPlayer.getDebugModePlayers()) {
|
||||||
|
MainUtil.sendMessage(player, "- " + pp.getName());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
|
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
|
||||||
EntityCategories.init();
|
EntityCategories.init();
|
||||||
player.sendMessage(Captions.PREFIX.getTranslated() + "§cEntity Categories: ");
|
player.sendMessage(Captions.PREFIX.getTranslated() + "§cEntity Categories: ");
|
||||||
|
@ -129,7 +129,7 @@ public class Toggle extends Command {
|
|||||||
public void debug(Command command, PlotPlayer<?> player, String[] args,
|
public void debug(Command command, PlotPlayer<?> player, String[] args,
|
||||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||||
RunnableVal2<Command, CommandResult> whenDone) {
|
RunnableVal2<Command, CommandResult> whenDone) {
|
||||||
if (toggle(player, "debug")) {
|
if (!toggle(player, "debug")) {
|
||||||
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||||
|
@ -805,7 +805,7 @@ public enum Captions implements Caption {
|
|||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
//<editor-fold desc="Debug">
|
//<editor-fold desc="Debug">
|
||||||
PLOT_DEBUG("$1Plot Debug ($2%plot%$1): %message%", "Plot-Debug"),
|
PLOT_DEBUG("$2Plot Debug ($1%plot%$2): %message%", "Plot-Debug"),
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -568,6 +568,8 @@ public class Settings extends Config {
|
|||||||
"Read more about components here: https://wiki.intellectualsites.com/en/plotsquared/installation/plot-components"}) public static boolean COMPONENT_PRESETS = true;
|
"Read more about components here: https://wiki.intellectualsites.com/en/plotsquared/installation/plot-components"}) public static boolean COMPONENT_PRESETS = true;
|
||||||
@Comment("Use UUID cache to complete usernames")
|
@Comment("Use UUID cache to complete usernames")
|
||||||
public static boolean EXTENDED_USERNAME_COMPLETION = true;
|
public static boolean EXTENDED_USERNAME_COMPLETION = true;
|
||||||
|
@Comment("Command aliases that will be tab completed")
|
||||||
|
public static List<String> TAB_COMPLETED_ALIASES = Arrays.asList("plot", "plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
private ConcurrentHashMap<String, Object> meta;
|
private ConcurrentHashMap<String, Object> meta;
|
||||||
private int hash;
|
private int hash;
|
||||||
|
|
||||||
public static <T> PlotPlayer from(@NonNull final T object) {
|
public static <T> PlotPlayer<T> from(@NonNull final T object) {
|
||||||
if (!converters.containsKey(object.getClass())) {
|
if (!converters.containsKey(object.getClass())) {
|
||||||
throw new IllegalArgumentException(String
|
throw new IllegalArgumentException(String
|
||||||
.format("There is no registered PlotPlayer converter for type %s",
|
.format("There is no registered PlotPlayer converter for type %s",
|
||||||
@ -101,7 +101,11 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
converters.put(clazz, converter);
|
converters.put(clazz, converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<PlotPlayer<?>> getDebugModePlayerInPlot(@NotNull final Plot plot) {
|
public static Collection<PlotPlayer<?>> getDebugModePlayers() {
|
||||||
|
return Collections.unmodifiableCollection(debugModeEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Collection<PlotPlayer<?>> getDebugModePlayersInPlot(@NotNull final Plot plot) {
|
||||||
if (debugModeEnabled.isEmpty()) {
|
if (debugModeEnabled.isEmpty()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -2925,7 +2925,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void debug(@NotNull final String message) {
|
public void debug(@NotNull final String message) {
|
||||||
final Collection<PlotPlayer<?>> players = PlotPlayer.getDebugModePlayerInPlot(this);
|
final Collection<PlotPlayer<?>> players = PlotPlayer.getDebugModePlayersInPlot(this);
|
||||||
if (players.isEmpty()) {
|
if (players.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user