-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.2.1 - LeaderHeads support, revamped paged gui system, autosave, bu…
…g fixes
- Loading branch information
Showing
32 changed files
with
404 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
duels-api/src/main/java/me/realized/duels/api/event/request/RequestAcceptEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package me.realized.duels.api.event.request; | ||
|
||
import javax.annotation.Nonnull; | ||
import me.realized.duels.api.request.Request; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Cancellable; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* Called when a {@link Player} accepts a {@link Request} from a {@link Player}. | ||
* | ||
* @since 3.2.1 | ||
*/ | ||
public class RequestAcceptEvent extends RequestEvent implements Cancellable { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private boolean cancelled; | ||
|
||
/** | ||
* @param source {@link Player} who is accepting this {@link Request}. | ||
* @param target {@link Player} who sent this {@link Request}. | ||
* @param request {@link Request} that is being handled. | ||
*/ | ||
public RequestAcceptEvent(@Nonnull final Player source, @Nonnull final Player target, @Nonnull final Request request) { | ||
super(source, target, request); | ||
} | ||
|
||
/** | ||
* Whether or not this event has been cancelled. | ||
* | ||
* @return True if this event has been cancelled. False otherwise. | ||
*/ | ||
@Override | ||
public boolean isCancelled() { | ||
return cancelled; | ||
} | ||
|
||
/** | ||
* Whether or not to cancel this event. | ||
* When cancelled, the request will not be removed and remain as unhandled. | ||
* | ||
* @param cancelled True to cancel this event. | ||
*/ | ||
@Override | ||
public void setCancelled(final boolean cancelled) { | ||
this.cancelled = cancelled; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
duels-api/src/main/java/me/realized/duels/api/event/request/RequestDenyEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package me.realized.duels.api.event.request; | ||
|
||
import javax.annotation.Nonnull; | ||
import me.realized.duels.api.request.Request; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* Called when a {@link Player} denies a {@link Request} from a {@link Player}. | ||
* | ||
* @since 3.2.1 | ||
*/ | ||
public class RequestDenyEvent extends RequestEvent { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
/** | ||
* @param source {@link Player} who is denying this {@link Request}. | ||
* @param target {@link Player} who sent this {@link Request}. | ||
* @param request {@link Request} that is being handled. | ||
*/ | ||
public RequestDenyEvent(@Nonnull final Player source, @Nonnull final Player target, @Nonnull final Request request) { | ||
super(source, target, request); | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
duels-api/src/main/java/me/realized/duels/api/event/request/RequestEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package me.realized.duels.api.event.request; | ||
|
||
import java.util.Objects; | ||
import javax.annotation.Nonnull; | ||
import me.realized.duels.api.event.SourcedEvent; | ||
import me.realized.duels.api.request.Request; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* Represents an event caused by a {@link Request}. | ||
* | ||
* @since 3.2.1 | ||
*/ | ||
public abstract class RequestEvent extends SourcedEvent { | ||
|
||
private final Player source, target; | ||
private final Request request; | ||
|
||
RequestEvent(@Nonnull final Player source, @Nonnull final Player target, @Nonnull final Request request) { | ||
super(source); | ||
Objects.requireNonNull(source, "source"); | ||
Objects.requireNonNull(target, "target"); | ||
Objects.requireNonNull(request, "request"); | ||
this.source = source; | ||
this.target = target; | ||
this.request = request; | ||
} | ||
|
||
/** | ||
* {@link Player} who is the source of this event. | ||
* | ||
* @return Never-null {@link Player} who is the source of this event. | ||
*/ | ||
@Nonnull | ||
@Override | ||
public Player getSource() { | ||
return source; | ||
} | ||
|
||
/** | ||
* {@link Player} who is the target of this event. | ||
* | ||
* @return Never-null {@link Player} who is the target of this event. | ||
*/ | ||
@Nonnull | ||
public Player getTarget() { | ||
return target; | ||
} | ||
|
||
/** | ||
* {@link Request} instance associated with this event. | ||
* | ||
* @return Never-null {@link Request} instance associated with this event. | ||
*/ | ||
@Nonnull | ||
public Request getRequest() { | ||
return request; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.