Fix EffFeed#8702
Conversation
This comment has been minimized.
This comment has been minimized.
|
wonder if this would be better as an expr eg edit: nvm ignore me that already exists |
|
Please target dev/patch or dev/feature |
TheMug06
left a comment
There was a problem hiding this comment.
lgtm apart from requested change and base branch
|
Oop i forgot about the new registry |
i was gonna use the newer one but all the files i checked that used it all had their own module things to register them with. i didn't really know where to put it. where should it go? |
|
in playermodule as its relating to feeding a player |
| return "feed " + players.toString(event, debug) + (beefs != null ? " by " + beefs.toString(event, debug) : ""); | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
extraneous space
| @@ -20,41 +21,41 @@ | |||
| @Since("2.2-dev34") | |||
| public class EffFeed extends Effect { | |||
There was a problem hiding this comment.
This class should also be moved to the PlayerModule directory. specifically org/skriptlang/skript/bukkit/entity/player/elements/effects
| Number n = beefs.getSingle(event); | ||
| if (n != null) | ||
| foodAmount = n.intValue(); |
There was a problem hiding this comment.
I would retain the behavior of terminating if n is null.
AnOwlBe
left a comment
There was a problem hiding this comment.
I forgot to click 'submit review' on these 2 weeks ago but should still apply by now
| @@ -1,17 +1,18 @@ | |||
| package ch.njol.skript.effects; | |||
There was a problem hiding this comment.
should be in org/skriptlang/skript/bukkit/entity/player/elements/effects
| private Expression<Number> beefs; | ||
|
|
||
| @Override | ||
| public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) { |
There was a problem hiding this comment.
Should use ParseResult not SkriptParser.ParseResult
|
|
||
| @Override | ||
| public String toString(@Nullable Event e, boolean debug) { | ||
| return "feed " + players.toString(e, debug) + (beefs != null ? " by " + beefs.toString(e, debug) : ""); |
There was a problem hiding this comment.
could use SyntaxStringBuilder
| @SuppressWarnings("null") | ||
| private Expression<Player> players; | ||
| @Nullable | ||
| private Expression<Number> beefs; |
There was a problem hiding this comment.
Just my thoughts but why is this named beefs? couldn't it be named something like amount
| register(addon, | ||
| EffBan::register, | ||
| EffKick::register, | ||
| EffFeed::register, |
There was a problem hiding this comment.
Should be before EffKick I believe
| } | ||
| public static void register(SyntaxRegistry registry) { | ||
| registry.register(SyntaxRegistry.EFFECT, SyntaxInfo.builder(EffFeed.class) | ||
| .addPatterns("feed %players% [by %-number% [beef[s]]]") |
There was a problem hiding this comment.
I believe someone already asked this in another pr or at some point but why is there beef in the syntax it just seems off
There was a problem hiding this comment.
i dont know bro its optional though
There was a problem hiding this comment.
well atleast imo it should be removed as its kind of misleading as if you eat beef/steak ingame it feeds by 6 health so if you do feed player by 1 beef kind of misleading
though for this pr probably not best idea as it'd cause breaking changes
There was a problem hiding this comment.
Beefs, as that's what the hunger bars could be refered to, don't see the use in removing it, would just cause it to break for anyone using it.

Problem
The person who updated the now current feed effect forgot to add a max level, so it stacks every time you do the normal
feed player. I think it should instead only go above the max if specified withby %-number%, as it makes more sense logically (at least in my head).Solution
It fixes it by just setting the food level to 20 if the beef amount isn't set.
Testing Completed
I did:
!feed player
!send food level of me
!feed player by 40
!send food level of me
And it seemed to work fine
Supporting Information
I guess it's a breaking change if players are using it specifically to stack feed themselves? I don't see why anyone would, though.
Completes: none
Related: none
AI assistance: none