mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -280,7 +279,7 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
||||
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);
|
||||
event.setCancelled(true);
|
||||
event.setBuild(false);
|
||||
@ -309,7 +308,7 @@ public class PaperListener implements Listener {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
PlotPlayer<?> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
||||
entity.remove();
|
||||
@ -334,14 +333,14 @@ public class PaperListener implements Listener {
|
||||
final String[] unprocessedArgs = buffer.split(Pattern.quote(" "));
|
||||
if (unprocessedArgs.length == 1) {
|
||||
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))) {
|
||||
return;
|
||||
}
|
||||
final String[] args = new String[unprocessedArgs.length - 1];
|
||||
System.arraycopy(unprocessedArgs, 1, args, 0, args.length);
|
||||
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(" "));
|
||||
if (objects == null) {
|
||||
return;
|
||||
|
@ -253,7 +253,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
int z = bloc.getBlockZ();
|
||||
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();
|
||||
if (location.getWorld().equals(world)) {
|
||||
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());
|
||||
if (location.isPlotArea()) {
|
||||
if (e.getEntity() instanceof Player) {
|
||||
PlotPlayer player = BukkitUtil.getPlayer((Player) e.getEntity());
|
||||
PlotPlayer<Player> player = BukkitUtil.getPlayer((Player) e.getEntity());
|
||||
Plot plot = player.getCurrentPlot();
|
||||
if (plot != null) {
|
||||
if (!plot.isAdded(player.getUUID())) {
|
||||
@ -346,6 +346,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
if (!plot.getFlag(RedstoneFlag.class)) {
|
||||
event.setNewCurrent(0);
|
||||
plot.debug("Redstone event was cancelled because redstone = false");
|
||||
return;
|
||||
}
|
||||
if (Settings.Redstone.DISABLE_OFFLINE) {
|
||||
@ -372,12 +373,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
if (disable) {
|
||||
event.setNewCurrent(0);
|
||||
plot.debug("Redstone event was cancelled because no trusted player was in the plot");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
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())) {
|
||||
return;
|
||||
}
|
||||
@ -484,7 +486,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
PlotPlayer<Player> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot != null && !plot.isAdded(pp.getUUID())) {
|
||||
entity.remove();
|
||||
@ -505,7 +507,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Plot plot = area.getPlot(location);
|
||||
ProjectileSource shooter = entity.getShooter();
|
||||
if (shooter instanceof Player) {
|
||||
PlotPlayer pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
PlotPlayer<?> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, Captions.PERMISSION_PROJECTILE_UNOWNED)) {
|
||||
entity.remove();
|
||||
@ -547,7 +549,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||
PlotPlayer<Player> plotPlayer = BukkitUtil.getPlayer(player);
|
||||
Location location = plotPlayer.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
@ -652,7 +654,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
public void onConnect(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
BukkitUtil.removePlayer(player.getName());
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final PlotPlayer<Player> pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
Location location = pp.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -691,7 +693,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void playerRespawn(PlayerRespawnEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
PlotPlayer<Player> pp = BukkitUtil.getPlayer(player);
|
||||
PlotSquared.get().getEventDispatcher().doRespawnTask(pp);
|
||||
}
|
||||
|
||||
@ -958,7 +960,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Set<Player> recipients = event.getRecipients();
|
||||
recipients.clear();
|
||||
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")) {
|
||||
spies.add(((BukkitPlayer) pp).player);
|
||||
} else {
|
||||
@ -1106,6 +1108,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
plot.debug("Explosion was cancelled because explosion = false");
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -1150,6 +1154,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (area != null) {
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
if (plot != null && plot.getFlag(MobPlaceFlag.class)) {
|
||||
plot.debug(e.getType() + " could not change block because mob-place = false");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -1179,6 +1184,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (!plot.hasOwner()) {
|
||||
BukkitPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||
if (plot.getFlag(IceFormFlag.class)) {
|
||||
plot.debug("Ice could not be formed because ice-form = false");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -1187,6 +1193,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
BukkitPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||
if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||
if (plot.getFlag(IceFormFlag.class)) {
|
||||
plot.debug("Ice could not be formed because ice-form = false");
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -1218,21 +1225,25 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
switch (event.getSource().getType()) {
|
||||
case GRASS_BLOCK:
|
||||
if (!plot.getFlag(GrassGrowFlag.class)) {
|
||||
plot.debug("Grass could not grow because grass-grow = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case MYCELIUM:
|
||||
if (!plot.getFlag(MycelGrowFlag.class)) {
|
||||
plot.debug("Mycelium could not grow because mycel-grow = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case VINE:
|
||||
if (!plot.getFlag(VineGrowFlag.class)) {
|
||||
plot.debug("Vine could not grow because vine-grow = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case KELP:
|
||||
if (!plot.getFlag(KelpGrowFlag.class)) {
|
||||
plot.debug("Kelp could not grow because kelp-grow = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
@ -1259,6 +1270,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
case SNOW:
|
||||
case SNOW_BLOCK:
|
||||
if (!plot.getFlag(SnowFormFlag.class)) {
|
||||
plot.debug("Snow could not form because snow-form = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
@ -1266,6 +1278,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
case FROSTED_ICE:
|
||||
case PACKED_ICE:
|
||||
if (!plot.getFlag(IceFormFlag.class)) {
|
||||
plot.debug("Ice could not form because ice-form = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -1315,6 +1328,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||
return;
|
||||
}
|
||||
plot.debug(player.getName() + " could not break " + block.getType() +
|
||||
" because it was not in the break flag");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1343,16 +1358,19 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
switch (block.getType()) {
|
||||
case ICE:
|
||||
if (!plot.getFlag(IceMeltFlag.class)) {
|
||||
plot.debug("Ice could not melt because ice-melt = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case SNOW:
|
||||
if (!plot.getFlag(SnowMeltFlag.class)) {
|
||||
plot.debug("Snow could not melt because snow-melt = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case FARMLAND:
|
||||
if (!plot.getFlag(SoilDryFlag.class)) {
|
||||
plot.debug("Soil could not dry because soil-dry = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
@ -1372,6 +1390,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
case FIRE_CORAL_FAN:
|
||||
case HORN_CORAL_FAN:
|
||||
if (!plot.getFlag(CoralDryFlag.class)) {
|
||||
plot.debug("Coral could not dry because coral-dry = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
@ -1390,6 +1409,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (plot != null
|
||||
&& plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
||||
.getBlock().isLiquid()) {
|
||||
plot.debug("Liquid could now flow because liquid-flow = disabled");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1413,11 +1433,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
||||
plot.debug(event.getBlock().getType() + " could not update because disable-physics = true");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (plot.getFlag(LiquidFlowFlag.class) == LiquidFlowFlag.FlowStatus.DISABLED && event
|
||||
.getBlock().isLiquid()) {
|
||||
plot.debug("Liquid could not flow because liquid-flow = disabled");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} 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)) {
|
||||
final ItemStack newStack = new ItemStack(newItem.getType(), newItem.getAmount());
|
||||
event.setCursor(newStack);
|
||||
plot.debug(player.getName() + " could not creative-copy an item because prevent-creative-copy = true");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1845,6 +1868,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||
"plots.admin.interact.other");
|
||||
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);
|
||||
if (plot == null || !plot.getFlag(ExplosionFlag.class)) {
|
||||
event.setCancelled(true);
|
||||
if (plot != null) {
|
||||
plot.debug("Explosion was cancelled because explosion = false");
|
||||
}
|
||||
}
|
||||
event.blockList().removeIf(
|
||||
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);
|
||||
if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) {
|
||||
event.setCancelled(true);
|
||||
plot.debug("Falling block event was cancelled because disable-physics = true");
|
||||
return;
|
||||
}
|
||||
if (event.getTo().hasGravity()) {
|
||||
@ -2172,6 +2200,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot == null || !plot.getFlag(BlockBurnFlag.class)) {
|
||||
plot.debug("Block burning was cancelled because block-burn = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -2225,6 +2254,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (ignitingEntity != null) {
|
||||
if (!plot.getFlag(BlockIgnitionFlag.class)) {
|
||||
event.setCancelled(true);
|
||||
plot.debug("Block ignition was cancelled because block-ignition = false");
|
||||
return;
|
||||
}
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FIREBALL) {
|
||||
@ -2475,6 +2505,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT,
|
||||
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||
event.setCancelled(true);
|
||||
plot.debug(p.getName() + " could not break hanging entity because hanging-break = false");
|
||||
}
|
||||
}
|
||||
} else if (remover instanceof Projectile) {
|
||||
@ -2503,6 +2534,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION_EVENT,
|
||||
Captions.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||
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,
|
||||
"plots.admin.vehicle.break.other");
|
||||
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)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||
"plots.admin.destroy." + stub);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not break armor stand because misc-break = false");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} 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)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||
"plots.admin.pve." + stub);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false OR hostile-attack = false");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} 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)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||
"plots.admin.pve." + stub);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false OR tamned-attack = false");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else if (EntityCategories.PLAYER.contains(entityType)) {
|
||||
@ -2843,6 +2885,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||
"plots.admin.pvp." + stub);
|
||||
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -2856,6 +2899,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
} else if (EntityCategories.ANIMAL.contains(entityType)) { // victim is animal
|
||||
if (plot != null && (plot.getFlag(AnimalAttackFlag.class) || plot
|
||||
.getFlag(PveFlag.class) || plot.isAdded(plotPlayer.getUUID()))) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false OR animal-attack = false");
|
||||
return true;
|
||||
}
|
||||
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)) {
|
||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||
"plots.admin.pve." + stub);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType + " because pve = false");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,13 @@ public class Debug extends SubCommand {
|
||||
MainUtil.sendMessage(player, String.format("There are %d cached UUIDs", mappings.size()));
|
||||
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])) {
|
||||
EntityCategories.init();
|
||||
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,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
if (toggle(player, "debug")) {
|
||||
if (!toggle(player, "debug")) {
|
||||
MainUtil.sendMessage(player, Captions.TOGGLE_ENABLED, command.toString());
|
||||
} else {
|
||||
MainUtil.sendMessage(player, Captions.TOGGLE_DISABLED, command.toString());
|
||||
|
@ -805,7 +805,7 @@ public enum Captions implements Caption {
|
||||
//</editor-fold>
|
||||
|
||||
//<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>
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
@Comment("Use UUID cache to complete usernames")
|
||||
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 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())) {
|
||||
throw new IllegalArgumentException(String
|
||||
.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);
|
||||
}
|
||||
|
||||
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()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -2925,7 +2925,7 @@ public class Plot {
|
||||
}
|
||||
|
||||
public void debug(@NotNull final String message) {
|
||||
final Collection<PlotPlayer<?>> players = PlotPlayer.getDebugModePlayerInPlot(this);
|
||||
final Collection<PlotPlayer<?>> players = PlotPlayer.getDebugModePlayersInPlot(this);
|
||||
if (players.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user