Add TestblockCommand
Dieser Commit ist enthalten in:
Ursprung
0cb29d2795
Commit
3595742da1
@ -11,12 +11,15 @@ import de.steamwar.command.SWCommand;
|
|||||||
import de.steamwar.command.SWCommandUtils;
|
import de.steamwar.command.SWCommandUtils;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
public class TestblockCommand extends SWCommand {
|
public class TestblockCommand extends SWCommand {
|
||||||
@ -41,15 +44,13 @@ public class TestblockCommand extends SWCommand {
|
|||||||
if (!permissionCheck(p)) return;
|
if (!permissionCheck(p)) return;
|
||||||
Region region = regionCheck(p);
|
Region region = regionCheck(p);
|
||||||
if (region == null) return;
|
if (region == null) return;
|
||||||
// TODO: implement this
|
|
||||||
/*
|
|
||||||
try {
|
try {
|
||||||
region.resetTestblock(null, regionExtensionType == RegionExtensionType.EXTENSION);
|
region.reset(RegionType.TESTBLOCK, regionExtensionType);
|
||||||
p.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
p.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,15 +74,13 @@ public class TestblockCommand extends SWCommand {
|
|||||||
p.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
p.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: implement this
|
|
||||||
/*
|
|
||||||
try {
|
try {
|
||||||
region.resetTestblock(schem, regionExtensionType == RegionExtensionType.EXTENSION);
|
region.reset(schem, RegionType.TESTBLOCK, regionExtensionType);
|
||||||
p.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
p.sendMessage(BauSystem.PREFIX + "§7Testblock zurückgesetzt");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks");
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassMapper(value = RegionExtensionType.class, local = true)
|
@ClassMapper(value = RegionExtensionType.class, local = true)
|
||||||
|
@ -26,6 +26,7 @@ import de.steamwar.bausystem.region.loader.RegionLoader;
|
|||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.bausystem.shared.SizedStack;
|
import de.steamwar.bausystem.shared.SizedStack;
|
||||||
|
import de.steamwar.sql.Schematic;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -33,6 +34,7 @@ import yapion.hierarchy.types.YAPIONObject;
|
|||||||
import yapion.hierarchy.types.YAPIONType;
|
import yapion.hierarchy.types.YAPIONType;
|
||||||
import yapion.hierarchy.types.YAPIONValue;
|
import yapion.hierarchy.types.YAPIONValue;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -298,19 +300,51 @@ public class Region {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset(RegionType regionType) {
|
boolean hasReset(RegionType regionType) {
|
||||||
if (!hasType(regionType)) {
|
if (!hasType(regionType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (regionType) {
|
||||||
|
case TESTBLOCK:
|
||||||
|
return prototype.getTestblock().getSchematicFile() != null;
|
||||||
|
case BUILD:
|
||||||
|
return prototype.getBuild().getSchematicFile() != null;
|
||||||
|
default:
|
||||||
|
case NORMAL:
|
||||||
|
return prototype.getSchematicFile() != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(RegionType regionType) throws IOException {
|
||||||
|
reset(null, regionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(Schematic schematic, RegionType regionType) throws IOException {
|
||||||
|
reset(schematic, regionType, RegionExtensionType.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(RegionType regionType, RegionExtensionType regionExtensionType) throws IOException {
|
||||||
|
reset(null, regionType, regionExtensionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(Schematic schematic, RegionType regionType, RegionExtensionType regionExtensionType) throws IOException {
|
||||||
|
if (!hasReset(regionType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (regionExtensionType == RegionExtensionType.EXTENSION && !hasExtensionType(regionType)) {
|
||||||
|
regionExtensionType = RegionExtensionType.NORMAL;
|
||||||
|
}
|
||||||
switch (regionType) {
|
switch (regionType) {
|
||||||
case BUILD:
|
case BUILD:
|
||||||
|
|
||||||
case TESTBLOCK:
|
case TESTBLOCK:
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isGlobal() {
|
public boolean isGlobal() {
|
||||||
return this == GlobalRegion.getInstance();
|
return this == GlobalRegion.getInstance();
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren