mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-23 08:38:51 +00:00
annotate Platform methods with nullability and contract
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
|
||||
package com.dfsek.terra.api;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
@@ -27,6 +30,8 @@ import com.dfsek.terra.api.tectonic.LoaderRegistrar;
|
||||
public interface Platform extends LoaderRegistrar {
|
||||
boolean reload();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
String platformName();
|
||||
|
||||
/**
|
||||
@@ -36,27 +41,44 @@ public interface Platform extends LoaderRegistrar {
|
||||
*
|
||||
* @param task Task to be run.
|
||||
*/
|
||||
default void runPossiblyUnsafeTask(Runnable task) {
|
||||
default void runPossiblyUnsafeTask(@NotNull Runnable task) {
|
||||
task.run();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
WorldHandle getWorldHandle();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
PluginConfig getTerraConfig();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
File getDataFolder();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
CheckedRegistry<ConfigPack> getConfigRegistry();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
Registry<BaseAddon> getAddons();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
ItemHandle getItemHandle();
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
EventManager getEventManager();
|
||||
|
||||
default String getVersion() {
|
||||
@Contract(pure = true)
|
||||
default @NotNull String getVersion() {
|
||||
return "@VERSION@";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure = true)
|
||||
Profiler getProfiler();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.dfsek.terra.api.util.StringIdentifiable;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
@@ -250,27 +251,27 @@ public abstract class AbstractPlatform implements Platform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginConfig getTerraConfig() {
|
||||
public @NotNull PluginConfig getTerraConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckedRegistry<ConfigPack> getConfigRegistry() {
|
||||
public @NotNull CheckedRegistry<ConfigPack> getConfigRegistry() {
|
||||
return checkedConfigRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Registry<BaseAddon> getAddons() {
|
||||
public @NotNull Registry<BaseAddon> getAddons() {
|
||||
return lockedAddonRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventManager getEventManager() {
|
||||
public @NotNull EventManager getEventManager() {
|
||||
return eventManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Profiler getProfiler() {
|
||||
public @NotNull Profiler getProfiler() {
|
||||
return profiler;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user