Class PlayerBuyUpgradeEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.PlayerBuyUpgradeEvent
- All Implemented Interfaces:
ArenaEvent
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Default problems used and provided by the pluginstatic class
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player
-
Constructor Summary
ConstructorDescriptionPlayerBuyUpgradeEvent
(Player player, Arena arena, Team team, UpgradeLevel level, List<PlayerBuyUpgradeEvent.Problem> problems, boolean broadcastingMessage, boolean broadcastingSound, boolean doingUpgrade, boolean takePayments) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add a problem that will prevent the item from being bought.boolean
addProblem
(PlayerBuyUpgradeEvent.Problem problem) Add a problem that will prevent the item from being bought.getArena()
Returns the arena in which the player is playing.static HandlerList
Returns the problems that are preventing the item from being boughtgetTeam()
Returns the team in which the player bought the upgrade for.The upgrade level that was purchased by the playerboolean
Whether or not a message will be sent out to all team players when an upgrade or trap is purchasedboolean
Whether or not a sound will be played when an upgrade or trap is purchasedboolean
Returns whether or not the player will receive the products of the item.boolean
Returns whether or not it will take the payments from the player.boolean
isTrap()
Returns if the handler attached to this upgrade level is a trap handlerint
Removes all problems and makes it buyable by that.boolean
Removes a problem.boolean
Removes a problem.void
setBroadcastingMessage
(boolean broadcastingMessage) Sets whether or not a message will be sent out to all team players when an upgrade or trap is purchasedvoid
setBroadcastingSound
(boolean broadcastingSound) Set whether or not a sound should be played when an upgrade or trap is purchasedvoid
setDoingUpgrade
(boolean doingUpgrade) Define whether or not if he'll get products.void
setTakingPayments
(boolean takePayments) Define whether or not the payments will be taken from the player.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayer
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerBuyUpgradeEvent
public PlayerBuyUpgradeEvent(Player player, Arena arena, Team team, UpgradeLevel level, List<PlayerBuyUpgradeEvent.Problem> problems, boolean broadcastingMessage, boolean broadcastingSound, boolean doingUpgrade, boolean takePayments)
-
-
Method Details
-
getArena
Returns the arena in which the player is playing.- Specified by:
getArena
in interfaceArenaEvent
- Returns:
- The arena in which the player currently is inside
-
getTeam
Returns the team in which the player bought the upgrade for.- Returns:
- the team that is being upgraded
-
isTrap
public boolean isTrap()Returns if the handler attached to this upgrade level is a trap handler- Returns:
- check if the upgrade level that was purchased is a trap
-
getUpgradeLevel
The upgrade level that was purchased by the player- Returns:
- get the upgrade level that was purchased
-
isBroadcastingMessage
public boolean isBroadcastingMessage()Whether or not a message will be sent out to all team players when an upgrade or trap is purchased- Returns:
- if a message will be broadcast
-
setBroadcastingMessage
public void setBroadcastingMessage(boolean broadcastingMessage) Sets whether or not a message will be sent out to all team players when an upgrade or trap is purchased- Parameters:
broadcastingMessage
- if a message should be broadcast
-
isBroadcastingSound
public boolean isBroadcastingSound()Whether or not a sound will be played when an upgrade or trap is purchased- Returns:
- if the sound is being played
-
setBroadcastingSound
public void setBroadcastingSound(boolean broadcastingSound) Set whether or not a sound should be played when an upgrade or trap is purchased- Parameters:
broadcastingSound
- if the sound should be played
-
getProblems
Returns the problems that are preventing the item from being bought- Returns:
- The problems
-
addProblem
Add a problem that will prevent the item from being bought.Act's similar as
Cancellable.setCancelled(boolean)
.- Parameters:
problem
- The problem why he can't buy it- Returns:
false
if it already has been added
-
addProblem
Add a problem that will prevent the item from being bought.Act's similar as
Cancellable.setCancelled(boolean)
.- Parameters:
problem
- The problem why he can't buy it- Returns:
false
if it already has been added
-
removeProblem
Removes a problem.- Parameters:
problem
- The problem- Returns:
- If it has been removed or not
-
removeProblem
Removes a problem.- Parameters:
problem
- The problem- Returns:
- If it has been removed or not
-
removeAllProblems
public int removeAllProblems()Removes all problems and makes it buyable by that.- Returns:
- The amount of problems that have been removed
-
isDoingUpgrade
public boolean isDoingUpgrade()Returns whether or not the player will receive the products of the item.Does not concern when there are problems as he won't receive them if there are problems anyways.
- Returns:
- If he'll get the products or not
-
setDoingUpgrade
public void setDoingUpgrade(boolean doingUpgrade) Define whether or not if he'll get products.Keep in mind that problems can prevent products being given to him.
- Parameters:
doingUpgrade
- The new value
-
isTakingPayments
public boolean isTakingPayments()Returns whether or not it will take the payments from the player.Does not concern when there are problems as they're preventing them from being taken anyways.
- Returns:
- If the payments will be taken or not
-
setTakingPayments
public void setTakingPayments(boolean takePayments) Define whether or not the payments will be taken from the player.Keep in mind that problems can prevent this
- Parameters:
takePayments
- The new value
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-