Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgift committed Jul 7, 2024
2 parents 546d617 + d4f82ca commit ac1bf25
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions game/src/main/java/net/driftingsouls/ds2/server/ships/Ship.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import net.driftingsouls.ds2.server.units.UnitCargo;
import net.driftingsouls.ds2.server.units.UnitCargoEntry;
import net.driftingsouls.ds2.server.werften.ShipWerft;
import net.driftingsouls.ds2.server.werften.WerftObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand Down Expand Up @@ -2191,15 +2192,11 @@ public void destroy() {
.setParameter("id", this)
.executeUpdate();

ShipWerft werft = db.createQuery("from ShipWerft where ship=:ship", ShipWerft.class)
.setParameter("ship", this)
.getSingleResult();
db.createQuery("from ShipWerft where ship=:ship", ShipWerft.class)
.setParameter("ship", this)
.getResultList().stream().findFirst().ifPresent(WerftObject::destroy);

if( werft != null ) {
werft.destroy();
}

// Delete Trade Limits if necessary
// Delete Trade Limits if necessary
if (this.isTradepost())
{
db.createQuery("delete from ResourceLimit where ship=:ship").setParameter("ship", this).executeUpdate();
Expand Down

0 comments on commit ac1bf25

Please sign in to comment.