From: Hendrik B. <nh...@us...> - 2010-04-15 14:22:04
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/common/constants In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv4453/src/games/stendhal/common/constants Modified Files: DamageType.java Log Message: simplified parse Index: DamageType.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/common/constants/DamageType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DamageType.java 14 Apr 2010 13:26:09 -0000 1.1 --- DamageType.java 15 Apr 2010 14:21:56 -0000 1.2 *************** *** 13,31 **** DARK; public static DamageType parse(String type) { ! if ("cut".equals(type)) { return CUT; - } else if ("fire".equals(type)) { - return FIRE; - } else if ("ice".equals(type)) { - return ICE; - } else if ("light".equals(type)) { - return LIGHT; - } else if ("dark".equals(type)) { - return DARK; } - - Logger.getLogger(DamageType.class).error("Unknown damage type: " + type); - return CUT; } } --- 13,29 ---- DARK; + /** + * Parses the DamageType, defaulting to CUT for unknown types. + * + * @param type type name + * @return DamageType + */ public static DamageType parse(String type) { ! try { ! return DamageType.valueOf(type); ! } catch (RuntimeException e) { ! Logger.getLogger(DamageType.class).error("Unknown damage type: " + type, e); return CUT; } } } |