Fix issues from previous merge

This commit is contained in:
Alexander Söderberg 2020-07-14 13:21:59 +02:00
parent 33f2ff7e6d
commit 1dc4da8beb
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
4 changed files with 12 additions and 17 deletions

View File

@ -933,7 +933,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
return perm; return perm;
} }
} catch (Throwable ignored) { } catch (Throwable ignored) {
PlotSquared.debug("No permissions detected!");
} }
return null; return null;
} }

View File

@ -26,14 +26,15 @@
package com.plotsquared.bukkit.uuid; package com.plotsquared.bukkit.uuid;
import com.google.common.util.concurrent.RateLimiter; import com.google.common.util.concurrent.RateLimiter;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.uuid.UUIDMapping; import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService; import com.plotsquared.core.uuid.UUIDService;
import com.sk89q.squirrelid.Profile; import com.sk89q.squirrelid.Profile;
import com.sk89q.squirrelid.resolver.HttpRepositoryService; import com.sk89q.squirrelid.resolver.HttpRepositoryService;
import com.sk89q.squirrelid.resolver.ProfileService; import com.sk89q.squirrelid.resolver.ProfileService;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -47,6 +48,8 @@ import java.util.UUID;
@SuppressWarnings("UnstableApiUsage") @SuppressWarnings("UnstableApiUsage")
public class SquirrelIdUUIDService implements UUIDService { public class SquirrelIdUUIDService implements UUIDService {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquirrelIdUUIDService.class.getSimpleName());
private final ProfileService profileService; private final ProfileService profileService;
private final RateLimiter rateLimiter; private final RateLimiter rateLimiter;
@ -78,7 +81,9 @@ public class SquirrelIdUUIDService implements UUIDService {
// go through them one by one // go through them one by one
// //
if (uuids.size() >= 2) { if (uuids.size() >= 2) {
PlotSquared.debug(Captions.PREFIX + "(UUID) Found invalid UUID in batch. Will try each UUID individually."); if (Settings.DEBUG) {
logger.info("[P2] (UUID) Found invalid UUID in batch. Will try each UUID individually.");
}
for (final UUID uuid : uuids) { for (final UUID uuid : uuids) {
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid)); final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
if (result.isEmpty()) { if (result.isEmpty()) {
@ -86,8 +91,8 @@ public class SquirrelIdUUIDService implements UUIDService {
} }
results.add(result.get(0)); results.add(result.get(0));
} }
} else if (uuids.size() == 1) { } else if (uuids.size() == 1 && Settings.DEBUG) {
PlotSquared.debug(Captions.PREFIX + "(UUID) Found invalid UUID: " + uuids.get(0)); logger.info("[P2] (UUID) Found invalid UUID: {}", uuids.get(0));
} }
} }
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {

View File

@ -1716,18 +1716,8 @@ public class PlotSquared {
} catch (IOException ignored) { } catch (IOException ignored) {
logger.error("[P2] Failed to save storage.yml"); logger.error("[P2] Failed to save storage.yml");
} }
try {
this.commandsFile = new File(folder, "commands.yml");
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
logger.error("[P2] Could not create the commands file. Please create 'commands.yml' manually");
}
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
} catch (IOException ignored) {
logger.error("[P2] Failed to save commands.yml");
}
try { try {
this.style.save(this.styleFile); this.style.save(this.styleFile);
this.commands.save(this.commandsFile);
} catch (IOException e) { } catch (IOException e) {
logger.error("[P2] Configuration file saving failed", e); logger.error("[P2] Configuration file saving failed", e);
} }

View File

@ -408,7 +408,8 @@ public abstract class PlotArea {
prefix = ", "; prefix = ", ";
} }
} }
PlotSquared.log(Captions.PREFIX + "&3 - road flags: &7" + roadFlagBuilder.toString());
logger.info("[P2] - road flags: {}", roadFlagBuilder.toString());
loadConfiguration(config); loadConfiguration(config);
} }