15.9
- In MiniMessage messages placeholders were erroneously not supported by PlaceholderAPI - Smaller API changes in T2Csend
This commit is contained in:
parent
f40c47e6ab
commit
150d9f4933
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.8</version>
|
||||
<version>15.9</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
|
@ -8,25 +8,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class T2ChoverModule {
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
||||
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void modulePlayer(String msg, Player player) {
|
||||
if (msg.contains("/*/")) {
|
||||
t2cmodule(msg, player);
|
||||
@ -35,24 +21,10 @@ public class T2ChoverModule {
|
||||
T2CminiMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendSenderMiniMessage(msg, sender);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void moduleSender(String msg, CommandSender sender) {
|
||||
T2CminiMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void moduleConsole(String msg) {
|
||||
if (T2CodeLibMain.getMmIsLoad()) {
|
||||
T2CminiMessage.sendConsoleMiniMessage(msg);
|
||||
@ -61,13 +33,6 @@ public class T2ChoverModule {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
private static void t2cmodule(String msg, Player player) {
|
||||
String[] split = msg.split("/\\*/");
|
||||
int i = split.length;
|
||||
|
@ -11,7 +11,12 @@ public class T2CminiMessage {
|
||||
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
|
||||
|
||||
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||
bukkitAudiences.sender(sender).sendMessage(replace(msg));
|
||||
String string = "";
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
string =T2Creplace.replace("",player,msg);
|
||||
} else string = msg;
|
||||
bukkitAudiences.sender(sender).sendMessage(replace(string));
|
||||
}
|
||||
|
||||
public static void sendConsoleMiniMessage(String msg) {
|
||||
@ -19,7 +24,7 @@ public class T2CminiMessage {
|
||||
}
|
||||
|
||||
public static void sendPlayerMiniMessage(String msg, Player player) {
|
||||
bukkitAudiences.player(player).sendMessage(replace(msg));
|
||||
bukkitAudiences.player(player).sendMessage(replace(T2Creplace.replace("", player, msg)));
|
||||
}
|
||||
|
||||
protected static Component replace(String text) {
|
||||
|
@ -7,71 +7,47 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class T2Csend {
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void console(String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void player(Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void console(Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
for (String msg : list(object)){
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void player(Player player, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
for (String msg : list(object)){
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
public static void sender(CommandSender sender, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
for (String msg : list(object)){
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
}
|
||||
|
||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
|
||||
@ -106,4 +82,16 @@ public class T2Csend {
|
||||
public static void error(Plugin plugin, String msg) {
|
||||
plugin.getLogger().log(Level.SEVERE, msg);
|
||||
}
|
||||
|
||||
private static ArrayList<String> list(Object object){
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
if (object instanceof List){
|
||||
list= (ArrayList<String>) object;
|
||||
}
|
||||
if (object instanceof String){
|
||||
list.add((String) object);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user