Remove right-click workaround
This commit is contained in:
parent
06308e6838
commit
cbee91bbf3
@ -893,22 +893,10 @@ public class Stargate extends JavaPlugin {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = null;
|
Block block = event.getClickedBlock();
|
||||||
if (event.isCancelled() && event.getAction() == Action.RIGHT_CLICK_AIR) {
|
|
||||||
try {
|
|
||||||
block = player.getTargetBlock(null, 5);
|
|
||||||
} catch (IllegalStateException ex) {
|
|
||||||
// We can safely ignore this exception, it only happens in void or max height
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
block = event.getClickedBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block == null) return;
|
|
||||||
|
|
||||||
// Right click
|
// Right click
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (block.getType() == Material.WALL_SIGN) {
|
if (block.getType() == Material.WALL_SIGN) {
|
||||||
Portal portal = Portal.getByBlock(block);
|
Portal portal = Portal.getByBlock(block);
|
||||||
if (portal == null) return;
|
if (portal == null) return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user