Dev Events: Difference between revisions

From MBedwars
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
''This event will be executed when a player is entering an arena.''<br />
''This event will be executed when a player is entering an arena.''<br />
<br />
<br />
'''Constructor:''' PlayerJoinArenaEvent(Player player, Arena arena, AddPlayerFail failReason)<br />
'''Constructor:''' Player player, Arena arena, AddPlayerFail failReason<br />
'''Methods:'''
'''Methods:'''
* Player getPlayer()
* Player getPlayer()
Line 19: Line 19:
''This event will be executed when a player is leaving an arena.''<br />
''This event will be executed when a player is leaving an arena.''<br />
<br />
<br />
'''Constructor:''' PlayerQuitArenaEvent(Player player, Arena arena, KickReason reason, @Nullable Team team)<br />
'''Constructor:''' Player player, Arena arena, KickReason reason, @Nullable Team team<br />
'''Methods:'''
'''Methods:'''
* Player getPlayer()
* Player getPlayer()
Line 29: Line 29:
''This event will be executed when a player is entering an arena as a spectator.''<br />
''This event will be executed when a player is entering an arena as a spectator.''<br />
<br />
<br />
'''Constructor:''' PlayerJoinArenaSpectatorEvent(Player player, Arena arena)<br />
'''Constructor:''' Player player, Arena arena<br />
'''Methods:'''
'''Methods:'''
* Player getPlayer()
* Player getPlayer()
Line 39: Line 39:
''This event will be executed when a player is leaving an arena as a spectator.''<br />
''This event will be executed when a player is leaving an arena as a spectator.''<br />
<br />
<br />
'''Constructor:''' PlayerQuitArenaSpectatorEvent(Player player, Arena arena)<br />
'''Constructor:''' Player player, Arena arena<br />
'''Methods:'''
'''Methods:'''
* Player getPlayer()
* Player getPlayer()
Line 48: Line 48:
''This event will be executed when an arena is starting.''<br />
''This event will be executed when an arena is starting.''<br />
<br />
<br />
'''Constructor:''' RoundStartEvent(Arena arena)<br />
'''Constructor:''' Arena arena<br />
'''Methods:'''
'''Methods:'''
* Arena getArena()
* Arena getArena()
Line 55: Line 55:
''This event will be executed when an arena is ending.''<br />
''This event will be executed when an arena is ending.''<br />
<br />
<br />
'''Constructor:''' RoundEndEvent(Arena arena, @Nullable Team winnerTeam)<br />
'''Constructor:''' Arena arena, @Nullable Team winnerTeam<br />
'''Methods:'''
'''Methods:'''
* boolean isTie()
* boolean isTie()
Line 66: Line 66:
''This event will be executed when a player changing the beds coordinates of a team.''<br />
''This event will be executed when a player changing the beds coordinates of a team.''<br />
<br />
<br />
'''Constructor:''' BedPlaceEvent(Player player, Arena arena, Team team, Location loc)<br />
'''Constructor:''' Player player, Arena arena, Team team, Location loc<br />
'''Methods:'''
'''Methods:'''
* void setCancelled(boolean bool)
* void setCancelled(boolean bool)
Line 78: Line 78:
''This event will be executed when a player is breaking the bed by a team.''<br />
''This event will be executed when a player is breaking the bed by a team.''<br />
<br />
<br />
'''Constructor:''' BedBreakEvent(Player player, Arena arena, Team team, Location loc)<br />
'''Constructor:''' Player player, Arena arena, Team team, Location loc<br />
'''Methods:'''
'''Methods:'''
* void setSolution(BedBreakEventSolution solution)
* void setSolution(BedBreakEventSolution solution)
Line 90: Line 90:
''This event will be executed when an arena is changing his status.''<br />
''This event will be executed when an arena is changing his status.''<br />
<br />
<br />
'''Constructor:''' ArenaStatusUpdateEvent(Arena arena, ArenaStatus before, ArenaStatus status)<br />
'''Constructor:''' Arena arena, ArenaStatus before, ArenaStatus status<br />
'''Methods:'''
'''Methods:'''
* Arena getArena()
* Arena getArena()
Line 100: Line 100:
''This event will be executed when a player is respawning (while he is playing MBedwars)''<br />
''This event will be executed when a player is respawning (while he is playing MBedwars)''<br />
<br />
<br />
'''Constructor:''' PlayerRespawnEvent(Player player, Arena arena, boolean kick)<br />
'''Constructor:''' Player player, Arena arena, boolean kick<br />
'''Methods:'''
'''Methods:'''
* void kickPlayer(boolean bool)
* void kickPlayer(boolean bool)
Line 118: Line 118:
* Arena getArena()
* Arena getArena()
* boolean willKick()
* boolean willKick()
== PlayerRoundRespawnEvent ==
''This event will be called after the player has respawned successfully and continues to play''<br />
<br />
'''Constructor:''' Player player, Arena arena<br />
'''Methods:'''
* Player getPlayer()
* Arena getArena()


