SteamWar/BauSystem2.0
Archiviert
12
0

Fix ColorCodes
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-11-18 20:29:41 +01:00
Ursprung 36e0c4c910
Commit 4c7f56be7c
2 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -31,6 +31,7 @@ import de.steamwar.bausystem.features.world.WorldEditListener;
import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWAnvilInv;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -192,7 +193,7 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
class Print extends VarArgFunction { class Print extends VarArgFunction {
@Override @Override
public Varargs invoke(Varargs args) { public Varargs invoke(Varargs args) {
player.sendMessage(varArgsToString(args).replaceAll("&([a-z0-9klmnor])", "§\1")); player.sendMessage(ChatColor.translateAlternateColorCodes('&', varArgsToString(args)));
return LuaValue.NIL; return LuaValue.NIL;
} }
} }

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.linkage.Linked; import de.steamwar.linkage.Linked;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Color; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.luaj.vm2.LuaTable; import org.luaj.vm2.LuaTable;
@ -94,7 +94,7 @@ public class PlayerLib implements LuaLib {
@Override @Override
public Varargs invoke(Varargs args) { public Varargs invoke(Varargs args) {
player.sendMessage(varArgsToString(args).replaceAll("&([a-z0-9klmnor])", "§\1")); player.sendMessage(ChatColor.translateAlternateColorCodes('&', varArgsToString(args)));
return LuaValue.NIL; return LuaValue.NIL;
} }
} }
@ -108,7 +108,7 @@ public class PlayerLib implements LuaLib {
@Override @Override
public Varargs invoke(Varargs args) { public Varargs invoke(Varargs args) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(varArgsToString(args).replaceAll("&([a-z0-9klmnor])", "§\1"))); player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', varArgsToString(args))));
return LuaValue.NIL; return LuaValue.NIL;
} }
} }