How to make a launchpad Bukkit Java

Discussion in 'Plugin Development' started by user_90837896, Mar 1, 2016.

Thread Status:
Not open for further replies.
  1. Offline


    Hello, I am very new to bukkit plugin programming (I am not new to programming)
    I am wanting to make and electric fence (when player steps on pressure plate it strike he/she with lightning.
    I thought the easiest way to do this was to learn to make a launch pad then change the velocity function to the lightning command (world.createlightning or whatever it is) my current script looks like this. it doesn't even print the text in chat when I step on a pressure plate :( please tell me how to fix this thanks

    package com.henstergamer.electricfence;
    import java.util.logging.Logger;
    import org.bukkit.Material;
    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.plugin.PluginDescriptionFile;
    import org.bukkit.util.Vector;
    public class main extends JavaPlugin implements Listener {
        public void onEnable() {
            PluginDescriptionFile pdfFile = getDescription();
            Logger logger = getLogger();
   + "Has Been Enabled! (V." + pdfFile.getVersion() + ")");
        public void onDisable() {
            PluginDescriptionFile pdfFile = getDescription();
            Logger logger = getLogger();
   + "Has Been Disabled! (V." + pdfFile.getVersion() + ")");
    public void onInteract(PlayerInteractEvent event) {
        if(event.getAction() == Action.PHYSICAL) {
            //The player triggered a physical interaction event
            event.getPlayer().sendMessage("you activated a block");
            if(event.getClickedBlock().getType() == Material.STONE_PLATE) {
                //The player stepped on a stone pressure plate
                event.getPlayer().sendMessage("you stepped on a pressure plate");
                Vector velocity = new Vector(0, 5, 0); //Straight up
    Last edited by a moderator: Mar 1, 2016
  2. Offline


    You sure you're a programmer? If you're experienced, go read the docs yes.
  3. Offline


    I said I was not new, not experienced there is a big difference. I have read the docs and didn't find much help, I will look again. If you can't help don't answer
  4. Offline


    You forgot to register the event on onEnable: Bukkit.getPluginManager().registerEvents(this, this);
    user_90837896 likes this.
  5. Offline


    Thanks I will test it later, could you explain why you need to do this?
  6. Offline

    Mrs. bwfctower

    So that your Listener is registered into Bukkit's event system. Read the docs, it tells you everything you need to know.
  7. Offline


    You are checking for interact.. Wouldn't the right event be a player move event?

    Also, you don't need to log the enabling and disabling messages, spigot/bukkit does it automatically.
Thread Status:
Not open for further replies.

Share This Page