mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
SPIGOT-7417, #1343: Add Sign#getTargetSide and Sign#getAllowedEditor
By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
parent
219db06f85
commit
3cfdcf8a3e
1 changed files with 23 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
|||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.network.chat.IChatBaseComponent;
|
||||
import net.minecraft.world.level.block.entity.TileEntitySign;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Sign;
|
||||
|
@ -93,6 +95,27 @@ public class CraftSign<T extends TileEntitySign> extends CraftBlockEntityState<T
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignSide getTargetSide(Player player) {
|
||||
ensureNoWorldGeneration();
|
||||
Preconditions.checkArgument(player != null, "player cannot be null");
|
||||
|
||||
if (getSnapshot().isFacingFrontText(((CraftPlayer) player).getHandle())) {
|
||||
return front;
|
||||
}
|
||||
|
||||
return back;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player getAllowedEditor() {
|
||||
ensureNoWorldGeneration();
|
||||
|
||||
// getPlayerWhoMayEdit is always null for the snapshot, so we use the wrapped TileEntity
|
||||
UUID id = getTileEntity().getPlayerWhoMayEdit();
|
||||
return (id == null) ? null : Bukkit.getPlayer(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DyeColor getColor() {
|
||||
return front.getColor();
|
||||
|
|
Loading…
Reference in a new issue