mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 21:43:54 +00:00
Merge remote-tracking branch 'origin/TFM-1.14' into TFM-1.14
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -27,6 +29,12 @@ public class Command_gchat extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!FUtil.isExecutive(sender.getName()) && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("Only Executives may use this command on admins", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outMessage = StringUtils.join(args, " ", 1, args.length);
|
||||
msg("Sending message as " + player.getName() + ": " + outMessage);
|
||||
player.chat(outMessage);
|
||||
|
@ -1,10 +1,12 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Send a command as someone else.", usage = "/<command> <fromname> <outcommand>")
|
||||
@ -27,6 +29,12 @@ public class Command_gcmd extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!FUtil.isExecutive(sender.getName()) && plugin.al.isAdmin(player))
|
||||
{
|
||||
msg("Only Executives may use this command on admins", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
final String outCommand = StringUtils.join(args, " ", 1, args.length);
|
||||
|
||||
if (plugin.cb.isCommandBlocked(outCommand, sender))
|
||||
|
@ -1,79 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Collection;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
|
||||
public class Command_overlord extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!ConfigEntry.OVERLORD_IPS.getList().contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
try
|
||||
{
|
||||
Object ips = plugin.config.getDefaults().get(ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (ips instanceof Collection && !((Collection)ips).contains(Ips.getIp(playerSender)))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
sender.sendMessage(SpigotConfig.unknownCommandMessage);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("addme"))
|
||||
{
|
||||
plugin.al.addAdmin(new Admin(playerSender));
|
||||
msg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("removeme"))
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
if (admin != null)
|
||||
{
|
||||
plugin.al.removeAdmin(admin);
|
||||
}
|
||||
msg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("do"))
|
||||
{
|
||||
if (args.length <= 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final String c = StringUtils.join(args, " ", 1, args.length);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), c);
|
||||
msg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -37,6 +37,7 @@ public class Command_toggle extends FreedomCommand
|
||||
msg("- nonuke [range] [count]");
|
||||
msg("- explosives [radius]");
|
||||
msg("- unsafeenchs");
|
||||
msg("- bells");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -159,6 +160,11 @@ public class Command_toggle extends FreedomCommand
|
||||
toggle("Invalid enchantments are", ConfigEntry.ALLOW_UNSAFE_ENCHANTMENTS);
|
||||
return true;
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("bells"))
|
||||
{
|
||||
toggle("The ringing of bells is", ConfigEntry.ALLOW_BELLS);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -177,7 +183,7 @@ public class Command_toggle extends FreedomCommand
|
||||
{
|
||||
return Arrays.asList(
|
||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs");
|
||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke", "explosives", "unsafeenchs", "bells");
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
|
Reference in New Issue
Block a user