diff --git a/pom.xml b/pom.xml
index 41723d4..6a74a3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
com.songoda
UltimateStacker
4.0.0
- 2.1.5
+ 2.1.6
clean install
UltimateStacker-${project.version}
@@ -118,7 +118,7 @@
com.songoda
SongodaCore
- LATEST
+ 2.4.55
compile
diff --git a/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java b/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java
index d3e9785..5756dd8 100644
--- a/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java
+++ b/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java
@@ -11,6 +11,7 @@ import com.songoda.core.database.DatabaseConnector;
import com.songoda.core.database.MySQLConnector;
import com.songoda.core.database.SQLiteConnector;
import com.songoda.core.gui.GuiManager;
+import com.songoda.core.hooks.EntityStackerManager;
import com.songoda.core.hooks.HologramManager;
import com.songoda.core.hooks.WorldGuardHook;
import com.songoda.core.utils.TextUtils;
@@ -25,6 +26,7 @@ import com.songoda.ultimatestacker.database.DataManager;
import com.songoda.ultimatestacker.database.migrations._1_InitialMigration;
import com.songoda.ultimatestacker.database.migrations._2_EntityStacks;
import com.songoda.ultimatestacker.database.migrations._3_BlockStacks;
+import com.songoda.ultimatestacker.database.migrations._4_DataPurge;
import com.songoda.ultimatestacker.hook.StackerHook;
import com.songoda.ultimatestacker.hook.hooks.JobsHook;
import com.songoda.ultimatestacker.listeners.*;
@@ -196,6 +198,7 @@ public class UltimateStacker extends SongodaPlugin {
stackerHooks.add(new JobsHook());
HologramManager.load(this);
+ EntityStackerManager.load();
// Database stuff, go!
try {
@@ -222,7 +225,8 @@ public class UltimateStacker extends SongodaPlugin {
this.dataMigrationManager = new DataMigrationManager(this.databaseConnector, this.dataManager,
new _1_InitialMigration(),
new _2_EntityStacks(),
- new _3_BlockStacks());
+ new _3_BlockStacks(),
+ new _4_DataPurge());
this.dataMigrationManager.runMigrations();
}
diff --git a/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java b/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java
index bea99df..01d36c8 100644
--- a/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java
+++ b/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java
@@ -46,8 +46,10 @@ public class CommandRemoveAll extends AbstractCommand {
for (Entity entityO : world.getEntities()) {
if (entityO instanceof Player) continue;
- if (entityO instanceof LivingEntity && (stackManager.isStackedAndLoaded((LivingEntity)entityO) || all) && type.equalsIgnoreCase("entities")) {
+ if (entityO instanceof LivingEntity && (stackManager.isStackedAndLoaded((LivingEntity)entityO) || all)
+ && type.equalsIgnoreCase("entities")) {
entityO.remove();
+ plugin.getEntityStackManager().removeStack(entityO);
amountRemoved++;
} else if (entityO.getType() == EntityType.DROPPED_ITEM && type.equalsIgnoreCase("items")) {
if (!UltimateStacker.hasCustomAmount((Item)entityO) && !all)
diff --git a/src/main/java/com/songoda/ultimatestacker/database/DataManager.java b/src/main/java/com/songoda/ultimatestacker/database/DataManager.java
index 5a35604..1894f18 100644
--- a/src/main/java/com/songoda/ultimatestacker/database/DataManager.java
+++ b/src/main/java/com/songoda/ultimatestacker/database/DataManager.java
@@ -3,6 +3,7 @@ package com.songoda.ultimatestacker.database;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.database.DataManagerAbstract;
import com.songoda.core.database.DatabaseConnector;
+import com.songoda.ultimatestacker.settings.Settings;
import com.songoda.ultimatestacker.stackable.block.BlockStack;
import com.songoda.ultimatestacker.stackable.entity.ColdEntityStack;
import com.songoda.ultimatestacker.stackable.entity.EntityStack;
@@ -16,6 +17,7 @@ import org.bukkit.plugin.Plugin;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -152,7 +154,7 @@ public class DataManager extends DataManagerAbstract {
public void updateHost(ColdEntityStack hostStack) {
this.async(() -> this.databaseConnector.connect(connection -> {
- String updateHost = "UPDATE " + this.getTablePrefix() + "host_entities SET uuid = ?, create_duplicates = ? WHERE id = ?";
+ String updateHost = "UPDATE " + this.getTablePrefix() + "host_entities SET uuid = ?, create_duplicates = ?, updated_at = current_timestamp WHERE id = ?";
try (PreparedStatement statement = connection.prepareStatement(updateHost)) {
if (hostStack.getHostUniqueId() == null) return;
statement.setString(1, hostStack.getHostUniqueId().toString());
@@ -225,9 +227,25 @@ public class DataManager extends DataManagerAbstract {
public void getEntities(Consumer