13
0
geforkt von Mirrors/Paper

SPIGOT-7953: Item cooldown must be greater than 0

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-11-12 20:37:58 +11:00
Ursprung 475a5576bc
Commit a768ea0ddf
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -1488,7 +1488,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override
public UseCooldownComponent getUseCooldown() {
return (this.hasUseCooldown()) ? new CraftUseCooldownComponent(this.useCooldown) : new CraftUseCooldownComponent(new UseCooldown(0));
return (this.hasUseCooldown()) ? new CraftUseCooldownComponent(this.useCooldown) : new CraftUseCooldownComponent(new UseCooldown(1));
}
@Override

Datei anzeigen

@ -54,10 +54,10 @@ public final class CraftUseCooldownComponent implements UseCooldownComponent {
}
@Override
public void setCooldownSeconds(float eatSeconds) {
Preconditions.checkArgument(eatSeconds >= 0, "eatSeconds cannot be less than 0");
public void setCooldownSeconds(float cooldown) {
Preconditions.checkArgument(cooldown > 0, "cooldown must be greater than 0");
handle = new UseCooldown(eatSeconds, handle.cooldownGroup());
handle = new UseCooldown(cooldown, handle.cooldownGroup());
}
@Override