It works, again!

LD_LIBRARY_PATH needs to be set
This commit is contained in:
Norbi Peti 2019-05-05 02:32:03 +02:00
parent 7aa6ab4eab
commit 9231c0b9b4
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 12 additions and 7 deletions

View file

@ -47,6 +47,7 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
*/ */
try try
{ {
BassInit.DEBUG=true;
BassInit.loadLibraries(); BassInit.loadLibraries();
} catch (BassException e) } catch (BassException e)
{ {
@ -143,7 +144,7 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
{ {
if (!new File(file).exists()) if (!new File(file).exists())
{ {
sender.sendMessage("§cFile not found: " + file); sender.sendMessage("§cFile not found: " + file);
return false; return false;
} }
HSTREAM stream = null; HSTREAM stream = null;

View file

@ -31,7 +31,7 @@ public class PluginMain extends JavaPlugin
try try
{ {
//System.setProperty("org.jouvieje.libloader.debug", "true"); //System.setProperty("org.jouvieje.libloader.debug", "true");
Bukkit.getConsoleSender().sendMessage("§bLoading..."); Bukkit.getConsoleSender().sendMessage("§bLoading...");
an = new Analyzer(); an = new Analyzer();
URL dirURL = getClassLoader().getResource("res"); URL dirURL = getClassLoader().getResource("res");
String jarPath = dirURL.getPath().substring(5, dirURL.getPath().indexOf("!")); String jarPath = dirURL.getPath().substring(5, dirURL.getPath().indexOf("!"));
@ -51,8 +51,12 @@ public class PluginMain extends JavaPlugin
} }
} }
jar.close(); jar.close();
for (File f : getDataFolder().listFiles()) /*File[] listFiles = getDataFolder().listFiles();
for (int i = listFiles.length - 1; i >= 0; i--) { //Reverse order needed to try to load 64bit first
File f = listFiles[i];
addLibraryPath(f.getAbsolutePath()); addLibraryPath(f.getAbsolutePath());
}*/
addLibraryPath(new File(getDataFolder(), "linux64").getAbsolutePath()); //TODO: Need to specify library path when starting
br = new BarsRenderer(an.init(), an); br = new BarsRenderer(an.init(), an);
for (short i = 0; i < 4; i++) for (short i = 0; i < 4; i++)
{ {
@ -62,9 +66,9 @@ public class PluginMain extends JavaPlugin
map.getRenderers().clear(); map.getRenderers().clear();
map.addRenderer(br); map.addRenderer(br);
} }
Bukkit.getConsoleSender().sendMessage("§bInitializing..."); Bukkit.getConsoleSender().sendMessage("§bInitializing...");
an.run(Bukkit.getConsoleSender()); an.run(Bukkit.getConsoleSender());
Bukkit.getConsoleSender().sendMessage("§bDone!"); Bukkit.getConsoleSender().sendMessage("§bDone!");
} catch (Exception e) } catch (Exception e)
{ {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -104,14 +108,14 @@ public class PluginMain extends JavaPlugin
if (an.start(sender, Arrays.stream(args).collect(Collectors.joining(" ")))) if (an.start(sender, Arrays.stream(args).collect(Collectors.joining(" "))))
sender.sendMessage("Started playing music"); sender.sendMessage("Started playing music");
else else
sender.sendMessage("§cFailed to play music."); sender.sendMessage("<EFBFBD>cFailed to play music.");
return true; return true;
} else if (command.getName().equalsIgnoreCase("stopplay")) } else if (command.getName().equalsIgnoreCase("stopplay"))
{ {
if (an.stopPlaying()) if (an.stopPlaying())
sender.sendMessage("Stopped playing music"); sender.sendMessage("Stopped playing music");
else else
sender.sendMessage("§cCan't stop the party!"); sender.sendMessage("<EFBFBD>cCan't stop the party!");
return true; return true;
} else } else
{ {