EntitySpawnEvent for TNTPrimed

Discussion in 'Spigot Plugin Development' started by WAS, Apr 16, 2017.

  1. WAS

    WAS

    Is this a thing? Is this why no event has ever been implemented despite a plethora of requests? Just thinking before going about creating listeners for a bunch of BS to see if TNTPrimed is spawned...
     
  2. You should probably use BlockChangeEvent if you activate tnt with redstone
     
    • Optimistic Optimistic x 1
  3. WAS

    WAS

    ... Well that's not just the point. The question is if you can check EntitySpawnEvent for TNTPrimed

    Otherwise you have to check much more than just redstone and BlockChangeEvent.
     
  4. Write a simple code like this
    Code (Text):
     public void onSpawn(EntitySpawnEvent e) {
      if (e.getEntity() != EntityType.PRIMED_TNT) {
        return;
    }
      Bukkit.broadcastMessage("works");
    }
    You should learn to try things yourself instead of instantly going to forums to ask
     
    • Optimistic Optimistic x 1
  5. WAS

    WAS

    Lol why should I if someone has already tried it to a means to an end? It's called advise for a reason. That requires writing a plugin, compiling and testing for possible errors for a bit fat no, when someone could just say "Yes, it does" or "No, it doesn't". If you don't know clearly this isn't the topic to be responding to.
     
  6. if you think writing 6 lines of code and compiling is a lot of work clearly coding isn't a thing for you.
     
    • Optimistic Optimistic x 1
  7. WAS

    WAS

    If you think it's just six lines of code, clearly coding is not for you. Lol Anyways, again, if you have no experience with the question, move on. I'm working on other stuff to be writing a nonsensical plugin which could be answered literally in a word from a vast forum of experienced developers.

    Not only that but simplified topics without rhetoric like this tend to answer other peoples questions better than a topic full of arguing members and broken code. Fairly certain Spigot falls under Open-Ended questions, and not Closed-Ended, to help other people and all.
     
    #7 WAS, Apr 16, 2017
    Last edited: Apr 16, 2017
  8. Code (Text):


    public Main extends JavaPlugin implements Listener {
     
      public void onEnable() {
        Bukkit.getServer().getPluginManager.registerEvents(this, this);
      }
     
     public void onSpawn(EntitySpawnEvent e) {
      if (e.getEntity() != EntityType.PRIMED_TNT) {
        return;
    }
      Bukkit.broadcastMessage("works");
    }

    }
    7 lines
     
    • Optimistic Optimistic x 1
  9. WAS

    WAS

    ... Lol. Still forgetting stuff... Just write the whole thing for everyone. Go for it. What about the plugin.yml? Just give me a Jar? Lol
     
  10. plugin.yml
    name: this
    main: com.dizmizzer.test.Main
    version: 1.0
     
    • Optimistic Optimistic x 1
  11. Tested it (Timed it as well took 90 seconds) and it doesn't work. Now we're done here
     
    • Creative Creative x 1
  12. WAS

    WAS

    ... You timed what? It's execution? It took 90 seconds?

    Again, thanks for being a know-it-all. Thanks for answers the question. See, the thing is, I'm at work here. I couldn't test if I wanted to. I can write code, but no GPU to run MC.
     
  13. 90 seconds to start a project, write the code and plugin.yml and compile it
     
  14. WAS

    WAS

    Awesome job! You can code! Still would have been no help to me right now and the whole point of the post, that you just can't seem to grasp. Regardless of your opinion, the question is to be answered in words. Glad you learned something too though. ;)