SteamWar/BauSystem2.0
Archiviert
12
0

QOL #203

Zusammengeführt
YoyoNow hat 44 Commits von QOL nach master 2023-10-06 14:59:48 +02:00 zusammengeführt
8 geänderte Dateien mit 89 neuen und 27 gelöschten Zeilen
Nur Änderungen aus Commit bf2de904dc werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -140,22 +140,21 @@ BAU_INFO_ITEM_NAME = §eBau-Management
## This is used in BauInfoBauGuiItem.java
BAU_INFO_ITEM_LORE_TNT = §7TNT§8: §e{0}
BAU_INFO_ITEM_LORE_FREEZE = §7Freeze§8: §e{0}
BAU_INFO_ITEM_LORE_DAMAGE=
BAU_INFO_ITEM_LORE_FIRE = §7Fire§8: §e{0}
BAU_INFO_ITEM_LORE_COLOR = §7Color§8: §e{0}
BAU_INFO_ITEM_LORE_PROTECT = §7Protect§8: §e{0}
BAU_INFO_ITEM_LORE_ITEMS = §7Items§8: §e{0}
BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Information regarding this build server
BAU_INFO_COMMAND_OWNER = §7Owner: §e{0}
BAU_INFO_COMMAND_MEMBER = §7Member: §e
BAU_INFO_COMMAND_OWNER = §7Owner§8: §e{0}
BAU_INFO_COMMAND_MEMBER = §7Member §8[§7{0}§8]§8: §e
BAU_INFO_MEMBER_INFO = §e{0}§8[{1}§8,{2}§8] §8
BAU_INFO_MEMBER_WE_ALLOW = §aWE
BAU_INFO_MEMBER_WE_DISALLOW = §cWE
BAU_INFO_MEMBER_WORLD_ALLOW = §aW
BAU_INFO_MEMBER_WORLD_DISALLOW = §cW
BAU_INFO_COMMAND_FLAG = §e{0} §8: §7{1}
BAU_INFO_COMMAND_TPS = TPS:§e
BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1}
BAU_INFO_COMMAND_TPS = §7TPS§8:§e
# Countingwand
COUNTINGWAND_COMMAND_HELP = §8/§ecountingwand §8- §7Receive a CountingWand
@ -168,10 +167,10 @@ COUNTINGWAND_MESSAGE_VOLUME = §e{0}
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
# Design Endstone
DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesign endstone §8- §7Show where Endstone is
DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesignendstone §8- §7Highlight endstone in design
DESIGN_ENDSTONE_REGION_ERROR = §cThis region has no build area
DESIGN_ENDSTONE_ENABLE = §aEndstone is activated
DESIGN_ENDSTONE_DISABLE = §cEndstone is deactivated
DESIGN_ENDSTONE_ENABLE = §aEndstone is highlighted
DESIGN_ENDSTONE_DISABLE = §cEndstone is no longer hightlighted
# Detonator
DETONATOR_LOC_REMOVE = §e{0} removed
@ -202,7 +201,7 @@ DETONATOR_INVALID_POINT=§cOne point could not be activated
DETONATOR_INVALID_POINTS=§c{0} points could not be activated
DETONATOR_INVALID_BLOCK=§eThe block could not be addded
# Hotbar
HOTBAR_HELP_GENERIC=§7Saves a hotbar. While joining a bau with an empty inventory this hotbar will be used
HOTBAR_HELP_GENERIC=§7Saves a hotbar. While joining a bau with an empty inventory this hotbar will be used.
HOTBAR_HELP_SAVE=§8/§ehotbar save §8-§7 Saves your current hotbar
HOTBAR_HELP_LOAD=§8/§ehotbar load §8-§7 Loads the saved hotbar
HOTBAR_HELP_SHOW=§8/§ehotbar show §8-§7 Displays the saved hotbar

Datei anzeigen

@ -144,15 +144,15 @@ BAU_INFO_ITEM_LORE_COLOR = §7Farbe§8: §e{0}
BAU_INFO_ITEM_LORE_PROTECT = §7Protect§8: §e{0}
BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Gibt Informationen über den Bau
BAU_INFO_COMMAND_OWNER = §7Besitzer: §e{0}
BAU_INFO_COMMAND_MEMBER = §7Mitglieder: §e
BAU_INFO_COMMAND_OWNER = §7Besitzer§8: §e{0}
BAU_INFO_COMMAND_MEMBER = §7Mitglieder §8[§7{0}§8]§8: §e
BAU_INFO_MEMBER_INFO = §e{0}§8[{1}§8,{2}§8] §8
BAU_INFO_MEMBER_WE_ALLOW = §aWE
BAU_INFO_MEMBER_WE_DISALLOW = §cWE
BAU_INFO_MEMBER_WORLD_ALLOW = §aW
BAU_INFO_MEMBER_WORLD_DISALLOW = §cW
BAU_INFO_COMMAND_FLAG = §e{0} §8: §7{1}
BAU_INFO_COMMAND_TPS = TPS:§e
BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1}
BAU_INFO_COMMAND_TPS = §7TPS§8:§e
# Countingwand
COUNTINGWAND_COMMAND_HELP = §8/§ecountingwand §8- §7Gibt dir ein CountingWand
@ -165,10 +165,10 @@ COUNTINGWAND_MESSAGE_VOLUME = §e{0}
COUNTINGWAND_MESSAGE_DIMENSION = §e{0}§8, §e{1}§8, §e{2}
# Design Endstone
DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesign endstone §8- §7Zeige wo Endstone ist
DESIGN_ENDSTONE_COMMAND_HELP = §8/§edesign endstone §8- §7Zeige End Stone im Design
DESIGN_ENDSTONE_REGION_ERROR = §cDiese Region hat keinen Baubereich
DESIGN_ENDSTONE_ENABLE = §aEndstone ist aktiviert
DESIGN_ENDSTONE_DISABLE = §cEndstone ist deaktiviert
DESIGN_ENDSTONE_ENABLE = §aEndstone im Design ist angezeigt
DESIGN_ENDSTONE_DISABLE = §cEndstone im Design ist versteckt
# Detonator
DETONATOR_LOC_REMOVE = §e{0} entfernt

