Merge remote-tracking branch 'origin/master'

This commit is contained in:
Indyuce 2023-01-06 16:18:13 +01:00
commit 93ad4c8a0b
5 changed files with 7 additions and 9 deletions

View File

@ -1115,8 +1115,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
*/
public void bindPassiveSkill(int slot, @NotNull PassiveSkill skill) {
Validate.notNull(skill, "Skill cannot be null");
final int maxBound = getProfess().getMaxBoundActiveSkills();
if (slot > 0 && boundPassiveSkills.size() >= maxBound) {
final int maxBound = getProfess().getMaxBoundPassiveSkills();
if (slot >= 0 && boundPassiveSkills.size() >= maxBound) {
final @NotNull PassiveSkill current = boundPassiveSkills.set(slot, skill);
if (current != null)
current.unregister(mmoData);
@ -1151,7 +1151,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
*/
public void bindActiveSkill(int slot, ClassSkill skill) {
Validate.notNull(skill, "Skill cannot be null");
if (slot > 0 && boundSkills.size() >= getProfess().getMaxBoundActiveSkills())
if (slot >= 0 && boundSkills.size() >= getProfess().getMaxBoundActiveSkills())
boundSkills.set(slot, skill);
else
boundSkills.add(skill);

View File

@ -173,9 +173,6 @@ public class PlayerQuests implements Closable {
bossbar.removeAll();
Bukkit.removeBossBar(bossbarNamespacedKey);
}
// Close current objective progress
closeCurrentQuest();
}
public boolean checkCooldownAvailability(Quest quest) {

View File

@ -36,7 +36,7 @@ public class GuildCommand extends RegisteredCommand {
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
if (args.length > 1) {
if (args.length >= 1) {
final @Nullable GuildInvite invite;
if (args.length > 1)

View File

@ -171,7 +171,7 @@ public class PlayerProfessions {
public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
Validate.isTrue(playerData.isOnline(), "Cannot give experience to offline player");
if (value <= 0) {
exp.put(profession.getId(), Math.max(0, exp.get(profession.getId() + value)));
exp.put(profession.getId(), Math.max(0, exp.get(profession.getId()) + value));
return;
}

View File

@ -6,6 +6,7 @@ import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource;
import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager;
import org.apache.commons.lang.Validate;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
@ -68,7 +69,7 @@ public class MoveExperienceSource extends SpecificExperienceSource {
FLY((p) -> p.isFlying() || p.isGliding()),
SWIM((p) -> p.getLocation().getBlock().isLiquid()),
SPRINT(Player::isSprinting),
WALK((p) -> !p.isSneaking() && !p.isSprinting() && !p.isFlying() && !p.getLocation().getBlock().isLiquid());
WALK((p) -> !p.isSneaking() && !p.isSprinting() &&((Entity)p).isOnGround()&& !p.isFlying() && !p.getLocation().getBlock().isLiquid());
private final Function<Player, Boolean> matching;