From cf10f8ff8a2b4d3adc11abe98c666484eecd8b67 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 18 Aug 2018 14:22:08 +1000 Subject: [PATCH 01/10] Proof of concept server-side CUI handler. Note: This pollutes the world with blocks atm --- .../com/sk89q/worldedit/LocalSession.java | 58 +++++++ .../internal/cui/ServerCUIHandler.java | 151 ++++++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index c42be0914..4e9f56cf2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -25,6 +25,8 @@ import com.sk89q.jchronic.Chronic; import com.sk89q.jchronic.Options; import com.sk89q.jchronic.utils.Span; import com.sk89q.jchronic.utils.Time; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.command.tool.BlockTool; import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.command.tool.InvalidToolBindException; @@ -37,6 +39,7 @@ import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; +import com.sk89q.worldedit.internal.cui.ServerCUIHandler; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; @@ -44,6 +47,8 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.snapshot.Snapshot; @@ -87,10 +92,12 @@ public class LocalSession { private transient boolean fastMode = false; private transient Mask mask; private transient TimeZone timezone = TimeZone.getDefault(); + private transient Vector cuiTemporaryBlock; // Saved properties private String lastScript; private RegionSelectorType defaultSelector; + private boolean useServerCUI = true; // Save this to not annoy players. /** * Construct the object. @@ -612,6 +619,52 @@ public class LocalSession { public void tellVersion(Actor player) { } + /** + * Update server-side WorldEdit CUI. + * + * @param actor The player + */ + public void updateServerCUI(Actor actor) { + if (!actor.isPlayer()) { + return; // This is for players only. + } + + if (!useServerCUI || hasCUISupport) { + return; // If it's not enabled, ignore this. + } + + Player player = (Player) actor; + + // Remove the old block. + if (cuiTemporaryBlock != null) { + // TODO Tell server to reset fake block. + try { + createEditSession(player).setBlock(cuiTemporaryBlock, BlockTypes.AIR.getDefaultState()); + } catch (MaxChangedBlocksException e) { + e.printStackTrace(); + } + cuiTemporaryBlock = null; + } + + BaseBlock block = ServerCUIHandler.createStructureBlock(player); + if (block != null) { + // If it's null, we don't need to do anything. The old was already removed. + Map tags = block.getNbtData().getValue(); + cuiTemporaryBlock = new Vector( + ((IntTag) tags.get("x")).getValue(), + ((IntTag) tags.get("y")).getValue(), + ((IntTag) tags.get("z")).getValue() + ); + + // TODO Send temporary block at that pos to the player. + try { + createEditSession(player).setBlock(cuiTemporaryBlock, block); + } catch (MaxChangedBlocksException e) { + e.printStackTrace(); + } + } + } + /** * Dispatch a CUI event but only if the actor has CUI support. * @@ -624,6 +677,8 @@ public class LocalSession { if (hasCUISupport) { actor.dispatchCUIEvent(event); + } else if (useServerCUI) { + updateServerCUI(actor); } } @@ -647,6 +702,9 @@ public class LocalSession { checkNotNull(actor); if (!hasCUISupport) { + if (useServerCUI) { + updateServerCUI(actor); + } return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java new file mode 100644 index 000000000..da78668c7 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java @@ -0,0 +1,151 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.internal.cui; + +import com.sk89q.jnbt.ByteTag; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.regions.RegionSelector; +import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockTypes; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Nullable; + +/** + * Handles creation of server-side CUI systems. + */ +public class ServerCUIHandler { + + private ServerCUIHandler() { + } + + /** + * Creates a structure block that shows the region. + * + *

+ * Null symbolises removal of the CUI. + *

+ * + * @param player The player to create the structure block for. + * @return The structure block, or null + */ + @Nullable + public static BaseBlock createStructureBlock(Player player) { + LocalSession session = WorldEdit.getInstance().getSessionManager().get(player); + RegionSelector regionSelector = session.getRegionSelector(player.getWorld()); + + int posX, posY, posZ; + int width, height, length; + + if (regionSelector instanceof CuboidRegionSelector) { + if (regionSelector.isDefined()) { + try { + CuboidRegion region = ((CuboidRegionSelector) regionSelector).getRegion(); + + posX = region.getMinimumPoint().getBlockX(); + posY = region.getMinimumPoint().getBlockY(); + posZ = region.getMinimumPoint().getBlockZ(); + + width = region.getWidth(); + height = region.getHeight(); + length = region.getLength(); + } catch (IncompleteRegionException e) { + // This will never happen. + e.printStackTrace(); + return null; + } + } else { + CuboidRegion region = ((CuboidRegionSelector) regionSelector).getIncompleteRegion(); + Vector point; + if (region.getPos1() != null) { + point = region.getPos1(); + } else if (region.getPos2() != null) { + point = region.getPos2(); + } else { + // No more selection + return null; + } + + // Just select the point. + posX = point.getBlockX(); + posY = point.getBlockY(); + posZ = point.getBlockZ(); + width = 1; + height = 1; + length = 1; + } + } else { + // We only support cuboid regions right now. + return null; + } + + if (width > 32 || length > 32 || height > 32) { + // Structure blocks have a limit of 32x32x32 + return null; + } + + // Borrowed this math from FAWE + double rotX = player.getLocation().getYaw(); + double rotY = player.getLocation().getPitch(); + double xz = Math.cos(Math.toRadians(rotY)); + int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); + int z = (int) (player.getLocation().getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12); + int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3)); + + Map structureTag = new HashMap<>(); + + posX -= x; + posY -= y; + posZ -= z; + + structureTag.put("name", new StringTag(player.getUniqueId().toString())); + structureTag.put("author", new StringTag(player.getName())); + structureTag.put("metadata", new StringTag("")); + structureTag.put("x", new IntTag(x)); + structureTag.put("y", new IntTag(y)); + structureTag.put("z", new IntTag(z)); + structureTag.put("posX", new IntTag(posX)); + structureTag.put("posY", new IntTag(posY)); + structureTag.put("posZ", new IntTag(posZ)); + structureTag.put("sizeX", new IntTag(width)); + structureTag.put("sizeY", new IntTag(height)); + structureTag.put("sizeZ", new IntTag(length)); + structureTag.put("rotation", new StringTag("NONE")); + structureTag.put("mirror", new StringTag("NONE")); + structureTag.put("mode", new StringTag("SAVE")); + structureTag.put("ignoreEntities", new ByteTag((byte) 1)); + structureTag.put("showboundingbox", new ByteTag((byte) 1)); + structureTag.put("id", new StringTag(BlockTypes.STRUCTURE_BLOCK.getId())); + + return BlockTypes.STRUCTURE_BLOCK.getDefaultState().toBaseBlock(new CompoundTag(structureTag)); + } +} From 7f419618ccf37b113ad16d08812cf44287c53cfe Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 18 Aug 2018 15:22:49 +1000 Subject: [PATCH 02/10] Switch to using fake blocks, no more world pollution --- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 18 ++++++++++++++++++ .../bukkit/adapter/BukkitImplAdapter.java | 12 ++++++++++++ .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 20257 -> 21176 bytes .../com/sk89q/worldedit/LocalSession.java | 15 ++------------- .../com/sk89q/worldedit/entity/Player.java | 14 ++++++++++++++ .../platform/AbstractPlayerActor.java | 4 ++++ .../extension/platform/PlayerProxy.java | 6 ++++++ .../internal/cui/ServerCUIHandler.java | 7 ++++++- 8 files changed, 62 insertions(+), 14 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 7066da770..f21b8a340 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; @@ -31,6 +32,7 @@ import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import org.bukkit.Bukkit; @@ -239,4 +241,20 @@ public class BukkitPlayer extends AbstractPlayerActor { } + @Override + public void sendFakeBlock(Vector pos, BlockStateHolder block) { + System.out.println("Setting " + (block == null ? "reset" : block.getAsString()) + " as " + pos.toString()); + Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()); + if (block == null) { + player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData()); + } else { + player.sendBlockChange(loc, BukkitAdapter.adapt(block)); + if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + if (adapter != null) { + adapter.sendFakeNBT(player, pos, ((BaseBlock) block).getNbtData()); + } + } + } + } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 4a30a11c0..344eca9d9 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.bukkit.adapter; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.registry.state.Property; @@ -27,6 +29,7 @@ import com.sk89q.worldedit.world.block.BlockType; import org.bukkit.Location; import org.bukkit.block.Biome; import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; import java.util.Map; @@ -101,4 +104,13 @@ public interface BukkitImplAdapter { * @return The properties map */ Map getProperties(BlockType blockType); + + /** + * Send the given NBT data to the player. + * + * @param player The player + * @param pos The position + * @param nbtData The NBT Data + */ + void sendFakeNBT(Player player, Vector pos, CompoundTag nbtData); } diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index 9655a35a6d5e15fdcb7d712e127fb6aef5b7ceea..adda1cf85d1a0bd6e716514bd8b309c0fd66d7f3 100644 GIT binary patch delta 7146 zcmZWu30zgh_dn;%dvD;ri?Rp;3QF#PA-I%~;+C3;OPE`lA(AO3E?8OSYtOPYy}6L4 zl$NHcDE6L;C6<+~YNhSjuI>F=&0PN9xev+u>xa2#&di)S%lDj_d*5TLc*heQc=gP# z=ZL72+H29T{ETUW7DaQ&;vKv*l1}k1%{3P9=4TE2In8?_xYm$+&EWGEzrg!6zZk(U zX?{79_wy@e@KrPTn#Hg4K8xSrH%)WE;)8t1qD%QLL%nVBI~+J{QByvm`CapT&#>M% zgCCd%3qItJEdH23G0joa{nX;m_;ZWD;4d|QWu9M~=9p=Yo8}uof6L!l{5}6*Q5*hI z^G_CK@y{0jkAKnpt3^4+%v1cEX#&4%{=?!w`GjfyGRsaH0e@>gWlE2D0KOBq%@F*ewr=Oeu*rHQr21fCN83GEK5+n!q8_G*VI|6_!Y|SR!dFf_ssdVw9$+qMox!9uXrK^@) zEqP|*C9%Yk@0T9Z(~@4&+faS9Tx!uwGp(>R?0*z*J+t#(Q27&QKgh>nWE)- zi`K|gi`Gh+mT4xK(=7_D6Vft6%S?+lNV!EDWtNs3wA^UXX1U3tEi&80Z(!5BZw z7`xG!4T~egW<71R*<=jbY{?d>GWOkL?AdC`HmNq|-4AnQyG1V;o1QVM1d;X<(y}8$ zc52z>rxP;RqC%;$WVbx41+3$R5A8#N&Ew3Pvk=|Nft^OctrbNA_ z<#jD@xKMx786CZ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^#I+r0un(c@60oWkYjgEAaNH_ZY@N58{6Y*w8yhX&D{jfCv+e8{#2x+M-3Jt*XMY*ZF zz`YY*jC?8G4=f^uw+Iyed+^BMpeu?}w5Al!|nB zAyiE*gR%i>rNFnd0PGd%zC!Sp!G6|RUQ`D229&`t?hlWA&Bh*yz89F`a@kqKL4k_k zh2R)Ikj63#$3Y@a;NONGgw7m`yEqd4aWV|$SUiAJVH!RJvvC@y;dFQsXTY=gFuZ^> zp%iC9IX(hMaW;I!4F4AAz%Mu#{^biZ;e5WwJcbrNj&ZoahpD&-o8l8p+r`)gmvE{r z#lg4?$6!8A!sYld7C1ES%H-|L6>BPQ8Un4kW=&(>x;b%r;B<$HiO>;eunGJb21z)R zjo{k@uC3(mT6~1pVkJ9erEfahNDy4=!Rxi#rF(VMdlqWxAu?{PxBss1xUkc9+7N zeA6q3@T`#Z)VPoUv@C_U2>Q);})a;@0LMS2S#L@z=vzT|+`hmWBaJZruKS|XpJk2xnS8ybW~&Zhp1%j29}9_YEBMD5`G$5fdsEN)zC)$(Hu9})F@oeZf8G^B26y@(l*8dHS9+YQ z6yA}Syj1DFE8QajXzPcZt=EpF3*Yk#A-W8fNp9r(;XOYb4ZtxOu$`nSkOA8d#{+Oe zq^q6jt3nw2GO*4W$d-Y1e)z->p9Y}43~X|C z*eC;={P0--J{Rd0N4i<0Tl{b;0AGl7dm-eMK`5uo5xsaID{e z0(=vm!?)l?JjmzTA>g0JxpEwaQ}_;7j(7P- z=evt<6*u%m1og1n&$4d9=WrE2osm97XU1{_vox V{2xhCRL$vSP$SBy=-omY{{sOeYFq#S diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 4e9f56cf2..18e1d40c6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -48,7 +48,6 @@ import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.snapshot.Snapshot; @@ -637,12 +636,7 @@ public class LocalSession { // Remove the old block. if (cuiTemporaryBlock != null) { - // TODO Tell server to reset fake block. - try { - createEditSession(player).setBlock(cuiTemporaryBlock, BlockTypes.AIR.getDefaultState()); - } catch (MaxChangedBlocksException e) { - e.printStackTrace(); - } + player.sendFakeBlock(cuiTemporaryBlock, null); cuiTemporaryBlock = null; } @@ -656,12 +650,7 @@ public class LocalSession { ((IntTag) tags.get("z")).getValue() ); - // TODO Send temporary block at that pos to the player. - try { - createEditSession(player).setBlock(cuiTemporaryBlock, block); - } catch (MaxChangedBlocksException e) { - e.printStackTrace(); - } + player.sendFakeBlock(cuiTemporaryBlock, block); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index b803e93f5..ac2fc81ed 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -29,8 +29,11 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; +import javax.annotation.Nullable; + /** * Represents a player */ @@ -262,4 +265,15 @@ public interface Player extends Entity, Actor { */ void setPosition(Vector pos); + /** + * Sends a fake block to the client. + * + *

+ * This block isn't real. + *

+ * + * @param pos The position of the block + * @param block The block to send, null to reset + */ + void sendFakeBlock(Vector pos, @Nullable BlockStateHolder block); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 4c3ced012..0bcb8e24e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -497,4 +497,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { return false; } + @Override + public void sendFakeBlock(Vector pos, BlockStateHolder block) { + + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java index 27da6be8a..adb5e2e83 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java @@ -31,6 +31,7 @@ import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; import java.util.UUID; @@ -155,4 +156,9 @@ class PlayerProxy extends AbstractPlayerActor { public void setGameMode(GameMode gameMode) { basePlayer.setGameMode(gameMode); } + + @Override + public void sendFakeBlock(Vector pos, BlockStateHolder block) { + basePlayer.sendFakeBlock(pos, block); + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java index da78668c7..7535041e0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java @@ -127,7 +127,12 @@ public class ServerCUIHandler { posY -= y; posZ -= z; - structureTag.put("name", new StringTag(player.getUniqueId().toString())); +// if (Math.abs(posX) > 32 || Math.abs(posY) > 32 || Math.abs(posZ) > 32) { +// // Structure blocks have a limit +// return null; +// } + + structureTag.put("name", new StringTag("worldedit:" + player.getName())); structureTag.put("author", new StringTag(player.getName())); structureTag.put("metadata", new StringTag("")); structureTag.put("x", new IntTag(x)); From f8585adc79842b11255c6bb4eae910d95ed0cf63 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 18 Aug 2018 15:27:26 +1000 Subject: [PATCH 03/10] Remove debug code --- .../java/com/sk89q/worldedit/bukkit/BukkitPlayer.java | 1 - .../sk89q/worldedit/internal/cui/ServerCUIHandler.java | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index f21b8a340..852d95739 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -243,7 +243,6 @@ public class BukkitPlayer extends AbstractPlayerActor { @Override public void sendFakeBlock(Vector pos, BlockStateHolder block) { - System.out.println("Setting " + (block == null ? "reset" : block.getAsString()) + " as " + pos.toString()); Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ()); if (block == null) { player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java index 7535041e0..af63bebe0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java @@ -127,10 +127,10 @@ public class ServerCUIHandler { posY -= y; posZ -= z; -// if (Math.abs(posX) > 32 || Math.abs(posY) > 32 || Math.abs(posZ) > 32) { -// // Structure blocks have a limit -// return null; -// } + if (Math.abs(posX) > 32 || Math.abs(posY) > 32 || Math.abs(posZ) > 32) { + // Structure blocks have a limit + return null; + } structureTag.put("name", new StringTag("worldedit:" + player.getName())); structureTag.put("author", new StringTag(player.getName())); From 20b67db48d0a55ec4b4b4c9244f4913536be918d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 18 Aug 2018 16:34:32 +1000 Subject: [PATCH 04/10] Added a command to turn it on/off --- .../com/sk89q/worldedit/LocalSession.java | 16 ++++++++-- .../worldedit/command/GeneralCommands.java | 32 +++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 18e1d40c6..ff3118d34 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -618,6 +618,14 @@ public class LocalSession { public void tellVersion(Actor player) { } + public boolean shouldUseServerCUI() { + return this.useServerCUI; + } + + public void setUseServerCUI(boolean useServerCUI) { + this.useServerCUI = useServerCUI; + } + /** * Update server-side WorldEdit CUI. * @@ -628,12 +636,16 @@ public class LocalSession { return; // This is for players only. } + Player player = (Player) actor; + if (!useServerCUI || hasCUISupport) { + if (cuiTemporaryBlock != null) { + player.sendFakeBlock(cuiTemporaryBlock, null); + cuiTemporaryBlock = null; + } return; // If it's not enabled, ignore this. } - Player player = (Player) actor; - // Remove the old block. if (cuiTemporaryBlock != null) { player.sendFakeBlock(cuiTemporaryBlock, null); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 3e1ecec7b..cb8a33644 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -114,6 +114,38 @@ public class GeneralCommands { } } + @Command( + aliases = { "/drawsel" }, + usage = "[on|off]", + desc = "Toggle drawing the current selection", + min = 0, + max = 1 + ) + @CommandPermissions("worldedit.drawsel") + public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException { + + String newState = args.getString(0, null); + if (session.shouldUseServerCUI()) { + if ("on".equals(newState)) { + player.printError("Server CUI already enabled."); + return; + } + + session.setUseServerCUI(false); + session.updateServerCUI(player); + player.print("Server CUI disabled."); + } else { + if ("off".equals(newState)) { + player.printError("Server CUI already disabled."); + return; + } + + session.setUseServerCUI(true); + session.updateServerCUI(player); + player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32."); + } + } + @Command( aliases = { "/gmask", "gmask" }, usage = "[mask]", From 0cbfc9308ec202b958fac6e55d4e0d5e873919e3 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 18 Aug 2018 19:35:53 +1000 Subject: [PATCH 05/10] Add base of sendFakeBlock to Sponge and Forge impls --- .../sk89q/worldedit/forge/ForgePlayer.java | 22 +++++++++++++++++++ .../sk89q/worldedit/sponge/SpongePlayer.java | 18 +++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java index d4b906fc4..817315e92 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java @@ -29,6 +29,8 @@ import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.item.ItemTypes; import io.netty.buffer.Unpooled; import net.minecraft.entity.player.EntityPlayerMP; @@ -36,7 +38,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.server.SPacketCustomPayload; +import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.common.registry.ForgeRegistries; @@ -164,6 +168,24 @@ public class ForgePlayer extends AbstractPlayerActor { return null; } + @Override + public void sendFakeBlock(Vector pos, BlockStateHolder block) { + BlockPos loc = new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); + if (block == null) { + // TODO +// player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData()); + } else { + // TODO +// player.sendBlockChange(loc, BukkitAdapter.adapt(block)); + if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { + player.connection.sendPacket(new SPacketUpdateTileEntity( + new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), 7, + NBTConverter.toNative(((BaseBlock) block).getNbtData())) + ); + } + } + } + @Override public SessionKey getSessionKey() { return new SessionKeyImpl(player.getUniqueID(), player.getName()); diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java index 37774dbc8..662d65e55 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java @@ -30,6 +30,7 @@ import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemTypes; @@ -183,6 +184,23 @@ public class SpongePlayer extends AbstractPlayerActor { gameMode.getId()).get()); } + @Override + public void sendFakeBlock(Vector pos, BlockStateHolder block) { + org.spongepowered.api.world.Location loc = player.getWorld().getLocation(pos.getX(), pos.getY(), pos.getZ()); + if (block == null) { + player.sendBlockChange(loc.getBlockPosition(), loc.getBlock()); + } else { + // TODO +// player.sendBlockChange(loc, BukkitAdapter.adapt(block)); +// if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) { +// BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); +// if (adapter != null) { +// adapter.sendFakeNBT(player, pos, ((BaseBlock) block).getNbtData()); +// } +// } + } + } + @Override public SessionKey getSessionKey() { return new SessionKeyImpl(player.getUniqueId(), player.getName()); From eba91cac5fd5f0eb2d4c424c11b858211622f585 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sat, 18 Aug 2018 19:42:45 +1000 Subject: [PATCH 06/10] Added a config option to entirely disable server side cui. --- worldedit-bukkit/src/main/resources/defaults/config.yml | 1 + .../src/main/java/com/sk89q/worldedit/LocalConfiguration.java | 1 + .../src/main/java/com/sk89q/worldedit/LocalSession.java | 4 ++++ .../java/com/sk89q/worldedit/command/GeneralCommands.java | 4 ++++ .../com/sk89q/worldedit/util/PropertiesConfiguration.java | 1 + .../main/java/com/sk89q/worldedit/util/YAMLConfiguration.java | 1 + .../worldedit/sponge/config/ConfigurateConfiguration.java | 1 + 7 files changed, 13 insertions(+) diff --git a/worldedit-bukkit/src/main/resources/defaults/config.yml b/worldedit-bukkit/src/main/resources/defaults/config.yml index fd931081f..a01430cfd 100644 --- a/worldedit-bukkit/src/main/resources/defaults/config.yml +++ b/worldedit-bukkit/src/main/resources/defaults/config.yml @@ -143,3 +143,4 @@ no-double-slash: false no-op-permissions: false debug: false show-help-on-first-use: true +server-side-cui: true \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index 2d931f91f..81b4d892a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -134,6 +134,7 @@ public abstract class LocalConfiguration { public int butcherDefaultRadius = -1; public int butcherMaxRadius = -1; public boolean allowSymlinks = false; + public boolean serverSideCUI = true; /** * Load the configuration. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index ff3118d34..aa09fbe0e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -636,6 +636,10 @@ public class LocalSession { return; // This is for players only. } + if (!config.serverSideCUI) { + return; // Disabled in config. + } + Player player = (Player) actor; if (!useServerCUI || hasCUISupport) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index cb8a33644..862b4398d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -31,6 +31,7 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.extension.input.DisallowedUsageException; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.util.command.parametric.Optional; @@ -124,6 +125,9 @@ public class GeneralCommands { @CommandPermissions("worldedit.drawsel") public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException { + if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) { + throw new DisallowedUsageException("This functionality is disabled in the configuration!"); + } String newState = args.getString(0, null); if (session.shouldUseServerCUI()) { if ("on".equals(newState)) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index 472796c4a..65f44c691 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -114,6 +114,7 @@ public class PropertiesConfiguration extends LocalConfiguration { butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); butcherMaxRadius = getInt("butcher-max-radius", butcherMaxRadius); allowSymlinks = getBool("allow-symbolic-links", allowSymlinks); + serverSideCUI = getBool("server-side-cui", serverSideCUI); LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index c6ab2b7db..84e0fc34e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -112,6 +112,7 @@ public class YAMLConfiguration extends LocalConfiguration { SessionManager.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000; showHelpInfo = config.getBoolean("show-help-on-first-use", true); + serverSideCUI = config.getBoolean("server-side-cui", true); String snapshotsDir = config.getString("snapshots.directory", ""); if (!snapshotsDir.isEmpty()) { diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java index e38140bb4..d824e0a8f 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/config/ConfigurateConfiguration.java @@ -120,6 +120,7 @@ public class ConfigurateConfiguration extends LocalConfiguration { SessionManager.EXPIRATION_GRACE = node.getNode("history", "expiration").getInt(10) * 60 * 1000; showHelpInfo = node.getNode("show-help-on-first-use").getBoolean(true); + serverSideCUI = node.getNode("server-side-cui").getBoolean(true); String snapshotsDir = node.getNode("snapshots", "directory").getString(""); if (!snapshotsDir.isEmpty()) { From 41c307a4b5360069fe659fac4c49e518fe40bacb Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 19 Aug 2018 10:46:46 +1000 Subject: [PATCH 07/10] Set the session to dirty if the server CUI is changed. --- .../src/main/java/com/sk89q/worldedit/LocalSession.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index aa09fbe0e..03f25c6af 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -624,6 +624,7 @@ public class LocalSession { public void setUseServerCUI(boolean useServerCUI) { this.useServerCUI = useServerCUI; + setDirty(); } /** From 4d0df10f883c79007668e62cf4b663ecd51516dd Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 19 Aug 2018 13:01:08 +1000 Subject: [PATCH 08/10] Fixed sessions not saving on shutdown --- .../worldedit/bukkit/WorldEditPlugin.java | 2 +- .../worldedit/session/SessionManager.java | 64 +++++++++++-------- .../sk89q/worldedit/forge/ForgeWorldEdit.java | 4 +- .../worldedit/sponge/SpongeWorldEdit.java | 4 +- 4 files changed, 45 insertions(+), 29 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 057742b92..ab0d08fba 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -150,7 +150,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { @Override public void onDisable() { WorldEdit worldEdit = WorldEdit.getInstance(); - worldEdit.getSessionManager().clear(); + worldEdit.getSessionManager().unload(); worldEdit.getPlatformManager().unregister(server); if (config != null) { config.unload(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index aa9b9e5df..929085bd5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -266,13 +266,50 @@ public class SessionManager { sessions.remove(getKey(owner)); } + /** + * Called to unload this session manager. + */ + public synchronized void unload() { + clear(); + } + /** * Remove all sessions. */ public synchronized void clear() { + saveChangedSessions(); sessions.clear(); } + private synchronized void saveChangedSessions() { + long now = System.currentTimeMillis(); + Iterator it = sessions.values().iterator(); + Map saveQueue = new HashMap<>(); + + while (it.hasNext()) { + SessionHolder stored = it.next(); + if (stored.key.isActive()) { + stored.lastActive = now; + + if (stored.session.compareAndResetDirty()) { + saveQueue.put(stored.key, stored.session); + } + } else { + if (now - stored.lastActive > EXPIRATION_GRACE) { + if (stored.session.compareAndResetDirty()) { + saveQueue.put(stored.key, stored.session); + } + + it.remove(); + } + } + } + + if (!saveQueue.isEmpty()) { + commit(saveQueue); + } + } + @Subscribe public void onConfigurationLoad(ConfigurationLoadEvent event) { LocalConfiguration config = event.getConfiguration(); @@ -302,32 +339,7 @@ public class SessionManager { @Override public void run() { synchronized (SessionManager.this) { - long now = System.currentTimeMillis(); - Iterator it = sessions.values().iterator(); - Map saveQueue = new HashMap<>(); - - while (it.hasNext()) { - SessionHolder stored = it.next(); - if (stored.key.isActive()) { - stored.lastActive = now; - - if (stored.session.compareAndResetDirty()) { - saveQueue.put(stored.key, stored.session); - } - } else { - if (now - stored.lastActive > EXPIRATION_GRACE) { - if (stored.session.compareAndResetDirty()) { - saveQueue.put(stored.key, stored.session); - } - - it.remove(); - } - } - } - - if (!saveQueue.isEmpty()) { - commit(saveQueue); - } + saveChangedSessions(); } } } diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java index bf17292cd..963f2f748 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorldEdit.java @@ -136,7 +136,9 @@ public class ForgeWorldEdit { @EventHandler public void serverStopping(FMLServerStoppingEvent event) { - WorldEdit.getInstance().getPlatformManager().unregister(platform); + WorldEdit worldEdit = WorldEdit.getInstance(); + worldEdit.getSessionManager().unload(); + worldEdit.getPlatformManager().unregister(platform); } @EventHandler diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index f2ba77982..d86e77c7c 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -147,7 +147,9 @@ public class SpongeWorldEdit { @Listener public void serverStopping(GameStoppingServerEvent event) { - WorldEdit.getInstance().getPlatformManager().unregister(platform); + WorldEdit worldEdit = WorldEdit.getInstance(); + worldEdit.getSessionManager().unload(); + worldEdit.getPlatformManager().unregister(platform); } @Listener From a354267e852d81d1c2bac13eb46f811b9ee76999 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 19 Aug 2018 13:41:38 +1000 Subject: [PATCH 09/10] Try sending fake operator packets to support non-OP --- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 4 ++++ .../bukkit/adapter/BukkitImplAdapter.java | 8 ++++++++ .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 21176 -> 21445 bytes 3 files changed, 12 insertions(+) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 852d95739..46a0564a6 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -33,6 +33,7 @@ import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import org.bukkit.Bukkit; @@ -252,6 +253,9 @@ public class BukkitPlayer extends AbstractPlayerActor { BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { adapter.sendFakeNBT(player, pos, ((BaseBlock) block).getNbtData()); + if (block.getBlockType() == BlockTypes.STRUCTURE_BLOCK) { + adapter.sendFakeOP(player); + } } } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 344eca9d9..d075cac45 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -113,4 +113,12 @@ public interface BukkitImplAdapter { * @param nbtData The NBT Data */ void sendFakeNBT(Player player, Vector pos, CompoundTag nbtData); + + /** + * Make the client think it has operator status. + * This does not give them any operator capabilities. + * + * @param player The player + */ + void sendFakeOP(Player player); } diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index adda1cf85d1a0bd6e716514bd8b309c0fd66d7f3..80124e9d9948374cc61cdd820e7cf18e57728513 100644 GIT binary patch delta 6886 zcmZWu2Y6LQ)1H~VH=CS$5<(y$2_z(RlF*w5Ap`{Jppm8^BBCM+3PDBvxQGoEr5r^Q zq)JuLVDMf-1OWxHgNhAN?4sBU!bkbvISIw@*M~iOW_M?2-g#$s&&{TlymK{&Uq88d zD-pFfyB+$AE410{P$E}4{336Oqm#VV@=FeHd7By??Z<_;_$}~)#Fbr@7L$2DmtKp zpJ{^ypYuV7zu+&m`AT2EcK93q*5U8?d&`IP`GYn;YI9hdpF;dI|Kjkk{F_5f`FG2I zIMj;&boej++wu{I+Nzr;`5$enxWl6u`(Dukc%Cf$)ASg z5-AGFr830IP={v8us9hmBdlB&cI0wI5Y3O;9Cqj-8R^InBwX~^2j zRUsKGwY7J(Lmg$Dm20eA>rjbY=TNDPw{pFe2@Wli8ys3JH(Hr!Ws*b7z|6?yz#FmH#+YCet0-AYqNq3@dlV z$xOLBR_;+`@3nHDmHQpqtQJisIk;YRg)wIgd}t-^4#y8W~x&&WDOVX6~`t@@o0)V2%X#BN@s!+fl;1%Tt{}oQO%U zA-23&s-*E??iIzgwI_$C||hpC2wSE=4B^kdm~d4 zYkehOyDV(1eB;Wu@*PuSj5YRFq-1sf-jzeV#FZc9N0$Q}v~n2!x$=|z?8-0lE4*{% zH~HO_KjcqW{*u3~9C76zIqJ$W+0T^Y723?+1IAArH+J%vYl{1go91$i{MVJ^a>A99 z^0Spwt|7x#c0*{y<@Uz7CSZcr#JI-tMu6*@SQ7_j^HUnP95!k44OhFyF(DW8(8QzR zP9_2HyQYRow5FzOl1wewWNLda)oGm&W0HZsYf?-draa&AUt&Y?E~juEm+$9UOzGai zP9F%z$CRa88A{KRWr(+*&AbIx&1 zd(*)+9kuDC&3Wd0*W_!{*<4^vSJ!kig|6vt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ocalSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 03f25c6af..c0f3a5b54 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -96,7 +96,7 @@ public class LocalSession { // Saved properties private String lastScript; private RegionSelectorType defaultSelector; - private boolean useServerCUI = true; // Save this to not annoy players. + private boolean useServerCUI = false; // Save this to not annoy players. /** * Construct the object.