diff --git a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Listener/PluginChannelCommunicator.java b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Listener/PluginChannelCommunicator.java index 450ba1f6..552e96c7 100644 --- a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Listener/PluginChannelCommunicator.java +++ b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Listener/PluginChannelCommunicator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 GeorgH93 + * Copyright (C) 2024 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import at.pcgamingfreaks.MarriageMaster.Bukkit.MarriageMaster; import at.pcgamingfreaks.MarriageMaster.Database.PluginChannelCommunicatorBase; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -202,6 +203,16 @@ public void sendMessage(final byte[] data) } private void sendMessage(String channel, byte[] data) + { + if (Bukkit.isPrimaryThread()) + performSendMessage(channel, data); + else + { + Bukkit.getScheduler().runTask(plugin, () -> performSendMessage(channel, data)); + } + } + + private void performSendMessage(String channel, byte[] data) { if(!plugin.getServer().getOnlinePlayers().isEmpty()) { diff --git a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/HomeCommand.java b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/HomeCommand.java index ca44e703..b4beb4e3 100644 --- a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/HomeCommand.java +++ b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/HomeCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 GeorgH93 + * Copyright (C) 2024 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -257,7 +257,7 @@ public void sendHome(final ProxiedPlayer player, final Marriage marriage) if(!player.getServer().getInfo().getName().equals(homeServer.getName())) { player.connect(homeServer); - plugin.getProxy().getScheduler().schedule(plugin, () -> sendHome(homeServer, player.getUniqueId(), (player.equals(marriage.getPartner1().getPlayer()) ? marriage.getPartner2() : marriage.getPartner1()).getUUID()), 1L, TimeUnit.SECONDS); + plugin.getProxy().getScheduler().schedule(plugin, () -> sendHome(homeServer, player.getUniqueId(), (player.equals(marriage.getPartner1().getPlayer()) ? marriage.getPartner2() : marriage.getPartner1()).getUUID()), 2L, TimeUnit.SECONDS); } else { diff --git a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/TpCommand.java b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/TpCommand.java index 59d48318..f3f01113 100644 --- a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/TpCommand.java +++ b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bungee/Commands/TpCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 GeorgH93 + * Copyright (C) 2024 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -138,7 +138,7 @@ public void sendTP(final ProxiedPlayer player, final ProxiedPlayer partner) if(!player.getServer().getInfo().getName().equals(partnerServer.getName())) { player.connect(partner.getServer().getInfo()); - plugin.getProxy().getScheduler().schedule(plugin, () -> communicator.sendMessage(partner.getServer().getInfo(), "tp", player.getUniqueId().toString(), partner.getUniqueId().toString()), 1L, TimeUnit.SECONDS); + plugin.getProxy().getScheduler().schedule(plugin, () -> communicator.sendMessage(partner.getServer().getInfo(), "tp", player.getUniqueId().toString(), partner.getUniqueId().toString()), 2L, TimeUnit.SECONDS); } else { diff --git a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/Backend/SQL.java b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/Backend/SQL.java index ec97d611..ec7779d7 100644 --- a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/Backend/SQL.java +++ b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/Backend/SQL.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 GeorgH93 + * Copyright (C) 2024 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -548,21 +548,18 @@ public void updatePriestStatus(final @NotNull MARRIAGE_PLAYER player, final @Nul public void updateHome(final @NotNull MARRIAGE marriage, final @Nullable Consumer updateCallback) { Home home = marriage.getHome(); - if(home == null) + if (home == null) { runStatementAsyncIncludeKey(queryDelHome, marriage); } + else if(useBungee) + { + runStatementAsyncIncludeKeyFirst((updateCallback != null) ? () -> updateCallback.accept(marriage) : null, + queryUpdateHome, marriage, home.getX(), home.getY(), home.getZ(), home.getYaw(), home.getPitch(), home.getWorldName(), home.getHomeServer()); + } else { - if(useBungee) - { - runStatementAsyncIncludeKeyFirst((updateCallback != null) ? () -> updateCallback.accept(marriage) : null, - queryUpdateHome, marriage, home.getX(), home.getY(), home.getZ(), home.getYaw(), home.getPitch(), home.getWorldName(), home.getHomeServer()); - } - else - { - runStatementAsyncIncludeKeyFirst(queryUpdateHome, marriage, home.getX(), home.getY(), home.getZ(), home.getYaw(), home.getPitch(), home.getWorldName()); - } + runStatementAsyncIncludeKeyFirst(queryUpdateHome, marriage, home.getX(), home.getY(), home.getZ(), home.getYaw(), home.getPitch(), home.getWorldName()); } } diff --git a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/BaseDatabase.java b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/BaseDatabase.java index 2ef4630a..e9356eea 100644 --- a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/BaseDatabase.java +++ b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Database/BaseDatabase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 GeorgH93 + * Copyright (C) 2024 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,6 @@ import at.pcgamingfreaks.ConsoleColor; import at.pcgamingfreaks.Database.ConnectionProvider.ConnectionProvider; import at.pcgamingfreaks.MarriageMaster.API.Home; -import at.pcgamingfreaks.MarriageMaster.API.Marriage; import at.pcgamingfreaks.MarriageMaster.API.MarriageMasterPlugin; import at.pcgamingfreaks.MarriageMaster.Database.Backend.DatabaseBackend; import at.pcgamingfreaks.MarriageMaster.Database.Backend.MySQL; diff --git a/pom.xml b/pom.xml index 08c465d4..9093bd07 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pom - 2.7.2 + 2.7.3 UTF-8 UTF-8 1.15.2-R0.1-SNAPSHOT