SteamWar/FightSystem
Archiviert
13
1

Test fix clipping while crouching
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-04-29 22:21:05 +02:00
Ursprung 8977cb1c6e
Commit 87dfd28636
4 geänderte Dateien mit 17 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -26,6 +26,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Dispenser; import org.bukkit.block.data.type.Dispenser;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockDataMeta; import org.bukkit.inventory.meta.BlockDataMeta;
@ -117,4 +118,9 @@ public class FlatteningWrapper14 implements FlatteningWrapper {
public boolean isFacingWater(Block dispenser) { public boolean isFacingWater(Block dispenser) {
return dispenser.getRelative(((Dispenser) dispenser.getBlockData()).getFacing()).isLiquid(); return dispenser.getRelative(((Dispenser) dispenser.getBlockData()).getFacing()).isLiquid();
} }
@Override
public boolean isCrouching(Player player) {
return player.isSwimming();
}
} }

Datei anzeigen

@ -23,6 +23,7 @@ import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -82,4 +83,9 @@ public class FlatteningWrapper8 implements FlatteningWrapper {
public boolean isFacingWater(Block dispenser) { public boolean isFacingWater(Block dispenser) {
return false; return false;
} }
@Override
public boolean isCrouching(Player player) {
return false;
}
} }

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -44,7 +45,7 @@ public class BlockPlaceCollision implements Listener {
// Hitbox size: 0.6xz, 1.8y, 1.5y when sneaking // Hitbox size: 0.6xz, 1.8y, 1.5y when sneaking
Player player = event.getPlayer(); Player player = event.getPlayer();
Location min = player.getLocation().add(-0.3, 0, -0.3); Location min = player.getLocation().add(-0.3, 0, -0.3);
Location max = player.getLocation().add(0.3, player.isSneaking() ? 1.5 : 1.8, 0.3); Location max = player.getLocation().add(0.3, FlatteningWrapper.impl.isCrouching(player) ? 0.6 : (player.isSneaking() ? 1.5 : 1.8), 0.3);
Location blockmin = block.getLocation(); Location blockmin = block.getLocation();
Location blockmax = block.getLocation().add(1.0, 1.0, 1.0); Location blockmax = block.getLocation().add(1.0, 1.0, 1.0);

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.FightSystem;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -48,4 +49,6 @@ public interface FlatteningWrapper {
boolean checkPistonMoving(Block block); boolean checkPistonMoving(Block block);
boolean isFacingWater(Block dispenser); boolean isFacingWater(Block dispenser);
boolean isCrouching(Player player);
} }