SteamWar/BauSystem
Archiviert
13
0

Add '/rg restore' to restore broken blocks not self set ones

Dieser Commit ist enthalten in:
yoyosource 2021-04-04 21:31:33 +02:00
Ursprung fc7e502a16
Commit 738954f669

Datei anzeigen

@ -58,7 +58,9 @@ public class CommandRegion extends SWCommand {
@Register("restore") @Register("restore")
public void genericRestoreCommand(Player p) { public void genericRestoreCommand(Player p) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
Region region = regionCheck(p); Region region = Region.getRegion(p.getLocation());
if(checkGlobalRegion(region, p)) return;
if (region == null) return; if (region == null) return;
try { try {
region.reset(null, true); region.reset(null, true);
@ -72,7 +74,9 @@ public class CommandRegion extends SWCommand {
@Register("restore") @Register("restore")
public void schematicRestoreCommand(Player p, String s) { public void schematicRestoreCommand(Player p, String s) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
Region region = regionCheck(p); Region region = Region.getRegion(p.getLocation());
if(checkGlobalRegion(region, p)) return;
if (region == null) return; if (region == null) return;
Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId()); Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId());
if (schem == null) { if (schem == null) {
@ -104,15 +108,6 @@ public class CommandRegion extends SWCommand {
return true; return true;
} }
private Region regionCheck(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region == Region.GlobalRegion.getInstance()) {
player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region");
return null;
}
return region;
}
enum Action { enum Action {
UNDO, UNDO,
REDO REDO