mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-23 12:05:22 +01:00
Fixed NPE errors when loading chunk loaders after deleting player data
This commit is contained in:
parent
7da9f07005
commit
ddb36f8d28
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -132,9 +133,9 @@ public final class ChunkLoaderBlockEntity extends BlockEntity implements ITileEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHologram hologram, String line) {
|
private void updateName(EntityHologram hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class TileEntityChunkLoader extends TileEntity implements ITickable, ITileEntityChunkLoader {
|
public final class TileEntityChunkLoader extends TileEntity implements ITickable, ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -116,8 +117,9 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHolograms hologram, String line) {
|
private void updateName(EntityHolograms hologram, String line) {
|
||||||
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -19,6 +19,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class TileEntityChunkLoader extends TileEntity implements ITickable, ITileEntityChunkLoader {
|
public final class TileEntityChunkLoader extends TileEntity implements ITickable, ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -130,9 +131,9 @@ public final class TileEntityChunkLoader extends TileEntity implements ITickable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHolograms hologram, String line) {
|
private void updateName(EntityHolograms hologram, String line) {
|
||||||
assert chunkLoader.getWhoPlaced().getName() != null;
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
@ -18,6 +18,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public final class TileEntityChunkLoader extends TileEntity implements IUpdatePlayerListBox, ITileEntityChunkLoader {
|
public final class TileEntityChunkLoader extends TileEntity implements IUpdatePlayerListBox, ITileEntityChunkLoader {
|
||||||
|
|
||||||
@ -116,8 +117,9 @@ public final class TileEntityChunkLoader extends TileEntity implements IUpdatePl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateName(EntityHolograms hologram, String line) {
|
private void updateName(EntityHolograms hologram, String line) {
|
||||||
|
String placerName = Optional.ofNullable(chunkLoader.getWhoPlaced().getName()).orElse("");
|
||||||
hologram.setHologramName(line
|
hologram.setHologramName(line
|
||||||
.replace("{0}", chunkLoader.getWhoPlaced().getName())
|
.replace("{0}", placerName)
|
||||||
.replace("{1}", daysAmount + "")
|
.replace("{1}", daysAmount + "")
|
||||||
.replace("{2}", hoursAmount + "")
|
.replace("{2}", hoursAmount + "")
|
||||||
.replace("{3}", minutesAmount + "")
|
.replace("{3}", minutesAmount + "")
|
||||||
|
Loading…
Reference in New Issue
Block a user