Fix ColorCommand
Fix RegionCommand Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
680d72c2be
Commit
07a7de7f21
@ -30,8 +30,6 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
|
||||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
@ -40,7 +38,6 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -50,9 +47,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@UtilityClass
|
@UtilityClass
|
||||||
@ -101,11 +96,21 @@ public class Region_15 {
|
|||||||
changeColor(clipboard, pasteOptions.getColor());
|
changeColor(clipboard, pasteOptions.getColor());
|
||||||
}
|
}
|
||||||
if (pasteOptions.isOnlyColors()) {
|
if (pasteOptions.isOnlyColors()) {
|
||||||
|
Set<String> blocks = new HashSet<>();
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_wool");
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_terracotta");
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_stained_glass");
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_stained_glass_pane");
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete");
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_concrete_powder");
|
||||||
|
blocks.add("minecraft:" + pasteOptions.getColor().name().toLowerCase() + "_carpet");
|
||||||
|
|
||||||
e.setMask(new AbstractExtentMask(clipboard) {
|
e.setMask(new AbstractExtentMask(clipboard) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 blockVector3) {
|
public boolean test(BlockVector3 blockVector3) {
|
||||||
BaseBlock block = getExtent().getFullBlock(blockVector3);
|
BaseBlock block = getExtent().getFullBlock(blockVector3);
|
||||||
return !(block.equals(WOOL) || block.equals(CLAY) || block.equals(GLASS) || block.equals(GLASS2) || block.equals(GLASS_PANE) || block.equals(CARPET) || block.equals(CONCRETE) || block.equals(CONCRETE2) || block.equals(CONCRETE_POWDER));
|
String blockName = block.toString().toLowerCase();
|
||||||
|
return blocks.contains(blockName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -415,10 +415,7 @@ REGION_COLOR_HELP_1=§8/§ecolor §8[§7Color§8] §8- §7Setze die Farbe der Re
|
|||||||
REGION_COLOR_HELP_2=§8/§ecolor §8[§7Color§8] §8[§7Type§8] §8- §7Setze die Farbe der Region oder Global
|
REGION_COLOR_HELP_2=§8/§ecolor §8[§7Color§8] §8[§7Type§8] §8- §7Setze die Farbe der Region oder Global
|
||||||
REGION_COLOR_GLOBAL=§7Alle Regions farben auf §e{0}§7 gesetzt
|
REGION_COLOR_GLOBAL=§7Alle Regions farben auf §e{0}§7 gesetzt
|
||||||
REGION_COLOR_NO_REGION=§cDu befindest dich derzeit in keiner Region
|
REGION_COLOR_NO_REGION=§cDu befindest dich derzeit in keiner Region
|
||||||
REGION_COLOR_REGION=§7Regions farben auf §e{0}§7 gesetzt
|
|
||||||
REGION_COLOR_NO_PERMS=§cDies ist nicht deine Welt!
|
REGION_COLOR_NO_PERMS=§cDies ist nicht deine Welt!
|
||||||
REGION_COLOR_UPDATE=§7Klicke §e§lHIER §7um die Farbe anzuwenden
|
|
||||||
REGION_COLOR_UPDATE_HOVER=§8/§eregion restore
|
|
||||||
REGION_DAMAGE_HELP_1=§8/§edamage §8- §7Toggle Spielerschaden
|
REGION_DAMAGE_HELP_1=§8/§edamage §8- §7Toggle Spielerschaden
|
||||||
REGION_DAMAGE_NO_PERMS=§cDu darfst hier nicht Spielerschaden (de-)aktivieren
|
REGION_DAMAGE_NO_PERMS=§cDu darfst hier nicht Spielerschaden (de-)aktivieren
|
||||||
REGION_DAMAGE_ENABLED=§cRegions Spielerschaden deaktiviert
|
REGION_DAMAGE_ENABLED=§cRegions Spielerschaden deaktiviert
|
||||||
@ -450,6 +447,8 @@ REGION_REGION_NOTHING_REDO=§cNichts zum wiederhohlen
|
|||||||
REGION_REGION_REDID=§7Letzte Aktion wiederhohlt
|
REGION_REGION_REDID=§7Letzte Aktion wiederhohlt
|
||||||
REGION_REGION_RESTORED=§7Region zurückgesetzt
|
REGION_REGION_RESTORED=§7Region zurückgesetzt
|
||||||
REGION_REGION_FAILED_RESTORE=§cFehler beim Zurücksetzen der Region
|
REGION_REGION_FAILED_RESTORE=§cFehler beim Zurücksetzen der Region
|
||||||
|
REGION_REGION_COLORED=§7Region umgefärbt
|
||||||
|
REGION_REGION_FAILED_COLORED=§cFehler beim umfärben der Region
|
||||||
REGION_REGION_NO_SCHEM=§cSchematic nicht gefunden
|
REGION_REGION_NO_SCHEM=§cSchematic nicht gefunden
|
||||||
REGION_REGION_TP_COPY=§7Zum Kopierpunkt teleportiert
|
REGION_REGION_TP_COPY=§7Zum Kopierpunkt teleportiert
|
||||||
REGION_REGION_NO_REGION=§cDu bist in keiner Region
|
REGION_REGION_NO_REGION=§cDu bist in keiner Region
|
||||||
|
@ -20,17 +20,25 @@
|
|||||||
package de.steamwar.bausystem.features.region;
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.config.BauServer;
|
import de.steamwar.bausystem.config.BauServer;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
import de.steamwar.bausystem.linkage.LinkedInstance;
|
import de.steamwar.bausystem.linkage.LinkedInstance;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
||||||
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@Linked(LinkageType.COMMAND)
|
@Linked(LinkageType.COMMAND)
|
||||||
public class ColorCommand extends SWCommand {
|
public class ColorCommand extends SWCommand {
|
||||||
|
|
||||||
@ -69,9 +77,11 @@ public class ColorCommand extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
region.set(Flag.COLOR, color);
|
region.set(Flag.COLOR, color);
|
||||||
BauSystem.MESSAGE.send("REGION_COLOR_REGION", p, color.name().toLowerCase());
|
try {
|
||||||
if (colorizationType == ColorizationType.LOCAL) {
|
region.reset(null, RegionType.NORMAL, RegionExtensionType.NORMAL, true, true);
|
||||||
sendHowToUpdate(p);
|
RegionUtils.message(region, "REGION_REGION_COLORED");
|
||||||
|
} catch (IOException e) {
|
||||||
|
BauSystem.MESSAGE.send("REGION_REGION_FAILED_COLORED", p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,10 +98,6 @@ public class ColorCommand extends SWCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendHowToUpdate(Player p) {
|
|
||||||
BauSystem.MESSAGE.send("REGION_COLOR_UPDATE", p, BauSystem.MESSAGE.parse("REGION_COLOR_UPDATE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/region restore"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ColorizationType {
|
public enum ColorizationType {
|
||||||
LOCAL,
|
LOCAL,
|
||||||
GLOBAL
|
GLOBAL
|
||||||
|
@ -131,11 +131,11 @@ public class RegionCommand extends SWCommand {
|
|||||||
if(checkGlobalRegion(region, p)) return;
|
if(checkGlobalRegion(region, p)) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
region.reset(null, RegionType.NORMAL, RegionExtensionType.NORMAL, true, true);
|
region.reset(null, RegionType.NORMAL, RegionExtensionType.NORMAL, true, false);
|
||||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed restore", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public class RegionCommand extends SWCommand {
|
|||||||
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
RegionUtils.message(region, "REGION_REGION_RESTORED");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p);
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed reset", e);
|
Bukkit.getLogger().log(Level.WARNING, "Failed restore", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren