#421 Clean up events javadoc and interface
- Add proper javadoc to all events - Use proper handling of the Eventlist in all events: each event has its own EventList and its static method, as specified by Bukkit's Event class - Add common supertype to all AuthMe events - Remove unused events - Remove unused methods (setters to fields that we ignore entirely)
This commit is contained in:
parent
c28a6922c0
commit
57da572b23
@ -0,0 +1,90 @@
|
|||||||
|
package fr.xephi.authme.events;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common supertype for all AuthMe teleport events.
|
||||||
|
*/
|
||||||
|
public abstract class AbstractTeleportEvent extends CustomEvent implements Cancellable {
|
||||||
|
|
||||||
|
private final Player player;
|
||||||
|
private final Location from;
|
||||||
|
private Location to;
|
||||||
|
private boolean isCancelled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param isAsync Whether to fire the event asynchronously or not
|
||||||
|
* @param player The player
|
||||||
|
* @param from The location the player is being teleported away from
|
||||||
|
* @param to The teleport destination
|
||||||
|
*/
|
||||||
|
public AbstractTeleportEvent(boolean isAsync, Player player, Location from, Location to) {
|
||||||
|
super(isAsync);
|
||||||
|
this.player = player;
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor, using the player's current location as "from" location.
|
||||||
|
*
|
||||||
|
* @param isAsync Whether to fire the event asynchronously or not
|
||||||
|
* @param player The player
|
||||||
|
* @param to The teleport destination
|
||||||
|
*/
|
||||||
|
public AbstractTeleportEvent(boolean isAsync, Player player, Location to) {
|
||||||
|
this(isAsync, player, player.getLocation(), to);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the player planned to be teleported.
|
||||||
|
*
|
||||||
|
* @return The player
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the location the player is being teleported away from.
|
||||||
|
*
|
||||||
|
* @return The location prior to the teleport
|
||||||
|
*/
|
||||||
|
public Location getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the destination of the teleport.
|
||||||
|
*
|
||||||
|
* @param to The location to teleport the player to
|
||||||
|
*/
|
||||||
|
public void setTo(Location to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the destination the player is being teleported to.
|
||||||
|
*
|
||||||
|
* @return The teleport destination
|
||||||
|
*/
|
||||||
|
public Location getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean isCancelled) {
|
||||||
|
this.isCancelled = isCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return isCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -5,21 +5,19 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is call when a player try to /login
|
* This event is called when a player uses the /login command with correct credentials.
|
||||||
*
|
* {@link #setCanLogin(boolean) {@code event.setCanLogin(false)}} prevents the player from logging in.
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class AuthMeAsyncPreLoginEvent extends Event {
|
public class AuthMeAsyncPreLoginEvent extends CustomEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private boolean canLogin = true;
|
private boolean canLogin = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for AuthMeAsyncPreLoginEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
*/
|
*/
|
||||||
public AuthMeAsyncPreLoginEvent(Player player) {
|
public AuthMeAsyncPreLoginEvent(Player player) {
|
||||||
super(true);
|
super(true);
|
||||||
@ -27,37 +25,41 @@ public class AuthMeAsyncPreLoginEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getPlayer.
|
* Return the player concerned by this event.
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return The player who executed a valid {@code /login} command
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method canLogin.
|
* Return whether the player is allowed to log in.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return True if the player can log in, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean canLogin() {
|
public boolean canLogin() {
|
||||||
return canLogin;
|
return canLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method setCanLogin.
|
* Define whether or not the player may log in.
|
||||||
*
|
*
|
||||||
* @param canLogin boolean
|
* @param canLogin True to allow the player to log in; false to prevent him
|
||||||
*/
|
*/
|
||||||
public void setCanLogin(boolean canLogin) {
|
public void setCanLogin(boolean canLogin) {
|
||||||
this.canLogin = canLogin;
|
this.canLogin = canLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getHandlers.
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
*
|
*
|
||||||
* @return HandlerList
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
|||||||
@ -2,65 +2,38 @@ package fr.xephi.authme.events;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is call when AuthMe try to teleport a player
|
* This event is fired before AuthMe teleports a player for general purposes.
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class AuthMeTeleportEvent extends CustomEvent {
|
public class AuthMeTeleportEvent extends AbstractTeleportEvent {
|
||||||
|
|
||||||
private final Player player;
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Location to;
|
|
||||||
private final Location from;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for AuthMeTeleportEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
* @param to Location
|
* @param to The teleport destination
|
||||||
*/
|
*/
|
||||||
public AuthMeTeleportEvent(Player player, Location to) {
|
public AuthMeTeleportEvent(Player player, Location to) {
|
||||||
this.player = player;
|
super(false, player, to);
|
||||||
this.from = player.getLocation();
|
|
||||||
this.to = to;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getPlayer.
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public static HandlerList getHandlerList() {
|
||||||
return player;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Method getTo.
|
public HandlerList getHandlers() {
|
||||||
*
|
return handlers;
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setTo.
|
|
||||||
*
|
|
||||||
* @param to Location
|
|
||||||
*/
|
|
||||||
public void setTo(Location to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getFrom.
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getFrom() {
|
|
||||||
return from;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +1,27 @@
|
|||||||
package fr.xephi.authme.events;
|
package fr.xephi.authme.events;
|
||||||
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Xephi59
|
* The parent of all AuthMe events.
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class CustomEvent extends Event implements Cancellable {
|
public abstract class CustomEvent extends Event {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private boolean isCancelled;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
public CustomEvent() {
|
public CustomEvent() {
|
||||||
super(false);
|
super(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CustomEvent.
|
* Constructor, specifying whether the event is asynchronous or not.
|
||||||
*
|
*
|
||||||
* @param b boolean
|
* @param isAsync {@code true} to fire the event asynchronously, false otherwise
|
||||||
|
* @see Event#Event(boolean)
|
||||||
*/
|
*/
|
||||||
public CustomEvent(boolean b) {
|
public CustomEvent(boolean isAsync) {
|
||||||
super(b);
|
super(isAsync);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getHandlerList.
|
|
||||||
*
|
|
||||||
* @return HandlerList
|
|
||||||
*/
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getHandlers.
|
|
||||||
*
|
|
||||||
* @return HandlerList
|
|
||||||
*/
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method isCancelled.
|
|
||||||
*
|
|
||||||
* @return boolean * @see org.bukkit.event.Cancellable#isCancelled()
|
|
||||||
*/
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.isCancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setCancelled.
|
|
||||||
*
|
|
||||||
* @param cancelled boolean
|
|
||||||
*
|
|
||||||
* @see org.bukkit.event.Cancellable#setCancelled(boolean)
|
|
||||||
*/
|
|
||||||
public void setCancelled(boolean cancelled) {
|
|
||||||
this.isCancelled = cancelled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,67 +2,40 @@ package fr.xephi.authme.events;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called if a player is teleported to the authme first spawn
|
* Event that is called if a player is teleported to the AuthMe first spawn, i.e. to the
|
||||||
*
|
* spawn location for players who have never played before.
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class FirstSpawnTeleportEvent extends CustomEvent {
|
public class FirstSpawnTeleportEvent extends AbstractTeleportEvent {
|
||||||
|
|
||||||
private final Player player;
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Location to;
|
|
||||||
private final Location from;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for FirstSpawnTeleportEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
* @param from Location
|
* @param from The location the player is being teleported away from
|
||||||
* @param to Location
|
* @param to The teleport destination
|
||||||
*/
|
*/
|
||||||
public FirstSpawnTeleportEvent(Player player, Location from, Location to) {
|
public FirstSpawnTeleportEvent(Player player, Location from, Location to) {
|
||||||
super(true);
|
super(true, player, from, to);
|
||||||
this.player = player;
|
|
||||||
this.from = from;
|
|
||||||
this.to = to;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getPlayer.
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public static HandlerList getHandlerList() {
|
||||||
return player;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Method getTo.
|
public HandlerList getHandlers() {
|
||||||
*
|
return handlers;
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setTo.
|
|
||||||
*
|
|
||||||
* @param to Location
|
|
||||||
*/
|
|
||||||
public void setTo(Location to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getFrom.
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getFrom() {
|
|
||||||
return from;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,80 +5,40 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called when a player login or register through AuthMe. The
|
* Event fired when a player has successfully logged in or registered.
|
||||||
* boolean 'isLogin' will be false if, and only if, login/register failed.
|
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class LoginEvent extends Event {
|
public class LoginEvent extends CustomEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Player player;
|
private final Player player;
|
||||||
private boolean isLogin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LoginEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
* @param isLogin boolean
|
|
||||||
*/
|
*/
|
||||||
public LoginEvent(Player player, boolean isLogin) {
|
public LoginEvent(Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.isLogin = isLogin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getHandlerList.
|
* Return the player that has successfully logged in or registered.
|
||||||
*
|
*
|
||||||
* @return HandlerList
|
* @return The player
|
||||||
|
*/
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
|
*
|
||||||
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getPlayer.
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return this.player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setPlayer.
|
|
||||||
*
|
|
||||||
* @param player Player
|
|
||||||
*/
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method isLogin.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean isLogin() {
|
|
||||||
return isLogin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setLogin.
|
|
||||||
*
|
|
||||||
* @param isLogin boolean
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setLogin(boolean isLogin) {
|
|
||||||
this.isLogin = isLogin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getHandlers.
|
|
||||||
*
|
|
||||||
* @return HandlerList
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
|||||||
@ -5,57 +5,42 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called when a player logout through AuthMe.
|
* This event is called when a player logs out through AuthMe, i.e. only when the player
|
||||||
*
|
* has executed the {@code /logout} command. This event is not fired if a player simply
|
||||||
* @author Xephi59
|
* leaves the server.
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class LogoutEvent extends Event {
|
public class LogoutEvent extends CustomEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Player player;
|
private final Player player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LogoutEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
*/
|
*/
|
||||||
public LogoutEvent(Player player) {
|
public LogoutEvent(Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getHandlerList.
|
* Return the player who logged out.
|
||||||
*
|
*
|
||||||
* @return HandlerList
|
* @return The player
|
||||||
*/
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getPlayer.
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method setPlayer.
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
public void setPlayer(Player player) {
|
public static HandlerList getHandlerList() {
|
||||||
this.player = player;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getHandlers.
|
|
||||||
*
|
|
||||||
* @return HandlerList
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
|||||||
@ -5,24 +5,33 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is called when we need to compare or hash password and allows
|
* This event is called when we need to compare or hash a password for a player and allows
|
||||||
* third-party listeners to change the encryption method. This is typically
|
* third-party listeners to change the encryption method. This is typically
|
||||||
* done with the {@link fr.xephi.authme.security.HashAlgorithm#CUSTOM} setting.
|
* done with the {@link fr.xephi.authme.security.HashAlgorithm#CUSTOM} setting.
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
*/
|
*/
|
||||||
public class PasswordEncryptionEvent extends Event {
|
public class PasswordEncryptionEvent extends CustomEvent {
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private EncryptionMethod method;
|
private EncryptionMethod method;
|
||||||
private String playerName;
|
private String playerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param method The method used to encrypt the password
|
||||||
|
* @param playerName The name of the player
|
||||||
|
*/
|
||||||
public PasswordEncryptionEvent(EncryptionMethod method, String playerName) {
|
public PasswordEncryptionEvent(EncryptionMethod method, String playerName) {
|
||||||
super(false);
|
super(false);
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
|
*
|
||||||
|
* @return The list of handlers
|
||||||
|
*/
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
@ -32,14 +41,29 @@ public class PasswordEncryptionEvent extends Event {
|
|||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the encryption method used to hash the password.
|
||||||
|
*
|
||||||
|
* @return The encryption method
|
||||||
|
*/
|
||||||
public EncryptionMethod getMethod() {
|
public EncryptionMethod getMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the encryption method to hash the password with.
|
||||||
|
*
|
||||||
|
* @param method The encryption method to use
|
||||||
|
*/
|
||||||
public void setMethod(EncryptionMethod method) {
|
public void setMethod(EncryptionMethod method) {
|
||||||
this.method = method;
|
this.method = method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the player the event has been fired for.
|
||||||
|
*
|
||||||
|
* @return The player name
|
||||||
|
*/
|
||||||
public String getPlayerName() {
|
public String getPlayerName() {
|
||||||
return playerName;
|
return playerName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,98 +1,84 @@
|
|||||||
package fr.xephi.authme.events;
|
package fr.xephi.authme.events;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is call just after store inventory into cache and will empty the
|
* This event is called before the inventory data of a player is suppressed,
|
||||||
* player inventory.
|
* i.e. the inventory of the player is not displayed until he has authenticated.
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class ProtectInventoryEvent extends CustomEvent {
|
public class ProtectInventoryEvent extends CustomEvent implements Cancellable {
|
||||||
|
|
||||||
private final ItemStack[] storedinventory;
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final ItemStack[] storedarmor;
|
private final ItemStack[] storedInventory;
|
||||||
private ItemStack[] emptyInventory = null;
|
private final ItemStack[] storedArmor;
|
||||||
private ItemStack[] emptyArmor = null;
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
private boolean isCancelled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ProtectInventoryEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
*/
|
*/
|
||||||
public ProtectInventoryEvent(Player player) {
|
public ProtectInventoryEvent(Player player) {
|
||||||
super(true);
|
super(true);
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.storedinventory = player.getInventory().getContents();
|
this.storedInventory = player.getInventory().getContents();
|
||||||
this.storedarmor = player.getInventory().getArmorContents();
|
this.storedArmor = player.getInventory().getArmorContents();
|
||||||
this.emptyInventory = new ItemStack[36];
|
|
||||||
this.emptyArmor = new ItemStack[4];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getStoredInventory.
|
* Return the inventory of the player.
|
||||||
*
|
*
|
||||||
* @return ItemStack[]
|
* @return The player's inventory
|
||||||
*/
|
*/
|
||||||
public ItemStack[] getStoredInventory() {
|
public ItemStack[] getStoredInventory() {
|
||||||
return this.storedinventory;
|
return storedInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getStoredArmor.
|
* Return the armor of the player.
|
||||||
*
|
*
|
||||||
* @return ItemStack[]
|
* @return The player's armor
|
||||||
*/
|
*/
|
||||||
public ItemStack[] getStoredArmor() {
|
public ItemStack[] getStoredArmor() {
|
||||||
return this.storedarmor;
|
return storedArmor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getPlayer.
|
* Return the player whose inventory will be hidden.
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return The player associated with this event
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.player;
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean isCancelled) {
|
||||||
|
this.isCancelled = isCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return isCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method setNewInventory.
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
*
|
*
|
||||||
* @param emptyInventory ItemStack[]
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
public void setNewInventory(ItemStack[] emptyInventory) {
|
public static HandlerList getHandlerList() {
|
||||||
this.emptyInventory = emptyInventory;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Method getEmptyInventory.
|
public HandlerList getHandlers() {
|
||||||
*
|
return handlers;
|
||||||
* @return ItemStack[]
|
|
||||||
*/
|
|
||||||
public ItemStack[] getEmptyInventory() {
|
|
||||||
return this.emptyInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setNewArmor.
|
|
||||||
*
|
|
||||||
* @param emptyArmor ItemStack[]
|
|
||||||
*/
|
|
||||||
public void setNewArmor(ItemStack[] emptyArmor) {
|
|
||||||
this.emptyArmor = emptyArmor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getEmptyArmor.
|
|
||||||
*
|
|
||||||
* @return ItemStack[]
|
|
||||||
*/
|
|
||||||
public ItemStack[] getEmptyArmor() {
|
|
||||||
return this.emptyArmor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
package fr.xephi.authme.events;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This event is call if, and only if, a player is teleported just after a
|
|
||||||
* register.
|
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
|
||||||
public class RegisterTeleportEvent extends CustomEvent {
|
|
||||||
|
|
||||||
private final Player player;
|
|
||||||
private Location to;
|
|
||||||
private final Location from;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for RegisterTeleportEvent.
|
|
||||||
*
|
|
||||||
* @param player Player
|
|
||||||
* @param to Location
|
|
||||||
*/
|
|
||||||
public RegisterTeleportEvent(Player player, Location to) {
|
|
||||||
this.player = player;
|
|
||||||
this.from = player.getLocation();
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getPlayer.
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getTo.
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setTo.
|
|
||||||
*
|
|
||||||
* @param to Location
|
|
||||||
*/
|
|
||||||
public void setTo(Location to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getFrom.
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getFrom() {
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
package fr.xephi.authme.events;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This event is call when a creative inventory is reseted.
|
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
|
||||||
public class ResetInventoryEvent extends CustomEvent {
|
|
||||||
|
|
||||||
private Player player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for ResetInventoryEvent.
|
|
||||||
*
|
|
||||||
* @param player Player
|
|
||||||
*/
|
|
||||||
public ResetInventoryEvent(Player player) {
|
|
||||||
super(true);
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getPlayer.
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return this.player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setPlayer.
|
|
||||||
*
|
|
||||||
* @param player Player
|
|
||||||
*/
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,52 +1,60 @@
|
|||||||
package fr.xephi.authme.events;
|
package fr.xephi.authme.events;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event restore the inventory.
|
* This event is fired when the inventory of a player is restored
|
||||||
*
|
* (the inventory data is no longer hidden from the user).
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class RestoreInventoryEvent extends CustomEvent {
|
public class RestoreInventoryEvent extends CustomEvent implements Cancellable {
|
||||||
|
|
||||||
private Player player;
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private final Player player;
|
||||||
|
private boolean isCancelled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for RestoreInventoryEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
*/
|
*/
|
||||||
public RestoreInventoryEvent(Player player) {
|
public RestoreInventoryEvent(Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for RestoreInventoryEvent.
|
* Return the player whose inventory will be restored.
|
||||||
*
|
|
||||||
* @param player Player
|
|
||||||
* @param async boolean
|
|
||||||
*/
|
|
||||||
public RestoreInventoryEvent(Player player, boolean async) {
|
|
||||||
super(async);
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getPlayer.
|
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return Player
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.player;
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return isCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean isCancelled) {
|
||||||
|
this.isCancelled = isCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method setPlayer.
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @return The list of handlers
|
||||||
*/
|
*/
|
||||||
public void setPlayer(Player player) {
|
public static HandlerList getHandlerList() {
|
||||||
this.player = player;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,79 +2,51 @@ package fr.xephi.authme.events;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called if a player is teleported to a specific spawn
|
* Called if a player is teleported to a specific spawn upon joining or logging in.
|
||||||
*
|
|
||||||
* @author Xephi59
|
|
||||||
* @version $Revision: 1.0 $
|
|
||||||
*/
|
*/
|
||||||
public class SpawnTeleportEvent extends CustomEvent {
|
public class SpawnTeleportEvent extends AbstractTeleportEvent {
|
||||||
|
|
||||||
private final Player player;
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Location to;
|
|
||||||
private final Location from;
|
|
||||||
private final boolean isAuthenticated;
|
private final boolean isAuthenticated;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SpawnTeleportEvent.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param player Player
|
* @param player The player
|
||||||
* @param from Location
|
* @param from The location the player is being teleported away from
|
||||||
* @param to Location
|
* @param to The teleport destination
|
||||||
* @param isAuthenticated boolean
|
* @param isAuthenticated Whether or not the player is logged in
|
||||||
*/
|
*/
|
||||||
public SpawnTeleportEvent(Player player, Location from, Location to,
|
public SpawnTeleportEvent(Player player, Location from, Location to, boolean isAuthenticated) {
|
||||||
boolean isAuthenticated) {
|
super(false, player, from, to);
|
||||||
this.player = player;
|
|
||||||
this.from = from;
|
|
||||||
this.to = to;
|
|
||||||
this.isAuthenticated = isAuthenticated;
|
this.isAuthenticated = isAuthenticated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method getPlayer.
|
* Return whether or not the player is authenticated.
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return true if the player is logged in, false otherwise
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getTo.
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method setTo.
|
|
||||||
*
|
|
||||||
* @param to Location
|
|
||||||
*/
|
|
||||||
public void setTo(Location to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getFrom.
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getFrom() {
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method isAuthenticated.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public boolean isAuthenticated() {
|
public boolean isAuthenticated() {
|
||||||
return isAuthenticated;
|
return isAuthenticated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of handlers, equivalent to {@link #getHandlers()} and required by {@link Event}.
|
||||||
|
*
|
||||||
|
* @return The list of handlers
|
||||||
|
*/
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,8 +28,7 @@ import fr.xephi.authme.util.Utils.GroupType;
|
|||||||
|
|
||||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
|
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class ProcessSyncPlayerLogin implements Runnable {
|
public class ProcessSyncPlayerLogin implements Runnable {
|
||||||
|
|
||||||
private final LimboPlayer limbo;
|
private final LimboPlayer limbo;
|
||||||
@ -63,24 +62,19 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method getLimbo.
|
|
||||||
*
|
|
||||||
* @return LimboPlayer
|
|
||||||
*/
|
|
||||||
public LimboPlayer getLimbo() {
|
public LimboPlayer getLimbo() {
|
||||||
return limbo;
|
return limbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreOpState() {
|
private void restoreOpState() {
|
||||||
player.setOp(limbo.getOperator());
|
player.setOp(limbo.getOperator());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void packQuitLocation() {
|
private void packQuitLocation() {
|
||||||
Utils.packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player);
|
Utils.packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void teleportBackFromSpawn() {
|
private void teleportBackFromSpawn() {
|
||||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc());
|
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc());
|
||||||
pm.callEvent(tpEvent);
|
pm.callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled() && tpEvent.getTo() != null) {
|
if (!tpEvent.isCancelled() && tpEvent.getTo() != null) {
|
||||||
@ -88,7 +82,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void teleportToSpawn() {
|
private void teleportToSpawn() {
|
||||||
Location spawnL = plugin.getSpawnLocation(player);
|
Location spawnL = plugin.getSpawnLocation(player);
|
||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true);
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true);
|
||||||
pm.callEvent(tpEvent);
|
pm.callEvent(tpEvent);
|
||||||
@ -97,14 +91,14 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreSpeedEffects() {
|
private void restoreSpeedEffects() {
|
||||||
if (Settings.isRemoveSpeedEnabled) {
|
if (Settings.isRemoveSpeedEnabled) {
|
||||||
player.setWalkSpeed(0.2F);
|
player.setWalkSpeed(0.2F);
|
||||||
player.setFlySpeed(0.1F);
|
player.setFlySpeed(0.1F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreInventory() {
|
private void restoreInventory() {
|
||||||
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
|
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
|
||||||
pm.callEvent(event);
|
pm.callEvent(event);
|
||||||
if (!event.isCancelled() && plugin.inventoryProtector != null) {
|
if (!event.isCancelled() && plugin.inventoryProtector != null) {
|
||||||
@ -112,7 +106,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void forceCommands() {
|
private void forceCommands() {
|
||||||
for (String command : Settings.forceCommands) {
|
for (String command : Settings.forceCommands) {
|
||||||
player.performCommand(command.replace("%p", player.getName()));
|
player.performCommand(command.replace("%p", player.getName()));
|
||||||
}
|
}
|
||||||
@ -121,7 +115,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendBungeeMessage() {
|
private void sendBungeeMessage() {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF("Forward");
|
out.writeUTF("Forward");
|
||||||
out.writeUTF("ALL");
|
out.writeUTF("ALL");
|
||||||
@ -130,11 +124,6 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method run.
|
|
||||||
*
|
|
||||||
* @see java.lang.Runnable#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Limbo contains the State of the Player before /login
|
// Limbo contains the State of the Player before /login
|
||||||
@ -175,8 +164,9 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
if (jm != null) {
|
if (jm != null) {
|
||||||
if (!jm.isEmpty()) {
|
if (!jm.isEmpty()) {
|
||||||
for (Player p : Utils.getOnlinePlayers()) {
|
for (Player p : Utils.getOnlinePlayers()) {
|
||||||
if (p.isOnline())
|
if (p.isOnline()) {
|
||||||
p.sendMessage(jm);
|
p.sendMessage(jm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AuthMePlayerListener.joinMessage.remove(name);
|
AuthMePlayerListener.joinMessage.remove(name);
|
||||||
@ -188,12 +178,13 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The Login event now fires (as intended) after everything is processed
|
// The Login event now fires (as intended) after everything is processed
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player));
|
||||||
player.saveData();
|
player.saveData();
|
||||||
if (Settings.bungee)
|
if (Settings.bungee) {
|
||||||
sendBungeeMessage();
|
sendBungeeMessage();
|
||||||
|
}
|
||||||
// Login is finish, display welcome message if we use email registration
|
// Login is finish, display welcome message if we use email registration
|
||||||
if (Settings.useWelcomeMessage && Settings.emailRegistration)
|
if (Settings.useWelcomeMessage && Settings.emailRegistration) {
|
||||||
if (Settings.broadcastWelcomeMessage) {
|
if (Settings.broadcastWelcomeMessage) {
|
||||||
for (String s : settings.getWelcomeMessage()) {
|
for (String s : settings.getWelcomeMessage()) {
|
||||||
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
|
Bukkit.getServer().broadcastMessage(plugin.replaceAllInfo(s, player));
|
||||||
@ -203,6 +194,7 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
player.sendMessage(plugin.replaceAllInfo(s, player));
|
player.sendMessage(plugin.replaceAllInfo(s, player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Login is now finished; we can force all commands
|
// Login is now finished; we can force all commands
|
||||||
forceCommands();
|
forceCommands();
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class ProcessSyncPasswordRegister implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The LoginEvent now fires (as intended) after everything is processed
|
// The LoginEvent now fires (as intended) after everything is processed
|
||||||
plugin.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
plugin.getServer().getPluginManager().callEvent(new LoginEvent(player));
|
||||||
player.saveData();
|
player.saveData();
|
||||||
|
|
||||||
if (!Settings.noConsoleSpam) {
|
if (!Settings.noConsoleSpam) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user