public static void set(Object object, long time) { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { Object arguments; arguments = object; }}, time); } but when i use set(sender.sendMessage("test"), 10l); it sends an error
thats a noble try. you cant pass a method call as an argument, thats simply not how it works. change your object argument to a runnable, and pass the runnable instead, then when you use set, you can use Code (Java): set(() -> sender.sendMessage("test"), 10L); /e Code (Text): () -> sender... is a lambda construction of a runnable. this is the same as doing new Runnable() { run() { ... } } then instead of creating a runnable in your set method, just use this runnable that youre passing as an argument
You need to make that method for a certain use, e.g. sending a message replace object with a string and it will send a message later As said above you can’t put call a method in an argument so you will have to do it this way or make a runnable each time