Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
897c1ff
feat: add database dependencies for JPA, Hibernate, and Flyway
TheMeinerLP Sep 4, 2025
a843e53
feat: add Hibernate, JPA, and Flyway dependencies for database integr…
TheMeinerLP Sep 4, 2025
517a46a
feat: add PlotEntity class for database representation of plots
TheMeinerLP Sep 4, 2025
e258786
feat: add ClusterEntity class for database representation of clusters
TheMeinerLP Sep 4, 2025
76414fb
feat: add PlotUserId class for composite key representation in database
TheMeinerLP Sep 4, 2025
b472442
feat: add PlotRatingId class for composite key representation in data…
TheMeinerLP Sep 4, 2025
785f3d1
feat: add ClusterUserId class for composite key representation in dat…
TheMeinerLP Sep 4, 2025
498740e
feat: add PlotCommentId class for composite key representation in dat…
TheMeinerLP Sep 4, 2025
b9d04ff
feat: add PlotSettingsEntity class for database representation of plo…
TheMeinerLP Sep 4, 2025
6e5464e
feat: add ClusterSettingsEntity class for database representation of …
TheMeinerLP Sep 4, 2025
dcccbed
feat: add PlotMembershipEntity class for database representation of p…
TheMeinerLP Sep 4, 2025
b0d20a4
feat: add PlotTrustedEntity class for database representation of trus…
TheMeinerLP Sep 4, 2025
e356e9f
feat: add PlotDeniedEntity class for database representation of denie…
TheMeinerLP Sep 4, 2025
5b0d563
feat: add PlotCommentEntity class for database representation of plot…
TheMeinerLP Sep 4, 2025
d7a8842
feat: add PlotRatingEntity class for database representation of plot …
TheMeinerLP Sep 4, 2025
226273c
feat: add ClusterHelperEntity class for database representation of cl…
TheMeinerLP Sep 4, 2025
d5d7b04
feat: add ClusterInvitedEntity class for database representation of i…
TheMeinerLP Sep 4, 2025
a9fc2bc
feat: add PlayerMetaEntity class for database representation of playe…
TheMeinerLP Sep 4, 2025
6fbbf5d
feat: add PlotFlagEntity class for database representation of plot flags
TheMeinerLP Sep 4, 2025
034607e
feat: add PersistenceModule for database configuration and entity man…
TheMeinerLP Sep 4, 2025
c4f5c6e
feat: add PrefixedNamingStrategy for custom table naming in database
TheMeinerLP Sep 4, 2025
ede12b4
feat: add repository interfaces for cluster and plot management
TheMeinerLP Sep 4, 2025
cba4edf
feat: implement JPA repositories for cluster and plot management
TheMeinerLP Sep 4, 2025
f4145c2
feat: add FlywayBootstrap for automatic database migration on startup
TheMeinerLP Sep 4, 2025
74888d0
feat: add JpaPropertiesProvider for dynamic JPA property configuration
TheMeinerLP Sep 4, 2025
a58f7ac
feat: bind JPA repository interfaces to implementations and configure…
TheMeinerLP Sep 4, 2025
5e1b56d
feat: integrate PersistenceModule into BukkitPlatform and clean up da…
TheMeinerLP Sep 4, 2025
4478e3f
feat: remove legacy database setup method from PlotSquared
TheMeinerLP Sep 4, 2025
65ec881
feat: add persistence.xml for JPA configuration
TheMeinerLP Sep 4, 2025
8b690fd
feat: enhance PlotCommentRepository with additional methods for hashc…
TheMeinerLP Sep 4, 2025
928e22b
feat: update PlotCommentEntity with new named queries for enhanced da…
TheMeinerLP Sep 4, 2025
5b8b29d
feat: enhance PlotCommentRepositoryJpa with new methods for inbox man…
TheMeinerLP Sep 4, 2025
3339111
feat: enhance Flyway configuration for JPA migration with placeholder…
TheMeinerLP Sep 4, 2025
82b101b
feat: refactor DBFunc to utilize PlayerMetaRepository and PlotComment…
TheMeinerLP Sep 4, 2025
0345265
feat: add repository interfaces for cluster and plot management with …
TheMeinerLP Sep 4, 2025
ac778ac
fix: remove unnecessary database connection closure in PlotSquared
TheMeinerLP Sep 4, 2025
7b901b9
feat: implement plot swapping and moving functionality in PlotReposit…
TheMeinerLP Sep 4, 2025
fe0924b
feat: add new named queries for plot management in PlotEntity
TheMeinerLP Sep 4, 2025
df90d51
feat: refactor plot management methods to use PlotRepository for impr…
TheMeinerLP Sep 4, 2025
8cb5c9a
feat: implement bulk creation of plots and associated data in PlotRep…
TheMeinerLP Sep 4, 2025
386a5eb
feat: refactor plot creation methods to use PlotRepository for improv…
TheMeinerLP Sep 4, 2025
dedac79
feat: refactor plot deletion methods to utilize PlotRepository for im…
TheMeinerLP Sep 4, 2025
b5d5af2
feat: remove unused UUID service imports and related code for cleaner…
TheMeinerLP Sep 4, 2025
e1a0af0
feat: remove DatabaseCommand from command list for cleaner command ma…
TheMeinerLP Sep 4, 2025
f84e849
feat: add cluster and plot repository methods for bulk world updates …
TheMeinerLP Sep 4, 2025
16432f9
feat: implement cluster and plot repository methods for world updates…
TheMeinerLP Sep 4, 2025
c900f84
feat: add named queries for updating cluster and plot settings entities
TheMeinerLP Sep 4, 2025
961509f
feat: add binding for ClusterSettingsRepository in PersistenceModule
TheMeinerLP Sep 4, 2025
cab85a9
feat: refactor DBFunc to use repository pattern for plot and cluster …
TheMeinerLP Sep 4, 2025
75a3244
feat: remove legacy database classes and interfaces for a cleaner and…
TheMeinerLP Sep 4, 2025
2bf312f
feat: add JAXB runtime and Hibernate community dialects dependencies …
TheMeinerLP Sep 4, 2025
57f637a
feat: update Hibernate configuration to create schema on startup
TheMeinerLP Sep 4, 2025
c8e14d3
feat: enhance persistence module with eager binding and context class…
TheMeinerLP Sep 4, 2025
8c4015e
feat: remove hbm2ddl.auto property from persistence.xml for improved …
TheMeinerLP Sep 4, 2025
3155ded
feat: add Flyway MySQL dependency for improved database migration sup…
TheMeinerLP Sep 4, 2025
d852368
feat: add GPL license headers to repository classes for compliance
TheMeinerLP Sep 4, 2025
2296957
feat: add versioning and author information to repository interfaces …
TheMeinerLP Sep 5, 2025
5f98a88
feat: enhance ClusterEntity and ClusterRepositoryJpa with additional …
TheMeinerLP Sep 5, 2025
b2f68e2
feat: refactor ClusterHelperRepositoryJpa to use try-with-resources f…
TheMeinerLP Sep 5, 2025
ed5a973
feat: refactor ClusterInvitedRepositoryJpa to use try-with-resources …
TheMeinerLP Sep 5, 2025
300612d
feat: refactor DBFunc to eliminate unnecessary try-catch blocks and i…
TheMeinerLP Sep 5, 2025
a5d7cc7
feat: add new methods to PlotRepository for world name replacement, p…
TheMeinerLP Sep 5, 2025
9cf43c1
feat: update classes for improved readability and consistency, add Ja…
TheMeinerLP Sep 5, 2025
7470b01
feat: refactor PlayerMetaRepositoryJpa to use try-with-resources for …
TheMeinerLP Sep 5, 2025
15790dd
feat: refactor ClusterSettingsRepositoryJpa to use try-with-resources…
TheMeinerLP Sep 5, 2025
6e74200
feat: enhance PlayerMetaRepositoryJpa with @NotNull annotations for i…
TheMeinerLP Sep 5, 2025
6883257
feat: add @NotNull annotation to updatePosition method in ClusterSett…
TheMeinerLP Sep 5, 2025
7df59b5
feat: add @NotNull annotations to PlotCommentRepositoryJpa methods fo…
TheMeinerLP Sep 5, 2025
253c6a9
feat: add @NotNull annotations to methods in PlotDeniedRepositoryJpa …
TheMeinerLP Sep 5, 2025
0d0ccb5
feat: add @NotNull annotations to methods in PlotFlagRepositoryJpa fo…
TheMeinerLP Sep 5, 2025
2e4669b
feat: add @NotNull annotations to methods in PlotMembershipRepository…
TheMeinerLP Sep 5, 2025
27bc20a
feat: add @NotNull annotations to methods in PlotRatingRepositoryJpa …
TheMeinerLP Sep 5, 2025
5b05998
feat: refactor PlotTrustedEntity and PlotTrustedRepositoryJpa for imp…
TheMeinerLP Sep 5, 2025
123d8fc
feat: add @NotNull annotations to methods in PlotSettingsRepositoryJp…
TheMeinerLP Sep 5, 2025
4259663
feat: add named queries for retrieving and deleting plots in various …
TheMeinerLP Sep 5, 2025
87f10e4
feat: remove unused import from PlotMembershipEntity for cleaner code
TheMeinerLP Sep 5, 2025
d9702f9
feat: simplify error handling and improve code readability in DBFunc …
TheMeinerLP Sep 5, 2025
da3ecb1
feat: remove unused import from DBFunc for cleaner code
TheMeinerLP Sep 5, 2025
a145f0b
feat: update version to 8.0.0-SNAPSHOT for upcoming release
TheMeinerLP Sep 5, 2025
35039be
feat: update database dependencies to use Liquibase and HikariCP
TheMeinerLP Sep 5, 2025
ebf6252
feat: implement DataSourceProvider and DatabaseMigrationService for L…
TheMeinerLP Sep 5, 2025
59dd673
feat: add Liquibase changelogs for v8 migration and new installations
TheMeinerLP Sep 5, 2025
bc55baf
feat: add DatabaseCommand for migrating databases between SQLite and …
TheMeinerLP Sep 5, 2025
f6df7e2
feat: refactor DatabaseCommand and DatabaseMigrationService for Liqui…
TheMeinerLP Sep 5, 2025
c69e7a0
feat: enhance Liquibase migration support for MySQL and SQLite with n…
TheMeinerLP Sep 5, 2025
cb49ac1
feat: exclude SQLite from MySQL-specific migration changes in v7-to-v…
TheMeinerLP Sep 5, 2025
2915b42
feat: fix MySQL datasource URL construction to ensure database creati…
TheMeinerLP Sep 5, 2025
7fa6f7d
feat: specify database type for v7 to v8 migration changeSets in XML …
TheMeinerLP Sep 5, 2025
181c073
feat: implement H2 database migration support and refactor related se…
TheMeinerLP Sep 5, 2025
90a2c90
feat: add H2 database support and include JAXB runtime dependency
TheMeinerLP Sep 5, 2025
e49cac5
feat: remove SQLite support and clean up database migration logic
TheMeinerLP Sep 5, 2025
4d65f89
feat: implement UUID services for EssentialsX, LuckPerms, OfflinePlay…
TheMeinerLP Sep 6, 2025
bd772a3
feat: rename RunnableVal variable for clarity in plot creation logic
TheMeinerLP Sep 6, 2025
d52e790
feat: simplify H2 database URL construction using switch expression
TheMeinerLP Sep 6, 2025
76c6508
feat: switch to Hibernate for EntityManagerFactory creation and updat…
TheMeinerLP Sep 6, 2025
cc38465
feat: convert identifiers to uppercase in PrefixedNamingStrategy
TheMeinerLP Sep 6, 2025
1f38e43
feat: refactor database changelogs for v8 migration and new table cre…
TheMeinerLP Sep 6, 2025
bd7dabf
feat: add named query to find all plot flags by multiple plot IDs
TheMeinerLP Sep 6, 2025
065be17
feat: update PlotFlag repository methods to use getSingleResultOrNull…
TheMeinerLP Sep 6, 2025
07b0b14
feat: update PlayerMetaEntity and PlotFlagEntity to use more descript…
TheMeinerLP Sep 6, 2025
e3b1465
feat: enhance PrefixedNamingStrategy to handle null identifiers and c…
TheMeinerLP Sep 6, 2025
e109c30
feat: rename fields in PlayerMetaEntity and PlotFlagEntity for clarity
TheMeinerLP Sep 6, 2025
1c9dc4e
feat: update PlayerMetaEntity and PlotFlagEntity to use more descript…
TheMeinerLP Sep 6, 2025
3317b2e
feat: rename columns in database schema for PlayerMetaEntity and Plot…
TheMeinerLP Sep 6, 2025
d5c3185
feat: remove unused imports from BukkitPlatform.java for cleaner code
TheMeinerLP Sep 6, 2025
b90a20b
feat: remove trailing whitespace in Storage.java for cleaner code
TheMeinerLP Sep 6, 2025
0667ba7
feat: remove unused Logger import from DatabaseMigrationService.java …
TheMeinerLP Sep 6, 2025
86cd252
feat: remove unused Logger import from DataSourceProvider.java for cl…
TheMeinerLP Sep 6, 2025
aeb23cf
feat: add license header to InstallationState.java for compliance
TheMeinerLP Sep 6, 2025
8c30f89
feat: remove logging of database version in LiquibaseBootstrap for cl…
TheMeinerLP Sep 6, 2025
f24b617
feat: simplify LiquibaseBootstrap and remove unused migration validat…
TheMeinerLP Sep 6, 2025
7981a6e
feat: make PrefixedNamingStrategy class final for better immutability
TheMeinerLP Sep 6, 2025
11fb49e
feat: add PlayerMetaService interface for managing player metadata
TheMeinerLP Sep 6, 2025
27e841d
feat: implement PlayerMetaDefaultService for managing player metadata
TheMeinerLP Sep 6, 2025
6411a00
feat: add ServiceModule for binding PlayerMetaService to PlayerMetaDe…
TheMeinerLP Sep 6, 2025
0df99de
feat: add ServiceModule to BukkitPlatform for improved service manage…
TheMeinerLP Sep 6, 2025
5f509de
feat: refactor persistent metadata handling to use PlayerMetaService
TheMeinerLP Sep 6, 2025
5822cff
feat: remove deprecated persistent metadata methods from DBFunc
TheMeinerLP Sep 6, 2025
5818fe2
feat: add PlotService interface for plot management operations
TheMeinerLP Sep 6, 2025
08424e2
feat: implement PlotDefaultService for plot management operations
TheMeinerLP Sep 6, 2025
e1f393e
feat: bind PlotService to PlotDefaultService in ServiceModule
TheMeinerLP Sep 6, 2025
84b2c4a
feat: refactor plot ownership and management to use PlotService
TheMeinerLP Sep 6, 2025
f8f9d5f
feat: refactor plot creation and retrieval to use PlotService
TheMeinerLP Sep 6, 2025
4a50591
feat: remove deprecated plot management methods from DBFunc
TheMeinerLP Sep 6, 2025
0e73fd7
feat: remove unused DBFunc imports across multiple files
TheMeinerLP Sep 6, 2025
aedce45
feat: add ClusterService interface for plot cluster management
TheMeinerLP Sep 6, 2025
3463913
feat: implement ClusterDefaultService for cluster management function…
TheMeinerLP Sep 6, 2025
c898649
feat: refactor cluster management to use ClusterService for database …
TheMeinerLP Sep 6, 2025
c3eced0
feat: integrate ClusterService for world replacement in PlotSquared
TheMeinerLP Sep 6, 2025
37ba723
feat: bind ClusterService to ClusterDefaultService in ServiceModule
TheMeinerLP Sep 6, 2025
de4a63b
feat: remove unused Cluster-related methods from DBFunc
TheMeinerLP Sep 6, 2025
4d744da
feat: remove unused DBFunc imports from Cluster and PlotSquared classes
TheMeinerLP Sep 6, 2025
f1fd063
feat: refactor DBFunc methods to use PlotService for database operations
TheMeinerLP Sep 6, 2025
895ca03
feat: remove unused imports from Purge and PlotDefaultService classes
TheMeinerLP Sep 6, 2025
0432dcf
feat: refactor flag management by introducing FlagService and removin…
TheMeinerLP Sep 6, 2025
c6e769b
feat: add FlagService and FlagDefaultService with necessary imports a…
TheMeinerLP Sep 6, 2025
5d64771
feat: refactor comment handling by introducing CommentService and rem…
TheMeinerLP Sep 6, 2025
5d4bbe9
feat: introduce MemberService and refactor DBFunc methods for member …
TheMeinerLP Sep 6, 2025
36a956c
feat: introduce RatingService and RatingDefaultService for plot ratin…
TheMeinerLP Sep 6, 2025
4097282
feat: replace DBFunc references with StaticUUIDs for improved clarity…
TheMeinerLP Sep 6, 2025
cb4fcbd
feat: add dependency injection for MemberDefaultService
TheMeinerLP Sep 6, 2025
224dd79
Merge branch 'main' into feature/v8/database-rework
TheMeinerLP Sep 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 7 additions & 131 deletions Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import com.plotsquared.bukkit.uuid.LuckPermsUUIDService;
import com.plotsquared.bukkit.uuid.OfflinePlayerUUIDService;
import com.plotsquared.bukkit.uuid.PaperUUIDService;
import com.plotsquared.bukkit.uuid.SQLiteUUIDService;
import com.plotsquared.bukkit.uuid.SquirrelIdUUIDService;
import com.plotsquared.core.PlotPlatform;
import com.plotsquared.core.PlotSquared;
Expand All @@ -71,7 +70,7 @@
import com.plotsquared.core.configuration.Storage;
import com.plotsquared.core.configuration.caption.ChatFormatter;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.util.StaticUUIDs;
import com.plotsquared.core.events.RemoveRoadEntityEvent;
import com.plotsquared.core.events.Result;
import com.plotsquared.core.generator.GeneratorWrapper;
Expand All @@ -85,6 +84,7 @@
import com.plotsquared.core.inject.modules.PlotSquaredModule;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.listener.WESubscriber;
import com.plotsquared.core.persistence.config.PersistenceModule;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
Expand All @@ -96,10 +96,10 @@
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.services.config.ServiceModule;
import com.plotsquared.core.setup.PlotAreaBuilder;
import com.plotsquared.core.setup.SettingsNodesWrapper;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.FileUtils;
import com.plotsquared.core.util.PlatformWorldManager;
import com.plotsquared.core.util.PlayerManager;
import com.plotsquared.core.util.PremiumVerification;
Expand Down Expand Up @@ -149,18 +149,10 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import static com.plotsquared.core.util.PremiumVerification.getDownloadID;
import static com.plotsquared.core.util.PremiumVerification.getResourceID;
Expand Down Expand Up @@ -298,7 +290,9 @@ public void onEnable() {
new WorldManagerModule(),
new PlotSquaredModule(),
new BukkitModule(this),
new BackupModule()
new BackupModule(),
new PersistenceModule(),
new ServiceModule()
);
this.injector.injectMembers(this);

