mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2026-01-06 15:41:56 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e5b794b6d | ||
|
|
649b7c0857 | ||
|
|
75a9050c39 | ||
|
|
7d38b9941e | ||
|
|
b3e4fbb3de |
@@ -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/#WiIIiam278/HuskSync)
|
||||
Then, add the dependency. Replace `version` with the latest version of HuskSync: [](https://jitpack.io/#net.william278/HuskSync)
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>net.william278</groupId>
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
javaVersion=16
|
||||
plugin_version=1.4
|
||||
plugin_version=1.4.1
|
||||
plugin_archive=husksync
|
||||
Reference in New Issue
Block a user