I'm trying to make a poll plugin but I don't know how to store arraylists for the poll name, id, answers, etc. Could anyone help? I have no code...
@Boobah Start with this: What are you trying to save? And where are you trying to do that? How long do you need to keep it saved?
@timtower So the player does /poll create <name> <question> and it saves the id (number of polls), name, and question to an arraylist. When a player does /poll list, it should list all the polls' names. When a player does /poll list <name>, it lists the question and answers (set through different command). this would be saved until the player does /poll remove <name>
@Boobah I would recommend doing the following: Create a hashmap. The keys will be Integers and the values will be the poll name/entry's name(most likely a string). This represents which IDs will be linked to which value. Create another hashmap, where both the keys and values are Integers. This represents how many votes one entry has. Create a boolean. This represents if there is a poll currently going on. When a player votes (I assume through a command), check if the boolean is true, and if so, add +1 to the entry they chose. When you want to start the poll, set the boolean to true, send the list of all the entries, and then set up a Delayed task that will set the boolean to false after ___ amount of time.