mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-17 22:00:08 +00:00
Change Java whitespace handling in .editorconfig (#425)
* Change whitespace handling in .editorconfig * Reformat code * fix format error * Reformat code --------- Co-authored-by: Zoë Gidiere <duplexsys@protonmail.com>
This commit is contained in:
@@ -16,59 +16,59 @@ import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
|
||||
public class ProfilerCommandAddon implements AddonInitializer {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProfilerCommandAddon.class);
|
||||
|
||||
|
||||
@Inject
|
||||
private Platform platform;
|
||||
|
||||
|
||||
@Inject
|
||||
private BaseAddon addon;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
platform.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, CommandRegistrationEvent.class)
|
||||
.then(event -> {
|
||||
CommandManager<CommandSender> manager = event.getCommandManager();
|
||||
manager
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("start", ArgumentDescription.of("Start profiling"), "st")
|
||||
.permission("terra.profiler.start")
|
||||
.handler(context -> {
|
||||
platform.getProfiler().start();
|
||||
context.getSender().sendMessage("Profiling started.");
|
||||
}))
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("stop", ArgumentDescription.of("Stop profiling"), "s")
|
||||
.permission("terra.profiler.stop")
|
||||
.handler(context -> {
|
||||
platform.getProfiler().stop();
|
||||
context.getSender().sendMessage("Profiling stopped.");
|
||||
}))
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("query", ArgumentDescription.of("Query profiler results"), "q")
|
||||
.permission("terra.profiler.query")
|
||||
.handler(context -> {
|
||||
StringBuilder data = new StringBuilder("Terra Profiler data: \n");
|
||||
platform.getProfiler().getTimings().forEach((id, timings) -> data.append(id)
|
||||
.append(": ")
|
||||
.append(timings.toString())
|
||||
.append('\n'));
|
||||
logger.info(data.toString());
|
||||
context.getSender().sendMessage("Profiling data dumped to console.");
|
||||
}))
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("reset", ArgumentDescription.of("Reset the profiler"), "r")
|
||||
.permission("terra.profiler.reset")
|
||||
.handler(context -> {
|
||||
platform.getProfiler().reset();
|
||||
context.getSender().sendMessage("Profiler reset.");
|
||||
}));
|
||||
});
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, CommandRegistrationEvent.class)
|
||||
.then(event -> {
|
||||
CommandManager<CommandSender> manager = event.getCommandManager();
|
||||
manager
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("start", ArgumentDescription.of("Start profiling"), "st")
|
||||
.permission("terra.profiler.start")
|
||||
.handler(context -> {
|
||||
platform.getProfiler().start();
|
||||
context.getSender().sendMessage("Profiling started.");
|
||||
}))
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("stop", ArgumentDescription.of("Stop profiling"), "s")
|
||||
.permission("terra.profiler.stop")
|
||||
.handler(context -> {
|
||||
platform.getProfiler().stop();
|
||||
context.getSender().sendMessage("Profiling stopped.");
|
||||
}))
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("query", ArgumentDescription.of("Query profiler results"), "q")
|
||||
.permission("terra.profiler.query")
|
||||
.handler(context -> {
|
||||
StringBuilder data = new StringBuilder("Terra Profiler data: \n");
|
||||
platform.getProfiler().getTimings().forEach((id, timings) -> data.append(id)
|
||||
.append(": ")
|
||||
.append(timings.toString())
|
||||
.append('\n'));
|
||||
logger.info(data.toString());
|
||||
context.getSender().sendMessage("Profiling data dumped to console.");
|
||||
}))
|
||||
.command(
|
||||
manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler"))
|
||||
.literal("reset", ArgumentDescription.of("Reset the profiler"), "r")
|
||||
.permission("terra.profiler.reset")
|
||||
.handler(context -> {
|
||||
platform.getProfiler().reset();
|
||||
context.getSender().sendMessage("Profiler reset.");
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user