mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
Implement PortalCreateEvent reason codes. Addresses BUKKIT-833
This commit modifies the construction of PortalCreateEvents to specify a reason for the event. Reasons are either: 1. FIRE: the portal is being created because a player set fire to an obsidian frame. 2. DESTINATION: the portal is being created as a destination for an existing portal.
This commit is contained in:
parent
f2d9d4174f
commit
cc2e721ffc
@ -95,7 +95,7 @@ public class BlockPortal extends BlockHalfTransparant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld);
|
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
|
||||||
world.getServer().getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
@ -341,7 +341,7 @@ public class PortalTravelAgent implements TravelAgent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
|
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld, PortalCreateEvent.CreateReason.OBC_DESTINATION);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user