mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
Security & improvement update (#19)
This commit is contained in:
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||
@CommandParameters(description = "Close server to non-superadmins.", usage = "/<command> [on | off]")
|
||||
@CommandParameters(description = "Close server to non-admins.", usage = "/<command> [on | off]")
|
||||
public class Command_adminmode extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -29,12 +29,12 @@ public class Command_adminmode extends FreedomCommand
|
||||
else if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
ConfigEntry.ADMIN_ONLY_MODE.setBoolean(true);
|
||||
FUtil.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
|
||||
FUtil.adminAction(sender.getName(), "Closing the server to non-admins.", true);
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!isAdmin(player))
|
||||
{
|
||||
player.kickPlayer("Server is now closed to non-superadmins.");
|
||||
player.kickPlayer("Server is now closed to non-admins.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -0,0 +1,36 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/<command>", aliases="aec")
|
||||
public class Command_aeclear extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all area effect clouds.", true);
|
||||
int removed = 0;
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
for (Entity entity : world.getEntities())
|
||||
{
|
||||
if (entity instanceof AreaEffectCloud)
|
||||
{
|
||||
entity.remove();
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
msg(removed + " area effect clouds removed.");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -174,6 +174,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true);
|
||||
plugin.al.addAdmin(new Admin(player));
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
else // Existing admin
|
||||
{
|
||||
@ -190,6 +191,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
@ -228,6 +230,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
admin.setActive(false);
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
plugin.rm.updateDisplay(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Iterator;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -9,7 +8,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -57,7 +55,7 @@ public class Command_vanish extends FreedomCommand
|
||||
player.hidePlayer(playerSender);
|
||||
}
|
||||
plugin.esb.setVanished(playerSender.getName(), true);
|
||||
playerSender.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000000, 1000000, true, false));
|
||||
playerSender.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000000, 1, false, true));
|
||||
VANISHED.add(playerSender);
|
||||
}
|
||||
return true;
|
||||
|
@ -75,6 +75,7 @@ public class Command_verify extends FreedomCommand
|
||||
admin.setLastLogin(new Date());
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
plugin.rm.updateDisplay(playerSender);
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
||||
if (fPlayer.getFreezeData().isFrozen())
|
||||
{
|
||||
|
Reference in New Issue
Block a user