mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-06 23:52:31 +01:00
Prevent null hopper owners crashing the server
This commit is contained in:
parent
3f2494cbbf
commit
1d652d8fff
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Suddenly <suddenly@suddenly.coffee>
|
||||
Date: Tue, 27 May 2014 14:00:41 +0100
|
||||
Subject: [PATCH] Prevent null hopper owners crashing the server
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
||||
@@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
if (!this.j() && BlockHopper.c(this.p())) {
|
||||
boolean flag = false;
|
||||
|
||||
- if (!this.k()) {
|
||||
- flag = this.x();
|
||||
- }
|
||||
-
|
||||
- if (!this.l()) {
|
||||
- flag = suckInItems(this) || flag;
|
||||
- }
|
||||
+ try { // PaperSpigot Start (Try/catch to prevent null owner crash)
|
||||
+ if (!this.k()) {
|
||||
+ flag = this.x();
|
||||
+ }
|
||||
+ } catch (NullPointerException e) {
|
||||
+ this.getWorld().setAir(this.x, this.y, this.z);
|
||||
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Null owner found for hopper, removing hopper at {0} {1}, {2}, {3}", new Object[]{this.getWorld().getWorld().getName(), this.x, this.y, this.z});
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ if (!this.l()) {
|
||||
+ flag = suckInItems(this) || flag;
|
||||
+ }
|
||||
+ } catch (NullPointerException e) {
|
||||
+ this.getWorld().setAir(this.x, this.y, this.z);
|
||||
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Null owner found for hopper, removing hopper at {0} {1}, {2}, {3}", new Object[]{this.getWorld().getWorld().getName(), this.x, this.y, this.z});
|
||||
+ } // PaperSpigot End
|
||||
|
||||
if (flag) {
|
||||
this.c(world.spigotConfig.hopperTransfer); // Spigot
|
||||
--
|
Loading…
Reference in New Issue
Block a user