Skip to content
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,10 @@ private static AttributeModifier adapt(@NotNull Modifier modifier) {
public void apply(@NotNull BukkitUser user, @NotNull BukkitHuskSync plugin) throws IllegalStateException {
if (!Bukkit.isPrimaryThread()) {
try {
Bukkit.getScheduler().callSyncMethod(plugin, () -> { this.apply(user, plugin); return null; }).get();
Bukkit.getScheduler().callSyncMethod(plugin, () -> {
this.apply(user, plugin);
return null;
}).get();
return;
} catch (Exception e) {
throw new IllegalStateException("Failed to apply attributes on main thread", e);
Expand Down Expand Up @@ -809,6 +812,10 @@ public void apply(@NotNull BukkitUser user, @NotNull BukkitHuskSync plugin) thro
final Player player = user.getPlayer();
player.setTotalExperience(totalExperience);
player.setLevel(expLevel);
if (expProgress < 0f || expProgress > 1f) {
plugin.log(Level.WARNING, "Invalid experience progress value: " + expProgress + ". Must be between 0 and 1.");
return;
}
player.setExp(expProgress);
}

Expand Down