Implementation of richer playEffect methods. Addresses BUKKIT-857
This commit is contained in:
committed by
EvilSeph
parent
bf01e93ab6
commit
d20091e64c
@@ -39,6 +39,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
@@ -47,6 +48,7 @@ import org.bukkit.Difficulty;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.plugin.messaging.StandardMessenger;
|
||||
import org.bukkit.potion.Potion;
|
||||
|
||||
public class CraftWorld implements World {
|
||||
private final WorldServer world;
|
||||
@@ -717,6 +719,21 @@ public class CraftWorld implements World {
|
||||
playEffect(location, effect, data, 64);
|
||||
}
|
||||
|
||||
public <T> void playEffect(Location loc, Effect effect, T data) {
|
||||
playEffect(loc, effect, data, 64);
|
||||
}
|
||||
|
||||
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
|
||||
if (data != null) {
|
||||
Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
|
||||
} else {
|
||||
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
|
||||
}
|
||||
|
||||
int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
||||
playEffect(loc, effect, datavalue, radius);
|
||||
}
|
||||
|
||||
public void playEffect(Location location, Effect effect, int data, int radius) {
|
||||
int packetData = effect.getId();
|
||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
|
||||
|
||||
Reference in New Issue
Block a user