Dev Events: Difference between revisions
Marcely1199 (talk | contribs) No edit summary |
Marcely1199 (talk | contribs) |
||
Line 185: | Line 185: | ||
'' This event will be executed when a player wants to use (and could) a extra item''<br /> | '' This event will be executed when a player wants to use (and could) a extra item''<br /> | ||
<br /> | <br /> | ||
'''Constructor:''' PlayerUseExtraItemEvent( | '''Constructor:''' PlayerUseExtraItemEvent(ExtraItem extraItem, Arena arena, PlayerInteractEvent parentEvent)<br /> | ||
'''Methods:''' | '''Methods:''' | ||
* Player getPlayer() | * Player getPlayer() | ||
* Arena getArena() | |||
* PlayerInteractEvent getParentEvent() | |||
* ExtraItem getExtraItem() | * ExtraItem getExtraItem() | ||
* boolean isCancelled() | * boolean isCancelled() |
Revision as of 14:53, 19 May 2019
As any other plugin this plugin also supports events.
You don't need to change much at your code,
you simply add a MBedwars event like the way you did with the Bukkit/Spigot events.
Currently these MBedwars events exists:
PlayerJoinArenaEvent
This event will be executed when a player is entering an arena.
Constructor: PlayerJoinArenaEvent(Player player, Arena arena, AddPlayerFail failReason)
Methods:
- Player getPlayer()
- Arena getArena()
- boolean wasSuccessfull()
- AddPlayerFail getFailReason()
- void setCancelled(boolean bool)
- boolean isCancelled()
PlayerQuitArenaEvent
This event will be executed when a player is leaving an arena.
Constructor: PlayerJoinArenaEvent(Player player, Arena arena, boolean success)
Methods:
- Player getPlayer()
- Arena getArena()
- boolean wasSuccessfull()
PlayerJoinArenaSpectatorEvent
This event will be executed when a player is entering an arena as a spectator.
Constructor: PlayerJoinArenaSpectatorEvent(Player player, Arena arena)
Methods:
- Player getPlayer()
- Arena getArena()
- void setCancelled(boolean bool)
- boolean isCancelled()
PlayerQuitArenaSpectatorEvent
This event will be executed when a player is leaving an arena as a spectator.
Constructor: PlayerQuitArenaSpectatorEvent(Player player, Arena arena)
Methods:
- Player getPlayer()
- Arena getArena()
RoundStartEvent
@Deprecated: Please use de.marcely.api.ArenaStatusUpdateEvent instead
This event will be executed when an arena is starting.
Constructor: RoundStartEvent(Arena arena)
Methods:
- Arena getArena()
RoundEndEvent
This event will be executed when an arena is ending.
Constructor: RoundEndEvent(List<Player> players, Arena arena, Team winnerteam)
Methods:
- List<Player> getWinners()
- Team getWinnerTeam()
- Arena getArena()
BedPlaceEvent
This event will be executed when a player changing the beds coordinates of a team.
Constructor: BedPlaceEvent(Player player, Arena arena, Team team, Location loc)
Methods:
- void setCancelled(boolean bool)
- Player getWhoPlaced()
- Arena getArena()
- Team getTeam()
- Location getLocation()
- boolean isCancelled()
BedBreakEvent
This event will be executed when a player is breaking the bed by a team.
Constructor: BedBreakEvent(Player player, Arena arena, Team team, Location loc)
Methods:
- void setSolution(BedBreakEventSolution solution)
- Arena getArena()
- Team getTeam()
- Location getLocation()
- Player getPlayer()
- BedBreakEventSolution getSolution()
ArenaStatusUpdateEvent
This event will be executed when an arena is changing his status.
Constructor: ArenaStatusUpdateEvent(Arena arena, ArenaStatus before, ArenaStatus status)
Methods:
- Arena getArena()
- ArenaStatus getStatusBefore()
- ArenaStatus getStatus()
PlayerRespawnEvent
This event will be executed when a player is respawning (while he is playing MBedwars)
Constructor: PlayerRespawnEvent(Player player, Arena arena, boolean kick)
Methods:
- void kickPlayer(boolean bool)
- Player getPlayer()
- Arena getArena()
- boolean willKick()
OutOfArenaEvent
This event will be executed when a player is teleporting himself outside the arena (while he is playing MBedwars)
Constructor: OutOfArenaEvent(Player player, Arena arena, Location from, Location to, TeleportCause cause)
Methods:
- void kickPlayer(boolean bool)
- void setCancelled(boolean bool)
- Player getPlayer()
- Arena getArena()
- Location getFrom()
- Location getTo()
- TeleportCause getCause()
- boolean willKick()
- boolean isCancelled()
ArenaOutOfTimeEvent
This event will be executed when an arena is out of time (the timer ends)
Constructor: ArenaOutOfTimeEvent(Arena arena)
Methods:
- void setNewTime(int time)
- Arena getArena()
- int getNewTime()
EnableArenaEvent
This event will be executed when a player is (trying to) enable an arena through /bw arena setenabled
Constructor: EnableArenaEvent(Arena arena, List<CrashMessage> crashMessages)
Methods:
- setCrashMessages(List<CrashMessage> crashMessages)
- Arena getArena()
- List<CrashMessage> getCrashMessages()
- boolean wasSuccessfull()
CommandFireEvent
This event will be executed when a player is typing typing the /bw command
Constructor: CommandFireEvent(CommandSender sender, Command cmd)
Methods:
- void setCancelled(boolean bool)
- CommandSender getCommandSender()
- Command getCommand()
- boolean isCancelled()
CommandArenaFireEvent
This event will be executed when a player is typing typing the /bw command arena command
Constructor: CommandArenaFireEvent(CommandSender sender, Command cmd)
Methods:
- void setCancelled(boolean bool)
- CommandSender getCommandSender()
- Command getCommand()
- boolean isCancelled()
ShopBuyEvent
This event will be executed when a player is (trying to) buy something in the shop
Constructor: ShopBuyEvent(Player player, ShopItem si, ItemStack is, Spawner payment, int price, int priceMultiply)
Methods:
- Arena getArena()
- Player getBuyer()
- ShopItem getShopItem()
- int getTakeAmount()
- ShopOpenType getOpenType()
- boolean isCancelled()
- void setCancelled(boolean cancel)
- void giveBought(boolean bool)
- void takePayment(boolean bool)
- void setHasEnoughMaterials(boolean bool)
- boolean isGettingBought()
- boolean isTakingPayment()
- boolean hasEnoughMaterials()
PlayerKillPlayerEvent
This event will be executed when a player is killing an other player while playing in an arena
Constructor: PlayerKillPlayerEvent(Arena arena, Player damager, Player player, DamageCause cause, Projectile proj)
Methods:
- Arena getArena()
- Player getDamager()
- Player getPlayer()
- DamageCause getCause()
- Projectile getProjectile()
PlayerUseExtraItemEvent
This event will be executed when a player wants to use (and could) a extra item
Constructor: PlayerUseExtraItemEvent(ExtraItem extraItem, Arena arena, PlayerInteractEvent parentEvent)
Methods:
- Player getPlayer()
- Arena getArena()
- PlayerInteractEvent getParentEvent()
- ExtraItem getExtraItem()
- boolean isCancelled()
- void setCancelled(boolean bool)
PlayerEarnAchievementEvent
This event will be executed when a player is earning an achievement
Constructor: Player player, Achievement a, UserAchievements ua
Methods:
- Player getPlayer()
- Achievement getAchievement()
- UserAchievements getUserAchievement()
- boolean isCancelled()
- void setCancelled(boolean bool)
PlayerOpenShopEvent
This event will be executed when a player is opening a shop
Constructor: Player player, ShopDesignType design
Methods:
- void setDesign(ShopDesignType design)
- Player getPlayer()
- ShopDesignType getDesign()
- boolean isCancelled()
- void setCancelled(boolean bool)
ArenaRegenerationStartEvent
This event will be executed whenever an arena starts to regenerate itself
Constructor: Arena arena, CommandSender sender, int regenerationSpeed, ArenaRegenerationStartEventResult result
Methods:
- void setResult(ArenaRegenerationStartEventResult result)
- Arena getArena()
- @Nullable CommandSender getSender()
- int getRegenerationSpeed()
- ArenaRegenerationStartEventResult getResult()
- void customRegeneratorCallFinished()
ArenaRegenerationStopEvent
This event will be executed whenever an arena stops (finished or cancelled) to regenerate itself
Constructor: Arena arena, CommandSender sender
Methods:
- Arena getArena()
- @Nullable CommandSender getSender()