Remove RegionSkins

This commit is contained in:
2025-07-31 21:44:24 +02:00
parent 56680119e2
commit 13ef131401
4 changed files with 0 additions and 152 deletions
@@ -30,30 +30,22 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.util.SelectCommand;
import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionSkins;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.shared.Pair;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.bausystem.utils.PasteBuilder;
import de.steamwar.bausystem.utils.WorldEditUtils;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.sql.SchematicNode;
import net.md_5.bungee.api.chat.ClickEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Collectors;
@Linked
public class RegionCommand extends SWCommand {
@@ -170,31 +162,6 @@ public class RegionCommand extends SWCommand {
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
}
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN_INFO")
@Register("skin")
public void changeSkinCommand(Player p) {
Region region = Region.getRegion(p.getLocation());
if (checkGlobalRegion(region, p)) {
return;
}
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_INFO", p, region.getSkins().getCurrentSkin().getName());
String creator = region.getSkins().getCurrentSkin().getCreator();
if (creator != null) {
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_INFO_CREATOR", p, creator);
}
}
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
@Register("skin")
public void changeSkinCommand(@Validator Player p, @Mapper("skinTypeMapper") @ErrorMessage("REGION_REGION_CHANGESKIN_UNKNOWN") RegionSkins.Skin skin) {
if (skin.apply()) {
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_CHANGE", p, skin.getName());
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_CHANGE_UPDATE", p, BauSystem.MESSAGE.parse("REGION_REGION_CHANGESKIN_CHANGE_UPDATE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/reset"));
} else {
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_INVALID", p);
}
}
@Register(value = "copy", description = "REGION_REGION_HELP_COPY")
public void copyCommand(@Validator Player p, @OptionalValue("") @StaticValue(value = {"", "-e", "-s"}, allowISE = true) int option) {
Region region = Region.getRegion(p.getLocation());
@@ -285,25 +252,4 @@ public class RegionCommand extends SWCommand {
private BlockVector3 toBlockVector3(Point point) {
return BlockVector3.at(point.getX(), point.getY(), point.getZ());
}
@Mapper(value = "skinTypeMapper", local = true)
private TypeMapper<RegionSkins.Skin> skinTypeMapper() {
return new TypeMapper<RegionSkins.Skin>() {
@Override
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
Player p = (Player) commandSender;
Region region = Region.getRegion(p.getLocation());
if (region.getType().isGlobal()) {
return Collections.emptyList();
}
return region.getSkins().list().stream().map(skin -> skin.getName().replace(' ', '_')).collect(Collectors.toList());
}
@Override
public RegionSkins.Skin map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return Region.getRegion(((Player) commandSender).getLocation()).getSkins().get(s.replace('_', ' '));
}
};
}
}
@@ -71,9 +71,6 @@ public interface Region {
@NonNull
RegionBackups getBackups();
@NonNull
RegionSkins getSkins();
interface Area {
Area EMPTY = new Area() {
@@ -1,90 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import java.util.List;
public interface RegionSkins {
@RequiredArgsConstructor
@Getter
abstract class Skin {
@NonNull
private final String name;
@NonNull
private final String creator;
@CheckReturnValue
public abstract boolean apply();
public static final Skin GLOBAL = new Skin("Global", "§eSteam§8War") {
@Override
public boolean apply() {
return false;
}
};
}
@NonNull
Skin getCurrentSkin();
@NonNull
List<Skin> list();
boolean has(@NonNull String name);
@Nullable
Skin get(@NonNull String name);
RegionSkins GLOBAL = new RegionSkins() {
@Override
public @NonNull Skin getCurrentSkin() {
return Skin.GLOBAL;
}
@Override
public @NonNull List<Skin> list() {
return List.of(Skin.GLOBAL);
}
@Override
public boolean has(@NonNull String name) {
return Skin.GLOBAL.name.equals(name);
}
@Nullable
@Override
public Skin get(@NonNull String name) {
if (Skin.GLOBAL.name.equals(name)) {
return Skin.GLOBAL;
} else {
return null;
}
}
};
}
@@ -136,9 +136,4 @@ public final class FixedGlobalRegion implements Region {
public @NonNull RegionBackups getBackups() {
return RegionBackups.EMPTY;
}
@Override
public @NonNull RegionSkins getSkins() {
return RegionSkins.GLOBAL;
}
}