geforkt von Mirrors/Paper
Rearchitect PortalCreateEvent to provide more information about the portal
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
b43e5e0738
Commit
c38c74e64d
@ -1,9 +1,8 @@
|
|||||||
package org.bukkit.event.world;
|
package org.bukkit.event.world;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.Collection;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -14,13 +13,13 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PortalCreateEvent extends WorldEvent implements Cancellable {
|
public class PortalCreateEvent extends WorldEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
private final ArrayList<Block> blocks = new ArrayList<Block>();
|
private final List<BlockState> blocks;
|
||||||
private CreateReason reason = CreateReason.FIRE;
|
private final CreateReason reason;
|
||||||
|
|
||||||
public PortalCreateEvent(@NotNull final Collection<Block> blocks, @NotNull final World world, @NotNull CreateReason reason) {
|
public PortalCreateEvent(@NotNull final List<BlockState> blocks, @NotNull final World world, @NotNull CreateReason reason) {
|
||||||
super(world);
|
super(world);
|
||||||
|
|
||||||
this.blocks.addAll(blocks);
|
this.blocks = blocks;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ public class PortalCreateEvent extends WorldEvent implements Cancellable {
|
|||||||
* @return array list of all the blocks associated with the created portal
|
* @return array list of all the blocks associated with the created portal
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public ArrayList<Block> getBlocks() {
|
public List<BlockState> getBlocks() {
|
||||||
return this.blocks;
|
return this.blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,14 +69,19 @@ public class PortalCreateEvent extends WorldEvent implements Cancellable {
|
|||||||
*/
|
*/
|
||||||
public enum CreateReason {
|
public enum CreateReason {
|
||||||
/**
|
/**
|
||||||
* When a portal is created 'traditionally' due to a portal frame
|
* When the blocks inside a portal are created due to a portal frame
|
||||||
* being set on fire.
|
* being set on fire.
|
||||||
*/
|
*/
|
||||||
FIRE,
|
FIRE,
|
||||||
/**
|
/**
|
||||||
* When a portal is created as a destination for an existing portal
|
* When a nether portal frame and portal is created at the exist of an
|
||||||
* when using the custom PortalTravelAgent
|
* entered nether portal.
|
||||||
*/
|
*/
|
||||||
OBC_DESTINATION
|
NETHER_PAIR,
|
||||||
|
/**
|
||||||
|
* When the target end platform is created as a result of a player
|
||||||
|
* entering an end portal.
|
||||||
|
*/
|
||||||
|
END_PLATFORM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren