Merge branch 'development'

This commit is contained in:
Brianna 2021-02-25 16:56:37 -06:00
commit c91617d724
4 changed files with 15 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicSpawners</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>7.0.6</version>
<version>7.0.7</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>EpicSpawners-${project.version}</finalName>

View File

@ -51,15 +51,20 @@ public class DataManager extends DataManagerAbstract {
updateSpawnerStack(spawnerStack, spawnerStack.getCurrentTier().getIdentifyingName());
}
public void updateSpawnerStack(SpawnerStack stack, String tierBeforeUpdate) {
public void updateSpawnerStack(SpawnerStack spawnerStack, String tierBeforeUpdate) {
updateSpawnerStack(spawnerStack, spawnerStack.getSpawnerData().getIdentifyingName(), tierBeforeUpdate);
}
public void updateSpawnerStack(SpawnerStack stack, String dataBeforeUpdate, String tierBeforeUpdate) {
this.async(() -> this.databaseConnector.connect(connection -> {
String updateSpawnerStack = "UPDATE " + this.getTablePrefix() + "spawner_stacks SET amount = ?, tier = ? WHERE spawner_id = ? AND data_type = ? AND tier = ?";
String updateSpawnerStack = "UPDATE " + this.getTablePrefix() + "spawner_stacks SET amount = ?, data_type = ?, tier = ? WHERE spawner_id = ? AND data_type = ? AND tier = ?";
try (PreparedStatement statement = connection.prepareStatement(updateSpawnerStack)) {
statement.setInt(1, stack.getStackSize());
statement.setString(2, stack.getCurrentTier().getIdentifyingName());
statement.setInt(3, stack.getSpawner().getId());
statement.setString(4, stack.getSpawnerData().getIdentifyingName());
statement.setString(5, tierBeforeUpdate);
statement.setString(2, stack.getSpawnerData().getIdentifyingName());
statement.setString(3, stack.getCurrentTier().getIdentifyingName());
statement.setInt(4, stack.getSpawner().getId());
statement.setString(5, dataBeforeUpdate);
statement.setString(6, tierBeforeUpdate);
statement.executeUpdate();
}
}));

View File

@ -381,7 +381,7 @@ public class SpawnerManager {
for (SpawnerData spawnerData : getAllSpawnerData()) {
ConfigurationSection currentSection = spawnersSection.createSection(spawnerData.getIdentifyingName());
currentSection.set("Allowed", spawnerData.isActive());
currentSection.set("Active", spawnerData.isActive());
currentSection.set("Custom", spawnerData.isCustom());
currentSection.set("Custom-Goal", spawnerData.getKillGoal());
currentSection.set("Convertible", spawnerData.isConvertible());

View File

@ -133,7 +133,8 @@ public class SpawnerStack {
currentTier = data.getFirstTier();
if (!spawner.merge(this, oldTier))
plugin.getDataManager().updateSpawnerStack(this, oldTier.getIdentifyingName());
plugin.getDataManager().updateSpawnerStack(this, oldTier.getSpawnerData().getIdentifyingName(),
oldTier.getIdentifyingName());
try {
spawner.getCreatureSpawner().setSpawnedType(EntityType.valueOf(data.getIdentifyingName().toUpperCase()));
} catch (Exception e) {