mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-25 12:06:17 +01:00
Merge pull request #209 from imDaniX/patch-1
better check for bungeecord support
This commit is contained in:
commit
38b15acd15
@ -109,7 +109,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
|||||||
// Enables very basic bungee support if not setup right
|
// Enables very basic bungee support if not setup right
|
||||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
if(this.checkIfBungee()) {
|
if(this.checkIfBungee()) {
|
||||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
|
||||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
|
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
|
||||||
|
|
||||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, channelName);
|
this.getServer().getMessenger().registerOutgoingPluginChannel(this, channelName);
|
||||||
@ -124,12 +123,14 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
|||||||
private boolean checkIfBungee()
|
private boolean checkIfBungee()
|
||||||
{
|
{
|
||||||
// we check if the server is Spigot/Paper (because of the spigot.yml file)
|
// we check if the server is Spigot/Paper (because of the spigot.yml file)
|
||||||
if ( !getServer().getVersion().contains( "Spigot" ) && !getServer().getVersion().contains( "Paper" ) )
|
try {
|
||||||
{
|
Class.forName("org.spigotmc.SpigotConfig");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
this.getServer().getConsoleSender().sendMessage( "\u00A7ePossibly unsupported version for bungee messages detected, channels won't be enabled." );
|
this.getServer().getConsoleSender().sendMessage( "\u00A7ePossibly unsupported version for bungee messages detected, channels won't be enabled." );
|
||||||
getLogger().info("If you believe this shouldn't be the case please contact us on discord https://discord.gg/fAJ3xJg");
|
getLogger().info("If you believe this shouldn't be the case please contact us on discord https://discord.gg/fAJ3xJg");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !getServer().spigot().getConfig().getConfigurationSection("settings").getBoolean( "bungeecord" ) )
|
if ( !getServer().spigot().getConfig().getConfigurationSection("settings").getBoolean( "bungeecord" ) )
|
||||||
{
|
{
|
||||||
this.getServer().getConsoleSender().sendMessage( "\n\n\u00A7eThis server does not have BungeeCord enabled.\n" +
|
this.getServer().getConsoleSender().sendMessage( "\n\n\u00A7eThis server does not have BungeeCord enabled.\n" +
|
||||||
@ -141,6 +142,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
|||||||
getLogger().warning( "Advanced bungee features disabled for Advanced Portals as bungee isn't enabled on the server (spigot.yml)" );
|
getLogger().warning( "Advanced bungee features disabled for Advanced Portals as bungee isn't enabled on the server (spigot.yml)" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user