Commits
md_5 authored 935f18b476b
315 315 | if (getHandle().playerConnection == null) return; |
316 316 | |
317 317 | int packetData = effect.getId(); |
318 318 | PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), data, false); |
319 319 | getHandle().playerConnection.sendPacket(packet); |
320 320 | } |
321 321 | |
322 322 | |
323 323 | public <T> void playEffect(Location loc, Effect effect, T data) { |
324 324 | if (data != null) { |
325 - | Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!"); |
325 + | Validate.isTrue(effect.getData() != null && effect.getData().isAssignableFrom(data.getClass()), "Wrong kind of data for this effect!"); |
326 326 | } else { |
327 327 | Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!"); |
328 328 | } |
329 329 | |
330 330 | int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); |
331 331 | playEffect(loc, effect, datavalue); |
332 332 | } |
333 333 | |
334 334 | |
335 335 | public void sendBlockChange(Location loc, Material material, byte data) { |