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,30 +15,28 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
for (BlockState block : event.getBlocks()) {
|
String user = "#portal";
|
||||||
Material type = block.getType();
|
for (BlockState block : event.getBlocks()) {
|
||||||
if (type == Material.NETHER_PORTAL || type == Material.FIRE) {
|
Material type = block.getType();
|
||||||
String resultData = Lookup.whoPlacedCache(block);
|
if (type == Material.NETHER_PORTAL || type == Material.FIRE) {
|
||||||
if (resultData.length() > 0) {
|
String resultData = Lookup.whoPlacedCache(block);
|
||||||
user = resultData;
|
if (resultData.length() > 0) {
|
||||||
break;
|
user = resultData;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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