From ff9b585b290a81bfbb2de9b54e0e6b01cc388ad7 Mon Sep 17 00:00:00 2001 From: DanMB Date: Sat, 25 Dec 2021 12:31:18 -0800 Subject: [PATCH] Drop api --- api/build.gradle | 45 ------ .../java/com/volmit/iris/api/IrisAPI.java | 141 ------------------ settings.gradle | 1 - 3 files changed, 187 deletions(-) delete mode 100644 api/build.gradle delete mode 100644 api/src/main/java/com/volmit/iris/api/IrisAPI.java diff --git a/api/build.gradle b/api/build.gradle deleted file mode 100644 index 6d0d4e93c..000000000 --- a/api/build.gradle +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Iris is a World Generator for Minecraft Bukkit Servers - * Copyright (c) 2021 Arcane Arts (Volmit Software) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -plugins { - id 'java' -} - -group 'com.volmit.iris' -version '1.0.0' - -repositories { - mavenCentral() - maven { - url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' - content { - includeGroup 'org.spigotmc' - } - } -} - -dependencies { - implementation rootProject - implementation 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/api/src/main/java/com/volmit/iris/api/IrisAPI.java b/api/src/main/java/com/volmit/iris/api/IrisAPI.java deleted file mode 100644 index f8059b1b8..000000000 --- a/api/src/main/java/com/volmit/iris/api/IrisAPI.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Iris is a World Generator for Minecraft Bukkit Servers - * Copyright (c) 2021 Arcane Arts (Volmit Software) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.volmit.iris.api; - -import com.volmit.iris.Iris; -import com.volmit.iris.core.service.RegistrySVC; -import com.volmit.iris.core.tools.IrisToolbelt; -import com.volmit.iris.engine.data.cache.AtomicCache; -import com.volmit.iris.util.api.APIAwareBlock; -import com.volmit.iris.util.api.APIWorldBlock; -import com.volmit.iris.util.plugin.PluginRegistryGroup; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.data.BlockData; - -import java.util.List; -import java.util.function.Supplier; - -public class IrisAPI -{ - private static final AtomicCache>> customBlock = new AtomicCache<>(); - - /** - * Checks if the given world is an Iris World - * - * @param world the world - * @return true if it is an Iris world - */ - public static boolean isIrisWorld(World world) { - return IrisToolbelt.isIrisWorld(world); - } - - /** - * Checks if the given world is an Iris World with studio mode - * @param world the world - * @return true if it is an Iris World & is in Studio Mode - */ - public static boolean isIrisStudioWorld(World world) { - return IrisToolbelt.isIrisStudioWorld(world); - } - - /** - * Used for registering ids into custom blocks - * @return the registry - */ - public static RegistryHolder> getCustomBlockRegistry() - { - return customBlock.aquire(() -> new RegistryHolder<>(() -> Iris.service(RegistrySVC.class).getCustomBlockRegistry())); - } - - public static class RegistryHolder - { - private final Supplier> registry; - - public RegistryHolder(Supplier> registry) - { - this.registry = registry; - } - - /** - * Unregister a node - * @param namespace the namespace (your plugin id or something) - * @param id the identifier for the node - */ - public void unregister(String namespace, String id) - { - registry.get().getRegistry(namespace).unregister(id); - } - - /** - * Unregister all nodes by namespace - * @param namespace the namespace (such as your plugin) - */ - public void unregisterAll(String namespace) - { - registry.get().getRegistry(namespace).unregisterAll(); - } - - /** - * Register a node under a namespace & id - * such as myplugin:ruby_ore which should resolve to an object that - * could be used by the generator. - * - * @param namespace the namespace (of this plugin) (myplugin) - * @param id the identifier for this node (ruby_ore) - * @param block the provider for this node data (always return a new instance!) - */ - public void register(String namespace, String id, T block) - { - registry.get().getRegistry(namespace).register(id, block); - } - - /** - * Get all registered nodes under a namespace - * @param namespace the namespace such as your plugin - * @return the registry list (ids) - */ - public List getRegsitries(String namespace) - { - return registry.get().getRegistry(namespace).getRegistries(); - } - } - - @FunctionalInterface - public interface AwareBlockMirror - { - void onPlaced(BlockData block, String namespace, String key, int x, int y, int z); - - default APIAwareBlock map() - { - return this::onPlaced; - } - } - - @FunctionalInterface - public interface WorldBlockMirror - { - void onWorldPlaced(Block block, String namespace, String key); - - default APIWorldBlock map() - { - return this::onWorldPlaced; - } - } -} diff --git a/settings.gradle b/settings.gradle index 82d702ce2..7e3e7191b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,5 +17,4 @@ */ rootProject.name = 'Iris' -include 'api'