geforkt von Mirrors/Paper
fix bug with lootable API
was returning the NMS instance of objects instead of the Bukkit API objects
Dieser Commit ist enthalten in:
Ursprung
d8d75b106c
Commit
e7be15b884
@ -78,6 +78,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ TileEntityLootable getTileEntity();
|
+ TileEntityLootable getTileEntity();
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ default LootableInventory getAPILootableInventory() {
|
||||||
|
+ return this;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
+ default World getNMSWorld() {
|
+ default World getNMSWorld() {
|
||||||
+ return getTileEntity().getWorld();
|
+ return getTileEntity().getWorld();
|
||||||
+ }
|
+ }
|
||||||
@ -108,6 +113,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+ net.minecraft.server.Entity getHandle();
|
+ net.minecraft.server.Entity getHandle();
|
||||||
+
|
+
|
||||||
|
+ @Override
|
||||||
|
+ default LootableInventory getAPILootableInventory() {
|
||||||
|
+ return this;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ default Entity getEntity() {
|
+ default Entity getEntity() {
|
||||||
+ return getHandle().getBukkitEntity();
|
+ return getHandle().getBukkitEntity();
|
||||||
+ }
|
+ }
|
||||||
@ -140,6 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+public interface CraftLootableInventory extends CraftLootable, LootableInventory {
|
+public interface CraftLootableInventory extends CraftLootable, LootableInventory {
|
||||||
+
|
+
|
||||||
+ CraftLootableInventoryData getLootableData();
|
+ CraftLootableInventoryData getLootableData();
|
||||||
|
+ LootableInventory getAPILootableInventory();
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ default boolean isRefillEnabled() {
|
+ default boolean isRefillEnabled() {
|
||||||
@ -304,7 +315,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+
|
+
|
||||||
+ final Player bukkitPlayer = (Player) player.getBukkitEntity();
|
+ final Player bukkitPlayer = (Player) player.getBukkitEntity();
|
||||||
+ LootableInventoryReplenishEvent event = new LootableInventoryReplenishEvent(bukkitPlayer, lootable);
|
+ LootableInventoryReplenishEvent event = new LootableInventoryReplenishEvent(bukkitPlayer, lootable.getAPILootableInventory());
|
||||||
+ if (paperConfig.restrictPlayerReloot && hasPlayerLooted(player.getUniqueID())) {
|
+ if (paperConfig.restrictPlayerReloot && hasPlayerLooted(player.getUniqueID())) {
|
||||||
+ event.setCancelled(true);
|
+ event.setCancelled(true);
|
||||||
+ }
|
+ }
|
||||||
@ -414,6 +425,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
|
+import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
|
||||||
+import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper
|
+import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper
|
||||||
|
+import com.destroystokyo.paper.loottable.LootableInventory; // Paper
|
||||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
@ -476,7 +488,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ private CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this);
|
+ private final CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this);
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public CraftLootableInventoryData getLootableData() {
|
+ public CraftLootableInventoryData getLootableData() {
|
||||||
@ -484,6 +496,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ public LootableInventory getAPILootableInventory() {
|
||||||
|
+ return (LootableInventory) this.getBukkitEntity();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
+ public World getNMSWorld() {
|
+ public World getNMSWorld() {
|
||||||
+ return this.world;
|
+ return this.world;
|
||||||
+ }
|
+ }
|
||||||
@ -516,6 +533,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
+import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
|
+import com.destroystokyo.paper.loottable.CraftLootableInventoryData; // Paper
|
||||||
+import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper
|
+import com.destroystokyo.paper.loottable.CraftLootableInventory; // Paper
|
||||||
|
+import com.destroystokyo.paper.loottable.LootableInventory; // Paper
|
||||||
+
|
+
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -570,7 +588,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - LootTable API
|
+ // Paper start - LootTable API
|
||||||
+ private CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this);
|
+ private final CraftLootableInventoryData lootableData = new CraftLootableInventoryData(this);
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public CraftLootableInventoryData getLootableData() {
|
+ public CraftLootableInventoryData getLootableData() {
|
||||||
@ -578,6 +596,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
+ public LootableInventory getAPILootableInventory() {
|
||||||
|
+ return (LootableInventory) getBukkitWorld().getBlockAt(MCUtil.toLocation(world, getPosition())).getState();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
+ public World getNMSWorld() {
|
+ public World getNMSWorld() {
|
||||||
+ return world;
|
+ return world;
|
||||||
+ }
|
+ }
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren