SPIGOT-7799, #1436: Expose explosion world interaction in EntityExplodeEvent and BlockExplodeEvent
By: antiPerson <nathat890@outlook.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import org.bukkit.ExplosionResult;
|
||||
|
||||
public final class CraftExplosionResult {
|
||||
|
||||
private CraftExplosionResult() {}
|
||||
|
||||
public static ExplosionResult toBukkit(Explosion.Effect effect) {
|
||||
Preconditions.checkArgument(effect != null, "explosion effect cannot be null");
|
||||
|
||||
switch (effect) {
|
||||
case KEEP:
|
||||
return ExplosionResult.KEEP;
|
||||
case DESTROY:
|
||||
return ExplosionResult.DESTROY;
|
||||
case DESTROY_WITH_DECAY:
|
||||
return ExplosionResult.DESTROY_WITH_DECAY;
|
||||
case TRIGGER_BLOCK:
|
||||
return ExplosionResult.TRIGGER_BLOCK;
|
||||
default:
|
||||
throw new IllegalArgumentException("There is no ExplosionResult which matches " + effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user