Fix unintended change to playSound contract and various other issues
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -747,7 +747,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
@Override
|
||||
public void setTicksLived(int value) {
|
||||
Preconditions.checkArgument(value > 0, "Age value (%s) must be positive", value);
|
||||
Preconditions.checkArgument(value > 0, "Age value (%s) must be greater than 0", value);
|
||||
getHandle().tickCount = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -457,16 +457,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void playSound(Location loc, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch) {
|
||||
Preconditions.checkArgument(sound != null, "Sound cannot be null");
|
||||
Preconditions.checkArgument(category != null, "Category cannot be null");
|
||||
if (loc == null || sound == null || category == null || getHandle().connection == null) return;
|
||||
|
||||
playSound0(loc, BuiltInRegistries.SOUND_EVENT.wrapAsHolder(CraftSound.getSoundEffect(sound)), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location loc, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
|
||||
Preconditions.checkArgument(sound != null, "sound cannot be null");
|
||||
Preconditions.checkArgument(category != null, "Category cannot be null");
|
||||
if (loc == null || sound == null || category == null || getHandle().connection == null) return;
|
||||
|
||||
playSound0(loc, Holder.direct(SoundEffect.createVariableRangeEvent(new MinecraftKey(sound))), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch);
|
||||
}
|
||||
@@ -492,16 +490,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void playSound(org.bukkit.entity.Entity entity, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch) {
|
||||
Preconditions.checkArgument(category != null, "Category cannot be null");
|
||||
Preconditions.checkArgument(sound != null, "Sound cannot be null");
|
||||
if (!(entity instanceof CraftEntity craftEntity) || sound == null || category == null || getHandle().connection == null) return;
|
||||
|
||||
playSound0(entity, BuiltInRegistries.SOUND_EVENT.wrapAsHolder(CraftSound.getSoundEffect(sound)), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(org.bukkit.entity.Entity entity, String sound, org.bukkit.SoundCategory category, float volume, float pitch) {
|
||||
Preconditions.checkArgument(category != null, "Category cannot be null");
|
||||
Preconditions.checkArgument(sound != null, "sound cannot be null");
|
||||
if (!(entity instanceof CraftEntity craftEntity) || sound == null || category == null || getHandle().connection == null) return;
|
||||
|
||||
playSound0(entity, Holder.direct(SoundEffect.createVariableRangeEvent(new MinecraftKey(sound))), net.minecraft.sounds.SoundCategory.valueOf(category.name()), volume, pitch);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user