Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
fd7eeb9177
Commit
637e5e4f42
@ -951,6 +951,8 @@ REGION_REGION_HELP_COPYPOINT=§8/§eregion copypoint §8- §7Teleportiere dich z
|
||||
REGION_REGION_HELP_TESTBLOCKPOINT=§8/§eregion testblockpoint §8- §7Teleportiere dich zum Regions Testblockpunkt
|
||||
REGION_REGION_HELP_CHANGETYPE_INFO=§8/§eregion changetype §8- §7Gebe den Regions Type aus
|
||||
REGION_REGION_HELP_CHANGETYPE=§8/§eregion changetype §8[§7Type§8] §8- §8Setzte den Regions Type
|
||||
REGION_REGION_HELP_CHANGESKIN_INFO=§8/§eregion changeskin §8- §7Gebe den Regions Skin aus
|
||||
REGION_REGION_HELP_CHANGESKIN=§8/§eregion changeskin §8[§7Skin§8] §8- §8Setzte den Regions Skin
|
||||
REGION_REGION_NOTHING_UNDO=§cNichts zum rückgängig machen
|
||||
REGION_REGION_UNDID=§7Letzte Aktion rückgangig gemacht
|
||||
REGION_REGION_NOTHING_REDO=§cNichts zum wiederhohlen
|
||||
@ -972,6 +974,12 @@ REGION_REGION_CHANGETYPE_INVALID=§cRegions Type ist nicht erlaubt hier
|
||||
REGION_REGION_CHANGETYPE_CHANGE=§7Regions Type ist auf §e{0}§7 geändert
|
||||
REGION_REGION_CHANGETYPE_CHANGE_UPDATE=§7Klicke §e§lHIER §7um den Type anzuwenden
|
||||
REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER=§8/§ereset
|
||||
REGION_REGION_CHANGESKIN_INFO=§7Regions Skin ist §e{0}
|
||||
REGION_REGION_CHANGESKIN_UNKNOWN=§cRegions Skin ist nicht valide
|
||||
REGION_REGION_CHANGESKIN_INVALID=§cRegions Skin ist nicht erlaubt hier
|
||||
REGION_REGION_CHANGESKIN_CHANGE=§7Regions Skin ist auf §e{0}§7 geändert
|
||||
REGION_REGION_CHANGESKIN_CHANGE_UPDATE=§7Klicke §e§lHIER §7um den Skin anzuwenden
|
||||
REGION_REGION_CHANGESKIN_CHANGE_UPDATE_HOVER=§8/§ereset
|
||||
REGION_RESET_HELP_RESET=§8/§ereset §8- §7Setzte die Region zurück
|
||||
REGION_RESET_HELP_SCHEMATIC=§8/§ereset §8[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück
|
||||
REGION_RESET_RESETED=§7Region zurückgesetzt
|
||||
|
@ -40,6 +40,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@ -199,6 +200,35 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@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.getSkin());
|
||||
}
|
||||
|
||||
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
|
||||
@Register("skin")
|
||||
public void changeSkinCommand(@Guard("WORLD") Player p, @Mapper("skinTypeMapper") String s) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
if (!region.getPrototype().getSkinMap().containsKey(s)) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_UNKNOWN", p);
|
||||
} else {
|
||||
if (region.setSkin(s)) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGESKIN_CHANGE", p, s);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Mapper(value = "regionTypeMapper", local = true)
|
||||
private TypeMapper<String> regionTypeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@ -206,7 +236,7 @@ public class RegionCommand extends SWCommand {
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
Player p = (Player) commandSender;
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
if (region.isGlobal()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return region.getPrototypes().stream().map(Prototype::getByName).map(Prototype::getDisplayName).map(c -> c.replace(' ', '_')).collect(Collectors.toList());
|
||||
@ -219,6 +249,26 @@ public class RegionCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
|
||||
@Mapper(value = "skinTypeMapper", local = true)
|
||||
private TypeMapper<String> skinTypeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, String[] strings, String s) {
|
||||
Player p = (Player) commandSender;
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return region.getPrototype().getSkinMap().keySet().stream().map(c -> c.replace(' ', '_')).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
return s.replace('_', ' ');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Guard(value = "WORLD", local = true)
|
||||
public GuardChecker worldGuard() {
|
||||
return (commandSender, guardCheckType, strings, s) -> {
|
||||
|
@ -145,8 +145,9 @@ public class Region {
|
||||
generatePrototypeData(Prototype.getByName(regionConfig.getPlainValue("prototype")), point);
|
||||
}
|
||||
if (prototype != null) {
|
||||
skin = regionConfig.getPlainValueOrDefault("skin", prototype.getDefaultSkin());
|
||||
skin = regionData.getPlainValueOrDefault("skin", prototype.getDefaultSkin());
|
||||
}
|
||||
regionData.add("skin", skin);
|
||||
|
||||
if (!hasType(RegionType.BUILD) || !hasType(RegionType.TESTBLOCK)) {
|
||||
flagStorage.set(Flag.TNT, TNTMode.DENY);
|
||||
@ -317,6 +318,7 @@ public class Region {
|
||||
region.skin = skinName;
|
||||
return true;
|
||||
});
|
||||
regionData.add("skin", skin);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren