mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
Protection against deleted worlds.
This commit is contained in:
parent
005dd5d495
commit
e97a991c25
@ -271,6 +271,7 @@ public class UltimateKits extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
for (KitBlockData kitBlockData : kitManager.getKitLocations().values()) {
|
for (KitBlockData kitBlockData : kitManager.getKitLocations().values()) {
|
||||||
String locationStr = Methods.serializeLocation(kitBlockData.getLocation());
|
String locationStr = Methods.serializeLocation(kitBlockData.getLocation());
|
||||||
|
if (locationStr == null) continue;
|
||||||
dataFile.getConfig().set("BlockData." + locationStr + ".type", kitBlockData.getType().name());
|
dataFile.getConfig().set("BlockData." + locationStr + ".type", kitBlockData.getType().name());
|
||||||
dataFile.getConfig().set("BlockData." + locationStr + ".kit", kitBlockData.getKit().getName());
|
dataFile.getConfig().set("BlockData." + locationStr + ".kit", kitBlockData.getKit().getName());
|
||||||
dataFile.getConfig().set("BlockData." + locationStr + ".holograms", kitBlockData.showHologram());
|
dataFile.getConfig().set("BlockData." + locationStr + ".holograms", kitBlockData.showHologram());
|
||||||
|
@ -101,8 +101,8 @@ public class Methods {
|
|||||||
* @return The serialized data.
|
* @return The serialized data.
|
||||||
*/
|
*/
|
||||||
public static String serializeLocation(Location location) {
|
public static String serializeLocation(Location location) {
|
||||||
if (location == null)
|
if (location == null || location.getWorld() == null)
|
||||||
return "";
|
return null;
|
||||||
String w = location.getWorld().getName();
|
String w = location.getWorld().getName();
|
||||||
double x = location.getX();
|
double x = location.getX();
|
||||||
double y = location.getY();
|
double y = location.getY();
|
||||||
|
Loading…
Reference in New Issue
Block a user