Plugin not being detected by Bukkit? [SOLVED]

Discussion in 'Plugin Development' started by Musicguy, Sep 8, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Musicguy

    Hey, I'm currently developing a plugin which plays a MIDI file when someone with permissions types a command. I'm trying to test what I have so far on my server hosted on my PC, however, the plugin isn't being recognized by bukkit. Is their anything wrong with my code?


    Code:
    package me.musicguy.radio;
     
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.util.logging.Logger;
     
    import javax.sound.midi.InvalidMidiDataException;
    import javax.sound.midi.MidiSystem;
    import javax.sound.midi.MidiUnavailableException;
    import javax.sound.midi.Sequence;
    import javax.sound.midi.Sequencer;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Radio extends JavaPlugin {
        public static Radio plugin;
        public final Logger logger = Logger.getLogger("Minecraft");
        public static int tid = 0;
        public static int running = 1;
       
        @Override
        public void onDisable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " has been Disabled");   
        }
       
        @Override
        public void onEnable() {
            PluginDescriptionFile pdfFile = this.getDescription();
            this.logger.info(pdfFile.getName() + " version " + pdfFile.getVersion() + " has been Enabled");   
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            Player player = (Player) sender;
            if(commandLabel.equalsIgnoreCase("play")) {
                if(running == 1) {
                    player.sendMessage("You're already playing the radio!");
                } else {
                    tid = Bukkit.getScheduler().scheduleSyncRepeatingTask(this,  new Runnable() {
                        public void run() {
                            try {
                               
                                Sequence sequence = MidiSystem.getSequence(new File(getConfig().getString("song")));
                         
                               
                                Sequencer sequencer = MidiSystem.getSequencer();
                                sequencer.open();
                                sequencer.setSequence(sequence);
                           
                               
                                sequencer.start();
                            } catch (MalformedURLException e) {
                            } catch (IOException e) {
                            } catch (MidiUnavailableException e) {
                            } catch (InvalidMidiDataException e) {
                            }
                        }
                    }, 0, 0);
                    player.sendMessage(ChatColor.RED + "Now Playing");
                }
               
            }
            return false;
        }
    }
    Thanks in advance!
     
  2. Offline

    edragy

    Sooo... you are trying to play a sound. Bukkit and the minecraft client are not capable of playing custom sounds. may I see your plugin.yml?
     
  3. Offline

    Musicguy

    I thought Minecraft could play MIDI files?
     
Thread Status:
Not open for further replies.

Share This Page