#need help with HashMap

1 messages ยท Page 1 of 1 (latest)

white mountainBOT
#

โŒ› This post has been reserved for your question.

Hey @mortal lichen! Please use /close or the Close Post button 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.

undone verge
#

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>>() {
 });
mortal lichen
undone verge
#

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.

white mountainBOT
#

๐Ÿ’ค 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.

mortal lichen
#

re-open

mortal lichen
# undone verge Glad your hashmap issue is resolved. Regarding the click event issue, is it a s...

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) ๐Ÿ˜ฆ

mortal lichen
#

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

undone verge
#

@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.

undone verge
#

When you post/edit the question, you've an option to add tags.

mortal lichen
#

iam on pc...i dont see that if i edit the question

#

@undone verge but it doesn't matter now...thanks for your attempt to help, I'll just completely rewrite the code so that it no longer uses the HashMap to find the sign