== OutOfArenaEvent ==
== OutOfArenaEvent ==
''This event will be executed when a player is teleporting himself outside the arena (while he is playing MBedwars)''<br />
''This event will be executed when a player is teleporting himself outside the arena (while he is playing MBedwars)''<br />
<br />
<br />
'''Constructor:''' OutOfArenaEvent(Player player, Arena arena, Location from, Location to, TeleportCause cause)<br />
'''Constructor:''' Player player, Arena arena, Location from, Location to, TeleportCause cause<br />
'''Methods:'''
'''Methods:'''
* void kickPlayer(boolean bool)
* void kickPlayer(boolean bool)
Line 137: Line 145:
'' This event will be executed when an arena is out of time (the timer ends)''<br />
'' This event will be executed when an arena is out of time (the timer ends)''<br />
<br />
<br />
'''Constructor:''' ArenaOutOfTimeEvent(Arena arena)<br />
'''Constructor:''' Arena arena<br />
'''Methods:'''
'''Methods:'''
* void setNewTime(int time)
* void setNewTime(int time)
Line 145: Line 153:
'' This event will be executed when a player is (trying to) enable an arena through /bw arena setenabled''<br />
'' This event will be executed when a player is (trying to) enable an arena through /bw arena setenabled''<br />
<br />
<br />
'''Constructor:''' EnableArenaEvent(Arena arena, List<CrashMessage> crashMessages)
'''Constructor:''' Arena arena, List<CrashMessage> crashMessages<br />
'''Methods:'''
'''Methods:'''
* setCrashMessages(List<CrashMessage> crashMessages)
* setCrashMessages(List<CrashMessage> crashMessages)
Line 154: Line 162:
'' This event will be executed when a player is typing typing the /bw command''<br />
'' This event will be executed when a player is typing typing the /bw command''<br />
<br />
<br />
'''Constructor:''' CommandFireEvent(CommandSender sender, Command cmd)<br />
'''Constructor:''' CommandSender sender, Command cmd<br />
'''Methods:'''
'''Methods:'''
* void setCancelled(boolean bool)
* void setCancelled(boolean bool)
Line 164: Line 172:
'' This event will be executed when a player is typing typing the /bw command arena command''<br />
'' This event will be executed when a player is typing typing the /bw command arena command''<br />
<br />
<br />
'''Constructor:''' CommandArenaFireEvent(CommandSender sender, Command cmd)<br />
'''Constructor:''' CommandSender sender, Command cmd<br />
'''Methods:'''
'''Methods:'''
* void setCancelled(boolean bool)
* void setCancelled(boolean bool)
Line 174: Line 182:
'' This event will be executed when a player is (trying to) buy something in the shop''<br />
'' This event will be executed when a player is (trying to) buy something in the shop''<br />
<br />
<br />
'''Constructor:''' ShopBuyEvent(Player player, ShopItem si, ItemStack is, Spawner payment, int price, int priceMultiply)<br />
'''Constructor:''' Player player, ShopItem si, ItemStack is, Spawner payment, int price, int priceMultiply<br />
'''Methods:'''
'''Methods:'''
* Arena getArena()
* Arena getArena()
Line 193: Line 201:
'' This event will be executed when a player is killing an other player while playing in an arena''<br />
'' This event will be executed when a player is killing an other player while playing in an arena''<br />
<br />
<br />
'''Constructor:''' PlayerKillPlayerEvent(Arena arena, Player damager, Player player, DamageCause cause, Projectile proj)<br />
'''Constructor:''' Arena arena, Player damager, Player player, DamageCause cause, Projectile proj<br />
'''Methods:'''
'''Methods:'''
* Arena getArena()
* Arena getArena()
Line 204: Line 212:
'' 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(ExtraItem extraItem, Arena arena, PlayerEvent parentEvent, ItemStack item)<br />
'''Constructor:''' ExtraItem extraItem, Arena arena, PlayerEvent parentEvent, ItemStack item<br />
'''Methods:'''
'''Methods:'''
* Player getPlayer()
* Player getPlayer()

