-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Multipaper #2343
Multipaper #2343
Conversation
This build has a lot of debug in it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Period database saving is no longer required because the database is updated continuously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the quarantine island code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Team invites are now stored in a database instead of memory so that they can be accessed by any server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new data object to store invites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do explicit saves because new data is saved when written to the Players object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Players are not cached anymore. If player data is needed, it is read from the database.
* Replace the island we have with this one | ||
* @param newIsland island | ||
*/ | ||
public void updateIsland(@NonNull Island newIsland) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces the previous "save" method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Islands are still cached, but if there is a change made to an island value, then it is communicated to all other servers so that they can load the new Island from the database and refresh their cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Island Grid was storing Island objects in its 2D map. Now it stores island IDs. This is better because it means that the data doesn't have to be updated if a cache update to refresh an Island. Island locations never change, but other Island data can change.
if (zEntry.containsKey(island.getMinZ())) { | ||
// There is an overlap or duplicate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of old defensive code has been removed. If it's required, it can be added again, but I don't think it's needed.
boolean removed = grid.values().stream() | ||
.anyMatch(innerMap -> innerMap.values().removeIf(innerValue -> innerValue.equals(id))); | ||
|
||
grid.values().removeIf(TreeMap::isEmpty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This previous code was broken and not fully removing islands from the 2D map.
@@ -489,7 +489,7 @@ private PanelItem createBundleButton(ItemTemplateRecord template, BlueprintBundl | |||
long uses = plugin.getIslands().getIslands(world, user).stream() | |||
.filter(is -> is.getMetaData("bundle") | |||
.map(mdv -> bundle.getDisplayName().equalsIgnoreCase(mdv.asString()) | |||
&& !(reset && is.isPrimary())) // If this is a reset, then ignore the use of the island being reset | |||
&& !(reset && is.isPrimary(user.getUniqueId()))) // If this is a reset, then ignore the use of the island being reset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a bug where the primary island record was not user specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of changes in this class for obvious reasons.
island.setMaxMembers(rank, islandMax == worldDefault ? null : islandMax); | ||
this.save(island); | ||
Integer change = islandMax == worldDefault ? null : islandMax; | ||
if (island.getMaxMembers().get(rank) != change) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only make a change if a change is needed.
public void save(Island island) { | ||
handler.saveObjectAsync(island); | ||
public static void updateIsland(Island island) { | ||
if (handler.objectExists(island.getUniqueId())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between updateIsland and the old save is that this only updates an existing Island. It won't create a new database entry. This prevents async updates from regenerating Island objects that had been deleted.
@@ -56,7 +58,7 @@ | |||
public class Island implements DataObject, MetaDataAble { | |||
|
|||
@Expose | |||
private boolean primary; | |||
private Set<UUID> primaries = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a bug where the primary island flag was not specific to users and instead was global.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of this class has changed to update the database if and only if a value actually changes, so there are multiple checks of current data to see if it is different to newly written data.
Quality Gate passedIssues Measures |
Mp debug sesh
This PR brings Multipaper compatibility to BentoBox. This should not affect servers running non-Multi paper.