Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosdave34 committed Mar 26, 2024
1 parent 26a217e commit 4195589
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 0 additions & 2 deletions src/main/java/io/github/chaosdave34/ghutils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public static void registerEvents(@NotNull Listener listener) {
GHUtils.PLUGIN.getServer().getPluginManager().registerEvents(listener, GHUtils.PLUGIN);
}



public static void spawnNmsEntity(@NotNull Player p, @NotNull Entity entity) {
CraftPlayer cp = (CraftPlayer) p;
ServerPlayer sp = cp.getHandle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -56,23 +57,23 @@ public FakePlayer(String name, String worldName, Location position, float yaw, f
GHUtils.getFakePlayerHandler().registerFakePlayer(this);
}

public void onAttack(Player p) {
public void onAttack(@NotNull Player p) {
}

public void onInteract(Player p, EquipmentSlot hand) {
public void onInteract(@NotNull Player p, @NotNull EquipmentSlot hand) {
}

protected void updatePose(Pose pose) {
if (this.pose != pose) {
this.pose = pose;
GHUtils.getFakePlayerHandler().updatePose(this);
GHUtils.getFakePlayerHandler().updatePose(this);
}
}

protected void teleport(Location position) {
if (!this.position.equals(position)) {
this.position = position;
GHUtils.getFakePlayerHandler().teleport(this);
GHUtils.getFakePlayerHandler().teleport(this);
}
}

Expand All @@ -90,27 +91,27 @@ protected void move(Location position) {

this.position = position;

GHUtils.getFakePlayerHandler().move(this, deltaX, deltaY, deltaZ);
GHUtils.getFakePlayerHandler().move(this, deltaX, deltaY, deltaZ);
}
}

protected void updateEquipment(EquipmentSlot slot, ItemStack itemStack) {
if (!itemStack.equals(equipment.get(slot))) {
equipment.put(slot, itemStack);
GHUtils.getFakePlayerHandler().updateEquipment(this);
GHUtils.getFakePlayerHandler().updateEquipment(this);
}
}

protected void animate(Animation animation) {
GHUtils.getFakePlayerHandler().animate(this, animation.getId());
GHUtils.getFakePlayerHandler().animate(this, animation.getId());
}

protected void playHurtAnimation() {
GHUtils.getFakePlayerHandler().playHurtAnimation(this);
GHUtils.getFakePlayerHandler().playHurtAnimation(this);
}

protected void updateHandState(boolean active, InteractionHand hand) {
GHUtils.getFakePlayerHandler().updateHandState(this, active, hand);
GHUtils.getFakePlayerHandler().updateHandState(this, active, hand);
}

public void spawn(Player p) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/chaosdave34/ghutils/gui/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class Gui {

protected final Map<Integer, Method> inventoryClickHandlers = new HashMap<>();

private final Enchantment emptyEnchantment = new CustomEnchantment("empty", 1, "EMPTY", EnchantmentCategory.BREAKABLE, EquipmentSlot.values()).build();
protected final Enchantment emptyEnchantment = new CustomEnchantment("empty", 1, "EMPTY", EnchantmentCategory.BREAKABLE, EquipmentSlot.values()).build();

public Gui(int rows, Component title, boolean locked) {
this.rows = rows;
Expand Down

0 comments on commit 4195589

Please sign in to comment.