geforkt von Mirrors/Paper
SPIGOT-7417, #1343: Add Sign#getTargetSide and Sign#getAllowedEditor
By: Jishuna <joshl5324@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
219db06f85
Commit
3cfdcf8a3e
@ -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();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren