mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Optimizations and javadoc tweaks
This commit is contained in:
parent
465f7f4504
commit
cc2d99849b
@ -302,7 +302,7 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Get the settings for a world.
|
* Get the settings for a world.
|
||||||
*
|
*
|
||||||
* @param world The world
|
* @param world the world to retrieve settings from
|
||||||
*
|
*
|
||||||
* @return The {@link PlotArea} for the world or null if not in plotworld
|
* @return The {@link PlotArea} for the world or null if not in plotworld
|
||||||
*
|
*
|
||||||
@ -329,8 +329,8 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Send a message to a player.
|
* Send a message to a player.
|
||||||
*
|
*
|
||||||
* @param player Player that will receive the message
|
* @param player the recipient of the message
|
||||||
* @param caption Caption
|
* @param caption the message
|
||||||
*
|
*
|
||||||
* @see MainUtil#sendMessage(PlotPlayer, C, String...)
|
* @see MainUtil#sendMessage(PlotPlayer, C, String...)
|
||||||
*/
|
*/
|
||||||
@ -339,10 +339,10 @@ public class PlotAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to a player. Supports color codes.
|
* Send a message to a player. The message supports color codes.
|
||||||
*
|
*
|
||||||
* @param player Player that will receive the message
|
* @param player the recipient of the message
|
||||||
* @param string The message
|
* @param string the message
|
||||||
*
|
*
|
||||||
* @see MainUtil#sendMessage(PlotPlayer, String)
|
* @see MainUtil#sendMessage(PlotPlayer, String)
|
||||||
*/
|
*/
|
||||||
@ -351,9 +351,9 @@ public class PlotAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to the console. Supports color codes.
|
* Send a message to the console. The message supports color codes.
|
||||||
*
|
*
|
||||||
* @param message Message that should be sent to the console
|
* @param message the message
|
||||||
*
|
*
|
||||||
* @see MainUtil#sendConsoleMessage(C, String...)
|
* @see MainUtil#sendConsoleMessage(C, String...)
|
||||||
*/
|
*/
|
||||||
@ -364,7 +364,7 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Send a message to the console.
|
* Send a message to the console.
|
||||||
*
|
*
|
||||||
* @param caption The caption
|
* @param caption the message
|
||||||
*
|
*
|
||||||
* @see #sendConsoleMessage(String)
|
* @see #sendConsoleMessage(String)
|
||||||
* @see C
|
* @see C
|
||||||
@ -376,7 +376,7 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Register a flag for use in plots.
|
* Register a flag for use in plots.
|
||||||
*
|
*
|
||||||
* @param flag Flag that should be registered
|
* @param flag the flag being registered
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addFlag(Flag<?> flag) {
|
public void addFlag(Flag<?> flag) {
|
||||||
@ -386,7 +386,7 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Get a plot based on the ID.
|
* Get a plot based on the ID.
|
||||||
*
|
*
|
||||||
* @param world World in which the plot is located
|
* @param world the world the plot is located in
|
||||||
* @param x The PlotID x coordinate
|
* @param x The PlotID x coordinate
|
||||||
* @param z The PlotID y coordinate
|
* @param z The PlotID y coordinate
|
||||||
*
|
*
|
||||||
@ -409,7 +409,7 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Get a plot based on the location.
|
* Get a plot based on the location.
|
||||||
*
|
*
|
||||||
* @param location The location to retrieve the plot from
|
* @param location the location to check
|
||||||
*
|
*
|
||||||
* @return plot if found, otherwise it creates a temporary plot
|
* @return plot if found, otherwise it creates a temporary plot
|
||||||
*
|
*
|
||||||
@ -425,7 +425,7 @@ public class PlotAPI {
|
|||||||
/**
|
/**
|
||||||
* Get a plot based on the player location.
|
* Get a plot based on the player location.
|
||||||
*
|
*
|
||||||
* @param player Get the current plot for the player location
|
* @param player the player to check
|
||||||
*
|
*
|
||||||
* @return plot if found, otherwise it creates a temporary plot
|
* @return plot if found, otherwise it creates a temporary plot
|
||||||
*
|
*
|
||||||
|
@ -664,9 +664,8 @@ public class PS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Entry<PlotId, Plot> entry : plots.entrySet()) {
|
for (Plot entry : plots.values()) {
|
||||||
Plot plot = entry.getValue();
|
entry.setArea(plotArea);
|
||||||
plot.setArea(plotArea);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set<PlotCluster> clusters = this.clusters_tmp.remove(plotArea.toString());
|
Set<PlotCluster> clusters = this.clusters_tmp.remove(plotArea.toString());
|
||||||
@ -821,8 +820,7 @@ public class PS {
|
|||||||
}
|
}
|
||||||
map.putAll(entry.getValue());
|
map.putAll(entry.getValue());
|
||||||
} else {
|
} else {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Plot plot : entry.getValue().values()) {
|
||||||
Plot plot = entry2.getValue();
|
|
||||||
plot.setArea(area);
|
plot.setArea(area);
|
||||||
area.addPlot(plot);
|
area.addPlot(plot);
|
||||||
}
|
}
|
||||||
@ -2081,7 +2079,7 @@ public class PS {
|
|||||||
* - Translation: PlotSquared.use_THIS.yml, style.yml<br>
|
* - Translation: PlotSquared.use_THIS.yml, style.yml<br>
|
||||||
*/
|
*/
|
||||||
public void setupConfigs() {
|
public void setupConfigs() {
|
||||||
File folder = new File(this.IMP.getDirectory() + File.separator + "config");
|
File folder = new File(this.IMP.getDirectory(),"config");
|
||||||
if (!folder.exists() && !folder.mkdirs()) {
|
if (!folder.exists() && !folder.mkdirs()) {
|
||||||
PS.log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually.");
|
PS.log(C.PREFIX + "&cFailed to create the /plugins/config folder. Please create it manually.");
|
||||||
}
|
}
|
||||||
@ -2102,36 +2100,30 @@ public class PS {
|
|||||||
PS.log("failed to save style.yml");
|
PS.log("failed to save style.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.configFile = new File(this.IMP.getDirectory() + File.separator + "config" + File.separator + "settings.yml");
|
this.configFile = new File(folder,"settings.yml");
|
||||||
if (!this.configFile.exists()) {
|
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
||||||
if (!this.configFile.createNewFile()) {
|
|
||||||
PS.log("Could not create the settings file, please create \"settings.yml\" manually.");
|
PS.log("Could not create the settings file, please create \"settings.yml\" manually.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
||||||
setupConfig();
|
setupConfig();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.log("Failed to save settings.yml");
|
PS.log("Failed to save settings.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.storageFile = new File(this.IMP.getDirectory() + File.separator + "config" + File.separator + "storage.yml");
|
this.storageFile = new File(folder,"storage.yml");
|
||||||
if (!this.storageFile.exists()) {
|
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
||||||
if (!this.storageFile.createNewFile()) {
|
|
||||||
PS.log("Could not the storage settings file, please create \"storage.yml\" manually.");
|
PS.log("Could not the storage settings file, please create \"storage.yml\" manually.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
|
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
|
||||||
setupStorage();
|
setupStorage();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
PS.log("Failed to save storage.yml");
|
PS.log("Failed to save storage.yml");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.commandsFile = new File(this.IMP.getDirectory() + File.separator + "config" + File.separator + "commands.yml");
|
this.commandsFile = new File(folder,"commands.yml");
|
||||||
if (!this.commandsFile.exists()) {
|
if (!this.commandsFile.exists() && !this.commandsFile.createNewFile()) {
|
||||||
if (!this.commandsFile.createNewFile()) {
|
|
||||||
PS.log("Could not the storage settings file, please create \"commands.yml\" manually.");
|
PS.log("Could not the storage settings file, please create \"commands.yml\" manually.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
|
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
|
||||||
setupStorage();
|
setupStorage();
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
@ -2245,9 +2237,9 @@ public class PS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.plots_tmp != null) {
|
if (this.plots_tmp != null) {
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : this.plots_tmp.entrySet()) {
|
for (HashMap<PlotId, Plot> entry : this.plots_tmp.values()) {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Plot entry2 : entry.values()) {
|
||||||
runnable.run(entry2.getValue());
|
runnable.run(entry2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2298,8 +2290,8 @@ public class PS {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public Set<String> getPlotWorldStrings() {
|
public Set<String> getPlotWorldStrings() {
|
||||||
HashSet<String> set = new HashSet<>(this.plotAreaMap.size());
|
HashSet<String> set = new HashSet<>(this.plotAreaMap.size());
|
||||||
for (Entry<String, PlotArea[]> entry : this.plotAreaMap.entrySet()) {
|
for (String entry : this.plotAreaMap.keySet()) {
|
||||||
set.add(entry.getKey());
|
set.add(entry);
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ import org.slf4j.Logger;
|
|||||||
import org.spongepowered.api.Game;
|
import org.spongepowered.api.Game;
|
||||||
import org.spongepowered.api.Server;
|
import org.spongepowered.api.Server;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
|
import org.spongepowered.api.config.ConfigDir;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
import org.spongepowered.api.event.Listener;
|
import org.spongepowered.api.event.Listener;
|
||||||
import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent;
|
import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent;
|
||||||
@ -71,6 +72,7 @@ import org.spongepowered.api.world.gen.WorldGenerator;
|
|||||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -91,8 +93,13 @@ public class SpongeMain implements IPlotMain {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Game game;
|
private Game game;
|
||||||
|
|
||||||
private Server server;
|
private Server server;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@ConfigDir(sharedRoot = false)
|
||||||
|
private Path privateConfigDir;
|
||||||
|
|
||||||
private GameProfileManager resolver;
|
private GameProfileManager resolver;
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
@ -153,7 +160,7 @@ public class SpongeMain implements IPlotMain {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getDirectory() {
|
public File getDirectory() {
|
||||||
return new File("mods/PlotSquared");
|
return privateConfigDir.toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user