Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main extends JavaPlugin {
- public static final String prefix = "§8[§cKnockIT§8]";
- public static Main plugin;
- public static MySQL mysql;
- private Coins coins;
- @Override
- public void onEnable() {
- init(Bukkit.getPluginManager());
- if(!getDataFolder().exists()){
- getDataFolder().mkdir();
- }
- if(!new File(getDataFolder() ,"config.yml").exists()){
- try {
- new File(getDataFolder() ,"config.yml").createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- coins = new Coins();
- this.getCommand("setspawn").setExecutor(new SetDatas());
- this.getCommand("setpvp").setExecutor(new SetDatas());
- this.getCommand("setdeath").setExecutor(new SetDatas());
- this.getCommand("stats").setExecutor(new StatsCommand());
- Bukkit.broadcastMessage(prefix + "§a Das Plugin wurde geladen.");
- updateScoreboard();
- }
- @Override
- public void onDisable() {
- Bukkit.broadcastMessage(prefix + "§c Plugin wurde gestoppt");
- }
- public void init(PluginManager pluginManager){
- pluginManager.registerEvents(new Prevent(), this);
- pluginManager.registerEvents(new PlayerConnectionListeners(this),this);
- pluginManager.registerEvents(new MoveListener(this),this);
- pluginManager.registerEvents(new Death(),this);
- pluginManager.registerEvents( new PlayerHitOtherEvent(),this);
- pluginManager.registerEvents(new PlayerRespawnListener(), this);
- pluginManager.registerEvents(new Shop(), this);
- pluginManager.registerEvents(new Chatutils(), this);
- PlayerHitOtherEvent.hits = new HashMap<>();
- // getCommand("setspawn").setExecutor(new SetDatas());
- // getCommand("setdeath").setExecutor(new SetDatas());
- // getCommand("setpvp").setExecutor(new SetDatas());
- }
- public Location getSpawn(){
- double x = getConfig().getDouble("spawn.x");
- double y = getConfig().getDouble("spawn.y");
- double z = getConfig().getDouble("spawn.z");
- float yaw = (float) getConfig().getDouble("spawn.yaw");
- float pitch = (float) getConfig().getDouble("spawn.pitch");
- String worldname = getConfig().getString("spawn.world");
- return new Location(Bukkit.getWorld(worldname),x,y,z,yaw,pitch);
- }
- public static Main getInstance(){
- return plugin;
- }
- public static MySQL getMysql() {
- return mysql;
- }
- public void updateScoreboard() {
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- for(Player players: Bukkit.getOnlinePlayers()) {
- new ScoreboardHandler().setScoreboard(players);
- }
- }
- }, 0, 20);
- }
- public Coins getCoins() {
- return coins;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement