Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Proper access to craft via UUID #673

Merged
merged 16 commits into from
Jul 28, 2024

Conversation

DerToaster98
Copy link
Contributor

Describe in detail what your pull request accomplishes

Gives each craft a UUID. Crafts are now tracked in a weak map via their UUID.
Signs will now get a entry into their persistentdatacontainer that represents the craft UUID.
That way you can find the relevant craft for a sign more reliably (needed for a upcoming PR that will greatly change sign codes and make them easier to expand and more maintainable while also allowing other plugins to override the behavior of a specific sign in a easier way).

Checklist

  • Proper internationalization (not needed)
  • Tested
  • Performance tested (can potentially give performance boosts when many crafts are active)

@TylerS1066
Copy link
Contributor

We've got ourselves some lovely merge conflicts, it's probably best if you rebase this PR.

@DerToaster98
Copy link
Contributor Author

Resolved the conflicts, were just some imports.

@TylerS1066
Copy link
Contributor

TylerS1066 commented Jul 28, 2024

Looks like we do need imports for UUID and some other classes, probably need to use import java.util.*;.

@DerToaster98
Copy link
Contributor Author

Looks like we do need imports for UUID and some other classes, probably need to use import java.util.*;.

Oh, yes, i overlooked that when resolving it, Fixing it rn...

@TylerS1066
Copy link
Contributor

Looks like we need to add the following imports to Movecraft.java:

import net.countercraft.movecraft.features.status.StatusManager;
import net.countercraft.movecraft.features.status.StatusSign;

@TylerS1066 TylerS1066 merged commit 42881f2 into APDevTeam:main Jul 28, 2024
1 check passed
@DerToaster98 DerToaster98 deleted the craft-uuid-improvements branch July 28, 2024 13:08
@TylerS1066
Copy link
Contributor

Was this tested on a server? It seems to not be operating correctly.

java.lang.NullPointerException: Cannot invoke "java.util.UUID.hashCode()" because the return value of "net.countercraft.movecraft.craft.BaseCraft.getUUID()" is null
        at net.countercraft.movecraft.craft.BaseCraft.hashCode(BaseCraft.java:555) ~[Movecraft_42881f2cc80b07b3c7b3c614d5de0ba6e8ab37e2.jar:?]
        at java.util.HashMap.hash(HashMap.java:338) ~[?:?]
        at java.util.HashMap.put(HashMap.java:610) ~[?:?]
        at java.util.HashSet.add(HashSet.java:221) ~[?:?]
        at net.countercraft.movecraft.craft.CraftManager.getPlayerCraftsInWorld(CraftManager.java:334) ~[Movecraft_42881f2cc80b07b3c7b3c614d5de0ba6e8ab37e2.jar:?]
        at net.countercraft.movecraft.features.contacts.ContactsManager.runRecentContacts(ContactsManager.java:124) ~[Movecraft_42881f2cc80b07b3c7b3c614d5de0ba6e8ab37e2.jar:?]
        at net.countercraft.movecraft.features.contacts.ContactsManager.run(ContactsManager.java:35) ~[Movecraft_42881f2cc80b07b3c7b3c614d5de0ba6e8ab37e2.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftTask.run(CraftTask.java:101) ~[purpur-1.18.2.jar:git-Purpur-"dc4a29b"]
        at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.18.2.jar:git-Purpur-"dc4a29b"]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.18.2.jar:git-Purpur-"dc4a29b"]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]

@TylerS1066 TylerS1066 mentioned this pull request Jul 28, 2024
@TylerS1066
Copy link
Contributor

Simple enough fix, Uuid vs UUID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants