13
0

Merge pull request 'Do not lose stack information in case of server overload command termination' (#38) from noStackUnwinding into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #38
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2023-12-06 16:22:05 +01:00
Commit 1385e69ed1

Datei anzeigen

@ -28,7 +28,7 @@ import de.steamwar.sql.SteamwarUser;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Deque; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@ -56,16 +56,16 @@ public class CommandPortal implements PortalHandler {
maxId = stackIds[i-1]; maxId = stackIds[i-1];
} }
Deque<Portal> stack = Portals.getStack(player); Iterator<Portal> stack = Portals.getStack(player).iterator();
String[] pieces = new String[stackIds.length]; String[] pieces = new String[stackIds.length];
while (maxId > 0) { while (maxId > 0) {
if(stack.isEmpty()) { if(!stack.hasNext()) {
LobbySystem.getPlugin().getLogger().log(Level.WARNING, "Stackportal with missing elements: " + player.getName() + " /" + command); LobbySystem.getPlugin().getLogger().log(Level.WARNING, "Stackportal with missing elements: " + player.getName() + " /" + command);
player.sendMessage("§cEigentlich solltest du gerade gar nicht durch dieses Portal durchgehen können..."); player.sendMessage("§cEigentlich solltest du gerade gar nicht durch dieses Portal durchgehen können...");
return; return;
} }
Portal portal = stack.pop(); Portal portal = stack.next();
if(portal.type() == PortalType.STACK) { if(portal.type() == PortalType.STACK) {
for(int i = 0; i < stackIds.length; i++) { for(int i = 0; i < stackIds.length; i++) {
if(stackIds[i] == maxId) { if(stackIds[i] == maxId) {