2.5.13
This commit is contained in:
parent
6b6ebbcd18
commit
e0da2cd88d
@ -3,6 +3,8 @@ package de.jatitv.commandguiv2.Bungee;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
import net.t2code.lib.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -26,17 +28,30 @@ public class BConfig {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Configuration configuration;
|
||||
try {
|
||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
|
||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
|
||||
BMySQL.Enable = configuration.getBoolean("MySQL.Enable");
|
||||
} catch (IOException e) {
|
||||
Bsend.console(Util.Prefix + " Please replace the config: MySQL.Enable: [false,true]");
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(BMain.plugin.getDataFolder(), "config.yml"));
|
||||
BMySQL.ip = configuration.getString("MySQL.IP");
|
||||
BMySQL.port = configuration.getInt("MySQL.Port");
|
||||
BMySQL.database = configuration.getString("MySQL.Database");
|
||||
BMySQL.user = configuration.getString("MySQL.User");
|
||||
BMySQL.password = configuration.getString("MySQL.Password");
|
||||
BMySQL.SSL = configuration.getBoolean("MySQL.SSL");
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package de.jatitv.commandguiv2.Bungee;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.system.config.config.SelectConfig;
|
||||
import de.jatitv.commandguiv2.Spigot.system.database.MySQL;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
@ -13,7 +10,6 @@ import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class BListener implements Listener {
|
||||
@ -25,8 +21,6 @@ public class BListener implements Listener {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
ProxiedPlayer player = BungeeCord.getInstance().getPlayer(channel);
|
||||
|
||||
|
||||
if (player != null) {
|
||||
BungeeCord.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
@ -40,16 +34,21 @@ public class BListener implements Listener {
|
||||
public void onJoin(PostLoginEvent e) {
|
||||
ProxiedPlayer player = e.getPlayer();
|
||||
sendToSpigotPlayer(player.getName(), true);
|
||||
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = '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);
|
||||
BMySQL.query("INSERT INTO `gui-bungeeplayer` (`UUID`, `Name`, `Online`) VALUES ('" + player.getUniqueId() + "', '" + player.getName()
|
||||
+ "', 'true') ON DUPLICATE KEY UPDATE `Name` = '" + player.getName() + "', `Online` = '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';");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void sendToSpigotPlayer(String name, Boolean join) {
|
||||
|
@ -49,16 +49,19 @@ public final class BMain extends Plugin {
|
||||
BListener.sendToSpigotDeleteAll();
|
||||
BMetrics metrics = new BMetrics(this, bstatsID);
|
||||
|
||||
BMySQL.main();
|
||||
BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Online` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
if (BMySQL.Enable){
|
||||
BMySQL.main();
|
||||
BMySQL.query("CREATE TABLE IF NOT EXISTS `gui-bungeeplayer` (" +
|
||||
" `UUID` VARCHAR(191) NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Name` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" `Online` TINYTEXT NOT NULL COLLATE 'utf8mb4_general_ci'," +
|
||||
" UNIQUE INDEX `UUID` (`UUID`)" +
|
||||
")" +
|
||||
"COLLATE='utf8mb4_general_ci'" +
|
||||
"ENGINE=InnoDB" +
|
||||
";");
|
||||
|
||||
}
|
||||
|
||||
Bsend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||
Bsend.console(prefix + "§4==============================================================================");
|
||||
|
@ -12,6 +12,8 @@ import java.util.Calendar;
|
||||
|
||||
public class BMySQL {
|
||||
private static Plugin plugin = BMain.plugin;
|
||||
protected static Boolean Enable = false;
|
||||
|
||||
protected static String ip = "localhost";
|
||||
protected static Integer port = 3306;
|
||||
protected static String database;
|
||||
|
@ -2,10 +2,8 @@ package de.jatitv.commandguiv2.Spigot.system;
|
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main;
|
||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user