#need help with HashMap
1 messages ยท Page 1 of 1 (latest)
โ This post has been reserved for your question.
Hey @mortal lichen! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
So your requirement is you want the HashMap variable after server restarts/reloads but currently it is getting cleared off. If what I understood is correct, can't you save the HashMap to a file (say json) and load it when the server reloads?
ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(new File("mapfile.json"), map);
And to read,
Map<Object, Object> map = mapper.readValue(
new File("mapfile.json"),
new TypeReference<Map<Object, Object>>() {
});
on this way i tryed it now...i added a debug message to look if is the sign back in the HashMap...the HashMap say yes...
but, the click event dont work after restart/reload ๐ฆ idk why ๐ฆ
Glad your hashmap issue is resolved.
Regarding the click event issue, is it a swing app? are you using a key listener? If so, it could be a focus issue. Here is a link which might be helpful. https://stackoverflow.com/questions/8074316/keylistener-not-working-after-clicking-button
If your problem is different, add some more details.
๐ค Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
re-open
no, it's a minecraft plugin. I'm currently developing a minigame plugin.
here is a more detailed description:
2 signs are set, 1 sign to join the game and 1 sign to leave the game. both work fine...
but if the server is restarted (or reloaded) and you then click on the join sign, you will no longer be teleported to the arena (through a debug message and your idea I was able to fix the error that the join sign was no longer in the HashMap) ...but for whatever reason (I don't understand) the sign is still recognized (checked by further debug messages) but you will no longer be teleported...if you reset the sign, it works again and the leave sign also works (without setting the leave sign again)...
So it could be that when the sign is set, the <Location, gamePath> is set correctly, but is not set correctly on reload (even if it is displayed correctly) ๐ฆ
I have now tested another debug message...directly after checking whether the clicked sign is available in the required HashMap...it doesn't seem to be recognized correctly ๐ฆ
well i found the issue...lets look if i can clear or or if i need help by that...i try it to clear with a help method
@mortal lichen Sorry, I can't help you with Minecraft plugins but see if you can add a Minecraft tag to your question so that Minecraft experts would notice the question.
how i do that?
When you post/edit the question, you've an option to add tags.