1.15.2 About spawn structures and execute method

Discussion in 'Spigot Plugin Development' started by Flaquito, Feb 11, 2020.

  1. Hello, I have those two questions:

    1) Is there a way to spawn a custom structure? I mean, imagine that I create a big house but it is not in-game yet. When it passes a time the structure spawn. How could I do this? I think some ways but, it's a lot of repetitive code 'cause I have to spawn block by block and with its locations.

    2) How can I execute a method in a specific time? I have something I found searching.

    Code (Java):
    public void datetime() {
            DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Timer timer = new Timer();
            try {
                Date date = dateFormatter .parse("2020-02-10 18:55:00");
                timer.schedule(new eventzerozerotwo(), date);
               
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
       
        private static class eventzerozerotwo extends TimerTask {
            public void run() {
               
            }
        }
    I wonder if I can execute the "eventzerozerotwo" class without the TimerTask or something like that.
     
  2. If you want to execute (I'm assuing you mean invoke by this?) without invoking the TimerTask, you need to get rid of extending it in your eventzerozerotwo class. If this isn't possible, then no, you cannot do that.