diff --git a/src/main/java/org/spongepowered/api/Game.java b/src/main/java/org/spongepowered/api/Game.java index 4dc3c98529b..af52f341ad2 100644 --- a/src/main/java/org/spongepowered/api/Game.java +++ b/src/main/java/org/spongepowered/api/Game.java @@ -63,6 +63,13 @@ public interface Game { */ EventManager getEventManager(); + /** + * Gets the {@link org.spongepowered.api.GameRegistry}. + * + * @return The game registry + */ + GameRegistry getRegistry(); + /** * Gets all currently loaded {@link org.spongepowered.api.world.World}s. * diff --git a/src/main/java/org/spongepowered/api/GameRegistry.java b/src/main/java/org/spongepowered/api/GameRegistry.java new file mode 100644 index 00000000000..0d52c20e048 --- /dev/null +++ b/src/main/java/org/spongepowered/api/GameRegistry.java @@ -0,0 +1,23 @@ +package org.spongepowered.api; + +import org.spongepowered.api.block.Block; +import org.spongepowered.api.item.Item; + +/** + * Provides an easy way to retrieve objects from the {@link org.spongepowered.api.Game} based on their ids. + */ +public interface GameRegistry { + /** + * Gets a {@link org.spongepowered.api.block.Block} by its identifier. + * @param id The id to look up + * @return The block or null if not found + */ + Block getBlock(String id); + + /** + * Gets an {@link org.spongepowered.api.item.Item} by its identifier. + * @param id The id to look up + * @return The item or null if not found + */ + Item getItem(String id); +} diff --git a/src/main/java/org/spongepowered/api/plugin/InvalidPluginException.java b/src/main/java/org/spongepowered/api/plugin/InvalidPluginException.java deleted file mode 100644 index edd9bff98a4..00000000000 --- a/src/main/java/org/spongepowered/api/plugin/InvalidPluginException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) 2014 SpongePowered - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.spongepowered.api.plugin; - -/** - * Thrown by the implementation if it determines that a {@link org.spongepowered.api.plugin.Plugin} being loaded is invalid. - */ -public class InvalidPluginException extends Exception { - private static final long serialVersionUID = 15816838168L; - - public InvalidPluginException(String message) { - super(message); - } - - public InvalidPluginException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/src/main/java/org/spongepowered/api/plugin/PluginContainer.java b/src/main/java/org/spongepowered/api/plugin/PluginContainer.java index 7ebc8f4928a..203a479dcac 100644 --- a/src/main/java/org/spongepowered/api/plugin/PluginContainer.java +++ b/src/main/java/org/spongepowered/api/plugin/PluginContainer.java @@ -46,7 +46,7 @@ public interface PluginContainer { String getVersion(); /** - * Returns the created instance of {@link org.spongepowered.api.plugin.Plugin} + * Returns the created instance of {@link org.spongepowered.api.plugin.Plugin}. *

* TODO Provide a way to not dereference this back to Object *