This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from OnBlock/Beta
New Event: PlayerOnChatMessage, Fixed the Disconnect event not getting triggered
- Loading branch information
Showing
16 changed files
with
163 additions
and
4 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
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
13 changes: 13 additions & 0 deletions
13
src/main/java/org/kilocraft/essentials/api/event/player/PlayerOnChatMessageEvent.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,13 @@ | ||
package org.kilocraft.essentials.api.event.player; | ||
|
||
import org.kilocraft.essentials.api.event.Event; | ||
import org.kilocraft.essentials.api.event.context.CancellableReasonContext; | ||
import org.kilocraft.essentials.api.event.context.Contextual; | ||
import org.kilocraft.essentials.api.event.context.PlayerContext; | ||
import org.kilocraft.essentials.api.event.context.WorldContext; | ||
|
||
public interface PlayerOnChatMessageEvent extends Event, PlayerContext, WorldContext, CancellableReasonContext, Contextual { | ||
String getMessage(); | ||
|
||
void setMessage(final String message); | ||
} |
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
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
65 changes: 65 additions & 0 deletions
65
src/main/java/org/kilocraft/essentials/events/player/PlayerOnChatMessageEventImpl.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,65 @@ | ||
package org.kilocraft.essentials.events.player; | ||
|
||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.server.world.ServerWorld; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.kilocraft.essentials.api.KiloServer; | ||
import org.kilocraft.essentials.api.event.player.PlayerOnChatMessageEvent; | ||
import org.kilocraft.essentials.api.user.OnlineUser; | ||
|
||
public class PlayerOnChatMessageEventImpl implements PlayerOnChatMessageEvent { | ||
private boolean cancelled = false; | ||
private String cancelReason; | ||
private final ServerPlayerEntity player; | ||
private String message; | ||
|
||
public PlayerOnChatMessageEventImpl(@NotNull final ServerPlayerEntity player, @NotNull final String message) { | ||
this.player = player; | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return this.message; | ||
} | ||
|
||
@Override | ||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
public String getCancelReason() { | ||
return this.cancelReason; | ||
} | ||
|
||
@Override | ||
public void setCancelReason(String reason) { | ||
this.cancelReason = reason; | ||
} | ||
|
||
@Override | ||
public boolean isCancelled() { | ||
return this.cancelled; | ||
} | ||
|
||
@Override | ||
public void setCancelled(boolean isCancelled) { | ||
this.cancelled = isCancelled; | ||
} | ||
|
||
@Override | ||
public ServerPlayerEntity getPlayer() { | ||
return this.player; | ||
} | ||
|
||
@Override | ||
public OnlineUser getUser() { | ||
return KiloServer.getServer().getOnlineUser(this.player); | ||
} | ||
|
||
@Override | ||
public ServerWorld getWorld() { | ||
return this.player.getServerWorld(); | ||
} | ||
} |
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