mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-27 10:49:08 +00:00
Fix deprecation warnings
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package net.islandearth.rpgregions.managers.data;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.islandearth.rpgregions.managers.data.region.ConfiguredRegion;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -14,12 +14,9 @@ public interface IRPGRegionsCache {
|
||||
|
||||
void removeConfiguredRegion(String id);
|
||||
|
||||
/**
|
||||
* @deprecated Subject to removal, as direct access should not be used.
|
||||
* @return {@link Map} of region names and the {@link ConfiguredRegion} pair.
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String, ConfiguredRegion> getConfiguredRegions();
|
||||
ImmutableMap<String, ConfiguredRegion> getConfiguredRegions();
|
||||
|
||||
void clear();
|
||||
|
||||
CompletableFuture<Boolean> saveAll(boolean async);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class RPGRegionsCommand extends BaseCommand {
|
||||
sender.sendMessage(ChatColor.GREEN + "Reloading region files...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
File folder = new File(plugin.getDataFolder() + "/regions/");
|
||||
plugin.getManagers().getRegionsCache().getConfiguredRegions().clear();
|
||||
plugin.getManagers().getRegionsCache().clear();
|
||||
|
||||
for (File file : folder.listFiles()) {
|
||||
// Exclude non-json files
|
||||
@@ -195,6 +195,7 @@ public class RPGRegionsCommand extends BaseCommand {
|
||||
@CommandPermission("rpgregions.reset")
|
||||
@CommandCompletion("@players @regions")
|
||||
public void onReset(CommandSender sender, String[] args) {
|
||||
@SuppressWarnings({"deprecation"}) // We know what we're doing.
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
if (!player.hasPlayedBefore()) {
|
||||
sender.sendMessage(ChatColor.RED + "That player cannot be found.");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.islandearth.rpgregions.managers.data;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.islandearth.rpgregions.RPGRegions;
|
||||
import net.islandearth.rpgregions.managers.data.region.ConfiguredRegion;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -34,8 +35,13 @@ public class RPGRegionsCache implements IRPGRegionsCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ConfiguredRegion> getConfiguredRegions() {
|
||||
return configuredRegions;
|
||||
public ImmutableMap<String, ConfiguredRegion> getConfiguredRegions() {
|
||||
return ImmutableMap.copyOf(configuredRegions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
configuredRegions.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user