Cool stuff (#101)

* add twitter link

* Add /pardon as an alias

* Add /unban -redo
This commit is contained in:
Telesphoreo 2018-07-26 15:55:55 -07:00 committed by Seth
parent 519b456807
commit 45a10a871f
4 changed files with 31 additions and 4 deletions

View File

@ -10,6 +10,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.15.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />

View File

@ -119,7 +119,7 @@ public class CoreProtectBridge extends FreedomService
}
// Reverts a rollback for the specifed player's edits that were in the last 24 hours.
public void undoRollback(final String name)
public void restore(final String name)
{
final CoreProtectAPI coreProtect = getCoreProtectAPI();

View File

@ -13,18 +13,19 @@ import java.util.ArrayList;
import java.util.List;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Unbans a player", usage = "/<command> <username>")
@CommandParameters(description = "Unbans a player", usage = "/<command> <username> [-restore]", aliases = "pardon")
public class Command_unban extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 1)
if (args.length > 0)
{
String username;
final List<String> ips = new ArrayList<>();
final PlayerData entry = plugin.pl.getData(args[0]);
final Player player = getPlayer(args[0]);
if (entry == null)
{
@ -38,6 +39,31 @@ public class Command_unban extends FreedomCommand
FUtil.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + StringUtils.join(ips, ", "), true);
plugin.bm.removeBan(plugin.bm.getByUsername(username));
if (args.length >= 2)
{
if (args[args.length - 1].equals("-restore"))
{
if (!plugin.cpb.isEnabled())
{
// Redo WorldEdits
try
{
plugin.web.redo(player, 15);
}
catch (NoClassDefFoundError | NullPointerException ex)
{
}
// Rollback
plugin.rb.undoRollback(username);
}
else
{
plugin.cpb.restore(username);
}
msg("Restored edits for: " + username);
}
}
for (String ip : ips)
{
Ban ban = plugin.bm.getByIp(ip);

View File

@ -66,6 +66,7 @@ social_links:
Forum: 'https://totalfreedom.boards.net/'
Website: 'https://totalfreedom.me/'
Discord: 'https://discordapp.com/invite/XXjmAmV/'
Twitter: 'https://twitter.com/TotalFreedomMC'
# Blocking certain events
@ -119,7 +120,6 @@ blocked_commands:
# Disabled commands
- 'n:b:/time:Server-side time changing is disabled. Please use /ptime to set your own personal time.'
- 'n:b:/gamemode:Use /creative and /survival to set your gamemode.'
- 'n:b:/pardon:_'
- 'n:b:/ban-ip:_'
- 'n:b:/pardon-ip:_'
- 'n:b:/toggledownfall:_'