diff --git a/src/main/java/fr/phylisiumstudio/bullet/PhysicsEngineFactory.java b/src/main/java/fr/phylisiumstudio/bullet/PhysicsEngineFactory.java new file mode 100644 index 0000000..0eeb41f --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/bullet/PhysicsEngineFactory.java @@ -0,0 +1,40 @@ +package fr.phylisiumstudio.bullet; + +import com.bulletphysics.collision.broadphase.BroadphaseInterface; +import com.bulletphysics.collision.broadphase.DbvtBroadphase; +import com.bulletphysics.collision.dispatch.CollisionConfiguration; +import com.bulletphysics.collision.dispatch.CollisionDispatcher; +import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration; +import com.bulletphysics.collision.shapes.BoxShape; +import com.bulletphysics.collision.shapes.CollisionShape; +import com.bulletphysics.collision.shapes.SphereShape; +import com.bulletphysics.dynamics.DiscreteDynamicsWorld; +import com.bulletphysics.dynamics.RigidBody; +import com.bulletphysics.dynamics.RigidBodyConstructionInfo; +import com.bulletphysics.dynamics.constraintsolver.ConstraintSolver; +import com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver; +import com.bulletphysics.linearmath.Transform; +import fr.phylisiumstudio.logic.IPhysicsEngineFactory; + +import javax.vecmath.Vector3f; + +public class PhysicsEngineFactory implements IPhysicsEngineFactory { + @Override + public DiscreteDynamicsWorld createWorld() { + BroadphaseInterface broadphase = new DbvtBroadphase(); + CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration(); + CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration); + ConstraintSolver solver = new SequentialImpulseConstraintSolver(); + return new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration); + } + + @Override + public RigidBody createRigidBody(float mass, CollisionShape shape, Transform transform) { + Vector3f localInertia = new Vector3f(0, 0, 0); + shape.calculateLocalInertia(mass, localInertia); + RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(mass, null, shape, localInertia); + RigidBody body = new RigidBody(constructionInfo); + body.setWorldTransform(transform); + return body; + } +} diff --git a/src/main/java/fr/phylisiumstudio/bullet/WorldPhysics.java b/src/main/java/fr/phylisiumstudio/bullet/WorldPhysics.java new file mode 100644 index 0000000..1a4dc11 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/bullet/WorldPhysics.java @@ -0,0 +1,104 @@ +package fr.phylisiumstudio.bullet; + +import com.bulletphysics.collision.shapes.BoxShape; +import com.bulletphysics.collision.shapes.SphereShape; +import com.bulletphysics.dynamics.DiscreteDynamicsWorld; +import com.bulletphysics.dynamics.RigidBody; +import com.bulletphysics.linearmath.Transform; +import fr.phylisiumstudio.logic.IPhysicsEngineFactory; +import fr.phylisiumstudio.logic.IWorldPhysics; +import fr.phylisiumstudio.soraxPhysic.models.RigidBlock; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.BlockDisplay; +import org.bukkit.entity.Interaction; +import org.bukkit.util.Transformation; + +import javax.vecmath.Vector3f; +import java.util.ArrayList; +import java.util.List; + +public class WorldPhysics implements IWorldPhysics { + private final DiscreteDynamicsWorld dynamicsWorld; + private final List rigidBlocks = new ArrayList<>(); + private final IPhysicsEngineFactory physicsFactory; + private final Object lock = new Object(); + + public WorldPhysics(IPhysicsEngineFactory physicsFactory) { + this.physicsFactory = physicsFactory; + this.dynamicsWorld = physicsFactory.createDynamicsWorld(); + } + + @Override + public void stepSimulation() { + synchronized (lock) { + dynamicsWorld.stepSimulation(1/20f, 30); + } + } + + @Override + public RigidBody createBoxShape(Location location, Material material, float mass, float xScale, float yScale, float zScale) { + // Abstraction de la création des objets physiques + Vector3f dimensions = new Vector3f(xScale / 2, yScale / 2, zScale / 2); + BoxShape boxShape = physicsFactory.createBoxShape(dimensions); + + Transform transform = new Transform(); + transform.setIdentity(); + transform.origin.set((float) location.getX(), (float) location.getY(), (float) location.getZ()); + + RigidBody body = physicsFactory.createRigidBody(mass, boxShape, transform); + dynamicsWorld.addRigidBody(body); + + // Gestion de l'affichage du bloc dans Bukkit + createDisplayAndHitbox(location, material, xScale, yScale, zScale, body); + + return body; + } + + @Override + public void createSphereShape(Location location, Material material, float mass, float radius) { + // Création d'une sphère + SphereShape sphereShape = physicsFactory.createSphereShape(radius); + + Transform transform = new Transform(); + transform.setIdentity(); + transform.origin.set((float) location.getX(), (float) location.getY(), (float) location.getZ()); + + RigidBody body = physicsFactory.createRigidBody(mass, sphereShape, transform); + dynamicsWorld.addRigidBody(body); + + createDisplayAndHitbox(location, material, radius, radius, radius, body); + } + + private void createDisplayAndHitbox(Location location, Material material, float xScale, float yScale, float zScale, RigidBody body) { + BlockDisplay blockDisplay = location.getWorld().spawn(location, BlockDisplay.class, display -> { + display.setTeleportDuration(1); + display.setBlock(material.createBlockData()); + Transformation transformation = display.getTransformation(); + org.joml.Vector3f translation = new org.joml.Vector3f(-xScale / 2, -yScale / 2, -zScale / 2); + org.joml.Vector3f scale = new org.joml.Vector3f(xScale, yScale, zScale); + display.setTransformation(new Transformation(translation, transformation.getLeftRotation(), scale, transformation.getRightRotation())); + }); + + Interaction hitbox = location.getWorld().spawn(location, Interaction.class, interaction -> { + interaction.setInteractionHeight(yScale); + interaction.setInteractionWidth(zScale); + interaction.setResponsive(true); + }); + + RigidBlock rigidBlock = new RigidBlock(body, blockDisplay, hitbox); + rigidBlocks.add(rigidBlock); + } + + @Override + public void clearAll() { + synchronized (lock) { + for (RigidBlock rigidBlock : rigidBlocks) { + dynamicsWorld.removeRigidBody(rigidBlock.getRigidBody()); + rigidBlock.getBlockDisplay().remove(); + rigidBlock.getInteraction().remove(); + } + rigidBlocks.clear(); + } + } +} diff --git a/src/main/java/fr/phylisiumstudio/bullet/fabric/ShapeAbstractFabric.java b/src/main/java/fr/phylisiumstudio/bullet/fabric/ShapeAbstractFabric.java new file mode 100644 index 0000000..64e8bed --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/bullet/fabric/ShapeAbstractFabric.java @@ -0,0 +1,10 @@ +package fr.phylisiumstudio.bullet.fabric; + +import com.bulletphysics.collision.shapes.CollisionShape; +import fr.phylisiumstudio.logic.fabric.AbstractFactory; + +/** + * Abstract factory for creating shapes + */ +public class ShapeAbstractFabric extends AbstractFactory { +} diff --git a/src/main/java/fr/phylisiumstudio/bullet/fabric/ShapeConstructor.java b/src/main/java/fr/phylisiumstudio/bullet/fabric/ShapeConstructor.java new file mode 100644 index 0000000..a34af56 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/bullet/fabric/ShapeConstructor.java @@ -0,0 +1,10 @@ +package fr.phylisiumstudio.bullet.fabric; + +import com.bulletphysics.collision.shapes.CollisionShape; +import fr.phylisiumstudio.logic.fabric.IConstructor; + +/** + * Abstract class for the shape constructor + */ +public abstract class ShapeConstructor implements IConstructor { +} diff --git a/src/main/java/fr/phylisiumstudio/bullet/fabric/constructors/CubeConstructor.java b/src/main/java/fr/phylisiumstudio/bullet/fabric/constructors/CubeConstructor.java new file mode 100644 index 0000000..52cb953 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/bullet/fabric/constructors/CubeConstructor.java @@ -0,0 +1,23 @@ +package fr.phylisiumstudio.bullet.fabric.constructors; + +import com.bulletphysics.collision.shapes.BoxShape; +import com.bulletphysics.collision.shapes.CollisionShape; +import fr.phylisiumstudio.bullet.fabric.ShapeConstructor; + +import javax.vecmath.Vector3f; + +/** + * Constructor for the cube shape + */ +public class CubeConstructor extends ShapeConstructor { + @Override + public String getName() { + return "cube"; + } + + @Override + public CollisionShape construct(Object... args) { + Vector3f size = (Vector3f) args[0]; + return new BoxShape(size); + } +} diff --git a/src/main/java/fr/phylisiumstudio/bullet/fabric/constructors/SphereConstructor.java b/src/main/java/fr/phylisiumstudio/bullet/fabric/constructors/SphereConstructor.java new file mode 100644 index 0000000..42305f1 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/bullet/fabric/constructors/SphereConstructor.java @@ -0,0 +1,21 @@ +package fr.phylisiumstudio.bullet.fabric.constructors; + +import com.bulletphysics.collision.shapes.CollisionShape; +import com.bulletphysics.collision.shapes.SphereShape; +import fr.phylisiumstudio.bullet.fabric.ShapeConstructor; + +/** + * Constructor for the sphere shape + */ +public class SphereConstructor extends ShapeConstructor { + @Override + public String getName() { + return "sphere"; + } + + @Override + public CollisionShape construct(Object... args) { + float radius = (float) args[0]; + return new SphereShape(radius); + } +} diff --git a/src/main/java/fr/phylisiumstudio/logic/IPhysicsEngineFactory.java b/src/main/java/fr/phylisiumstudio/logic/IPhysicsEngineFactory.java new file mode 100644 index 0000000..7645116 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/logic/IPhysicsEngineFactory.java @@ -0,0 +1,31 @@ +package fr.phylisiumstudio.logic; + +import com.bulletphysics.collision.shapes.BoxShape; +import com.bulletphysics.collision.shapes.CollisionShape; +import com.bulletphysics.collision.shapes.SphereShape; +import com.bulletphysics.dynamics.DiscreteDynamicsWorld; +import com.bulletphysics.dynamics.RigidBody; +import com.bulletphysics.linearmath.Transform; + +import javax.vecmath.Vector3f; + +/** + * Factory for creating physics engine objects + */ +public interface IPhysicsEngineFactory { + + /** + * Create a new dynamics world + * @return the new dynamics world + */ + T createWorld(); + + /** + * Create a new rigid body + * @param mass the mass of the rigid body + * @param shape the shape of the rigid body + * @param transform the transform of the rigid body + * @return the new rigid body + */ + C createRigidBody(float mass, W shape, V transform); +} diff --git a/src/main/java/fr/phylisiumstudio/logic/IPhysicsManager.java b/src/main/java/fr/phylisiumstudio/logic/IPhysicsManager.java new file mode 100644 index 0000000..2993845 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/logic/IPhysicsManager.java @@ -0,0 +1,26 @@ +package fr.phylisiumstudio.logic; + +import org.bukkit.World; + +/** + * Interface for the physics manager + */ +public interface IPhysicsManager { + /** + * Get the physics engine for a world + * @param world The world + * @return The physics engine + */ + IWorldPhysics getWorldPhysics(World world); + + /** + * Setup the physics engine for a world + * @param world The world + */ + void setupPhysicsEngine(World world); + + /** + * Stop the physics engine + */ + void stop(); +} diff --git a/src/main/java/fr/phylisiumstudio/logic/IWorldPhysics.java b/src/main/java/fr/phylisiumstudio/logic/IWorldPhysics.java new file mode 100644 index 0000000..a15aa9b --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/logic/IWorldPhysics.java @@ -0,0 +1,19 @@ +package fr.phylisiumstudio.logic; + +import java.util.UUID; + +/** + * Interface for the physics world + */ +public interface IWorldPhysics { + /** + * Step the simulation + */ + void stepSimulation(); + + /** + * Get the unique id of the world + * @return the unique id + */ + UUID uniqueId(); +} diff --git a/src/main/java/fr/phylisiumstudio/logic/ItemLinker.java b/src/main/java/fr/phylisiumstudio/logic/ItemLinker.java deleted file mode 100644 index f381540..0000000 --- a/src/main/java/fr/phylisiumstudio/logic/ItemLinker.java +++ /dev/null @@ -1,42 +0,0 @@ -package fr.phylisiumstudio.logic; - -import java.util.UUID; - -public class ItemLinker { - private final UUID id; - - private UUID firstRigidBody; - private UUID secondRigidBody; - - public ItemLinker(UUID id) { - this.id = id; - } - - public UUID getId() { - return id; - } - - public UUID getFirstRigidBody() { - return firstRigidBody; - } - - public void setFirstRigidBody(UUID firstRigidBody) { - this.firstRigidBody = firstRigidBody; - } - - public UUID getSecondRigidBody() { - return secondRigidBody; - } - - public void setSecondRigidBody(UUID secondRigidBody) { - this.secondRigidBody = secondRigidBody; - } - - public boolean hasFirstRigidBody() { - return firstRigidBody != null; - } - - public boolean hasSecondRigidBody() { - return secondRigidBody != null; - } -} diff --git a/src/main/java/fr/phylisiumstudio/logic/fabric/AbstractFactory.java b/src/main/java/fr/phylisiumstudio/logic/fabric/AbstractFactory.java new file mode 100644 index 0000000..185fe06 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/logic/fabric/AbstractFactory.java @@ -0,0 +1,91 @@ +package fr.phylisiumstudio.logic.fabric; + +import java.util.ArrayList; +import java.util.List; + +/** + * Abstract factory for creating objects + * @param the type of object to create + * @param the type of constructor + */ +public abstract class AbstractFactory> { + private final List constructors; + + /** + * Create a new abstract factory + */ + public AbstractFactory() { + this.constructors = new ArrayList<>(); + } + + /** + * Construct an object by name + * @param name the name of the object to construct + * @return the object + */ + public T construct(String name, Object... args) { + for (C constructor : constructors) { + if (constructor.getName().equals(name)) { + return constructor.construct(args); + } + } + return null; + } + + /** + * Get all the registered names + * @return the names + */ + public List getAllRegisteredNames() { + List names = new ArrayList<>(); + for (C constructor : constructors) { + names.add(constructor.getName()); + } + return names; + } + + /** + * Register a constructor + * @param constructor the constructor + */ + public void registerConstructor(C constructor) { + constructors.add(constructor); + } + + /** + * Unregister a constructor + * @param constructor the constructor + */ + public void unregisterConstructor(C constructor) { + constructors.remove(constructor); + } + + /** + * Get the constructor by name + * @param name the name + * @return the constructor + */ + public C getConstructor(String name) { + for (C constructor : constructors) { + if (constructor.getName().equals(name)) { + return constructor; + } + } + return null; + } + + /** + * Get all the constructors + * @return the constructors in a new list + */ + public List getConstructors() { + return new ArrayList<>(constructors); + } + + /** + * Clear all the constructors + */ + public void clear() { + constructors.clear(); + } +} diff --git a/src/main/java/fr/phylisiumstudio/logic/fabric/IConstructor.java b/src/main/java/fr/phylisiumstudio/logic/fabric/IConstructor.java new file mode 100644 index 0000000..a0ee388 --- /dev/null +++ b/src/main/java/fr/phylisiumstudio/logic/fabric/IConstructor.java @@ -0,0 +1,6 @@ +package fr.phylisiumstudio.logic.fabric; + +public interface IConstructor { + String getName(); + T construct(Object... args); +} diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/ItemLinkerManager.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/ItemLinkerManager.java index 45eace4..7c2388c 100644 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/ItemLinkerManager.java +++ b/src/main/java/fr/phylisiumstudio/soraxPhysic/ItemLinkerManager.java @@ -1,6 +1,5 @@ package fr.phylisiumstudio.soraxPhysic; -import fr.phylisiumstudio.logic.ItemLinker; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/PhysicsManager.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/PhysicsManager.java index f78e785..f8388bd 100644 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/PhysicsManager.java +++ b/src/main/java/fr/phylisiumstudio/soraxPhysic/PhysicsManager.java @@ -30,9 +30,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import static org.bukkit.block.BlockFace.NORTH; -import static org.bukkit.block.BlockFace.SOUTH; - public class PhysicsManager { private DiscreteDynamicsWorld dynamicsWorld; private final World bukkitWorld; diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/SoraxPhysic.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/SoraxPhysic.java index 9c9998e..542e0e7 100644 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/SoraxPhysic.java +++ b/src/main/java/fr/phylisiumstudio/soraxPhysic/SoraxPhysic.java @@ -5,7 +5,7 @@ import com.sk89q.worldedit.session.SessionManager; import fr.phylisiumstudio.soraxPhysic.commands.PhysicsCommands; import fr.phylisiumstudio.soraxPhysic.listeners.RigidbodyListener; -import fr.phylisiumstudio.soraxPhysic.listeners.ToolsListener; +import fr.phylisiumstudio.soraxPhysic.listeners.PlayerActionListener; import org.bstats.bukkit.Metrics; import org.bstats.charts.SimplePie; import org.bukkit.Material; @@ -80,7 +80,7 @@ private void setupPhysics() { } private void setupListeners() { - getServer().getPluginManager().registerEvents(new ToolsListener(physicsManager, this.itemLinkerManager), this); + getServer().getPluginManager().registerEvents(new PlayerActionListener(physicsManager, this.itemLinkerManager), this); getServer().getPluginManager().registerEvents(new RigidbodyListener(physicsManager, getServer()), this); } diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/consumers/ToolHeld.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/consumers/ToolHeld.java deleted file mode 100644 index c843aaf..0000000 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/consumers/ToolHeld.java +++ /dev/null @@ -1,9 +0,0 @@ -package fr.phylisiumstudio.soraxPhysic.consumers; - -import io.papermc.paper.event.player.PlayerInventorySlotChangeEvent; -import org.bukkit.inventory.ItemStack; - -@FunctionalInterface -public interface ToolHeld { - void onToolHeld(ItemStack itemStack, PlayerInventorySlotChangeEvent event); -} diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/consumers/ToolUnheld.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/consumers/ToolUnheld.java deleted file mode 100644 index 822e667..0000000 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/consumers/ToolUnheld.java +++ /dev/null @@ -1,9 +0,0 @@ -package fr.phylisiumstudio.soraxPhysic.consumers; - -import io.papermc.paper.event.player.PlayerInventorySlotChangeEvent; -import org.bukkit.inventory.ItemStack; - -@FunctionalInterface -public interface ToolUnheld { - void onToolUnheld(ItemStack itemStack, PlayerInventorySlotChangeEvent event); -} diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/ToolsListener.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/PlayerActionListener.java similarity index 67% rename from src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/ToolsListener.java rename to src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/PlayerActionListener.java index 3fae8f6..f346f73 100644 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/ToolsListener.java +++ b/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/PlayerActionListener.java @@ -1,59 +1,27 @@ package fr.phylisiumstudio.soraxPhysic.listeners; -import com.bulletphysics.dynamics.RigidBody; -import fr.phylisiumstudio.logic.ItemLinker; import fr.phylisiumstudio.soraxPhysic.ItemLinkerManager; import fr.phylisiumstudio.soraxPhysic.PhysicsManager; -import fr.phylisiumstudio.soraxPhysic.consumers.ToolHeld; -import fr.phylisiumstudio.soraxPhysic.consumers.ToolUnheld; import fr.phylisiumstudio.soraxPhysic.event.LeftClickRigidblockEvent; import fr.phylisiumstudio.soraxPhysic.event.RightClickRigidblockEvent; import fr.phylisiumstudio.soraxPhysic.models.RigidBlock; -import io.papermc.paper.event.player.PlayerInventorySlotChangeEvent; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import javax.vecmath.Vector3f; -import java.util.HashMap; -import java.util.Map; -public class ToolsListener implements Listener { +public class PlayerActionListener implements Listener { private final PhysicsManager physicsManager; private final ItemLinkerManager itemLinkerManager; - private final Map toolHeldMap; - private final Map toolUnheldMap; - - public ToolsListener(PhysicsManager physicsManager, ItemLinkerManager itemLinkerManager) { + public PlayerActionListener(PhysicsManager physicsManager, ItemLinkerManager itemLinkerManager) { this.physicsManager = physicsManager; this.itemLinkerManager = itemLinkerManager; - - this.toolHeldMap = new HashMap<>(); - this.toolUnheldMap = new HashMap<>(); - - } - - @EventHandler - public void onToolHeld(PlayerInventorySlotChangeEvent event){ - ItemStack newItem = event.getNewItemStack(); - ItemStack oldItem = event.getOldItemStack(); - - Integer newUUID = newItem.hashCode(); - Integer oldUUID = oldItem.hashCode(); - - if (toolHeldMap.containsKey(newUUID)){ - toolHeldMap.get(newUUID).onToolHeld(newItem, event); - } - - if (toolUnheldMap.containsKey(oldUUID)){ - toolUnheldMap.get(oldUUID).onToolUnheld(oldItem, event); - } } @EventHandler(priority = EventPriority.LOW) @@ -97,12 +65,4 @@ public void onLeftClickRigidbody(LeftClickRigidblockEvent event){ org.joml.Vector3f clickedPositionJoml = new org.joml.Vector3f((float) clickedPosition.getX(), (float) clickedPosition.getY(), (float) clickedPosition.getZ()); rigidBlock.applyImpulse(clickedPositionJoml, impulseJoml); } - - public void registerToolHeld(Integer uuid, ToolHeld toolHeld){ - toolHeldMap.put(uuid, toolHeld); - } - - public void registerToolUnheld(Integer uuid, ToolUnheld toolUnheld){ - toolUnheldMap.put(uuid, toolUnheld); - } } diff --git a/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/RigidbodyListener.java b/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/RigidbodyListener.java index 0b6f190..e70115b 100644 --- a/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/RigidbodyListener.java +++ b/src/main/java/fr/phylisiumstudio/soraxPhysic/listeners/RigidbodyListener.java @@ -19,8 +19,8 @@ import java.util.List; public class RigidbodyListener implements Listener { - private PhysicsManager physicsManager; - private Server server; + private final PhysicsManager physicsManager; + private final Server server; public RigidbodyListener(PhysicsManager physicsManager, Server server) { this.physicsManager = physicsManager;