2016-04-13 05:52:53 +02:00
|
|
|
package eu.univento.core;
|
|
|
|
|
2016-08-03 00:15:45 +02:00
|
|
|
import eu.univento.commons.Commons;
|
|
|
|
import eu.univento.commons.server.TPS;
|
2017-06-04 13:42:10 +02:00
|
|
|
import eu.univento.core.antihack.AntiHack;
|
2016-04-13 05:52:53 +02:00
|
|
|
import eu.univento.core.api.Config;
|
2017-06-04 13:42:10 +02:00
|
|
|
import eu.univento.core.api.command.CommandFramework;
|
2016-07-28 20:17:25 +02:00
|
|
|
import eu.univento.core.api.effects.Blackscreen;
|
2016-04-13 05:52:53 +02:00
|
|
|
import eu.univento.core.api.events.MoveEventFilter;
|
2016-09-19 17:21:39 +02:00
|
|
|
import eu.univento.core.api.items.InventoryManager;
|
2016-04-13 05:52:53 +02:00
|
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
|
|
import eu.univento.core.commands.*;
|
|
|
|
import eu.univento.core.listeners.*;
|
2017-06-04 13:42:10 +02:00
|
|
|
import eu.univento.core.listeners.cloud.Servers;
|
2016-12-06 19:47:49 +01:00
|
|
|
import lombok.Getter;
|
2016-04-13 05:52:53 +02:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.plugin.PluginManager;
|
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
2016-07-28 20:17:25 +02:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.LinkedList;
|
2016-04-13 05:52:53 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* main class
|
2016-07-28 20:17:25 +02:00
|
|
|
*
|
2016-04-13 05:52:53 +02:00
|
|
|
* @author joethei
|
|
|
|
* @version 1.0
|
|
|
|
*/
|
2017-06-04 13:42:10 +02:00
|
|
|
public class Core extends JavaPlugin{
|
2016-07-28 20:17:25 +02:00
|
|
|
|
2017-06-04 13:42:10 +02:00
|
|
|
@Getter private static Core instance;
|
|
|
|
@Getter private static Commons commons;
|
|
|
|
@Getter private static CommandFramework commandFramework;
|
2016-04-13 05:52:53 +02:00
|
|
|
|
2016-08-03 00:15:45 +02:00
|
|
|
public static String getNMSVersion() {
|
|
|
|
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
|
|
|
return packageName.substring(packageName.lastIndexOf('.') + 1);
|
|
|
|
}
|
|
|
|
|
2016-07-28 20:17:25 +02:00
|
|
|
public static Collection<CustomPlayer> getOnlinePlayers() {
|
|
|
|
Collection<CustomPlayer> list = new LinkedList<>();
|
|
|
|
for (Player players : Bukkit.getOnlinePlayers()) {
|
2016-04-13 05:52:53 +02:00
|
|
|
CustomPlayer p = CustomPlayer.getPlayer(players);
|
|
|
|
list.add(p);
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2016-07-28 20:17:25 +02:00
|
|
|
@Override
|
|
|
|
public void onEnable() {
|
2016-08-03 00:15:45 +02:00
|
|
|
commons = new Commons();
|
2017-06-04 13:42:10 +02:00
|
|
|
|
|
|
|
System.out.println("\n" +
|
2016-06-25 15:42:06 +02:00
|
|
|
"\n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" _ _ _ \n" +
|
|
|
|
" | | | | (_) \n" +
|
|
|
|
" ___ ___ _ ____ _____ _ __ ___| |_ __ _ _ __| |_ _ _ __ __ _ \n" +
|
|
|
|
"/ __|/ _ \\ '__\\ \\ / / _ \\ '__| / __| __/ _` | '__| __| | '_ \\ / _` |\n" +
|
|
|
|
"\\__ \\ __/ | \\ V / __/ | \\__ \\ || (_| | | | |_| | | | | (_| |\n" +
|
|
|
|
"|___/\\___|_| \\_/ \\___|_| |___/\\__\\__,_|_| \\__|_|_| |_|\\__, |\n" +
|
|
|
|
" __/ |\n" +
|
|
|
|
" |___/ \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
"\n");
|
2016-07-28 20:17:25 +02:00
|
|
|
try {
|
|
|
|
Config.writeDefault();
|
2016-12-06 19:47:49 +01:00
|
|
|
} catch (IOException e) {
|
2016-07-28 20:17:25 +02:00
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
instance = this;
|
|
|
|
PluginManager pm = Bukkit.getPluginManager();
|
|
|
|
pm.registerEvents(new Commands(), this);
|
|
|
|
pm.registerEvents(new JoinQuit(), this);
|
|
|
|
pm.registerEvents(new Chat(), this);
|
|
|
|
pm.registerEvents(new Events(), this);
|
|
|
|
pm.registerEvents(new WeaponEvents(), this);
|
|
|
|
pm.registerEvents(new SpectatorEvents(), this);
|
|
|
|
pm.registerEvents(new MoveEventFilter(getServer()), this);
|
2016-09-19 17:21:39 +02:00
|
|
|
pm.registerEvents(new InventoryManager(), this);
|
2017-06-04 13:42:10 +02:00
|
|
|
pm.registerEvents(new WorkbenchEvents(), this);
|
|
|
|
pm.registerEvents(new NPCEvents(), this);
|
2016-07-28 20:17:25 +02:00
|
|
|
|
2017-06-04 13:42:10 +02:00
|
|
|
commandFramework = new CommandFramework(this);
|
|
|
|
|
|
|
|
commandFramework.registerCommands(new DevCommands());
|
|
|
|
commandFramework.registerCommands(new ModCommands());
|
|
|
|
commandFramework.registerCommands(new BuilderCommands());
|
|
|
|
commandFramework.registerCommands(new VIPCommands());
|
|
|
|
commandFramework.registerCommands(new PlayerCommands());
|
|
|
|
|
|
|
|
commandFramework.registerCommands(new HologramCommands());
|
|
|
|
|
|
|
|
new AntiHack().registerListeners();
|
2016-07-28 20:17:25 +02:00
|
|
|
|
|
|
|
new SetRank(this, "setrank", "sets the rank for other players", "sr");
|
|
|
|
|
|
|
|
PluginMessenger pluginMessenger = new PluginMessenger();
|
|
|
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "5zig_Set");
|
|
|
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, "5zig_Set", pluginMessenger);
|
|
|
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "LABYMOD");
|
|
|
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, "WDL|INIT", pluginMessenger);
|
|
|
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "WDL|CONTROL");
|
|
|
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, "WDL|REQUEST", pluginMessenger);
|
|
|
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, "PERMISSIONSREPL", pluginMessenger);
|
|
|
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "schematica");
|
|
|
|
|
2017-06-04 13:42:10 +02:00
|
|
|
Servers.register();
|
|
|
|
|
2016-07-28 20:17:25 +02:00
|
|
|
Blackscreen.setupUtil(getInstance());
|
2017-06-04 13:42:10 +02:00
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, () -> System.out.println("\n" +
|
2016-06-25 15:42:06 +02:00
|
|
|
"\n" +
|
|
|
|
"\n" +
|
|
|
|
" _ _ \n" +
|
|
|
|
" | (_) \n" +
|
|
|
|
" ___ ___ _ ____ _____ _ __ ___ _ __ | |_ _ __ ___ \n" +
|
|
|
|
"/ __|/ _ \\ '__\\ \\ / / _ \\ '__| / _ \\| '_ \\| | | '_ \\ / _ \\\n" +
|
|
|
|
"\\__ \\ __/ | \\ V / __/ | | (_) | | | | | | | | | __/\n" +
|
|
|
|
"|___/\\___|_| \\_/ \\___|_| \\___/|_| |_|_|_|_| |_|\\___|\n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
"\n"), 0L);
|
2017-06-04 13:42:10 +02:00
|
|
|
|
2016-08-03 00:15:45 +02:00
|
|
|
Bukkit.getScheduler().runTask(this, new TPS());
|
2016-07-28 20:17:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDisable() {
|
|
|
|
Bukkit.getMessenger().unregisterIncomingPluginChannel(this);
|
|
|
|
Bukkit.getMessenger().unregisterOutgoingPluginChannel(this);
|
2016-05-08 10:45:34 +02:00
|
|
|
|
2017-06-04 13:42:10 +02:00
|
|
|
System.out.println("\n" +
|
2016-06-25 15:42:06 +02:00
|
|
|
"\n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" _ _ _ \n" +
|
|
|
|
" | | | | | | \n" +
|
|
|
|
" ___ ___ _ ____ _____ _ __ ___| |__ _ _| |_ __| | _____ ___ __ \n" +
|
|
|
|
"/ __|/ _ \\ '__\\ \\ / / _ \\ '__| / __| '_ \\| | | | __/ _` |/ _ \\ \\ /\\ / / '_ \\ \n" +
|
|
|
|
"\\__ \\ __/ | \\ V / __/ | \\__ \\ | | | |_| | || (_| | (_) \\ V V /| | | |\n" +
|
|
|
|
"|___/\\___|_| \\_/ \\___|_| |___/_| |_|\\__,_|\\__\\__,_|\\___/ \\_/\\_/ |_| |_|\n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
|
|
|
" \n" +
|
2017-06-04 13:42:10 +02:00
|
|
|
"\n");
|
|
|
|
//new PluginUpdater("Core").update();
|
|
|
|
commons.shutdown();
|
2016-07-28 20:17:25 +02:00
|
|
|
}
|
2016-04-13 05:52:53 +02:00
|
|
|
|
|
|
|
}
|