summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorblablubbabc <lukas@wirsindwir.de>2018-08-01 08:49:53 +1000
committermd_5 <git@md-5.net>2018-08-01 08:50:08 +1000
commita0c7bcf02a2fb8ca6fc64a76b33be9fab2c5c099 (patch)
tree0aaeaec1f0123bae41a8838b32f3d9e97306361d /src/main
parenta3b7e3433a01a5266c774912d71cb8451dcf7daf (diff)
downloadcraftbukkit-a0c7bcf02a2fb8ca6fc64a76b33be9fab2c5c099.tar
craftbukkit-a0c7bcf02a2fb8ca6fc64a76b33be9fab2c5c099.tar.gz
craftbukkit-a0c7bcf02a2fb8ca6fc64a76b33be9fab2c5c099.tar.lz
craftbukkit-a0c7bcf02a2fb8ca6fc64a76b33be9fab2c5c099.tar.xz
craftbukkit-a0c7bcf02a2fb8ca6fc64a76b33be9fab2c5c099.zip
Fix merchant inventories with custom titles
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java1
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java8
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index d96c6afd..cce9366f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -270,6 +270,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
break;
case CREATIVE:
case CRAFTING:
+ case MERCHANT:
throw new IllegalArgumentException("Can't open a " + type + " inventory!");
}
if (getHandle().activeContainer == formerContainer) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
index bc898d69..4f8edbe3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.inventory;
+import org.apache.commons.lang.Validate;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.ChatComponentText;
import net.minecraft.server.EntityHuman;
@@ -23,12 +24,13 @@ public class CraftMerchantCustom extends CraftMerchant {
private static class MinecraftMerchant implements IMerchant {
- private final String title;
+ private final IChatBaseComponent title;
private final MerchantRecipeList trades = new MerchantRecipeList();
private EntityHuman tradingPlayer;
public MinecraftMerchant(String title) {
- this.title = title;
+ Validate.notNull(title, "Title cannot be null");
+ this.title = new ChatComponentText(title);
}
@Override
@@ -58,7 +60,7 @@ public class CraftMerchantCustom extends CraftMerchant {
@Override
public IChatBaseComponent getScoreboardDisplayName() {
- return new ChatComponentText(title);
+ return title;
}
@Override