Hello, does anyone know how to run a command only when the user confirms it with another command, which is available for 10secs after the user runs the command? For example: User xy types command "/deleteeverything now". Then User xy has 10 seconds to type "/deleteeverything confirm" to really do it. Thanks, maino
Yes, I had this exact question on a different plugin. What you need to do, is when the player types the essential command "/deleteeverything now" you need to put his name, and a boolean into a new HashMap. Also, when he types "/deleteeverything now" you need to set that boolean to true, before you put it into the HashMap. When the player types "/deleteeverything confirm" it gets the information from the HashMap, it then checks if the boolean is true, and if the playername in from the HashMap = the sender's username. If you need any other help, or you just don't get this, just ask.
Instead of using a boolean, store a long that contains that time the command was executed. Then you can check to make sure no more than 10 seconds have passed, and also write a cleanup task that erases old entries where the 10 second timeout period expired