From 3298183fdfeefe3e02b7812fdcce0153da0f99b6 Mon Sep 17 00:00:00 2001 From: drtshock Date: Wed, 9 Jul 2014 14:01:53 -0500 Subject: [PATCH] Add missing javadocs. --- .../massivecraft/factions/cmd/CmdKick.java | 2 +- .../factions/event/FPlayerJoinEvent.java | 10 ++++-- .../factions/event/FPlayerLeaveEvent.java | 9 +++-- .../factions/event/FactionCreateEvent.java | 5 ++- .../factions/event/FactionDisbandEvent.java | 6 ++-- .../factions/event/FactionEvent.java | 11 +++++- .../factions/event/FactionPlayerEvent.java | 3 ++ .../factions/event/FactionRelationEvent.java | 4 ++- .../factions/event/FactionRenameEvent.java | 22 ++++++++++-- .../factions/event/LandClaimEvent.java | 31 ++++++++++++++-- .../factions/event/LandUnclaimAllEvent.java | 23 ++++++++++-- .../factions/event/LandUnclaimEvent.java | 26 ++++++++++++-- .../factions/event/PowerLossEvent.java | 36 +++++++++++++++++-- .../listeners/FactionsEntityListener.java | 1 - 14 files changed, 165 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java index d88d3e82..590cea46 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -44,7 +44,7 @@ public class CmdKick extends FCommand { Faction toKickFaction = toKick.getFaction(); // The PlayerEntityCollection only holds online players, this was a specific issue that kept happening. - if(toKickFaction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) { + if (toKickFaction.getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) { sender.sendMessage("Something went wrong with getting the offline player's faction."); return; } diff --git a/src/main/java/com/massivecraft/factions/event/FPlayerJoinEvent.java b/src/main/java/com/massivecraft/factions/event/FPlayerJoinEvent.java index 28376823..ce3148ac 100644 --- a/src/main/java/com/massivecraft/factions/event/FPlayerJoinEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FPlayerJoinEvent.java @@ -3,9 +3,10 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; +/** + * Event called when an FPlayer joins a Faction. + */ public class FPlayerJoinEvent extends FactionPlayerEvent implements Cancellable { PlayerJoinReason reason; @@ -20,6 +21,11 @@ public class FPlayerJoinEvent extends FactionPlayerEvent implements Cancellable reason = r; } + /** + * Get the reason the player joined the faction. + * + * @return reason player joined the faction. + */ public PlayerJoinReason getReason() { return reason; } diff --git a/src/main/java/com/massivecraft/factions/event/FPlayerLeaveEvent.java b/src/main/java/com/massivecraft/factions/event/FPlayerLeaveEvent.java index 6ff0c195..73afb5e4 100644 --- a/src/main/java/com/massivecraft/factions/event/FPlayerLeaveEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FPlayerLeaveEvent.java @@ -3,8 +3,6 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; public class FPlayerLeaveEvent extends FactionPlayerEvent implements Cancellable { @@ -20,6 +18,11 @@ public class FPlayerLeaveEvent extends FactionPlayerEvent implements Cancellable reason = r; } + /** + * Get the reason the player left the faction. + * + * @return reason player left the faction. + */ public PlayerLeaveReason getReason() { return reason; } @@ -34,7 +37,7 @@ public class FPlayerLeaveEvent extends FactionPlayerEvent implements Cancellable if (reason == PlayerLeaveReason.DISBAND || reason == PlayerLeaveReason.RESET) { cancelled = false; // Don't let them cancel factions disbanding. } else { - cancelled = c; + cancelled = c; } } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java b/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java index 671b3b9d..ac7188ec 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java @@ -8,8 +8,11 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +/** + * Event called when a Faction is created. + */ public class FactionCreateEvent extends Event implements Cancellable { - + private static final HandlerList handlers = new HandlerList(); private String factionTag; diff --git a/src/main/java/com/massivecraft/factions/event/FactionDisbandEvent.java b/src/main/java/com/massivecraft/factions/event/FactionDisbandEvent.java index eef61556..4abdd90d 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionDisbandEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionDisbandEvent.java @@ -2,13 +2,13 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; +/** + * Event called when a faction is disbanded. + */ public class FactionDisbandEvent extends FactionEvent implements Cancellable { private boolean cancelled = false; diff --git a/src/main/java/com/massivecraft/factions/event/FactionEvent.java b/src/main/java/com/massivecraft/factions/event/FactionEvent.java index a9037edc..53c87fd8 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionEvent.java @@ -4,6 +4,9 @@ import com.massivecraft.factions.Faction; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +/** + * Represents an event involving a Faction. + */ public class FactionEvent extends Event { private static final HandlerList handlers = new HandlerList(); @@ -13,13 +16,19 @@ public class FactionEvent extends Event { this.faction = faction; } + /** + * Get the Faction involved in the event. + * + * @return faction involved in the event. + */ public Faction getFaction() { - return this.getFaction(); + return this.faction; } public HandlerList getHandlers() { return handlers; } + public static HandlerList getHandlerList() { return handlers; } diff --git a/src/main/java/com/massivecraft/factions/event/FactionPlayerEvent.java b/src/main/java/com/massivecraft/factions/event/FactionPlayerEvent.java index da59473d..8a2552db 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionPlayerEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionPlayerEvent.java @@ -3,6 +3,9 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; +/** + * Represents an event involving a Faction and a FPlayer. + */ public class FactionPlayerEvent extends FactionEvent { private final FPlayer fPlayer; diff --git a/src/main/java/com/massivecraft/factions/event/FactionRelationEvent.java b/src/main/java/com/massivecraft/factions/event/FactionRelationEvent.java index 601525a5..a9b6a2f5 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionRelationEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionRelationEvent.java @@ -5,7 +5,9 @@ import com.massivecraft.factions.struct.Relation; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; - +/** + * Event called when a Faction relation is called. + */ public class FactionRelationEvent extends Event { private static final HandlerList handlers = new HandlerList(); diff --git a/src/main/java/com/massivecraft/factions/event/FactionRenameEvent.java b/src/main/java/com/massivecraft/factions/event/FactionRenameEvent.java index 146de1d0..702f9b06 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionRenameEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionRenameEvent.java @@ -1,11 +1,8 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; -import com.massivecraft.factions.Faction; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; public class FactionRenameEvent extends FactionPlayerEvent implements Cancellable { @@ -17,16 +14,35 @@ public class FactionRenameEvent extends FactionPlayerEvent implements Cancellabl tag = newTag; } + /** + * Get the player involved in the event. + * + * @return Player involved in the event. + * + * @deprecated use getfPlayer().getPlayer() instead. + */ @Deprecated public Player getPlayer() { return getfPlayer().getPlayer(); } + /** + * Get the faction tag before it was renamed. + * + * @return old faction tag. + * + * @deprecated use getFaction().getTag() instead. + */ @Deprecated public String getOldFactionTag() { return getFaction().getTag(); } + /** + * Get the new faction tag. + * + * @return new faction tag as String. + */ public String getFactionTag() { return tag; } diff --git a/src/main/java/com/massivecraft/factions/event/LandClaimEvent.java b/src/main/java/com/massivecraft/factions/event/LandClaimEvent.java index 133cf10b..a41a5eb9 100644 --- a/src/main/java/com/massivecraft/factions/event/LandClaimEvent.java +++ b/src/main/java/com/massivecraft/factions/event/LandClaimEvent.java @@ -5,9 +5,10 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; +/** + * Event called when an FPlayer claims land for a Faction. + */ public class LandClaimEvent extends FactionPlayerEvent implements Cancellable { private boolean cancelled; @@ -19,20 +20,46 @@ public class LandClaimEvent extends FactionPlayerEvent implements Cancellable { location = loc; } + /** + * Get the FLocation involved in this event. + * + * @return the FLocation (also a chunk) involved in this event. + */ public FLocation getLocation() { return this.location; } + /** + * Get the id of the faction. + * + * @return id of faction as String + * + * @deprecated use getFaction().getId() instead. + */ @Deprecated public String getFactionId() { return getFaction().getId(); } + /** + * Get the tag of the faction. + * + * @return tag of faction as String + * + * @deprecated use getFaction().getTag() instead. + */ @Deprecated public String getFactionTag() { return getFaction().getTag(); } + /** + * Get the Player involved in this event. + * + * @return player from FPlayer. + * + * @deprecated use getfPlayer().getPlayer() instead. + */ @Deprecated public Player getPlayer() { return getfPlayer().getPlayer(); diff --git a/src/main/java/com/massivecraft/factions/event/LandUnclaimAllEvent.java b/src/main/java/com/massivecraft/factions/event/LandUnclaimAllEvent.java index 6d1264bf..bb82196a 100644 --- a/src/main/java/com/massivecraft/factions/event/LandUnclaimAllEvent.java +++ b/src/main/java/com/massivecraft/factions/event/LandUnclaimAllEvent.java @@ -3,8 +3,6 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; public class LandUnclaimAllEvent extends FactionPlayerEvent { @@ -12,16 +10,37 @@ public class LandUnclaimAllEvent extends FactionPlayerEvent { super(f, p); } + /** + * Get the id of the faction. + * + * @return id of faction as String + * + * @deprecated use getFaction().getId() instead. + */ @Deprecated public String getFactionId() { return getFaction().getId(); } + /** + * Get the tag of the faction. + * + * @return tag of faction as String + * + * @deprecated use getFaction().getTag() instead. + */ @Deprecated public String getFactionTag() { return getFaction().getTag(); } + /** + * Get the Player involved in the event. + * + * @return Player from FPlayer. + * + * @deprecated use getfPlayer().getPlayer() instead. + */ @Deprecated public Player getPlayer() { return getfPlayer().getPlayer(); diff --git a/src/main/java/com/massivecraft/factions/event/LandUnclaimEvent.java b/src/main/java/com/massivecraft/factions/event/LandUnclaimEvent.java index 1c5f77c7..c7321ebe 100644 --- a/src/main/java/com/massivecraft/factions/event/LandUnclaimEvent.java +++ b/src/main/java/com/massivecraft/factions/event/LandUnclaimEvent.java @@ -5,9 +5,10 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; +/** + * Event called when an FPlayer unclaims land for a Faction. + */ public class LandUnclaimEvent extends FactionPlayerEvent implements Cancellable { private boolean cancelled; @@ -23,16 +24,37 @@ public class LandUnclaimEvent extends FactionPlayerEvent implements Cancellable return this.location; } + /** + * Get the id of the faction. + * + * @return id of faction as String + * + * @deprecated use getFaction().getId() instead. + */ @Deprecated public String getFactionId() { return getFaction().getId(); } + /** + * Get the tag of the faction. + * + * @return tag of faction as String + * + * @deprecated use getFaction().getTag() instead. + */ @Deprecated public String getFactionTag() { return getFaction().getTag(); } + /** + * Get the Player involved in the event. + * + * @return Player from FPlayer. + * + * @deprecated use getfPlayer().getPlayer() instead. + */ @Deprecated public Player getPlayer() { return getfPlayer().getPlayer(); diff --git a/src/main/java/com/massivecraft/factions/event/PowerLossEvent.java b/src/main/java/com/massivecraft/factions/event/PowerLossEvent.java index 0f28cda1..681ba619 100644 --- a/src/main/java/com/massivecraft/factions/event/PowerLossEvent.java +++ b/src/main/java/com/massivecraft/factions/event/PowerLossEvent.java @@ -4,9 +4,10 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; +/** + * Event called when a player loses power. + */ public class PowerLossEvent extends FactionPlayerEvent implements Cancellable { private boolean cancelled = false; @@ -16,25 +17,56 @@ public class PowerLossEvent extends FactionPlayerEvent implements Cancellable { super(f, p); } + /** + * Get the id of the faction. + * + * @return id of faction as String + * + * @deprecated use getFaction().getId() instead. + */ @Deprecated public String getFactionId() { return getFaction().getId(); } + /** + * Get the tag of the faction. + * + * @return tag of faction as String + * + * @deprecated use getFaction().getTag() instead. + */ @Deprecated public String getFactionTag() { return getFaction().getTag(); } + /** + * Get the Player involved in the event. + * + * @return Player from FPlayer. + * + * @deprecated use getfPlayer().getPlayer() instead. + */ @Deprecated public Player getPlayer() { return getfPlayer().getPlayer(); } + /** + * Get the power loss message. + * + * @return power loss message as String. + */ public String getMessage() { return message; } + /** + * Set the power loss message. + * + * @param message + */ public void setMessage(String message) { this.message = message; } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index c36e4176..1e3f4b6e 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -21,7 +21,6 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; -import java.text.MessageFormat; import java.util.*;