Skip to content

Commit

Permalink
Add simple GameRegistry interface
Browse files Browse the repository at this point in the history
Remove un-needed exception
  • Loading branch information
Chris Sanders committed Sep 10, 2014
1 parent 5d50dc4 commit c368a6d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 40 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/spongepowered/api/Game.java
Expand Up @@ -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.
*
Expand Down
23 changes: 23 additions & 0 deletions 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);
}

This file was deleted.

Expand Up @@ -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}.
* <p/>
* TODO Provide a way to not dereference this back to Object
*
Expand Down

0 comments on commit c368a6d

Please sign in to comment.