1 /* $Id$ */ 2 /*************************************************************************** 3 * (C) Copyright 2003-2010 - Stendhal * 4 *************************************************************************** 5 *************************************************************************** 6 * * 7 * This program is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation; either version 2 of the License, or * 10 * (at your option) any later version. * 11 * * 12 ***************************************************************************/ 13 package games.stendhal.server.core.rule; 14 15 import java.util.Collection; 16 17 import games.stendhal.server.core.rule.defaultruleset.DefaultCreature; 18 import games.stendhal.server.core.rule.defaultruleset.DefaultItem; 19 import games.stendhal.server.core.rule.defaultruleset.DefaultSpell; 20 import games.stendhal.server.entity.Entity; 21 import games.stendhal.server.entity.creature.Creature; 22 import games.stendhal.server.entity.item.Item; 23 import games.stendhal.server.entity.spell.Spell; 24 /** 25 * Ruleset Interface for resolving Entities in Stendhal. 26 * 27 * @author Matthias Totz 28 */ 29 public interface EntityManager { 30 addItem(DefaultItem item)31 boolean addItem(DefaultItem item); 32 addCreature(DefaultCreature creature)33 boolean addCreature(DefaultCreature creature); 34 addSpell(DefaultSpell spell)35 boolean addSpell(DefaultSpell spell); 36 37 /** 38 * @return a list of all Creatures that are used at least once. 39 */ getCreatures()40 Collection<Creature> getCreatures(); 41 populateCreatureList()42 public void populateCreatureList(); 43 44 /** 45 * @return a list of all Items that are being used at least once. 46 */ getItems()47 Collection<Item> getItems(); 48 49 /** 50 * gets a list of all configured creatures 51 * 52 * @return list of default creatures 53 */ getDefaultCreatures()54 public Collection<DefaultCreature> getDefaultCreatures(); 55 56 /** 57 * gets a list of all configured items 58 * 59 * @return list of default items 60 */ getDefaultItems()61 Collection<DefaultItem> getDefaultItems(); 62 63 /** 64 * Returns the entity or <code>null</code> if the class is unknown. 65 * 66 * @param clazz 67 * the creature class, must not be <code>null</code> 68 * @return the entity or <code>null</code> 69 * 70 */ getEntity(String clazz)71 Entity getEntity(String clazz); 72 73 /** 74 * returns the creature or <code>null</code> if the id is unknown. 75 * @param tileset 76 * 77 * @param id 78 * the tile id 79 * @return the creature or <code>null</code> 80 */ getCreature(String tileset, int id)81 Creature getCreature(String tileset, int id); 82 83 /** 84 * returns the creature or <code>null</code> if the clazz is unknown. 85 * 86 * @param clazz 87 * the creature class, must not be <code>null</code> 88 * @return the creature or <code>null</code> 89 * 90 * @throws NullPointerException 91 * if clazz is <code>null</code> 92 */ getCreature(String clazz)93 Creature getCreature(String clazz); 94 95 /** 96 * Returns the DefaultCreature or <code>null</code> if the clazz is 97 * unknown. 98 * 99 * @param clazz 100 * the creature class 101 * @return the creature or <code>null</code> 102 * @throws NullPointerException 103 * if clazz is <code>null</code> 104 */ getDefaultCreature(String clazz)105 DefaultCreature getDefaultCreature(String clazz); 106 107 /** 108 * Return true if the Entity is a creature. 109 * @param tileset 110 * 111 * @param id 112 * the tile id 113 * @return true if it is a creature, false otherwise 114 */ isCreature(String tileset, int id)115 boolean isCreature(String tileset, int id); 116 117 /** 118 * Return true if the Entity is a creature. 119 * 120 * @param clazz 121 * the creature class, must not be <code>null</code> 122 * @return true if it is a creature, false otherwise 123 * 124 */ isCreature(String clazz)125 boolean isCreature(String clazz); 126 127 /** 128 * Return true if the Entity is a Item. 129 * 130 * @param clazz 131 * the Item class, must not be <code>null</code> 132 * @return true if it is a Item, false otherwise 133 * 134 */ isItem(String clazz)135 boolean isItem(String clazz); 136 137 /** 138 * Returns the item or <code>null</code> if the clazz is unknown. 139 * 140 * @param clazz 141 * the item class, must not be <code>null</code> 142 * @return the item or <code>null</code> 143 * 144 */ getItem(String clazz)145 Item getItem(String clazz); 146 147 /** 148 * Retrieves a Spell or null if the spell is unknown. 149 * 150 * @param spell 151 * @return the spell or null if spell is unknown 152 */ getSpell(String spell)153 Spell getSpell(String spell); 154 155 /** 156 * checks if spellName points to an existing spell 157 * @param spellName 158 * @return true iff a spell with that name exists 159 */ isSpell(String spellName)160 boolean isSpell(String spellName); 161 162 /** 163 * @return a collection of spells that are used at least once 164 */ getSpells()165 Collection<Spell> getSpells(); 166 167 /** 168 * @return a collection of all available spells 169 */ getConfiguredSpells()170 Collection<String> getConfiguredSpells(); 171 172 } 173