9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

chore: define nullability of behavior impl

This commit is contained in:
Logan
2025-12-16 12:52:41 -06:00
parent b0ba5fc011
commit 775699d9ca
5 changed files with 14 additions and 9 deletions

View File

@@ -2,14 +2,15 @@ package com.hibiscusmc.hmccosmetics.cosmetic.behavior;
import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
import org.bukkit.Location; import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
/** /**
* Updates cosmetics whenever a player moves. * Updates cosmetics whenever a player moves.
*/ */
public interface CosmeticMovementBehavior { public interface CosmeticMovementBehavior {
void dispatchMove( void dispatchMove(
final CosmeticUser user, @NotNull final CosmeticUser user,
final Location from, @NotNull final Location from,
final Location to @NotNull final Location to
); );
} }

View File

@@ -1,10 +1,13 @@
package com.hibiscusmc.hmccosmetics.cosmetic.behavior; package com.hibiscusmc.hmccosmetics.cosmetic.behavior;
import com.hibiscusmc.hmccosmetics.user.CosmeticUser; import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
import org.jetbrains.annotations.NotNull;
/** /**
* Generic updates that happen every tick or when manually requested to be dispatched. * Generic updates that happen every tick or when manually requested to be dispatched.
*/ */
public interface CosmeticUpdateBehavior { public interface CosmeticUpdateBehavior {
void dispatchUpdate(final CosmeticUser user); void dispatchUpdate(
@NotNull final CosmeticUser user
);
} }

View File

@@ -31,7 +31,7 @@ public class CosmeticArmorType extends Cosmetic implements CosmeticUpdateBehavio
} }
@Override @Override
public void dispatchUpdate(CosmeticUser user) { public void dispatchUpdate(@NotNull CosmeticUser user) {
if (user.isInWardrobe()) return; if (user.isInWardrobe()) return;
Entity entity = Bukkit.getEntity(user.getUniqueId()); Entity entity = Bukkit.getEntity(user.getUniqueId());
if (entity == null) return; if (entity == null) return;

View File

@@ -39,7 +39,7 @@ public class CosmeticBackpackType extends Cosmetic implements CosmeticUpdateBeha
} }
@Override @Override
public void dispatchUpdate(CosmeticUser user) { public void dispatchUpdate(@NotNull CosmeticUser user) {
Entity entity = user.getEntity(); Entity entity = user.getEntity();
if(entity == null) { if(entity == null) {
return; return;
@@ -95,7 +95,7 @@ public class CosmeticBackpackType extends Cosmetic implements CosmeticUpdateBeha
} }
@Override @Override
public void dispatchMove(CosmeticUser user, Location from, Location to) { public void dispatchMove(@NotNull CosmeticUser user, @NotNull Location from, @NotNull Location to) {
@SuppressWarnings("DuplicatedCode") // thanks. @SuppressWarnings("DuplicatedCode") // thanks.
Entity entity = user.getEntity(); Entity entity = user.getEntity();
if(entity == null) { if(entity == null) {

View File

@@ -16,6 +16,7 @@ import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
@@ -55,7 +56,7 @@ public class CosmeticBalloonType extends Cosmetic implements CosmeticUpdateBehav
} }
@Override @Override
public void dispatchUpdate(CosmeticUser user) { public void dispatchUpdate(@NotNull CosmeticUser user) {
Entity entity = Bukkit.getEntity(user.getUniqueId()); Entity entity = Bukkit.getEntity(user.getUniqueId());
UserBalloonManager userBalloonManager = user.getBalloonManager(); UserBalloonManager userBalloonManager = user.getBalloonManager();
@@ -79,7 +80,7 @@ public class CosmeticBalloonType extends Cosmetic implements CosmeticUpdateBehav
} }
@Override @Override
public void dispatchMove(CosmeticUser user, Location from, Location to) { public void dispatchMove(@NotNull CosmeticUser user, @NotNull Location from, @NotNull Location to) {
Entity entity = Bukkit.getEntity(user.getUniqueId()); Entity entity = Bukkit.getEntity(user.getUniqueId());
UserBalloonManager userBalloonManager = user.getBalloonManager(); UserBalloonManager userBalloonManager = user.getBalloonManager();