Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 05:20:05 +01:00
BlockFlowing NPE fix.
Dieser Commit ist enthalten in:
Ursprung
34458efd83
Commit
332b0c2ca9
@ -2,12 +2,12 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
import org.bukkit.event.Event.Type;
|
import org.bukkit.event.Event.Type;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockFlowing extends BlockFluids {
|
public class BlockFlowing extends BlockFluids {
|
||||||
|
|
||||||
@ -28,8 +28,11 @@ public class BlockFlowing extends BlockFluids {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(World world, int i, int j, int k, Random random) {
|
public void a(World world, int i, int j, int k, Random random) {
|
||||||
// CraftBukkit
|
// CraftBukkit start
|
||||||
CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||||
|
CraftServer server = ((WorldServer) world).getServer();
|
||||||
|
CraftBlock source = cworld == null ? null : (CraftBlock) cworld.getBlockAt(i, j, k);
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
int l = this.g(world, i, j, k);
|
int l = this.g(world, i, j, k);
|
||||||
byte b0 = 1;
|
byte b0 = 1;
|
||||||
@ -97,7 +100,9 @@ public class BlockFlowing extends BlockFluids {
|
|||||||
if (this.l(world, i, j - 1, k)) {
|
if (this.l(world, i, j - 1, k)) {
|
||||||
// CraftBukkit start - send "down" to the server
|
// CraftBukkit start - send "down" to the server
|
||||||
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN);
|
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
if (server != null) {
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (l >= 8) {
|
if (l >= 8) {
|
||||||
@ -125,7 +130,11 @@ public class BlockFlowing extends BlockFluids {
|
|||||||
for (BlockFace currentFace: faces) {
|
for (BlockFace currentFace: faces) {
|
||||||
if (aboolean[index]) {
|
if (aboolean[index]) {
|
||||||
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace);
|
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, currentFace);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
|
if (server != null) {
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.g(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
|
this.g(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren