Commits
Y2Kwastaken authored and md_5 committed a7cfc778fdb
42 42 | this.view = view; |
43 43 | // TODO: Do we need to check that it really is a CraftInventory? |
44 44 | IInventory top = ((CraftInventory) view.getTopInventory()).getInventory(); |
45 45 | PlayerInventory bottom = (PlayerInventory) ((CraftInventory) view.getBottomInventory()).getInventory(); |
46 46 | cachedType = view.getType(); |
47 47 | setupSlots(top, bottom, player); |
48 48 | } |
49 49 | |
50 50 | public CraftContainer(final Inventory inventory, final EntityHuman player, int id) { |
51 51 | this(new InventoryView() { |
52 + | |
53 + | private final String originalTitle = (inventory instanceof CraftInventoryCustom) ? ((CraftInventoryCustom.MinecraftInventory) ((CraftInventory) inventory).getInventory()).getTitle() : inventory.getType().getDefaultTitle(); |
54 + | private String title = originalTitle; |
55 + | |
52 56 | |
53 57 | public Inventory getTopInventory() { |
54 58 | return inventory; |
55 59 | } |
56 60 | |
57 61 | |
58 62 | public Inventory getBottomInventory() { |
59 63 | return getPlayer().getInventory(); |
60 64 | } |
61 65 | |
64 68 | return player.getBukkitEntity(); |
65 69 | } |
66 70 | |
67 71 | |
68 72 | public InventoryType getType() { |
69 73 | return inventory.getType(); |
70 74 | } |
71 75 | |
72 76 | |
73 77 | public String getTitle() { |
74 - | return inventory instanceof CraftInventoryCustom ? ((CraftInventoryCustom.MinecraftInventory) ((CraftInventory) inventory).getInventory()).getTitle() : inventory.getType().getDefaultTitle(); |
78 + | return title; |
79 + | } |
80 + | |
81 + | |
82 + | public String getOriginalTitle() { |
83 + | return originalTitle; |
75 84 | } |
85 + | |
86 + | |
87 + | public void setTitle(String title) { |
88 + | CraftInventoryView.sendInventoryTitleChange(this, title); |
89 + | this.title = title; |
90 + | } |
91 + | |
76 92 | }, player, id); |
77 93 | } |
78 94 | |
79 95 | |
80 96 | public InventoryView getBukkitView() { |
81 97 | return view; |
82 98 | } |
83 99 | |
84 100 | public static Containers getNotchInventoryType(Inventory inventory) { |
85 101 | switch (inventory.getType()) { |