Player Events

This commit is contained in:
Vankka 2024-07-28 02:19:55 +03:00
parent 03cbd45993
commit 350bd38c80
No known key found for this signature in database
GPG Key ID: 62E48025ED4E7EBB
7 changed files with 19 additions and 6 deletions

View File

@ -24,6 +24,7 @@
package com.discordsrv.api.events;
import com.discordsrv.api.player.DiscordSRVPlayer;
import org.jetbrains.annotations.NotNull;
/**
* An event that is related to a {@link DiscordSRVPlayer}.
@ -34,5 +35,6 @@ public interface PlayerEvent extends Event {
* The player that this event is related to.
* @return the player
*/
@NotNull
DiscordSRVPlayer getPlayer();
}

View File

@ -26,6 +26,7 @@ package com.discordsrv.api.events.message.receive.game;
import com.discordsrv.api.channel.GameChannel;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.eventbus.EventPriority;
import com.discordsrv.api.events.PlayerEvent;
import com.discordsrv.api.player.DiscordSRVPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -34,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
* Indicates that an advancement or achievement message was received will be processed
* at {@link EventPriority#DEFAULT} unless cancelled or processed by a 3rd party.
*/
public class AwardMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
public class AwardMessageReceiveEvent extends AbstractGameMessageReceiveEvent implements PlayerEvent {
private final DiscordSRVPlayer player;
private MinecraftComponent name;
@ -56,6 +57,8 @@ public class AwardMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
this.gameChannel = gameChannel;
}
@Override
@NotNull
public DiscordSRVPlayer getPlayer() {
return player;
}

View File

@ -26,6 +26,7 @@ package com.discordsrv.api.events.message.receive.game;
import com.discordsrv.api.channel.GameChannel;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.eventbus.EventPriority;
import com.discordsrv.api.events.PlayerEvent;
import com.discordsrv.api.player.DiscordSRVPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -34,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
* Indicates that a death message was received and will be processed
* at {@link EventPriority#DEFAULT} unless cancelled or processed by a 3rd party.
*/
public class DeathMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
public class DeathMessageReceiveEvent extends AbstractGameMessageReceiveEvent implements PlayerEvent {
private final DiscordSRVPlayer player;
private MinecraftComponent message;
@ -52,6 +53,7 @@ public class DeathMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
this.gameChannel = gameChannel;
}
@Override
@NotNull
public DiscordSRVPlayer getPlayer() {
return player;

View File

@ -72,7 +72,7 @@ public class GameChatMessageReceiveEvent extends AbstractGameMessageReceiveEvent
}
@Override
public DiscordSRVPlayer getPlayer() {
public @NotNull DiscordSRVPlayer getPlayer() {
return player;
}
}

View File

@ -26,6 +26,7 @@ package com.discordsrv.api.events.message.receive.game;
import com.discordsrv.api.channel.GameChannel;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.eventbus.EventPriority;
import com.discordsrv.api.events.PlayerEvent;
import com.discordsrv.api.player.DiscordSRVPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -34,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
* Indicates that a join message was received and will be processed
* at {@link EventPriority#DEFAULT} unless cancelled or processed by a 3rd party.
*/
public class JoinMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
public class JoinMessageReceiveEvent extends AbstractGameMessageReceiveEvent implements PlayerEvent {
private final DiscordSRVPlayer player;
private MinecraftComponent message;
@ -55,6 +56,7 @@ public class JoinMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
this.firstJoin = firstJoin;
}
@Override
@NotNull
public DiscordSRVPlayer getPlayer() {
return player;

View File

@ -26,6 +26,7 @@ package com.discordsrv.api.events.message.receive.game;
import com.discordsrv.api.channel.GameChannel;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.eventbus.EventPriority;
import com.discordsrv.api.events.PlayerEvent;
import com.discordsrv.api.player.DiscordSRVPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -34,7 +35,7 @@ import org.jetbrains.annotations.Nullable;
* Indicates that a leave message was received and will be processed
* at {@link EventPriority#DEFAULT} unless cancelled or processed by a 3rd party.
*/
public class LeaveMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
public class LeaveMessageReceiveEvent extends AbstractGameMessageReceiveEvent implements PlayerEvent {
private final DiscordSRVPlayer player;
private MinecraftComponent message;
@ -52,6 +53,7 @@ public class LeaveMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
this.gameChannel = gameChannel;
}
@Override
@NotNull
public DiscordSRVPlayer getPlayer() {
return player;

View File

@ -25,6 +25,7 @@ package com.discordsrv.api.events.message.receive.game;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.eventbus.EventPriority;
import com.discordsrv.api.events.PlayerEvent;
import com.discordsrv.api.player.DiscordSRVPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -33,7 +34,7 @@ import org.jetbrains.annotations.Nullable;
* Indicates that a server switch message was received and will be processed
* at {@link EventPriority#DEFAULT} unless cancelled or processed by a 3rd party.
*/
public class ServerSwitchMessageReceiveEvent extends AbstractGameMessageReceiveEvent {
public class ServerSwitchMessageReceiveEvent extends AbstractGameMessageReceiveEvent implements PlayerEvent {
private final DiscordSRVPlayer player;
private MinecraftComponent message;
@ -49,6 +50,7 @@ public class ServerSwitchMessageReceiveEvent extends AbstractGameMessageReceiveE
this.message = message;
}
@Override
@NotNull
public DiscordSRVPlayer getPlayer() {
return player;