Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7235

`World.Spigot#strikeLightningEffect` doesn't do anything

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • Debian 11

      openjdk version "18.0.2.1" 2022-08-18
      OpenJDK Runtime Environment Temurin-18.0.2.1+1 (build 18.0.2.1+1)
      OpenJDK 64-Bit Server VM Temurin-18.0.2.1+1 (build 18.0.2.1+1, mixed mode, sharing)

    • This server is running CraftBukkit version 3638-Spigot-d90018e-7dcb59b (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT)
    • Yes

      As the title says, `World.Spigot#strikeLightningEffect` doesn't do anything; no lightning strike occurs.

      This issue is present on Spigot 1.18.2 as well, and does not apply to vanilla or CraftBukkit.

      Taking a brief look at the four existing lightning strike methods (World#strikeLightning(Location), World#strikeLightningEffect(Location), World.Spigot#strikeLightning(Location, boolean), and World.Spigot#strikeLightningEffect(Location, boolean)),] only `World.Spigot#strikeLightningEffect` does not contain a call to the underlying NMS `WorldServer#strikeLightning`, so maybe that is the cause?

       

      Sample code (compiled jar is attached):

      package me.datatags.floopin;
      
      import org.bukkit.event.EventHandler;
      import org.bukkit.event.Listener;
      import org.bukkit.event.block.Action;
      import org.bukkit.event.player.PlayerInteractEvent;
      import org.bukkit.inventory.EquipmentSlot;
      import org.bukkit.plugin.java.JavaPlugin;
      
      public class Floopin extends JavaPlugin implements Listener {
      
          @Override
          public void onEnable() {
              getServer().getPluginManager().registerEvents(this, this);
          }
      
          @EventHandler
          public void onClick(PlayerInteractEvent event) {
              if (event.getAction() != Action.RIGHT_CLICK_BLOCK || !event.getPlayer().isSneaking() || event.getHand() != EquipmentSlot.HAND) return;
              event.getPlayer().sendMessage("lightning");
              event.getPlayer().getWorld().spigot().strikeLightningEffect(event.getClickedBlock().getLocation(), false);
          }
      } 

      Expected result: shift-right-clicking on a block causes a message in chat, and a lightning strike that does no damage.

      Actual result: shift-right-clicking on a block causes a message in chat, but no lightning.

            Unassigned Unassigned
            datatags datatags
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: