mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 10:45:54 +01:00
Beacon serialization
This commit is contained in:
parent
f665b2653d
commit
a435d8fa34
@ -56,8 +56,10 @@ public final class BlockUtil {
|
||||
blockData.setStateType(BlockStateType.BANNER.toString());
|
||||
} else if (blockState instanceof Beacon) {
|
||||
Beacon beacon = (Beacon) blockState;
|
||||
blockData.setPotionEffect(
|
||||
beacon.getPrimaryEffect().toString() + ":" + beacon.getSecondaryEffect().toString());
|
||||
String primaryEffectName = beacon.getPrimaryEffect() != null ? beacon.getPrimaryEffect().toString() : "null";
|
||||
String secondaryEffectName = beacon.getSecondaryEffect() != null ? beacon.getSecondaryEffect().toString() : "null";
|
||||
|
||||
blockData.setPotionEffect(primaryEffectName + ":" + secondaryEffectName);
|
||||
|
||||
for (int i = 0; i < beacon.getInventory().getSize(); i++) {
|
||||
ItemStack is = beacon.getInventory().getItem(i);
|
||||
@ -300,8 +302,13 @@ public final class BlockUtil {
|
||||
} else if (blockTypeState == BlockStateType.BEACON) {
|
||||
Beacon beacon = (Beacon) block.getState();
|
||||
String[] potionEffect = blockData.getPotionEffect().split(":");
|
||||
beacon.setPrimaryEffect(PotionEffectType.getByName(potionEffect[0].toUpperCase()));
|
||||
beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase()));
|
||||
if (!potionEffect[0].equals("null")) {
|
||||
beacon.setPrimaryEffect(PotionEffectType.getByName(potionEffect[0].toUpperCase()));
|
||||
}
|
||||
|
||||
if (!potionEffect[1].equals("null")) {
|
||||
beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase()));
|
||||
}
|
||||
|
||||
for (Integer slotList : blockData.getInventory().keySet()) {
|
||||
if (slotList < beacon.getInventory().getSize()) {
|
||||
|
@ -47,12 +47,7 @@ public class WorldManager {
|
||||
normalWorld = WorldCreator.name(normalWorldName).type(WorldType.FLAT).environment(World.Environment.NORMAL)
|
||||
.generator(new VoidGenerator()).createWorld();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
registerMultiverse(normalWorldName, World.Environment.NORMAL);
|
||||
}
|
||||
});
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(normalWorldName, World.Environment.NORMAL));
|
||||
}
|
||||
|
||||
if (netherWorld == null) {
|
||||
@ -61,12 +56,7 @@ public class WorldManager {
|
||||
netherWorld = WorldCreator.name(netherWorldName).type(WorldType.FLAT).environment(World.Environment.NETHER)
|
||||
.generator(new VoidGenerator()).createWorld();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
registerMultiverse(netherWorldName, World.Environment.NETHER);
|
||||
}
|
||||
});
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(netherWorldName, World.Environment.NETHER));
|
||||
}
|
||||
|
||||
if (endWorld == null) {
|
||||
@ -75,12 +65,7 @@ public class WorldManager {
|
||||
endWorld = WorldCreator.name(endWorldName).type(WorldType.FLAT).environment(World.Environment.THE_END)
|
||||
.generator(new VoidGenerator()).createWorld();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
registerMultiverse(endWorldName, World.Environment.THE_END);
|
||||
}
|
||||
});
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, () -> registerMultiverse(endWorldName, World.Environment.THE_END));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user