Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
SPIGOT-5829: RGB hex colours not supported in several places
Dieser Commit ist enthalten in:
Ursprung
6b20d04c71
Commit
174a2ee539
@ -45,6 +45,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
|||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftMerchantCustom;
|
import org.bukkit.craftbukkit.inventory.CraftMerchantCustom;
|
||||||
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
@ -317,7 +318,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
|
|
||||||
String title = container.getBukkitView().getTitle();
|
String title = container.getBukkitView().getTitle();
|
||||||
|
|
||||||
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title)));
|
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0]));
|
||||||
getHandle().activeContainer = container;
|
getHandle().activeContainer = container;
|
||||||
getHandle().activeContainer.addSlotListener(player);
|
getHandle().activeContainer.addSlotListener(player);
|
||||||
}
|
}
|
||||||
@ -387,7 +388,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|||||||
// Now open the window
|
// Now open the window
|
||||||
Containers<?> windowType = CraftContainer.getNotchInventoryType(inventory.getTopInventory());
|
Containers<?> windowType = CraftContainer.getNotchInventoryType(inventory.getTopInventory());
|
||||||
String title = inventory.getTitle();
|
String title = inventory.getTitle();
|
||||||
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title)));
|
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0]));
|
||||||
player.activeContainer = container;
|
player.activeContainer = container;
|
||||||
player.activeContainer.addSlotListener(player);
|
player.activeContainer.addSlotListener(player);
|
||||||
}
|
}
|
||||||
|
@ -758,7 +758,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setDisplayName(String name) {
|
public final void setDisplayName(String name) {
|
||||||
this.displayName = CraftChatMessage.wrapOrNull(name);
|
this.displayName = CraftChatMessage.fromStringOrNull(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -773,7 +773,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLocalizedName(String name) {
|
public void setLocalizedName(String name) {
|
||||||
this.locName = CraftChatMessage.wrapOrNull(name);
|
this.locName = CraftChatMessage.fromStringOrNull(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1338,7 +1338,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|||||||
page = page.substring(0, maxItemLength);
|
page = page.substring(0, maxItemLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
addTo.add(CraftChatMessage.wrapOrEmpty(page));
|
addTo.add(CraftChatMessage.fromString(page)[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,14 +153,6 @@ public final class CraftChatMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IChatBaseComponent wrapOrNull(String message) {
|
|
||||||
return (message == null || message.isEmpty()) ? null : new ChatComponentText(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IChatBaseComponent wrapOrEmpty(String message) {
|
|
||||||
return (message == null) ? new ChatComponentText("") : new ChatComponentText(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IChatBaseComponent fromStringOrNull(String message) {
|
public static IChatBaseComponent fromStringOrNull(String message) {
|
||||||
return fromStringOrNull(message, false);
|
return fromStringOrNull(message, false);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren