mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 05:05:18 +01:00
Preveent NPEs and other items.
This commit is contained in:
parent
7616f6aa2a
commit
7277432c41
@ -7,6 +7,9 @@
|
||||
package world.bentobox.bentobox.api.panels.reader;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
@ -76,4 +79,32 @@ public record PanelTemplateRecord(Panel.Type type,
|
||||
this(icon, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Arrays.deepHashCode(content);
|
||||
result = prime * result + Arrays.hashCode(forcedRows);
|
||||
result = prime * result + Objects.hash(background, border, title, type);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof PanelTemplateRecord)) {
|
||||
return false;
|
||||
}
|
||||
PanelTemplateRecord other = (PanelTemplateRecord) obj;
|
||||
return Objects.equals(background, other.background) && Objects.equals(border, other.border)
|
||||
&& Arrays.deepEquals(content, other.content) && Arrays.equals(forcedRows, other.forcedRows)
|
||||
&& Objects.equals(title, other.title) && type == other.type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,11 +60,13 @@ public class IslandRespawnListener extends FlagListener {
|
||||
if (world == null) {
|
||||
return; // world no longer available
|
||||
}
|
||||
|
||||
final Location respawnLocation = getIslands().getSafeHomeLocation(Util.getWorld(world), User.getInstance(e.getPlayer().getUniqueId()), "");
|
||||
World w = Util.getWorld(world);
|
||||
if (w != null) {
|
||||
final Location respawnLocation = getIslands().getSafeHomeLocation(w, User.getInstance(e.getPlayer().getUniqueId()), "");
|
||||
if (respawnLocation != null) {
|
||||
e.setRespawnLocation(respawnLocation);
|
||||
}
|
||||
}
|
||||
// Run respawn commands, if any
|
||||
Util.runCommands(User.getInstance(e.getPlayer()), getIWM().getOnRespawnCommands(world), "respawn");
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ public class BlueprintManagementPanel {
|
||||
return new PanelItemBuilder()
|
||||
.name(blueprint.getDisplayName() == null ? blueprint.getName() : blueprint.getDisplayName())
|
||||
.description(desc)
|
||||
.icon(blueprint.getIcon() == null ? Material.PAPER : blueprint.getIcon())
|
||||
.icon(blueprint.getIcon())
|
||||
.glow(selected != null && pos == selected.getKey())
|
||||
.clickHandler((panel, u, clickType, slot) -> {
|
||||
// Handle the world squares
|
||||
|
Loading…
Reference in New Issue
Block a user