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:
@@ -2,14 +2,15 @@ package com.hibiscusmc.hmccosmetics.cosmetic.behavior;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Updates cosmetics whenever a player moves.
|
||||
*/
|
||||
public interface CosmeticMovementBehavior {
|
||||
void dispatchMove(
|
||||
final CosmeticUser user,
|
||||
final Location from,
|
||||
final Location to
|
||||
@NotNull final CosmeticUser user,
|
||||
@NotNull final Location from,
|
||||
@NotNull final Location to
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.hibiscusmc.hmccosmetics.cosmetic.behavior;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Generic updates that happen every tick or when manually requested to be dispatched.
|
||||
*/
|
||||
public interface CosmeticUpdateBehavior {
|
||||
void dispatchUpdate(final CosmeticUser user);
|
||||
void dispatchUpdate(
|
||||
@NotNull final CosmeticUser user
|
||||
);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class CosmeticArmorType extends Cosmetic implements CosmeticUpdateBehavio
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchUpdate(CosmeticUser user) {
|
||||
public void dispatchUpdate(@NotNull CosmeticUser user) {
|
||||
if (user.isInWardrobe()) return;
|
||||
Entity entity = Bukkit.getEntity(user.getUniqueId());
|
||||
if (entity == null) return;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CosmeticBackpackType extends Cosmetic implements CosmeticUpdateBeha
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchUpdate(CosmeticUser user) {
|
||||
public void dispatchUpdate(@NotNull CosmeticUser user) {
|
||||
Entity entity = user.getEntity();
|
||||
if(entity == null) {
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ public class CosmeticBackpackType extends Cosmetic implements CosmeticUpdateBeha
|
||||
}
|
||||
|
||||
@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.
|
||||
Entity entity = user.getEntity();
|
||||
if(entity == null) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -55,7 +56,7 @@ public class CosmeticBalloonType extends Cosmetic implements CosmeticUpdateBehav
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchUpdate(CosmeticUser user) {
|
||||
public void dispatchUpdate(@NotNull CosmeticUser user) {
|
||||
Entity entity = Bukkit.getEntity(user.getUniqueId());
|
||||
UserBalloonManager userBalloonManager = user.getBalloonManager();
|
||||
|
||||
@@ -79,7 +80,7 @@ public class CosmeticBalloonType extends Cosmetic implements CosmeticUpdateBehav
|
||||
}
|
||||
|
||||
@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());
|
||||
UserBalloonManager userBalloonManager = user.getBalloonManager();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user