mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Add an option to teleport the player on plot clearing or deletion
This commit is contained in:
parent
ff70d5db14
commit
60859de0bd
@ -31,6 +31,7 @@ import com.plotsquared.core.configuration.Settings;
|
|||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
|
import com.plotsquared.core.events.TeleportCause;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
@ -89,6 +90,10 @@ public class Clear extends Command {
|
|||||||
checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions
|
checkTrue(force || !Settings.Done.RESTRICT_BUILDING || !DoneFlag.isDone(plot) || Permissions
|
||||||
.hasPermission(player, "plots.continue"), TranslatableCaption.of("done.done_already_done"));
|
.hasPermission(player, "plots.continue"), TranslatableCaption.of("done.done_already_done"));
|
||||||
confirm.run(this, () -> {
|
confirm.run(this, () -> {
|
||||||
|
if (Settings.Teleport.ON_CLEAR) {
|
||||||
|
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
|
||||||
|
});
|
||||||
|
}
|
||||||
BackupManager.backup(player, plot, () -> {
|
BackupManager.backup(player, plot, () -> {
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> {
|
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.command;
|
package com.plotsquared.core.command;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.core.events.TeleportCause;
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
@ -98,6 +99,10 @@ public class Delete extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
if (Settings.Teleport.ON_DELETE) {
|
||||||
|
plot.teleportPlayer(player, TeleportCause.COMMAND, result -> {
|
||||||
|
});
|
||||||
|
}
|
||||||
boolean result = plot.getPlotModificationManager().deletePlot(player, () -> {
|
boolean result = plot.getPlotModificationManager().deletePlot(player, () -> {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
if (this.econHandler.isEnabled(plotArea)) {
|
if (this.econHandler.isEnabled(plotArea)) {
|
||||||
|
@ -159,6 +159,8 @@ public class Settings extends Config {
|
|||||||
Teleport.DELAY = config.getInt("teleport.delay", Teleport.DELAY);
|
Teleport.DELAY = config.getInt("teleport.delay", Teleport.DELAY);
|
||||||
Teleport.ON_LOGIN = config.getBoolean("teleport.on_login", Teleport.ON_LOGIN);
|
Teleport.ON_LOGIN = config.getBoolean("teleport.on_login", Teleport.ON_LOGIN);
|
||||||
Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
|
Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
|
||||||
|
Teleport.ON_CLEAR = config.getBoolean("teleport.on_clear", Teleport.ON_CLEAR);
|
||||||
|
Teleport.ON_DELETE = config.getBoolean("teleport.on_delete", Teleport.ON_DELETE);
|
||||||
|
|
||||||
// WorldEdit
|
// WorldEdit
|
||||||
//WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
|
//WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
|
||||||
@ -494,6 +496,8 @@ public class Settings extends Config {
|
|||||||
@Comment({"Add a delay to all teleport commands (in seconds)",
|
@Comment({"Add a delay to all teleport commands (in seconds)",
|
||||||
"Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
|
"Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
|
||||||
public static int DELAY = 0;
|
public static int DELAY = 0;
|
||||||
|
@Comment("Teleport outside of the plot before clearing") public static boolean ON_CLEAR = false;
|
||||||
|
@Comment("Teleport outside of the plot before deleting") public static boolean ON_DELETE = false;
|
||||||
@Comment("The visit command is ordered by world instead of globally") public static boolean
|
@Comment("The visit command is ordered by world instead of globally") public static boolean
|
||||||
PER_WORLD_VISIT = false;
|
PER_WORLD_VISIT = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user