diff --git a/pom.xml b/pom.xml index 3e12847..b4bb87a 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,11 @@ minestom-snapshots d606051f1e + + org.slf4j + slf4j-simple + 2.0.13 + \ No newline at end of file diff --git a/src/main/java/net/pivipi/LoginHandler.java b/src/main/java/net/pivipi/LoginHandler.java index 915628a..09b5293 100644 --- a/src/main/java/net/pivipi/LoginHandler.java +++ b/src/main/java/net/pivipi/LoginHandler.java @@ -9,7 +9,6 @@ import net.minestom.server.event.player.AsyncPlayerConfigurationEvent; import net.minestom.server.event.player.PlayerDisconnectEvent; import net.minestom.server.event.player.PlayerSpawnEvent; import net.minestom.server.instance.Instance; -import net.minestom.server.instance.Weather; import net.pivipi.ball.Ball; import net.pivipi.ball.BallKicker; import net.pivipi.world.Stadium; diff --git a/src/main/java/net/pivipi/Main.java b/src/main/java/net/pivipi/Main.java index b0f78b8..fcd2fe7 100644 --- a/src/main/java/net/pivipi/Main.java +++ b/src/main/java/net/pivipi/Main.java @@ -3,14 +3,11 @@ package net.pivipi; import net.minestom.server.MinecraftServer; import net.minestom.server.event.GlobalEventHandler; -import net.minestom.server.extras.velocity.VelocityProxy; import net.minestom.server.instance.InstanceContainer; import net.minestom.server.instance.InstanceManager; import net.minestom.server.instance.LightingChunk; -import net.minestom.server.instance.Weather; import net.minestom.server.registry.DynamicRegistry.Key; import net.minestom.server.timer.SchedulerManager; -import net.minestom.server.timer.TaskSchedule; import net.minestom.server.world.DimensionType; import net.pivipi.world.FancyDimension; import net.pivipi.world.SoccerGenerator; diff --git a/src/main/java/net/pivipi/Stats.java b/src/main/java/net/pivipi/Stats.java index ad1a080..8223e3d 100644 --- a/src/main/java/net/pivipi/Stats.java +++ b/src/main/java/net/pivipi/Stats.java @@ -1,21 +1,15 @@ package net.pivipi; -import java.time.Duration; - import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.ComponentBuilder; -import net.minestom.server.MinecraftServer; -import net.minestom.server.instance.Instance; import net.minestom.server.instance.InstanceManager; -import net.minestom.server.monitoring.BenchmarkManager; -import net.minestom.server.network.packet.server.play.DeclareRecipesPacket.Ingredient; import net.minestom.server.timer.SchedulerManager; import net.minestom.server.timer.TaskSchedule; public class Stats implements Runnable { private int tickDelay = 10; + private Runtime runtime = Runtime.getRuntime(); private InstanceManager instanceManager; - private BenchmarkManager benchmarkManager; + //private BenchmarkManager benchmarkManager; private long lastRun; @@ -24,7 +18,7 @@ public class Stats implements Runnable { } public void start(SchedulerManager schedulerManager) { - this.benchmarkManager = MinecraftServer.getBenchmarkManager(); + //this.benchmarkManager = MinecraftServer.getBenchmarkManager(); schedulerManager.scheduleTask(this, TaskSchedule.immediate(), TaskSchedule.tick(tickDelay)); } @@ -36,9 +30,11 @@ public class Stats implements Runnable { double mspt = (double)delay / tickDelay; double tps = 1000 / mspt; - long mem = benchmarkManager.getUsedMemory() / 1024 / 1024; + + long memAllocated = runtime.totalMemory() / 1024 / 1024; + long memUsed = memAllocated - runtime.freeMemory() / 1024 / 1024; - Component footer = Component.text("MSPT: %f | TPS: %f | Mem: %dMB".formatted(mspt, tps, mem)).appendNewline().append(benchmarkManager.getCpuMonitoringMessage()); + Component footer = Component.text("%.3f MSPT | %.3f TPS | %dMB / %dMB".formatted(mspt, tps, memUsed, memAllocated)); instanceManager.getInstances().forEach(instance -> { instance.getPlayers().forEach(player -> { diff --git a/src/main/java/net/pivipi/ball/Ball.java b/src/main/java/net/pivipi/ball/Ball.java index 6f5533a..4c19ee3 100644 --- a/src/main/java/net/pivipi/ball/Ball.java +++ b/src/main/java/net/pivipi/ball/Ball.java @@ -1,13 +1,10 @@ package net.pivipi.ball; -import net.minestom.server.coordinate.Pos; import net.minestom.server.coordinate.Vec; import net.minestom.server.entity.Entity; import net.minestom.server.entity.EntityType; import net.minestom.server.entity.Player; import net.minestom.server.entity.metadata.other.FallingBlockMeta; -import net.minestom.server.event.player.PlayerEntityInteractEvent; -import net.minestom.server.instance.Instance; import net.minestom.server.instance.block.Block; import net.pivipi.physics.Physics; import net.pivipi.world.Stadium; diff --git a/src/main/java/net/pivipi/ball/BallKicker.java b/src/main/java/net/pivipi/ball/BallKicker.java index 3918ad3..893c1e3 100644 --- a/src/main/java/net/pivipi/ball/BallKicker.java +++ b/src/main/java/net/pivipi/ball/BallKicker.java @@ -1,24 +1,15 @@ package net.pivipi.ball; -import javax.print.attribute.standard.MediaSize.Engineering; -import javax.swing.plaf.basic.BasicInternalFrameTitlePane.IconifyAction; - import net.minestom.server.coordinate.Point; import net.minestom.server.coordinate.Pos; -import net.minestom.server.coordinate.Vec; import net.minestom.server.entity.Entity; import net.minestom.server.entity.Player; -import net.minestom.server.entity.Entity.Pose; import net.minestom.server.event.GlobalEventHandler; import net.minestom.server.event.player.PlayerEntityInteractEvent; import net.minestom.server.event.player.PlayerHandAnimationEvent; -import net.minestom.server.event.player.PlayerMoveEvent; import net.minestom.server.event.player.PlayerStartSneakingEvent; import net.minestom.server.event.player.PlayerStopSneakingEvent; import net.minestom.server.instance.block.Block; -import net.minestom.server.item.ItemStack; -import net.minestom.server.network.packet.server.play.BlockActionPacket; -import net.minestom.server.particle.Particle.Item; import net.pivipi.physics.Collision; import net.pivipi.physics.CollisionData; import net.pivipi.world.Stadium; diff --git a/src/main/java/net/pivipi/physics/Collision.java b/src/main/java/net/pivipi/physics/Collision.java index ec1c752..f6831f1 100644 --- a/src/main/java/net/pivipi/physics/Collision.java +++ b/src/main/java/net/pivipi/physics/Collision.java @@ -1,15 +1,11 @@ package net.pivipi.physics; -import java.lang.foreign.ValueLayout.OfBoolean; - import net.minestom.server.collision.BoundingBox; import net.minestom.server.collision.SweepResult; import net.minestom.server.collision.VisibleSweepResult; import net.minestom.server.coordinate.Pos; import net.minestom.server.coordinate.Vec; import net.minestom.server.entity.Entity; -import net.minestom.server.entity.Player; -import net.minestom.server.listener.common.KeepAliveListener; public class Collision { private static CollisionData willCollide(Pos pos, BoundingBox boundingBox, Entity moving, Vec movement) { diff --git a/src/main/java/net/pivipi/physics/Physics.java b/src/main/java/net/pivipi/physics/Physics.java index 94d64d6..98a7f14 100644 --- a/src/main/java/net/pivipi/physics/Physics.java +++ b/src/main/java/net/pivipi/physics/Physics.java @@ -1,10 +1,8 @@ package net.pivipi.physics; import java.util.ArrayList; -import java.util.List; import java.util.Set; -import net.minestom.server.collision.VisibleSweepResult; import net.minestom.server.coordinate.Pos; import net.minestom.server.coordinate.Vec; import net.minestom.server.entity.Entity;