#124 Portal rotation code fixed and end portal block

This commit is contained in:
Sekwah 2018-08-27 00:36:51 +01:00
parent ae677607a1
commit 6a97eb46c8
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.AdvancedPortalsPlugin main: com.sekwah.advancedportals.AdvancedPortalsPlugin
name: AdvancedPortals name: AdvancedPortals
version: 0.0.42 version: 0.0.45
author: sekwah41 author: sekwah41
description: An advanced portals plugin for bukkit. description: An advanced portals plugin for bukkit.
api-version: 1.13 api-version: 1.13

View File

@ -258,13 +258,17 @@ public class Listeners implements Listener {
} else if (checkItemForName(event.getItem()) && event.getItem().getItemMeta().getDisplayName().equals("\u00A75Portal Block Placer") && } else if (checkItemForName(event.getItem()) && event.getItem().getItemMeta().getDisplayName().equals("\u00A75Portal Block Placer") &&
event.getAction() == Action.LEFT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.NETHER_PORTAL) { event.getAction() == Action.LEFT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.NETHER_PORTAL) {
BlockData block = event.getClickedBlock().getBlockData(); BlockData block = event.getClickedBlock().getBlockData();
if(block instanceof Orientable) { if(block instanceof Orientable) {
Orientable rotatable = (Orientable) block; Orientable rotatable = (Orientable) block;
System.out.println(rotatable.getAxis());
if (rotatable.getAxis() == Axis.X) { if (rotatable.getAxis() == Axis.X) {
rotatable.setAxis(Axis.Z); rotatable.setAxis(Axis.Z);
} else { } else {
rotatable.setAxis(Axis.X); rotatable.setAxis(Axis.X);
} }
event.getClickedBlock().setBlockData(rotatable);
} }
event.setCancelled(true); event.setCancelled(true);
} }