mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-25 12:25:37 +01:00
Minor refactoring in PortalCreateListener
This commit is contained in:
parent
1d828e3b68
commit
03bac937c3
@ -15,11 +15,13 @@ import net.coreprotect.database.Lookup;
|
|||||||
public final class PortalCreateListener extends Queue implements Listener {
|
public final class PortalCreateListener extends Queue implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
protected void OnPortalCreate(PortalCreateEvent event) {
|
protected void onPortalCreate(PortalCreateEvent event) {
|
||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
if (!event.isCancelled() && Config.getConfig(world).PORTALS) {
|
if (event.isCancelled() || !Config.getConfig(world).PORTALS) {
|
||||||
String user = "#portal";
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String user = "#portal";
|
||||||
for (BlockState block : event.getBlocks()) {
|
for (BlockState block : event.getBlocks()) {
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
if (type == Material.NETHER_PORTAL || type == Material.FIRE) {
|
if (type == Material.NETHER_PORTAL || type == Material.FIRE) {
|
||||||
@ -33,13 +35,9 @@ public final class PortalCreateListener extends Queue implements Listener {
|
|||||||
|
|
||||||
for (BlockState blockState : event.getBlocks()) {
|
for (BlockState blockState : event.getBlocks()) {
|
||||||
Material type = blockState.getType();
|
Material type = blockState.getType();
|
||||||
if (user.equals("#portal")) {
|
if (user.equals("#portal") || !type.equals(Material.OBSIDIAN)) {
|
||||||
Queue.queueBlockPlace(user, blockState, blockState.getBlock().getType(), null, type, -1, 0, blockState.getBlockData().getAsString());
|
Queue.queueBlockPlace(user, blockState, blockState.getBlock().getType(), null, type, -1, 0, blockState.getBlockData().getAsString());
|
||||||
}
|
}
|
||||||
else if (!type.equals(Material.OBSIDIAN)) {
|
|
||||||
Queue.queueBlockPlace(user, blockState, blockState.getBlock().getType(), null, type, -1, 0, blockState.getBlockData().getAsString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user