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

View file

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