mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 04:55:28 +02:00
Update code style
This commit is contained in:
@@ -6,6 +6,10 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private Plugin plugin;
|
||||
private String sender;
|
||||
@@ -27,6 +31,10 @@ public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The plugin responsible for this event, note this can be null
|
||||
*/
|
||||
@@ -48,13 +56,6 @@ public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String message that will be sent
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayName String display name of the player who sent the chat
|
||||
*/
|
||||
@@ -62,6 +63,13 @@ public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String message that will be sent
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message String message to be sent in chat
|
||||
*/
|
||||
@@ -69,7 +77,9 @@ public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -80,15 +90,8 @@ public abstract class McMMOChatEvent extends Event implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -12,10 +12,11 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
* Generic event for mcMMO experience events.
|
||||
*/
|
||||
public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected PrimarySkillType skill;
|
||||
protected int skillLevel;
|
||||
protected XPGainReason xpGainReason;
|
||||
private boolean cancelled;
|
||||
|
||||
@Deprecated
|
||||
protected McMMOPlayerExperienceEvent(Player player, PrimarySkillType skill) {
|
||||
@@ -32,6 +33,10 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
||||
this.xpGainReason = xpGainReason;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The skill involved in this event
|
||||
*/
|
||||
@@ -53,7 +58,9 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
||||
return xpGainReason;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -63,15 +70,9 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import org.bukkit.event.HandlerList;
|
||||
* Called when a user loses levels in a skill
|
||||
*/
|
||||
public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int levelsLost;
|
||||
|
||||
@Deprecated
|
||||
@@ -33,11 +34,8 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
|
||||
this.levelsLost = levelsLost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param levelsLost Set the number of levels lost in this event
|
||||
*/
|
||||
public void setLevelsLost(int levelsLost) {
|
||||
this.levelsLost = levelsLost;
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,14 +45,15 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
|
||||
return levelsLost;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
/**
|
||||
* @param levelsLost Set the number of levels lost in this event
|
||||
*/
|
||||
public void setLevelsLost(int levelsLost) {
|
||||
this.levelsLost = levelsLost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import org.bukkit.event.HandlerList;
|
||||
* Called when a user levels up in a skill
|
||||
*/
|
||||
public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int levelsGained;
|
||||
|
||||
@Deprecated
|
||||
@@ -33,11 +34,8 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
|
||||
this.levelsGained = levelsGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param levelsGained Set the number of levels gained in this event
|
||||
*/
|
||||
public void setLevelsGained(int levelsGained) {
|
||||
this.levelsGained = levelsGained;
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,14 +45,15 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent {
|
||||
return levelsGained;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
/**
|
||||
* @param levelsGained Set the number of levels gained in this event
|
||||
*/
|
||||
public void setLevelsGained(int levelsGained) {
|
||||
this.levelsGained = levelsGained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import org.bukkit.event.HandlerList;
|
||||
* Called when a player gains XP in a skill
|
||||
*/
|
||||
public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private float xpGained;
|
||||
|
||||
@Deprecated
|
||||
@@ -22,6 +23,10 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The amount of experience gained in this event
|
||||
*/
|
||||
@@ -29,6 +34,13 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
return xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained int amount of experience gained in this event
|
||||
*/
|
||||
public void setRawXpGained(float xpGained) {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int amount of experience gained in this event
|
||||
*/
|
||||
@@ -37,13 +49,6 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
return (int) xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained int amount of experience gained in this event
|
||||
*/
|
||||
public void setRawXpGained(float xpGained) {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained int amount of experience gained in this event
|
||||
*/
|
||||
@@ -52,14 +57,8 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -8,9 +8,12 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private HashMap<String, Integer> levelChanged;
|
||||
private HashMap<String, Float> experienceChanged;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerDeathPenaltyEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
|
||||
@@ -26,6 +29,10 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> getLevelChanged() {
|
||||
return levelChanged;
|
||||
}
|
||||
@@ -42,7 +49,9 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell
|
||||
this.experienceChanged = experienceChanged;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -53,15 +62,8 @@ public class McMMOPlayerDeathPenaltyEvent extends PlayerEvent implements Cancell
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,10 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class McMMOPlayerPreDeathPenaltyEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
public McMMOPlayerPreDeathPenaltyEvent(Player player) {
|
||||
@@ -13,7 +17,13 @@ public class McMMOPlayerPreDeathPenaltyEvent extends PlayerEvent implements Canc
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -24,15 +34,8 @@ public class McMMOPlayerPreDeathPenaltyEvent extends PlayerEvent implements Canc
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -10,6 +10,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
* Called when mcMMO is preparing to drop an item.
|
||||
*/
|
||||
public class McMMOItemSpawnEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Location location;
|
||||
private ItemStack itemStack;
|
||||
private boolean cancelled;
|
||||
@@ -20,6 +24,10 @@ public class McMMOItemSpawnEvent extends Event implements Cancellable {
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Location where the item will be dropped
|
||||
*/
|
||||
@@ -48,7 +56,9 @@ public class McMMOItemSpawnEvent extends Event implements Cancellable {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -59,15 +69,8 @@ public class McMMOItemSpawnEvent extends Event implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,10 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String oldAlly;
|
||||
private String newAlly;
|
||||
private EventReason reason;
|
||||
@@ -24,6 +28,10 @@ public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancel
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The party being left, or null if the player was not in a party
|
||||
*/
|
||||
@@ -45,6 +53,24 @@ public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancel
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of reasons why the event may have been fired
|
||||
*/
|
||||
@@ -64,27 +90,4 @@ public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancel
|
||||
*/
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,10 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
* Called when a player attempts to join, leave, or change parties.
|
||||
*/
|
||||
public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String oldParty;
|
||||
private String newParty;
|
||||
private EventReason reason;
|
||||
@@ -27,6 +31,10 @@ public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The party being left, or null if the player was not in a party
|
||||
*/
|
||||
@@ -48,6 +56,24 @@ public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of reasons why the event may have been fired
|
||||
*/
|
||||
@@ -77,27 +103,4 @@ public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
|
||||
*/
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,10 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class McMMOPartyLevelUpEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Party party;
|
||||
private int levelsChanged;
|
||||
private boolean cancelled;
|
||||
@@ -16,6 +20,10 @@ public class McMMOPartyLevelUpEvent extends Event implements Cancellable {
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Party getParty() {
|
||||
return party;
|
||||
}
|
||||
@@ -28,7 +36,9 @@ public class McMMOPartyLevelUpEvent extends Event implements Cancellable {
|
||||
this.levelsChanged = levelsChanged;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -39,15 +49,8 @@ public class McMMOPartyLevelUpEvent extends Event implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,10 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
* Called just before a player teleports using the /ptp command.
|
||||
*/
|
||||
public class McMMOPartyTeleportEvent extends PlayerTeleportEvent {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String party;
|
||||
private Player target;
|
||||
|
||||
@@ -17,6 +21,10 @@ public class McMMOPartyTeleportEvent extends PlayerTeleportEvent {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The party the teleporting player is in
|
||||
*/
|
||||
@@ -31,15 +39,8 @@ public class McMMOPartyTeleportEvent extends PlayerTeleportEvent {
|
||||
return target;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,10 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class McMMOPartyXpGainEvent extends Event implements Cancellable {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Party party;
|
||||
private float xpGained;
|
||||
private boolean cancelled;
|
||||
@@ -16,6 +20,10 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Party getParty() {
|
||||
return party;
|
||||
}
|
||||
@@ -27,6 +35,13 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
|
||||
return xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained set amount of experience gained in this event
|
||||
*/
|
||||
public void setRawXpGained(float xpGained) {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int amount of experience gained in this event
|
||||
*/
|
||||
@@ -35,13 +50,6 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
|
||||
return (int) xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained set amount of experience gained in this event
|
||||
*/
|
||||
public void setRawXpGained(float xpGained) {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xpGained set int amount of experience gained in this event
|
||||
*/
|
||||
@@ -50,7 +58,9 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
|
||||
this.xpGained = xpGained;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
@@ -61,15 +71,8 @@ public class McMMOPartyXpGainEvent extends Event implements Cancellable {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -11,24 +11,31 @@ import org.bukkit.scoreboard.Scoreboard;
|
||||
*/
|
||||
abstract public class McMMOScoreboardEvent extends Event {
|
||||
|
||||
protected Scoreboard targetBoard; //ConfigScoreboard involved in this event
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
final Scoreboard currentBoard; //Can be null
|
||||
private final ScoreboardEventReason scoreboardEventReason;
|
||||
protected Scoreboard targetBoard; //ConfigScoreboard involved in this event
|
||||
protected Player targetPlayer;
|
||||
|
||||
private final ScoreboardEventReason scoreboardEventReason;
|
||||
/** GETTER & SETTER BOILERPLATE **/
|
||||
|
||||
public McMMOScoreboardEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason)
|
||||
{
|
||||
public McMMOScoreboardEvent(Scoreboard targetBoard, Scoreboard currentBoard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
|
||||
this.scoreboardEventReason = scoreboardEventReason;
|
||||
this.targetBoard = targetBoard;
|
||||
this.currentBoard = currentBoard;
|
||||
this.targetPlayer = targetPlayer;
|
||||
}
|
||||
|
||||
/** GETTER & SETTER BOILERPLATE **/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the scoreboard the player will be assigned to after this event
|
||||
*
|
||||
* @return the target board to assign the player after this event fires
|
||||
*/
|
||||
public Scoreboard getTargetBoard() {
|
||||
@@ -37,6 +44,7 @@ abstract public class McMMOScoreboardEvent extends Event {
|
||||
|
||||
/**
|
||||
* Change the scoreboard that the player will be assigned to after this event fires
|
||||
*
|
||||
* @param targetBoard the new board to assign the player to
|
||||
*/
|
||||
public void setTargetBoard(Scoreboard targetBoard) {
|
||||
@@ -45,15 +53,26 @@ abstract public class McMMOScoreboardEvent extends Event {
|
||||
|
||||
/**
|
||||
* The player involved in this event (this can be changed)
|
||||
*
|
||||
* @return the player involved in this event
|
||||
*/
|
||||
public Player getTargetPlayer() {
|
||||
return targetPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the target player for this event
|
||||
*
|
||||
* @param targetPlayer the new target for this event
|
||||
*/
|
||||
public void setTargetPlayer(Player targetPlayer) {
|
||||
this.targetPlayer = targetPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the scoreboard the player is currently assigned to at the time the event was fired
|
||||
* Grabbed via player.getScoreboard()
|
||||
*
|
||||
* @return players current scoreboard
|
||||
*/
|
||||
public Scoreboard getCurrentBoard() {
|
||||
@@ -62,29 +81,15 @@ abstract public class McMMOScoreboardEvent extends Event {
|
||||
|
||||
/**
|
||||
* The ENUM defining the reason for this event
|
||||
*
|
||||
* @return the reason for this event
|
||||
*/
|
||||
public ScoreboardEventReason getScoreboardEventReason() {
|
||||
return scoreboardEventReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the target player for this event
|
||||
* @param targetPlayer the new target for this event
|
||||
*/
|
||||
public void setTargetPlayer(Player targetPlayer) {
|
||||
this.targetPlayer = targetPlayer;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -6,10 +6,9 @@ import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
public class McMMOScoreboardObjectiveEvent extends McMMOScoreboardEvent implements Cancellable {
|
||||
protected boolean cancelled;
|
||||
|
||||
protected Objective targetObjective;
|
||||
protected final ScoreboardObjectiveEventReason objectiveEventReason;
|
||||
protected boolean cancelled;
|
||||
protected Objective targetObjective;
|
||||
|
||||
public McMMOScoreboardObjectiveEvent(Objective targetObjective, ScoreboardObjectiveEventReason objectiveEventReason, Scoreboard scoreboard, Scoreboard oldboard, Player targetPlayer, ScoreboardEventReason scoreboardEventReason) {
|
||||
super(scoreboard, oldboard, targetPlayer, scoreboardEventReason);
|
||||
@@ -20,6 +19,7 @@ public class McMMOScoreboardObjectiveEvent extends McMMOScoreboardEvent implemen
|
||||
|
||||
/**
|
||||
* The objective that will be modified by this event
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Objective getTargetObjective() {
|
||||
@@ -28,6 +28,7 @@ public class McMMOScoreboardObjectiveEvent extends McMMOScoreboardEvent implemen
|
||||
|
||||
/**
|
||||
* Change the target objective for this event
|
||||
*
|
||||
* @param newObjective new target objective
|
||||
*/
|
||||
public void setTargetObjective(Objective newObjective) {
|
||||
|
@@ -12,6 +12,10 @@ import org.bukkit.event.HandlerList;
|
||||
* This event is sent for when mcMMO informs a player about various important information
|
||||
*/
|
||||
public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected final NotificationType notificationType;
|
||||
protected ChatMessageType chatMessageType;
|
||||
protected TextComponent notificationTextComponent;
|
||||
private boolean isCancelled;
|
||||
/*
|
||||
* Messages can be sent to both places, as configured in advanced.yml
|
||||
@@ -20,12 +24,6 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
||||
*/
|
||||
private boolean isMessageAlsoBeingSentToChat;
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected ChatMessageType chatMessageType;
|
||||
|
||||
protected TextComponent notificationTextComponent;
|
||||
protected final NotificationType notificationType;
|
||||
|
||||
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, TextComponent notificationTextComponent, ChatMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
|
||||
super(false);
|
||||
this.notificationType = notificationType;
|
||||
@@ -39,6 +37,10 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
||||
* Getters & Setters
|
||||
*/
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public boolean isMessageAlsoBeingSentToChat() {
|
||||
return isMessageAlsoBeingSentToChat;
|
||||
}
|
||||
@@ -63,27 +65,24 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
||||
this.chatMessageType = chatMessageType;
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom Event Boilerplate
|
||||
*/
|
||||
|
||||
/**
|
||||
* The notification type for this event
|
||||
*
|
||||
* @return this event's notification type
|
||||
*/
|
||||
public NotificationType getEventNotificationType() {
|
||||
return notificationType;
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom Event Boilerplate
|
||||
*/
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancellable Interface Boilerplate
|
||||
*/
|
||||
|
@@ -10,6 +10,10 @@ import org.bukkit.event.player.PlayerEvent;
|
||||
* Generic event for mcMMO skill handling.
|
||||
*/
|
||||
public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
||||
/**
|
||||
* Rest of file is required boilerplate for custom events
|
||||
**/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected PrimarySkillType skill;
|
||||
protected int skillLevel;
|
||||
|
||||
@@ -19,6 +23,10 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The skill involved in this event
|
||||
*/
|
||||
@@ -33,15 +41,8 @@ public abstract class McMMOPlayerSkillEvent extends PlayerEvent {
|
||||
return skillLevel;
|
||||
}
|
||||
|
||||
/** Rest of file is required boilerplate for custom events **/
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,9 @@ public class McMMOPlayerRepairCheckEvent extends McMMOPlayerSkillEvent implement
|
||||
return repairedObject;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
|
@@ -44,7 +44,9 @@ public class McMMOPlayerSalvageCheckEvent extends McMMOPlayerSkillEvent implemen
|
||||
return enchantedBook;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
|
@@ -13,7 +13,8 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
|
||||
|
||||
/**
|
||||
* Only skills using the old system will fire this event
|
||||
* @param player target player
|
||||
*
|
||||
* @param player target player
|
||||
* @param subSkillType target subskill
|
||||
* @Deprecated Skills will be using a new system stemming from the AbstractSubSkill class so make sure you check for both events, this event will be removed eventually.
|
||||
*/
|
||||
@@ -23,13 +24,13 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
|
||||
this.subSkillType = subSkillType;
|
||||
}
|
||||
|
||||
public SubSkillEvent(Player player, AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public SubSkillEvent(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
super(player, abstractSubSkill.getPrimarySkill());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SubSkillType involved in the event
|
||||
*
|
||||
* @return the SubSkillType
|
||||
*/
|
||||
public SubSkillType getSubSkillType() {
|
||||
|
@@ -12,8 +12,7 @@ public class SubSkillRandomCheckEvent extends SubSkillEvent {
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
public SubSkillRandomCheckEvent(Player player, AbstractSubSkill abstractSubSkill, double chance)
|
||||
{
|
||||
public SubSkillRandomCheckEvent(Player player, AbstractSubSkill abstractSubSkill, double chance) {
|
||||
super(player, abstractSubSkill);
|
||||
this.chance = chance;
|
||||
}
|
||||
|
@@ -18,7 +18,9 @@ public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Can
|
||||
return defender;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
/**
|
||||
* Following are required for Cancellable
|
||||
**/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
|
Reference in New Issue
Block a user