1 /** 2 * Copyright 2006 Matthew Purland (m.purland@gmail.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package net.sf.mud4j.character; 18 19 import java.io.IOException; 20 import java.util.List; 21 22 import net.sf.mud4j.ability.CharacterAbility; 23 import net.sf.mud4j.damage.DamageBehavior; 24 import net.sf.mud4j.damage.Damageable; 25 import net.sf.mud4j.services.ConnectionService; 26 import net.sf.mud4j.world.item.Item; 27 28 /** 29 * Player character for non-autonomous characters. 30 * 31 * @author Matthew Purland 32 */ 33 public class PlayerCharacter extends AbstractCharacter implements Damageable { 34 35 private Character character; 36 private ConnectionService connectionService; 37 38 public PlayerCharacter(Character character, ConnectionService connectionService) { 39 this.character = character; 40 this.connectionService = connectionService; 41 } 42 43 /** 44 * {@inheritDoc} 45 */ 46 public List<CharacterAbility> getAbilities() { 47 return character.getAbilities(); 48 } 49 50 /** 51 * {@inheritDoc} 52 */ 53 public List<Item> getItems() { 54 return character.getItems(); 55 } 56 57 /** 58 * {@inheritDoc} 59 */ 60 public String getName() { 61 return character.getName(); 62 } 63 64 /** 65 * {@inheritDoc} 66 */ 67 public boolean hasAbility(CharacterAbility ability) { 68 return character.hasAbility(ability); 69 } 70 71 /** 72 * {@inheritDoc} 73 */ 74 public boolean hasItem(Item item) { 75 return character.hasItem(item); 76 } 77 78 /** 79 * {@inheritDoc} 80 */ 81 public void message(String message) throws IOException { 82 connectionService.message(message); 83 } 84 }