I think im on the right path...

Discussion in 'Spigot Plugin Development' started by Crafter145, Apr 24, 2017.

  1. So im making a plugin for a tekkit server and if someone puts an aluminum wire on a tesseract than is will crash so i want to make a plugin so you cant put an aluminum wire next to a tesseract vise vers this is what i got so far i dont know what to do next.....



    public class Main extends JavaPlugin {

    @Override
    public void onEnable() {
    getLogger().info("Tesseractandwire has been enabled");

    }

    @Override
    public void onDisable() {
    getLogger().info("Tesseractandwire has been disabled");

    }


    @EventHandler
    public void onBlockPlaceEvent(BlockPlaceEvent event){
    Player player = (Player) event.getBlockPlaced();
    TileTesseract blockMeta = (TileTesseract) player.getItemInHand().getItemMeta();

    if(event.getBlockPlaced() = Tess ) {





    }
     
  2. You are on the wrong forum for this.
     
  3. .... noooo plugin development
     
  4. Mas

    Mas

    • Bukkit already logs enable and disable messages for you, so you can remove your logging (and your onDisable() altogether).
    • You need to register your class as a listener (implement org.bukkit.Listener and use Bukkit.getPluginManager.registerEvents(this, this))
    • You're trying to cast a player to a block? What?
    • You're getting the item the player has in their hand, not that they placed/placed it next to. You're also not checking before casting to TileTesseract.
    • Field "Tess" doesn't exist anywhere in your code.
    Also next time it would be helpful if you surrounded your code with [ code=java ] [/ code] blocks

    So no, I wouldn't say you're on the right track.
    Try learning the basics of Java before attempting to learn an API. Trust me, it will help ;)
     

  5. I know i got to do basics but i need some person to spoon feed me code for this one because i get a prize if i can do it :D

    But for sure after this im going to the basics
     
  6. Why would someone go out of their way to look into making a plugin for a modded server so that you can win a prize?

    Do it yourself.