Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void removeDiseaseType(final Creature creature) {
- byte newModtype = CreatureTypes.C_MOD_NONE;
- Connection dbcon = null;
- PreparedStatement ps = null;
- try {
- dbcon = DbConnector.getCreatureDbCon();
- if (creature.isPlayer()) {
- dbcon = DbConnector.getPlayerDbCon();
- ps = dbcon.prepareStatement("update PLAYERS set TYPE=? WHERE WURMID=?");
- } else {
- ps = dbcon.prepareStatement("update CREATURES set TYPE=? WHERE WURMID=?");
- }
- ps.setByte(1, newModtype);
- ps.setLong(2, creature.getWurmId());
- ps.executeUpdate();
- RequiemLogging.logInfo(String.format("Set type to %s for %d", newModtype, creature.getWurmId()));
- } catch (SQLException sqex) {
- RequiemLogging.logWarning(String.format("Failed to set type to %s for %d %s", newModtype, creature.getWurmId(), sqex.getMessage()));
- } finally {
- DbUtilities.closeDatabaseObjects(ps, null);
- DbConnector.returnConnection(dbcon);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement