Skip to content

Commit

Permalink
Fix build issues and test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorinwasher committed Jan 21, 2024
1 parent a4bcff4 commit a344da4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/sgrewritten/stargate/Stargate.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ private void sendWarningMessages() {
Stargate.log(e);
}
}
long scheduledGateClearing = Long.parseLong(storedProperties.getProperty(StoredProperty.SCHEDULED_GATE_CLEARING));
if(scheduledGateClearing < System.currentTimeMillis()){
String scheduledGateClearingString = storedProperties.getProperty(StoredProperty.SCHEDULED_GATE_CLEARING);
if(scheduledGateClearingString != null && Long.parseLong(scheduledGateClearingString) < System.currentTimeMillis()){
try(InputStream inputStream = Stargate.class.getResourceAsStream("/messages/")){
Date date = new Date(scheduledGateClearing);
Date date = new Date(Long.parseLong(scheduledGateClearingString));
String dateString = date.toString();
String unformattedMessage = FileHelper.readStreamToString(inputStream);
String message = unformattedMessage.replace("%time%",dateString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ private void loadAllPortals(SQLDatabaseAPI database, StorageType portalType, Sta
statement.close();
}
removeWorlds(worldsToRemove, portalType);
if (Long.parseLong(propertiesDatabase.getProperty(StoredProperty.SCHEDULED_GATE_CLEARING)) > System.currentTimeMillis()) {
String scheduledGateFormatClearing = propertiesDatabase.getProperty(StoredProperty.SCHEDULED_GATE_CLEARING);
if (scheduledGateFormatClearing != null && Long.parseLong(scheduledGateFormatClearing) > System.currentTimeMillis()) {
removeGateFormats(gateFormatsToRemove, portalType);
} else {
invalidGateFormats.addAll(gateFormatsToRemove);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DELETE FROM {Portal}
WHERE gateFileName = ?;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DELETE FROM {InterPortal}
WHERE gateFileName = ? AND homeServerId = ?;
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.sgrewritten.stargate.network.StorageType;
import org.sgrewritten.stargate.network.portal.GlobalPortalId;

import java.util.HashSet;
import java.util.Set;
import java.util.Stack;

public class StorageMock implements StorageAPI {
Expand Down Expand Up @@ -127,4 +129,9 @@ public boolean netWorkExists(String netName, StorageType portalType) {
return false;
}

@Override
public Set<String> getScheduledGatesClearing() {
return new HashSet<>();
}

}

0 comments on commit a344da4

Please sign in to comment.