Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public static void removeDiseaseType(final Creature creature) {
  2. byte newModtype = CreatureTypes.C_MOD_NONE;
  3. Connection dbcon = null;
  4. PreparedStatement ps = null;
  5. try {
  6. dbcon = DbConnector.getCreatureDbCon();
  7. if (creature.isPlayer()) {
  8. dbcon = DbConnector.getPlayerDbCon();
  9. ps = dbcon.prepareStatement("update PLAYERS set TYPE=? WHERE WURMID=?");
  10. } else {
  11. ps = dbcon.prepareStatement("update CREATURES set TYPE=? WHERE WURMID=?");
  12. }
  13. ps.setByte(1, newModtype);
  14. ps.setLong(2, creature.getWurmId());
  15. ps.executeUpdate();
  16. RequiemLogging.logInfo(String.format("Set type to %s for %d", newModtype, creature.getWurmId()));
  17. } catch (SQLException sqex) {
  18. RequiemLogging.logWarning(String.format("Failed to set type to %s for %d %s", newModtype, creature.getWurmId(), sqex.getMessage()));
  19. } finally {
  20. DbUtilities.closeDatabaseObjects(ps, null);
  21. DbConnector.returnConnection(dbcon);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement