mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Leave a note when using deprecated commands
This commit is contained in:
parent
9dd35e87d6
commit
c9b012ea5b
@ -28,9 +28,11 @@ package com.plotsquared.core.command;
|
|||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Deprecated in favor of "/plot toggle chat" and scheduled for removal within the next major release.
|
* @deprecated In favor of "/plot toggle chat" and
|
||||||
|
* scheduled for removal within the next major release.
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true)
|
||||||
@CommandDeclaration(command = "chat",
|
@CommandDeclaration(command = "chat",
|
||||||
@ -44,6 +46,10 @@ public class Chat extends SubCommand {
|
|||||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||||
PlotArea area = player.getPlotAreaAbs();
|
PlotArea area = player.getPlotAreaAbs();
|
||||||
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
|
check(area, TranslatableCaption.of("errors.not_in_plot_world"));
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.deprecated_commands"),
|
||||||
|
Template.of("replacement", "/plot toggle chat")
|
||||||
|
);
|
||||||
if (player.getPlotAreaAbs().isForcingPlotChat()) {
|
if (player.getPlotAreaAbs().isForcingPlotChat()) {
|
||||||
player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced"));
|
player.sendMessage(TranslatableCaption.of("chat.plot_chat_forced"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,12 +39,18 @@ import com.plotsquared.core.util.Permissions;
|
|||||||
import com.plotsquared.core.util.SchematicHandler;
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated In favor of "/plot download" (Arkitektonika) and scheduled
|
||||||
|
* for removal within the next major release.
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
@CommandDeclaration(command = "save",
|
@CommandDeclaration(command = "save",
|
||||||
category = CommandCategory.SCHEMATIC,
|
category = CommandCategory.SCHEMATIC,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
@ -106,7 +112,7 @@ public class Save extends SubCommand {
|
|||||||
.replaceAll("[^A-Za-z0-9]", "");
|
.replaceAll("[^A-Za-z0-9]", "");
|
||||||
final String file = time + '_' + world1 + '_' + id.getX() + '_' + id.getY() + '_' + size;
|
final String file = time + '_' + world1 + '_' + id.getX() + '_' + id.getY() + '_' + size;
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
schematicHandler.upload(compoundTag, uuid, file, new RunnableVal<URL>() {
|
schematicHandler.upload(compoundTag, uuid, file, new RunnableVal<>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(URL url) {
|
public void run(URL url) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
@ -115,6 +121,10 @@ public class Save extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.sendMessage(TranslatableCaption.of("web.save_success"));
|
player.sendMessage(TranslatableCaption.of("web.save_success"));
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.deprecated_commands"),
|
||||||
|
Template.of("replacement", "/plot download")
|
||||||
|
);
|
||||||
try (final MetaDataAccess<List<String>> schematicAccess =
|
try (final MetaDataAccess<List<String>> schematicAccess =
|
||||||
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) {
|
player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_SCHEMATICS)) {
|
||||||
schematicAccess.get().ifPresent(schematics -> schematics.add(file + ".schem"));
|
schematicAccess.get().ifPresent(schematics -> schematics.add(file + ".schem"));
|
||||||
|
@ -526,7 +526,7 @@ public abstract class SchematicHandler {
|
|||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
upload(uuid, file, "schem", new RunnableVal<OutputStream>() {
|
upload(uuid, file, "schem", new RunnableVal<>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(OutputStream output) {
|
public void run(OutputStream output) {
|
||||||
try (NBTOutputStream nos = new NBTOutputStream(new GZIPOutputStream(output, true))) {
|
try (NBTOutputStream nos = new NBTOutputStream(new GZIPOutputStream(output, true))) {
|
||||||
|
@ -311,6 +311,7 @@
|
|||||||
"errors.not_implemented": "<prefix><red>Not implemented.</red>",
|
"errors.not_implemented": "<prefix><red>Not implemented.</red>",
|
||||||
"errors.stacktrace_begin": "<red>=== Begin of stacktrace ===</red>",
|
"errors.stacktrace_begin": "<red>=== Begin of stacktrace ===</red>",
|
||||||
"errors.stacktrace_end": "<red>=== End of stacktrace ===</red>",
|
"errors.stacktrace_end": "<red>=== End of stacktrace ===</red>",
|
||||||
|
"errors.deprecated_commands": "<prefix><red>You are using a deprecated command scheduled for removal within the next major release of PlotSquared. Consider using the proper alternative: <red><gold><replacement></gold>",
|
||||||
"debugpaste.latest_log": "<red><file> is larger than <size>. Please reboot the server and submit a new paste.",
|
"debugpaste.latest_log": "<red><file> is larger than <size>. Please reboot the server and submit a new paste.",
|
||||||
"debugpaste.empty_file": "<red>Skipping <file> because it's empty.",
|
"debugpaste.empty_file": "<red>Skipping <file> because it's empty.",
|
||||||
"debugpaste.skip_multiverse": "<red>Skipping Multiverse <file> because it's not in use.",
|
"debugpaste.skip_multiverse": "<red>Skipping Multiverse <file> because it's not in use.",
|
||||||
|
Loading…
Reference in New Issue
Block a user