Skip to content

Commit

Permalink
Implement suggested naming changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytm committed Jan 11, 2025
1 parent 10953c1 commit fd457fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public class UncheckedSignChangeEvent extends PlayerEvent implements Cancellable

private static final HandlerList HANDLER_LIST = new HandlerList();
private boolean cancel = false;
private final BlockPosition block;
private final BlockPosition editedBlockPosition;
private final Side side;
private final List<Component> lines;

@ApiStatus.Internal
public UncheckedSignChangeEvent(final Player editor, final BlockPosition block, final Side side, final List<Component> lines) {
public UncheckedSignChangeEvent(final Player editor, final BlockPosition editedBlockPosition, final Side side, final List<Component> lines) {
super(editor);
this.block = block;
this.editedBlockPosition = editedBlockPosition;
this.side = side;
this.lines = lines;
}
Expand All @@ -41,8 +41,8 @@ public UncheckedSignChangeEvent(final Player editor, final BlockPosition block,
*
* @return location where the change happened
*/
public BlockPosition getBlock() {
return block;
public BlockPosition getEditedBlockPosition() {
return editedBlockPosition;
}

/**
Expand All @@ -59,7 +59,7 @@ public Side getSide() {
*
* @return the lines
*/
public @Unmodifiable List<Component> getLines() {
public @Unmodifiable List<Component> lines() {
return lines;
}

Expand Down
6 changes: 3 additions & 3 deletions paper-api/src/main/java/org/bukkit/entity/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import io.papermc.paper.entity.LookAnchor;
import io.papermc.paper.math.BlockPosition;
import io.papermc.paper.math.Position;
import org.bukkit.BanEntry;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
Expand Down Expand Up @@ -51,7 +51,6 @@
import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.profile.PlayerProfile;
import org.bukkit.scoreboard.Scoreboard;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -3487,8 +3486,9 @@ default void setNoTickViewDistance(int viewDistance) {
*
* @param block The block where the client has a sign placed
* @param side The side to edit
* @see io.papermc.paper.event.packet.UncheckedSignChangeEvent
*/
void openLocalSign(@NotNull BlockPosition block, @NotNull Side side);
void openVirtualSign(@NotNull Position block, @NotNull Side side);

/**
* Shows the demo screen to the player, this screen is normally only seen in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.netty.buffer.Unpooled;
import io.papermc.paper.FeatureHooks;
import io.papermc.paper.entity.LookAnchor;
import io.papermc.paper.math.BlockPosition;
import io.papermc.paper.math.Position;
import io.papermc.paper.util.MCUtil;
import it.unimi.dsi.fastutil.shorts.ShortArraySet;
import it.unimi.dsi.fastutil.shorts.ShortSet;
Expand Down Expand Up @@ -3065,8 +3065,10 @@ public void openSign(@NotNull Sign sign, @NotNull Side side) {
}

@Override
public void openLocalSign(@NotNull BlockPosition block, @NotNull Side side) {
getHandle().connection.send(new ClientboundOpenSignEditorPacket(MCUtil.toBlockPos(block), side == Side.FRONT));
public void openVirtualSign(@NotNull Position block, @NotNull Side side) {
if (this.getHandle().connection == null) return;

this.getHandle().connection.send(new ClientboundOpenSignEditorPacket(MCUtil.toBlockPos(block), side == Side.FRONT));
}

@Override
Expand Down

0 comments on commit fd457fc

Please sign in to comment.