forked from SteamWar/SteamWar
Merge branch 'main' into exposed
This commit is contained in:
@@ -13,6 +13,7 @@ steamwar.properties
|
||||
# VSCode
|
||||
bin/
|
||||
.vscode
|
||||
.settings
|
||||
|
||||
# Other
|
||||
lib
|
||||
|
||||
@@ -46,6 +46,7 @@ import de.steamwar.linkage.SpigotLinker;
|
||||
import de.steamwar.message.Message;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -128,6 +129,8 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
TraceRecorder.instance.init();
|
||||
|
||||
new WorldEditRendererCUIEditor();
|
||||
|
||||
Bukkit.getWorlds().get(0).setGameRule(GameRule.SEND_COMMAND_FEEDBACK, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -87,6 +87,7 @@ public class MaterialLazyInit {
|
||||
Block block = Bukkit.getWorlds().get(0).getBlockAt(0, 0, 0);
|
||||
block.setType(material);
|
||||
unmoveable = block.getPistonMoveReaction() == PistonMoveReaction.BLOCK || block.getPistonMoveReaction() == PistonMoveReaction.IGNORE || block.getState() instanceof TileState;
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
if (material.isItem() && material != Material.AIR) {
|
||||
|
||||
+28
-15
@@ -23,15 +23,40 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.core.CRIUWakeupEvent;
|
||||
import de.steamwar.data.BauLockState;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import de.steamwar.network.packets.server.BaulockUpdatePacket;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
@Linked
|
||||
public class BauLockStateScoreboard implements ScoreboardElement {
|
||||
public class BauLockStateScoreboard extends PacketHandler implements ScoreboardElement, Listener {
|
||||
|
||||
private static final String BAU_LOCK_CONFIG_NAME = "baulockstate";
|
||||
|
||||
@Getter
|
||||
private BauLockState lockState = loadLockState();
|
||||
|
||||
private BauLockState loadLockState() {
|
||||
String state = UserConfig.getConfig(BauServer.getInstance().getOwner(), BAU_LOCK_CONFIG_NAME);
|
||||
return state == null ? BauLockState.OPEN : BauLockState.valueOf(state);
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void handleBaulockUpdatePacket(BaulockUpdatePacket packet) {
|
||||
lockState = loadLockState();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCRIUWakeup(CRIUWakeupEvent event) {
|
||||
lockState = loadLockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScoreboardGroup getGroup() {
|
||||
return ScoreboardGroup.FOOTER;
|
||||
@@ -47,23 +72,11 @@ public class BauLockStateScoreboard implements ScoreboardElement {
|
||||
if (!BauServer.getInstance().getOwner().equals(p.getUniqueId())) {
|
||||
return null;
|
||||
}
|
||||
String state = UserConfig.getConfig(p.getUniqueId(), BAU_LOCK_CONFIG_NAME);
|
||||
switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) {
|
||||
switch (lockState) {
|
||||
case OPEN:
|
||||
return null;
|
||||
default:
|
||||
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_LOCK_" + state.toUpperCase(), p);
|
||||
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_LOCK_" + lockState.name(), p);
|
||||
}
|
||||
}
|
||||
|
||||
public enum BauLockState {
|
||||
|
||||
NOBODY,
|
||||
SUPERVISOR,
|
||||
SERVERTEAM,
|
||||
TEAM_AND_SERVERTEAM,
|
||||
TEAM,
|
||||
OPEN
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-1
@@ -84,7 +84,12 @@ public class FixedFlagStorage implements FlagStorage {
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
flagMap.clear();
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (flag == Flag.TESTBLOCK) continue;
|
||||
if (flag == Flag.COLOR) continue;
|
||||
if (flag == Flag.CHANGED) continue;
|
||||
flagMap.remove(flag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-1
@@ -91,7 +91,12 @@ public class FixedGlobalFlagStorage implements FlagStorage {
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
flagMap.clear();
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (flag == Flag.TESTBLOCK) continue;
|
||||
if (flag == Flag.COLOR) continue;
|
||||
if (flag == Flag.CHANGED) continue;
|
||||
flagMap.remove(flag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.velocitycore.util;
|
||||
package de.steamwar.data;
|
||||
|
||||
public enum BauLockState {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.network.packets.server;
|
||||
|
||||
import de.steamwar.network.packets.NetworkPacket;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BaulockUpdatePacket extends NetworkPacket {
|
||||
private static final long serialVersionUID = 6863118892424244051L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class TpsWarper21 implements TpsWarper {
|
||||
|
||||
@Override
|
||||
public void warp(float tps) {
|
||||
MinecraftServer.getServer().tickRateManager().setTickRate(tps);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.TPSWarpUtils;
|
||||
|
||||
public class TpsWarper8 implements TpsWarper {
|
||||
|
||||
@Override
|
||||
public void warp(float tps) {
|
||||
TPSWarpUtils.warp(tps);
|
||||
}
|
||||
}
|
||||
+16
-15
@@ -1,20 +1,18 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
* Copyright (C) 2025 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 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.
|
||||
* 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/>.
|
||||
* 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.fightsystem.commands;
|
||||
@@ -24,6 +22,7 @@ import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.fightsystem.utils.TpsWarper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -39,15 +38,17 @@ public class TPSWarpCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
double tps;
|
||||
float tps;
|
||||
try {
|
||||
tps = Double.parseDouble(args[0]);
|
||||
tps = Float.parseFloat(args[0]);
|
||||
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
|
||||
FightSystem.getMessage().send("TPSWARP_HELP", sender);
|
||||
return false;
|
||||
}
|
||||
|
||||
TPSWarpUtils.warp(tps);
|
||||
TpsWarper warper = TpsWarper.impl;
|
||||
warper.warp(tps);
|
||||
|
||||
FightSystem.getMessage().broadcastActionbar("TPSWARP_SET", tps);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
|
||||
public interface TpsWarper {
|
||||
TpsWarper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin());
|
||||
|
||||
void warp(float tps);
|
||||
}
|
||||
@@ -32,10 +32,14 @@ public class FlatteningWrapper21 extends FlatteningWrapper14 implements Flatteni
|
||||
public ItemStack setSkullOwner(String player) {
|
||||
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
|
||||
head.editMeta(SkullMeta.class, skullMeta -> {
|
||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player);
|
||||
PlayerProfile playerProfile = offlinePlayer.getPlayerProfile();
|
||||
if (!playerProfile.isComplete()) playerProfile.complete();
|
||||
skullMeta.setPlayerProfile(playerProfile);
|
||||
try {
|
||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player);
|
||||
PlayerProfile playerProfile = offlinePlayer.getPlayerProfile();
|
||||
playerProfile.complete();
|
||||
skullMeta.setPlayerProfile(playerProfile);
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
});
|
||||
return head;
|
||||
}
|
||||
|
||||
@@ -24,18 +24,36 @@ import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.type.Light;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.meta.BlockDataMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class WorldEditRendererCUIEditor implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
for (Type type : Type.values()) {
|
||||
type.materialCache.remove(event.getPlayer());
|
||||
type.widthCache.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCRIUSleep(CRIUSleepEvent event) {
|
||||
for (Type type : Type.values()) {
|
||||
type.materialCache.clear();
|
||||
type.widthCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public class WorldEditRendererCUIEditor {
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Type {
|
||||
@@ -43,34 +61,43 @@ public class WorldEditRendererCUIEditor {
|
||||
CLIPBOARD("cui_clipboard_material", "cui_clipboard_width", Material.LIME_CONCRETE, Width.SLIM),
|
||||
;
|
||||
|
||||
private final Map<Player, Material> materialCache = new HashMap<>();
|
||||
private final Map<Player, Width> widthCache = new HashMap<>();
|
||||
|
||||
private final String configMaterial;
|
||||
private final String configWidth;
|
||||
private final Material defaultMaterial;
|
||||
private final Width defaultWidth;
|
||||
|
||||
public Material getMaterial(Player player) {
|
||||
String material = UserConfig.getConfig(player.getUniqueId(), configMaterial);
|
||||
if (material == null) {
|
||||
return defaultMaterial;
|
||||
} else {
|
||||
return Material.valueOf(material);
|
||||
}
|
||||
return materialCache.computeIfAbsent(player, p -> {
|
||||
String material = UserConfig.getConfig(p.getUniqueId(), configMaterial);
|
||||
if (material == null) {
|
||||
return defaultMaterial;
|
||||
} else {
|
||||
return Material.valueOf(material);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setMaterial(Player player, Material material) {
|
||||
materialCache.put(player, material);
|
||||
UserConfig.updatePlayerConfig(player.getUniqueId(), configMaterial, material.name());
|
||||
}
|
||||
|
||||
public Width getWidth(Player player) {
|
||||
String width = UserConfig.getConfig(player.getUniqueId(), configWidth);
|
||||
if (width == null) {
|
||||
return defaultWidth;
|
||||
} else {
|
||||
return Width.valueOf(width);
|
||||
}
|
||||
return widthCache.computeIfAbsent(player, p -> {
|
||||
String width = UserConfig.getConfig(p.getUniqueId(), configWidth);
|
||||
if (width == null) {
|
||||
return defaultWidth;
|
||||
} else {
|
||||
return Width.valueOf(width);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setWidth(Player player, Width width) {
|
||||
widthCache.put(player, width);
|
||||
UserConfig.updatePlayerConfig(player.getUniqueId(), configWidth, width.name());
|
||||
}
|
||||
}
|
||||
@@ -88,6 +115,7 @@ public class WorldEditRendererCUIEditor {
|
||||
}
|
||||
|
||||
public WorldEditRendererCUIEditor() {
|
||||
Bukkit.getPluginManager().registerEvents(this, Core.getInstance());
|
||||
if (Core.getVersion() >= 20) {
|
||||
new Command();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ public class CLine extends CEntity {
|
||||
if (Objects.equals(from, this.from) && Objects.equals(to, this.to)) return this;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
hide(true);
|
||||
tick();
|
||||
hide(false);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class CWireframe extends CEntity {
|
||||
private void updateAndSpawnLines() {
|
||||
List<CLine> lines = getEntitiesByType(CLine.class);
|
||||
if (pos1 == null || pos2 == null) {
|
||||
lines.forEach(line -> line.setFrom(null).setTo(null));
|
||||
lines.forEach(line -> line.setFromAndTo(null, null));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -578,7 +578,7 @@ CHAT_EMPTY=§cDon\'t write meaningless empty messages.
|
||||
CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2}
|
||||
CHAT_DISCORD_SERVERTEAM=§8STC §e{0}§8» §f{2}
|
||||
CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}
|
||||
CHAT_DISCORD_GLOBAL=§8Dc {5}{6}{0}§8» {7}{2}
|
||||
CHAT_DISCORD_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}
|
||||
CHAT_TEAM=§8TC §e{0}§8» §f{2}
|
||||
CHAT_MSG=§e{0}§8»§e{1} §7{2}
|
||||
|
||||
|
||||
@@ -552,7 +552,7 @@ CHAT_EMPTY=§cSchreibe keine inhaltslosen Nachrichten.
|
||||
CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2}
|
||||
CHAT_DISCORD_SERVERTEAM=§8STC §e{0}§8» §f{2}
|
||||
CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}
|
||||
CHAT_DISCORD_GLOBAL=§8Dc {5}{6}{0}§8» {7}{2}
|
||||
CHAT_DISCORD_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}
|
||||
CHAT_TEAM=§8TC §e{0}§8» §f{2}
|
||||
CHAT_MSG=§e{0}§8»§e{1} §7{2}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import de.steamwar.velocitycore.inventory.SWInventory;
|
||||
import de.steamwar.velocitycore.inventory.SWItem;
|
||||
import de.steamwar.velocitycore.network.NetworkSender;
|
||||
import de.steamwar.velocitycore.util.BauLock;
|
||||
import de.steamwar.velocitycore.util.BauLockState;
|
||||
import de.steamwar.data.BauLockState;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -20,17 +20,16 @@
|
||||
package de.steamwar.velocitycore.discord.channels;
|
||||
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.discord.DiscordBot;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel;
|
||||
import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
public class CouncilChannel extends StaticMessageChannel {
|
||||
|
||||
@@ -45,8 +44,17 @@ public class CouncilChannel extends StaticMessageChannel {
|
||||
MessageCreateBuilder messageCreateBuilder = new MessageCreateBuilder();
|
||||
messageCreateBuilder.setContent("# Ratsmitglieder");
|
||||
|
||||
DiscordBot.getGuild().findMembersWithRoles(role).get()
|
||||
.stream()
|
||||
List<Member> members;
|
||||
try {
|
||||
members = DiscordBot.getGuild().findMembersWithRoles(role).onError(throwable -> {
|
||||
// Ignore
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
VelocityCore.getLogger().warning("Could not get members for " + role.getName());
|
||||
return messageCreateBuilder;
|
||||
}
|
||||
|
||||
members.stream()
|
||||
.map(member -> {
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong());
|
||||
String name = steamwarUser == null ? member.getEffectiveName() : steamwarUser.getUserName();
|
||||
|
||||
+3
-1
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.discord.channels;
|
||||
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
@@ -26,6 +27,7 @@ import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteract
|
||||
import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
|
||||
import net.dv8tion.jda.api.utils.messages.MessageEditData;
|
||||
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -63,7 +65,7 @@ public class StaticMessageChannel extends DiscordChannel {
|
||||
if(getChannel().getLatestMessageIdLong() != 0)
|
||||
message = getChannel().getIterableHistory().complete().stream().filter(m -> m.getAuthor().isBot()).findFirst().orElse(null);
|
||||
|
||||
update();
|
||||
VelocityCore.schedule(this::update);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ChatListener extends BasicListener {
|
||||
if(format.equals("CHAT_GLOBAL")) {
|
||||
DiscordBot.withBot(bot -> chatToReciever(bot.getIngameChat(), msgReceiver, user, format, coloredMessage));
|
||||
} else if (format.equals("CHAT_SERVERTEAM")) {
|
||||
DiscordBot.withBot(bot -> chatToReciever(bot.getServerTeamChat(), msgReceiver, user, format, coloredMessage));
|
||||
DiscordBot.withBot(bot -> chatToReciever(bot.getServerTeamChat(), msgReceiver, user, "CHAT_GLOBAL", coloredMessage));
|
||||
} else if (noReceiver) {
|
||||
sender.system("CHAT_NO_RECEIVER");
|
||||
}
|
||||
|
||||
@@ -19,11 +19,15 @@
|
||||
|
||||
package de.steamwar.velocitycore.util;
|
||||
|
||||
import de.steamwar.data.BauLockState;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.network.packets.server.BaulockUpdatePacket;
|
||||
import de.steamwar.persistent.Bauserver;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserConfig;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import de.steamwar.velocitycore.network.NetworkSender;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
@@ -33,6 +37,10 @@ public class BauLock {
|
||||
public static void setLocked(Chatter owner, BauLockState state) {
|
||||
UserConfig.updatePlayerConfig(owner.user().getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name());
|
||||
owner.system("BAU_LOCKED_" + state.name());
|
||||
|
||||
Bauserver bauserver = Bauserver.get(owner.user().getUUID());
|
||||
if(bauserver != null)
|
||||
bauserver.getRegisteredServer().getPlayersConnected().stream().findAny().ifPresent(player -> NetworkSender.send(player, new BaulockUpdatePacket()));
|
||||
}
|
||||
|
||||
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||
|
||||
Reference in New Issue
Block a user