mirror of
https://github.com/Freezy-Studios/BlazeSMP.git
synced 2025-04-20 19:54:04 +02:00
commit
25f52857e2
4 changed files with 56 additions and 17 deletions
|
@ -7,7 +7,6 @@ import me.freezy.plugins.papermc.blazesmp.module.manager.Clans;
|
|||
import me.freezy.plugins.papermc.blazesmp.module.manager.L4M4;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -20,6 +19,8 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
|
||||
|
||||
public class ClanCommand extends SimpleCommand {
|
||||
|
||||
private final Clans clans;
|
||||
|
@ -66,7 +67,8 @@ public class ClanCommand extends SimpleCommand {
|
|||
}
|
||||
String clanName = args[1];
|
||||
String clanTag = String.join(" ", Arrays.copyOfRange(args, 2, args.length));
|
||||
Component tagComponent = miniMessage().deserialize(clanTag);
|
||||
String formattedMessage = clanTag.replaceAll("<click:[^>]+>(.*?)</click>", "$1");
|
||||
Component tagComponent = miniMessage().deserialize(formattedMessage);
|
||||
|
||||
Clan newClan = new Clan(clanName, tagComponent, playerUUID);
|
||||
clans.addClan(newClan);
|
||||
|
@ -678,6 +680,7 @@ public class ClanCommand extends SimpleCommand {
|
|||
}
|
||||
String whatToModify = args[1].toLowerCase();
|
||||
String newValue = String.join(" ", Arrays.copyOfRange(args, 2, args.length));
|
||||
String formattedMessage = newValue.replaceAll("<click:[^>]+>(.*?)</click>", "$1");
|
||||
Clan currentClan = clans.getClanByMember(playerUUID);
|
||||
if (currentClan == null) {
|
||||
player.sendMessage(miniMessage().deserialize(L4M4.get("error.clan_not_found")));
|
||||
|
@ -692,11 +695,11 @@ public class ClanCommand extends SimpleCommand {
|
|||
));
|
||||
}
|
||||
case "tag" -> {
|
||||
Component newTag = miniMessage().deserialize(newValue);
|
||||
Component newTag = miniMessage().deserialize(formattedMessage);
|
||||
currentClan.setTag(newTag);
|
||||
currentClan.save();
|
||||
player.sendMessage(miniMessage().deserialize(
|
||||
String.format("<green>Clan tag changed to %s.</green>", newValue)
|
||||
String.format("<green>Clan tag changed to %s.</green>", formattedMessage)
|
||||
));
|
||||
}
|
||||
default -> player.sendMessage(miniMessage().deserialize(L4M4.get("error.modify_invalid")));
|
||||
|
@ -778,7 +781,8 @@ public class ClanCommand extends SimpleCommand {
|
|||
.filter(s -> s.startsWith(args[1]))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
default -> {}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
} else if (clans.isVice(playerUUID)) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
|
@ -809,7 +813,8 @@ public class ClanCommand extends SimpleCommand {
|
|||
List<String> joins = getClanJoinRequests(args, playerUUID);
|
||||
if (joins != null) return joins;
|
||||
}
|
||||
default -> {}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
|
@ -829,7 +834,8 @@ public class ClanCommand extends SimpleCommand {
|
|||
case "create" -> {
|
||||
return Collections.singletonList("<name>");
|
||||
}
|
||||
default -> {}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,10 @@ public class PlayerChatListener implements Listener {
|
|||
public void onChat(AsyncChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Component messageComponent = MiniMessage.miniMessage().deserialize(PlainTextComponentSerializer.plainText().serialize(event.message()));
|
||||
String message = PlainTextComponentSerializer.plainText().serialize(event.message());
|
||||
String formattedMessage = message.replaceAll("<click:[^>]+>(.*?)</click>", "$1");
|
||||
|
||||
Component messageComponent = MiniMessage.miniMessage().deserialize(formattedMessage);
|
||||
|
||||
Component chatComponent = Component.empty()
|
||||
.append(player.playerListName())
|
||||
|
|
|
@ -2,9 +2,12 @@ package me.freezy.plugins.papermc.blazesmp.listener;
|
|||
|
||||
import me.freezy.plugins.papermc.blazesmp.BlazeSMP;
|
||||
import me.freezy.plugins.papermc.blazesmp.module.manager.L4M4;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -23,14 +26,14 @@ public class PressurePlateListener implements Listener {
|
|||
private final Location pressurePlateLocation;
|
||||
private final Location spawnLocation;
|
||||
private final Map<UUID, BukkitRunnable> playerTasks = new HashMap<>();
|
||||
private final String teleportMessage;
|
||||
private final Component teleportMessage;
|
||||
private final long teleportDelay;
|
||||
|
||||
public PressurePlateListener() {
|
||||
FileConfiguration config = plugin.getConfig();
|
||||
pressurePlateLocation = new Location(
|
||||
Bukkit.getWorld(config.getString("pressure-plate.world", "world")),
|
||||
config.getDouble("pressure-plate.x", 1),
|
||||
config.getDouble("pressure-plate.x", 0),
|
||||
config.getDouble("pressure-plate.y", 68),
|
||||
config.getDouble("pressure-plate.z", 0)
|
||||
);
|
||||
|
@ -40,9 +43,8 @@ public class PressurePlateListener implements Listener {
|
|||
config.getDouble("spawn-location.y", 200),
|
||||
config.getDouble("spawn-location.z", 0)
|
||||
);
|
||||
// Verwende die zentrale Nachricht aus der messages.json
|
||||
teleportMessage = L4M4.get("pressureplate.teleport");
|
||||
teleportDelay = 5*20L; // Default to 5 seconds (100 ticks)
|
||||
teleportMessage = MiniMessage.miniMessage().deserialize(L4M4.get("pressureplate.teleport"));
|
||||
teleportDelay = 5 * 20L;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -59,11 +61,26 @@ public class PressurePlateListener implements Listener {
|
|||
};
|
||||
task.runTaskLater(plugin, teleportDelay);
|
||||
playerTasks.put(event.getPlayer().getUniqueId(), task);
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (playerTasks.containsKey(event.getPlayer().getUniqueId())) {
|
||||
event.getPlayer().getWorld().spawnParticle(Particle.PORTAL, event.getPlayer().getLocation(), 30, 0.5, 0.5, 0.5, 0.1);
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 0, 10);
|
||||
}
|
||||
} else {
|
||||
if (playerTasks.containsKey(event.getPlayer().getUniqueId())) {
|
||||
playerTasks.get(event.getPlayer().getUniqueId()).cancel();
|
||||
playerTasks.remove(event.getPlayer().getUniqueId());
|
||||
if (event.getFrom().getBlockX() != event.getTo().getBlockX() ||
|
||||
event.getFrom().getBlockY() != event.getTo().getBlockY() ||
|
||||
event.getFrom().getBlockZ() != event.getTo().getBlockZ()) {
|
||||
playerTasks.get(event.getPlayer().getUniqueId()).cancel();
|
||||
playerTasks.remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,4 +92,4 @@ public class PressurePlateListener implements Listener {
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,4 +2,17 @@ op-prefix: '<color:dark_gray>[</color><gradient:#ffa600:#ffb700><b>Team</b></gra
|
|||
player-prefix: '<color:dark_gray>[</color><gradient:#747e80:#828d8f><b>Player</b></gradient><color:dark_gray>]</color> '
|
||||
discord-report-webhook: ''
|
||||
discord-url: 'https://discord.gg/cww2YDt2bx'
|
||||
tab_update_interval: 5 #Seconds
|
||||
tab_update_interval: 5 #Seconds
|
||||
isEndOpen: false
|
||||
|
||||
pressure-plate:
|
||||
world: "world"
|
||||
x: 0
|
||||
y: 68
|
||||
z: 0
|
||||
|
||||
spawn-location:
|
||||
world: "world"
|
||||
x: 0
|
||||
y: 200
|
||||
z: 0
|
Loading…
Add table
Add a link
Reference in a new issue