Implement sign editing
This commit is contained in:
parent
f4cb5f58e5
commit
7c9bf21ced
@ -130,6 +130,7 @@ public final class InvTweaksPlugin extends JavaPlugin {
|
|||||||
), this);
|
), this);
|
||||||
pluginManager.registerEvents(new PlayerMoveRenderListener(chestManager), this);
|
pluginManager.registerEvents(new PlayerMoveRenderListener(chestManager), this);
|
||||||
pluginManager.registerEvents(new ChestBreakListener(chestManager), this);
|
pluginManager.registerEvents(new ChestBreakListener(chestManager), this);
|
||||||
|
pluginManager.registerEvents(new SignEditListener(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
21
src/dev/w1zzrd/invtweaks/listener/SignEditListener.java
Normal file
21
src/dev/w1zzrd/invtweaks/listener/SignEditListener.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package dev.w1zzrd.invtweaks.listener;
|
||||||
|
|
||||||
|
import dev.w1zzrd.spigot.wizcompat.packet.Players;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class SignEditListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onSignClick(final PlayerInteractEvent event) {
|
||||||
|
if(event.getAction() == Action.RIGHT_CLICK_BLOCK &&
|
||||||
|
Objects.requireNonNull(event.getClickedBlock()).getState() instanceof Sign &&
|
||||||
|
event.getPlayer().isSneaking()) { // Sneak-right-click to edit sign
|
||||||
|
Players.openSignEditor(event.getPlayer(), event.getClickedBlock().getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user