mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-18 11:01:19 +01:00
Fix ShowItem incompatibility as well as update adventure
This commit is contained in:
parent
af32b041ff
commit
4e40823d23
2
pom.xml
2
pom.xml
@ -98,7 +98,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||||
<version>4.2.0</version>
|
<version>4.3.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
@ -10,6 +10,9 @@ import de.themoep.ShowItem.api.ShowItem;
|
|||||||
import de.themoep.minedown.adventure.Replacer;
|
import de.themoep.minedown.adventure.Replacer;
|
||||||
import info.somethingodd.OddItem.OddItem;
|
import info.somethingodd.OddItem.OddItem;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.ComponentBuilder;
|
||||||
|
import net.kyori.adventure.text.TextComponent;
|
||||||
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.YamlConstructor;
|
import org.bukkit.configuration.file.YamlConstructor;
|
||||||
@ -537,10 +540,10 @@ public class MaterialUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component itemComponent = Component.empty();
|
TextComponent.Builder itemComponent = Component.text();
|
||||||
for (ItemStack item : InventoryUtil.mergeSimilarStacks(stock)) {
|
for (ItemStack item : InventoryUtil.mergeSimilarStacks(stock)) {
|
||||||
try {
|
try {
|
||||||
itemComponent.append(showItem.getItemConverter().createComponent(item, Level.FINE).toTextComponent(player));
|
itemComponent.append(GsonComponentSerializer.gson().deserialize(showItem.getItemConverter().createComponent(item, Level.FINE).toJsonString(player)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ChestShop.getPlugin().getLogger().log(Level.WARNING, "Error while trying to send message '" + message + "' to player " + player.getName() + ": " + e.getMessage());
|
ChestShop.getPlugin().getLogger().log(Level.WARNING, "Error while trying to send message '" + message + "' to player " + player.getName() + ": " + e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
@ -551,7 +554,7 @@ public class MaterialUtil {
|
|||||||
newMap.put("material", "item");
|
newMap.put("material", "item");
|
||||||
Component component = new Replacer()
|
Component component = new Replacer()
|
||||||
.placeholderSuffix("")
|
.placeholderSuffix("")
|
||||||
.replace("item",itemComponent)
|
.replace("item",itemComponent.build())
|
||||||
.replaceIn(message.getComponent(player, true, newMap, replacements));
|
.replaceIn(message.getComponent(player, true, newMap, replacements));
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ChestShop.getAudiences().player(player).sendMessage(component);
|
ChestShop.getAudiences().player(player).sendMessage(component);
|
||||||
|
Loading…
Reference in New Issue
Block a user