Skip to content

Commit 4f6cc82

Browse files
authored
Merge pull request #644 from Multiverse/v5.3
V5.3
2 parents 66d766c + 30a4a9d commit 4f6cc82

27 files changed

+44
-1398
lines changed

build.gradle

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ group = 'org.mvplugins.multiverse.inventories'
77
description = 'Multiverse-Inventories'
88

99
repositories {
10-
maven {
11-
name = 'codemc'
12-
url = uri('https://repo.codemc.org/repository/maven-releases')
13-
}
14-
1510
maven {
1611
name = "helpchatRepoReleases"
1712
url = uri("https://repo.helpch.at/releases/")
@@ -36,7 +31,7 @@ configure(apiDependencies) {
3631

3732
dependencies {
3833
// Core
39-
externalPlugin 'org.mvplugins.multiverse.core:multiverse-core:5.2.0'
34+
externalPlugin 'org.mvplugins.multiverse.core:multiverse-core:5.3.0'
4035

4136
// Config
4237
shadowed 'com.dumptruckman.minecraft:JsonConfiguration:1.2-SNAPSHOT'
@@ -59,24 +54,10 @@ dependencies {
5954
// Luckperms for group context
6055
compileOnly 'net.luckperms:api:5.4'
6156

62-
// Other plugins for import
63-
compileOnly('uk.co:MultiInv:3.0.6') {
64-
exclude group: '*', module: '*'
65-
}
66-
compileOnly('me.drayshak:WorldInventories:1.0.2') {
67-
exclude group: '*', module: '*'
68-
}
69-
// perworldinventory is weird and has snakeyaml included in the jar, so we can only use compileOnly for build to work properly
70-
compileOnly('me.ebonjaeger:perworldinventory-kt:2.3.2') {
71-
exclude group: '*', module: '*'
72-
}
73-
7457
// hk2 for annotation processing only
7558
compileOnly('org.glassfish.hk2:hk2-api:3.1.1') {
7659
exclude group: '*', module: '*'
7760
}
78-
annotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.1.1'
79-
testAnnotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.1.1'
8061
}
8162

8263
shadowJar {

src/main/java/org/mvplugins/multiverse/inventories/MultiverseInventories.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
@Service
4545
public class MultiverseInventories extends MultiverseModule {
4646

47-
private static final double TARGET_CORE_API_VERSION = 5.2;
47+
private static final double TARGET_CORE_API_VERSION = 5.3;
4848

4949
@Inject
5050
private Provider<CoreConfig> coreConfig;
@@ -63,8 +63,6 @@ public class MultiverseInventories extends MultiverseModule {
6363
@Inject
6464
private Provider<ProfileContainerStoreProvider> profileContainerStoreProvider;
6565
@Inject
66-
private Provider<DataImportManager> dataImportManager;
67-
@Inject
6866
private Provider<MVInvCommandCompletion> mvInvCommandCompletion;
6967
@Inject
7068
private Provider<MVInvCommandContexts> mvInvCommandContexts;
@@ -112,9 +110,6 @@ public final void onEnable() {
112110
this.registerCommands();
113111
this.registerDestinations();
114112

115-
// Hook plugins that can be imported from
116-
this.hookImportables();
117-
118113
// Init other extensions
119114
this.hookLuckPerms();
120115
this.loadPlaceholderApiIntegration();
@@ -171,12 +166,6 @@ private void registerDestinations() {
171166
destinationsProvider.get().registerDestination(serviceLocator.getService(LastLocationDestination.class));
172167
}
173168

174-
private void hookImportables() {
175-
serviceLocator.getAllServices(DataImporter.class).forEach(dataImporter -> {
176-
dataImportManager.get().register(dataImporter);
177-
});
178-
}
179-
180169
private void hookLuckPerms() {
181170
Try.run(() -> Class.forName("net.luckperms.api.LuckPerms"))
182171
.onFailure(e -> Logging.fine("Luckperms is not installed!"))

src/main/java/org/mvplugins/multiverse/inventories/commands/MigrateCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.mvplugins.multiverse.inventories.commands;
22

3+
import com.dumptruckman.minecraft.util.Logging;
34
import org.jetbrains.annotations.NotNull;
45
import org.jvnet.hk2.annotations.Service;
56
import org.mvplugins.multiverse.core.command.MVCommandIssuer;
@@ -46,6 +47,13 @@ void onMigrateCommand(
4647
@Syntax("<MultiInv|WorldInventories|PerWorldInventory>")
4748
String pluginName) {
4849

50+
if (dataImportManager.getEnabledImporterNames().isEmpty()) {
51+
issuer.sendError("Please install Multiverse-InventoriesImporter plugin to use this command.");
52+
issuer.sendInfo("Download Link: https://modrinth.com/project/multiverse-inventoriesimporter/");
53+
issuer.sendInfo("Learn More: https://mvplugins.org/inventories/how-to/import-playerdata/");
54+
return;
55+
}
56+
4957
dataImportManager.getImporter(pluginName)
5058
.onEmpty(() -> issuer.sendError(MVInvi18n.MIGRATE_UNSUPPORTEDPLUGIN, replace("{plugin}").with(pluginName)))
5159
.peek(dataImporter -> {
Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.mvplugins.multiverse.inventories.commands;
22

3-
import com.google.common.io.Files;
43
import org.bukkit.World;
54
import org.jvnet.hk2.annotations.Service;
65
import org.mvplugins.multiverse.core.command.MVCommandIssuer;
@@ -9,72 +8,18 @@
98
import org.mvplugins.multiverse.external.acf.commands.annotation.Description;
109
import org.mvplugins.multiverse.external.acf.commands.annotation.Subcommand;
1110
import org.mvplugins.multiverse.external.acf.commands.annotation.Syntax;
12-
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
13-
import org.mvplugins.multiverse.external.vavr.control.Try;
14-
import org.mvplugins.multiverse.inventories.profile.ProfileDataSource;
15-
import org.mvplugins.multiverse.inventories.profile.data.ProfileData;
16-
import org.mvplugins.multiverse.inventories.profile.key.ContainerType;
17-
import org.mvplugins.multiverse.inventories.profile.key.GlobalProfileKey;
18-
import org.mvplugins.multiverse.inventories.profile.key.ProfileKey;
19-
import org.mvplugins.multiverse.inventories.profile.key.ProfileTypes;
20-
import org.mvplugins.multiverse.inventories.profile.nbt.PlayerDataExtractor;
21-
22-
import java.io.File;
23-
import java.nio.file.Path;
24-
import java.util.ArrayList;
25-
import java.util.List;
26-
import java.util.UUID;
27-
import java.util.concurrent.CompletableFuture;
2811

2912
@Service
3013
final class PlayerDataImportCommand extends InventoriesCommand {
3114

32-
private final PlayerDataExtractor playerDataExtractor;
33-
private final ProfileDataSource profileDataSource;
34-
35-
@Inject
36-
PlayerDataImportCommand(PlayerDataExtractor playerDataExtractor, ProfileDataSource profileDataSource) {
37-
this.playerDataExtractor = playerDataExtractor;
38-
this.profileDataSource = profileDataSource;
39-
}
40-
4115
@Subcommand("playerdata import")
4216
@Syntax("<world>")
4317
@CommandPermission("multiverse.inventories.importplayerdata")
4418
@CommandCompletion("@worldwithplayerdata")
4519
@Description("Import player data from the world's playerdata folder.")
4620
void onCommand(MVCommandIssuer issuer, World world) {
47-
Path worldPath = world.getWorldFolder().toPath();
48-
File playerDataPath = worldPath.resolve("playerdata").toFile();
49-
if (!playerDataPath.isDirectory()) {
50-
issuer.sendMessage("World's playerdata folder does not exist: " + world.getName());
51-
return;
52-
}
53-
54-
List<CompletableFuture<Void>> playerDataFutures = new ArrayList<>();
55-
File[] files = playerDataPath.listFiles();
56-
if (files == null) {
57-
issuer.sendMessage("No player data files found in the world's playerdata folder: " + world.getName());
58-
return;
59-
}
60-
61-
for (File playerDataFile : files) {
62-
if (!Files.getFileExtension(playerDataFile.getName()).equals("dat")) {
63-
continue;
64-
}
65-
UUID playerUUID = UUID.fromString(Files.getNameWithoutExtension(playerDataFile.getName()));
66-
playerDataExtractor.extract(playerDataFile.toPath())
67-
.onSuccess(profileData -> playerDataFutures.add(profileDataSource
68-
.getGlobalProfile(GlobalProfileKey.of(playerUUID))
69-
.thenCompose(profileDataSource::updateGlobalProfile)
70-
.thenCompose(ignore -> profileDataSource.getPlayerProfile(
71-
ProfileKey.of(ContainerType.WORLD, world.getName(), ProfileTypes.getDefault(), playerUUID)))
72-
.thenCompose(playerProfile -> {
73-
playerProfile.update(profileData);
74-
return profileDataSource.updatePlayerProfile(playerProfile);
75-
})));
76-
}
77-
CompletableFuture.allOf(playerDataFutures.toArray(new CompletableFuture[0]))
78-
.thenRun(() -> issuer.sendMessage("Successfully imported all player data from " + world.getName() + "."));
21+
issuer.sendError("Please install Multiverse-InventoriesImporter plugin to use this command.");
22+
issuer.sendInfo("Download Link: https://modrinth.com/project/multiverse-inventoriesimporter/");
23+
issuer.sendInfo("Learn More: https://mvplugins.org/inventories/how-to/import-playerdata/");
7924
}
8025
}

src/main/java/org/mvplugins/multiverse/inventories/commands/ToggleCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.mvplugins.multiverse.core.command.MVCommandIssuer;
55
import org.mvplugins.multiverse.inventories.config.InventoriesConfig;
66
import org.mvplugins.multiverse.inventories.share.Sharable;
7+
import org.mvplugins.multiverse.inventories.share.Sharables;
78
import org.mvplugins.multiverse.inventories.share.Shares;
89
import org.mvplugins.multiverse.core.command.MVCommandManager;
910
import org.mvplugins.multiverse.external.acf.commands.annotation.CommandAlias;
@@ -54,6 +55,13 @@ void onToggleCommand(
5455
} else {
5556
optionalShares.add(sharable);
5657
issuer.sendInfo(MVInvi18n.TOGGLE_NOWUSINGOPTIONAL, replace("{share}").with(sharable.getNames()[0]));
58+
59+
// special tip to our wiki page, hopefully this reduces the number of people asking the
60+
// same old questions about last location config options on discord.
61+
if (sharable == Sharables.LAST_LOCATION) {
62+
issuer.sendInfo("For more information on configuring last location, please see: " +
63+
"https://mvplugins.org/inventories/how-to/configure-last-location/");
64+
}
5765
}
5866
inventoriesConfig.setActiveOptionalShares(optionalShares);
5967
inventoriesConfig.save();

src/main/java/org/mvplugins/multiverse/inventories/config/InventoriesConfig.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,14 @@ public Try<Void> setActiveOptionalShares(Shares shares) {
144144
return this.configHandle.set(configNodes.activeOptionalShares, shares);
145145
}
146146

147+
@Deprecated(since = "5.3", forRemoval = true)
147148
public boolean getUseImprovedRespawnLocationDetection() {
148-
return this.configHandle.get(configNodes.useImprovedRespawnLocationDetection);
149+
return true;
149150
}
150151

152+
@Deprecated(since = "5.3", forRemoval = true)
151153
public Try<Void> setUseImprovedRespawnLocationDetection(boolean useImprovedRespawnLocationDetection) {
152-
return this.configHandle.set(configNodes.useImprovedRespawnLocationDetection, useImprovedRespawnLocationDetection);
154+
return Try.failure(new IllegalStateException("this config option has been removed"));
153155
}
154156

155157
@ApiStatus.AvailableSince("5.2")

src/main/java/org/mvplugins/multiverse/inventories/config/InventoriesConfigNodes.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,7 @@ public Object serialize(Shares sharables, Class<Shares> aClass) {
113113
.comment("")
114114
.build());
115115

116-
final ConfigNode<Boolean> useImprovedRespawnLocationDetection = node(ConfigNode.builder("sharables.use-improved-respawn-location-detection", Boolean.class)
117-
.comment("When enabled, we will use 1.21's PlayerSpawnChangeEvent to better detect bed and anchor respawn locations.")
118-
.comment("This options is not applicable for older minecraft server versions.")
119-
.defaultValue(true)
120-
.name("use-improved-respawn-location-detection")
121-
.build());
122-
123116
final ConfigNode<Boolean> validateBedAnchorRespawnLocation = node(ConfigNode.builder("sharables.validate-bed-anchor-respawn-location", Boolean.class)
124-
.comment("")
125117
.comment("When enabled, we will validate the bed/anchor respawn location on group/world change.")
126118
.comment("The validation checks if the bed/anchor block still exists at the saved location and is usable.")
127119
.comment("When the validation fails, the respawn location will be cleared and default world spawn will be used instead.")

src/main/java/org/mvplugins/multiverse/inventories/dataimport/multiinv/MIInventoryConverter.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/main/java/org/mvplugins/multiverse/inventories/dataimport/multiinv/MIInventoryInterface.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/java/org/mvplugins/multiverse/inventories/dataimport/multiinv/MIInventoryOldWrapper.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)