Compare commits
3 Commits
f8619e4802
...
ec7714c9fe
Author | SHA1 | Date | |
---|---|---|---|
ec7714c9fe | |||
260dae2aa0 | |||
addc485ca8 |
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.6_dev-3</version>
|
||||
<version>15.6_dev-4</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
|
@ -29,7 +29,6 @@ public class T2CitemBuilder {
|
||||
} else glass = new ItemStack(Material.valueOf(item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||
assert itemMetaglass != null;
|
||||
itemMetaglass.setDisplayName(" ");
|
||||
glass.setItemMeta(itemMetaglass);
|
||||
glass.setAmount(1);
|
||||
for (int i = 0; i < 9 * lines; i++) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -17,10 +18,16 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static String replace(String prefix, Player player, String Text) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
.replace("[nl]", "\n");
|
||||
if (T2CpluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Object object) {
|
||||
@ -46,18 +53,33 @@ public class T2Creplace {
|
||||
|
||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||
if (object instanceof String) {
|
||||
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
||||
|
||||
if (T2CpluginCheck.papi()) {
|
||||
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
||||
} else {
|
||||
object = replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
}
|
||||
if (object instanceof List) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
if (T2CpluginCheck.papi()) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
} else {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
@ -84,10 +106,18 @@ public class T2Creplace {
|
||||
return Collections.singletonList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
if (T2CpluginCheck.papi()) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
} else {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
|
||||
}
|
||||
return output;
|
||||
}
|
||||
@ -115,10 +145,15 @@ public class T2Creplace {
|
||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix)
|
||||
String input = s.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
||||
.replace("[price]", String.valueOf(price)))));
|
||||
.replace("[price]", String.valueOf(price));
|
||||
if (T2CpluginCheck.papi()) {
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input)));
|
||||
} else {
|
||||
rp.add(replaceLegacyColor(input));
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
@ -132,10 +167,16 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, Text.replace("[prefix]", prefix)
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n")));
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n");
|
||||
if (T2CpluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String replaceLegacyColor(String text) {
|
||||
@ -172,7 +213,7 @@ public class T2Creplace {
|
||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||
}
|
||||
|
||||
public static Object replace(Object object,String placeholder,String replacement) {
|
||||
public static Object replace(Object object, String placeholder, String replacement) {
|
||||
if (object instanceof String) {
|
||||
object = ((String) object).replace(placeholder, replacement);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user