Update StorageType.java

Fix for NPE from lines in SignChangeEvent
This commit is contained in:
jameslfc19 2020-07-29 02:19:25 +01:00
parent 54f2e7cfa1
commit 79c3d36676

View File

@ -10,6 +10,7 @@ import com.jamesdpeters.minecraft.chests.serialize.Config;
import com.jamesdpeters.minecraft.chests.serialize.ConfigStorage; import com.jamesdpeters.minecraft.chests.serialize.ConfigStorage;
import com.jamesdpeters.minecraft.chests.serialize.LocationInfo; import com.jamesdpeters.minecraft.chests.serialize.LocationInfo;
import com.jamesdpeters.minecraft.chests.storage.StorageUtils; import com.jamesdpeters.minecraft.chests.storage.StorageUtils;
import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@ -328,9 +329,10 @@ public abstract class StorageType<T extends AbstractStorage> {
String[] lines = new String[4]; String[] lines = new String[4];
lines[0] = linkTag; lines[0] = linkTag;
lines[1] = Values.identifier(group); lines[1] = Values.identifier(group);
if(owner != null) { lines[3] = "";
lines[2] = owner; if(owner != null) lines[2] = owner;
} else lines[2] = "";
Material airType = toReplace.getType(); Material airType = toReplace.getType();
Material wallSign = Material.getMaterial(signMaterial.name().replace("SIGN", "WALL_SIGN")); Material wallSign = Material.getMaterial(signMaterial.name().replace("SIGN", "WALL_SIGN"));
toReplace.setType(wallSign != null ? wallSign : Material.OAK_WALL_SIGN); toReplace.setType(wallSign != null ? wallSign : Material.OAK_WALL_SIGN);