Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.velortex.proxysystem.main;
- import de.velortex.proxysystem.Commands.*;
- import de.velortex.proxysystem.Listener.*;
- import de.velortex.proxysystem.utils.TeamSpeak.Listener_ClientJoin;
- import de.velortex.proxysystem.utils.TeamSpeak.Listener_ClientLeave;
- import de.velortex.proxysystem.utils.TeamSpeak.TeamSpeak;
- import de.velortex.proxysystem.utils.autobroadcast.AutoBroadCastManager;
- import de.velortex.proxysystem.utils.autobroadcast.AutoBroadCastTask;
- import de.velortex.proxysystem.utils.chat.ChatManager;
- import de.velortex.proxysystem.utils.config.ConfigManager;
- import de.velortex.proxysystem.utils.mysql.MySQL;
- import de.velortex.proxysystem.utils.party.PartyManager;
- import de.velortex.proxysystem.utils.perms.PermissionManager;
- import de.velortex.proxysystem.utils.player.NetworkPlayer;
- import de.velortex.proxysystem.utils.tablist.TablistTask;
- import net.md_5.bungee.BungeeCord;
- import net.md_5.bungee.api.connection.ProxiedPlayer;
- import net.md_5.bungee.api.plugin.Plugin;
- import java.net.InetSocketAddress;
- import java.util.UUID;
- public class ProxySystem extends Plugin
- {
- private static ProxySystem instance;
- @Override
- public void onEnable() {
- instance = this;
- this.systemBootstrap();
- this.registerCommands();
- this.registerListener();
- this.registerTeamSpeakEvents();
- }
- @Override
- public void onDisable() {
- this.systemShutdown();
- }
- private void systemBootstrap() {
- new ConfigManager();
- new Cloud();
- new WebServer(new InetSocketAddress(ConfigManager.getInstance().getInt("config.yml", "system.webserverport")));
- new PartyManager();
- new MySQL("ProxySystem", ConfigManager.getInstance().getString("config.yml", "mysql.host"), ConfigManager.getInstance().getString("config.yml", "mysql.port"), ConfigManager.getInstance().getString("config.yml", "mysql.user"), ConfigManager.getInstance().getString("config.yml", "mysql.password"), ConfigManager.getInstance().getString("config.yml", "mysql.database"));
- new AutoBroadCastTask();
- new AutoBroadCastManager();
- new TablistTask();
- new TeamSpeakBot();
- ChatManager.loadBlacklistwords();
- PermissionManager.createGroup("default");
- }
- private void systemShutdown() {
- MySQL.getInstance().update("DELETE FROM `" + MySQL.getInstance().tabelprefix + "_reports`");
- MySQL.getInstance().update("DELETE FROM `" + MySQL.getInstance().tabelprefix + "_chatlog`");
- TeamSpeak.cleariconondisableplugin();
- TeamSpeakBot.getInstance().getApi().logout();
- TeamSpeakBot.getInstance().getQuery().exit();
- MySQL.getInstance().disconect();
- }
- private void registerCommands() {
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Accounts());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_AutoBroadcast());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Ban());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Broadcast());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_ChatLog());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_ChatSpy());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Check());
- //BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Clan());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_ClearChat());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_CommandLog());
- //BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Execute());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Find());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Friend());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_GetIP());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Help());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_JoinMe());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Jump());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_JumpTo());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Kick());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Leave());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_ls());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Maintenance());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Move());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Msg());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Mute());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Party());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Pc());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Ping());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_PlayerInfo());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_PlayTime());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_ProxyVersion());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_r());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_RandomPicker());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Report());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Reports());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_ReportStats());
- //BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_SilentBan());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Staff());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_TeamChat());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_TeamSpeak());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_TitleBroadcast());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_UnBan());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_UnMute());
- //BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_VeloPerms());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Verify());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Verify_Link());
- BungeeCord.getInstance().pluginManager.registerCommand(this, new Command_Verify_UnLink());
- }
- private void registerListener() {
- if (ConfigManager.getInstance().getBoolean("config.yml", "veloretexpermissions.enable")) {
- new Listener_PermissionCheck(this);
- }
- new Listener_ChatEvent(this);
- new Listener_PostLoginEvent(this);
- new Listener_ServerConnectEvent(this);
- new Listener_PluginMessageEvent(this);
- new Listener_ProxyPingEvent(this);
- new Listener_ServerSwitchEvent(this);
- new Listener_PlayerDisconnectEvent(this);
- //new Listener_TabCompleteEvent(this);
- }
- private void registerTeamSpeakEvents() {
- Listener_ClientJoin.register();
- Listener_ClientLeave.register();
- }
- public NetworkPlayer loadPlayer(final UUID uuid) throws Exception {
- final ProxiedPlayer player = this.getProxy().getPlayer(uuid);
- if (player == null) {
- throw new NullPointerException("Can't find the player `" + ((uuid == null) ? "unknown" : uuid.toString()) + "`");
- }
- return new NetworkPlayer(player.getUniqueId());
- }
- public boolean hasPermission(final UUID uuid, String permission, final boolean hasPermission) {
- permission = permission.toLowerCase();
- final NetworkPlayer player = NetworkPlayer.getPlayer(uuid);
- if (player != null && player.hasPermission("-" + permission)) {
- return false;
- }
- if (player != null && (player.hasPermission(permission) || player.hasPermission("*"))) {
- return true;
- }
- return false;
- }
- public static ProxySystem getInstance() {
- return instance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement