Skip to content

Commit

Permalink
Add hard cap of 20 to feed command
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 30, 2019
1 parent 8230e3d commit b34cc9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
@@ -1,7 +1,6 @@
package com.denizenscript.denizen.events.core;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.utilities.debugging.Debug;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.objects.core.ListTag;
import com.denizenscript.denizencore.objects.ObjectTag;
Expand Down Expand Up @@ -61,7 +60,6 @@ public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
}
else {
event.setMotd(determination);
Debug.log("MOTD Set: " + determination);
}
return true;
}
Expand Down
Expand Up @@ -117,7 +117,9 @@ public void execute(ScriptEntry scriptEntry) {
npc.getCitizen().getTrait(HungerTrait.class).feed(amount.asInt());
}
else {
player.getPlayerEntity().setFoodLevel(Math.max(0, Math.min(9999, player.getPlayerEntity().getFoodLevel() + amount.asInt())));
int result = Math.max(0, Math.min(20, player.getPlayerEntity().getFoodLevel() + amount.asInt()));
player.getPlayerEntity().setFoodLevel(result);
Debug.echoDebug(scriptEntry, "Player food level updated to " + result + ".");
}
}
}

0 comments on commit b34cc9f

Please sign in to comment.