More messages

This commit is contained in:
2026-05-20 17:07:19 -04:00
parent 758683b824
commit 55e5e69667
8 changed files with 33 additions and 28 deletions
@@ -29,7 +29,7 @@ public class CakeCommand extends SimplePlexCommand
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{
Bukkit.getOnlinePlayers().forEach(p -> api().scheduler().runEntity(p, () -> p.getInventory().addItem(CAKE.clone())));
broadcast(messageComponent("cakeLyrics"));
broadcast("<rainbow>But there's no sense crying over every mistake. You just keep on trying till you run out of cake.");
return null;
}
@@ -6,7 +6,6 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@@ -42,7 +41,7 @@ public class CartSitCommand extends SimplePlexCommand
List<Entity> minecart = player.getNearbyEntities(100, 100, 100).stream().filter(entity -> entity.getType() == EntityType.MINECART).collect(Collectors.toList());
if (minecart.isEmpty())
{
return MiniMessage.miniMessage().deserialize("<red>Could not find a nearby minecart!");
return messageComponent("minecartNotFound");
}
Entity entity = findNearestEntity(player, minecart);
api().scheduler().runEntity(entity, () -> entity.addPassenger(player));
@@ -56,7 +55,7 @@ public class CartSitCommand extends SimplePlexCommand
List<Entity> minecart = target.getNearbyEntities(100, 100, 100).stream().filter(entity -> entity.getType() == EntityType.MINECART).collect(Collectors.toList());
if (minecart.isEmpty())
{
return MiniMessage.miniMessage().deserialize("<red>Could not find a nearby minecart near " + target.getName() + "!");
return messageComponent("targetMinecartNotFound", target.getName());
}
Entity entity = findNearestEntity(target, minecart);
api().scheduler().runEntity(entity, () -> entity.addPassenger(target));
@@ -6,7 +6,6 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -35,7 +34,7 @@ public class CloudClearCommand extends SimplePlexCommand
api().scheduler().runEntity(entity, entity::remove);
});
broadcast(messageComponent("areaEffectCloudClear", sender.getName()));
return MiniMessage.miniMessage().deserialize("<gray>" + removed.get() + " area effect clouds removed.");
return messageComponent("areaEffectCloudsRemoved", removed.get());
}
@Override
@@ -63,7 +63,7 @@ public class ClownfishCommand extends SimplePlexCommand
module.getConfig().set("server.clownfish.toggled_players", toggledPlayers);
module.getConfig().save();
return messageComponent("toggleClownfish", isToggled ? "now" : "no longer");
return MiniMessage.miniMessage().deserialize("<gray>You will " + (isToggled ? "now" : "no longer") + " be affected by the clownfish.");
}
else if (args[0].equals("restrict") && args.length == 2)
{
@@ -86,7 +86,7 @@ public class ClownfishCommand extends SimplePlexCommand
module.getConfig().set("server.clownfish.restricted", restrictedPlayers);
module.getConfig().save();
return messageComponent("restrictClownfish", target.name(), isRestricted ? "now" : "no longer");
return MiniMessage.miniMessage().deserialize("<gold>" + target.name() + " will " + (isRestricted ? "now" : "no longer") + " be able to use the clownfish.");
}
else
{
@@ -5,7 +5,6 @@ import dev.plex.command.source.RequiredCommandSource;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -26,7 +25,7 @@ public class EjectCommand extends SimplePlexCommand
{
final int passengers = player.getPassengers().size();
api().scheduler().runEntity(player, player::eject);
return MiniMessage.miniMessage().deserialize("<gray>Ejected " + passengers + " passengers.");
return messageComponent("passengersEjected", passengers);
}
@Override
@@ -2,7 +2,6 @@ package dev.plex.extras.command;
import dev.plex.command.SimplePlexCommand;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -83,7 +82,7 @@ public class ExpelCommand extends SimplePlexCommand
if (!pushedPlayers.isEmpty())
{
return messageComponent("playersExpelled", String.join("<reset><gray>, <white><em>", pushedPlayers));
return messageComponent("playersExpelled", String.join(messageString("playersExpelledSeparator"), pushedPlayers));
}
return null;
@@ -8,7 +8,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
@@ -45,7 +44,7 @@ public class JumpPadsCommand extends SimplePlexCommand
{
if (sender instanceof ConsoleCommandSender)
{
return MiniMessage.miniMessage().deserialize("<red>You must specify a player when running this command from console.");
return messageComponent("jumpPadsConsoleSpecifyPlayer");
}
if (player == null)
@@ -56,7 +55,7 @@ public class JumpPadsCommand extends SimplePlexCommand
if (args[0].equalsIgnoreCase("none") || args[0].equalsIgnoreCase("off"))
{
jumpPads.removePlayer(player);
return MiniMessage.miniMessage().deserialize("<gray>You have disabled your jump pads.");
return messageComponent("jumpPadsDisabledSelf");
}
Mode mode = Mode.valueOf(args[0].toUpperCase());
@@ -65,21 +64,21 @@ public class JumpPadsCommand extends SimplePlexCommand
{
if (mode.equals(jumpPads.get(player)))
{
return MiniMessage.miniMessage().deserialize("<red>Your jump pads are already set to " + mode.name() + ".");
return messageComponent("jumpPadsAlreadySet", mode.name());
}
else
{
jumpPads.updatePlayer(player, mode);
return MiniMessage.miniMessage().deserialize("<aqua>Successfully set your jump pads to " + mode.name() + ".");
return messageComponent("jumpPadsSetSelf", mode.name());
}
}
jumpPads.addPlayer(player, mode);
return MiniMessage.miniMessage().deserialize("<aqua>Successfully set your jump pads to " + mode.name() + ".");
return messageComponent("jumpPadsSetSelf", mode.name());
}
catch (IllegalArgumentException ignored)
{
return MiniMessage.miniMessage().deserialize("<red>That is not a valid mode.");
return messageComponent("jumpPadsInvalidMode");
}
}
try
@@ -88,13 +87,13 @@ public class JumpPadsCommand extends SimplePlexCommand
if (p == null)
{
return MiniMessage.miniMessage().deserialize("<red>That player cannot be found.");
return messageComponent("jumpPadsPlayerNotFound");
}
if (args[0].equalsIgnoreCase("none"))
{
jumpPads.removePlayer(p);
return MiniMessage.miniMessage().deserialize("<gray>Jump pads for " + p.getName() + " have been disabled.");
return messageComponent("jumpPadsDisabledOther", p.getName());
}
Mode mode = Mode.valueOf(args[0]);
@@ -108,19 +107,19 @@ public class JumpPadsCommand extends SimplePlexCommand
{
if (jumpPads.get(p).equals(mode))
{
return MiniMessage.miniMessage().deserialize("<red>Your jump pads are already set to " + mode.name() + ".");
return messageComponent("jumpPadsAlreadySet", mode.name());
}
jumpPads.updatePlayer(p, mode);
return MiniMessage.miniMessage().deserialize("<gray>Jump pads for " + p.getName() + " have been set to " + mode.name() + ".");
return messageComponent("jumpPadsSetOther", p.getName(), mode.name());
}
jumpPads.addPlayer(p, mode);
return MiniMessage.miniMessage().deserialize("<gray>Jump pads for " + p.getName() + " have been set to " + mode.name() + ".");
return messageComponent("jumpPadsSetOther", p.getName(), mode.name());
}
catch (IllegalArgumentException ignored)
{
return MiniMessage.miniMessage().deserialize("That is not a valid mode.");
return messageComponent("jumpPadsInvalidMode");
}
}
+13 -3
View File
@@ -1,16 +1,26 @@
playerOrbited: "<aqua>{0} - Orbiting {1}"
stoppedOrbiting: "<aqua>No longer orbiting {0}"
alreadyOrbited: "<red>{0} is already being orbited!"
restrictClownfish: "<gold>{0} will {1} be able to use the clownfish."
toggleClownfish: "<gray>You will {0} be affected by the clownfish."
emptyAdminInfo: "<red>The admin information section of the config.yml file has not been configured."
cakeLyrics: "<rainbow>But there's no sense crying over every mistake. You just keep on trying till you run out of cake."
areaEffectCloudClear: "<red>{0} - Removing all area effect clouds"
areaEffectCloudsRemoved: "<gray>{0} area effect clouds removed."
chatCleared: "<red>{0} - Cleared the chat"
attributeList: "<gold>All possible attributes: <yellow>{0}"
modifiedAutoClear: "<gold>{0} will {1} have their inventory cleared when they join."
modifiedAutoTeleport: "<gold>{0} will {1} be teleported automatically when they join."
minecartNotFound: "<red>Could not find a nearby minecart!"
targetMinecartNotFound: "<red>Could not find a nearby minecart near {0}!"
passengersEjected: "<gray>Ejected {0} passengers."
playersExpelled: "<gray>Pushed away players: <white><em>{0}"
playersExpelledSeparator: "<reset><gray>, <white><em>"
jumpPadsConsoleSpecifyPlayer: "<red>You must specify a player when running this command from console."
jumpPadsDisabledSelf: "<gray>You have disabled your jump pads."
jumpPadsAlreadySet: "<red>Your jump pads are already set to {0}."
jumpPadsSetSelf: "<aqua>Successfully set your jump pads to {0}."
jumpPadsInvalidMode: "<red>That is not a valid mode."
jumpPadsPlayerNotFound: "<red>That player cannot be found."
jumpPadsDisabledOther: "<gray>Jump pads for {0} have been disabled."
jumpPadsSetOther: "<gray>Jump pads for {0} have been set to {1}."
enchantList: "<dark_gray>All possible enchantments are for this item are: <gray>{0}"
enchantAddAll: "<gray>Added all possible enchantments for this item."
enchantReset: "<gray>Removed every enchantment from this item."