Remove unnecessary database calls that checked for siege weapons remaining in the database, which is not possible, as siege weapons clean themselves up.
This commit is contained in:
parent
eed3df720a
commit
9ccec50fd0
@ -1,7 +1,5 @@
|
||||
package mineplex.game.clans.clans.siege;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -188,8 +186,6 @@ public class SiegeManager extends MiniPlugin
|
||||
|
||||
private void saveSiegeWeapons()
|
||||
{
|
||||
final Stack<Runnable> queue = new Stack<>();
|
||||
|
||||
for (final SiegeWeapon weapon : LiveSiegeWeapons.values())
|
||||
{
|
||||
final SiegeWeaponToken token = weapon.toToken();
|
||||
@ -197,28 +193,10 @@ public class SiegeManager extends MiniPlugin
|
||||
if (UnsyncedSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)))
|
||||
continue;
|
||||
|
||||
queue.push(() -> {
|
||||
runAsync(() -> {
|
||||
_repository.updateWeapon(token);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
runAsync(() -> {
|
||||
while (!queue.isEmpty())
|
||||
{
|
||||
queue.pop().run();
|
||||
}
|
||||
|
||||
_repository.getWeaponsByServer(_clansManager.getServerId(), tokens -> {
|
||||
tokens.forEach(token -> {
|
||||
if (!LiveSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)) && !UnsyncedSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)))
|
||||
{
|
||||
System.out.println("LiveSiegeWeapons no longer contains old weapon " + token.UniqueId + ", deleting.");
|
||||
_repository.deleteWeapon(token.UniqueId);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user