mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Merge branch 'v6' into features/v6/services
This commit is contained in:
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core;
|
||||
|
||||
@ -86,11 +86,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
||||
|
||||
/**
|
||||
* Gets the version of Minecraft that is running.
|
||||
* @return server version as array of numbers
|
||||
*/
|
||||
int[] getServerVersion();
|
||||
|
||||
/**
|
||||
* Gets the server implementation name and version
|
||||
* @return server implementationa and version as string
|
||||
*/
|
||||
String getServerImplementation();
|
||||
|
||||
@ -254,6 +256,11 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
||||
*/
|
||||
@Nonnull Audience getConsoleAudience();
|
||||
|
||||
/**
|
||||
* Load the caption maps
|
||||
*/
|
||||
void copyCaptionMaps();
|
||||
|
||||
/**
|
||||
* Get the {@link PermissionHandler} implementation for the platform
|
||||
*
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core;
|
||||
|
||||
@ -90,7 +90,6 @@ import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayDeque;
|
||||
@ -141,7 +140,7 @@ public class PlotSquared {
|
||||
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
|
||||
private YamlConfiguration config;
|
||||
// Localization
|
||||
private Map<String, CaptionMap> captionMaps;
|
||||
private final Map<String, CaptionMap> captionMaps = new HashMap<>();
|
||||
// Platform / Version / Update URL
|
||||
private PlotVersion version;
|
||||
// Files and configuration
|
||||
@ -174,6 +173,13 @@ public class PlotSquared {
|
||||
//
|
||||
ConfigurationSerialization.registerClass(BlockBucket.class, "BlockBucket");
|
||||
|
||||
// Load caption map
|
||||
try {
|
||||
this.loadCaptionMap();
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to load caption map", e);
|
||||
}
|
||||
|
||||
// Setup the global flag container
|
||||
GlobalFlagContainer.setup();
|
||||
|
||||
@ -197,8 +203,6 @@ public class PlotSquared {
|
||||
return;
|
||||
}
|
||||
|
||||
this.captionMaps = new HashMap<>();
|
||||
|
||||
this.worldedit = WorldEdit.getInstance();
|
||||
|
||||
// Create Event utility class
|
||||
@ -224,16 +228,19 @@ public class PlotSquared {
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCaptionMap() throws IOException {
|
||||
public void loadCaptionMap() throws Exception {
|
||||
this.platform.copyCaptionMaps();
|
||||
// Setup localization
|
||||
CaptionMap captionMap;
|
||||
if (Settings.Enabled_Components.PER_USER_LOCALE) {
|
||||
captionMap = CaptionLoader.loadAll(Paths.get("lang"));
|
||||
captionMap = CaptionLoader.loadAll(new File(this.platform.getDirectory(), "lang").toPath());
|
||||
} else {
|
||||
String fileName = "messages_" + Settings.Enabled_Components.DEFAULT_LOCALE + ".json";
|
||||
captionMap = CaptionLoader.loadSingle(Paths.get("lang", fileName));
|
||||
captionMap = CaptionLoader.loadSingle(new File(new File(this.platform.getDirectory(), "lang"), fileName).toPath());
|
||||
}
|
||||
this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
|
||||
logger.info("Loaded caption map for namespace 'plotsquared': {}",
|
||||
this.captionMaps.get(TranslatableCaption.DEFAULT_NAMESPACE).getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -384,16 +391,16 @@ public class PlotSquared {
|
||||
regionInts.forEach(l -> regions.add(BlockVector2.at(l[0], l[1])));
|
||||
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
||||
int height = (int) list.get(2);
|
||||
logger.info("[P2] Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
|
||||
logger.info("[P2] - Regions: {}", regions.size());
|
||||
logger.info("[P2] - Chunks: {}", chunks.size());
|
||||
logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
|
||||
logger.info(" - Regions: {}", regions.size());
|
||||
logger.info(" - Chunks: {}", chunks.size());
|
||||
HybridUtils.UPDATE = true;
|
||||
PlotSquared.platform().getHybridUtils().scheduleRoadUpdate(plotArea, regions, height, chunks);
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
logger.error("[P2] Error restarting road regeneration", e);
|
||||
logger.error("Error restarting road regeneration", e);
|
||||
} finally {
|
||||
if (!file.delete()) {
|
||||
logger.error("[P2] Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId());
|
||||
logger.error("Error deleting persistent_regen_data_{}. Please delete this file manually", plotArea.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -796,10 +803,10 @@ public class PlotSquared {
|
||||
// Conventional plot generator
|
||||
PlotArea plotArea = plotGenerator.getNewPlotArea(world, null, null, null);
|
||||
PlotManager plotManager = plotArea.getPlotManager();
|
||||
logger.info("[P2] Detected world load for '{}'", world);
|
||||
logger.info("[P2] - generator: {}>{}", baseGenerator, plotGenerator);
|
||||
logger.info("[P2] - plot world: {}", plotArea.getClass().getCanonicalName());
|
||||
logger.info("[P2] - plot area manager: {}", plotManager.getClass().getCanonicalName());
|
||||
logger.info("Detected world load for '{}'", world);
|
||||
logger.info(" - generator: {}>{}", baseGenerator, plotGenerator);
|
||||
logger.info(" - plot world: {}", plotArea.getClass().getCanonicalName());
|
||||
logger.info("- plot area manager: {}", plotManager.getClass().getCanonicalName());
|
||||
if (!this.worldConfiguration.contains(path)) {
|
||||
this.worldConfiguration.createSection(path);
|
||||
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
||||
@ -823,7 +830,7 @@ public class PlotSquared {
|
||||
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
||||
return;
|
||||
}
|
||||
logger.info("[P2] Detected world load for '{}'", world);
|
||||
logger.info("Detected world load for '{}'", world);
|
||||
String gen_string = worldSection.getString("generator.plugin", platform.getPluginName());
|
||||
if (type == PlotAreaType.PARTIAL) {
|
||||
Set<PlotCluster> clusters =
|
||||
@ -839,7 +846,7 @@ public class PlotSquared {
|
||||
String fullId = name + "-" + pos1 + "-" + pos2;
|
||||
worldSection.createSection("areas." + fullId);
|
||||
DBFunc.replaceWorld(world, world + ";" + name, pos1, pos2); // NPE
|
||||
logger.info("[P2] - {}-{}-{}", name, pos1, pos2);
|
||||
logger.info(" - {}-{}-{}", name, pos1, pos2);
|
||||
GeneratorWrapper<?> areaGen = this.platform.getGenerator(world, gen_string);
|
||||
if (areaGen == null) {
|
||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||
@ -853,10 +860,10 @@ public class PlotSquared {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen);
|
||||
logger.info("[P2] | plot world: {}", pa);
|
||||
logger.info("[P2] | manager: {}", pa);
|
||||
logger.info("[P2] Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
||||
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
|
||||
logger.info(" | plot world: {}", pa);
|
||||
logger.info(" | manager: {}", pa);
|
||||
logger.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
toLoad.add(pa);
|
||||
@ -878,9 +885,9 @@ public class PlotSquared {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("[P2] - generator: {}>{}", baseGenerator, areaGen);
|
||||
logger.info("[P2] - plot world: {}", pa);
|
||||
logger.info("[P2] - plot area manager: {}", pa.getPlotManager());
|
||||
logger.info(" - generator: {}>{}", baseGenerator, areaGen);
|
||||
logger.info(" - plot world: {}", pa);
|
||||
logger.info(" - plot area manager: {}", pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -892,7 +899,7 @@ public class PlotSquared {
|
||||
+ PlotAreaType.AUGMENTED + "`");
|
||||
}
|
||||
for (String areaId : areasSection.getKeys(false)) {
|
||||
logger.info("[P2] - {}", areaId);
|
||||
logger.info(" - {}", areaId);
|
||||
String[] split = areaId.split("(?<=[^;-])-");
|
||||
if (split.length != 3) {
|
||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||
@ -954,10 +961,10 @@ public class PlotSquared {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("[P2] Detected area load for '{}'", world);
|
||||
logger.info("[P2] | generator: {}>{}", baseGenerator, areaGen);
|
||||
logger.info("[P2] | plot world: {}", pa);
|
||||
logger.info("[P2] | manager: {}", pa.getPlotManager());
|
||||
logger.info("Detected area load for '{}'", world);
|
||||
logger.info(" | generator: {}>{}", baseGenerator, areaGen);
|
||||
logger.info(" | plot world: {}", pa);
|
||||
logger.info(" | manager: {}", pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1028,7 +1035,7 @@ public class PlotSquared {
|
||||
for (String element : split) {
|
||||
String[] pair = element.split("=");
|
||||
if (pair.length != 2) {
|
||||
logger.error("[P2] No value provided for '{}'", element);
|
||||
logger.error("No value provided for '{}'", element);
|
||||
return false;
|
||||
}
|
||||
String key = pair[0].toLowerCase();
|
||||
@ -1076,11 +1083,11 @@ public class PlotSquared {
|
||||
ConfigurationUtil.BLOCK_BUCKET.parseString(value).toString());
|
||||
break;
|
||||
default:
|
||||
logger.error("[P2] Key not found: {}", element);
|
||||
logger.error("Key not found: {}", element);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("[P2] Invalid value '{}' for arg '{}'", value, element);
|
||||
logger.error("Invalid value '{}' for arg '{}'", value, element);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
@ -1148,7 +1155,7 @@ public class PlotSquared {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("[P2] Could not save {}", file);
|
||||
logger.error("Could not save {}", file);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1171,7 +1178,7 @@ public class PlotSquared {
|
||||
// Close the connection
|
||||
DBFunc.close();
|
||||
} catch (NullPointerException throwable) {
|
||||
logger.error("[P2] Could not close database connection", throwable);
|
||||
logger.error("Could not close database connection", throwable);
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1184,9 +1191,9 @@ public class PlotSquared {
|
||||
HybridUtils.regions.isEmpty() && HybridUtils.chunks.isEmpty())) {
|
||||
return;
|
||||
}
|
||||
logger.info("[P2] Road regeneration incomplete. Saving incomplete regions to disk");
|
||||
logger.info("[P2] - regions: {}", HybridUtils.regions.size());
|
||||
logger.info("[P2] - chunks: {}", HybridUtils.chunks.size());
|
||||
logger.info("Road regeneration incomplete. Saving incomplete regions to disk");
|
||||
logger.info(" - regions: {}", HybridUtils.regions.size());
|
||||
logger.info(" - chunks: {}", HybridUtils.chunks.size());
|
||||
ArrayList<int[]> regions = new ArrayList<>();
|
||||
ArrayList<int[]> chunks = new ArrayList<>();
|
||||
for (BlockVector2 r : HybridUtils.regions) {
|
||||
@ -1203,14 +1210,14 @@ public class PlotSquared {
|
||||
this.platform.getDirectory() + File.separator + "persistent_regen_data_" + HybridUtils.area
|
||||
.getId() + "_" + HybridUtils.area.getWorldName());
|
||||
if (file.exists() && !file.delete()) {
|
||||
logger.error("[P2] persistent_regene_data file already exists and could not be deleted");
|
||||
logger.error("persistent_regene_data file already exists and could not be deleted");
|
||||
return;
|
||||
}
|
||||
try (ObjectOutputStream oos = new ObjectOutputStream(
|
||||
Files.newOutputStream(file.toPath(), StandardOpenOption.CREATE_NEW))) {
|
||||
oos.writeObject(list);
|
||||
} catch (IOException e) {
|
||||
logger.error("[P2] Error creating persistent_region_data file", e);
|
||||
logger.error("Error creating persistent_region_data file", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1230,7 +1237,7 @@ public class PlotSquared {
|
||||
File file = FileUtils.getFile(platform.getDirectory(), Storage.SQLite.DB + ".db");
|
||||
database = new SQLite(file);
|
||||
} else {
|
||||
logger.error("[P2] No storage type is set. Disabling PlotSquared");
|
||||
logger.error("No storage type is set. Disabling PlotSquared");
|
||||
this.platform.shutdown(); //shutdown used instead of disable because no database is set
|
||||
return;
|
||||
}
|
||||
@ -1248,11 +1255,11 @@ public class PlotSquared {
|
||||
}
|
||||
this.clustersTmp = DBFunc.getClusters();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
logger.error("[P2] Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite");
|
||||
logger.error("[P2] ==== Here is an ugly stacktrace, if you are interested in those things ===");
|
||||
logger.error("Failed to open database connection ({}). Disabling PlotSquared", Storage.MySQL.USE ? "MySQL" : "SQLite");
|
||||
logger.error("==== Here is an ugly stacktrace, if you are interested in those things ===");
|
||||
e.printStackTrace();
|
||||
logger.error("[P2] &d==== End of stacktrace ====");
|
||||
logger.error("[P2] &6Please go to the {} 'storage.yml' and configure the database correctly",
|
||||
logger.error("==== End of stacktrace ====");
|
||||
logger.error("Please go to the {} 'storage.yml' and configure the database correctly",
|
||||
platform.getPluginName());
|
||||
this.platform.shutdown(); //shutdown used instead of disable because of database error
|
||||
}
|
||||
@ -1278,7 +1285,7 @@ public class PlotSquared {
|
||||
try {
|
||||
worldConfiguration.save(worldsFile);
|
||||
} catch (IOException e) {
|
||||
logger.error("[P2] Failed to save worlds.yml", e);
|
||||
logger.error("Failed to save worlds.yml", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1306,16 +1313,18 @@ public class PlotSquared {
|
||||
* Setup all configuration files<br>
|
||||
* - Config: settings.yml<br>
|
||||
* - Storage: storage.yml<br>
|
||||
*
|
||||
* @return success or not
|
||||
*/
|
||||
public boolean setupConfigs() {
|
||||
File folder = new File(this.platform.getDirectory(), "config");
|
||||
if (!folder.exists() && !folder.mkdirs()) {
|
||||
logger.error("[P2] Failed to create the /plugins/config folder. Please create it manually");
|
||||
logger.error("Failed to create the /plugins/PlotSquared/config folder. Please create it manually");
|
||||
}
|
||||
try {
|
||||
this.worldsFile = new File(folder, "worlds.yml");
|
||||
if (!this.worldsFile.exists() && !this.worldsFile.createNewFile()) {
|
||||
logger.error("[P2] Could not create the worlds file. Please create 'worlds.yml' manually");
|
||||
logger.error("Could not create the worlds file. Please create 'worlds.yml' manually");
|
||||
}
|
||||
this.worldConfiguration = YamlConfiguration.loadConfiguration(this.worldsFile);
|
||||
|
||||
@ -1325,20 +1334,20 @@ public class PlotSquared {
|
||||
.equalsIgnoreCase(LegacyConverter.CONFIGURATION_VERSION) && !this.worldConfiguration
|
||||
.getString("configuration_version").equalsIgnoreCase("v5"))) {
|
||||
// Conversion needed
|
||||
logger.info("[P2] &aA legacy configuration file was detected. Conversion will be attempted.");
|
||||
logger.info("A legacy configuration file was detected. Conversion will be attempted.");
|
||||
try {
|
||||
com.google.common.io.Files
|
||||
.copy(this.worldsFile, new File(folder, "worlds.yml.old"));
|
||||
logger.info("[P2] &6A copy of worlds.yml has been saved in the file worlds.yml.old");
|
||||
logger.info("A copy of worlds.yml has been saved in the file worlds.yml.old");
|
||||
final ConfigurationSection worlds =
|
||||
this.worldConfiguration.getConfigurationSection("worlds");
|
||||
final LegacyConverter converter = new LegacyConverter(worlds);
|
||||
converter.convert();
|
||||
this.worldConfiguration.set("worlds", worlds);
|
||||
this.setConfigurationVersion(LegacyConverter.CONFIGURATION_VERSION);
|
||||
logger.info("[P2] &aThe conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.");
|
||||
logger.info("The conversion has finished. PlotSquared will now be disabled and the new configuration file will be used at next startup. Please review the new worlds.yml file. Please note that schematics will not be converted, as we are now using WorldEdit to handle schematics. You need to re-generate the schematics.");
|
||||
} catch (final Exception e) {
|
||||
logger.error("[P2] &cFailed to convert the legacy configuration file. See stack trace for information.", e);
|
||||
logger.error("Failed to convert the legacy configuration file. See stack trace for information.", e);
|
||||
}
|
||||
// Disable plugin
|
||||
this.platform.shutdown();
|
||||
@ -1348,27 +1357,27 @@ public class PlotSquared {
|
||||
this.worldConfiguration.set("configuration_version", LegacyConverter.CONFIGURATION_VERSION);
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
logger.error("[P2] Failed to save worlds.yml");
|
||||
logger.error("Failed to save worlds.yml");
|
||||
}
|
||||
try {
|
||||
this.configFile = new File(folder, "settings.yml");
|
||||
if (!this.configFile.exists() && !this.configFile.createNewFile()) {
|
||||
logger.error("[P2] Could not create the settings file. Please create 'settings.yml' manually");
|
||||
logger.error("Could not create the settings file. Please create 'settings.yml' manually");
|
||||
}
|
||||
this.config = YamlConfiguration.loadConfiguration(this.configFile);
|
||||
setupConfig();
|
||||
} catch (IOException ignored) {
|
||||
logger.error("[P2] Failed to save settings.yml");
|
||||
logger.error("Failed to save settings.yml");
|
||||
}
|
||||
try {
|
||||
this.storageFile = new File(folder, "storage.yml");
|
||||
if (!this.storageFile.exists() && !this.storageFile.createNewFile()) {
|
||||
logger.error("[P2] Could not create the storage settings file. Please create 'storage.yml' manually");
|
||||
logger.error("Could not create the storage settings file. Please create 'storage.yml' manually");
|
||||
}
|
||||
YamlConfiguration.loadConfiguration(this.storageFile);
|
||||
setupStorage();
|
||||
} catch (IOException ignored) {
|
||||
logger.error("[P2] Failed to save storage.yml");
|
||||
logger.error("Failed to save storage.yml");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1399,7 +1408,7 @@ public class PlotSquared {
|
||||
if (Settings.DEBUG) {
|
||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||
for (Entry<String, Object> component : components.entrySet()) {
|
||||
logger.info("[P2] Key: {} | Value: {}", component.getKey(), component.getValue());
|
||||
logger.info("Key: {} | Value: {}", component.getKey(), component.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.collection;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.collection;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.collection;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.collection;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.collection;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.collection;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -48,7 +48,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "add",
|
||||
description = "Allow a user to build in a plot while the plot owner is online.",
|
||||
usage = "/plot add <player | *>",
|
||||
category = CommandCategory.SETTINGS,
|
||||
permission = "plots.add",
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -44,7 +44,6 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "alias",
|
||||
permission = "plots.alias",
|
||||
description = "Set the plot name",
|
||||
usage = "/plot alias <set | remove> <alias>",
|
||||
aliases = {"setalias", "sa", "name", "rename", "setname", "seta", "nameplot"},
|
||||
category = CommandCategory.SETTINGS,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -93,7 +93,6 @@ import java.util.UUID;
|
||||
permission = "plots.area",
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Create a new PlotArea",
|
||||
aliases = "world",
|
||||
usage = "/plot area <create | info | list | tp | regen>",
|
||||
confirmation = true)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -58,7 +58,7 @@ public abstract class Argument<T> {
|
||||
}
|
||||
};
|
||||
public static final Argument<String> PlayerName =
|
||||
new Argument<String>("PlayerName", "<player|*>") {
|
||||
new Argument<String>("PlayerName", "<player | *>") {
|
||||
@Override public String parse(String in) {
|
||||
return in.length() <= 16 ? in : null;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -64,7 +64,6 @@ import java.util.stream.Collectors;
|
||||
permission = "plots.auto",
|
||||
category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Claim the nearest plot",
|
||||
aliases = "a",
|
||||
usage = "/plot auto [length, width]")
|
||||
public class Auto extends SubCommand {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -57,7 +57,6 @@ import java.util.stream.Stream;
|
||||
|
||||
@CommandDeclaration(command = "backup",
|
||||
usage = "/plot backup <save | list | load>",
|
||||
description = "Manage plot backups",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.backup")
|
||||
@ -123,7 +122,6 @@ public final class Backup extends Command {
|
||||
|
||||
@CommandDeclaration(command = "save",
|
||||
usage = "/plot backup save",
|
||||
description = "Create a plot backup",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.backup.save")
|
||||
@ -174,7 +172,6 @@ public final class Backup extends Command {
|
||||
|
||||
@CommandDeclaration(command = "list",
|
||||
usage = "/plot backup list",
|
||||
description = "List available plot backups",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.backup.list")
|
||||
@ -241,7 +238,6 @@ public final class Backup extends Command {
|
||||
|
||||
@CommandDeclaration(command = "load",
|
||||
usage = "/plot backup load <#>",
|
||||
description = "Restore a plot backup",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.backup.load")
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -40,7 +40,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
@CommandDeclaration(command = "setbiome",
|
||||
permission = "plots.set.biome",
|
||||
description = "Set the plot biome",
|
||||
usage = "/plot biome [biome]",
|
||||
aliases = {"biome", "sb", "setb", "b"},
|
||||
category = CommandCategory.APPEARANCE,
|
||||
@ -67,7 +66,7 @@ public class Biome extends SetCommand {
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
plot.setBiome(biome, () -> {
|
||||
plot.getPlotModificationManager().setBiome(biome, () -> {
|
||||
plot.removeRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("biome.biome_set_to"),
|
||||
@ -78,8 +77,7 @@ public class Biome extends SetCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Command> tab(final PlotPlayer player, final String[] args,
|
||||
final boolean space) {
|
||||
public Collection<Command> tab(final PlotPlayer<?> player, final String[] args, final boolean space) {
|
||||
return SuggestionHelper.getNamespacedRegistrySuggestions(BiomeType.REGISTRY, args[0])
|
||||
.map(value -> value.toLowerCase(Locale.ENGLISH).replace("minecraft:", ""))
|
||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -46,7 +46,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "buy",
|
||||
description = "Buy the plot you are standing on",
|
||||
usage = "/plot buy",
|
||||
permission = "plots.buy",
|
||||
category = CommandCategory.CLAIMING,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -47,7 +47,6 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
||||
|
||||
@CommandDeclaration(command = "caps",
|
||||
category = CommandCategory.INFO,
|
||||
description = "Show plot entity caps",
|
||||
usage = "/plot caps")
|
||||
public class Caps extends SubCommand {
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -29,7 +29,6 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "chat",
|
||||
description = "Toggles plot chat on or off",
|
||||
usage = "/plot chat",
|
||||
permission = "plots.chat",
|
||||
category = CommandCategory.CHAT,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -55,7 +55,6 @@ import javax.annotation.Nullable;
|
||||
@CommandDeclaration(
|
||||
command = "claim",
|
||||
aliases = "c",
|
||||
description = "Claim the current plot you're standing on",
|
||||
category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER, permission = "plots.claim",
|
||||
usage = "/plot claim")
|
||||
@ -175,8 +174,7 @@ public class Claim extends SubCommand {
|
||||
try {
|
||||
TaskManager.getPlatformImplementation().sync(() -> {
|
||||
if (!plot.claim(player, true, finalSchematic, false)) {
|
||||
logger.info(TranslatableCaption.of("core.prefix") + String
|
||||
.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
|
||||
logger.info("Failed to claim plot {}", plot.getId().toCommaSeparatedString());
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
plot.setOwnerAbs(null);
|
||||
} else if (area.isAutoMerge()) {
|
||||
@ -188,7 +186,7 @@ public class Claim extends SubCommand {
|
||||
Template.of("value", "Auto merge on claim")
|
||||
);
|
||||
} else {
|
||||
plot.autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
|
||||
plot.getPlotModificationManager().autoMerge(mergeEvent.getDir(), mergeEvent.getMax(), player.getUUID(), true);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -197,9 +195,7 @@ public class Claim extends SubCommand {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, () -> {
|
||||
logger.info(TranslatableCaption.of("core.prefix") + String
|
||||
.format("Failed to add plot %s to the database",
|
||||
plot.getId().toCommaSeparatedString()));
|
||||
logger.info("Failed to add plot to database: {}", plot.getId().toCommaSeparatedString());
|
||||
player.sendMessage(TranslatableCaption.of("working.plot_not_claimed"));
|
||||
plot.setOwnerAbs(null);
|
||||
});
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -47,7 +47,6 @@ import javax.annotation.Nonnull;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "clear",
|
||||
description = "Clear the plot you stand on",
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.clear",
|
||||
category = CommandCategory.APPEARANCE,
|
||||
@ -92,8 +91,8 @@ public class Clear extends Command {
|
||||
confirm.run(this, () -> {
|
||||
BackupManager.backup(player, plot, () -> {
|
||||
final long start = System.currentTimeMillis();
|
||||
boolean result = plot.clear(true, false, () -> {
|
||||
plot.unlink();
|
||||
boolean result = plot.getPlotModificationManager().clear(true, false, () -> {
|
||||
plot.getPlotModificationManager().unlink();
|
||||
TaskManager.runTask(() -> {
|
||||
plot.removeRunning();
|
||||
// If the state changes, then mark it as no longer done
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -53,8 +53,7 @@ import java.util.concurrent.TimeoutException;
|
||||
aliases = "clusters",
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.cluster",
|
||||
description = "Manage a plot cluster")
|
||||
permission = "plots.cluster")
|
||||
public class Cluster extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
@ -270,7 +269,7 @@ public class Cluster extends SubCommand {
|
||||
} else {
|
||||
cluster = area.getCluster(player.getLocation());
|
||||
if (cluster == null) {
|
||||
player.sendMessage(TranslatableCaption.of("cluster.not_in_cluster"));
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_cluster"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -298,7 +297,7 @@ public class Cluster extends SubCommand {
|
||||
if (args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster delete [name]")
|
||||
Template.of("value", "/plot cluster resize [name]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -609,10 +608,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "members":
|
||||
case "admin":
|
||||
case "helper":
|
||||
case "helpers": {
|
||||
case "members": {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_CLUSTER_HELPERS)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -623,7 +619,7 @@ public class Cluster extends SubCommand {
|
||||
if (args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster helpers <add | remove> <player>")
|
||||
Template.of("value", "/plot cluster members <add | remove> <player>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -658,7 +654,7 @@ public class Cluster extends SubCommand {
|
||||
} else {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot cluster helpers <add | remove> <player>")
|
||||
Template.of("value", "/plot cluster members <add | remove> <player>")
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -690,7 +686,7 @@ public class Cluster extends SubCommand {
|
||||
PlotCluster cluster = area.getCluster(args[1]);
|
||||
if (cluster == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.invalid_cluster"),
|
||||
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||
Template.of("cluster", args[1])
|
||||
);
|
||||
return false;
|
||||
@ -733,7 +729,7 @@ public class Cluster extends SubCommand {
|
||||
if (args.length == 2) {
|
||||
cluster = area.getCluster(args[1]);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("cluster.invalid_cluster"),
|
||||
TranslatableCaption.of("cluster.invalid_cluster_name"),
|
||||
Template.of("cluster", args[1])
|
||||
);
|
||||
} else {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -71,7 +71,7 @@ public abstract class Command {
|
||||
private List<String> aliases;
|
||||
private RequiredType required;
|
||||
private String usage;
|
||||
private String description;
|
||||
private Caption description;
|
||||
private String permission;
|
||||
private boolean confirmation;
|
||||
private CommandCategory category;
|
||||
@ -171,7 +171,7 @@ public abstract class Command {
|
||||
return this.aliases;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
public Caption getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@ -198,7 +198,21 @@ public abstract class Command {
|
||||
aliasOptions.addAll(Arrays.asList(declaration.aliases()));
|
||||
|
||||
this.aliases = aliasOptions;
|
||||
this.description = declaration.description();
|
||||
if (declaration.description().isEmpty()) {
|
||||
Command parent = getParent();
|
||||
// we're collecting the "path" of the command
|
||||
List<String> path = new ArrayList<>();
|
||||
path.add(this.id);
|
||||
while (parent != null && !parent.equals(MainCommand.getInstance())) {
|
||||
path.add(parent.getId());
|
||||
parent = parent.getParent();
|
||||
}
|
||||
Collections.reverse(path);
|
||||
String descriptionKey = String.join(".", path);
|
||||
this.description = TranslatableCaption.of(String.format("commands.description.%s", descriptionKey));
|
||||
} else {
|
||||
this.description = StaticCaption.of(declaration.description());
|
||||
}
|
||||
this.usage = declaration.usage();
|
||||
this.confirmation = declaration.confirmation();
|
||||
|
||||
@ -280,9 +294,10 @@ public abstract class Command {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player Caller
|
||||
* @param args Arguments
|
||||
* @param confirm Instance, Success, Failure
|
||||
* @param player Caller
|
||||
* @param args Arguments
|
||||
* @param confirm Instance, Success, Failure
|
||||
* @param whenDone task to run when done
|
||||
* @return CompletableFuture true if the command executed fully, false in
|
||||
* any other case
|
||||
*/
|
||||
@ -334,7 +349,7 @@ public abstract class Command {
|
||||
String[] allArgs = setArgs.toArray(new String[0]);
|
||||
int best = 0;
|
||||
for (Command current : commands) {
|
||||
int match = getMatch(allArgs, current);
|
||||
int match = getMatch(allArgs, current, player);
|
||||
if (match > best) {
|
||||
cmd = current;
|
||||
}
|
||||
@ -384,12 +399,12 @@ public abstract class Command {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getMatch(String[] args, Command cmd) {
|
||||
public int getMatch(String[] args, Command cmd, PlotPlayer<?> player) {
|
||||
String perm = cmd.getPermission();
|
||||
HashSet<String> desc = new HashSet<>();
|
||||
int count = cmd.getAliases().stream().filter(alias -> alias.startsWith(args[0]))
|
||||
.mapToInt(alias -> 5).sum();
|
||||
Collections.addAll(desc, cmd.getDescription().split(" "));
|
||||
Collections.addAll(desc, cmd.getDescription().getComponent(player).split(" "));
|
||||
for (String arg : args) {
|
||||
if (perm.startsWith(arg)) {
|
||||
count++;
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -48,6 +48,7 @@ public interface CommandCaller {
|
||||
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
|
||||
*
|
||||
* @param permission the name of the permission
|
||||
* @return if permission is had
|
||||
*/
|
||||
boolean hasPermission(@Nonnull String permission);
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -41,7 +41,6 @@ import java.util.Locale;
|
||||
|
||||
@CommandDeclaration(command = "comment",
|
||||
aliases = {"msg"},
|
||||
description = "Comment on a plot",
|
||||
category = CommandCategory.CHAT,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.comment")
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -51,7 +51,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@CommandDeclaration(command = "condense",
|
||||
permission = "plots.admin",
|
||||
usage = "/plot condense <area> <start|stop|info> [radius]",
|
||||
description = "Condense a plotworld",
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.CONSOLE)
|
||||
public class Condense extends SubCommand {
|
||||
@ -71,7 +70,7 @@ public class Condense extends SubCommand {
|
||||
if (args.length != 2 && args.length != 3) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot condense <area> <start|stop|info> [radius]")
|
||||
Template.of("value", "/plot condense <area> <start | stop | info> [radius]")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -179,7 +178,7 @@ public class Condense extends SubCommand {
|
||||
i++;
|
||||
final AtomicBoolean result = new AtomicBoolean(false);
|
||||
try {
|
||||
result.set(origin.move(possible, () -> {
|
||||
result.set(origin.getPlotModificationManager().move(possible, () -> {
|
||||
if (result.get()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("condense.moving"),
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -32,7 +32,6 @@ import com.plotsquared.core.util.task.TaskManager;
|
||||
|
||||
@CommandDeclaration(command = "confirm",
|
||||
permission = "plots.use",
|
||||
description = "Confirm an action",
|
||||
category = CommandCategory.INFO)
|
||||
public class Confirm extends SubCommand {
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -42,7 +42,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "continue",
|
||||
description = "Continue a plot that was previously marked as done",
|
||||
permission = "plots.continue",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -37,7 +37,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
permission = "plots.copy",
|
||||
aliases = {"copypaste"},
|
||||
category = CommandCategory.CLAIMING,
|
||||
description = "Copy a plot",
|
||||
usage = "/plot copy <X;Z>",
|
||||
requiredType = RequiredType.NONE)
|
||||
public class Copy extends SubCommand {
|
||||
@ -77,11 +76,15 @@ public class Copy extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("errors.plotworld_incompatible"));
|
||||
return false;
|
||||
}
|
||||
if (plot1.copy(plot2, () -> player.sendMessage(TranslatableCaption.of("move.copy_success")))) {
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
|
||||
return false;
|
||||
}
|
||||
|
||||
plot1.getPlotModificationManager().copy(plot2).thenAccept(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(TranslatableCaption.of("move.copy_success"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -41,7 +41,6 @@ import javax.annotation.Nonnull;
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.createroadschematic",
|
||||
description = "Add a road schematic to your world using the roads around your current plot",
|
||||
usage = "/plot createroadschematic")
|
||||
public class CreateRoadSchematic extends SubCommand {
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -48,7 +48,6 @@ import com.plotsquared.core.util.FileUtils;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import sun.net.TransferProtocolClient;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
@ -63,7 +62,6 @@ import java.util.Map.Entry;
|
||||
aliases = {"convert"},
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
permission = "plots.database",
|
||||
description = "Convert/Backup Storage",
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
usage = "/plot database [area] <sqlite | mysql | import>")
|
||||
public class DatabaseCommand extends SubCommand {
|
||||
@ -104,7 +102,7 @@ public class DatabaseCommand extends SubCommand {
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot database [area] <sqlite|mysql|import>")
|
||||
Template.of("value", "/plot database [area] <sqlite | mysql | import>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -178,7 +176,11 @@ public class DatabaseCommand extends SubCommand {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
player.sendMessage(StaticCaption.of("Skipping duplicate plot: " + plot + " | id=" + plot.temp));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("database.skipping_duplicated_plot"),
|
||||
Template.of("plot", String.valueOf(plot)),
|
||||
Template.of("id", String.valueOf(plot.temp))
|
||||
);
|
||||
continue;
|
||||
}
|
||||
plot.setArea(pa);
|
||||
@ -225,17 +227,17 @@ public class DatabaseCommand extends SubCommand {
|
||||
return true;
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
player.sendMessage(TranslatableCaption.of("database.failed_to_save_plots"));
|
||||
player.sendMessage(StaticCaption.of(("=== Begin of stacktrace. ===")));
|
||||
player.sendMessage(TranslatableCaption.of("errors.stacktrace_begin"));
|
||||
e.printStackTrace();
|
||||
player.sendMessage(StaticCaption.of(("=== End of stacktrace. ===")));
|
||||
player.sendMessage(TranslatableCaption.of(("errors.stacktrace_end")));
|
||||
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||
return false;
|
||||
}
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
player.sendMessage(TranslatableCaption.of("database.failed_to_open"));
|
||||
player.sendMessage(StaticCaption.of(("=== Begin of stacktrace. ===")));
|
||||
player.sendMessage(TranslatableCaption.of("errors.stacktrace_begin"));
|
||||
e.printStackTrace();
|
||||
player.sendMessage(StaticCaption.of(("=== End of stacktrace. ===")));
|
||||
player.sendMessage(TranslatableCaption.of("errors.stacktrace_end"));
|
||||
player.sendMessage(TranslatableCaption.of("database.invalid_args"));
|
||||
return false;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -55,7 +55,6 @@ import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "debug",
|
||||
category = CommandCategory.DEBUG,
|
||||
description = "Show debug information",
|
||||
usage = "/plot debug [msg]",
|
||||
permission = "plots.admin")
|
||||
public class Debug extends SubCommand {
|
||||
@ -72,6 +71,10 @@ public class Debug extends SubCommand {
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
if (args.length == 0 ) {
|
||||
player.sendMessage(TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot debug <loadedchunks | debug-players | logging | entitytypes | msg>"));
|
||||
}
|
||||
if (args.length > 0) {
|
||||
if ("player".equalsIgnoreCase(args[0])) {
|
||||
for (Map.Entry<String, Object> meta : player.getMeta().entrySet()) {
|
||||
@ -83,7 +86,7 @@ public class Debug extends SubCommand {
|
||||
final long start = System.currentTimeMillis();
|
||||
player.sendMessage(TranslatableCaption.of("debug.fetching_loaded_chunks"));
|
||||
TaskManager.runTaskAsync(() -> player.sendMessage(StaticCaption
|
||||
.of("Loaded chunks: " + this.worldUtil.getChunkChunks(player.getLocation().getWorldName()).size() + "(" + (System.currentTimeMillis()
|
||||
.of("Loaded chunks: " + this.worldUtil.getChunkChunks(player.getLocation().getWorldName()).size() + " (" + (System.currentTimeMillis()
|
||||
- start) + "ms) using thread: " + Thread.currentThread().getName())));
|
||||
return true;
|
||||
}
|
||||
@ -106,10 +109,10 @@ public class Debug extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
if (args.length > 0 && "logging".equalsIgnoreCase(args[0])) {
|
||||
logger.info("[P2] Info!");
|
||||
logger.warn("[P2] Warning!");
|
||||
logger.error("[P2] Error!", new RuntimeException());
|
||||
logger.debug("[P2] Debug!");
|
||||
logger.info("Info!");
|
||||
logger.warn("Warning!");
|
||||
logger.error("Error!", new RuntimeException());
|
||||
logger.debug("Debug!");
|
||||
return true;
|
||||
}
|
||||
if (args.length > 0 && "entitytypes".equalsIgnoreCase(args[0])) {
|
||||
@ -121,7 +124,7 @@ public class Debug extends SubCommand {
|
||||
for (final EntityType entityType : category.getAll()) {
|
||||
builder.append(entityType.getId()).append(" ");
|
||||
}
|
||||
player.sendMessage(StaticCaption.of("core.prefix" + builder.toString()));
|
||||
player.sendMessage(StaticCaption.of("<prefix>" + builder.toString()));
|
||||
});
|
||||
EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
|
||||
.forEach(entityType -> {
|
||||
@ -130,7 +133,7 @@ public class Debug extends SubCommand {
|
||||
if (categoryCount > 0) {
|
||||
return;
|
||||
}
|
||||
player.sendMessage(StaticCaption.of("core.prefix" + entityType.getName() + " is in "
|
||||
player.sendMessage(StaticCaption.of("<prefix>" + entityType.getName() + " is in "
|
||||
+ categoryCount + " categories"));
|
||||
});
|
||||
return true;
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -33,7 +33,6 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "debugallowunsafe",
|
||||
description = "Allow unsafe actions until toggled off",
|
||||
usage = "/plot debugallowunsafe",
|
||||
category = CommandCategory.DEBUG,
|
||||
requiredType = RequiredType.NONE,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -89,7 +89,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "debugexec",
|
||||
permission = "plots.admin",
|
||||
description = "Mutli-purpose debug command",
|
||||
aliases = {"exec", "$"},
|
||||
category = CommandCategory.DEBUG)
|
||||
public class DebugExec extends SubCommand {
|
||||
@ -230,7 +229,10 @@ public class DebugExec extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.starting_task"));
|
||||
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||
@Override public void run(PlotAnalysis value) {
|
||||
player.sendMessage(StaticCaption.of("&6Done: &7Use &6/plot debugexec analyze &7for more information."));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugexec.analyze_done"),
|
||||
Template.of("command", "/plot debugexec analyze")
|
||||
);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
@ -331,11 +333,9 @@ public class DebugExec extends SubCommand {
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("debugexec.expiry_already_started"));
|
||||
}
|
||||
case "h":
|
||||
case "he":
|
||||
case "?":
|
||||
case "help":
|
||||
player.sendMessage(StaticCaption.of("Possible sub commands: /plot debugexec <" + StringMan.join(allowed_params, "|") + ">"));
|
||||
player.sendMessage(StaticCaption.of("<prefix><gold>Possible sub commands: </gray>/plot debugexec <" + StringMan.join(allowed_params, " | ") + "></gray>"));
|
||||
return false;
|
||||
case "addcmd":
|
||||
try {
|
||||
@ -422,7 +422,7 @@ public class DebugExec extends SubCommand {
|
||||
message.set(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||
.parse(TranslatableCaption.of("debugexec.script_list_item").getComponent(player), numTemplate, nameTemplate))));
|
||||
}
|
||||
}, "/plot debugexec list-scripts", StaticCaption.of("List of scripts"));
|
||||
}, "/plot debugexec list-scripts", TranslatableCaption.of("scripts.script_list"));
|
||||
return true;
|
||||
case "all":
|
||||
if (args.length < 3) {
|
||||
@ -458,12 +458,12 @@ public class DebugExec extends SubCommand {
|
||||
} catch (ScriptException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logger.info("[P2] > {}ms -> {}", System.currentTimeMillis() - start, result);
|
||||
logger.info("{}ms -> {}", System.currentTimeMillis() - start, result);
|
||||
});
|
||||
} else {
|
||||
long start = System.currentTimeMillis();
|
||||
Object result = this.engine.eval(script, this.scope);
|
||||
logger.info("[P2] > {}ms -> {}", System.currentTimeMillis() - start, result);
|
||||
logger.info("{}ms -> {}", System.currentTimeMillis() - start, result);
|
||||
}
|
||||
return true;
|
||||
} catch (ScriptException e) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -45,7 +45,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "debugimportworlds",
|
||||
permission = "plots.admin",
|
||||
description = "Import worlds by player name",
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
category = CommandCategory.TELEPORT)
|
||||
public class DebugImportWorlds extends Command {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -31,7 +31,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "debugloadtest",
|
||||
permission = "plots.debugloadtest",
|
||||
description = "This debug command will force the reload of all plots in the DB",
|
||||
usage = "/plot debugloadtest",
|
||||
category = CommandCategory.DEBUG,
|
||||
requiredType = RequiredType.CONSOLE)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -56,7 +56,6 @@ import java.util.stream.Collectors;
|
||||
@CommandDeclaration(command = "debugpaste",
|
||||
aliases = "dp",
|
||||
usage = "/plot debugpaste",
|
||||
description = "Upload settings.yml, worlds.yml, your latest.log and Multiverse's worlds.yml (if being used) to https://athion.net/ISPaster/paste",
|
||||
permission = "plots.debugpaste",
|
||||
category = CommandCategory.DEBUG,
|
||||
confirmation = true,
|
||||
@ -146,25 +145,30 @@ public class DebugPaste extends SubCommand {
|
||||
final File logFile =
|
||||
new File(PlotSquared.platform().getDirectory(), "../../logs/latest.log");
|
||||
if (Files.size(logFile.toPath()) > 14_000_000) {
|
||||
throw new IOException("Too big...");
|
||||
throw new IOException("The latest.log is larger than 14MB. Please reboot your server and submit a new paste.");
|
||||
}
|
||||
incendoPaster
|
||||
.addFile(new IncendoPaster.PasteFile("latest.log", readFile(logFile)));
|
||||
} catch (IOException ignored) {
|
||||
player.sendMessage(StaticCaption.of("&clatest.log is too big to be pasted, please reboot your server and submit a new paste."));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugpaste.latest_log"),
|
||||
Template.of("file", "latest.log"),
|
||||
Template.of("size", "14MB"));
|
||||
}
|
||||
|
||||
try {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("settings.yml",
|
||||
readFile(this.configFile)));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
player.sendMessage(StaticCaption.of("&cSkipping settings.yml because it's empty."));
|
||||
player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"),
|
||||
Template.of("file", "settings.yml"));
|
||||
}
|
||||
try {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("worlds.yml",
|
||||
readFile(this.worldfile)));
|
||||
} catch (final IllegalArgumentException ignored) {
|
||||
player.sendMessage(StaticCaption.of("&cSkipping worlds.yml because it's empty."));
|
||||
player.sendMessage(TranslatableCaption.of("debugpaste.empty_file"),
|
||||
Template.of("file", "worlds.yml"));
|
||||
}
|
||||
|
||||
try {
|
||||
@ -173,7 +177,8 @@ public class DebugPaste extends SubCommand {
|
||||
incendoPaster.addFile(new IncendoPaster.PasteFile("MultiverseCore/worlds.yml",
|
||||
readFile(MultiverseWorlds)));
|
||||
} catch (final IOException ignored) {
|
||||
player.sendMessage(StaticCaption.of("&cSkipping Multiverse world's.yml because Multiverse is not in use."));
|
||||
player.sendMessage(TranslatableCaption.of("debugpaste.skip_multiverse"),
|
||||
Template.of("file", "worlds.yml"));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -43,7 +43,6 @@ import java.util.Arrays;
|
||||
@CommandDeclaration(command = "debugroadregen",
|
||||
usage = DebugRoadRegen.USAGE,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Regenerate roads in the plot or region the user is, based on the road schematic",
|
||||
category = CommandCategory.DEBUG,
|
||||
permission = "plots.debugroadregen")
|
||||
public class DebugRoadRegen extends SubCommand {
|
||||
@ -140,7 +139,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
Plot plot = player.getCurrentPlot();
|
||||
PlotManager manager = area.getPlotManager();
|
||||
if (!(manager instanceof HybridPlotManager)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world"));
|
||||
return true;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("debugroadregen.schematic"),
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -37,8 +37,7 @@ import java.util.List;
|
||||
permission = "plots.debugsavetest",
|
||||
category = CommandCategory.DEBUG,
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
usage = "/plot debugsavetest",
|
||||
description = "This command will force the recreation of all plots in the DB")
|
||||
usage = "/plot debugsavetest")
|
||||
public class DebugSaveTest extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -47,7 +47,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
@CommandDeclaration(command = "delete",
|
||||
permission = "plots.delete",
|
||||
description = "Delete the plot you stand on",
|
||||
usage = "/plot delete",
|
||||
aliases = {"dispose", "del"},
|
||||
category = CommandCategory.CLAIMING,
|
||||
@ -99,7 +98,7 @@ public class Delete extends SubCommand {
|
||||
return;
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
boolean result = plot.deletePlot(() -> {
|
||||
boolean result = plot.getPlotModificationManager().deletePlot(() -> {
|
||||
plot.removeRunning();
|
||||
if ((this.econHandler != null) && plotArea.useEconomy()) {
|
||||
Expression<Double> valueExr = plotArea.getPrices().get("sell");
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -50,7 +50,6 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "deny",
|
||||
aliases = {"d", "ban"},
|
||||
description = "Deny a user from entering a plot",
|
||||
usage = "/plot deny <player | *>",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -40,7 +40,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "setdescription",
|
||||
permission = "plots.set.desc",
|
||||
description = "Set the plot description",
|
||||
usage = "/plot desc <description>",
|
||||
aliases = {"desc", "setdesc", "setd", "description"},
|
||||
category = CommandCategory.SETTINGS,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -32,7 +32,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "dislike",
|
||||
permission = "plots.dislike",
|
||||
description = "Dislike the plot",
|
||||
usage = "/plot dislike [next|purge]",
|
||||
category = CommandCategory.INFO,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -49,7 +49,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "done",
|
||||
aliases = {"submit"},
|
||||
description = "Mark a plot as done",
|
||||
permission = "plots.done",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE)
|
||||
@ -93,7 +92,7 @@ public class Done extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_lin"));
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link"));
|
||||
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
||||
if (ExpireManager.IMP == null || doneRequirements == null) {
|
||||
finish(plot, player, true);
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -45,12 +45,11 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.net.URL;
|
||||
|
||||
@CommandDeclaration(usage = "/plot download [schematic|world]",
|
||||
@CommandDeclaration(usage = "/plot download [schematic | world]",
|
||||
command = "download",
|
||||
aliases = {"dl"},
|
||||
category = CommandCategory.SCHEMATIC,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Download your plot",
|
||||
permission = "plots.download")
|
||||
public class Download extends SubCommand {
|
||||
|
||||
@ -111,7 +110,9 @@ public class Download extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link_failed"));
|
||||
return;
|
||||
}
|
||||
player.sendMessage(StaticCaption.of(url.toString())
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generation_link_success"),
|
||||
Template.of("url", url.toString())
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -71,7 +71,6 @@ import java.util.stream.Stream;
|
||||
@CommandDeclaration(command = "flag",
|
||||
aliases = {"f", "flag"},
|
||||
usage = "/plot flag <set | remove | add | list | info> <flag> <value>",
|
||||
description = "Manage plot flags",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.flag")
|
||||
@ -282,7 +281,6 @@ public final class FlagCommand extends Command {
|
||||
@CommandDeclaration(command = "set",
|
||||
aliases = {"s", "set"},
|
||||
usage = "/plot flag set <flag> <value>",
|
||||
description = "Set a plot flag",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.set.flag")
|
||||
@ -335,7 +333,6 @@ public final class FlagCommand extends Command {
|
||||
@CommandDeclaration(command = "add",
|
||||
aliases = {"a", "add"},
|
||||
usage = "/plot flag add <flag> <value>",
|
||||
description = "Add a plot flag value",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.flag.add")
|
||||
@ -399,7 +396,6 @@ public final class FlagCommand extends Command {
|
||||
@CommandDeclaration(command = "remove",
|
||||
aliases = {"r", "remove", "delete"},
|
||||
usage = "/plot flag remove <flag> [values]",
|
||||
description = "Remove a flag",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.flag.remove")
|
||||
@ -503,7 +499,6 @@ public final class FlagCommand extends Command {
|
||||
@CommandDeclaration(command = "list",
|
||||
aliases = {"l", "list", "flags"},
|
||||
usage = "/plot flag list",
|
||||
description = "List all available plot flags",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.flag.list")
|
||||
@ -543,7 +538,6 @@ public final class FlagCommand extends Command {
|
||||
@CommandDeclaration(command = "info",
|
||||
aliases = {"i", "info"},
|
||||
usage = "/plot flag info <flag>",
|
||||
description = "View information about a flag",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.flag.info")
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -40,10 +40,14 @@ import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@CommandDeclaration(command = "grant",
|
||||
category = CommandCategory.CLAIMING,
|
||||
@ -89,7 +93,7 @@ public class Grant extends Command {
|
||||
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
|
||||
if (args[0].equalsIgnoreCase("check")) {
|
||||
player.sendMessage(TranslatableCaption.of("grants.granted_plots"),
|
||||
Template.of("grants", String.valueOf(access.get().orElse(0))));
|
||||
Template.of("amount", String.valueOf(access.get().orElse(0))));
|
||||
} else {
|
||||
access.set(access.get().orElse(0) + 1);
|
||||
}
|
||||
@ -131,4 +135,10 @@ public class Grant extends Command {
|
||||
sendUsage(player);
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
@Override public Collection<Command> tab(final PlotPlayer player, String[] args, boolean space) {
|
||||
return Stream.of("check", "add")
|
||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
.map(value -> new Command(null, false, value, "plots.grant", RequiredType.NONE, null) {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -39,7 +39,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "help",
|
||||
description = "Get this help menu",
|
||||
aliases = "?",
|
||||
category = CommandCategory.INFO,
|
||||
usage = "help [category|#]",
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -50,7 +50,6 @@ import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "home",
|
||||
description = "Teleport to your plot(s)",
|
||||
permission = "plots.home",
|
||||
usage = "/plot home [<page> | <alias> | <area;x;y> | <area> <x;y> | <area> <page>]",
|
||||
aliases = {"h"},
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -44,8 +44,7 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
import java.util.List;
|
||||
|
||||
@CommandDeclaration(command = "inbox",
|
||||
description = "Review the comments for a plot",
|
||||
usage = "/plot inbox [inbox] [delete <index>|clear|page]",
|
||||
usage = "/plot inbox [inbox] [delete <index> | clear | page]",
|
||||
permission = "plots.inbox",
|
||||
category = CommandCategory.CHAT,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -208,7 +207,7 @@ public class Inbox extends SubCommand {
|
||||
}
|
||||
PlotComment comment = value.get(index - 1);
|
||||
inbox.removeComment(plot, comment);
|
||||
boolean success = plot.removeComment(comment);
|
||||
boolean success = plot.getPlotCommentContainer().removeComment(comment);
|
||||
if (success) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_success"),
|
||||
@ -231,9 +230,9 @@ public class Inbox extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
}
|
||||
inbox.clearInbox(plot);
|
||||
List<PlotComment> comments = plot.getComments(inbox.toString());
|
||||
List<PlotComment> comments = plot.getPlotCommentContainer().getComments(inbox.toString());
|
||||
if (!comments.isEmpty()) {
|
||||
plot.removeComments(comments);
|
||||
plot.getPlotCommentContainer().removeComments(comments);
|
||||
}
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("comment.comment_removed_success"),
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -38,8 +38,7 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
@CommandDeclaration(command = "info",
|
||||
aliases = "i",
|
||||
description = "Display plot info",
|
||||
usage = "/plot info <id> [-f, to force info]",
|
||||
usage = "/plot info <id> [-f to force info]",
|
||||
category = CommandCategory.INFO)
|
||||
public class Info extends SubCommand {
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -50,7 +50,6 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "kick",
|
||||
aliases = "k",
|
||||
description = "Kick a player from your plot",
|
||||
permission = "plots.kick",
|
||||
usage = "/plot kick <player | *>",
|
||||
category = CommandCategory.TELEPORT,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -39,7 +39,6 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "leave",
|
||||
description = "Removes self from being trusted or a member of the plot",
|
||||
permission = "plots.leave",
|
||||
usage = "/plot leave",
|
||||
category = CommandCategory.CLAIMING,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -50,7 +50,6 @@ import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "like",
|
||||
permission = "plots.like",
|
||||
description = "Like the plot",
|
||||
usage = "/plot like [next | purge]",
|
||||
category = CommandCategory.INFO,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -172,6 +171,7 @@ public class Like extends SubCommand {
|
||||
/**
|
||||
* Get the likes to dislike ratio of a plot as a percentage (in decimal form)
|
||||
*
|
||||
* @param plot plot
|
||||
* @return likes to dislike ratio, returns zero if the plot has no likes
|
||||
*/
|
||||
public static double getLikesPercentage(final Plot plot) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -72,7 +72,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
@CommandDeclaration(command = "list",
|
||||
aliases = {"l", "find", "search"},
|
||||
description = "List plots",
|
||||
permission = "plots.list",
|
||||
category = CommandCategory.INFO,
|
||||
usage = "/plot list <forsale | mine | shared | world | top | all | unowned | player | world | done | fuzzy <search...>> [#]")
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -54,7 +54,6 @@ import java.util.List;
|
||||
aliases = "restore",
|
||||
category = CommandCategory.SCHEMATIC,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Load your plot",
|
||||
permission = "plots.load",
|
||||
usage = "/plot load")
|
||||
public class Load extends SubCommand {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -42,6 +42,8 @@ import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
@ -55,6 +57,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
aliases = {"plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"})
|
||||
public class MainCommand extends Command {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("P2/" + MainCommand.class.getSimpleName());
|
||||
|
||||
private static MainCommand instance;
|
||||
public Help help;
|
||||
public Toggle toggle;
|
||||
@ -144,7 +148,12 @@ public class MainCommand extends Command {
|
||||
}
|
||||
|
||||
for (final Class<? extends Command> command : commands) {
|
||||
injector.getInstance(command);
|
||||
try {
|
||||
injector.getInstance(command);
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to register command {}", command.getCanonicalName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Referenced commands
|
||||
@ -301,12 +310,13 @@ public class MainCommand extends Command {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
String message = e.getLocalizedMessage();
|
||||
String message = e.getMessage();
|
||||
if (message != null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.error"),
|
||||
net.kyori.adventure.text.minimessage.Template.of("value", message));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("errors.error"));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("errors.error_console"));
|
||||
}
|
||||
}
|
||||
// Reset command scope //
|
||||
|
@ -21,19 +21,19 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.events.PlotMergeEvent;
|
||||
import com.plotsquared.core.events.Result;
|
||||
import com.plotsquared.core.location.Direction;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
@ -42,7 +42,6 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -51,7 +50,6 @@ import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "merge",
|
||||
aliases = "m",
|
||||
description = "Merge the plot you are standing on with another plot",
|
||||
permission = "plots.merge",
|
||||
usage = "/plot merge <all | n | e | s | w> [removeroads]",
|
||||
category = CommandCategory.SETTINGS,
|
||||
@ -182,7 +180,7 @@ public class Merge extends SubCommand {
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (plot.autoMerge(Direction.ALL, maxSize, uuid, terrain)) {
|
||||
if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, terrain)) {
|
||||
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
|
||||
this.econHandler.withdrawMoney(player, price);
|
||||
player.sendMessage(
|
||||
@ -226,7 +224,7 @@ public class Merge extends SubCommand {
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
|
||||
if (plot.getPlotModificationManager().autoMerge(direction, maxSize - size, uuid, terrain)) {
|
||||
if (this.econHandler != null && plotArea.useEconomy() && price > 0d) {
|
||||
this.econHandler.withdrawMoney(player, price);
|
||||
player.sendMessage(
|
||||
@ -234,12 +232,12 @@ public class Merge extends SubCommand {
|
||||
Template.of("money", String.valueOf(price))
|
||||
);
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("success_merge"));
|
||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||
return true;
|
||||
}
|
||||
Plot adjacent = plot.getRelative(direction);
|
||||
if (adjacent == null || !adjacent.hasOwner() || adjacent
|
||||
.getMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) {
|
||||
.isMerged((direction.getIndex() + 2) % 4) || (!force && adjacent.isOwner(uuid))) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||
return false;
|
||||
}
|
||||
@ -261,8 +259,8 @@ public class Merge extends SubCommand {
|
||||
final Direction dir = direction;
|
||||
Runnable run = () -> {
|
||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
|
||||
plot.autoMerge(dir, maxSize - size, owner, terrain);
|
||||
PlotPlayer plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID());
|
||||
plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, terrain);
|
||||
PlotPlayer<?> plotPlayer = PlotSquared.platform().getPlayerManager().getPlayerIfExists(player.getUUID());
|
||||
if (plotPlayer == null) {
|
||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -36,7 +36,6 @@ import com.plotsquared.core.plot.Plot;
|
||||
*/
|
||||
@CommandDeclaration(command = "middle",
|
||||
aliases = {"center", "centre"},
|
||||
description = "Teleports you to the center of the plot",
|
||||
usage = "/plot middle",
|
||||
category = CommandCategory.TELEPORT,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -50,6 +49,7 @@ public class Middle extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.getCenter(center -> player.teleport(center, TeleportCause.COMMAND));
|
||||
player.sendMessage(TranslatableCaption.of("teleport.teleported_to_plot"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -43,7 +43,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(usage = "/plot move <X;Z>",
|
||||
command = "move",
|
||||
description = "Move a plot",
|
||||
permission = "plots.move",
|
||||
category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -107,7 +106,7 @@ public class Move extends SubCommand {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
return plot1.move(plot2, () -> {
|
||||
return plot1.getPlotModificationManager().move(plot2, () -> {
|
||||
}, false).thenApply(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(TranslatableCaption.of("move.move_success"));
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -48,7 +48,6 @@ import java.util.Locale;
|
||||
|
||||
@CommandDeclaration(command = "music",
|
||||
permission = "plots.music",
|
||||
description = "Play music in your plot",
|
||||
usage = "/plot music",
|
||||
category = CommandCategory.APPEARANCE,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -57,7 +56,7 @@ public class Music extends SubCommand {
|
||||
private static final Collection<String> DISCS = Arrays
|
||||
.asList("music_disc_13", "music_disc_cat", "music_disc_blocks", "music_disc_chirp",
|
||||
"music_disc_far", "music_disc_mall", "music_disc_mellohi", "music_disc_stal",
|
||||
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait");
|
||||
"music_disc_strad", "music_disc_ward", "music_disc_11", "music_disc_wait", "music_disc_pigstep");
|
||||
|
||||
private final InventoryUtil inventoryUtil;
|
||||
|
||||
@ -87,27 +86,27 @@ public class Music extends SubCommand {
|
||||
.createFlagInstance(item.getType());
|
||||
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Music removal"));
|
||||
return true;
|
||||
}
|
||||
plot.removeFlag(event.getFlag());
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
|
||||
} else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) {
|
||||
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"));
|
||||
} else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
|
||||
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
|
||||
.createFlagInstance(item.getType());
|
||||
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot);
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
player.sendMessage(
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("events.event_denied"),
|
||||
Template.of("value", "Music addition"));
|
||||
return true;
|
||||
}
|
||||
plot.setFlag(event.getFlag());
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_added"));
|
||||
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"));
|
||||
} else {
|
||||
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
||||
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -115,16 +114,16 @@ public class Music extends SubCommand {
|
||||
int index = 0;
|
||||
|
||||
for (final String disc : DISCS) {
|
||||
final String name = String.format("&r&6%s", disc);
|
||||
final String[] lore = {"&r&aClick to play!"};
|
||||
final String name = String.format("<gold>%s</gold>", disc);
|
||||
final String[] lore = {"<green>Click to play!</green>"};
|
||||
final PlotItemStack item = new PlotItemStack(disc, 1, name, lore);
|
||||
inv.setItem(index++, item);
|
||||
}
|
||||
|
||||
// Always add the cancel button
|
||||
// if (player.getMeta("music") != null) {
|
||||
String name = "&r&6Cancel music";
|
||||
String[] lore = {"&r&cClick to cancel!"};
|
||||
String name = "<gold>Cancel music</gold>";
|
||||
String[] lore = {"<red>Click to remove the music!<reset>"};
|
||||
inv.setItem(index, new PlotItemStack("bedrock", 1, name, lore));
|
||||
// }
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -37,7 +37,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "near",
|
||||
aliases = "n",
|
||||
description = "Display nearby players",
|
||||
usage = "/plot near",
|
||||
category = CommandCategory.INFO,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -49,7 +49,6 @@ import java.util.function.Consumer;
|
||||
|
||||
@CommandDeclaration(command = "setowner",
|
||||
permission = "plots.set.owner",
|
||||
description = "Set the plot owner",
|
||||
usage = "/plot setowner <player>",
|
||||
aliases = {"owner", "so", "seto"},
|
||||
category = CommandCategory.CLAIMING,
|
||||
@ -106,11 +105,11 @@ public class Owner extends SetCommand {
|
||||
Template.of("value", "Unlink on owner change"));
|
||||
return;
|
||||
}
|
||||
plot.unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad());
|
||||
plot.getPlotModificationManager().unlinkPlot(unlinkEvent.isCreateRoad(), unlinkEvent.isCreateRoad());
|
||||
Set<Plot> connected = plot.getConnectedPlots();
|
||||
for (Plot current : connected) {
|
||||
current.unclaim();
|
||||
current.removeSign();
|
||||
current.getPlotModificationManager().removeSign();
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||
return;
|
||||
@ -148,7 +147,7 @@ public class Owner extends SetCommand {
|
||||
if (plot.setOwner(finalUUID, player)) {
|
||||
if (removeDenied)
|
||||
plot.removeDenied(finalUUID);
|
||||
plot.setSign(finalName);
|
||||
plot.getPlotModificationManager().setSign(finalName);
|
||||
player.sendMessage(TranslatableCaption.of("owner.set_owner"));
|
||||
if (other != null) {
|
||||
other.sendMessage(
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -34,7 +34,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
@CommandDeclaration(command = "plugin",
|
||||
permission = "plots.use",
|
||||
description = "Show plugin information",
|
||||
usage = "/plot plugin",
|
||||
aliases = "version",
|
||||
category = CommandCategory.INFO)
|
||||
@ -47,7 +46,7 @@ public class PluginCmd extends SubCommand {
|
||||
Template.of("version", String.valueOf(PlotSquared.get().getVersion()))
|
||||
);
|
||||
player.sendMessage(StaticCaption.of("<gray> >> </gray><gold><bold>Authors<reset><gray>: </gray><gold>Citymonstret </gold><gray>& </gray><gold>Empire92 </gold><gray>& </gray><gold>MattBDev </gold><gray>& </gray><gold>dordsor21 </gold><gray>& </gray><gold>NotMyFault </gold><gray>& </gray><gold>SirYwell</gold>"));
|
||||
player.sendMessage(StaticCaption.of("<gray> >> </gray><gold><bold>Wiki<reset><gray>: </gray><gold>https://wiki.intellectualsites.com/plotsquared/home</gold>"));
|
||||
player.sendMessage(StaticCaption.of("<gray> >> </gray><gold><bold>Wiki<reset><gray>: </gray><gold><click:open_url>https://wiki.intellectualsites.com/plotsquared/home</gold>"));
|
||||
player.sendMessage(
|
||||
StaticCaption.of("<gray> >> </gray><gold><bold>Premium<reset><gray>: <gold><value></gold>"),
|
||||
Template.of("value", String.valueOf(PremiumVerification.isPremium()))
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -51,10 +51,9 @@ import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@CommandDeclaration(usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true|false] clear:[true|false]",
|
||||
@CommandDeclaration(usage = "/plot purge world:<world> area:<area> id:<id> owner:<owner> shared:<shared> unknown:[true | false] clear:[true | false]",
|
||||
command = "purge",
|
||||
permission = "plots.admin",
|
||||
description = "Purge all plots for a world",
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
confirmation = true)
|
||||
@ -201,7 +200,7 @@ public class Purge extends SubCommand {
|
||||
boolean finalClear = clear;
|
||||
Runnable run = () -> {
|
||||
if (Settings.DEBUG) {
|
||||
logger.info("[P2] Calculating plots to purge, please wait...");
|
||||
logger.info("Calculating plots to purge, please wait...");
|
||||
}
|
||||
HashSet<Integer> ids = new HashSet<>();
|
||||
Iterator<Plot> iterator = toDelete.iterator();
|
||||
@ -215,20 +214,20 @@ public class Purge extends SubCommand {
|
||||
try {
|
||||
ids.add(plot.temp);
|
||||
if (finalClear) {
|
||||
plot.clear(false, true, () -> {
|
||||
plot.getPlotModificationManager().clear(false, true, () -> {
|
||||
if (Settings.DEBUG) {
|
||||
logger.info("[P2] Plot {} cleared by purge", plot.getId());
|
||||
logger.info("Plot {} cleared by purge", plot.getId());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
plot.removeSign();
|
||||
plot.getPlotModificationManager().removeSign();
|
||||
}
|
||||
plot.getArea().removePlot(plot.getId());
|
||||
for (PlotPlayer<?> pp : plot.getPlayersInPlot()) {
|
||||
Purge.this.plotListener.plotEntry(pp, plot);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
logger.error("[P2] NullPointer during purge detected. This is likely"
|
||||
logger.error("NullPointer during purge detected. This is likely"
|
||||
+ " because you are deleting a world that has been removed", e);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -54,7 +54,6 @@ import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "rate",
|
||||
permission = "plots.rate",
|
||||
description = "Rate the plot",
|
||||
usage = "/plot rate [# | next | purge]",
|
||||
aliases = "rt",
|
||||
category = CommandCategory.INFO,
|
||||
@ -160,19 +159,19 @@ public class Rate extends SubCommand {
|
||||
if (index.getValue() >= Settings.Ratings.CATEGORIES.size()) {
|
||||
int rV = rating.getValue();
|
||||
PlotRateEvent event = Rate.this.eventDispatcher
|
||||
.callRating(this.player, plot, new Rating(rV));
|
||||
.callRating(this.getPlayer(), plot, new Rating(rV));
|
||||
if (event.getRating() != null) {
|
||||
plot.addRating(this.player.getUUID(), event.getRating());
|
||||
player.sendMessage(
|
||||
plot.addRating(this.getPlayer().getUUID(), event.getRating());
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_applied"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
if (Permissions
|
||||
.hasPermission(this.player, Permission.PERMISSION_COMMENT)) {
|
||||
.hasPermission(this.getPlayer(), Permission.PERMISSION_COMMENT)) {
|
||||
Command command =
|
||||
MainCommand.getInstance().getCommand(Comment.class);
|
||||
if (command != null) {
|
||||
player.sendMessage(
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("tutorial.comment_this"),
|
||||
Template.of("plot", "/plot rate")
|
||||
);
|
||||
@ -241,7 +240,7 @@ public class Rate extends SubCommand {
|
||||
plot.addRating(uuid, event.getRating());
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("ratings.rating_applied"),
|
||||
Template.of("value", plot.getId().toString())
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -38,7 +38,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "regenallroads",
|
||||
description = "Regenerate all roads in the map using the set road schematic",
|
||||
aliases = {"rgar"},
|
||||
usage = "/plot regenallroads <world> [height]",
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
@ -89,7 +88,7 @@ public class RegenAllRoads extends SubCommand {
|
||||
String name = args[0];
|
||||
PlotManager manager = area.getPlotManager();
|
||||
if (!(manager instanceof HybridPlotManager)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.of("errors.invalid_plot_world"));
|
||||
return false;
|
||||
}
|
||||
//Set<BlockVector2> chunks = ChunkManager.manager.getChunkChunks(name);
|
||||
|
@ -21,11 +21,11 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.caption.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
@ -33,7 +33,6 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "relight",
|
||||
description = "Relight your plot",
|
||||
usage = "/plot relight",
|
||||
category = CommandCategory.DEBUG,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -46,7 +45,7 @@ public class Relight extends Command {
|
||||
public CompletableFuture<Boolean> execute(final PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
player.sendMessage(StaticCaption.of("Not implemented."));
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_implemented"));
|
||||
/* final Plot plot = player.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -39,13 +39,11 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@CommandDeclaration(command = "reload",
|
||||
aliases = "rl",
|
||||
permission = "plots.admin.command.reload",
|
||||
description = "Reload translations and world settings",
|
||||
usage = "/plot reload",
|
||||
category = CommandCategory.ADMINISTRATION)
|
||||
public class Reload extends SubCommand {
|
||||
@ -117,7 +115,7 @@ public class Reload extends SubCommand {
|
||||
});
|
||||
this.worldConfiguration.save(this.worldFile);
|
||||
player.sendMessage(TranslatableCaption.of("reload.reloaded_configs"));
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
player.sendMessage(TranslatableCaption.of("reload.reload_failed"));
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -46,7 +46,6 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "remove",
|
||||
aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"},
|
||||
description = "Remove a player from a plot",
|
||||
usage = "/plot remove <player | *>",
|
||||
category = CommandCategory.SETTINGS,
|
||||
requiredType = RequiredType.NONE,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -32,8 +32,8 @@ import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public enum RequiredType {
|
||||
CONSOLE(TranslatableCaption.of("console.is_console")),
|
||||
PLAYER(TranslatableCaption.of("console.not_console")),
|
||||
CONSOLE(TranslatableCaption.of("console.not_console")),
|
||||
PLAYER(TranslatableCaption.of("console.is_console")),
|
||||
NONE(StaticCaption.of("Something went wrong: RequiredType=NONE")); // this caption should never be sent
|
||||
|
||||
private final Caption caption;
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -47,7 +47,6 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "save",
|
||||
description = "Save your plot",
|
||||
category = CommandCategory.SCHEMATIC,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.save")
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -52,7 +52,6 @@ import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "schematic",
|
||||
permission = "plots.schematic",
|
||||
description = "Schematic command",
|
||||
aliases = {"sch", "schem"},
|
||||
category = CommandCategory.SCHEMATIC,
|
||||
usage = "/plot schematic <save | saveall | paste>")
|
||||
@ -72,7 +71,7 @@ public class SchematicCmd extends SubCommand {
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Possible values: save, paste , exportall, list")
|
||||
Template.of("value", "Possible values: save, paste, exportall, list")
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@ -89,7 +88,7 @@ public class SchematicCmd extends SubCommand {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Possible values: save, paste , exportall, list")
|
||||
Template.of("value", "Possible values: save, paste, exportall, list")
|
||||
);
|
||||
break;
|
||||
}
|
||||
@ -266,7 +265,7 @@ public class SchematicCmd extends SubCommand {
|
||||
default:
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "Possible values: save, paste , exportall, list")
|
||||
Template.of("value", "Possible values: save, paste, exportall, list")
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -58,7 +58,6 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@CommandDeclaration(command = "set",
|
||||
description = "Set a plot value",
|
||||
aliases = {"s"},
|
||||
usage = "/plot set <biome | alias | home | flag> <value...>",
|
||||
permission = "plots.set",
|
||||
@ -154,8 +153,8 @@ public class Set extends SubCommand {
|
||||
BackupManager.backup(player, plot, () -> {
|
||||
plot.addRunning();
|
||||
QueueCoordinator queue = plotArea.getQueue();
|
||||
for (Plot current : plot.getConnectedPlots()) {
|
||||
current.setComponent(component, pattern, queue);
|
||||
for (final Plot current : plot.getConnectedPlots()) {
|
||||
current.getPlotModificationManager().setComponent(component, pattern, queue);
|
||||
}
|
||||
queue.setCompleteTask(plot::removeRunning);
|
||||
queue.enqueue();
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -34,7 +34,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
@CommandDeclaration(command = "sethome",
|
||||
permission = "plots.set.home",
|
||||
description = "Set the plot home to your current position",
|
||||
usage = "/plot sethome [none]",
|
||||
aliases = {"sh", "seth"},
|
||||
category = CommandCategory.SETTINGS,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -47,7 +47,6 @@ import java.util.Map.Entry;
|
||||
|
||||
@CommandDeclaration(command = "setup",
|
||||
permission = "plots.admin.command.setup",
|
||||
description = "Setup wizard for plot worlds",
|
||||
usage = "/plot setup",
|
||||
aliases = {"create"},
|
||||
category = CommandCategory.ADMINISTRATION)
|
||||
@ -61,14 +60,14 @@ public class Setup extends SubCommand {
|
||||
|
||||
public void displayGenerators(PlotPlayer<?> player) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("&6What generator do you want?");
|
||||
message.append("<gold>What generator do you want?</gold>");
|
||||
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
|
||||
if (entry.getKey().equals(PlotSquared.platform().getPluginName())) {
|
||||
message.append("\n&8 - &2").append(entry.getKey()).append(" (Default Generator)");
|
||||
message.append("\n<dark_gray> - </dark_gray><dark_green>").append(entry.getKey()).append(" (Default Generator)</dark_green>");
|
||||
} else if (entry.getValue().isFull()) {
|
||||
message.append("\n&8 - &7").append(entry.getKey()).append(" (Plot Generator)");
|
||||
message.append("\n<dark_gray> - </dark_gray><gray>").append(entry.getKey()).append(" (Plot Generator)</gray>");
|
||||
} else {
|
||||
message.append("\n&8 - &7").append(entry.getKey()).append(" (Unknown structure)");
|
||||
message.append("\n<dark_gray> - </dark_gray><gray>").append(entry.getKey()).append(" (Unknown structure)</gray>");
|
||||
}
|
||||
}
|
||||
player.sendMessage(StaticCaption.of(message.toString()));
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -39,7 +39,6 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(usage = "/plot swap <X;Z>",
|
||||
command = "swap",
|
||||
description = "Swap two plots",
|
||||
aliases = {"switch"},
|
||||
category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER)
|
||||
@ -85,7 +84,7 @@ public class Swap extends SubCommand {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
return plot1.move(plot2, () -> {
|
||||
return plot1.getPlotModificationManager().move(plot2, () -> {
|
||||
}, true).thenApply(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(TranslatableCaption.of("swap.swap_success"));
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -30,12 +30,18 @@ import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@CommandDeclaration(command = "target",
|
||||
usage = "/plot target <<plot> | nearest>",
|
||||
description = "Target a plot with your compass",
|
||||
usage = "/plot target <<X;Z> | nearest>",
|
||||
permission = "plots.target",
|
||||
requiredType = RequiredType.PLAYER,
|
||||
category = CommandCategory.INFO)
|
||||
@ -54,7 +60,7 @@ public class Target extends SubCommand {
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
Template.of("value", "/plot target <<plot> | nearest>")
|
||||
Template.of("value", "/plot target <<X;Z> | nearest>")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -79,4 +85,10 @@ public class Target extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("compass.compass_target"));
|
||||
return true;
|
||||
}
|
||||
@Override public Collection<Command> tab(final PlotPlayer player, String[] args, boolean space) {
|
||||
return Stream.of("<X;Z>", "nearest")
|
||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
.map(value -> new Command(null, false, value, "plots.target", RequiredType.NONE, null) {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -54,14 +54,17 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@CommandDeclaration(command = "template",
|
||||
permission = "plots.admin",
|
||||
description = "Create or use a world template",
|
||||
usage = "/plot template [import | export] <world> <template>",
|
||||
category = CommandCategory.ADMINISTRATION)
|
||||
public class Template extends SubCommand {
|
||||
@ -239,7 +242,8 @@ public class Template extends SubCommand {
|
||||
}
|
||||
final PlotArea area = this.plotAreaManager.getPlotAreaByString(world);
|
||||
if (area == null) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"));
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"),
|
||||
net.kyori.adventure.text.minimessage.Template.of("value", args[1]));
|
||||
return false;
|
||||
}
|
||||
final PlotManager manager = area.getPlotManager();
|
||||
@ -262,4 +266,10 @@ public class Template extends SubCommand {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override public Collection<Command> tab(final PlotPlayer player, String[] args, boolean space) {
|
||||
return Stream.of("import", "export")
|
||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
.map(value -> new Command(null, false, value, "plots.admin", RequiredType.NONE, null) {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -35,7 +35,6 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
aliases = {"attribute"},
|
||||
permission = "plots.use",
|
||||
usage = "/plot toggle <chat | chatspy | clear-confirmation | time | titles | worldedit>",
|
||||
description = "Toggle per user settings",
|
||||
requiredType = RequiredType.NONE,
|
||||
category = CommandCategory.SETTINGS)
|
||||
public class Toggle extends Command {
|
||||
@ -45,8 +44,7 @@ public class Toggle extends Command {
|
||||
|
||||
@CommandDeclaration(command = "chatspy",
|
||||
aliases = {"spy"},
|
||||
permission = "plots.admin.command.chat",
|
||||
description = "Toggle plot chat spy")
|
||||
permission = "plots.admin.command.chat")
|
||||
public void chatspy(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -65,8 +63,7 @@ public class Toggle extends Command {
|
||||
|
||||
@CommandDeclaration(command = "worldedit",
|
||||
aliases = {"we", "wea"},
|
||||
permission = "plots.worldedit.bypass",
|
||||
description = "Toggle worldedit area restrictions")
|
||||
permission = "plots.worldedit.bypass")
|
||||
public void worldedit(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -84,8 +81,7 @@ public class Toggle extends Command {
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "chat",
|
||||
permission = "plots.toggle.chat",
|
||||
description = "Toggle plot chat")
|
||||
permission = "plots.toggle.chat")
|
||||
public void chat(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -103,8 +99,7 @@ public class Toggle extends Command {
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "clear-confirmation",
|
||||
permission = "plots.admin.command.autoclear",
|
||||
description = "Toggle autoclear confirmation")
|
||||
permission = "plots.admin.command.autoclear")
|
||||
public void clearConfirmation(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -122,8 +117,7 @@ public class Toggle extends Command {
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "titles",
|
||||
permission = "plots.toggle.titles",
|
||||
description = "Toggle plot title messages")
|
||||
permission = "plots.toggle.titles")
|
||||
public void titles(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -141,8 +135,7 @@ public class Toggle extends Command {
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "time",
|
||||
permission = "plots.toggle.time",
|
||||
description = "Toggle plot time settings")
|
||||
permission = "plots.toggle.time")
|
||||
public void time(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
@ -160,8 +153,7 @@ public class Toggle extends Command {
|
||||
}
|
||||
|
||||
@CommandDeclaration(command = "debug",
|
||||
permission = "plots.toggle.debug",
|
||||
description = "Toggle plot debugging")
|
||||
permission = "plots.toggle.debug")
|
||||
public void debug(Command command, PlotPlayer<?> player, String[] args,
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -57,7 +57,6 @@ import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "trim",
|
||||
permission = "plots.admin",
|
||||
description = "Delete unmodified portions of your plotworld",
|
||||
usage = "/plot trim <world> [regenerate]",
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
category = CommandCategory.ADMINISTRATION)
|
||||
@ -86,7 +85,7 @@ public class Trim extends SubCommand {
|
||||
*
|
||||
* @param world The world
|
||||
* @param result (viable = .mcr to trim, nonViable = .mcr keep)
|
||||
* @return
|
||||
* @return success or not
|
||||
*/
|
||||
public static boolean getTrimRegions(String world,
|
||||
final RunnableVal2<Set<BlockVector2>, Set<BlockVector2>> result) {
|
||||
@ -145,15 +144,15 @@ public class Trim extends SubCommand {
|
||||
@Override public void run(Set<BlockVector2> viable, final Set<BlockVector2> nonViable) {
|
||||
Runnable regenTask;
|
||||
if (regen) {
|
||||
logger.info("[P2] Starting regen task");
|
||||
logger.info("[P2] - This is a VERY slow command");
|
||||
logger.info("[P2] - It will say 'Trim done!' when complete");
|
||||
logger.info("Starting regen task");
|
||||
logger.info(" - This is a VERY slow command");
|
||||
logger.info(" - It will say 'Trim done!' when complete");
|
||||
regenTask = new Runnable() {
|
||||
@Override public void run() {
|
||||
if (nonViable.isEmpty()) {
|
||||
Trim.TASK = false;
|
||||
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
|
||||
logger.info("[P2] Trim done!");
|
||||
logger.info("Trim done!");
|
||||
return;
|
||||
}
|
||||
Iterator<BlockVector2> iterator = nonViable.iterator();
|
||||
@ -203,7 +202,7 @@ public class Trim extends SubCommand {
|
||||
regenTask = () -> {
|
||||
Trim.TASK = false;
|
||||
player.sendMessage(TranslatableCaption.of("trim.trim_done"));
|
||||
logger.info("[P2] Trim done!");
|
||||
logger.info("Trim done!");
|
||||
};
|
||||
}
|
||||
regionManager.deleteRegionFiles(world, viable, regenTask);
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -52,7 +52,6 @@ import java.util.concurrent.TimeoutException;
|
||||
aliases = {"t"},
|
||||
requiredType = RequiredType.PLAYER,
|
||||
usage = "/plot trust <player | *>",
|
||||
description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.",
|
||||
category = CommandCategory.SETTINGS)
|
||||
public class Trust extends Command {
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -43,7 +43,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "unlink",
|
||||
aliases = {"u", "unmerge"},
|
||||
description = "Unlink a mega-plot",
|
||||
usage = "/plot unlink [createroads]",
|
||||
requiredType = RequiredType.PLAYER,
|
||||
category = CommandCategory.SETTINGS,
|
||||
@ -96,7 +95,7 @@ public class Unlink extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
if (!plot.unlinkPlot(createRoad, createRoad)) {
|
||||
if (!plot.getPlotModificationManager().unlinkPlot(createRoad, createRoad)) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.unmerge_cancelled"));
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -57,7 +57,6 @@ import java.util.concurrent.TimeoutException;
|
||||
|
||||
@CommandDeclaration(command = "visit",
|
||||
permission = "plots.visit",
|
||||
description = "Visit someones plot",
|
||||
usage = "/plot visit <player> | <alias> | <plot> [area]|[#] [#]",
|
||||
aliases = {"v", "tp", "teleport", "goto", "warp"},
|
||||
requiredType = RequiredType.PLAYER,
|
||||
|
@ -21,7 +21,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
@ -29,7 +29,6 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
|
||||
@CommandDeclaration(command = "weanywhere",
|
||||
permission = "plots.worldedit.bypass",
|
||||
description = "Force bypass of WorldEdit restrictions",
|
||||
aliases = {"wea"},
|
||||
usage = "/plot weanywhere",
|
||||
requiredType = RequiredType.NONE,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user