9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2026-01-06 15:41:56 +00:00

Compare commits

...

5 Commits
1.4 ... 1.4.1

Author SHA1 Message Date
William
8e5b794b6d Still fire synccomplete for dead player syncs 2022-07-04 10:26:10 +01:00
William
649b7c0857 Bump to 1.4.1 2022-07-04 09:58:16 +01:00
William
75a9050c39 Merge remote-tracking branch 'origin/master' 2022-07-04 09:57:16 +01:00
William
7d38b9941e Don't sync now-dead players 2022-07-04 09:57:12 +01:00
William
b3e4fbb3de Update a few jitpack links to use net.william278 2022-06-09 12:22:31 +01:00
3 changed files with 12 additions and 3 deletions

View File

@@ -121,7 +121,7 @@ Most likely not - and I cannot support it - but feel free to test it, as dependi
### API
HuskSync has an API for Bukkit providing events that fire when synchronisation takes place as well as a method to access and deserialize player data on demand. There is no API for the proxy side currently.
HuskSync's API is available on [JitPack](https://jitpack.io/#WiIIiam278/HuskSync/Tag). You can view the [HuskSync JavaDocs here](https://javadoc.jitpack.io/com/github/WiIIiam278/HuskSync/latest/javadoc/index.html). You should only use stuff in the `husksync.bukkit.api` and `husksync.bukkit.data` packages (as well as the PlayerData class located in the `husksync` root package.
HuskSync's API is available on [JitPack](https://jitpack.io/#net.william278/HuskSync/Tag). You can view the [HuskSync JavaDocs here](https://javadoc.jitpack.io/net/william278/HuskSync/latest/javadoc/index.html). You should only use stuff in the `husksync.bukkit.api` and `husksync.bukkit.data` packages (as well as the PlayerData class located in the `husksync` root package.
#### Including the API in your project
With Maven, add the repository to your pom.xml:
@@ -133,7 +133,7 @@ With Maven, add the repository to your pom.xml:
</repository>
</repositories>
```
Then, add the dependency. Replace `version` with the latest version of HuskSync: [![](https://jitpack.io/v/WiIIiam278/HuskSync.svg)](https://jitpack.io/#WiIIiam278/HuskSync)
Then, add the dependency. Replace `version` with the latest version of HuskSync: [![](https://jitpack.io/v/WiIIiam278/HuskSync.svg)](https://jitpack.io/#net.william278/HuskSync)
```xml
<dependency>
<groupId>net.william278</groupId>

View File

@@ -154,6 +154,10 @@ public class PlayerSetter {
// Set the player's data from the PlayerData
try {
// Don't sync the player if they are dead
if (player.isDead() || player.getHealth() <= 0) {
return;
}
if (Settings.syncAdvancements) {
List<me.william278.husksync.bukkit.data.DataSerializer.AdvancementRecordDate> advancementRecords
= DataSerializer.deserializeAdvancementData(data.getSerializedAdvancements());
@@ -175,6 +179,11 @@ public class PlayerSetter {
setPlayerAdvancements(player, advancementRecords, data);
}
}
// Don't sync the player if they are dead
if (player.isDead() || player.getHealth() <= 0) {
Bukkit.getPluginManager().callEvent(new SyncCompleteEvent(player, data));
return;
}
if (Settings.syncInventories) {
setPlayerInventory(player, DataSerializer.deserializeInventory(data.getSerializedInventory()));
player.getInventory().setHeldItemSlot(data.getSelectedSlot());

View File

@@ -1,3 +1,3 @@
javaVersion=16
plugin_version=1.4
plugin_version=1.4.1
plugin_archive=husksync