Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.lsrvbungeecore;
- import net.md_5.bungee.api.ProxyServer;
- import net.md_5.bungee.api.connection.ProxiedPlayer;
- import net.md_5.bungee.api.plugin.*;
- import java.nio.file.*;
- import net.md_5.bungee.config.*;
- import ru.lsrvbungeecore.CommandPack.findcmd;
- import ru.lsrvbungeecore.CommandPack.pingcmd;
- import ru.lsrvbungeecore.tab.Tab;
- import java.io.*;
- public class main extends Plugin {
- public Configuration config;
- public File f;
- public static main instance;
- @SuppressWarnings("unchecked")
- public void onEnable(){
- instance = this;
- Tab.tabset();
- getProxy().getPluginManager().registerCommand(this, new pingcmd());
- getProxy().getPluginManager().registerCommand(this, new findcmd());
- getProxy().getPluginManager().registerListener(this, new Listeners());
- this.getDataFolder().mkdirs();
- this.f = new File(this.getDataFolder(), "config.yml");
- if (!this.f.exists()) {
- try {
- Files.copy(this.getResourceAsStream("config.yml"), this.f.toPath(), new CopyOption[0]);
- }
- catch (Exception ex) {}
- }
- try {
- this.config = ConfigurationProvider.getProvider((Class)YamlConfiguration.class).load(this.f);
- }
- catch (IOException ex2) {}
- File db = new File(getDataFolder() + File.separator + "base.db");
- if(!db.exists()) {
- try {
- db.createNewFile();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- public String getObject(final ProxiedPlayer p, final String object) {
- try {
- int i = 0;
- String object2 = "";
- for (final String a : this.config.getStringList(object)) {
- if (++i > 1) {
- object2 = String.valueOf(object2) + "\n";
- }
- object2 = String.valueOf(object2) + a;
- }
- final int online = ProxyServer.getInstance().getOnlineCount();
- final int ping = p.getPing();
- final String nick = p.getName();
- String server = "§aLoading..";
- try {
- server = p.getServer().getInfo().getName();
- }
- catch (Exception var8) {
- System.out.println("\u0418\u0433\u0440\u043e\u043a " + p.getName() + " \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043d\u0438 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443?!");
- }
- return object2.replace("null", "").replaceAll("&", "§").replaceAll("%online%", String.valueOf(online)).replaceAll("%server%", String.valueOf(server)).replaceAll("%ping%", String.valueOf(ping)).replaceAll("%name%", String.valueOf(nick));
- }
- catch (Exception var7) {
- var7.printStackTrace();
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment