2.5.20 | bugfix

This commit is contained in:
JaTiTV 2022-01-08 07:47:49 +01:00
parent cb5f8a7350
commit 7e81c3403d
8 changed files with 37 additions and 12 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.5.19</version>
<version>2.5.20</version>
<packaging>jar</packaging>
<name>CommandGUI</name>

View File

@ -34,20 +34,24 @@ public class BListener implements Listener {
public void onJoin(PostLoginEvent e) {
ProxiedPlayer player = e.getPlayer();
sendToSpigotPlayer(player.getName(), true);
/*
if (BMySQL.Enable) {
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'true';");
}
*/
}
@EventHandler
public void onDisconnect(PlayerDisconnectEvent e) {
ProxiedPlayer player = e.getPlayer();
sendToSpigotPlayer(e.getPlayer().getName(), false);
/*
if (BMySQL.Enable) {
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = 'false';");
}
*/
}
@ -65,7 +69,8 @@ public class BListener implements Listener {
Logger.getLogger(e.getMessage());
}
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
server.sendData("cgui:onlineplayers", stream.toByteArray());
server.sendData("cgui:onlinepl", stream.toByteArray());
});
}
@ -79,7 +84,7 @@ public class BListener implements Listener {
Logger.getLogger(e.getMessage());
}
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
server.sendData("cgui:onlineplayers", stream.toByteArray());
server.sendData("cgui:onlinepl", stream.toByteArray());
});
}
}

View File

@ -42,17 +42,18 @@ public final class BMain extends Plugin {
Bsend.console(prefix + " §2Version: §6" + version);
Bsend.console(prefix + " §2Spigot: §6" + spigot);
Bsend.console(prefix + " §2Discord: §6" + discord);
try {
/* try {
BConfig.create();
} catch (IOException e) {
e.printStackTrace();
}
*/
plugin.getProxy().registerChannel("cgui:bungee");
plugin.getProxy().getPluginManager().registerListener(plugin, new BListener());
BListener.sendToSpigotDeleteAll();
BMetrics metrics = new BMetrics(this, bstatsID);
/*
if (BMySQL.Enable){
BMySQL.main();
BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" +
@ -64,8 +65,8 @@ public final class BMain extends Plugin {
"COLLATE='utf8mb4_general_ci'" +
"ENGINE=InnoDB" +
";");
}
*/
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
Bsend.console(prefix + "§4==============================================================================");

View File

@ -5,6 +5,7 @@ import de.jatitv.commandguiv2.Spigot.system.Give_UseItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.system.database.Select_Database;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -53,6 +54,9 @@ public class ItemChange {
@Override
public void run() {
Give_UseItem.onGive(player);
if (setCursor) {
setCursor(player, slot);
}
}
}.runTaskLater(Main.plugin, 1L * 1);
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin || SelectConfig.Cursor_ToGUIItem_OnLogin) {
@ -94,25 +98,37 @@ public class ItemChange {
}
private static void setCursor(Player player, int slot) {
send.debug(Main.plugin,"setCursor 1 Player: "+player.getName());
if (!SelectConfig.Cursor_ToGUIItem_OnLogin) {
return;
}
send.debug(Main.plugin,"setCursor 2 Player: "+player.getName());
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
if (!player.hasPlayedBefore()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 3 Player: "+player.getName());
}
return;
}
send.debug(Main.plugin,"setCursor 4 Player: "+player.getName());
if (!SelectConfig.Bungee) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 5 Player: "+player.getName());
return;
}
send.debug(Main.plugin,"setCursor 6 Player: "+player.getName());
if (SelectConfig.UseItem_ServerChange) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 7 Player: "+player.getName());
return;
}
send.debug(Main.plugin,"setCursor 8 Player: "+player.getName());
send.debug(Main.plugin,"setCursor bungeejoinplayers: " +Main.bungeejoinplayers);
send.debug(Main.plugin,"setCursor Player: " +player.getName());
if (Main.bungeejoinplayers.contains(player.getName())) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 9 Player: "+player.getName());
Main.bungeejoinplayers.remove(player.getName());
}
}

View File

@ -18,7 +18,6 @@ import java.util.logging.Logger;
public final class Main extends JavaPlugin {
public static ArrayList<String> bungeeplayers = new ArrayList<>();
public static ArrayList<String> bungeejoinplayers = new ArrayList<>();
public static File getPath() {

View File

@ -24,20 +24,20 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
send.debug(Main.plugin,"stream: "+stream.toString());
try {
String subChannel = stream.readUTF();
String input = stream.readUTF();
send.debug(Main.plugin,"subChannel: " +subChannel);
send.debug(Main.plugin,"input: " +input);
switch (subChannel) {
case "join":
Main.bungeeplayers.add(input);
Main.bungeejoinplayers.add(input);
break;
case "left":
Main.bungeeplayers.remove(input);
Main.bungeejoinplayers.remove(input);
break;
case "clear":
Main.bungeeplayers.clear();
Main.bungeejoinplayers.clear();
break;
}

View File

@ -61,9 +61,13 @@ public class Load {
if (SelectConfig.Bungee) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin,"cgui:bungee")){
send.debug(plugin, "registerIncomingPluginChannel §ecgui:bungee");
send.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin,"cgui:bungee");
}
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin,"cgui:onlinepl")){
send.debug(plugin, "registerIncomingPluginChannel §ecgui:onlinepl");
Bukkit.getMessenger().registerIncomingPluginChannel(plugin,"cgui:onlinepl", new Bungee_Sender_Reciver());
}
}
try {

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2;
public class Util {
private static double requiredT2CodeLibVersion = 8;
private static double requiredT2CodeLibVersion = 10.1;
private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840;