mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
idk what i did this should probably be reverted
This commit is contained in:
parent
072879ad33
commit
6a0aa89410
@ -1,13 +1,13 @@
|
||||
package me.totalfreedom.plex;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.plex.cache.MongoPlayerData;
|
||||
import me.totalfreedom.plex.cache.SQLPlayerData;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.config.MainConfig;
|
||||
import me.totalfreedom.plex.listeners.ChatListener;
|
||||
import me.totalfreedom.plex.listeners.PlayerListener;
|
||||
import me.totalfreedom.plex.listener.ChatListener;
|
||||
import me.totalfreedom.plex.listener.PlayerListener;
|
||||
import me.totalfreedom.plex.rank.RankManager;
|
||||
import me.totalfreedom.plex.storage.MongoConnection;
|
||||
import me.totalfreedom.plex.storage.RedisConnection;
|
||||
@ -21,11 +21,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
@Setter
|
||||
public class Plex extends JavaPlugin
|
||||
{
|
||||
@Setter(AccessLevel.NONE)
|
||||
private static Plex plugin;
|
||||
|
||||
public static Plex plugin;
|
||||
public MainConfig config;
|
||||
|
||||
private StorageType storageType = StorageType.SQLITE;
|
||||
|
||||
private SQLConnection sqlConnection;
|
||||
@ -46,9 +43,7 @@ public class Plex extends JavaPlugin
|
||||
public void onLoad()
|
||||
{
|
||||
plugin = this;
|
||||
|
||||
config = new MainConfig(this);
|
||||
|
||||
saveResource("database.db", false);
|
||||
|
||||
sqlConnection = new SQLConnection();
|
||||
@ -95,12 +90,14 @@ public class Plex extends JavaPlugin
|
||||
rankManager.generateDefaultRanks();
|
||||
rankManager.importDefaultRanks();
|
||||
PlexLog.log("Rank Manager initialized");
|
||||
|
||||
getCommand("plex").setExecutor(new PlexCommand());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
config.save();
|
||||
/*if (redisConnection.getJedis().isConnected())
|
||||
{
|
||||
PlexLog.log("Disabling Redis/Jedis. No memory leaks in this Anarchy server !");
|
||||
|
6
src/main/java/me/totalfreedom/plex/PlexBase.java
Normal file
6
src/main/java/me/totalfreedom/plex/PlexBase.java
Normal file
@ -0,0 +1,6 @@
|
||||
package me.totalfreedom.plex;
|
||||
|
||||
public class PlexBase
|
||||
{
|
||||
protected static Plex plugin = Plex.plugin;
|
||||
}
|
16
src/main/java/me/totalfreedom/plex/command/PlexCommand.java
Normal file
16
src/main/java/me/totalfreedom/plex/command/PlexCommand.java
Normal file
@ -0,0 +1,16 @@
|
||||
package me.totalfreedom.plex.command;
|
||||
|
||||
import me.totalfreedom.plex.PlexBase;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class PlexCommand extends PlexBase implements CommandExecutor
|
||||
{
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command message, String s, String[] args)
|
||||
{
|
||||
sender.sendMessage(plugin.config.getString("server.test"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -6,9 +6,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class MainConfig extends YamlConfiguration
|
||||
{
|
||||
private static MainConfig config;
|
||||
private final Plex plugin;
|
||||
private final File file;
|
||||
private Plex plugin;
|
||||
private File file;
|
||||
|
||||
public MainConfig(Plex plugin)
|
||||
{
|
||||
|
@ -1,9 +1,8 @@
|
||||
package me.totalfreedom.plex.listeners;
|
||||
package me.totalfreedom.plex.listener;
|
||||
|
||||
import me.totalfreedom.plex.Plex;
|
||||
import me.totalfreedom.plex.cache.PlayerCache;
|
||||
import me.totalfreedom.plex.player.PlexPlayer;
|
||||
import me.totalfreedom.plex.rank.RankManager;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
@ -1,4 +1,4 @@
|
||||
package me.totalfreedom.plex.listeners;
|
||||
package me.totalfreedom.plex.listener;
|
||||
|
||||
import java.util.Arrays;
|
||||
import me.totalfreedom.plex.Plex;
|
@ -5,11 +5,10 @@ import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import me.totalfreedom.plex.Plex;
|
||||
import me.totalfreedom.plex.PlexBase;
|
||||
|
||||
public class SQLConnection
|
||||
public class SQLConnection extends PlexBase
|
||||
{
|
||||
private final Plex plugin = Plex.get();
|
||||
|
||||
private Connection connection;
|
||||
|
||||
public Connection getCon()
|
||||
@ -25,7 +24,7 @@ public class SQLConnection
|
||||
if (plugin.config.getString("data.central.storage").equalsIgnoreCase("sqlite"))
|
||||
{
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath());
|
||||
Plex.get().setStorageType(StorageType.SQLITE);
|
||||
plugin.setStorageType(StorageType.SQLITE);
|
||||
}
|
||||
else if (plugin.config.getString("data.central.storage").equalsIgnoreCase("mysql"))
|
||||
{
|
||||
@ -45,12 +44,12 @@ public class SQLConnection
|
||||
connection.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (\n" +
|
||||
"\t`uuid` VARCHAR(46),\n" +
|
||||
"\t`name` VARCHAR(18),\n" +
|
||||
"\t`login_msg` VARCHAR(256),\n" +
|
||||
"\t`prefix` VARCHAR(30),\n" +
|
||||
"\t`rank` VARCHAR(256),\n" +
|
||||
"\t`ips` VARCHAR(65535),\n" +
|
||||
"\t`coins` BIGINT,\n" +
|
||||
"\tPRIMARY KEY (`uuid`)\n" +
|
||||
"\t`login_msg` VARCHAR,\n" +
|
||||
"\t`prefix` VARCHAR,\n" +
|
||||
"\t`rank` VARCHAR,\n" +
|
||||
"\t`ips` VARCHAR,\n" +
|
||||
"\t`coins` INT\n" +
|
||||
//"\tPRIMARY KEY (`uuid`)\n" +
|
||||
");").execute();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,7 @@
|
||||
# -------------------------------#
|
||||
# #
|
||||
# P L E X #
|
||||
# #
|
||||
# -------------------------------#
|
||||
# Plex Configuration File
|
||||
|
||||
# ------------------------------ #
|
||||
# #
|
||||
# You can use MySQL, MongoDB #
|
||||
# or SQLite for the data #
|
||||
# type #
|
||||
# -------------------------------#
|
||||
server:
|
||||
test: "test string"
|
||||
|
||||
data:
|
||||
central:
|
||||
|
@ -2,4 +2,8 @@ name: ${project.name}
|
||||
version: ${project.version}
|
||||
author: Telesphoreo
|
||||
main: me.totalfreedom.plex.Plex
|
||||
api-version: 1.16
|
||||
api-version: 1.16
|
||||
commands:
|
||||
plex:
|
||||
description: Test
|
||||
usage: /<command>
|
Loading…
Reference in New Issue
Block a user