|
|
@ -1,6 +1,5 @@ |
|
|
|
package com.benjocraeft.sharehealth; |
|
|
|
package com.benjocraeft.sharehealth; |
|
|
|
|
|
|
|
|
|
|
|
import net.kyori.adventure.text.TextComponent; |
|
|
|
|
|
|
|
import org.bukkit.Bukkit; |
|
|
|
import org.bukkit.Bukkit; |
|
|
|
import org.bukkit.ChatColor; |
|
|
|
import org.bukkit.ChatColor; |
|
|
|
import org.bukkit.block.Block; |
|
|
|
import org.bukkit.block.Block; |
|
|
@ -42,7 +41,7 @@ public class Messenger { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void sendFailedMessage(Player cause){ |
|
|
|
void sendFailedMessage(Player cause){ |
|
|
|
String playerName = ((TextComponent) cause.displayName()).content(); |
|
|
|
String playerName = getPlayerName(cause); |
|
|
|
String message = "Mission failed, go next! CAUSE: " + ChatColor.RED + playerName; |
|
|
|
String message = "Mission failed, go next! CAUSE: " + ChatColor.RED + playerName; |
|
|
|
Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(message)); |
|
|
|
Bukkit.getOnlinePlayers().forEach(p -> p.sendMessage(message)); |
|
|
|
} |
|
|
|
} |
|
|
@ -98,7 +97,7 @@ public class Messenger { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String damageMessage(Player player, double damage, String source){ |
|
|
|
private String damageMessage(Player player, double damage, String source){ |
|
|
|
String playerS = ((TextComponent) player.displayName()).content(); |
|
|
|
String playerS = getPlayerName(player); |
|
|
|
String damageS = String.format("%.2f", damage / 2); |
|
|
|
String damageS = String.format("%.2f", damage / 2); |
|
|
|
return ChatColor.BLUE + playerS |
|
|
|
return ChatColor.BLUE + playerS |
|
|
|
+ ChatColor.WHITE + " - " |
|
|
|
+ ChatColor.WHITE + " - " |
|
|
@ -108,7 +107,7 @@ public class Messenger { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String healMessage(Player player, double regainedHealth, RegainReason reason){ |
|
|
|
private String healMessage(Player player, double regainedHealth, RegainReason reason){ |
|
|
|
String playerS = ((TextComponent) player.displayName()).content(); |
|
|
|
String playerS = getPlayerName(player); |
|
|
|
String healingS = String.format("%.2f", regainedHealth / 2); |
|
|
|
String healingS = String.format("%.2f", regainedHealth / 2); |
|
|
|
String causeS = reason.toString(); |
|
|
|
String causeS = reason.toString(); |
|
|
|
return ChatColor.BLUE + playerS |
|
|
|
return ChatColor.BLUE + playerS |
|
|
@ -150,4 +149,12 @@ public class Messenger { |
|
|
|
return helpMessage.toString(); |
|
|
|
return helpMessage.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getPlayerName(Player player){ |
|
|
|
|
|
|
|
//Papermc:
|
|
|
|
|
|
|
|
//((TextComponent) player.displayName()).content();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Spigot:
|
|
|
|
|
|
|
|
return player.getDisplayName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|