Expand All @@ -323,25 +317,6 @@ public void onEnable() {
LOGGER.info("Couldn't verify purchase :(");
}

// Database
if (Settings.Enabled_Components.DATABASE) {
plotSquared.setupDatabase();
}

// Check if we need to convert old flag values, etc
if (!plotSquared.getConfigurationVersion().equalsIgnoreCase("v5")) {
// Perform upgrade
if (DBFunc.dbManager.convertFlags()) {
LOGGER.info("Flags were converted successfully!");
// Update the config version
try {
plotSquared.setConfigurationVersion("v5");
} catch (final Exception e) {
e.printStackTrace();
}
}
}

// Comments
CommentManager.registerDefaultInboxes();

Expand Down Expand Up @@ -472,17 +447,6 @@ public void onEnable() {
this.backgroundPipeline.registerService(offlinePlayerUUIDService);
}

final SQLiteUUIDService sqLiteUUIDService = new SQLiteUUIDService("user_cache.db");

final SQLiteUUIDService legacyUUIDService;
if (Settings.UUID.LEGACY_DATABASE_SUPPORT && FileUtils
.getFile(PlotSquared.platform().getDirectory(), "usercache.db")
.exists()) {
legacyUUIDService = new SQLiteUUIDService("usercache.db");
} else {
legacyUUIDService = null;
}

