Class CancellableTownyEvent
java.lang.Object
org.bukkit.event.Event
com.palmergames.bukkit.towny.event.CancellableTownyEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
- Direct Known Subclasses:
DistrictAddEvent
,DistrictDeletedEvent
,NationAcceptAllyRequestEvent
,NationDenyAllyRequestEvent
,NationKingChangeEvent
,NationPreAddAllyEvent
,NationPreAddEnemyEvent
,NationPreAddTownEvent
,NationPreInviteTownEvent
,NationPreMergeEvent
,NationPreRemoveEnemyEvent
,NationPreRenameEvent
,NationPreTownKickEvent
,NationPreTownLeaveEvent
,NationPreTransactionEvent
,NationRankAddEvent
,NationRankRemoveEvent
,NationRemoveAllyEvent
,NationSanctionTownAddEvent
,NationSanctionTownRemoveEvent
,NationSetSpawnEvent
,NationToggleEvent
,PlotGroupAddEvent
,PlotGroupDeletedEvent
,PlotPreChangeTypeEvent
,PlotPreClearEvent
,PlotToggleEvent
,PlotTrustAddEvent
,PlotTrustRemoveEvent
,PreDeleteNationEvent
,PreDeleteTownEvent
,PreNewNationEvent
,PreNewTownEvent
,PreTownPaysNationTaxEvent
,ResidentPreJailEvent
,ResidentToggleModeEvent
,SpawnEvent
,TownAddAlliedTownEvent
,TownAddEnemiedTownEvent
,TownAddResidentRankEvent
,TownBlockPermissionChangeEvent
,TownCedePlotEvent
,TownIsTownOverClaimedEvent
,TownKickEvent
,TownLeaveEvent
,TownMayorChangeEvent
,TownOutlawAddEvent
,TownOutlawRemoveEvent
,TownPaysNationConqueredTaxEvent
,TownPreAddResidentEvent
,TownPreClaimEvent
,TownPreInvitePlayerEvent
,TownPreMergeEvent
,TownPreReclaimEvent
,TownPreRenameEvent
,TownPreRuinedEvent
,TownPreSetHomeBlockEvent
,TownPreTransactionEvent
,TownPreUnclaimCmdEvent
,TownPreUnclaimEvent
,TownRemoveAlliedTownEvent
,TownRemoveEnemiedTownEvent
,TownRemoveResidentRankEvent
,TownSetOutpostSpawnEvent
,TownSetSpawnEvent
,TownToggleEvent
,TownTrustAddEvent
,TownTrustRemoveEvent
,TownTrustTownAddEvent
,TownTrustTownRemoveEvent
,TownyActionEvent
,TownyPreTransactionEvent
public abstract class CancellableTownyEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
A class extended by Towny Events which are Cancellable and which contain a
cancelMessage.
Having a getCancelMessage() available to us allows us to throw a
CancelledEventException
which can use the cancelMessage in feedback
messaging or logging.
Used primarily in the
ConfirmationBuilder.setCancellableEvent(CancellableTownyEvent)
and
BukkitTools.ifCancelledThenThrow(CancellableTownyEvent)
code.
- Since:
- 0.98.4.0.
- Author:
- LlmDL
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull String
boolean
void
setCancelled
(boolean cancelled) Sets the event to be cancelled or not.void
setCancelMessage
(@NotNull String msg) Sets the cancellation message which will display to the player.Methods inherited from class org.bukkit.event.Event
getEventName, getHandlers, isAsynchronous
-
Constructor Details
-
CancellableTownyEvent
public CancellableTownyEvent()
-
-
Method Details
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceorg.bukkit.event.Cancellable
- Returns:
- true if this event is cancelled.
-
setCancelled
public void setCancelled(boolean cancelled) Sets the event to be cancelled or not.- Specified by:
setCancelled
in interfaceorg.bukkit.event.Cancellable
- Parameters:
cancelled
- true will cancel the event.
-
getCancelMessage
- Returns:
- cancelMessage a String which will be displayed to the player/sender informing them that the action they commited is being denied, if cancelMessage is blank then no message will be displayed.
-
setCancelMessage
Sets the cancellation message which will display to the player. Set to "" to display nothing.- Parameters:
msg
- cancelMessage to display as feedback.
-