mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 01:27: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;
|
package me.totalfreedom.plex;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.totalfreedom.plex.cache.MongoPlayerData;
|
import me.totalfreedom.plex.cache.MongoPlayerData;
|
||||||
import me.totalfreedom.plex.cache.SQLPlayerData;
|
import me.totalfreedom.plex.cache.SQLPlayerData;
|
||||||
|
import me.totalfreedom.plex.command.PlexCommand;
|
||||||
import me.totalfreedom.plex.config.MainConfig;
|
import me.totalfreedom.plex.config.MainConfig;
|
||||||
import me.totalfreedom.plex.listeners.ChatListener;
|
import me.totalfreedom.plex.listener.ChatListener;
|
||||||
import me.totalfreedom.plex.listeners.PlayerListener;
|
import me.totalfreedom.plex.listener.PlayerListener;
|
||||||
import me.totalfreedom.plex.rank.RankManager;
|
import me.totalfreedom.plex.rank.RankManager;
|
||||||
import me.totalfreedom.plex.storage.MongoConnection;
|
import me.totalfreedom.plex.storage.MongoConnection;
|
||||||
import me.totalfreedom.plex.storage.RedisConnection;
|
import me.totalfreedom.plex.storage.RedisConnection;
|
||||||
@ -21,11 +21,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
@Setter
|
@Setter
|
||||||
public class Plex extends JavaPlugin
|
public class Plex extends JavaPlugin
|
||||||
{
|
{
|
||||||
@Setter(AccessLevel.NONE)
|
public static Plex plugin;
|
||||||
private static Plex plugin;
|
|
||||||
|
|
||||||
public MainConfig config;
|
public MainConfig config;
|
||||||
|
|
||||||
private StorageType storageType = StorageType.SQLITE;
|
private StorageType storageType = StorageType.SQLITE;
|
||||||
|
|
||||||
private SQLConnection sqlConnection;
|
private SQLConnection sqlConnection;
|
||||||
@ -46,9 +43,7 @@ public class Plex extends JavaPlugin
|
|||||||
public void onLoad()
|
public void onLoad()
|
||||||
{
|
{
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
|
||||||
config = new MainConfig(this);
|
config = new MainConfig(this);
|
||||||
|
|
||||||
saveResource("database.db", false);
|
saveResource("database.db", false);
|
||||||
|
|
||||||
sqlConnection = new SQLConnection();
|
sqlConnection = new SQLConnection();
|
||||||
@ -95,12 +90,14 @@ public class Plex extends JavaPlugin
|
|||||||
rankManager.generateDefaultRanks();
|
rankManager.generateDefaultRanks();
|
||||||
rankManager.importDefaultRanks();
|
rankManager.importDefaultRanks();
|
||||||
PlexLog.log("Rank Manager initialized");
|
PlexLog.log("Rank Manager initialized");
|
||||||
|
|
||||||
|
getCommand("plex").setExecutor(new PlexCommand());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
config.save();
|
|
||||||
/*if (redisConnection.getJedis().isConnected())
|
/*if (redisConnection.getJedis().isConnected())
|
||||||
{
|
{
|
||||||
PlexLog.log("Disabling Redis/Jedis. No memory leaks in this Anarchy server !");
|
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
|
public class MainConfig extends YamlConfiguration
|
||||||
{
|
{
|
||||||
private static MainConfig config;
|
private Plex plugin;
|
||||||
private final Plex plugin;
|
private File file;
|
||||||
private final File file;
|
|
||||||
|
|
||||||
public MainConfig(Plex plugin)
|
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.Plex;
|
||||||
import me.totalfreedom.plex.cache.PlayerCache;
|
import me.totalfreedom.plex.cache.PlayerCache;
|
||||||
import me.totalfreedom.plex.player.PlexPlayer;
|
import me.totalfreedom.plex.player.PlexPlayer;
|
||||||
import me.totalfreedom.plex.rank.RankManager;
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
@ -1,4 +1,4 @@
|
|||||||
package me.totalfreedom.plex.listeners;
|
package me.totalfreedom.plex.listener;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import me.totalfreedom.plex.Plex;
|
import me.totalfreedom.plex.Plex;
|
@ -5,11 +5,10 @@ import java.sql.Connection;
|
|||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import me.totalfreedom.plex.Plex;
|
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;
|
private Connection connection;
|
||||||
|
|
||||||
public Connection getCon()
|
public Connection getCon()
|
||||||
@ -25,7 +24,7 @@ public class SQLConnection
|
|||||||
if (plugin.config.getString("data.central.storage").equalsIgnoreCase("sqlite"))
|
if (plugin.config.getString("data.central.storage").equalsIgnoreCase("sqlite"))
|
||||||
{
|
{
|
||||||
connection = DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath());
|
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"))
|
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" +
|
connection.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (\n" +
|
||||||
"\t`uuid` VARCHAR(46),\n" +
|
"\t`uuid` VARCHAR(46),\n" +
|
||||||
"\t`name` VARCHAR(18),\n" +
|
"\t`name` VARCHAR(18),\n" +
|
||||||
"\t`login_msg` VARCHAR(256),\n" +
|
"\t`login_msg` VARCHAR,\n" +
|
||||||
"\t`prefix` VARCHAR(30),\n" +
|
"\t`prefix` VARCHAR,\n" +
|
||||||
"\t`rank` VARCHAR(256),\n" +
|
"\t`rank` VARCHAR,\n" +
|
||||||
"\t`ips` VARCHAR(65535),\n" +
|
"\t`ips` VARCHAR,\n" +
|
||||||
"\t`coins` BIGINT,\n" +
|
"\t`coins` INT\n" +
|
||||||
"\tPRIMARY KEY (`uuid`)\n" +
|
//"\tPRIMARY KEY (`uuid`)\n" +
|
||||||
");").execute();
|
");").execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,7 @@
|
|||||||
# -------------------------------#
|
# Plex Configuration File
|
||||||
# #
|
|
||||||
# P L E X #
|
|
||||||
# #
|
|
||||||
# -------------------------------#
|
|
||||||
|
|
||||||
# ------------------------------ #
|
server:
|
||||||
# #
|
test: "test string"
|
||||||
# You can use MySQL, MongoDB #
|
|
||||||
# or SQLite for the data #
|
|
||||||
# type #
|
|
||||||
# -------------------------------#
|
|
||||||
|
|
||||||
data:
|
data:
|
||||||
central:
|
central:
|
||||||
|
@ -3,3 +3,7 @@ version: ${project.version}
|
|||||||
author: Telesphoreo
|
author: Telesphoreo
|
||||||
main: me.totalfreedom.plex.Plex
|
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