fix also remove warnings
This commit is contained in:
parent
e1f6bfcf0b
commit
7acdda21fa
8 changed files with 12 additions and 33 deletions
5
pom.xml
5
pom.xml
|
@ -19,6 +19,11 @@
|
||||||
<artifactId>minestom-snapshots</artifactId>
|
<artifactId>minestom-snapshots</artifactId>
|
||||||
<version>d606051f1e</version>
|
<version>d606051f1e</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<version>2.0.13</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -9,7 +9,6 @@ import net.minestom.server.event.player.AsyncPlayerConfigurationEvent;
|
||||||
import net.minestom.server.event.player.PlayerDisconnectEvent;
|
import net.minestom.server.event.player.PlayerDisconnectEvent;
|
||||||
import net.minestom.server.event.player.PlayerSpawnEvent;
|
import net.minestom.server.event.player.PlayerSpawnEvent;
|
||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
import net.minestom.server.instance.Weather;
|
|
||||||
import net.pivipi.ball.Ball;
|
import net.pivipi.ball.Ball;
|
||||||
import net.pivipi.ball.BallKicker;
|
import net.pivipi.ball.BallKicker;
|
||||||
import net.pivipi.world.Stadium;
|
import net.pivipi.world.Stadium;
|
||||||
|
|
|
@ -3,14 +3,11 @@ package net.pivipi;
|
||||||
|
|
||||||
import net.minestom.server.MinecraftServer;
|
import net.minestom.server.MinecraftServer;
|
||||||
import net.minestom.server.event.GlobalEventHandler;
|
import net.minestom.server.event.GlobalEventHandler;
|
||||||
import net.minestom.server.extras.velocity.VelocityProxy;
|
|
||||||
import net.minestom.server.instance.InstanceContainer;
|
import net.minestom.server.instance.InstanceContainer;
|
||||||
import net.minestom.server.instance.InstanceManager;
|
import net.minestom.server.instance.InstanceManager;
|
||||||
import net.minestom.server.instance.LightingChunk;
|
import net.minestom.server.instance.LightingChunk;
|
||||||
import net.minestom.server.instance.Weather;
|
|
||||||
import net.minestom.server.registry.DynamicRegistry.Key;
|
import net.minestom.server.registry.DynamicRegistry.Key;
|
||||||
import net.minestom.server.timer.SchedulerManager;
|
import net.minestom.server.timer.SchedulerManager;
|
||||||
import net.minestom.server.timer.TaskSchedule;
|
|
||||||
import net.minestom.server.world.DimensionType;
|
import net.minestom.server.world.DimensionType;
|
||||||
import net.pivipi.world.FancyDimension;
|
import net.pivipi.world.FancyDimension;
|
||||||
import net.pivipi.world.SoccerGenerator;
|
import net.pivipi.world.SoccerGenerator;
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
package net.pivipi;
|
package net.pivipi;
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
|
|
||||||
import net.kyori.adventure.text.Component;
|
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.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.SchedulerManager;
|
||||||
import net.minestom.server.timer.TaskSchedule;
|
import net.minestom.server.timer.TaskSchedule;
|
||||||
|
|
||||||
public class Stats implements Runnable {
|
public class Stats implements Runnable {
|
||||||
private int tickDelay = 10;
|
private int tickDelay = 10;
|
||||||
|
private Runtime runtime = Runtime.getRuntime();
|
||||||
private InstanceManager instanceManager;
|
private InstanceManager instanceManager;
|
||||||
private BenchmarkManager benchmarkManager;
|
//private BenchmarkManager benchmarkManager;
|
||||||
|
|
||||||
private long lastRun;
|
private long lastRun;
|
||||||
|
|
||||||
|
@ -24,7 +18,7 @@ public class Stats implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(SchedulerManager schedulerManager) {
|
public void start(SchedulerManager schedulerManager) {
|
||||||
this.benchmarkManager = MinecraftServer.getBenchmarkManager();
|
//this.benchmarkManager = MinecraftServer.getBenchmarkManager();
|
||||||
schedulerManager.scheduleTask(this, TaskSchedule.immediate(), TaskSchedule.tick(tickDelay));
|
schedulerManager.scheduleTask(this, TaskSchedule.immediate(), TaskSchedule.tick(tickDelay));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +30,11 @@ public class Stats implements Runnable {
|
||||||
|
|
||||||
double mspt = (double)delay / tickDelay;
|
double mspt = (double)delay / tickDelay;
|
||||||
double tps = 1000 / mspt;
|
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 -> {
|
instanceManager.getInstances().forEach(instance -> {
|
||||||
instance.getPlayers().forEach(player -> {
|
instance.getPlayers().forEach(player -> {
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package net.pivipi.ball;
|
package net.pivipi.ball;
|
||||||
|
|
||||||
import net.minestom.server.coordinate.Pos;
|
|
||||||
import net.minestom.server.coordinate.Vec;
|
import net.minestom.server.coordinate.Vec;
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.EntityType;
|
import net.minestom.server.entity.EntityType;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.entity.metadata.other.FallingBlockMeta;
|
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.minestom.server.instance.block.Block;
|
||||||
import net.pivipi.physics.Physics;
|
import net.pivipi.physics.Physics;
|
||||||
import net.pivipi.world.Stadium;
|
import net.pivipi.world.Stadium;
|
||||||
|
|
|
@ -1,24 +1,15 @@
|
||||||
package net.pivipi.ball;
|
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.Point;
|
||||||
import net.minestom.server.coordinate.Pos;
|
import net.minestom.server.coordinate.Pos;
|
||||||
import net.minestom.server.coordinate.Vec;
|
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.entity.Entity.Pose;
|
|
||||||
import net.minestom.server.event.GlobalEventHandler;
|
import net.minestom.server.event.GlobalEventHandler;
|
||||||
import net.minestom.server.event.player.PlayerEntityInteractEvent;
|
import net.minestom.server.event.player.PlayerEntityInteractEvent;
|
||||||
import net.minestom.server.event.player.PlayerHandAnimationEvent;
|
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.PlayerStartSneakingEvent;
|
||||||
import net.minestom.server.event.player.PlayerStopSneakingEvent;
|
import net.minestom.server.event.player.PlayerStopSneakingEvent;
|
||||||
import net.minestom.server.instance.block.Block;
|
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.Collision;
|
||||||
import net.pivipi.physics.CollisionData;
|
import net.pivipi.physics.CollisionData;
|
||||||
import net.pivipi.world.Stadium;
|
import net.pivipi.world.Stadium;
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
package net.pivipi.physics;
|
package net.pivipi.physics;
|
||||||
|
|
||||||
import java.lang.foreign.ValueLayout.OfBoolean;
|
|
||||||
|
|
||||||
import net.minestom.server.collision.BoundingBox;
|
import net.minestom.server.collision.BoundingBox;
|
||||||
import net.minestom.server.collision.SweepResult;
|
import net.minestom.server.collision.SweepResult;
|
||||||
import net.minestom.server.collision.VisibleSweepResult;
|
import net.minestom.server.collision.VisibleSweepResult;
|
||||||
import net.minestom.server.coordinate.Pos;
|
import net.minestom.server.coordinate.Pos;
|
||||||
import net.minestom.server.coordinate.Vec;
|
import net.minestom.server.coordinate.Vec;
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
import net.minestom.server.entity.Player;
|
|
||||||
import net.minestom.server.listener.common.KeepAliveListener;
|
|
||||||
|
|
||||||
public class Collision {
|
public class Collision {
|
||||||
private static CollisionData willCollide(Pos pos, BoundingBox boundingBox, Entity moving, Vec movement) {
|
private static CollisionData willCollide(Pos pos, BoundingBox boundingBox, Entity moving, Vec movement) {
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package net.pivipi.physics;
|
package net.pivipi.physics;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minestom.server.collision.VisibleSweepResult;
|
|
||||||
import net.minestom.server.coordinate.Pos;
|
import net.minestom.server.coordinate.Pos;
|
||||||
import net.minestom.server.coordinate.Vec;
|
import net.minestom.server.coordinate.Vec;
|
||||||
import net.minestom.server.entity.Entity;
|
import net.minestom.server.entity.Entity;
|
||||||
|
|
Loading…
Reference in a new issue