pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.server.subcommands;
|
||||
|
||||
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
@@ -26,76 +25,60 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.server.ISubCommand;
|
||||
|
||||
public class ChunkLogger implements ISubCommand {
|
||||
|
||||
public class ChunkLogger implements ISubCommand
|
||||
{
|
||||
private boolean enabled = false;
|
||||
|
||||
private boolean enabled = false;
|
||||
private void displayStack() {
|
||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHUNK_LOGGER_TRACE)) {
|
||||
boolean output = false;
|
||||
for (final StackTraceElement e : Thread.currentThread().getStackTrace()) {
|
||||
if (output) {
|
||||
AELog.info(
|
||||
" " + e.getClassName() + '.' + e.getMethodName() + " (" + e.getLineNumber() + ')');
|
||||
} else {
|
||||
output = e.getClassName().contains("EventBus") && e.getMethodName().contains("post");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayStack()
|
||||
{
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CHUNK_LOGGER_TRACE ) )
|
||||
{
|
||||
boolean output = false;
|
||||
for( final StackTraceElement e : Thread.currentThread().getStackTrace() )
|
||||
{
|
||||
if( output )
|
||||
{
|
||||
AELog.info( " " + e.getClassName() + '.' + e.getMethodName() + " (" + e.getLineNumber() + ')' );
|
||||
}
|
||||
else
|
||||
{
|
||||
output = e.getClassName().contains( "EventBus" ) && e.getMethodName().contains( "post" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onChunkLoadEvent(final ChunkEvent.Load event) {
|
||||
if (!event.getWorld().isRemote()) {
|
||||
AELog.info("Chunk Loaded: " + event.getChunk().getPos().x + ", " + event.getChunk().getPos().z);
|
||||
this.displayStack();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkLoadEvent( final ChunkEvent.Load event )
|
||||
{
|
||||
if( !event.getWorld().isRemote() )
|
||||
{
|
||||
AELog.info( "Chunk Loaded: " + event.getChunk().getPos().x + ", " + event.getChunk().getPos().z );
|
||||
this.displayStack();
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onChunkUnloadEvent(final ChunkEvent.Unload unload) {
|
||||
if (!unload.getWorld().isRemote()) {
|
||||
AELog.info("Chunk Unloaded: " + unload.getChunk().getPos().x + ", " + unload.getChunk().getPos().z);
|
||||
this.displayStack();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkUnloadEvent( final ChunkEvent.Unload unload )
|
||||
{
|
||||
if( !unload.getWorld().isRemote() )
|
||||
{
|
||||
AELog.info( "Chunk Unloaded: " + unload.getChunk().getPos().x + ", " + unload.getChunk().getPos().z );
|
||||
this.displayStack();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getHelp(final MinecraftServer srv) {
|
||||
return "commands.ae2.ChunkLogger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp( final MinecraftServer srv )
|
||||
{
|
||||
return "commands.ae2.ChunkLogger";
|
||||
}
|
||||
@Override
|
||||
public void call(final MinecraftServer srv, final String[] data, final CommandSource sender) {
|
||||
this.enabled = !this.enabled;
|
||||
|
||||
@Override
|
||||
public void call( final MinecraftServer srv, final String[] data, final CommandSource sender )
|
||||
{
|
||||
this.enabled = !this.enabled;
|
||||
|
||||
if( this.enabled )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
sender.sendFeedback( new TranslationTextComponent( "commands.ae2.ChunkLoggerOn" ), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.unregister( this );
|
||||
sender.sendFeedback( new TranslationTextComponent( "commands.ae2.ChunkLoggerOff" ), true );
|
||||
}
|
||||
}
|
||||
if (this.enabled) {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
sender.sendFeedback(new TranslationTextComponent("commands.ae2.ChunkLoggerOn"), true);
|
||||
} else {
|
||||
MinecraftForge.EVENT_BUS.unregister(this);
|
||||
sender.sendFeedback(new TranslationTextComponent("commands.ae2.ChunkLoggerOff"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.server.subcommands;
|
||||
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import net.minecraft.command.CommandSource;
|
||||
@@ -27,20 +26,17 @@ import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import appeng.server.ISubCommand;
|
||||
|
||||
public class Supporters implements ISubCommand {
|
||||
|
||||
public class Supporters implements ISubCommand
|
||||
{
|
||||
@Override
|
||||
public String getHelp(final MinecraftServer srv) {
|
||||
return "commands.ae2.Supporters";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp( final MinecraftServer srv )
|
||||
{
|
||||
return "commands.ae2.Supporters";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call( final MinecraftServer srv, final String[] data, final CommandSource sender )
|
||||
{
|
||||
final String[] who = { "Stig Halvorsen", "Josh Ricker", "Jenny \"Othlon\" Sutherland", "Hristo Bogdanov", "BevoLJ" };
|
||||
sender.sendFeedback( new StringTextComponent( "Special thanks to " + Joiner.on( ", " ).join( who ) ), true );
|
||||
}
|
||||
@Override
|
||||
public void call(final MinecraftServer srv, final String[] data, final CommandSource sender) {
|
||||
final String[] who = { "Stig Halvorsen", "Josh Ricker", "Jenny \"Othlon\" Sutherland", "Hristo Bogdanov",
|
||||
"BevoLJ" };
|
||||
sender.sendFeedback(new StringTextComponent("Special thanks to " + Joiner.on(", ").join(who)), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user