Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace most println calls with proxy logger #3720

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.net.URLConnection;
import lombok.Data;
import net.md_5.bungee.Util;
import net.md_5.bungee.api.ProxyServer;

@Data
public class JenkinsModuleSource implements ModuleSource
Expand All @@ -15,7 +16,7 @@ public class JenkinsModuleSource implements ModuleSource
@Override
public void retrieve(ModuleSpec module, ModuleVersion version)
{
System.out.println( "Attempting to Jenkins download module " + module.getName() + " v" + version.getBuild() );
ProxyServer.getInstance().getLogger().info( "Attempting to Jenkins download module " + module.getName() + " v" + version.getBuild() );
try
{
URL website = new URL( "https://ci.md-5.net/job/BungeeCord/" + version.getBuild() + "/artifact/module/" + module.getName().replace( '_', '-' ) + "/target/" + module.getName() + ".jar" );
Expand All @@ -25,10 +26,10 @@ public void retrieve(ModuleSpec module, ModuleVersion version)
con.setReadTimeout( 15000 );

Files.write( ByteStreams.toByteArray( con.getInputStream() ), module.getFile() );
System.out.println( "Download complete" );
ProxyServer.getInstance().getLogger().info( "Download complete" );
} catch ( IOException ex )
{
System.out.println( "Failed to download: " + Util.exception( ex ) );
ProxyServer.getInstance().getLogger().warning( "Failed to download: " + Util.exception( ex ) );
}
}
}
10 changes: 5 additions & 5 deletions proxy/src/main/java/net/md_5/bungee/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void load(ProxyServer proxy, File moduleDirectory) throws Exception
ModuleVersion bungeeVersion = ModuleVersion.parse( proxy.getVersion() );
if ( bungeeVersion == null )
{
System.out.println( "Couldn't detect bungee version. Custom build?" );
proxy.getLogger().warning( "Couldn't detect bungee version. Custom build?" );
return;
}

Expand Down Expand Up @@ -105,19 +105,19 @@ public void load(ProxyServer proxy, File moduleDirectory) throws Exception
ModuleSource source = knownSources.get( uri.getScheme() );
if ( source == null )
{
System.out.println( "Unknown module source: " + s );
proxy.getLogger().warning( "Unknown module source: " + s );
continue;
}
String name = uri.getAuthority();
if ( name == null )
{
System.out.println( "Unknown module host: " + s );
proxy.getLogger().warning( "Unknown module host: " + s );
continue;
}

ModuleSpec spec = new ModuleSpec( name, new File( moduleDirectory, name + ".jar" ), source );
modules.add( spec );
System.out.println( "Discovered module: " + spec );
proxy.getLogger().info( "Discovered module: " + spec );
}

for ( ModuleSpec module : modules )
Expand All @@ -126,7 +126,7 @@ public void load(ProxyServer proxy, File moduleDirectory) throws Exception

if ( !bungeeVersion.equals( moduleVersion ) )
{
System.out.println( "Attempting to update plugin from " + moduleVersion + " to " + bungeeVersion );
proxy.getLogger().info( "Attempting to update plugin from " + moduleVersion + " to " + bungeeVersion );
module.getProvider().retrieve( module, bungeeVersion );
}
}
Expand Down