Revision as of 16:28, 11 August 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: 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: Player player, Arena arena, KickReason reason, @Nullable Team team
Methods:

  • Player getPlayer()
  • Arena getArena()
  • KickReason getReason()
  • @Nullable Team getTeam()

PlayerJoinArenaSpectatorEvent

This event will be executed when a player is entering an arena as a spectator.

Constructor: 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: 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: Arena arena
Methods:

  • Arena getArena()

RoundEndEvent

This event will be executed when an arena is ending.

Constructor: Arena arena, @Nullable Team winnerTeam
Methods:

  • boolean isTie()
  • List<Player> getWinners()
  • Team getWinnerTeam()
  • List<Player> getLosers()
  • Arena getArena()

BedPlaceEvent

This event will be executed when a player changing the beds coordinates of a team.

Constructor: 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: 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: Arena arena, ArenaStatus before, ArenaStatus status
Methods:

  • Arena getArena()
  • ArenaStatus getStatusBefore()
  • ArenaStatus getStatus()

PlayerRespawnEvent

@Deprecated: Please use de.marcely.api.PlayerRoundDeathEvent instead
This event will be executed when a player is respawning (while he is playing MBedwars)

Constructor: Player player, Arena arena, boolean kick
Methods:

  • void kickPlayer(boolean bool)
  • Player getPlayer()
  • Arena getArena()
  • boolean willKick()

PlayerRoundDeathEvent

This event will be executed whenever a player died, but during its org.bukkit.event.player.PlayerRespawnEvent event

Constructor: org.bukkit.event.player.PlayerRespawnEvent parent, Arena arena, boolean kick
Extends: PlayerRespawnEvent
Methods:

  • org.bukkit.event.player.PlayerRespawnEvent getParentEvent()
  • void kickPlayer(boolean bool)
  • Player getPlayer()
  • Arena getArena()
  • boolean willKick()

PlayerRoundRespawnEvent

This event will be called after the player has respawned successfully and continues to play

Constructor: Player player, Arena arena
Methods:

  • Player getPlayer()
  • Arena getArena()

OutOfArenaEvent

This event will be executed when a player is teleporting himself outside the arena (while he is playing MBedwars)

Constructor: 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: 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: 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: 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: 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: 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: 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: ExtraItem extraItem, Arena arena, PlayerEvent parentEvent, ItemStack item
Methods:

  • Player getPlayer()
  • @Nullable Block getClickedBlock()
  • @Nullable BlockFace getBlockFace()
  • ItemStack getItem()
  • 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()

ArenaCreateEvent

This event will be executed whenever a player/plugin creats an arena and adds it to the existing arenas list

Constructor: Arena arena, @Nullable CommandSender sender
Methods:

  • Arena getArena()
  • @Nullable Player getSender()

ArenaDeleteEvent

This event will be executed whenever a player/plugin removes an arena of the existing arenas list

Constructor: Arena arena, @Nullable CommandSender sender
Methods:

  • Arena getArena()
  • @Nullable Player getSender()
  • void setCancelled(boolean cancelled)
  • boolean isCancelled()

TeamEliminateEvent

This event will be executed whenever a player dies and by that causes the elimination/removal of the team from the round

Constructor: Arena arena, Team team, Player finalPlayer, boolean causesEnd
Methods:

  • Arena getArena()
  • Team getTeam()
  • Player getFinalPlayer()
  • boolean isCausingEnd()