mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 06:34:58 +00:00
[Bleeding] Block listed IPs from being supered. Resolves #201
This commit is contained in:
parent
af64a77268
commit
8b45482d0a
6 changed files with 19 additions and 7 deletions
|
@ -233,6 +233,10 @@ unbannable_usernames:
|
||||||
- dantdm
|
- dantdm
|
||||||
- gizzy14gazza
|
- gizzy14gazza
|
||||||
|
|
||||||
|
# IPs that can not be supered
|
||||||
|
noadmin_ips:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
# TwitterBot - Used to allow superadmins to verify themselves using twitter
|
# TwitterBot - Used to allow superadmins to verify themselves using twitter
|
||||||
twitterbot:
|
twitterbot:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
|
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
|
@ -134,7 +135,7 @@ public class Command_saconfig extends TFM_Command
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
player = me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, superadmin.getLastLoginName());
|
player = TFM_DepreciationAggregator.getOfflinePlayer(server, superadmin.getLastLoginName());
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list", true);
|
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list", true);
|
||||||
|
@ -171,7 +172,7 @@ public class Command_saconfig extends TFM_Command
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
|
||||||
TFM_AdminList.removeSuperadmin(me.StevenLawson.TotalFreedomMod.TFM_DepreciationAggregator.getOfflinePlayer(server, targetName));
|
TFM_AdminList.removeSuperadmin(TFM_DepreciationAggregator.getOfflinePlayer(server, targetName));
|
||||||
|
|
||||||
// Twitterbot
|
// Twitterbot
|
||||||
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())
|
||||||
|
@ -194,7 +195,6 @@ public class Command_saconfig extends TFM_Command
|
||||||
INFO("info", AdminLevel.SUPER, SourceType.BOTH, 2, 2),
|
INFO("info", AdminLevel.SUPER, SourceType.BOTH, 2, 2),
|
||||||
ADD("add", AdminLevel.SUPER, SourceType.ONLY_CONSOLE, 2, 2),
|
ADD("add", AdminLevel.SUPER, SourceType.ONLY_CONSOLE, 2, 2),
|
||||||
DELETE("delete", AdminLevel.SENIOR, SourceType.ONLY_CONSOLE, 2, 2);
|
DELETE("delete", AdminLevel.SENIOR, SourceType.ONLY_CONSOLE, 2, 2);
|
||||||
|
|
||||||
private final String modeName;
|
private final String modeName;
|
||||||
private final AdminLevel adminLevel;
|
private final AdminLevel adminLevel;
|
||||||
private final SourceType sourceType;
|
private final SourceType sourceType;
|
||||||
|
|
|
@ -76,6 +76,7 @@ public enum TFM_ConfigEntry
|
||||||
BLOCKED_COMMANDS(List.class, "blocked_commands"),
|
BLOCKED_COMMANDS(List.class, "blocked_commands"),
|
||||||
HOST_SENDER_NAMES(List.class, "host_sender_names"),
|
HOST_SENDER_NAMES(List.class, "host_sender_names"),
|
||||||
UNBANNABLE_USERNAMES(List.class, "unbannable_usernames"),
|
UNBANNABLE_USERNAMES(List.class, "unbannable_usernames"),
|
||||||
|
NOADMIN_IPS(List.class, "noadmin_ips"),
|
||||||
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
|
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
|
||||||
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
|
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
|
||||||
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior");
|
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior");
|
||||||
|
|
|
@ -11,9 +11,9 @@ import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Method;
|
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Method;
|
||||||
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
|
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
import me.StevenLawson.TotalFreedomMod.TFM_Admin;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils;
|
import net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -27,8 +27,7 @@ public class Module_schematic extends TFM_HTTPD_Module
|
||||||
{
|
{
|
||||||
"schematic"
|
"schematic"
|
||||||
};
|
};
|
||||||
private static final String UPLOAD_FORM
|
private static final String UPLOAD_FORM = "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
||||||
= "<form method=\"post\" name=\"schematicForm\" id=\"schematicForm\" action=\"/schematic/upload/\" enctype=\"multipart/form-data\">\n"
|
|
||||||
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
|
+ "<p>Select a schematic file to upload. Filenames must be alphanumeric, between 1 and 30 characters long (inclusive), and have a .schematic extension.</p>\n"
|
||||||
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
+ "<input type=\"file\" id=\"schematicFile\" name=\"schematicFile\" />\n"
|
||||||
+ "<br />\n"
|
+ "<br />\n"
|
||||||
|
|
|
@ -3,8 +3,11 @@ package me.StevenLawson.TotalFreedomMod;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_MainConfig;
|
||||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
@ -44,6 +47,11 @@ public class TFM_Admin
|
||||||
this.isTelnetAdmin = section.getBoolean("is_telnet_admin", false);
|
this.isTelnetAdmin = section.getBoolean("is_telnet_admin", false);
|
||||||
this.consoleAliases = section.getStringList("console_aliases");
|
this.consoleAliases = section.getStringList("console_aliases");
|
||||||
this.isActivated = section.getBoolean("is_activated", true);
|
this.isActivated = section.getBoolean("is_activated", true);
|
||||||
|
|
||||||
|
for (Iterator<?> it = TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).iterator(); it.hasNext();)
|
||||||
|
{
|
||||||
|
ips.remove((String) it.next());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -566,7 +566,7 @@ public class TFM_AdminList
|
||||||
{
|
{
|
||||||
superadmin.setLastLogin(new Date());
|
superadmin.setLastLogin(new Date());
|
||||||
|
|
||||||
if (ip != null)
|
if (ip != null && !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip))
|
||||||
{
|
{
|
||||||
superadmin.addIp(ip);
|
superadmin.addIp(ip);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue