Hotfix CommandTestblock
Dieser Commit ist enthalten in:
Ursprung
bdf5b9d808
Commit
db86661637
@ -21,15 +21,23 @@ package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.tracer.show.ShowModeParameterType;
|
||||
import de.steamwar.bausystem.world.regions.Region;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import de.steamwar.bausystem.world.regions.RegionExtensionType;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class CommandTestblock extends SWCommand {
|
||||
@ -64,12 +72,17 @@ public class CommandTestblock extends SWCommand {
|
||||
}
|
||||
|
||||
|
||||
@Register({"schem"})
|
||||
@Register
|
||||
public void schematicTestblockCommand(Player p, String s) {
|
||||
schematicTestblockCommand(p, s, RegionExtensionType.NORMAL);
|
||||
}
|
||||
|
||||
@Register({"schem"})
|
||||
@Register
|
||||
public void schematicTestblockCommand(Player p, RegionExtensionType regionExtensionType, String s) {
|
||||
schematicTestblockCommand(p, s, regionExtensionType);
|
||||
}
|
||||
|
||||
@Register
|
||||
public void schematicTestblockCommand(Player p, String s, RegionExtensionType regionExtensionType) {
|
||||
if (!permissionCheck(p)) return;
|
||||
Region region = regionCheck(p);
|
||||
@ -88,6 +101,18 @@ public class CommandTestblock extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@ClassMapper(value = RegionExtensionType.class, local = true)
|
||||
private TypeMapper<RegionExtensionType> regionExtensionTypeTypeMapper() {
|
||||
Map<String, RegionExtensionType> showModeParameterTypesMap = new HashMap<>();
|
||||
showModeParameterTypesMap.put("-normal", RegionExtensionType.NORMAL);
|
||||
showModeParameterTypesMap.put("-n", RegionExtensionType.NORMAL);
|
||||
showModeParameterTypesMap.put("-extension", RegionExtensionType.EXTENSION);
|
||||
showModeParameterTypesMap.put("-e", RegionExtensionType.EXTENSION);
|
||||
|
||||
List<String> tabCompletes = new ArrayList<>(showModeParameterTypesMap.keySet());
|
||||
return SWCommandUtils.createMapper(s -> showModeParameterTypesMap.getOrDefault(s, null), s -> tabCompletes);
|
||||
}
|
||||
|
||||
private boolean permissionCheck(Player player) {
|
||||
if (Welt.noPermission(player, Permission.WORLDEDIT)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen");
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren