-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bugfix] - Colors finaly work [changes] - reworked translateColorsAndFormatting() so it now supports the newly added formatting permissions - When u send a message the default brackets <> won't whow up anymore - updated README.md [added] - Multi Version Support (1.13-1.20.*) - added for color formatting ColorUtils.java - added ChatListener.java - added Version Checker (/info now checks if there is a new Version of the Plugin) - added basic bStats functionality - added permissions for using colors and every other type to write (bold, italic,...) Tested-by: Me on a localserver PS: hopefullly this works Took 3 hours 37 minutes
- Loading branch information
BuildTools
committed
Dec 7, 2023
1 parent
0d9587d
commit 71713da
Showing
11 changed files
with
1,164 additions
and
51 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
32 changes: 32 additions & 0 deletions
32
src/main/java/de/tubyoub/statusplugin/Listener/ChatListener.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,32 @@ | ||
package de.tubyoub.statusplugin.Listener; | ||
|
||
import de.tubyoub.statusplugin.StatusManager; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerChatEvent; | ||
|
||
public class ChatListener implements Listener { | ||
private final StatusManager statusManager; | ||
public ChatListener(StatusManager statusManager) { | ||
this.statusManager = statusManager; | ||
} | ||
@EventHandler | ||
public void onPlayerChat(PlayerChatEvent event) { | ||
// Get the player and message | ||
Player player = event.getPlayer(); | ||
String message = event.getMessage(); | ||
String status = statusManager.getStatus(player); | ||
String broadcastMessage; | ||
|
||
if (status == null) { | ||
broadcastMessage = player.getName() + ": " + message; | ||
} else { | ||
broadcastMessage = "[" + status + "] " + player.getName() + ": " + message; | ||
} | ||
Bukkit.broadcastMessage(broadcastMessage); | ||
// Cancel the original event | ||
event.setCancelled(true); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...youb/statusplugin/PlayerJoinListener.java → ...usplugin/Listener/PlayerJoinListener.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
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.