Skip to content

Commit

Permalink
Version 1.3
Browse files Browse the repository at this point in the history
[Bugfix]
- Now showing the formatted color when sending a message
- help command works again (I dont wanna talk about it)
[changes]
/
[added]
/

Tested-by:
Me on a localserver

PS: hopefullly this works

Took 31 minutes
  • Loading branch information
BuildTools committed Dec 9, 2023
1 parent 71713da commit 69000e2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>D:\papermc\plugins\TubsStatusPlugin-${project.version}.jar</outputFile>
<outputFile>D:\papermc\plugins\TubsStatusPlugin-v${project.version}.jar</outputFile>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package de.tubyoub.statusplugin.Listener;

import de.tubyoub.statusplugin.StatusManager;
import de.tubyoub.utils.ColourUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand All @@ -23,7 +25,7 @@ public void onPlayerChat(PlayerChatEvent event) {
if (status == null) {
broadcastMessage = player.getName() + ": " + message;
} else {
broadcastMessage = "[" + status + "] " + player.getName() + ": " + message;
broadcastMessage = "[" + ColourUtils.format(status) + ChatColor.RESET + "] " + player.getName() + ": " + message;
}
Bukkit.broadcastMessage(broadcastMessage);
// Cancel the original event
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/tubyoub/statusplugin/StatusPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public void onEnable() {
this.statusManager = new StatusManager(this);
this.saveDefaultConfig();
this.versionChecker = new VersionChecker();
StatusCommand statusCommand = new StatusCommand(statusManager,versionChecker);
getCommand("status").setExecutor(new StatusCommand(this.statusManager,versionChecker));
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this.statusManager), this);
getServer().getPluginManager().registerEvents(new ChatListener(this.statusManager), this);
StatusCommand statusCommand = new StatusCommand(statusManager,versionChecker);
getCommand("status").setExecutor(new StatusCommand(this.statusManager,versionChecker));
getCommand("status").setExecutor(statusCommand);
getCommand("status").setTabCompleter(new StatusTabCompleter());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class StatusCommand implements CommandExecutor {
private final StatusManager statusManager;

private final VersionChecker versionChecker;
private StatusPlugin plugin;

public StatusCommand(StatusManager statusManager, VersionChecker versionChecker) {
this.statusManager = statusManager;
Expand All @@ -30,7 +31,7 @@ public StatusCommand(StatusManager statusManager, VersionChecker versionChecker)

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
StatusPlugin plugin = (StatusPlugin) Bukkit.getPluginManager().getPlugin("StatusPlugin");
this.plugin = (StatusPlugin) Bukkit.getPluginManager().getPlugin("TubsStatusPlugin");

if (!(sender instanceof Player)) {
// Handle console commands here
Expand Down Expand Up @@ -146,12 +147,11 @@ private void helpCommand(Player sender, StatusPlugin plugin, String[] args) {
}
}
private void displayColorCodes(CommandSender sender, StatusPlugin plugin) {
sender.sendMessage(ChatColor.GOLD + "Available Color Codes:");
for (ChatColor color : ChatColor.values()) {
if (color.isColor()) {
sender.sendMessage(color + color.name() + ChatColor.RESET + " - &" + color.getChar());
}
sender.sendMessage(ChatColor.GOLD + "Available Color and Formatting Codes:");
for (ChatColor code : ChatColor.values()) {
sender.sendMessage(code + code.name() + ChatColor.RESET + " - &" + code.getChar());
}
sender.sendMessage(ChatColor.RED + "These color codes are only usable if u have the permissions for them");
}
private void setmaxlenghtCommand(Player sender, String[] args) {
if (!sender.hasPermission("StatusPlugin.admin.setMaxlength")) {
Expand Down

0 comments on commit 69000e2

Please sign in to comment.