9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-29 11:49:08 +00:00

Add OfflinePlayer support for clearing discoveries

This commit is contained in:
SamB440
2020-06-26 19:48:33 +01:00
parent 863086a825
commit 38972f6361
3 changed files with 6 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ repositories {
url = 'http://repo.extendedclip.com/content/repositories/placeholderapi/'
}
// languagy, repo only accessible on request
// languagy
maven {
url = 'https://campfire.islandearth.net/maven/'
}

View File

@@ -14,6 +14,7 @@ import net.islandearth.rpgregions.utils.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -185,10 +186,10 @@ public class RPGRegionsCommand extends BaseCommand {
@CommandPermission("rpgregions.reset")
@CommandCompletion("@players @regions")
public void onReset(CommandSender sender, String[] args) {
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
switch (args.length) {
case 1: {
Player player = Bukkit.getPlayer(args[0]);
if (player != null) {
if (player.hasPlayedBefore()) {
plugin.getManagers().getStorageManager().clearDiscoveries(player.getUniqueId());
sender.sendMessage(ChatColor.GREEN + "Players discoveries has been cleared.");
} else {
@@ -198,8 +199,7 @@ public class RPGRegionsCommand extends BaseCommand {
}
case 2: {
Player player = Bukkit.getPlayer(args[0]);
if (player != null) {
if (player.hasPlayedBefore()) {
String regionId = args[1];
if (plugin.getManagers().getRegionsCache().getConfiguredRegions().containsKey(regionId)) {
plugin.getManagers().getStorageManager().clearDiscovery(player.getUniqueId(), regionId);

View File

@@ -101,7 +101,7 @@ public class SqlStorage implements StorageManager {
t.printStackTrace();
return null;
});
DB.executeUpdateAsync(DELETE_DISCOVERY, getDatabaseUuid(uuid), regionId);
}