Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Fabric targeting Minecraft 1.20.1 #217

Merged
merged 75 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
3213ae6
Upgrade the Fabric version and rewrite the code.
hanbings Jun 29, 2023
b4de30c
Migrate the completed code of version 1.19.2.
hanbings Jun 29, 2023
614e347
fabric: some events.
hanbings Jun 30, 2023
6717fdb
Merge branch 'WiIIiam278:master' into master
hanbings Jul 1, 2023
323b0ae
Updated open source license to Apache 2.0.
hanbings Jul 1, 2023
77d7d45
Add Plan analyzer support.
hanbings Jul 1, 2023
8d638d1
Merge branch 'WiIIiam278:master' into master
hanbings Sep 6, 2023
37461f0
Merge branch 'WiIIiam278:master' into master
hanbings Sep 12, 2023
125a6c1
Fix build.
hanbings Sep 12, 2023
f5028b2
Merge branch 'master' into dev/fabric
WiIIiam278 Sep 23, 2023
96639f7
`UnsupportedOperationException`
WiIIiam278 Sep 23, 2023
36ba15d
More fabric implementation work, update to v3's structure
WiIIiam278 Sep 23, 2023
9ab4880
Suppress compiler warnings
WiIIiam278 Sep 23, 2023
7fb3418
Add commands, adjust registration order
WiIIiam278 Sep 23, 2023
8af5af4
Merge branch 'master' into dev/fabric
WiIIiam278 Sep 23, 2023
553c82e
Inventory and ender chest data/serializers
WiIIiam278 Sep 23, 2023
0a3c7ca
Update license headers
WiIIiam278 Sep 23, 2023
83fc337
Fixup shaded library relocations
WiIIiam278 Sep 23, 2023
eb5a870
Merge branch 'master' into dev/fabric
WiIIiam278 Sep 23, 2023
65e2d8e
Merge branch 'master' into dev/fabric
WiIIiam278 Sep 23, 2023
a9a9f59
Merge branch 'master' into master
WiIIiam278 Oct 1, 2023
44ca49a
Merge branch 'master' into dev/fabric
WiIIiam278 Oct 5, 2023
8c4b278
Merge remote-tracking branch 'hanbings/master' into dev/fabric
WiIIiam278 Oct 5, 2023
8041b75
Merge branch 'master' into master
WiIIiam278 Oct 6, 2023
8e3b900
Merge branch 'master' into dev/fabric
WiIIiam278 Oct 13, 2023
cedbba0
Merge remote-tracking branch 'hanbings/master' into dev/fabric
WiIIiam278 Oct 13, 2023
6f32483
Fix build
WiIIiam278 Oct 13, 2023
9f3c377
Potion effects & location serializers
WiIIiam278 Oct 14, 2023
531de61
Catch `Files.createDirectory(path);` in `#getDataFolder`
WiIIiam278 Oct 14, 2023
00b3adc
Merge branch 'master' into master
WiIIiam278 Oct 14, 2023
27ef962
Update fabric.mod.json metadata, correct icon
WiIIiam278 Oct 14, 2023
1f44ab5
Merge branch 'master' into master
WiIIiam278 Nov 3, 2023
52f157b
Merge branch 'master' into feat/fabric
WiIIiam278 Dec 19, 2023
fd33010
Merge remote-tracking branch 'hanbings/master' into feat/fabric
WiIIiam278 Dec 19, 2023
dada5d1
Merge branch 'master' into feat/fabric
WiIIiam278 Dec 21, 2023
1d2183e
Merge branch 'master' into feat/fabric
WiIIiam278 Dec 21, 2023
833ed56
Events for Fabric (#218)
Stampede2011 Dec 26, 2023
5bafa7c
Merge remote-tracking branch 'origin/master' into feat/fabric
WiIIiam278 Dec 26, 2023
5d9986b
deps: Include all bukkit runtime deps
WiIIiam278 Dec 26, 2023
b85a9cb
fix/fabric: Supply AudienceProvider to `ConsoleUser` constructor
WiIIiam278 Dec 26, 2023
0ac98b3
docs: credit Fabric porters :)
WiIIiam278 Dec 26, 2023
5f32d32
fix: Item deserialization now working
WiIIiam278 Dec 26, 2023
5d60231
Merge branch 'master' into feat/fabric
WiIIiam278 Dec 26, 2023
d78b0f9
refactor: Remove inventory debug log
WiIIiam278 Dec 26, 2023
ad8294d
Merge branch 'master' into feat/fabric
WiIIiam278 Dec 26, 2023
f4ca5e8
Merge branch 'master' into feat/fabric
WiIIiam278 Dec 26, 2023
f1715a1
docs: Update `fabric.mod.json`
WiIIiam278 Dec 26, 2023
b82770b
Merge branch 'master' into feat/fabric
WiIIiam278 Jan 16, 2024
c1a1feb
Merge branch 'master' into feat/fabric
WiIIiam278 Feb 27, 2024
83fe226
refactor: update with upstream changes
WiIIiam278 Feb 27, 2024
6bdee54
fix: dangling JD comment
WiIIiam278 Feb 27, 2024
3080c42
fix: config file reference fixes
WiIIiam278 Feb 27, 2024
db2c6ae
refactor: optimize imports, fix relocation
WiIIiam278 Feb 27, 2024
e849734
refactor: move tag references to common
WiIIiam278 Feb 27, 2024
6fa1067
refactor: use lombok for data / serializer methods
WiIIiam278 Feb 27, 2024
30fba64
Merge branch 'master' into feat/fabric
WiIIiam278 Mar 8, 2024
c8db839
fix: bad annotating
WiIIiam278 Mar 8, 2024
7a82cd7
refactor: adjust callback formatting
WiIIiam278 Mar 8, 2024
b95d6e4
Merge branch 'master' into feat/fabric
WiIIiam278 Apr 2, 2024
44a020c
Merge branch 'refs/heads/master' into feat/fabric
WiIIiam278 Jun 1, 2024
159727c
fabric: bump deps, refactor to match main branch
WiIIiam278 Jun 1, 2024
eb3dc2e
fabric: more serializer type work
WiIIiam278 Jun 1, 2024
24543e8
Merge branch 'refs/heads/master' into feat/fabric
WiIIiam278 Jun 9, 2024
4164ef5
feat: register more fabric data serializers
WiIIiam278 Jun 9, 2024
0678201
feat: implement remaining Fabric serializers
WiIIiam278 Jun 9, 2024
9be2c4f
feat: add on-the-fly DFU for Fabric
WiIIiam278 Jun 9, 2024
1a5c6a7
feat: add missing mixins
WiIIiam278 Jun 9, 2024
0d5b3e6
feat: implement toKeep/toDrop option on Fabric
WiIIiam278 Jun 9, 2024
d4f0f8b
feat: apply stats on sync
WiIIiam278 Jun 9, 2024
beb74d7
build: append fabric MC version to file name
WiIIiam278 Jun 9, 2024
b18c2e5
feat: add HuskSync API support for Fabric
WiIIiam278 Jun 9, 2024
13b2d01
refactor: fixup a deprecation in the wrong spot
WiIIiam278 Jun 9, 2024
0c6c873
refactor: optimize fabric item serializing in-line with Bukkit
WiIIiam278 Jun 9, 2024
a6985d3
feat: implement viewer GUIs on Fabric
WiIIiam278 Jun 9, 2024
cfde673
docs: Fabric is in Alpha for now
WiIIiam278 Jun 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
**Ready?** [It's syncing time!](https://william278.net/docs/husksync/setup)

## Setup
Requires a MySQL/Mongo/PostgreSQL database, a Redis (v5.0+) server and any number of Spigot-based 1.17.1+ Minecraft servers, running Java 17+.
Requires a MySQL/Mongo/PostgreSQL database, a Redis (v5.0+) server and a network of Spigot (1.17.1+) or Fabric (1.20.1) Minecraft servers, running Java 17+.

1. Place the plugin jar file in the /plugins/ directory of each Spigot server. You do not need to install HuskSync as a proxy plugin.
1. Place the plugin jar file in the `/plugins` or `/mods` directory of each Spigot/Fabric server. You do not need to install HuskSync as a proxy plugin.
2. Start, then stop every server to let HuskSync generate the config file.
3. Navigate to the HuskSync config file on each server (~/plugins/HuskSync/config.yml) and fill in both your database and Redis server credentials.
3. Navigate to the HuskSync config file on each server and fill in both your database and Redis server credentials.
4. Start every server again and synchronization will begin.

## Development
To build HuskSync, simply run the following in the root of the repository:
To build HuskSync, simply run the following in the root of the repository (building requires Java 17). Builds will be output in `/target`:

```bash
./gradlew clean build
Expand All @@ -66,7 +66,7 @@ HuskSync is licensed under the Apache 2.0 license.
Contributions to the project are welcome—feel free to open a pull request with new features, improvements and/or fixes!

### Support
Due to its complexity, official binaries and customer support for HuskSync is provided through a paid model. This means that support is only available to users who have purchased a license to the plugin from Spigot, Polymart, Craftaro, or BuiltByBit and have provided proof of purchase. Please join our Discord server if you have done so and need help!
Due to its complexity, official binaries and customer support for HuskSync is provided through a paid model. This means that support is only available to users who have purchased a license to the plugin from Spigot, Polymart, or BuiltByBit and have provided proof of purchase. Please join our Discord server if you have done so and need help!

### Translations
Translations of the plugin locales are welcome to help make the plugin more accessible. Please submit a pull request with your translations as a `.yml` file.
Expand Down
21 changes: 20 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ allprojects {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url "https://repo.dmulloy2.net/repository/public/" }
maven { url 'https://repo.codemc.io/repository/maven-public/' }
Expand Down Expand Up @@ -117,8 +118,13 @@ subprojects {
archiveClassifier.set('')
}

// Append the Minecraft to the version for Fabric projects
if (project.name == 'fabric') {
version += "+mc.${fabric_minecraft_version}"
}

// API publishing
if (['common', 'bukkit'].contains(project.name)) {
if (['common', 'bukkit', 'fabric'].contains(project.name)) {
java {
withSourcesJar()
withJavadocJar()
Expand Down Expand Up @@ -157,6 +163,19 @@ subprojects {
}
}
}

if (['fabric'].contains(project.name)) {
publications {
mavenJavaFabric(MavenPublication) {
groupId = 'net.william278.husksync'
artifactId = 'husksync-fabric'
version = "$rootProject.version"
artifact shadowJar
artifact sourcesJar
artifact javadocJar
}
}
}
}
}

Expand Down
16 changes: 8 additions & 8 deletions bukkit/src/main/java/net/william278/husksync/BukkitHuskSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ public void onEnable() {
registerSerializer(Identifier.INVENTORY, new BukkitSerializer.Inventory(this));
registerSerializer(Identifier.ENDER_CHEST, new BukkitSerializer.EnderChest(this));
registerSerializer(Identifier.ADVANCEMENTS, new BukkitSerializer.Advancements(this));
registerSerializer(Identifier.STATISTICS, new BukkitSerializer.Json<>(this, BukkitData.Statistics.class));
registerSerializer(Identifier.STATISTICS, new Serializer.Json<>(this, BukkitData.Statistics.class));
registerSerializer(Identifier.POTION_EFFECTS, new BukkitSerializer.PotionEffects(this));
registerSerializer(Identifier.GAME_MODE, new BukkitSerializer.Json<>(this, BukkitData.GameMode.class));
registerSerializer(Identifier.FLIGHT_STATUS, new BukkitSerializer.Json<>(this, BukkitData.FlightStatus.class));
registerSerializer(Identifier.ATTRIBUTES, new BukkitSerializer.Json<>(this, BukkitData.Attributes.class));
registerSerializer(Identifier.HEALTH, new BukkitSerializer.Json<>(this, BukkitData.Health.class));
registerSerializer(Identifier.HUNGER, new BukkitSerializer.Json<>(this, BukkitData.Hunger.class));
registerSerializer(Identifier.EXPERIENCE, new BukkitSerializer.Json<>(this, BukkitData.Experience.class));
registerSerializer(Identifier.LOCATION, new BukkitSerializer.Json<>(this, BukkitData.Location.class));
registerSerializer(Identifier.GAME_MODE, new Serializer.Json<>(this, BukkitData.GameMode.class));
registerSerializer(Identifier.FLIGHT_STATUS, new Serializer.Json<>(this, BukkitData.FlightStatus.class));
registerSerializer(Identifier.ATTRIBUTES, new Serializer.Json<>(this, BukkitData.Attributes.class));
registerSerializer(Identifier.HEALTH, new Serializer.Json<>(this, BukkitData.Health.class));
registerSerializer(Identifier.HUNGER, new Serializer.Json<>(this, BukkitData.Hunger.class));
registerSerializer(Identifier.EXPERIENCE, new Serializer.Json<>(this, BukkitData.Experience.class));
registerSerializer(Identifier.LOCATION, new Serializer.Json<>(this, BukkitData.Location.class));
validateDependencies();
});

Expand Down
32 changes: 18 additions & 14 deletions bukkit/src/main/java/net/william278/husksync/data/BukkitData.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public static abstract class Items extends BukkitData implements Data.Items {
private final @Nullable ItemStack @NotNull [] contents;

private Items(@Nullable ItemStack @NotNull [] contents) {

this.contents = Arrays.stream(contents.clone())
.map(i -> i == null || i.getType() == Material.AIR ? null : i)
.toArray(ItemStack[]::new);
Expand Down Expand Up @@ -127,8 +126,6 @@ public boolean equals(Object obj) {
@Getter
public static class Inventory extends BukkitData.Items implements Data.Items.Inventory {

public static final int INVENTORY_SLOT_COUNT = 41;

@Range(from = 0, to = 8)
private int heldItemSlot;

Expand Down Expand Up @@ -175,15 +172,18 @@ private void clearInventoryCraftingSlots(@NotNull Player player) {

public static class EnderChest extends BukkitData.Items implements Data.Items.EnderChest {

public static final int ENDER_CHEST_SLOT_COUNT = 27;

private EnderChest(@NotNull ItemStack[] contents) {
private EnderChest(@Nullable ItemStack @NotNull [] contents) {
super(contents);
}

@NotNull
public static BukkitData.Items.EnderChest adapt(@NotNull ItemStack[] items) {
return new BukkitData.Items.EnderChest(items);
public static BukkitData.Items.EnderChest adapt(@Nullable ItemStack @NotNull [] contents) {
return new BukkitData.Items.EnderChest(contents);
}

@NotNull
public static BukkitData.Items.EnderChest adapt(@NotNull Collection<ItemStack> items) {
return adapt(items.toArray(ItemStack[]::new));
}

@NotNull
Expand All @@ -200,7 +200,7 @@ public void apply(@NotNull BukkitUser user, @NotNull BukkitHuskSync plugin) thro

public static class ItemArray extends BukkitData.Items implements Data.Items {

private ItemArray(@NotNull ItemStack[] contents) {
private ItemArray(@Nullable ItemStack @NotNull [] contents) {
super(contents);
}

Expand All @@ -210,7 +210,7 @@ public static ItemArray adapt(@NotNull Collection<ItemStack> drops) {
}

@NotNull
public static ItemArray adapt(@NotNull ItemStack[] drops) {
public static ItemArray adapt(@Nullable ItemStack @NotNull [] drops) {
return new ItemArray(drops);
}

Expand Down Expand Up @@ -341,9 +341,12 @@ public void apply(@NotNull BukkitUser user, @NotNull BukkitHuskSync plugin) thro
}));
}

private void setAdvancement(@NotNull HuskSync plugin, @NotNull org.bukkit.advancement.Advancement advancement,
@NotNull Player player, @NotNull BukkitUser user,
@NotNull Collection<String> toAward, @NotNull Collection<String> toRevoke) {
private void setAdvancement(@NotNull HuskSync plugin,
@NotNull org.bukkit.advancement.Advancement advancement,
@NotNull Player player,
@NotNull BukkitUser user,
@NotNull Collection<String> toAward,
@NotNull Collection<String> toRevoke) {
plugin.runSync(() -> {
// Track player exp level & progress
final int expLevel = player.getLevel();
Expand All @@ -355,7 +358,8 @@ private void setAdvancement(@NotNull HuskSync plugin, @NotNull org.bukkit.advanc
toRevoke.forEach(progress::revokeCriteria);

// Set player experience and level (prevent advancement awards applying twice), reset game rule
if (!toAward.isEmpty() && player.getLevel() != expLevel || player.getExp() != expProgress) {
if (!toAward.isEmpty()
&& (player.getLevel() != expLevel || player.getExp() != expProgress)) {
player.setLevel(expLevel);
player.setExp(expProgress);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import net.william278.desertwell.util.Version;
import net.william278.husksync.BukkitHuskSync;
import net.william278.husksync.HuskSync;
import net.william278.husksync.adapter.Adaptable;
import net.william278.husksync.api.HuskSyncAPI;
Expand All @@ -41,6 +42,8 @@
import java.util.List;

import static net.william278.husksync.data.BukkitData.Items.Inventory.INVENTORY_SLOT_COUNT;
import static net.william278.husksync.data.Data.Items.Inventory.HELD_ITEM_SLOT_TAG;
import static net.william278.husksync.data.Data.Items.Inventory.ITEMS_TAG;

@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class BukkitSerializer {
Expand All @@ -60,8 +63,6 @@ public HuskSync getPlugin() {

public static class Inventory extends BukkitSerializer implements Serializer<BukkitData.Items.Inventory>,
ItemDeserializer {
private static final String ITEMS_TAG = "items";
private static final String HELD_ITEM_SLOT_TAG = "held_item_slot";

public Inventory(@NotNull HuskSync plugin) {
super(plugin);
Expand All @@ -74,7 +75,7 @@ public BukkitData.Items.Inventory deserialize(@NotNull String serialized, @NotNu
final ReadWriteNBT items = root.hasTag(ITEMS_TAG) ? root.getCompound(ITEMS_TAG) : null;
return BukkitData.Items.Inventory.from(
items != null ? getItems(items, dataMcVersion) : new ItemStack[INVENTORY_SLOT_COUNT],
root.getInteger(HELD_ITEM_SLOT_TAG)
root.hasTag(HELD_ITEM_SLOT_TAG) ? root.getInteger(HELD_ITEM_SLOT_TAG) : 0
);
}

Expand Down Expand Up @@ -126,15 +127,15 @@ private interface ItemDeserializer {
@Nullable
default ItemStack[] getItems(@NotNull ReadWriteNBT tag, @NotNull Version mcVersion) {
if (mcVersion.compareTo(getPlugin().getMinecraftVersion()) < 0) {
return upgradeItemStack((NBTCompound) tag, mcVersion);
return upgradeItemStacks((NBTCompound) tag, mcVersion);
}
return NBT.itemStackArrayFromNBT(tag);
}

@NotNull
private ItemStack @NotNull [] upgradeItemStack(@NotNull NBTCompound compound, @NotNull Version mcVersion) {
final ReadWriteNBTCompoundList items = compound.getCompoundList("items");
final ItemStack[] itemStacks = new ItemStack[compound.getInteger("size")];
private ItemStack @NotNull [] upgradeItemStacks(@NotNull NBTCompound itemsNbt, @NotNull Version mcVersion) {
final ReadWriteNBTCompoundList items = itemsNbt.getCompoundList("items");
final ItemStack[] itemStacks = new ItemStack[itemsNbt.getInteger("size")];
for (int i = 0; i < items.size(); i++) {
if (items.get(i) == null) {
itemStacks[i] = new ItemStack(Material.AIR);
Expand Down Expand Up @@ -163,6 +164,7 @@ private int getDataVersion(@NotNull Version mcVersion) {
case "1.19", "1.19.1", "1.19.2" -> DataFixerUtil.VERSION1_19_2;
case "1.20", "1.20.1", "1.20.2" -> DataFixerUtil.VERSION1_20_2;
case "1.20.3", "1.20.4" -> DataFixerUtil.VERSION1_20_4;
case "1.20.5", "1.20.6" -> DataFixerUtil.VERSION1_20_5;
default -> DataFixerUtil.getCurrentVersion();
};
}
Expand Down Expand Up @@ -237,24 +239,19 @@ public String serialize(@NotNull BukkitData.PersistentData element) throws Seria

}

public static class Json<T extends Data & Adaptable> extends BukkitSerializer implements Serializer<T> {
/**
* @deprecated Use {@link Serializer.Json} in the common module instead
*/
@Deprecated(since = "2.6")
public class Json<T extends Data & Adaptable> extends Serializer.Json<T> {

private final Class<T> type;

public Json(@NotNull HuskSync plugin, Class<T> type) {
super(plugin);
this.type = type;
}

@Override
public T deserialize(@NotNull String serialized) throws DeserializationException {
return plugin.getDataAdapter().fromJson(serialized, type);
public Json(@NotNull HuskSync plugin, @NotNull Class<T> type) {
super(plugin, type);
}

@NotNull
@Override
public String serialize(@NotNull T element) throws SerializationException {
return plugin.getDataAdapter().toJson(element);
public BukkitHuskSync getPlugin() {
return (BukkitHuskSync) plugin;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ default Optional<Data.Items.Inventory> getInventory() {
.isSyncDeadPlayersChangingServer())) {
return Optional.of(BukkitData.Items.Inventory.empty());
}
final PlayerInventory inventory = getBukkitPlayer().getInventory();
final PlayerInventory inventory = getPlayer().getInventory();
return Optional.of(BukkitData.Items.Inventory.from(
getMapPersister().persistLockedMaps(inventory.getContents(), getBukkitPlayer()),
getMapPersister().persistLockedMaps(inventory.getContents(), getPlayer()),
inventory.getHeldItemSlot()
));
}
Expand All @@ -78,80 +78,89 @@ default Optional<Data.Items.Inventory> getInventory() {
@Override
default Optional<Data.Items.EnderChest> getEnderChest() {
return Optional.of(BukkitData.Items.EnderChest.adapt(
getMapPersister().persistLockedMaps(getBukkitPlayer().getEnderChest().getContents(), getBukkitPlayer())
getMapPersister().persistLockedMaps(getPlayer().getEnderChest().getContents(), getPlayer())
));
}

@NotNull
@Override
default Optional<Data.PotionEffects> getPotionEffects() {
return Optional.of(BukkitData.PotionEffects.from(getBukkitPlayer().getActivePotionEffects()));
return Optional.of(BukkitData.PotionEffects.from(getPlayer().getActivePotionEffects()));
}

@NotNull
@Override
default Optional<Data.Advancements> getAdvancements() {
return Optional.of(BukkitData.Advancements.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.Advancements.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.Location> getLocation() {
return Optional.of(BukkitData.Location.adapt(getBukkitPlayer().getLocation()));
return Optional.of(BukkitData.Location.adapt(getPlayer().getLocation()));
}

@NotNull
@Override
default Optional<Data.Statistics> getStatistics() {
return Optional.of(BukkitData.Statistics.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.Statistics.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.Health> getHealth() {
return Optional.of(BukkitData.Health.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.Health.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.Hunger> getHunger() {
return Optional.of(BukkitData.Hunger.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.Hunger.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.Attributes> getAttributes() {
return Optional.of(BukkitData.Attributes.adapt(getBukkitPlayer(), getPlugin()));
return Optional.of(BukkitData.Attributes.adapt(getPlayer(), getPlugin()));
}

@NotNull
@Override
default Optional<Data.Experience> getExperience() {
return Optional.of(BukkitData.Experience.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.Experience.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.GameMode> getGameMode() {
return Optional.of(BukkitData.GameMode.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.GameMode.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.FlightStatus> getFlightStatus() {
return Optional.of(BukkitData.FlightStatus.adapt(getBukkitPlayer()));
return Optional.of(BukkitData.FlightStatus.adapt(getPlayer()));
}

@NotNull
@Override
default Optional<Data.PersistentData> getPersistentData() {
return Optional.of(BukkitData.PersistentData.adapt(getBukkitPlayer().getPersistentDataContainer()));
return Optional.of(BukkitData.PersistentData.adapt(getPlayer().getPersistentDataContainer()));
}

boolean isDead();

@NotNull
Player getBukkitPlayer();
Player getPlayer();

/**
* @deprecated Use {@link #getPlayer()} instead
*/
@Deprecated(since = "3.6")
@NotNull
default Player getBukkitPlayer() {
return getPlayer();
}

@NotNull
default BukkitMapPersister getMapPersister() {
Expand Down
Loading
Loading