Bug fixing #17

Merged
MineTec merged 3 commits from bugFixing into develop 2026-10-28 21:13:04 +00:00
2 changed files with 11 additions and 8 deletions

No files matched your search

@@ -9,6 +9,7 @@ import io.github.togar2.pvp.events.FinalAttackEvent;
import io.github.togar2.pvp.events.PrepareAttackEvent; import io.github.togar2.pvp.events.PrepareAttackEvent;
import io.github.togar2.pvp.feature.CombatFeatures; import io.github.togar2.pvp.feature.CombatFeatures;
import io.github.togar2.pvp.feature.knockback.KnockbackSettings; import io.github.togar2.pvp.feature.knockback.KnockbackSettings;
import net.minestom.server.ServerFlag;
import net.minestom.server.coordinate.Pos; import net.minestom.server.coordinate.Pos;
import net.minestom.server.entity.Player; import net.minestom.server.entity.Player;
import net.minestom.server.event.instance.InstanceTickEvent; import net.minestom.server.event.instance.InstanceTickEvent;
@@ -51,15 +52,18 @@ class HighGround extends StatelessGame {
this.eventNode().addListener( this.eventNode().addListener(
EntityKnockbackEvent.class, EntityKnockbackEvent.class,
entityKnockbackEvent -> entityKnockbackEvent.setSettings( entityKnockbackEvent -> {
MineTec marked this conversation as resolved
Review

der check behandelt das Symptom, nicht die Ursache
Der check sollte nicht nötig sein.

der check behandelt das Symptom, nicht die Ursache Der check sollte nicht nötig sein.
double tps = ServerFlag.SERVER_TICKS_PER_SECOND;
entityKnockbackEvent.setSettings(
KnockbackSettings.builder() KnockbackSettings.builder()
.horizontal(1.1) .horizontal(1.1)
.vertical(KnockbackSettings.DEFAULT.vertical()) .vertical(KnockbackSettings.DEFAULT.vertical() / tps)
.verticalLimit(KnockbackSettings.DEFAULT.verticalLimit()) .verticalLimit(KnockbackSettings.DEFAULT.verticalLimit() / tps)
.extraHorizontal(KnockbackSettings.DEFAULT.extraHorizontal()) .extraHorizontal(KnockbackSettings.DEFAULT.extraHorizontal() / tps)
.extraVertical(KnockbackSettings.DEFAULT.extraVertical()) .extraVertical(KnockbackSettings.DEFAULT.extraVertical() / tps)
.build() .build()
) );
}
); );
this.eventNode().addListener(InstanceTickEvent.class, instanceTickEvent -> { this.eventNode().addListener(InstanceTickEvent.class, instanceTickEvent -> {
@@ -147,10 +147,10 @@ class Tetris extends StatelessGame {
TetrisGame tetrisGame = this.tetrisGames.get(p); TetrisGame tetrisGame = this.tetrisGames.get(p);
p.teleport(tetrisGame.getPlayerSpawnPosition());
tetrisGame.sidebar.addViewer(p); tetrisGame.sidebar.addViewer(p);
MinecraftServer.getSchedulerManager().scheduleTask(() -> { MinecraftServer.getSchedulerManager().scheduleTask(() -> {
p.teleport(tetrisGame.getPlayerSpawnPosition());
Entity ghostBlock = new Entity(EntityType.BLOCK_DISPLAY); Entity ghostBlock = new Entity(EntityType.BLOCK_DISPLAY);
((BlockDisplayMeta) ghostBlock.getEntityMeta()).setBlockState(Block.AIR); ((BlockDisplayMeta) ghostBlock.getEntityMeta()).setBlockState(Block.AIR);
ghostBlock.setNoGravity(true); ghostBlock.setNoGravity(true);
@@ -159,7 +159,6 @@ class Tetris extends StatelessGame {
return TaskSchedule.stop(); return TaskSchedule.stop();
}, TaskSchedule.nextTick()); }, TaskSchedule.nextTick());
return super.onPlayerJoin(p); return super.onPlayerJoin(p);
} }