3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Added SIGN_CHANGE event.

Dieser Commit ist enthalten in:
Timberjaw 2011-02-10 18:15:59 -08:00 committet von EvilSeph
Ursprung c097fd9ac5
Commit 348e6c75c7

Datei anzeigen

@ -19,6 +19,7 @@ import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.BlockRightClickEvent; import org.bukkit.event.block.BlockRightClickEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerItemEvent; import org.bukkit.event.player.PlayerItemEvent;
@ -792,8 +793,21 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
j = packet130updatesign.c; j = packet130updatesign.c;
TileEntitySign tileentitysign = (TileEntitySign) tileentity; TileEntitySign tileentitysign = (TileEntitySign) tileentity;
// CraftBukkit start - SIGN_CHANGE hook
Player player = server.getPlayer(this.e);
SignChangeEvent modifyEvent = new SignChangeEvent(org.bukkit.event.Event.Type.SIGN_CHANGE, (CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d);
server.getPluginManager().callEvent(modifyEvent);
if (modifyEvent.isCancelled()) {
// Normally we would return here, but we have to update the sign with blank text if it's been cancelled
// Otherwise the client will have bad text on their sign (client shows text changes as they type)
for(int l = 0; l < 4; ++l) {
modifyEvent.setLine(l, "");
}
}
// CraftBukkit end
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
tileentitysign.e[l] = packet130updatesign.d[l]; tileentitysign.e[l] = modifyEvent.getLine(l); // CraftBukkit
} }
tileentitysign.d(); tileentitysign.d();