Merge branch 'master' of https://github.com/plexusorg/plex into taah-cmd-blocker

 Conflicts:
	src/main/java/dev/plex/command/blocker/CommandBlockerManager.java
	src/main/java/dev/plex/listener/impl/CommandListener.java
	src/main/resources/commands.yml
This commit is contained in:
Taah 2022-04-10 15:03:32 -07:00
commit b449d732b0
4 changed files with 13 additions and 38 deletions

View File

@ -255,4 +255,4 @@ public class Plex extends JavaPlugin
}
}
}
}
}

View File

@ -54,7 +54,7 @@ public class EntityWipeCMD extends PlexCommand
{
if (entity.getType() != EntityType.PLAYER)
{
String type = entity.getName();
String type = entity.getType().name();
if (useBlacklist ? entityBlacklist.stream().noneMatch(entityName -> entityName.equalsIgnoreCase(type)) : entityWhitelist.stream().anyMatch(entityName -> entityName.equalsIgnoreCase(type)))
{
@ -99,7 +99,7 @@ public class EntityWipeCMD extends PlexCommand
{
if (entity.getType() != EntityType.PLAYER)
{
entities.add(entity.getName());
entities.add(entity.getType().name());
}
}
}

View File

@ -7,11 +7,7 @@ import dev.plex.PlexBase;
import dev.plex.config.Config;
import dev.plex.storage.StorageType;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.ParsingException;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.kyori.adventure.text.minimessage.tag.standard.*;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
@ -22,8 +18,6 @@ import org.bukkit.command.Command;
import org.bukkit.command.PluginCommandYamlParser;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@ -163,32 +157,17 @@ public class PlexUtils extends PlexBase
StandardTags.reset()
).build()).build();
private static final MiniMessage eggMessage = MiniMessage.builder().tags(new TagResolver()
{
@Override
public @Nullable Tag resolve(@NotNull String name, @NotNull ArgumentQueue arguments, @NotNull Context ctx) throws ParsingException
{
return StandardTags.rainbow().resolve("rainbow", arguments, ctx);
}
@Override
public boolean has(@NotNull String name)
{
return true;
}
}
).build();
public static Component mmDeserialize(String input)
{
/*Calendar calendar = Calendar.getInstance();
MiniMessage mm = (calendar.get(Calendar.MONTH) == Calendar.APRIL && calendar.get(Calendar.DAY_OF_MONTH) == 1 && (!plugin.config.contains("april_fools") || plugin.config.getBoolean("april_fools"))) ? eggMessage : safeMessage;
return mm.deserialize(PlainTextComponentSerializer.plainText().serialize(LegacyComponentSerializer.legacySection().deserialize(input)));*/
boolean aprilFools = plugin.config.getBoolean("april_fools");
boolean aprilFools = true; // true by default
if (plugin.config.contains("april_fools"))
{
aprilFools = plugin.config.getBoolean("april_fools");
}
LocalDateTime date = LocalDateTime.now();
if (aprilFools && date.getMonth() == Month.APRIL && date.getDayOfMonth() == 1)
{
Component component = PlainTextComponentSerializer.plainText().deserialize(input);
Component component = MiniMessage.miniMessage().deserialize(input); // removes existing tags
return MiniMessage.miniMessage().deserialize("<rainbow>" + PlainTextComponentSerializer.plainText().serialize(component));
}
return MiniMessage.miniMessage().deserialize(input);

View File

@ -15,11 +15,7 @@
# So these would be valid:
# - "m:e:mail sendall:You cannot send messages to everyone on the server"
# - "r:e:^[^ :]+::Plugin specific commands are disabled"
commands:
# Plugin specific commands (might not be necessary anymore!!)
- "r:e:^[^ :]+::Plugin specific commands are disabled."
# Disabled commands
- "m:e:time:Server-side time changing is disabled. Please use /ptime to set your own personal time."
- "m:e:pardon:_"
blockedCommands:
- "r:e:^[^ :]+::<gray>Plugin specific commands are disabled."
- "m:e:mail sendall:<gray>You cannot send messages to everyone on the server."
- "m:e:mail sendtempall:<gray>You cannot send messages to everyone on the server."