mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
ef0e5a642d
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API 48c0c547 PR-786: Add methods to get sounds from entities CraftBukkit Changes: 5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event 4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation 4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API e5d6a9bbf PR-1100: Add methods to get sounds from entities b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta Spigot Changes: 4c157bb4 Rebuild patches
47 lines
2.8 KiB
Diff
47 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Mon, 23 Nov 2020 12:58:51 -0800
|
|
Subject: [PATCH] Added PlayerLecternPageChangeEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
|
index 9b80f533e94c47ebc0d46429698e084216b632ab..52471ef87994ac91b4b0017159b61ff50774848a 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
|
@@ -64,6 +64,7 @@ public class LecternMenu extends AbstractContainerMenu {
|
|
@Override
|
|
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
|
|
int j;
|
|
+ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper
|
|
|
|
if (id >= 100) {
|
|
j = id - 100;
|
|
@@ -73,11 +74,25 @@ public class LecternMenu extends AbstractContainerMenu {
|
|
switch (id) {
|
|
case 1:
|
|
j = this.lecternData.get(0);
|
|
- this.setData(0, j - 1);
|
|
+ // Paper start
|
|
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
|
|
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1);
|
|
+ if (!playerLecternPageChangeEvent.callEvent()) {
|
|
+ return false;
|
|
+ }
|
|
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
|
|
+ // Paper end
|
|
return true;
|
|
case 2:
|
|
j = this.lecternData.get(0);
|
|
- this.setData(0, j + 1);
|
|
+ // Paper start
|
|
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
|
|
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1);
|
|
+ if (!playerLecternPageChangeEvent.callEvent()) {
|
|
+ return false;
|
|
+ }
|
|
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
|
|
+ // Paper end
|
|
return true;
|
|
case 3:
|
|
if (!player.mayBuild()) {
|