TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/world/CustomWorld.java
Paldiu 5c0f77c7c5 Removal of Lombok
Lombok implementation removal.

I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!!

Thank you!!
2020-12-25 14:46:43 -05:00

65 lines
1.2 KiB
Java

package me.totalfreedom.totalfreedommod.world;
import io.papermc.lib.PaperLib;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
public abstract class CustomWorld extends FreedomService
{
private final String name;
//
private World world;
public CustomWorld(String name)
{
this.name = name;
}
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
public final World getWorld()
{
if (world == null || !Bukkit.getWorlds().contains(world))
{
world = generateWorld();
}
if (world == null)
{
FLog.warning("Could not load world: " + name);
}
return world;
}
public void sendToWorld(Player player)
{
try
{
PaperLib.teleportAsync(player, getWorld().getSpawnLocation());
}
catch (Exception ex)
{
player.sendMessage(ex.getMessage());
}
}
protected abstract World generateWorld();
public String getName()
{
return name;
}
}