Fixes, fixes, fixes
This commit is contained in:
parent
410e1351ee
commit
e1d185dbe9
4 changed files with 6 additions and 12 deletions
|
@ -75,7 +75,7 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
|
||||||
return floats;
|
return floats;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ByteBuffer buffer;
|
private volatile ByteBuffer buffer;
|
||||||
private TimerTask tt;
|
private TimerTask tt;
|
||||||
|
|
||||||
public boolean run(CommandSender sender)
|
public boolean run(CommandSender sender)
|
||||||
|
@ -104,13 +104,10 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
|
||||||
|
|
||||||
public boolean start(CommandSender sender, String file)
|
public boolean start(CommandSender sender, String file)
|
||||||
{
|
{
|
||||||
|
if (playing)
|
||||||
|
tt.cancel();
|
||||||
if (!playFile(sender, file))
|
if (!playFile(sender, file))
|
||||||
{
|
|
||||||
// start a file playing
|
|
||||||
BASS_Free();
|
|
||||||
stop();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
// setup update timer (50hz)
|
// setup update timer (50hz)
|
||||||
timer.scheduleAtFixedRate(tt = new TimerTask()
|
timer.scheduleAtFixedRate(tt = new TimerTask()
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class BarsRenderer extends BarsRendererBase
|
||||||
for (int j = 0; j < 128; j++)
|
for (int j = 0; j < 128; j++)
|
||||||
for (int k = 0; k < 8; k++)
|
for (int k = 0; k < 8; k++)
|
||||||
mc.setPixel(i * 16 + k, 128 - j,
|
mc.setPixel(i * 16 + k, 128 - j,
|
||||||
j < Math.sqrt(an.playing() ? bars.get((offsetx + i) * 64) : 0) * 1280 + offsety
|
j < Math.sqrt(an.playing() ? bars.get((offsetx + i) * 64) : 0) * 2560 + offsety
|
||||||
? MapPalette.matchColor(j - offsety, 255 - j + offsety, 0)
|
? MapPalette.matchColor(j - offsety, 255 - j + offsety, 0)
|
||||||
: MapPalette.matchColor(Color.BLACK));
|
: MapPalette.matchColor(Color.BLACK));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.map.MapRenderer;
|
||||||
|
|
||||||
public abstract class BarsRendererBase extends MapRenderer
|
public abstract class BarsRendererBase extends MapRenderer
|
||||||
{
|
{
|
||||||
protected FloatBuffer bars;
|
protected volatile FloatBuffer bars;
|
||||||
protected byte firstrender = 0;
|
protected byte firstrender = 0;
|
||||||
protected byte count = 16;
|
protected byte count = 16;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.nio.FloatBuffer;
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
@ -21,8 +20,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class PluginMain extends JavaPlugin
|
public class PluginMain extends JavaPlugin
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unused") //Assignment in method call isn't counted as use
|
|
||||||
private volatile FloatBuffer bars;
|
|
||||||
private BarsRenderer br;
|
private BarsRenderer br;
|
||||||
private Analyzer an;
|
private Analyzer an;
|
||||||
|
|
||||||
|
@ -56,7 +53,7 @@ public class PluginMain extends JavaPlugin
|
||||||
jar.close();
|
jar.close();
|
||||||
for (File f : getDataFolder().listFiles())
|
for (File f : getDataFolder().listFiles())
|
||||||
addLibraryPath(f.getAbsolutePath());
|
addLibraryPath(f.getAbsolutePath());
|
||||||
br = new BarsRenderer(bars = an.init(), an);
|
br = new BarsRenderer(an.init(), an);
|
||||||
for (short i = 0; i < 4; i++)
|
for (short i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
MapView map = Bukkit.getMap(i);
|
MapView map = Bukkit.getMap(i);
|
||||||
|
|
Loading…
Reference in a new issue