Skip to content

Commit

Permalink
Merge pull request #12 from BT-Pluginz/1.5
Browse files Browse the repository at this point in the history
1.5
  • Loading branch information
TubYoub authored Dec 15, 2024
2 parents d2ceb7a + ab28867 commit 4ffde5d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.tubyoub</groupId>
<artifactId>StatusPlugin</artifactId>
<version>1.5.1</version>
<version>1.5.2</version>
<packaging>jar</packaging>

<name>Tub's Status Plugin</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ public void onPlayerChat(PlayerChatEvent event) {
status = PlaceholderAPI.setPlaceholders(player, status);
}

// message = plugin.getStatusManager().translateColorsAndFormatting(message,player);

// Format the broadcast message
String broadcastMessage;
if (status == null) {
broadcastMessage = player.getName() + ": " + message;
if (status.isEmpty()) {
broadcastMessage = player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,player);
} else {
broadcastMessage = "[" + ColourUtils.format(status) + ChatColor.RESET + "] " + player.getName() + ": " + message;
broadcastMessage = configManager.getOpeningCharacter() + ColourUtils.format(status) + ChatColor.RESET + configManager.getClosingCharacter() + " " + player.getName() + ": " + plugin.getStatusManager().translateColorsAndFormatting(message,player);
}

// Broadcast the message and cancel the original event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public void onPlayerJoin(PlayerJoinEvent event) {
if (player.hasPermission("StatusPlugin.admin") && plugin.getConfigManager().isCheckUpdate()) {
// Alert if a critical update is available
if (this.versionInfo.isNewVersionAvailable && this.versionInfo.urgency == UpdateUrgency.CRITICAL || this.versionInfo.urgency == UpdateUrgency.HIGH) {
player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + "A critical update for BT Grave is available!");
player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + "Please update to version: " + this.versionInfo.latestVersion);
player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + "Backup your config");
player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + " A critical update for Tubs StatusPlugin is available!");
player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + " Please update to version: " + this.versionInfo.latestVersion);
player.sendMessage(plugin.getPluginPrefix() + ChatColor.RED + " Backup your config");
// only works this way and idk why
TextComponent modrinthLink = new TextComponent(ChatColor.GREEN + "" + ChatColor.UNDERLINE + "Modrinth");
modrinthLink.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://modrinth.com/plugin/bt-graves/version/" + this.versionInfo.latestVersion));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public String getStatus(Player player) {
public void updateDisplayName(Player player) {
String status = getStatus(player);

if (status != "") {
if (status.isEmpty()) {
String translatedStatus = translateColorsAndFormatting(status, player);
if (plugin.isLuckPermsPresent() && player.hasPermission("StatusPlugin.placeholders")) {
translatedStatus.replace("%LP_prefix%", Objects.requireNonNull(plugin.getLuckPerms().getPlayerAdapter(Player.class).getUser(player).getCachedData().getMetaData().getPrefix()));
Expand Down Expand Up @@ -216,7 +216,7 @@ public String translateColorsAndFormatting(String status, CommandSender sender)
status = status.replace(codes[i], "");
}
}
return ChatColor.translateAlternateColorCodes('§', status);
return ChatColor.translateAlternateColorCodes('&', status);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String getVersion(){
@Override
public String onPlaceholderRequest(Player player, String identifier){
if(player == null){
return "";
return null;
}
if (Objects.equals(identifier, "status")){
return plugin.getStatusManager().getStatus(player);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/tubyoub/statusplugin/StatusPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* This class extends JavaPlugin and represents the main entry point for the plugin.
*/
public class StatusPlugin extends JavaPlugin {
private final String version = "1.5.1";
private final String version = "1.5.2";
private final String project = "km0yAITg";
private int pluginId = 20463;
private StatusManager statusManager;
Expand Down

0 comments on commit 4ffde5d

Please sign in to comment.