Datei anzeigen

@ -73,7 +73,7 @@ public class AttributeRemoveCommand extends SWCommand {
BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player);
return;
}
lore.removeIf(s -> s.equals("§8-§7 " + attribute));
lore.removeIf(s -> s.startsWith("§8-§7 " + attribute + "§8:"));
if (lore.size() == 1) {
itemStack.setItemMeta(null);
} else {
@ -99,15 +99,13 @@ public class AttributeRemoveCommand extends SWCommand {
return lore.stream()
.skip(1)
.map(s1 -> s1.substring(6))
.map(s1 -> s1.replace('§', '&'))
.map(s1 -> s1.replace(' ', '_'))
.map(s1 -> s1.substring(0, s1.indexOf("§8:")))
.collect(Collectors.toList());
}
@Override
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
return s.replace('_', ' ')
.replace('&', '§');
return s;
}
};
}

Datei anzeigen

@ -30,10 +30,12 @@ import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.block.data.type.Chest;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
@ -70,9 +72,28 @@ public class AutostartListener implements Listener {
if (event.getClickedBlock() == null) {
return;
}
if (event.getClickedBlock().getBlockData() instanceof Chest) {
return;
}
activate(event.getPlayer());
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
if (!(event.getPlayer() instanceof Player)) {
return;
}
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
return;
}
if (event.getInventory().getLocation() == null) {
return;
}
if (event.getInventory().getLocation().getBlock().getBlockData() instanceof Chest) {
activate((Player) event.getPlayer());
}
}
public void activate(Player player) {
Region region = Region.getRegion(player.getLocation());
if (region.isGlobal()) {

Datei anzeigen

@ -52,7 +52,7 @@ public class InfoCommand extends SWCommand {
List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID());
StringBuilder membermessage = new StringBuilder();
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p));
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p, members.size()));
for (BauweltMember member : members) {
membermessage.append(BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_INFO", p,

Datei anzeigen

@ -55,7 +55,7 @@ public class DesignEndStone {
this.maxZ = region.getMaxPointBuild().getZ();
}
private void calc() {
public void calc() {
entities.forEach(REntity::die);
entities.clear();
locations.clear();
@ -98,12 +98,17 @@ public class DesignEndStone {
if (players.contains(player)) {
players.remove(player);
entityServer.removePlayer(player);
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
} else {
players.add(player);
entityServer.addPlayer(player);
calc();
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
}
}
public boolean removePlayer(Player player) {
players.remove(player);
return players.isEmpty();
}
}

Datei anzeigen

@ -24,13 +24,19 @@ import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.command.SWCommand;
import de.steamwar.linkage.Linked;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap;
import java.util.Map;
@Linked
public class DesignEndStoneCommand extends SWCommand {
public class DesignEndStoneCommand extends SWCommand implements Listener {
public DesignEndStoneCommand() {
super("designendstone");
@ -47,4 +53,37 @@ public class DesignEndStoneCommand extends SWCommand {
}
designEndStoneMap.computeIfAbsent(region, DesignEndStone::new).toggle(player);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Region region = Region.getRegion(event.getPlayer().getLocation());
DesignEndStone designEndStone = designEndStoneMap.get(region);
if (designEndStone == null) {
return;
}
if (designEndStone.removePlayer(event.getPlayer())) {
designEndStoneMap.remove(region);
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
update(event.getBlock().getLocation());
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
BauSystem.runTaskLater(BauSystem.getInstance(), () -> {
update(event.getBlock().getLocation());
}, 1);
}
private void update(Location location) {
Region region = Region.getRegion(location);
DesignEndStone designEndStone = designEndStoneMap.get(region);
if (designEndStone == null) {
return;
}
designEndStone.calc();
}
}

Datei anzeigen

@ -48,7 +48,7 @@ public class KillcheckerVisualizer {
private static final Material[] MATERIALS = new Material[] {Material.YELLOW_STAINED_GLASS, Material.ORANGE_STAINED_GLASS, Material.RED_STAINED_GLASS, Material.PURPLE_STAINED_GLASS, Material.BLACK_STAINED_GLASS};
private static final World WORLD = Bukkit.getWorlds().get(0);
private static final double SURROUND = 4;
private static final double SURROUND = 4.5;
private final Point minPoint;
private final Point maxPoint;