Pick up the rest of the reformating

This commit is contained in:
dordsor21 2020-04-30 11:53:07 +01:00
parent 5e842f1572
commit cbe46539ca
6 changed files with 44 additions and 35 deletions

View File

@ -28,18 +28,18 @@ package com.plotsquared.core;
import com.plotsquared.core.generator.GeneratorWrapper; import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.generator.HybridUtils; import com.plotsquared.core.generator.HybridUtils;
import com.plotsquared.core.generator.IndependentPlotGenerator; import com.plotsquared.core.generator.IndependentPlotGenerator;
import com.plotsquared.core.util.logger.ILogger;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.queue.QueueProvider;
import com.plotsquared.core.util.ChatManager; import com.plotsquared.core.util.ChatManager;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.InventoryUtil; import com.plotsquared.core.util.InventoryUtil;
import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.SetupUtils; import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.logger.ILogger;
import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.uuid.UUIDHandlerImplementation; import com.plotsquared.core.util.uuid.UUIDHandlerImplementation;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.queue.QueueProvider;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -29,11 +29,11 @@ import com.plotsquared.core.command.WE_Anywhere;
import com.plotsquared.core.configuration.Caption; import com.plotsquared.core.configuration.Caption;
import com.plotsquared.core.configuration.CaptionUtility; import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions; import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil; import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.MemorySection;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.Storage; import com.plotsquared.core.configuration.Storage;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.MemorySection;
import com.plotsquared.core.configuration.file.YamlConfiguration; import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.configuration.serialization.ConfigurationSerialization; import com.plotsquared.core.configuration.serialization.ConfigurationSerialization;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
@ -130,7 +130,8 @@ import java.util.zip.ZipInputStream;
/** /**
* An implementation of the core, with a static getter for easy access. * An implementation of the core, with a static getter for easy access.
*/ */
@SuppressWarnings({"unused", "WeakerAccess"}) public class PlotSquared { @SuppressWarnings({"unused", "WeakerAccess"})
public class PlotSquared {
private static final Set<Plot> EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet()); private static final Set<Plot> EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet());
private static PlotSquared instance; private static PlotSquared instance;
// Implementation // Implementation
@ -360,7 +361,8 @@ import java.util.zip.ZipInputStream;
} }
PlotSquared.log(Captions.PREFIX + CaptionUtility PlotSquared.log(Captions.PREFIX + CaptionUtility
.format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(), IMP.getPluginName())); .format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(),
IMP.getPluginName()));
} }
/** /**
@ -518,8 +520,9 @@ import java.util.zip.ZipInputStream;
Set<PlotCluster> clusters; Set<PlotCluster> clusters;
if (clusters_tmp == null || (clusters = clusters_tmp.remove(plotArea.toString())) == null) { if (clusters_tmp == null || (clusters = clusters_tmp.remove(plotArea.toString())) == null) {
if (plotArea.getType() == PlotAreaType.PARTIAL) { if (plotArea.getType() == PlotAreaType.PARTIAL) {
clusters = clusters = this.clusters_tmp != null ?
this.clusters_tmp != null ? this.clusters_tmp.get(plotArea.getWorldName()) : null; this.clusters_tmp.get(plotArea.getWorldName()) :
null;
if (clusters != null) { if (clusters != null) {
Iterator<PlotCluster> iterator = clusters.iterator(); Iterator<PlotCluster> iterator = clusters.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -542,8 +545,8 @@ import java.util.zip.ZipInputStream;
return; return;
} }
File file = new File( File file = new File(
this.IMP.getDirectory() + File.separator + "persistent_regen_data_" + plotArea.getId() + "_" this.IMP.getDirectory() + File.separator + "persistent_regen_data_" + plotArea.getId()
+ plotArea.getWorldName()); + "_" + plotArea.getWorldName());
if (!file.exists()) { if (!file.exists()) {
return; return;
} }
@ -1301,7 +1304,8 @@ import java.util.zip.ZipInputStream;
} }
if (type == PlotAreaType.AUGMENTED) { if (type == PlotAreaType.AUGMENTED) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Invalid type for multi-area world. Expected `PARTIAL`, got `" + PlotAreaType.AUGMENTED + "`"); "Invalid type for multi-area world. Expected `PARTIAL`, got `"
+ PlotAreaType.AUGMENTED + "`");
} }
for (String areaId : areasSection.getKeys(false)) { for (String areaId : areasSection.getKeys(false)) {
PlotSquared.log(Captions.PREFIX + " - " + areaId); PlotSquared.log(Captions.PREFIX + " - " + areaId);
@ -1523,7 +1527,7 @@ import java.util.zip.ZipInputStream;
/** /**
* Copies a file from inside the jar to a location * Copies a file from inside the jar to a location
* *
* @param file Name of the file inside PlotSquared.jar * @param file Name of the file inside PlotSquared.jar
* @param folder The output location relative to /plugins/PlotSquared/ * @param folder The output location relative to /plugins/PlotSquared/
*/ */
public void copyFile(String file, String folder) { public void copyFile(String file, String folder) {
@ -1636,8 +1640,9 @@ import java.util.zip.ZipInputStream;
list.add(regions); list.add(regions);
list.add(chunks); list.add(chunks);
list.add(HybridUtils.height); list.add(HybridUtils.height);
File file = new File(this.IMP.getDirectory() + File.separator + "persistent_regen_data_" File file = new File(
+ HybridUtils.area.getId() + "_" + HybridUtils.area.getWorldName()); this.IMP.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
.getId() + "_" + HybridUtils.area.getWorldName());
if (file.exists() && !file.delete()) { if (file.exists() && !file.delete()) {
PlotSquared.log(Captions.PREFIX PlotSquared.log(Captions.PREFIX
+ "persistent_regen_data file already exists and could not be deleted."); + "persistent_regen_data file already exists and could not be deleted.");
@ -1712,13 +1717,13 @@ import java.util.zip.ZipInputStream;
String lastVersionString = this.getConfig().getString("version"); String lastVersionString = this.getConfig().getString("version");
if (lastVersionString != null) { if (lastVersionString != null) {
String[] split = lastVersionString.split("\\."); String[] split = lastVersionString.split("\\.");
int[] lastVersion = new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1]), int[] lastVersion = new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1]),
Integer.parseInt(split[2])}; Integer.parseInt(split[2])};
if (checkVersion(new int[]{3, 4, 0}, lastVersion)) { if (checkVersion(new int[] {3, 4, 0}, lastVersion)) {
Settings.convertLegacy(configFile); Settings.convertLegacy(configFile);
if (getConfig().contains("worlds")) { if (getConfig().contains("worlds")) {
ConfigurationSection worldSection = ConfigurationSection worldSection =
getConfig().getConfigurationSection("worlds"); getConfig().getConfigurationSection("worlds");
worlds.set("worlds", worldSection); worlds.set("worlds", worldSection);
try { try {
worlds.save(worldsFile); worlds.save(worldsFile);
@ -1768,10 +1773,10 @@ import java.util.zip.ZipInputStream;
this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile); this.worlds = YamlConfiguration.loadConfiguration(this.worldsFile);
if (this.worlds.contains("worlds")) { if (this.worlds.contains("worlds")) {
if (!this.worlds.contains("configuration_version") || if (!this.worlds.contains("configuration_version") || (
(!this.worlds.getString("configuration_version").equalsIgnoreCase( !this.worlds.getString("configuration_version")
LegacyConverter.CONFIGURATION_VERSION) && .equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worlds
!this.worlds.getString("configuration_version").equalsIgnoreCase("v5"))) { .getString("configuration_version").equalsIgnoreCase("v5"))) {
// Conversion needed // Conversion needed
log(Captions.LEGACY_CONFIG_FOUND.getTranslated()); log(Captions.LEGACY_CONFIG_FOUND.getTranslated());
try { try {
@ -1860,7 +1865,8 @@ import java.util.zip.ZipInputStream;
} }
public String getConfigurationVersion() { public String getConfigurationVersion() {
return this.worlds.get("configuration_version", LegacyConverter.CONFIGURATION_VERSION).toString(); return this.worlds.get("configuration_version", LegacyConverter.CONFIGURATION_VERSION)
.toString();
} }
public void setConfigurationVersion(final String newVersion) throws IOException { public void setConfigurationVersion(final String newVersion) throws IOException {

View File

@ -75,8 +75,7 @@ public class PlotVersion {
} }
} }
@Override @Override public String toString() {
public String toString() {
if (hash == 0 && versionString == null) { if (hash == 0 && versionString == null) {
return "PlotSquared-NoVer-SNAPSHOT"; return "PlotSquared-NoVer-SNAPSHOT";
} else { } else {

View File

@ -25,13 +25,13 @@
*/ */
package com.plotsquared.core.database; package com.plotsquared.core.database;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotCluster; import com.plotsquared.core.plot.PlotCluster;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.plot.comment.PlotComment; import com.plotsquared.core.plot.comment.PlotComment;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.util.task.RunnableVal;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashMap; import java.util.HashMap;
@ -191,7 +191,8 @@ public class AbstractDBTest implements AbstractDB {
@Override public void setComment(Plot plot, PlotComment comment) { @Override public void setComment(Plot plot, PlotComment comment) {
} }
@Override public void getComments(@NotNull Plot plot, String inbox, @Override
public void getComments(@NotNull Plot plot, String inbox,
RunnableVal<List<PlotComment>> whenDone) { RunnableVal<List<PlotComment>> whenDone) {
} }

View File

@ -44,14 +44,14 @@ import com.plotsquared.core.events.PlotFlagRemoveEvent;
import com.plotsquared.core.events.PlotMergeEvent; import com.plotsquared.core.events.PlotMergeEvent;
import com.plotsquared.core.events.PlotRateEvent; import com.plotsquared.core.events.PlotRateEvent;
import com.plotsquared.core.events.PlotUnlinkEvent; import com.plotsquared.core.events.PlotUnlinkEvent;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.location.Direction; import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotId; import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.plot.Rating; import com.plotsquared.core.plot.Rating;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.EventDispatcher;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
@ -110,7 +110,8 @@ public class EventDispatcherTest extends EventDispatcher {
return null; return null;
} }
@Override public PlotUnlinkEvent callUnlink(PlotArea area, Plot plot, boolean createRoad, @Override
public PlotUnlinkEvent callUnlink(PlotArea area, Plot plot, boolean createRoad,
boolean createSign, PlotUnlinkEvent.REASON reason) { boolean createSign, PlotUnlinkEvent.REASON reason) {
return null; return null;
} }
@ -123,7 +124,8 @@ public class EventDispatcherTest extends EventDispatcher {
return null; return null;
} }
@Override public PlayerPlotDeniedEvent callDenied(PlotPlayer initiator, Plot plot, UUID player, @Override
public PlayerPlotDeniedEvent callDenied(PlotPlayer initiator, Plot plot, UUID player,
boolean added) { boolean added) {
return null; return null;
} }
@ -134,7 +136,8 @@ public class EventDispatcherTest extends EventDispatcher {
return null; return null;
} }
@Override public PlayerPlotHelperEvent callMember(PlotPlayer initiator, Plot plot, UUID player, @Override
public PlayerPlotHelperEvent callMember(PlotPlayer initiator, Plot plot, UUID player,
boolean added) { boolean added) {
return null; return null;
} }

View File

@ -27,8 +27,8 @@ package com.plotsquared.core.plot.util;
import com.plotsquared.core.database.AbstractDBTest; import com.plotsquared.core.database.AbstractDBTest;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.util.uuid.UUIDHandlerImplementation;
import com.plotsquared.core.util.task.RunnableVal; import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.uuid.UUIDHandlerImplementation;
import com.plotsquared.core.util.uuid.UUIDWrapper; import com.plotsquared.core.util.uuid.UUIDWrapper;
import org.junit.Before; import org.junit.Before;