Advertisement
Guest User

Gutefrage.net / Fehler (is it up to date)

a guest
Nov 12th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.03 KB | None | 0 0
  1. package de.lolermc;
  2.  
  3. import java.io.File;
  4. import java.util.ArrayList;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.configuration.file.FileConfiguration;
  8. import org.bukkit.configuration.file.YamlConfiguration;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.plugin.RegisteredServiceProvider;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. import de.Herbystar.TTA.TTA_Methods;
  15. import net.milkbowl.vault.economy.Economy;
  16.  
  17. public class Main extends JavaPlugin implements Listener{
  18.    
  19.     public static Economy economy = null;
  20.     int messages_anzahl = 6;
  21.    
  22.     ArrayList<String> particles = new ArrayList<>();
  23.    
  24.     File Config = new File("plugins/System", "config.yml");
  25.     FileConfiguration config = YamlConfiguration.loadConfiguration(Config);
  26.    
  27.     File Players = new File("plugins/System", "players.yml");
  28.     FileConfiguration players = YamlConfiguration.loadConfiguration(Players);
  29.    
  30.     File Lang = new File("plugins/System", "language.yml");
  31.     FileConfiguration lang = YamlConfiguration.loadConfiguration(Lang);
  32.    
  33.     File Friends = new File("plugins/System", "friends.yml");
  34.     FileConfiguration friends = YamlConfiguration.loadConfiguration(Friends);
  35.    
  36.     public void onEnable(){    
  37.         this.setupEconomy();
  38.         this.getServer().getPluginManager().registerEvents(this, this);
  39.         System.out.println("<-------DISCLAIMER------->");
  40.         System.out.println("System - By LolerMC");
  41.         System.out.println("Version: 4.0");
  42.         System.out.println("<-------DISCLAIMER------->");
  43.         Bukkit.broadcastMessage("§c<§e--------§cCREDITS§e-----------§c>");
  44.         Bukkit.broadcastMessage("§cAuthor: §eLolerMC");
  45.         Bukkit.broadcastMessage("§cVersion: §e4.0");
  46.         Bukkit.broadcastMessage("§cCodename: de-lolermc-plexed-system-4.0-release");
  47.         Bukkit.broadcastMessage("§cCodename2: de-lolermc-plexed-system-friendsystem-1.0-beta");
  48.         Bukkit.broadcastMessage("§c<§e---------------------------§c>");
  49.         Bukkit.broadcastMessage("§8[§cSystem§8] §aErfolgreich neugeladen!");
  50.        
  51.         registerEvents();
  52.         registerCommands();
  53.         makeConfig();
  54.        
  55.         runAutoMessage();
  56.        
  57.     }
  58.    
  59.     private void runAutoMessage() {
  60.        
  61.         getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable(){
  62.  
  63.             @Override
  64.             public void run() {
  65.                
  66.                 if(messages_anzahl <= 6){
  67.                     if(messages_anzahl > 1){
  68.                        
  69.                         messages_anzahl--;
  70.                        
  71.                         for(Player players : Bukkit.getOnlinePlayers()){
  72.                            
  73.                             TTA_Methods.sendActionBar(players, config.getString("AutoMessage." + messages_anzahl));
  74.                            
  75.                         }
  76.                        
  77.                     }else{
  78.                        
  79.                         messages_anzahl = 6;
  80.                        
  81.                     }
  82.                    
  83.  
  84.                    
  85.  
  86.                    
  87.                    
  88.                    
  89.                 }else{
  90.                    
  91.                     messages_anzahl = 6;
  92.                    
  93.                 }
  94.                
  95.                
  96.                
  97.             }
  98.            
  99.         }, 3*20, 5*20);
  100.        
  101.        
  102.        
  103.     }
  104.  
  105.     public void registerEvents(){
  106.         new ChatSystem(this);
  107.         new Motd(this);
  108.         new PremiumJoin(this);
  109.         new InfoBoard(this);
  110.         new Tablist(this);
  111.         new Join(this);
  112.         new Jumppads(this);
  113.         new Particles(this);
  114.         new Commands(this);
  115.         new LobbyItems(this);
  116.         new LobbyItemsGadgets(this);
  117.         new LobbyItemNavigator(this);
  118.         new WarnBanSystem(this);
  119.         new FriendSystem(this);
  120.         new Build(this);
  121.         Bukkit.broadcastMessage("§8[§bPlexed§8] §aEvents geladen!");
  122.     }
  123.    
  124.     public void registerCommands(){
  125.         getCommand("system").setExecutor(new Commands(this));
  126.         getCommand("system").setExecutor(new Motd(this));
  127.         getCommand("day").setExecutor(new Commands(this));
  128.         getCommand("noon").setExecutor(new Commands(this));
  129.         getCommand("night").setExecutor(new Commands(this));
  130.         getCommand("storm").setExecutor(new Commands(this));
  131.         getCommand("sun").setExecutor(new Commands(this));
  132.         getCommand("gamemode").setExecutor(new Commands(this));
  133.         getCommand("sethub").setExecutor(new SpawnAndHub(this));
  134.         getCommand("hub").setExecutor(new SpawnAndHub(this));
  135.         getCommand("spawn").setExecutor(new SpawnAndHub(this));
  136.         getCommand("friend").setExecutor(new FriendSystem(this));
  137.         getCommand("ban").setExecutor(new WarnBanSystem(this));
  138.         getCommand("unban").setExecutor(new WarnBanSystem(this));
  139.         getCommand("warn").setExecutor(new WarnBanSystem(this));
  140.         getCommand("kick").setExecutor(new WarnBanSystem(this));
  141.         getCommand("unwarn").setExecutor(new WarnBanSystem(this));
  142.         getCommand("playerinfo").setExecutor(new Commands(this));
  143.         getCommand("tracer").setExecutor(new Commands(this));
  144.         getCommand("build").setExecutor(new Build(this));
  145.         getCommand("kits").setExecutor(new Commands(this));
  146.         getCommand("adminpanel").setExecutor(new AdminPanel(this));
  147.         Bukkit.broadcastMessage("§8[§bPlexed§8] §aCommands geladen!");
  148.     }
  149.    
  150.    
  151.     public void makeConfig(){
  152.        
  153.         if (Config.exists() == false){ 
  154.             try{
  155.                 config.set("max_normal_players", 150);
  156.                 config.set("motd", "§b§lPlexed §8- §aMinigames | §bVersion§a [1.8-1.10]\n§cKeine Motd eingestellt!");
  157.                 config.set("wartungsmodus", "off");
  158.                 config.set("AutoMessage.1", "§cDas ist die §e1. §cNachricht!");
  159.                 config.set("AutoMessage.2", "§cDas ist die §e2. §cNachricht!");
  160.                 config.set("AutoMessage.3", "§cDas ist die §e3. §cNachricht!");
  161.                 config.set("AutoMessage.4", "§cDas ist die §e4. §cNachricht!");
  162.                 config.set("AutoMessage.5", "§cDas ist die §e5. §cNachricht!");
  163.                 config.save(Config);
  164.             }catch(Exception e){
  165.                 System.err.println("[System] Konnte 'config.yml' nicht erstellen!");
  166.             }
  167.            
  168.         }
  169.        
  170.         if(Players.exists() == false){
  171.             try{
  172.                 players.save(Players);
  173.             }catch(Exception e){
  174.                 System.err.println("[System] Konnte 'players.yml' nicht erstellen!");
  175.             }
  176.         }
  177.        
  178.         if(Friends.exists() == false){
  179.             try{
  180.                 friends.save(Friends);
  181.             }catch(Exception e){
  182.                 System.err.println("[System] Konnte 'friends.yml' nicht erstellen!");
  183.             }
  184.         }
  185.            
  186.     }
  187.    
  188.     private boolean setupEconomy()
  189.     {
  190.         RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
  191.         if (economyProvider != null) {
  192.             economy = economyProvider.getProvider();
  193.         }
  194.  
  195.         return (economy != null);
  196.     }
  197.  
  198.    
  199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement