summaryrefslogtreecommitdiffstats
path: root/nms-patches/ContainerMerchant.patch
blob: fdbef6a80500d9ddca5ef5e4fa031af2ff8a21bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- /home/matt/mc-dev-private//net/minecraft/server/ContainerMerchant.java	2015-02-26 22:40:22.423608141 +0000
+++ src/main/java/net/minecraft/server/ContainerMerchant.java	2015-02-26 22:40:22.423608141 +0000
@@ -1,11 +1,26 @@
 package net.minecraft.server;
 
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
+
 public class ContainerMerchant extends Container {
 
     private IMerchant merchant;
     private InventoryMerchant f;
     private final World g;
 
+    // CraftBukkit start
+    private CraftInventoryView bukkitEntity = null;
+    private PlayerInventory player;
+
+    @Override
+    public CraftInventoryView getBukkitView() {
+        if (bukkitEntity == null) {
+            bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant((InventoryMerchant) f), this);
+        }
+        return bukkitEntity;
+    }
+    // CraftBukkit end
+
     public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
         this.merchant = imerchant;
         this.g = world;
@@ -13,6 +28,7 @@
         this.a(new Slot(this.f, 0, 36, 53));
         this.a(new Slot(this.f, 1, 62, 53));
         this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.f, 2, 120, 53)));
+        this.player = playerinventory; // CraftBukkit - save player
 
         int i;