SteamWar/BauSystem
Archiviert
13
0

Improve join performance

Dieser Commit ist enthalten in:
Lixfel 2020-12-21 11:15:51 +01:00
Ursprung 57f26874a5
Commit edbba0f545

Datei anzeigen

@ -19,8 +19,10 @@
package de.steamwar.bausystem.world; package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.sql.Schematic; import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicType; import de.steamwar.sql.SchematicType;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -34,14 +36,16 @@ public class ClipboardListener implements Listener {
@EventHandler @EventHandler
public void onLogin(PlayerJoinEvent e){ public void onLogin(PlayerJoinEvent e){
try { Bukkit.getScheduler().runTaskAsynchronously(BauSystem.getPlugin(), () -> {
Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, e.getPlayer().getUniqueId()); try {
if(schematic != null){ Schematic schematic = Schematic.getSchemFromDB(CLIPBOARD_SCHEMNAME, e.getPlayer().getUniqueId());
schematic.loadToPlayer(e.getPlayer()); if(schematic != null){
schematic.loadToPlayer(e.getPlayer());
}
} catch (Exception ex) {
//ignore cause players do all kind of stuff with schematics.... like massively oversized schems
} }
} catch (Exception ex) { });
//ignore cause players do all kind of stuff with schematics.... like massively oversized schems
}
} }
@EventHandler @EventHandler