final LuckPermsUUIDService luckPermsUUIDService;
if (Settings.UUID.SERVICE_LUCKPERMS && Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
luckPermsUUIDService = new LuckPermsUUIDService();
Expand All @@ -508,16 +472,6 @@ public void onEnable() {
LOGGER.info("(UUID) Using Paper as a complementary UUID service");
}

this.impromptuPipeline.registerService(sqLiteUUIDService);
this.backgroundPipeline.registerService(sqLiteUUIDService);
this.impromptuPipeline.registerConsumer(sqLiteUUIDService);
this.backgroundPipeline.registerConsumer(sqLiteUUIDService);

if (legacyUUIDService != null) {
this.impromptuPipeline.registerService(legacyUUIDService);
this.backgroundPipeline.registerService(legacyUUIDService);
}

// Plugin providers
if (luckPermsUUIDService != null) {
this.impromptuPipeline.registerService(luckPermsUUIDService);
Expand All @@ -534,23 +488,9 @@ public void onEnable() {
}
final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT);
this.backgroundPipeline.registerService(backgroundMojangService);
} else {
this.impromptuPipeline.registerService(sqLiteUUIDService);
this.backgroundPipeline.registerService(sqLiteUUIDService);
this.impromptuPipeline.registerConsumer(sqLiteUUIDService);
this.backgroundPipeline.registerConsumer(sqLiteUUIDService);

if (legacyUUIDService != null) {
this.impromptuPipeline.registerService(legacyUUIDService);
this.backgroundPipeline.registerService(legacyUUIDService);
}
}

