mirror of
https://github.com/plexusorg/Plex.git
synced 2026-06-04 05:26:55 +00:00
Add a few more conveinence helpers to the API
This commit is contained in:
@@ -179,6 +179,12 @@ public abstract class PlexCommand extends Command
|
|||||||
return requireRuntime().messageComponent(s, objects);
|
return requireRuntime().messageComponent(s, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component permissionMessage()
|
||||||
|
{
|
||||||
|
return messageComponent("noPermissionNode", getPermission());
|
||||||
|
}
|
||||||
|
|
||||||
protected String messageString(String s, Object... objects)
|
protected String messageString(String s, Object... objects)
|
||||||
{
|
{
|
||||||
return requireRuntime().messageString(s, objects);
|
return requireRuntime().messageString(s, objects);
|
||||||
@@ -237,6 +243,21 @@ public abstract class PlexCommand extends Command
|
|||||||
return requireRuntime().miniMessage(s);
|
return requireRuntime().miniMessage(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void broadcast(String miniMessage)
|
||||||
|
{
|
||||||
|
requireRuntime().broadcast(miniMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void broadcast(Component component)
|
||||||
|
{
|
||||||
|
requireRuntime().broadcast(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List<String> onlinePlayerNames()
|
||||||
|
{
|
||||||
|
return requireRuntime().onlinePlayerNames();
|
||||||
|
}
|
||||||
|
|
||||||
public CommandMap getMap()
|
public CommandMap getMap()
|
||||||
{
|
{
|
||||||
return Bukkit.getCommandMap();
|
return Bukkit.getCommandMap();
|
||||||
@@ -258,5 +279,8 @@ public abstract class PlexCommand extends Command
|
|||||||
Component messageComponent(String entry, Component... objects);
|
Component messageComponent(String entry, Component... objects);
|
||||||
String messageString(String entry, Object... objects);
|
String messageString(String entry, Object... objects);
|
||||||
Component miniMessage(String input);
|
Component miniMessage(String input);
|
||||||
|
void broadcast(String miniMessage);
|
||||||
|
void broadcast(Component component);
|
||||||
|
List<String> onlinePlayerNames();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,24 @@ public class Plex extends JavaPlugin
|
|||||||
{
|
{
|
||||||
return api.messages().miniMessage(input);
|
return api.messages().miniMessage(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void broadcast(String miniMessage)
|
||||||
|
{
|
||||||
|
api.messages().broadcast(miniMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void broadcast(net.kyori.adventure.text.Component component)
|
||||||
|
{
|
||||||
|
api.messages().broadcast(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public java.util.List<String> onlinePlayerNames()
|
||||||
|
{
|
||||||
|
return api.players().onlineNames();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
ModuleConfig.setFactory((module, from, to) -> api.moduleConfigs().create(module, from, to));
|
ModuleConfig.setFactory((module, from, to) -> api.moduleConfigs().create(module, from, to));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user