[SPIGOT-1697] PotionEffect amplifier starts at 0 Created: 03/Mar/16  Updated: 04/Mar/16  Resolved: 03/Mar/16

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: LEGOlord 208 Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: 1.9


 Description   

[SMALL ISSUE]

When you construct a PotionEffect
new PotionEffect(PotionEffectType.EFFECT HERE, TICKS, AMPLIFIER);

You get a problem with the Amplifier.
Level II seems to be 1, and level III seems to be 2 and so on.
I know you are always tought computers starts with the number 0, but Minecraft doesn't.

TEMPORARY WORKAROUND FOR API USERS:
Pretty self explaintory. Pass in the number - 1 in the constructor.

FOR THE SPIGOT TEAM:
All you guys on Spigot would need to do is to add a -1 in the constructor I guess!
And that would save people from doing silly misstakes



 Comments   
Comment by LEGOlord 208 [ 04/Mar/16 ]

Oh, then of course! I'll stop watching this now! Bye

Comment by Justin Lawen [ 03/Mar/16 ]

It should also be noted that Minecraft itself stores the amplifier beginning at zero. There is also support for negative amplifiers on some potions.

Comment by LEGOlord 208 [ 03/Mar/16 ]

I understand if it breaks other plugins! I just thought it didn't because I haven't recalled seeing such a thing! (I've been using the Potion class, who uses level(NUMBER THAT STARTS WITH 1))

Thanks!

Comment by Jan Delius [ 03/Mar/16 ]

The api is part of programming, not playing. There isn't any good reason to change that(and broke many other plugins)

Comment by LEGOlord 208 [ 03/Mar/16 ]

"I know you are always tought computers starts with the number 0, but in Minecraft it doesn't."

I usually got a feeling for when to start with 0, as it doesn't all the time.
List.size() or Array.length of course doesn't start with 0.

Honestly I didn't think it would use 0 here.
Especially if the broken Potion-class' level method used 1.

"I am just going to apply level 0 on the potion"
"LEVEL 0???"
"Yeah, Spigot thought it would be a good idea to start at 0"

No offence but it really is weird.

Comment by Thinkofname [ 03/Mar/16 ]

Most things in programming start at 0

Generated at Sat Dec 13 15:21:02 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.