diff --git a/common/src/main/java/de/bluecolored/bluemap/common/serverinterface/Player.java b/common/src/main/java/de/bluecolored/bluemap/common/serverinterface/Player.java index 320f2da4..a5242333 100644 --- a/common/src/main/java/de/bluecolored/bluemap/common/serverinterface/Player.java +++ b/common/src/main/java/de/bluecolored/bluemap/common/serverinterface/Player.java @@ -29,42 +29,42 @@ import java.util.UUID; -public interface Player { +public abstract class Player { - UUID getUuid(); + public abstract UUID getUuid(); - Text getName(); + public abstract Text getName(); - ServerWorld getWorld(); + public abstract ServerWorld getWorld(); - Vector3d getPosition(); + public abstract Vector3d getPosition(); /** * x -> pitch, y -> yaw, z -> roll */ - Vector3d getRotation(); + public abstract Vector3d getRotation(); - int getSkyLight(); + public abstract int getSkyLight(); - int getBlockLight(); + public abstract int getBlockLight(); /** * Return true if the player is sneaking. *

If the player is offline the value of this method is undetermined.

*/ - boolean isSneaking(); + public abstract boolean isSneaking(); /** * Returns true if the player has an invisibillity effect *

If the player is offline the value of this method is undetermined.

*/ - boolean isInvisible(); + public abstract boolean isInvisible(); /** * Returns true if the player is vanished *

If the player is offline the value of this method is undetermined.

*/ - default boolean isVanished() { + public boolean isVanished() { return false; } @@ -72,6 +72,17 @@ default boolean isVanished() { * Returns the {@link Gamemode} this player is in *

If the player is offline the value of this method is undetermined.

*/ - Gamemode getGamemode(); + public abstract Gamemode getGamemode(); + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) return false; + Player other = (Player) o; + return getUuid().equals(other.getUuid()); + } + + @Override + public int hashCode() { + return getUuid().hashCode(); + } } diff --git a/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java b/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java index 692256dd..d54169ce 100644 --- a/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java +++ b/implementations/fabric/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java @@ -41,7 +41,7 @@ import java.util.Map; import java.util.UUID; -public class FabricPlayer implements Player { +public class FabricPlayer extends Player { private static final Map GAMEMODE_MAP = new EnumMap<>(GameMode.class); static { diff --git a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java index e90501b3..5b305d55 100644 --- a/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java +++ b/implementations/forge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java @@ -42,7 +42,7 @@ import java.util.Map; import java.util.UUID; -public class ForgePlayer implements Player { +public class ForgePlayer extends Player { private static final Map GAMEMODE_MAP = new EnumMap<>(GameType.class); static { diff --git a/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java b/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java index e90501b3..5b305d55 100644 --- a/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java +++ b/implementations/neoforge/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java @@ -42,7 +42,7 @@ import java.util.Map; import java.util.UUID; -public class ForgePlayer implements Player { +public class ForgePlayer extends Player { private static final Map GAMEMODE_MAP = new EnumMap<>(GameType.class); static { diff --git a/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java b/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java index fd9c1aee..a4f783ed 100644 --- a/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java +++ b/implementations/paper/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java @@ -38,7 +38,7 @@ import java.util.*; -public class BukkitPlayer implements Player { +public class BukkitPlayer extends Player { private static final Map GAMEMODE_MAP = new EnumMap<>(GameMode.class); static { diff --git a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java index 26de00f7..2d8e876b 100644 --- a/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java +++ b/implementations/spigot/src/main/java/de/bluecolored/bluemap/bukkit/BukkitPlayer.java @@ -39,7 +39,7 @@ import java.util.Map; import java.util.UUID; -public class BukkitPlayer implements Player { +public class BukkitPlayer extends Player { private static final Map GAMEMODE_MAP = new EnumMap<>(GameMode.class); static { diff --git a/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/SpongePlayer.java b/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/SpongePlayer.java index a0d5f694..6a0386ad 100644 --- a/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/SpongePlayer.java +++ b/implementations/sponge/src/main/java/de/bluecolored/bluemap/sponge/SpongePlayer.java @@ -41,7 +41,7 @@ import java.util.*; -public class SpongePlayer implements Player { +public class SpongePlayer extends Player { private static final Map GAMEMODE_MAP = new HashMap<>(5); static {