mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-27 12:46:05 +01:00
Make greload reload custom messages.properties
This commit is contained in:
parent
fbc5f514e2
commit
2e826a15e7
@ -189,14 +189,7 @@ public class BungeeCord extends ProxyServer
|
||||
{
|
||||
baseBundle = ResourceBundle.getBundle( "messages", Locale.ENGLISH );
|
||||
}
|
||||
File file = new File( "messages.properties" );
|
||||
if ( file.isFile() )
|
||||
{
|
||||
try ( FileReader rd = new FileReader( file ) )
|
||||
{
|
||||
customBundle = new PropertyResourceBundle( rd );
|
||||
}
|
||||
}
|
||||
reloadMessages();
|
||||
|
||||
// This is a workaround for quite possibly the weirdest bug I have ever encountered in my life!
|
||||
// When jansi attempts to extract its natives, by default it tries to extract a specific version,
|
||||
@ -484,6 +477,21 @@ public class BungeeCord extends ProxyServer
|
||||
return ( BungeeCord.class.getPackage().getImplementationVersion() == null ) ? "unknown" : BungeeCord.class.getPackage().getImplementationVersion();
|
||||
}
|
||||
|
||||
public void reloadMessages()
|
||||
{
|
||||
File file = new File( "messages.properties" );
|
||||
if ( file.isFile() )
|
||||
{
|
||||
try ( FileReader rd = new FileReader( file ) )
|
||||
{
|
||||
customBundle = new PropertyResourceBundle( rd );
|
||||
} catch ( IOException ex )
|
||||
{
|
||||
getLogger().log( Level.SEVERE, "Could not load custom messages.properties", ex );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslation(String name, Object... args)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ public class CommandReload extends Command
|
||||
public void execute(CommandSender sender, String[] args)
|
||||
{
|
||||
BungeeCord.getInstance().config.load();
|
||||
BungeeCord.getInstance().reloadMessages();
|
||||
BungeeCord.getInstance().stopListeners();
|
||||
BungeeCord.getInstance().startListeners();
|
||||
BungeeCord.getInstance().getPluginManager().callEvent( new ProxyReloadEvent( sender ) );
|
||||
|
Loading…
Reference in New Issue
Block a user