this.impromptuPipeline.storeImmediately("*", DBFunc.EVERYONE);

if (Settings.UUID.BACKGROUND_CACHING_ENABLED) {
this.startUuidCaching(sqLiteUUIDService, cacheUUIDService);
}
this.impromptuPipeline.storeImmediately("*", StaticUUIDs.EVERYONE);

if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
injector.getInstance(PAPIPlaceholders.class).register();
Expand Down Expand Up @@ -674,70 +614,6 @@ private void unload() {
}
}

private void startUuidCaching(
final @NonNull SQLiteUUIDService sqLiteUUIDService,
final @NonNull CacheUUIDService cacheUUIDService
) {
// Record all unique UUID's and put them into a queue
final Set<UUID> uuidSet = new HashSet<>();
PlotSquared.get().forEachPlotRaw(plot -> {
uuidSet.add(plot.getOwnerAbs());
uuidSet.addAll(plot.getMembers());
uuidSet.addAll(plot.getTrusted());
uuidSet.addAll(plot.getDenied());
});
final Queue<UUID> uuidQueue = new LinkedBlockingQueue<>(uuidSet);

LOGGER.info("(UUID) {} UUIDs will be cached", uuidQueue.size());

Executors.newSingleThreadScheduledExecutor().schedule(() -> {
// Begin by reading all the SQLite cache at once
cacheUUIDService.accept(sqLiteUUIDService.getAll());
// Now fetch names for all known UUIDs
final int totalSize = uuidQueue.size();
int read = 0;
LOGGER.info("(UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);

// Used to indicate that the second retrieval has been attempted
boolean secondRun = false;

while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
if (!uuidList.isEmpty() && secondRun) {
LOGGER.warn("(UUID) Giving up on last batch. Fetching new batch instead");
uuidList.clear();
}
if (uuidList.isEmpty()) {
// Retrieve the secondRun variable to indicate that we're retrieving a
// fresh batch
secondRun = false;
// Populate the request list
for (int i = 0; i < Settings.UUID.BACKGROUND_LIMIT && !uuidQueue.isEmpty(); i++) {
uuidList.add(uuidQueue.poll());
read++;
}
} else {
// If the list isn't empty then this is a second run for
// an old batch, so we re-use the patch
secondRun = true;
}
try {
PlotSquared.get().getBackgroundUUIDPipeline().getNames(uuidList).get();
// Clear the list if we successfully index all the names
uuidList.clear();
// Print progress
final double percentage = ((double) read / (double) totalSize) * 100.0D;
if (Settings.DEBUG) {
LOGGER.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
}
} catch (final InterruptedException | ExecutionException e) {
LOGGER.error("(UUID) Failed to retrieve last batch. Will try again", e);
}
}
LOGGER.info("(UUID) PlotSquared has cached all UUIDs");
}, 10, TimeUnit.SECONDS);
}

@Override
public void onDisable() {
PlotSquared.get().disable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.util.StaticUUIDs;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void onRedstoneEvent(BlockRedstoneEvent event) {
}
if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable = false;
if (!DBFunc.SERVER.equals(plot.getOwner())) {
if (!StaticUUIDs.SERVER.equals(plot.getOwner())) {
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
Expand Down

This file was deleted.

Loading
Loading