From b13dea19c579cc01e775169aaa1c2ff9692f5eb8 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 27 Apr 2020 17:53:56 -0400 Subject: [PATCH] Add debug messages --- .../java/com/boydti/fawe/config/Settings.java | 5 +++++ .../worldedit/command/tool/SelectionWand.java | 13 ++++++++++++- .../extension/platform/PlatformManager.java | 12 ++++++++++-- .../sk89q/worldedit/regions/RegionSelector.java | 16 ++++++---------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java index 83b09b660..916a8c205 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java @@ -364,6 +364,11 @@ public class Settings extends Config { " - PERM: fawe.freebuild." }) public boolean FREEBUILD = false; + + @Comment({ + "Other experimental features" + }) + public boolean OTHER = false; } public static class WEB { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java index 7cac075ec..c20641a05 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SelectionWand.java @@ -19,25 +19,33 @@ package com.sk89q.worldedit.command.tool; +import com.boydti.fawe.config.Settings; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.extension.platform.PlatformManager; import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.util.Location; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public enum SelectionWand implements DoubleActionBlockTool { INSTANCE; + private static final Logger logger = LoggerFactory.getLogger(SelectionWand.class); + @Override public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { RegionSelector selector = session.getRegionSelector(player.getWorld()); BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); - if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) { + if (Settings.IMP.EXPERIMENTAL.OTHER) { + logger.info("actSecondary Hit and about to explain with explainPrimarySelection"); + } selector.explainPrimarySelection(player, session, blockPoint); } return true; @@ -49,6 +57,9 @@ public enum SelectionWand implements DoubleActionBlockTool { BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) { + if (Settings.IMP.EXPERIMENTAL.OTHER) { + logger.info("actPrimary Hit and about to explain with explainSecondarySelection"); + } selector.explainSecondarySelection(player, session, blockPoint); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 9bd3acbc1..9422a9abf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -21,6 +21,7 @@ package com.sk89q.worldedit.extension.platform; import static com.google.common.base.Preconditions.checkNotNull; +import com.boydti.fawe.config.Settings; import com.boydti.fawe.wrappers.AsyncPlayer; import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; @@ -335,14 +336,18 @@ public class PlatformManager { Request.request().setSession(session); Request.request().setWorld(player.getWorld()); - try { + try { Vector3 vector = location.toVector(); VirtualWorld virtual = session.getVirtualWorld(); if (virtual != null) { + if (Settings.IMP.EXPERIMENTAL.OTHER) { + logger.info("virtualWorld was not null in handlePlayerInput()"); + } + virtual.handleBlockInteract(player, vector.toBlockPoint(), event); if (event.isCancelled()) return; - } + } if (event.getType() == Interaction.HIT) { // superpickaxe is special because its primary interaction is a left click, not a right click @@ -408,6 +413,9 @@ public class PlatformManager { LocalSession session = worldEdit.getSessionManager().get(player); VirtualWorld virtual = session.getVirtualWorld(); if (virtual != null) { + if (Settings.IMP.EXPERIMENTAL.OTHER) { + logger.info("virtualWorld was not null in handlePlayerInput()"); + } virtual.handlePlayerInput(player, event); if (event.isCancelled()) return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java index 0a264990b..3286d63f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java @@ -30,11 +30,12 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.world.World; -import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; +import org.jetbrains.annotations.Nullable; + /** * Region selectors create {@link Region}s from a series of "selected points." * They are used, for example, to allow users to create a {@link CuboidRegion} @@ -76,13 +77,8 @@ public interface RegionSelector { /** * Tell the player information about his/her primary selection. * -<<<<<<< HEAD - * @param actor the actor - * @param session the session -======= * @param actor the actor * @param session the session ->>>>>>> 18a55bc14... Add new experimental snapshot API (#524) * @param position position */ void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position); @@ -90,8 +86,8 @@ public interface RegionSelector { /** * Tell the player information about his/her secondary selection. * - * @param actor the actor - * @param session the session + * @param actor the actor + * @param session the session * @param position position */ void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position); @@ -100,7 +96,7 @@ public interface RegionSelector { * The the player information about the region's changes. This may resend * all the defining region information if needed. * - * @param actor the actor + * @param actor the actor * @param session the session */ void explainRegionAdjust(Actor actor, LocalSession session); @@ -167,7 +163,7 @@ public interface RegionSelector { @Deprecated default List getInformationLines() { return Lists.newArrayList(); - } + }; /** * Get lines of information about the selection.