mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Fix some 1.8.8 shop compat
This commit is contained in:
parent
ffac34f734
commit
aee977ebb3
@ -603,7 +603,7 @@ public class ShopTrait extends Trait {
|
||||
@MenuSlot(slot = { 0, 6 }, material = Material.NAME_TAG, amount = 1)
|
||||
public void onSetTitle(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
|
||||
ctx.getMenu().transition(InputMenus.stringSetter(() -> shop.title, newTitle -> {
|
||||
shop.title = newTitle.isEmpty() ? null : newTitle;
|
||||
shop.title = newTitle;
|
||||
}));
|
||||
}
|
||||
|
||||
@ -613,8 +613,8 @@ public class ShopTrait extends Trait {
|
||||
shop.type = chosen.getValue();
|
||||
}, Choice.<ShopType> of(ShopType.BUY, Material.DIAMOND, "Players buy items", shop.type == ShopType.BUY),
|
||||
Choice.of(ShopType.SELL, Material.EMERALD, "Players sell items", shop.type == ShopType.SELL),
|
||||
Choice.of(ShopType.COMMAND, Material.ENDER_EYE, "Clicks trigger commands only",
|
||||
shop.type == ShopType.COMMAND)));
|
||||
Choice.of(ShopType.COMMAND, Util.getFallbackMaterial("ENDER_EYE", "ENDER_PEARL"),
|
||||
"Clicks trigger commands only", shop.type == ShopType.COMMAND)));
|
||||
}
|
||||
|
||||
@MenuSlot(slot = { 0, 8 }, compatMaterial = { "COMMAND_BLOCK", "COMMAND" }, amount = 1)
|
||||
|
@ -136,7 +136,7 @@ public class CommandAction extends NPCShopAction {
|
||||
CommandAction old = (CommandAction) previous;
|
||||
description = old.describe();
|
||||
}
|
||||
return Util.createItem(Material.COMMAND_BLOCK, "Command", description);
|
||||
return Util.createItem(Util.getFallbackMaterial("COMMAND_BLOCK", "COMMAND"), "Command", description);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -210,8 +210,9 @@ public class ItemAction extends NPCShopAction {
|
||||
base.requireUndamaged = res;
|
||||
return res ? ChatColor.GREEN + "On" : ChatColor.RED + "Off";
|
||||
}, base.requireUndamaged));
|
||||
ctx.getSlot(3 * 9 + 2).setItemStack(new ItemStack(Material.COMPARATOR), "Compare item similarity",
|
||||
base.compareSimilarity ? ChatColor.GREEN + "On" : ChatColor.RED + "Off");
|
||||
ctx.getSlot(3 * 9 + 2).setItemStack(
|
||||
new ItemStack(Util.getFallbackMaterial("COMPARATOR", "REDSTONE_COMPARATOR")),
|
||||
"Compare item similarity", base.compareSimilarity ? ChatColor.GREEN + "On" : ChatColor.RED + "Off");
|
||||
ctx.getSlot(3 * 9 + 2).addClickHandler(new BooleanSlotHandler((res) -> {
|
||||
base.compareSimilarity = res;
|
||||
return res ? ChatColor.GREEN + "On" : ChatColor.RED + "Off";
|
||||
@ -221,7 +222,7 @@ public class ItemAction extends NPCShopAction {
|
||||
ctx.getSlot(3 * 9 + 3)
|
||||
.addClickHandler((event) -> ctx.getMenu()
|
||||
.transition(InputMenus.stringSetter(() -> Joiner.on(',').join(base.metaFilter),
|
||||
res -> base.metaFilter = Arrays.asList(res.split(",")))));
|
||||
res -> base.metaFilter = res == null ? null : Arrays.asList(res.split(",")))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -891,6 +891,12 @@ public class NMSImpl implements NMSBridge {
|
||||
public void b(EntityHuman entityhuman) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e() {
|
||||
super.e();
|
||||
this.a = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (this.bukkitEntity != null) {
|
||||
@ -914,10 +920,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection
|
||||
.sendPacket(new PacketPlayOutOpenWindow(container.windowId, "minecraft:anvil", new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -949,6 +949,12 @@ public class NMSImpl implements NMSBridge {
|
||||
public void b(EntityHuman entityhuman) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e() {
|
||||
super.e();
|
||||
this.a = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (this.bukkitEntity != null) {
|
||||
@ -972,10 +978,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection
|
||||
.sendPacket(new PacketPlayOutOpenWindow(container.windowId, "minecraft:anvil", new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -979,10 +979,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection
|
||||
.sendPacket(new PacketPlayOutOpenWindow(container.windowId, "minecraft:anvil", new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -1021,10 +1021,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection
|
||||
.sendPacket(new PacketPlayOutOpenWindow(container.windowId, "minecraft:anvil", new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -1084,10 +1084,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection.sendPacket(
|
||||
new PacketPlayOutOpenWindow(container.windowId, container.getType(), new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -1102,10 +1102,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection.sendPacket(
|
||||
new PacketPlayOutOpenWindow(container.windowId, container.getType(), new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -1120,10 +1120,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection.sendPacket(
|
||||
new PacketPlayOutOpenWindow(container.windowId, container.getType(), new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
@ -829,6 +829,12 @@ public class NMSImpl implements NMSBridge {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b() {
|
||||
this.a = 0;
|
||||
super.b();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(EntityHuman entityhuman) {
|
||||
}
|
||||
@ -856,10 +862,10 @@ public class NMSImpl implements NMSBridge {
|
||||
container.getBukkitView().setItem(0, anvil.getItem(0));
|
||||
container.getBukkitView().setItem(1, anvil.getItem(1));
|
||||
container.checkReachable = false;
|
||||
container.addSlotListener(handle);
|
||||
handle.playerConnection
|
||||
.sendPacket(new PacketPlayOutOpenWindow(container.windowId, "minecraft:anvil", new ChatMessage(title)));
|
||||
handle.activeContainer = container;
|
||||
handle.syncInventory();
|
||||
return container.getBukkitView();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user