Filled Y-EntityRemover

Discussion in 'Plugin Requests' started by iceblue1188, Aug 16, 2017.

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

    iceblue1188

    Plugin category: Misc

    Minecraft version: 1.8+

    Suggested name: Y-EntityRemover

    What I want: A simple plugin that whenever Prime TNT, Falling Anvils, Sand, Red Sand, or Gravel goes over Y255 (So 256, 257, 258, etc), that it is removed. If the block is placed itself at 256, it will not be removed. Its just the entity or falling block.

    This is a good plugin for a factions server because than you can't shoot sand or TNT or whatever over players walls and get into bases easily.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: No permissions needed for this plugin.

    When I'd like it by: ASAP.

    If you need further information, then let me know.
     
  2. Offline

    iceblue1188

  3. Seems like an interesting idea! I'll give this a try but I don't think this will be very efficient. Btw, no blocks can be placed above Y256.
     
  4. Offline

    iceblue1188

    Yeah, I know. But cannons can shoot sand, tnt, and anything with gravity. What I want is if a entity like falling sand, red sand, primed tnt, etc gets shot over 256 and above, then it gets cleared. (I said this in my original post).
     
    Last edited: Aug 18, 2017
  5. I'll have it ready in about 16 hours(cuz I have to sleep)
     
  6. Haven't tested it.

    Should work.

    Here
     
  7. I am so sorry to tell you this but there is no good way to do this. What I recommend you doing is recommending your server's players to put an obsidian roof on their bases :(
     
  8. Online

    timtower Administrator Administrator Moderator

    Then why has it been made?
     
    HariBearGB likes this.
  9. What do you mean?
     
  10. Online

    timtower Administrator Administrator Moderator

    You are saying that there is no good way to do this, yet it has been made.
    I think that this will work better then filling the entire roof with obsidian and making everything dark.
     
  11. The thing is that there are no events related to entity movement so unless we make a scheduled synchronous repeating task checking all of the falling sand entities in the world to see if they are not above Y256, I believe there are no other solutions to this problem... There might be but I don't know any of them...
     
  12. @timtower
    @HeyItsAndre is actually correct. This is quite hard without scheduling a task to constantly check the entity.

    @NullPointerExptn hasn't really solved this issue very well...
    Code:java
    1. public void onEnable() {
    2. for (Entity var1 : Bukkit.getWorld("world").getEntities()) {
    3. if (var1.getHeight() > 255.0D) {
    4. var1.remove();
    5. }
    6. }
    7.  
    8. }
    You do realize this will only run once, when the plugin is enabled?
     
    HeyItsAndre likes this.
  13. Online

    timtower Administrator Administrator Moderator

    @AlvinB It is better than filling in the entire roof.
     
  14. @timtower
    Well, yes it might be better to use a scheduling task, I just wanted to point out that NullPointerExptn had not presented a working solution to the problem.
     
    HeyItsAndre and timtower like this.
  15. Lag could be very noticeable if the server has many player online and/or entities loaded.
    EDIT: Why do all of my posts have to be approved by moderators??
     
  16. Online

    timtower Administrator Administrator Moderator

    If done incorrect: yes, yes it would.
    You are a new user, new users have that.
     
  17. This is how I would do it... And still, I think it would be horrible!!
    Code:java
    1.  
    2. private int taskId;
    3.  
    4. @Override
    5. public void onEnable() {
    6. taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
    7. for(World w : Bukkit.getWorlds()) {
    8. for(Entity e : w.getEntities()) {
    9. if(e instanceof FallingBlock || e instanceof TNTPrimed) {
    10. if(e.getLocation().getY() > 255D) {
    11. e.remove();
    12. }
    13. }
    14. }
    15. }
    16. }, 0, 1);
    17. }
    18.  
    19. @Override
    20. public void onDisable() {
    21. Bukkit.getScheduler().cancelTask(taskId);
    22. }
    23.  
     
  18. Online

    timtower Administrator Administrator Moderator

  19. Me too but the thing is the higher the interval, the higher are the chances of one of those prohibited entities could not be removed. That is possible if the falling sand or tnt go above Y255 and uses the interval to get back down...
     
  20. Online

    timtower Administrator Administrator Moderator

    @HeyItsAndre There is an argument for and against everything.
    But it is this or your roof.
    Not our call what to do though.
    Think that we need to stop this conversation as this is going far offtopic.
     
  21. Hi

    Yes, I admit, I didn't realise that, I was in a rush to go out at the time and made a noob error. I will fix the plugin to check every x ticks, if the requestor wants me to.

    No need for arguments :)

    Watch a cat video if you're getting stressed about it.
     
  22. Offline

    iceblue1188

    People would still place roofs on their base even with this plugin. Without this plugin, there is no point of having walls around your base. People can just use cannons and shoot over the walls onto the roof. So to disable this, remove entities like falling sand, primed tnt, etc, that go over 255. So 256 and above. @timtower @NullPointerExptn @HeyItsAndre
     
  23. Offline

    iceblue1188

    Bump - Still need this done.

    EDIT:

    The plugin has been done and I was sent the plugin over PM.
     
    Last edited: Aug 20, 2017
  24. Online

    timtower Administrator Administrator Moderator

    @iceblue1188 And who made it then? Because nobody should PM this stuff, thread exists for a reason.
    Now nobody on the forum can get it.
     
  25. Offline

    iceblue1188

    Last edited by a moderator: Aug 22, 2017
  26. Online

    timtower Administrator Administrator Moderator

  27. Offline

    Dnyce72799

    Because I sent it to him in pm, @timtower, but fair enough. Here's the link, it's no better than what everyone else suggested.

    Code:
    public class YEntityRemover extends JavaPlugin {
    
      @Override
      public void onEnable() {
         this.saveDefaultConfig();
         this.a();
      }
    
      private void a() {
        new BukkitRunnable() {
          @Overridepublic void run() {
            for (String a : getConfig().getStringList("worlds"))
              Bukkit.getWorld(a).getEntities().stream().filter(b -> b.getLocation().getY() >= 255).filter(b -> b instanceof FallingBlock || b instanceof TNTPrimed).forEach(Entity::remove);
           }
        }.runTaskTimerAsynchronously(this, 1, 1);
      }
    }
    
     
    Last edited: Aug 22, 2017
  28. Online

    timtower Administrator Administrator Moderator

    @Dnyce72799 There is no need to take it to PM, forum is made to talk on, same for posting plugins.
     
    HariBearGB likes this.
  29. Offline

    Dnyce72799

    There is no need to repeat yourself. I read your previous posts.
     
Thread Status:
Not open for further replies.

Share This Page