Permalink
Browse files

Fixed a few more warnings.

  • Loading branch information...
1 parent a8b0ba9 commit f6cde09b9624bb1db77b0b4ecc42aae50af71bbc @me4502 me4502 committed Jun 9, 2012
@@ -19,11 +19,11 @@
import com.sk89q.jinglenote.JingleNoteComponent;
import com.sk89q.jinglenote.MidiJingleSequencer;
-public class Melody extends AbstractIC{
+public class Melody extends AbstractIC {
MidiJingleSequencer sequencer;
JingleNoteComponent jNote = new JingleNoteComponent();
-
+
public Melody(Server server, Sign block) {
super(server, block);
jNote.enable();
@@ -38,89 +38,88 @@ public String getTitle() {
public String getSignTitle() {
return "MELODY";
}
-
+
@Override
- public void unload()
- {
- if(jNote!=null)
+ public void unload() {
+ if (jNote != null)
jNote.getJingleNoteManager().stopAll();
}
@Override
public void trigger(ChipState chip) {
try {
- if(chip.getInput(0) && sequencer == null)
- {
+ if (chip.getInput(0) && sequencer == null) {
String midiName = getSign().getLine(2);
- File[] trialPaths = {
- new File(CircuitsPlugin.getInst().getDataFolder(), "midi/" + midiName),
- new File(CircuitsPlugin.getInst().getDataFolder(), "midi/" + midiName + ".mid"),
- new File(CircuitsPlugin.getInst().getDataFolder(), "midi/" + midiName + ".midi"),
- new File("midi", midiName),
- new File("midi", midiName + ".mid"),
- new File("midi", midiName + ".midi"),
- };
-
- File file = null;
-
- for (File f : trialPaths) {
- if (f.exists()) {
- file = f;
- break;
- }
- }
-
- if (file == null) {
- getServer().getLogger().log(Level.SEVERE, "Midi file not found!");
- return;
- }
-
- if(sequencer!=null||jNote!=null)
- {
- for (Player player : getServer().getOnlinePlayers())
- {
+ File[] trialPaths = {
+ new File(CircuitsPlugin.getInst().getDataFolder(),
+ "midi/" + midiName),
+ new File(CircuitsPlugin.getInst().getDataFolder(),
+ "midi/" + midiName + ".mid"),
+ new File(CircuitsPlugin.getInst().getDataFolder(),
+ "midi/" + midiName + ".midi"),
+ new File("midi", midiName),
+ new File("midi", midiName + ".mid"),
+ new File("midi", midiName + ".midi"), };
+
+ File file = null;
+
+ for (File f : trialPaths) {
+ if (f.exists()) {
+ file = f;
+ break;
+ }
+ }
+
+ if (file == null) {
+ getServer().getLogger().log(Level.SEVERE,
+ "Midi file not found!");
+ return;
+ }
+
+ if (sequencer != null || jNote != null) {
+ for (Player player : getServer().getOnlinePlayers()) {
jNote.getJingleNoteManager().stop(player);
}
jNote.getJingleNoteManager().stopAll();
- }
+ }
sequencer = new MidiJingleSequencer(file);
for (Player player : getServer().getOnlinePlayers()) {
- if(player==null)continue;
+ if (player == null)
+ continue;
jNote.getJingleNoteManager().play(player, sequencer, 0);
- player.sendMessage(ChatColor.YELLOW + "Playing " + midiName + "...");
+ player.sendMessage(ChatColor.YELLOW + "Playing " + midiName
+ + "...");
}
- }
- else if(sequencer!=null && chip.getInput(0))
- {
+ } else if (sequencer != null && chip.getInput(0)) {
sequencer.stop();
sequencer = null;
- for (Player player : getServer().getOnlinePlayers())
- {
+ for (Player player : getServer().getOnlinePlayers()) {
jNote.getJingleNoteManager().stop(player);
}
jNote.getJingleNoteManager().stopAll();
}
- }
- catch(Exception e){
- getServer().getLogger().log(Level.SEVERE, "[CraftBookCircuits]: Midi Failed To Play!");
+ } catch (Exception e) {
+ getServer().getLogger().log(Level.SEVERE,
+ "[CraftBookCircuits]: Midi Failed To Play!");
final Writer result = new StringWriter();
- final PrintWriter printWriter = new PrintWriter(result);
- e.printStackTrace(printWriter);
- getServer().getLogger().log(Level.SEVERE, "[CraftBookCircuits]: " + result.toString());
+ final PrintWriter printWriter = new PrintWriter(result);
+ e.printStackTrace(printWriter);
+ getServer().getLogger().log(Level.SEVERE,
+ "[CraftBookCircuits]: " + result.toString());
+ }
+ }
+
+ public static class Factory extends AbstractICFactory {
+
+ public Factory(Server server) {
+ super(server);
+ }
+
+ @Override
+ public IC create(Sign sign) {
+ return new Melody(getServer(), sign);
}
}
-
- public static class Factory extends AbstractICFactory {
-
- public Factory(Server server) {
- super(server);
- }
-
- @Override
- public IC create(Sign sign) {
- return new Melody(getServer(), sign);
- }
- }
}
@@ -28,7 +28,8 @@
*/
public class SourcedBlockRedstoneEvent extends BlockRedstoneEvent {
- private static final long serialVersionUID = 1031838877588760298L;
+ @SuppressWarnings("unused")
+ private static final long serialVersionUID = 1031838877588760298L;
protected Block source;
@@ -46,7 +46,8 @@ private boolean isValidWallsign(World world, Vector pos) {
return (s.getLine(1).equalsIgnoreCase("[x]"));
}
- private boolean isValidWallsign(Block b) {
+ @SuppressWarnings("unused")
+ private boolean isValidWallsign(Block b) {
if(b.getType() != Material.WALL_SIGN) // instead of SIGN_POST
return false;
Sign s = (Sign)b.getState();

0 comments on commit f6cde09

Please sign in to comment.