コード例 #1
0
  @SuppressWarnings("unused")
  @Override
  public void onEnable() {
    this.resourceLoader = new ResourceLoader(this);

    try {
      this.language = new Language(this);

      File info = new File(getDataFolder(), "info.txt");
      if (info.exists()) info.delete();
      resourceLoader.load("info", ".txt", getDataFolder());
    } catch (IOException | InvalidConfigurationException e) {
      e.printStackTrace();
    }

    if (true) {
      old = new OldRadio(this);
    } else {
      getServer().getPluginManager().registerEvents(this, this);

      this.version = "v2.0";

      new AutoUpdater(this, version).updateCheck();

      this.nbsParser = new NbsParser();
      this.midiParser = new MidiParser();

      RadioLoader loader = new RadioLoader(this);
      try {
        for (RadioStation station : loader.load()) {
          radioStations.add(station);
          station.startPlaying(this);
        }
      } catch (IOException | InvalidMidiDataException e) {
        e.printStackTrace();
      }

      getCommand("radio").setExecutor(this);

      System.out.println("--=<>=---==---===<(O)>===---==---=<>=--");
      System.out.println("       Radio " + version + " plugin loaded");
      System.out.println("          Made by Rafessor:");
      System.out.println("    https://twitter.com/TheRafessor");
      System.out.println("--=<>=---==---===<(O)>===---==---=<>=--");

      for (RadioStation station : radioStations) {
        System.out.println("Radio: " + station.getName());
        for (Song song : station.getPlayList().getPlaylist())
          System.out.println(" - " + song.getName());
      }
    }
  }
コード例 #2
0
 @EventHandler
 public void onJoin(PlayerJoinEvent e) {
   for (RadioStation station : radioStations)
     if (station.getName().contains("Noteblock")) station.addListener(e.getPlayer());
 }