mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Merge branch 'RELEASE-2023.03-LUCKPERMS' into proper-resultset-retrieval
This commit is contained in:
commit
1f9a36cbfb
@ -3,12 +3,12 @@ package me.totalfreedom.totalfreedommod;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.api.event.AdminChatEvent;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
@ -44,7 +44,6 @@ public class ChatManager extends FreedomService
|
|||||||
String steamrolled = FUtil.steamroll(event.originalMessage());
|
String steamrolled = FUtil.steamroll(event.originalMessage());
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
FPlayer fPlayer = plugin.pl.getPlayer(player);
|
FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||||
PlayerData playerData = plugin.pl.getData(player);
|
|
||||||
|
|
||||||
// Chat is disabled
|
// Chat is disabled
|
||||||
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player))
|
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player))
|
||||||
@ -63,7 +62,7 @@ public class ChatManager extends FreedomService
|
|||||||
// Admin chat is enabled
|
// Admin chat is enabled
|
||||||
else if (fPlayer.inAdminChat())
|
else if (fPlayer.inAdminChat())
|
||||||
{
|
{
|
||||||
adminChat(player, steamrolled);
|
adminChat(player, steamrolled, true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -73,12 +72,6 @@ public class ChatManager extends FreedomService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tag
|
|
||||||
Component tag = fPlayer.getTag().append(Component.space());
|
|
||||||
|
|
||||||
// Nickname
|
|
||||||
Component nickname = player.displayName();
|
|
||||||
|
|
||||||
// Splitter
|
// Splitter
|
||||||
Component splitter = Component.text("»", NamedTextColor.DARK_GRAY);
|
Component splitter = Component.text("»", NamedTextColor.DARK_GRAY);
|
||||||
|
|
||||||
@ -91,23 +84,6 @@ public class ChatManager extends FreedomService
|
|||||||
steamrolled = steamrolled.substring(0, 256);
|
steamrolled = steamrolled.substring(0, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pinging
|
|
||||||
Arrays.stream(steamrolled.split(" ")).filter(string -> string.startsWith("@")).forEach(possiblePlayer ->
|
|
||||||
{
|
|
||||||
Player potential = server.getPlayer(possiblePlayer.replace("@", ""));
|
|
||||||
|
|
||||||
// Ping only that particular player
|
|
||||||
if (potential != null)
|
|
||||||
{
|
|
||||||
ping(player);
|
|
||||||
}
|
|
||||||
// Ping everyone (if the person pinging is an admin)
|
|
||||||
else if (possiblePlayer.equalsIgnoreCase("@everyone") && plugin.al.isAdmin(player))
|
|
||||||
{
|
|
||||||
server.getOnlinePlayers().forEach(this::ping);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Did this because sonarlint was complaining about doing the unboxing in the if statement.
|
// Did this because sonarlint was complaining about doing the unboxing in the if statement.
|
||||||
// Something about returning null because it was boxed... I'm not sure.
|
// Something about returning null because it was boxed... I'm not sure.
|
||||||
boolean unboxed = ConfigEntry.FOURCHAN_ENABLED.getBoolean();
|
boolean unboxed = ConfigEntry.FOURCHAN_ENABLED.getBoolean();
|
||||||
@ -132,12 +108,67 @@ public class ChatManager extends FreedomService
|
|||||||
// This simply filters out shit like &k in a simple but stupid way.
|
// This simply filters out shit like &k in a simple but stupid way.
|
||||||
Component filtered = FUtil.miniMessage(FUtil.miniMessage(message.build()));
|
Component filtered = FUtil.miniMessage(FUtil.miniMessage(message.build()));
|
||||||
|
|
||||||
event.setCancelled(true);
|
// Pinging
|
||||||
server.broadcast(FUtil.miniMessage("<tag><nickname> <splitter> <message>",
|
String steamrolledFiltered = FUtil.steamroll(filtered);
|
||||||
Placeholder.component("tag", tag),
|
Arrays.stream(steamrolledFiltered.split(" ")).filter(string -> string.startsWith("@")).forEach(possiblePlayer ->
|
||||||
Placeholder.component("nickname", nickname),
|
{
|
||||||
|
Player potential = server.getPlayer(possiblePlayer.replace("@", ""));
|
||||||
|
|
||||||
|
// Ping only that particular player
|
||||||
|
if (potential != null)
|
||||||
|
{
|
||||||
|
ping(potential);
|
||||||
|
}
|
||||||
|
// Ping everyone (if the person pinging is an admin)
|
||||||
|
else if (possiblePlayer.equalsIgnoreCase("@everyone") && plugin.al.isAdmin(player))
|
||||||
|
{
|
||||||
|
server.getOnlinePlayers().forEach(this::ping);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
event.message(filtered);
|
||||||
|
|
||||||
|
event.renderer((source, displayName, msg, viewer) -> FUtil.miniMessage("<tag><nickname> <splitter> <message>",
|
||||||
|
Placeholder.component("tag", plugin.pl.getPlayer(source).getTag().append(Component.space())),
|
||||||
|
Placeholder.component("nickname", displayName),
|
||||||
Placeholder.component("splitter", splitter),
|
Placeholder.component("splitter", splitter),
|
||||||
Placeholder.component("message", filtered)));
|
Placeholder.component("message", msg)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onAdminChat(AdminChatEvent event)
|
||||||
|
{
|
||||||
|
Displayable display = event.getDisplayable();
|
||||||
|
String flatAbv = FUtil.miniMessage(display.getAbbr());
|
||||||
|
|
||||||
|
Component defaultFormat = FUtil.miniMessage("<prefix><dark_gray>[<aqua>ADMIN<dark_gray>] <dark_red><name> <dark_gray>[<rankcolor><rank></rankcolor>]</dark_gray><white>: <gold><message>",
|
||||||
|
Placeholder.component("prefix", event.getPrefix()),
|
||||||
|
Placeholder.component("name", event.getName()),
|
||||||
|
Placeholder.unparsed("rank", flatAbv),
|
||||||
|
TagResolver.resolver("rankcolor", Tag.styling(getColor(display))),
|
||||||
|
Placeholder.component("message", event.getMessage()));
|
||||||
|
|
||||||
|
plugin.getComponentLogger().info(defaultFormat);
|
||||||
|
;
|
||||||
|
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)).forEach(player ->
|
||||||
|
{
|
||||||
|
Admin admin = plugin.al.getAdmin(player);
|
||||||
|
if (!Strings.isNullOrEmpty(admin.getAcFormat()))
|
||||||
|
{
|
||||||
|
String format = admin.getAcFormat();
|
||||||
|
|
||||||
|
player.sendMessage(FUtil.miniMessage(format,
|
||||||
|
Placeholder.component("prefix", event.getPrefix()),
|
||||||
|
Placeholder.component("name", event.getName()),
|
||||||
|
Placeholder.unparsed("rank", flatAbv),
|
||||||
|
TagResolver.resolver("rankcolor", Tag.styling(getColor(display))),
|
||||||
|
Placeholder.component("message", event.getMessage())));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.sendMessage(defaultFormat);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextColor getColor(Displayable display)
|
public TextColor getColor(Displayable display)
|
||||||
@ -145,45 +176,27 @@ public class ChatManager extends FreedomService
|
|||||||
return display.getColor();
|
return display.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component getColoredTag(Displayable display)
|
public void adminChat(Component name, Displayable displayable, Component message, boolean async)
|
||||||
{
|
{
|
||||||
return display.getColoredTag();
|
AdminChatEvent event = new AdminChatEvent(name, displayable, message, async);
|
||||||
|
event.callEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void adminChat(Key key, Component prefix, Component name, Displayable displayable, Component message, boolean async)
|
||||||
|
{
|
||||||
|
AdminChatEvent event = new AdminChatEvent(key, prefix, name, displayable, message, async);
|
||||||
|
event.callEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adminChat(CommandSender sender, String message)
|
public void adminChat(CommandSender sender, String message)
|
||||||
|
{
|
||||||
|
adminChat(sender, message, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void adminChat(CommandSender sender, String message, boolean async)
|
||||||
{
|
{
|
||||||
Displayable display = plugin.rm.getDisplay(sender);
|
Displayable display = plugin.rm.getDisplay(sender);
|
||||||
FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message, true);
|
adminChat(Component.text(sender.getName()), display, Component.text(message), async);
|
||||||
|
|
||||||
if (plugin.dc != null)
|
|
||||||
{
|
|
||||||
plugin.dc.messageAdminChatChannel(sender.getName() + " \u00BB " + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)).forEach(player ->
|
|
||||||
{
|
|
||||||
Admin admin = plugin.al.getAdmin(player);
|
|
||||||
if (!Strings.isNullOrEmpty(admin.getAcFormat()))
|
|
||||||
{
|
|
||||||
String format = admin.getAcFormat();
|
|
||||||
String flatAbv = FUtil.miniMessage(display.getAbbr());
|
|
||||||
|
|
||||||
player.sendMessage(FUtil.miniMessage(format,
|
|
||||||
Placeholder.unparsed("name", sender.getName()),
|
|
||||||
Placeholder.unparsed("rank", flatAbv),
|
|
||||||
TagResolver.resolver("rankcolor", Tag.styling(getColor(display))),
|
|
||||||
Placeholder.unparsed("message", message)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Component defaultFormat = FUtil.miniMessage("<dark_gray>[<aqua>ADMIN<dark_gray>] <dark_red><name> <dark_gray><tag><dark_gray>]<white>: <gold><message>",
|
|
||||||
Placeholder.unparsed("<name>", sender.getName()),
|
|
||||||
Placeholder.component("<tag>", getColoredTag(display)),
|
|
||||||
Placeholder.unparsed("<message>", message));
|
|
||||||
|
|
||||||
player.sendMessage(defaultFormat);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reportAction(Player reporter, String reportedName, String report)
|
public void reportAction(Player reporter, String reportedName, String report)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -24,6 +24,6 @@ public class CommandSpy extends FreedomService
|
|||||||
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)
|
server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)
|
||||||
&& plugin.al.getAdmin(player).getCommandSpy() && player != event.getPlayer()).forEach(player ->
|
&& plugin.al.getAdmin(player).getCommandSpy() && player != event.getPlayer()).forEach(player ->
|
||||||
player.sendMessage(Component.text(event.getPlayer().getName()).append(Component.text(": "))
|
player.sendMessage(Component.text(event.getPlayer().getName()).append(Component.text(": "))
|
||||||
.append(Component.text(event.getMessage()))));
|
.append(Component.text(event.getMessage())).color(NamedTextColor.GRAY)));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ import java.util.Random;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
|
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
@ -27,7 +28,7 @@ public class Muter extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event)
|
public void onAsyncPlayerChatEvent(AsyncChatEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import me.totalfreedom.totalfreedommod.blocking.*;
|
|||||||
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.*;
|
import me.totalfreedom.totalfreedommod.bridge.*;
|
||||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||||
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
import me.totalfreedom.totalfreedommod.command.handling.CommandLoader;
|
||||||
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
||||||
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
||||||
import me.totalfreedom.totalfreedommod.fun.*;
|
import me.totalfreedom.totalfreedommod.fun.*;
|
||||||
|
@ -39,7 +39,7 @@ public class Admin
|
|||||||
|
|
||||||
this.uuid = UUID.fromString(resultSet.getString("uuid"));
|
this.uuid = UUID.fromString(resultSet.getString("uuid"));
|
||||||
this.active = resultSet.getBoolean("active");
|
this.active = resultSet.getBoolean("active");
|
||||||
this.rank = GroupProvider.fromArgument(resultSet.getString("rank")).getGroup();
|
this.rank = GroupProvider.fromString(resultSet.getString("rank")).getGroup();
|
||||||
this.ips.clear();
|
this.ips.clear();
|
||||||
this.ips.addAll(FUtil.stringToList(resultSet.getString("ips")));
|
this.ips.addAll(FUtil.stringToList(resultSet.getString("ips")));
|
||||||
this.lastLogin = new Date(resultSet.getLong("last_login"));
|
this.lastLogin = new Date(resultSet.getLong("last_login"));
|
||||||
|
@ -6,6 +6,7 @@ import me.totalfreedom.totalfreedommod.FreedomService;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
||||||
import me.totalfreedom.totalfreedommod.sql.ResultSetProvider;
|
import me.totalfreedom.totalfreedommod.sql.ResultSetProvider;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
@ -112,9 +113,10 @@ public class AdminList extends FreedomService
|
|||||||
return admin != null && admin.isActive();
|
return admin != null && admin.isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cast to OfflinePlayer
|
|
||||||
public boolean isAdmin(Player player)
|
public boolean isAdmin(Player player)
|
||||||
{
|
{
|
||||||
|
if (Hierarchy.getHierarchy().isUserOnAdminTrack(player)) return true;
|
||||||
|
|
||||||
return isAdmin((OfflinePlayer) player);
|
return isAdmin((OfflinePlayer) player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,19 +132,6 @@ public class AdminList extends FreedomService
|
|||||||
return admin != null && admin.isActive();
|
return admin != null && admin.isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSeniorAdmin(CommandSender sender)
|
|
||||||
{
|
|
||||||
Admin admin = getAdmin(sender);
|
|
||||||
if (admin == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return admin.getRank().getLuckPermsGroup().getWeight().orElse(0)
|
|
||||||
>= GroupProvider.SENIOR_ADMIN.getGroup().getLuckPermsGroup().getWeight().orElse(1);
|
|
||||||
// We don't want this to return true if there's no group weight available.
|
|
||||||
}
|
|
||||||
|
|
||||||
public Admin getAdmin(CommandSender sender)
|
public Admin getAdmin(CommandSender sender)
|
||||||
{
|
{
|
||||||
if (sender instanceof Player player)
|
if (sender instanceof Player player)
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.api.event;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
|
import net.kyori.adventure.key.Key;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class AdminChatEvent extends Event
|
||||||
|
{
|
||||||
|
private static HandlerList handlerList = new HandlerList();
|
||||||
|
//--
|
||||||
|
private Key identifier;
|
||||||
|
private Component prefix = Component.empty();
|
||||||
|
private Component name;
|
||||||
|
private Displayable displayable;
|
||||||
|
private Component message;
|
||||||
|
|
||||||
|
public AdminChatEvent(Key identifier, Component prefix, Component name, Displayable rank, Component message, boolean async)
|
||||||
|
{
|
||||||
|
super(async);
|
||||||
|
this.identifier = identifier;
|
||||||
|
this.prefix = prefix;
|
||||||
|
this.name = name;
|
||||||
|
this.displayable = rank;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdminChatEvent(Component name, Displayable rank, Component message, boolean async)
|
||||||
|
{
|
||||||
|
super(async);
|
||||||
|
this.identifier = Key.key("tfm", "default");
|
||||||
|
this.name = name;
|
||||||
|
this.displayable = rank;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Key getIdentifier()
|
||||||
|
{
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getPrefix()
|
||||||
|
{
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Displayable getDisplayable()
|
||||||
|
{
|
||||||
|
return displayable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Component getMessage()
|
||||||
|
{
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
@ -30,24 +30,6 @@ public class CommandBlocker extends FreedomService
|
|||||||
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
||||||
private final List<String> unknownCommands = Lists.newArrayList();
|
private final List<String> unknownCommands = Lists.newArrayList();
|
||||||
|
|
||||||
public static CommandMap getCommandMap()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SimplePluginManager simplePluginManager = (SimplePluginManager)Bukkit.getServer().getPluginManager();
|
|
||||||
|
|
||||||
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
|
|
||||||
commandMapField.setAccessible(true);
|
|
||||||
|
|
||||||
return (SimpleCommandMap)commandMapField.get(simplePluginManager);
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
|
|
||||||
{
|
|
||||||
FLog.severe("Failed to get command map field (" + e.getMessage() + ")");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
@ -65,7 +47,7 @@ public class CommandBlocker extends FreedomService
|
|||||||
entryList.clear();
|
entryList.clear();
|
||||||
unknownCommands.clear();
|
unknownCommands.clear();
|
||||||
|
|
||||||
final CommandMap commandMap = getCommandMap();
|
final CommandMap commandMap = Bukkit.getCommandMap();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
|
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import org.reflections.Reflections;
|
|
||||||
|
|
||||||
public class CommandLoader extends FreedomService
|
|
||||||
{
|
|
||||||
private final List<FreedomCommand> commands;
|
|
||||||
|
|
||||||
public CommandLoader()
|
|
||||||
{
|
|
||||||
commands = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(FreedomCommand command)
|
|
||||||
{
|
|
||||||
commands.add(command);
|
|
||||||
command.register();
|
|
||||||
}
|
|
||||||
|
|
||||||
public FreedomCommand getByName(String name)
|
|
||||||
{
|
|
||||||
for (FreedomCommand command : commands)
|
|
||||||
{
|
|
||||||
if (name.equals(command.getName()))
|
|
||||||
{
|
|
||||||
return command;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAlias(String alias)
|
|
||||||
{
|
|
||||||
for (FreedomCommand command : commands)
|
|
||||||
{
|
|
||||||
if (Arrays.asList(command.getAliases().split(",")).contains(alias))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadCommands()
|
|
||||||
{
|
|
||||||
Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command");
|
|
||||||
|
|
||||||
Set<Class<? extends FreedomCommand>> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class);
|
|
||||||
|
|
||||||
commandLoading:
|
|
||||||
for (Class<? extends FreedomCommand> commandClass : commandClasses)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (commandClass.isAnnotationPresent(CommandDependencies.class))
|
|
||||||
{
|
|
||||||
String[] dependencies = commandClass.getAnnotation(CommandDependencies.class).value();
|
|
||||||
|
|
||||||
for (String plugin : dependencies)
|
|
||||||
{
|
|
||||||
if (!server.getPluginManager().isPluginEnabled(plugin))
|
|
||||||
{
|
|
||||||
FLog.warning("Not loading command due to missing dependency (" + plugin + "): /" + commandClass.getSimpleName().replace("Command_", ""));
|
|
||||||
continue commandLoading;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add(commandClass.newInstance());
|
|
||||||
}
|
|
||||||
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
|
|
||||||
{
|
|
||||||
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_", ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FLog.info("Loaded " + commands.size() + " commands");
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FreedomCommand> getCommands()
|
|
||||||
{
|
|
||||||
return commands;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.api.event.AdminChatEvent;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
@ -4,6 +4,11 @@ import io.papermc.lib.PaperLib;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.world.WorldTime;
|
import me.totalfreedom.totalfreedommod.world.WorldTime;
|
||||||
import me.totalfreedom.totalfreedommod.world.WorldWeather;
|
import me.totalfreedom.totalfreedommod.world.WorldWeather;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
@ -18,6 +19,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Intercept("ban")
|
||||||
@CommandPermissions(permission = "ban", source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(permission = "ban", source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb | -q]", aliases = "gtfo")
|
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb | -q]", aliases = "gtfo")
|
||||||
public class Command_ban extends FreedomCommand
|
public class Command_ban extends FreedomCommand
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
@ -9,6 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Intercept("banip")
|
||||||
@CommandPermissions(permission = "banip", source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(permission = "banip", source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Bans the specified ip.", usage = "/<command> <ip> [reason] [-q]")
|
@CommandParameters(description = "Bans the specified ip.", usage = "/<command> <ip> [reason] [-q]")
|
||||||
public class Command_banip extends FreedomCommand
|
public class Command_banip extends FreedomCommand
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -9,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Intercept("banlist")
|
||||||
@CommandPermissions(permission = "banlist", source = SourceType.BOTH)
|
@CommandPermissions(permission = "banlist", source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Shows all banned player names. Admins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
|
@CommandParameters(description = "Shows all banned player names. Admins may optionally use 'purge' to clear the list.", usage = "/<command> [purge]")
|
||||||
public class Command_banlist extends FreedomCommand
|
public class Command_banlist extends FreedomCommand
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SplittableRandom;
|
import java.util.SplittableRandom;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -4,6 +4,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -3,6 +3,10 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import java.util.SplittableRandom;
|
import java.util.SplittableRandom;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.format.TextDecoration;
|
import net.kyori.adventure.text.format.TextDecoration;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import net.luckperms.api.model.user.User;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
@Intercept("deop")
|
||||||
@CommandPermissions(permission = "deop", source = SourceType.BOTH)
|
@CommandPermissions(permission = "deop", source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Deop a player", usage = "/<command> <partialname>")
|
@CommandParameters(description = "Deop a player", usage = "/<command> <partialname>")
|
||||||
public class Command_deop extends FreedomCommand
|
public class Command_deop extends FreedomCommand
|
||||||
@ -35,20 +39,29 @@ public class Command_deop extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = GroupProvider.getUser(player);
|
AtomicBoolean atomicBoolean = new AtomicBoolean(silent);
|
||||||
if (user.getPrimaryGroup().equalsIgnoreCase(GroupProvider.NON_OP.getGroup().getLuckPermsGroup().getName()))
|
Hierarchy.getHierarchy().demoteUser(Hierarchy.getHierarchy().op(), player).whenComplete((result, throwable) ->
|
||||||
{
|
{
|
||||||
msgNew(sender, "<red><player> is already de-opped!", Placeholder.unparsed("<player>", player.getName()));
|
if (throwable != null)
|
||||||
return true;
|
{
|
||||||
}
|
msgNew("<red>Could not demote <player> to non-OP. Check the logs for more details.", player(player));
|
||||||
user.setPrimaryGroup(GroupProvider.NON_OP.getGroup().getLuckPermsGroup().getName());
|
FLog.severe("Error while demoting " + player.getName() + " to non-OP:");
|
||||||
msg(player, YOU_ARE_NOT_OP);
|
FLog.severe(throwable);
|
||||||
plugin.rm.updateDisplay(player);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!silent)
|
if (result == null || !result.wasSuccessful()) {
|
||||||
{
|
msgNew("<red><player> is already non-op.", Placeholder.unparsed("player", player.getName()));
|
||||||
FUtil.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msg(player, YOU_ARE_NOT_OP);
|
||||||
|
|
||||||
|
if (!atomicBoolean.get())
|
||||||
|
{
|
||||||
|
FUtil.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.luckperms.api.model.user.User;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -18,12 +23,23 @@ public class Command_deopall extends FreedomCommand
|
|||||||
FUtil.adminAction(sender.getName(), "De-opping all players on the server", true);
|
FUtil.adminAction(sender.getName(), "De-opping all players on the server", true);
|
||||||
|
|
||||||
server.getOnlinePlayers().forEach(player ->
|
server.getOnlinePlayers().forEach(player ->
|
||||||
{
|
Hierarchy.getHierarchy().demoteUser(Hierarchy.getHierarchy().op(), player).whenComplete((result, ex) ->
|
||||||
User user = GroupProvider.getUser(player);
|
{
|
||||||
user.setPrimaryGroup(GroupProvider.NON_OP.getGroup().getLuckPermsGroup().getName());
|
if (ex != null)
|
||||||
msg(player, YOU_ARE_NOT_OP);
|
{
|
||||||
plugin.rm.updateDisplay(player);
|
msgNew("<red>Could not demote <player> to non-OP. Check the logs for more details.", player(player));
|
||||||
});
|
FLog.severe("Failed to demote " + player.getName() + " to non-OP:");
|
||||||
|
FLog.severe(ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == null || !result.wasSuccessful()) {
|
||||||
|
msgNew("<red><player> is already non-OP.", Placeholder.unparsed("player", player.getName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg(player, YOU_ARE_NOT_OP);
|
||||||
|
}));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -2,6 +2,10 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -7,6 +7,10 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import me.totalfreedom.totalfreedommod.util.Groups;
|
import me.totalfreedom.totalfreedommod.util.Groups;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -2,6 +2,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -2,6 +2,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
|
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -3,6 +3,10 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import org.apache.commons.lang.math.DoubleRange;
|
import org.apache.commons.lang.math.DoubleRange;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -5,9 +5,12 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
import me.totalfreedom.totalfreedommod.fun.Jumppads;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
@ -12,6 +12,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Intercept("kick")
|
||||||
@CommandPermissions(permission = "kick", source = SourceType.BOTH)
|
@CommandPermissions(permission = "kick", source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Kick the specified player.", usage = "/<command> <player> [reason] [-q]")
|
@CommandParameters(description = "Kick the specified player.", usage = "/<command> <player> [reason] [-q]")
|
||||||
public class Command_kick extends FreedomCommand
|
public class Command_kick extends FreedomCommand
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.fun.Landminer.Landmine;
|
import me.totalfreedom.totalfreedommod.fun.Landminer.Landmine;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import net.kyori.adventure.text.JoinConfiguration;
|
||||||
|
import net.kyori.adventure.text.TextComponent;
|
||||||
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Intercept("list")
|
||||||
@CommandPermissions(permission = "list", source = SourceType.BOTH)
|
@CommandPermissions(permission = "list", source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -v]", aliases = "who,lsit")
|
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -v]", aliases = "who,lsit")
|
||||||
public class Command_list extends FreedomCommand
|
public class Command_list extends FreedomCommand
|
||||||
@ -48,39 +51,29 @@ public class Command_list extends FreedomCommand
|
|||||||
listFilter = ListFilter.PLAYERS;
|
listFilter = ListFilter.PLAYERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
String onlineStats;
|
List<TextComponent> players;
|
||||||
List<String> players;
|
|
||||||
|
|
||||||
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.al.isAdmin(sender))
|
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
players = plugin.btb.getConnectedAdmins().stream().map(Admin::getName).toList();
|
players = plugin.btb.getConnectedAdmins().stream().map(admin -> Component.text(admin.getName())).toList();
|
||||||
onlineStats = ChatColor.BLUE + "There are " + ChatColor.RED + players.size() + ChatColor.BLUE
|
msgNew("<blue>There are <red><count></red> admins connected to telnet.",
|
||||||
+ " admins connected to telnet.";
|
Placeholder.unparsed("count", String.valueOf(players.size())));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
onlineStats = ChatColor.BLUE + "There are " + ChatColor.RED + FUtil.getFakePlayerCount() + ChatColor.BLUE
|
|
||||||
+ " out of a maximum " + ChatColor.RED + server.getMaxPlayers() + ChatColor.BLUE + " players online.";
|
|
||||||
|
|
||||||
players = server.getOnlinePlayers().stream().filter(pl ->
|
players = server.getOnlinePlayers().stream().filter(pl ->
|
||||||
(listFilter == ListFilter.ADMINS && plugin.al.isAdmin(pl) && !plugin.al.isVanished(pl.getUniqueId()))
|
(listFilter == ListFilter.ADMINS && plugin.al.isAdmin(pl) && !plugin.al.isVanished(pl.getUniqueId()))
|
||||||
|| (listFilter == ListFilter.VANISHED_ADMINS && plugin.al.isVanished(pl.getUniqueId()))
|
|| (listFilter == ListFilter.VANISHED_ADMINS && plugin.al.isVanished(pl.getUniqueId()))
|
||||||
|| (listFilter == ListFilter.PLAYERS && !plugin.al.isVanished(pl.getUniqueId()))).map(player ->
|
|| (listFilter == ListFilter.PLAYERS && !plugin.al.isVanished(pl.getUniqueId()))).map(player ->
|
||||||
plugin.rm.getDisplay(player).getColoredTag() + player.getName()).toList();
|
Component.textOfChildren(plugin.rm.getDisplay(player).getColoredTag().append(Component.text(player.getName())))).toList();
|
||||||
}
|
|
||||||
|
msgNew("<blue>There are <red><count></red> out of a maximum of <red><max></red> players online.",
|
||||||
String onlineUsers = "Connected " + listFilter.name().toLowerCase().replace('_', ' ') + ": " + ChatColor.WHITE +
|
Placeholder.unparsed("count", String.valueOf(FUtil.getFakePlayerCount())),
|
||||||
StringUtils.join(players, ChatColor.WHITE + ", " + ChatColor.WHITE);
|
Placeholder.unparsed("max", String.valueOf(server.getMaxPlayers())));
|
||||||
|
|
||||||
if (senderIsConsole)
|
|
||||||
{
|
|
||||||
msg(ChatColor.stripColor(onlineStats));
|
|
||||||
msg(ChatColor.stripColor(onlineUsers));
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
msg(onlineStats);
|
|
||||||
msg(onlineUsers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msgNew("Connected <type>: <players>",
|
||||||
|
Placeholder.unparsed("type", listFilter.name().toLowerCase().replace('_', ' ')),
|
||||||
|
Placeholder.component("players", Component.join(JoinConfiguration.commas(true), players)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
import me.totalfreedom.totalfreedommod.api.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.world.WorldTime;
|
import me.totalfreedom.totalfreedommod.world.WorldTime;
|
||||||
import me.totalfreedom.totalfreedommod.world.WorldWeather;
|
import me.totalfreedom.totalfreedommod.world.WorldWeather;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -139,11 +145,9 @@ public class Command_mbconfig extends FreedomCommand
|
|||||||
{
|
{
|
||||||
FUtil.adminAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
|
FUtil.adminAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
|
||||||
data.setMasterBuilder(true);
|
data.setMasterBuilder(true);
|
||||||
|
Hierarchy.getHierarchy()
|
||||||
|
.addUserToGroup(GroupProvider.MASTER_BUILDER.getGroup(), player);
|
||||||
plugin.pl.save(data);
|
plugin.pl.save(data);
|
||||||
if (player != null)
|
|
||||||
{
|
|
||||||
plugin.rm.updateDisplay(player);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
msg("That player is already on the Master Builder list.");
|
msg("That player is already on the Master Builder list.");
|
||||||
@ -163,21 +167,20 @@ public class Command_mbconfig extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = getPlayer(args[1]);
|
Player player = getPlayer(args[1]);
|
||||||
PlayerData data = player != null ? plugin.pl.getData(player) : plugin.pl.getData(args[1]);
|
PlayerData data = plugin.pl.getData(args[1]);
|
||||||
|
|
||||||
if (data == null || !data.isMasterBuilder())
|
if (player == null || data == null || !data.isMasterBuilder())
|
||||||
{
|
{
|
||||||
msg("Master Builder not found: " + args[1]);
|
msgNew("Master Builder not found: <arg>", arg(args[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true);
|
FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true);
|
||||||
|
Hierarchy.getHierarchy()
|
||||||
|
.dropUserFromAll(Hierarchy.getHierarchy().builder(), player);
|
||||||
data.setMasterBuilder(false);
|
data.setMasterBuilder(false);
|
||||||
plugin.pl.save(data);
|
plugin.pl.save(data);
|
||||||
if (player != null)
|
|
||||||
{
|
|
||||||
plugin.rm.updateDisplay(player);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default ->
|
default ->
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.GameRuleHandler;
|
import me.totalfreedom.totalfreedommod.GameRuleHandler;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import me.totalfreedom.totalfreedommod.util.Groups;
|
import me.totalfreedom.totalfreedommod.util.Groups;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
@ -12,6 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@Intercept("mute")
|
||||||
@CommandPermissions(permission = "mute", source = SourceType.BOTH)
|
@CommandPermissions(permission = "mute", source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> <[-q] <player> [reason] | list | purge | all>", aliases = "stfu")
|
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> <[-q] <player> [reason] | list | purge | all>", aliases = "stfu")
|
||||||
public class Command_mute extends FreedomCommand
|
public class Command_mute extends FreedomCommand
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
||||||
import me.totalfreedom.totalfreedommod.util.FConverter;
|
import me.totalfreedom.totalfreedommod.util.FConverter;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.format.TextColor;
|
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
@ -35,7 +39,7 @@ public class Command_nickmm extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component parsed = FUtil.miniMessage(args[0], Placeholder.unparsed("<name>", sender.getName()));
|
Component parsed = FUtil.miniMessage(args[0], Placeholder.unparsed("name", sender.getName()));
|
||||||
plugin.esb.setNickname(sender.getName(), FUtil.miniMessage(parsed));
|
plugin.esb.setNickname(sender.getName(), FUtil.miniMessage(parsed));
|
||||||
msgNew("Your nickname is now: " + FUtil.miniMessage(parsed));
|
msgNew("Your nickname is now: " + FUtil.miniMessage(parsed));
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
|
||||||
import net.luckperms.api.model.user.User;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
@Intercept("op")
|
||||||
@CommandPermissions(permission = "op", source = SourceType.BOTH, cooldown = 5)
|
@CommandPermissions(permission = "op", source = SourceType.BOTH, cooldown = 5)
|
||||||
@CommandParameters(description = "OP a player", usage = "/<command> <partialname>")
|
@CommandParameters(description = "OP a player", usage = "/<command> <partialname>")
|
||||||
public class Command_op extends FreedomCommand
|
public class Command_op extends FreedomCommand
|
||||||
@ -36,20 +39,34 @@ public class Command_op extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = GroupProvider.getUser(player);
|
AtomicBoolean atomicBoolean = new AtomicBoolean(silent);
|
||||||
if (user.getPrimaryGroup().equalsIgnoreCase(GroupProvider.OP.getGroup().getLuckPermsGroup().getName()))
|
Hierarchy.getHierarchy().promoteUser(Hierarchy.getHierarchy().op(), player).whenComplete((result, throwable) ->
|
||||||
{
|
{
|
||||||
msgNew(sender, "<red><player> is already OP!", Placeholder.unparsed("<player>", player.getName()));
|
if (throwable != null)
|
||||||
return true;
|
{
|
||||||
}
|
msgNew("<red>Failed to promote <player> to OP. Check logs for more details.", player(player));
|
||||||
user.setPrimaryGroup(GroupProvider.OP.getGroup().getLuckPermsGroup().getName());
|
FLog.severe("Failed to promote " + player.getName() + " to OP:");
|
||||||
msg(player, YOU_ARE_OP);
|
FLog.severe(throwable);
|
||||||
plugin.rm.updateDisplay(player);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
msgNew("<red><player> was not on the track! Added.", player(player));
|
||||||
|
}
|
||||||
|
else if (!result.wasSuccessful())
|
||||||
|
{
|
||||||
|
msgNew("<red><player> is already OP!", player(player));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg(player, YOU_ARE_OP);
|
||||||
|
|
||||||
|
if (!atomicBoolean.get())
|
||||||
|
{
|
||||||
|
FUtil.adminAction(sender.getName(), "Opping " + player.getName(), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!silent)
|
|
||||||
{
|
|
||||||
FUtil.adminAction(sender.getName(), "Opping " + player.getName(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.luckperms.api.model.user.User;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,12 +21,25 @@ public class Command_opall extends FreedomCommand
|
|||||||
FUtil.adminAction(sender.getName(), "Opping all players on the server", true);
|
FUtil.adminAction(sender.getName(), "Opping all players on the server", true);
|
||||||
|
|
||||||
server.getOnlinePlayers().forEach(player ->
|
server.getOnlinePlayers().forEach(player ->
|
||||||
{
|
Hierarchy.getHierarchy().promoteUser(Hierarchy.getHierarchy().op(), player).whenComplete((result, throwable) ->
|
||||||
User user = GroupProvider.getUser(player);
|
{
|
||||||
user.setPrimaryGroup(GroupProvider.OP.getGroup().getLuckPermsGroup().getName());
|
if (throwable != null)
|
||||||
msg(player, YOU_ARE_OP);
|
{
|
||||||
plugin.rm.updateDisplay(player);
|
msgNew("<red>Failed to promote <player> to OP. Check the logs for more details.", player(player));
|
||||||
});
|
FLog.severe("Failed to promote " + player.getName());
|
||||||
|
FLog.severe(throwable);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
msgNew("<red><player> was not present on the track! Added.", player(player));
|
||||||
|
} else if (!result.wasSuccessful()) {
|
||||||
|
msgNew("<red>Player is already OP!", player(player));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg(player, YOU_ARE_OP);
|
||||||
|
}));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.GroupProvider;
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Hierarchy;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.luckperms.api.model.user.User;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -16,10 +20,22 @@ public class Command_opme extends FreedomCommand
|
|||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||||
User user = GroupProvider.getUser(playerSender);
|
Hierarchy.getHierarchy().promoteUser(Hierarchy.getHierarchy().op(), playerSender)
|
||||||
user.setPrimaryGroup(GroupProvider.OP.getGroup().getLuckPermsGroup().getName());
|
.whenComplete((result, error) ->
|
||||||
msg(YOU_ARE_OP);
|
{
|
||||||
plugin.rm.updateDisplay(playerSender);
|
if (error != null)
|
||||||
|
{
|
||||||
|
FLog.severe("Error while promoting " + playerSender.getName() + " to OP: " + error.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null && !result.wasSuccessful()) {
|
||||||
|
msgNew("<red>You are already op!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg(YOU_ARE_OP);
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.*;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -13,6 +14,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Intercept("potion")
|
||||||
@CommandPermissions(permission = "potion", source = SourceType.BOTH)
|
@CommandPermissions(permission = "potion", source = SourceType.BOTH)
|
||||||
@CommandParameters(
|
@CommandParameters(
|
||||||
description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import me.totalfreedom.totalfreedommod.rank.DisplayableGroup;
|
import me.totalfreedom.totalfreedommod.rank.DisplayableGroup;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandParameters;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.handling.SourceType;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user