-
-
Notifications
You must be signed in to change notification settings - Fork 34
Add block donation feature #412
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
Changes from 31 commits
c9851fe
c5c6ef2
9c535c5
2fd5615
d572a33
a4fc233
0d5000d
f242433
a09b0a4
76190aa
449cb18
358a0e1
4f3d815
8037192
64931a1
b3ec23e
63a460d
b9d4ca0
995c418
4128b1a
d00883e
615dc67
b5620a2
6702b49
54b50be
d68da46
9c0a5e1
322a605
8346ae3
9a4ec0f
f0fc85d
4ae01bb
f27f8f7
aa92264
e68f503
bfce0e8
2c546e3
099fc44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,8 @@ private boolean addToTopTen(Island island, long lv) { | |
| && hasTopTenPerm(island.getWorld(), island.getOwner())) { | ||
| topTenLists.computeIfAbsent(island.getWorld(), k -> new TopTenData(island.getWorld())).getTopTen() | ||
| .put(island.getUniqueId(), lv); | ||
| // Invalidate the cache for this world because of the update | ||
| cache.remove(island.getWorld()); | ||
| return true; | ||
| } | ||
| return false; | ||
|
|
@@ -540,4 +542,43 @@ public void deleteIsland(String uniqueId) { | |
| handler.deleteID(uniqueId); | ||
| } | ||
|
|
||
| // ---- Block Donation Methods ---- | ||
|
|
||
| /** | ||
| * Record a block donation for an island. Items should already be removed from the player's inventory. | ||
| * | ||
| * @param island the island receiving the donation | ||
| * @param donorUUID UUID of the donating player | ||
| * @param material the material name being donated | ||
| * @param count how many blocks | ||
| * @param points the point value of this donation | ||
| */ | ||
| public void donateBlocks(@NonNull Island island, @NonNull UUID donorUUID, @NonNull String material, int count, long points) { | ||
| IslandLevels ld = levelsCache.computeIfAbsent(island.getUniqueId(), IslandLevels::new); | ||
|
tastybento marked this conversation as resolved.
Outdated
|
||
| ld.addDonation(donorUUID.toString(), material, count, points); | ||
| handler.saveObjectAsync(ld); | ||
| // Update the top ten to reflect the donation | ||
| addToTopTen(island, ld.getLevel()); | ||
|
tastybento marked this conversation as resolved.
Outdated
|
||
| } | ||
|
Comment on lines
+556
to
+573
|
||
|
|
||
| /** | ||
| * Get the total donated points for an island. | ||
| * | ||
| * @param island the island | ||
| * @return total donated points | ||
| */ | ||
| public long getDonatedPoints(@NonNull Island island) { | ||
| return getLevelsData(island).getDonatedPoints(); | ||
| } | ||
|
|
||
| /** | ||
| * Get the donated blocks map for an island. | ||
| * | ||
| * @param island the island | ||
| * @return map of material name to count | ||
| */ | ||
| public Map<String, Integer> getDonatedBlocks(@NonNull Island island) { | ||
| return getLevelsData(island).getDonatedBlocks(); | ||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.