forked from SteamWar/SteamWar
Add JavaDoc to RegionSystem
This commit is contained in:
@@ -40,6 +40,7 @@ import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.command.AbstractValidator;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.core.CRIUSleepEvent;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.core.WorldEditRendererCUIEditor;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
@@ -54,6 +55,7 @@ import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -72,7 +74,7 @@ import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BauSystem extends JavaPlugin {
|
||||
public class BauSystem extends JavaPlugin implements Listener {
|
||||
|
||||
// This should be treated as final!
|
||||
public static Message MESSAGE;
|
||||
@@ -212,6 +214,11 @@ public class BauSystem extends JavaPlugin {
|
||||
new WorldEditRendererCUIEditor();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCRIUSleep(CRIUSleepEvent event) {
|
||||
RegionSystem.INSTANCE.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
instances.forEach((aClass, o) -> {
|
||||
|
||||
@@ -32,18 +32,39 @@ public interface RegionSystem {
|
||||
|
||||
RegionSystem INSTANCE = init();
|
||||
|
||||
/**
|
||||
* Loads and initializes the Regions and anything that should be loaded on startup.
|
||||
*/
|
||||
void load();
|
||||
|
||||
/**
|
||||
* Saves anything that should be written to file on either CRIUSleepEvent or plugin disable.
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* Returns the GlobalRegion. This Region should have their {@link Region#getID()} return the
|
||||
* '00000000-0000-0000-0000-000000000000' UUID for easier retrieval with {@link #getRegion(UUID)}.
|
||||
*/
|
||||
@NonNull
|
||||
Region getGlobalRegion();
|
||||
|
||||
/**
|
||||
* Should return a Region that is present at the specific Location or the {@link #getGlobalRegion()}
|
||||
* if none are present.
|
||||
*/
|
||||
@NonNull
|
||||
Region get(@NonNull Location location);
|
||||
|
||||
/**
|
||||
* Should return the Region by their UUID.
|
||||
*/
|
||||
@CheckReturnValue
|
||||
Optional<Region> getRegion(@NonNull UUID id);
|
||||
|
||||
/**
|
||||
* Does and should not contain the GlobalRegion returned by {@link #getGlobalRegion()}.
|
||||
*/
|
||||
@NonNull
|
||||
Stream<Region> getRegions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user