package com.ezardlabs.dethsquare.prefabs;

import com.ezardlabs.dethsquare.GameObject;

import java.util.HashMap;

public class PrefabManager {
	private static HashMap<String, PrefabCreator> prefabs = new HashMap<>();

	public static void addPrefab(String name, PrefabCreator prefab) {
		prefabs.put(name, prefab);
	}

	public static GameObject loadPrefab(String name) {
		return prefabs.get(name).create();
	}

	public static void removePrefab(String name, PrefabCreator prefab) {
		prefabs.remove(name);
	}
}

@@ -216,75 +216,374 @@
 );%0A%0A
-%09public static void addPrefab(String name, PrefabCreator prefab) %7B%0A
+%0A%09/**%0A%09 * Register a prefabricated %7B@link GameObject%7D%0A%09 *%0A%09 * @param name   The name to identify the prefab with%0A%09 * @param prefab The %7B@link PrefabCreator%7D used to create the GameObject%0A%09 */%0A%09public static void addPrefab(String name, PrefabCreator prefab) %7B%0A%09%09if (name.endsWith(%22_other%22)) %7B%0A%09%09%09throw new Error(%22Prefab name cannot end with %5C%22_other%5C%22%22);%0A%09%09%7D else %7B%0A%09
 %09%09pr
@@ -611,81 +611,904 @@
 b);%0A
+%09
 %09%7D%0A
-%0A%09public 
+%09%7D%0A%0A%09/**%0A%09 * Register a prefabricated %7B@link GameObject%7D that can be in
 sta
+n
 ti
-c GameObject loadPrefab(String name) %7B%0A%09%09return 
+ated across clients%0A%09 *%0A%09 * @param name        The name to identify the prefab with%0A%09 * @param prefab      The %7B@link PrefabCreator%7D used to create the GameObject%0A%09 * @param otherPrefab An alternate %7B@link PrefabCreator%7D to be used for instantiation on%0A%09 *                    every client except the caller - for example, you could have a%0A%09 *                    prefab for a player object that has a script that accepts input on%0A%09 *                    one client, but not on other clients. Can be null, in which case the%0A%09 *                    same %7B@link PrefabCreator%7D will be used on all clients%0A%09 */%0A%09public static void addPrefab(String name, PrefabCreator prefab, PrefabCreator otherPrefab) %7B%0A%09%09if (name.endsWith(%22_other%22)) %7B%0A%09%09%09throw new Error(%22Prefab name cannot end with %5C%22_other%5C%22%22);%0A%09%09%7D else %7B%0A%09%09%09
 prefabs.
 get(
@@ -1507,31 +1507,698 @@
 abs.
-ge
+pu
 t(name
-).create(
+, prefab);%0A%09%09%09prefabs.put(name + %22_other%22, otherPrefab
 );%0A
+%09
 %09%7D%0A
+%09%7D%0A%0A%09/**%0A%09 * Check whether or not a prefab exists%0A%09 *%0A%09 * @param name The name of the prefab%0A%09 * @return Whether or not a prefab with the given name exists%0A%09 */%0A%09public static boolean prefabExists(String name) %7B%0A%09%09return prefabs.containsKey(name);%0A%09%7D%0A%0A%09/**%0A%09 * Load the prefab with the given name%0A%09 *%0A%09 * @param name The name of the prefab to load%0A%09 * @return The %7B@link GameObject%7D prefab with the given name%0A%09 */%0A%09public static GameObject loadPrefab(String name) %7B%0A%09%09return prefabs.get(name).create();%0A%09%7D%0A%0A%09/**%0A%09 * Unregisters the prefab with the given name%0A%09 *%0A%09 * @param name The name of the prefab to unregister%0A%09 */
 %0A%09pu
@@ -2238,38 +2238,16 @@
 ing name
-, PrefabCreator prefab
 ) %7B%0A%09%09pr

Add documentation