mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Myadmin tags and misc improvements
This commit is contained in:
parent
c8683ea489
commit
2bffcef9a9
4
pom.xml
4
pom.xml
@ -158,9 +158,9 @@
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>3.5.0_327-withDependencies</version>
|
||||
<version>3.5.1_339-withDependencies</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/JDA-3.5.0_327-withDependencies.jar</systemPath>
|
||||
<systemPath>${project.basedir}/lib/JDA-3.5.1_339-withDependencies.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@ -43,6 +43,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Getter
|
||||
@Setter
|
||||
private String discordID = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private String tag = null;
|
||||
|
||||
public static final String CONFIG_FILENAME = "admins.yml";
|
||||
|
||||
@ -69,7 +72,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
.append("- Custom Login Message: ").append(loginMessage).append("\n")
|
||||
.append("- Rank: ").append(rank.getName()).append("\n")
|
||||
.append("- Is Active: ").append(active).append("\n")
|
||||
.append("- Discord ID: ").append(discordID).append("\n");
|
||||
.append("- Discord ID: ").append(discordID).append("\n")
|
||||
.append("- Tag: ").append(tag);
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
@ -93,6 +97,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
lastLogin = FUtil.stringToDate(cs.getString("last_login"));
|
||||
loginMessage = cs.getString("login_message", null);
|
||||
discordID = cs.getString("discord_id", null);
|
||||
tag = cs.getString("tag", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,6 +111,7 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
cs.set("last_login", FUtil.dateToString(lastLogin));
|
||||
cs.set("login_message", loginMessage);
|
||||
cs.set("discord_id", discordID);
|
||||
cs.set("tag", tag);
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Rank pRank)
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin>")
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag>")
|
||||
public class Command_myadmin extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -160,6 +160,27 @@ public class Command_myadmin extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
case "settag":
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Setting personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
String tag = StringUtils.join(args, " ", 1, args.length);
|
||||
target.setTag(tag);
|
||||
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " default tag is now: " + FUtil.colorize(target.getTag()));
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
|
||||
case "cleartag":
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Clearing personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
String tag = StringUtils.join(args, " ", 1, args.length);
|
||||
target.setTag(null);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s]")
|
||||
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s | -a]")
|
||||
public class Command_opall extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -31,6 +31,11 @@ public class Command_opall extends FreedomCommand
|
||||
doSetGamemode = true;
|
||||
targetGamemode = GameMode.SURVIVAL;
|
||||
}
|
||||
else if (args[0].equals("-a"))
|
||||
{
|
||||
doSetGamemode = true;
|
||||
targetGamemode = GameMode.ADVENTURE;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
|
@ -2,22 +2,36 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to the default.", usage = "/<command>", aliases = "setl,swl")
|
||||
@CommandParameters(description = "Sets everyone's Worldedit block modification limit to the default limit or to a custom limit.", usage = "/<command> [limit]", aliases = "setl,swl")
|
||||
public class Command_setlimit extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 2500.", true);
|
||||
int amount = 2500;
|
||||
if (args.length > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
amount = Math.max(1, Math.min(10000, Integer.parseInt(args[0])));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
msg("Invalid number: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to " + amount + ".", true);
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
plugin.web.setLimit(player, 2500);
|
||||
plugin.web.setLimit(player, amount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2,13 +2,14 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command>")
|
||||
@CommandParameters(description = "Kicks everyone and stops the server.", usage = "/<command> [reason]")
|
||||
public class Command_stop extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -17,9 +18,16 @@ public class Command_stop extends FreedomCommand
|
||||
{
|
||||
FUtil.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
|
||||
|
||||
String reason = "Server is going offline, come back in about 20 seconds.";
|
||||
|
||||
if (args.length > 0)
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 0, args.length);
|
||||
}
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.kickPlayer("Server is going offline, come back in about 20 seconds.");
|
||||
player.kickPlayer(reason);
|
||||
}
|
||||
|
||||
server.shutdown();
|
||||
|
@ -16,7 +16,7 @@ public class Command_wipewarps extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!server.getPluginManager().isPluginEnabled("Essentials"))
|
||||
if (!plugin.esb.isEssentialsEnabled())
|
||||
{
|
||||
msg("Essentials is not enabled on this server");
|
||||
return true;
|
||||
|
@ -114,6 +114,10 @@ public class RankManager extends FreedomService
|
||||
|
||||
public void updateDisplay(Player player)
|
||||
{
|
||||
if (!player.isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
@ -190,6 +194,15 @@ public class RankManager extends FreedomService
|
||||
FUtil.bcastMsg(ChatColor.AQUA + player.getName() + " is " + loginMsg);
|
||||
plugin.pl.getPlayer(player).setTag(display.getColoredTag());
|
||||
|
||||
if (isAdmin)
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
if (admin.getTag() != null)
|
||||
{
|
||||
plugin.pl.getPlayer(player).setTag(FUtil.colorize(admin.getTag()));
|
||||
}
|
||||
}
|
||||
|
||||
String displayName = display.getColor() + player.getName();
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user