mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-03 04:56:42 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f8231aeb3f | |||
eddbcf515c | |||
00ac914066 | |||
179fe9d665 | |||
67c86aea24 | |||
16b02e3dec |
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Tue May 13 17:55:47 CEST 2014
|
#Mon May 19 14:24:40 CEST 2014
|
||||||
build.number=846
|
build.number=860
|
||||||
|
@ -1,6 +1,30 @@
|
|||||||
# TotalFreedomMod v4.2 Configuration
|
# TotalFreedomMod v4.2 Configuration
|
||||||
# by Madgeek1450 and DarthSalamon
|
# by Madgeek1450 and DarthSalamon
|
||||||
|
|
||||||
|
# Generic server information
|
||||||
|
server:
|
||||||
|
# You should change this to your server's name
|
||||||
|
name: TotalFreedom
|
||||||
|
|
||||||
|
# The address your server is located at
|
||||||
|
address: 64.34.165.5:28965
|
||||||
|
|
||||||
|
# Shown at the server list
|
||||||
|
motd: TotalFreedom &8- Minecraft %mcversion%
|
||||||
|
|
||||||
|
# Every word in the MOTD will be a different color unless prefixed by a color code
|
||||||
|
colorful_motd: true
|
||||||
|
|
||||||
|
# All players who show up as owner
|
||||||
|
owners:
|
||||||
|
- markbyron
|
||||||
|
|
||||||
|
# URL players should appeal for bans at
|
||||||
|
ban_url: http://totalfreedom.boards.net/
|
||||||
|
|
||||||
|
# URL players should appeal for permanent bans at
|
||||||
|
permban_url: http://bit.ly/TF_PermBan
|
||||||
|
|
||||||
# Blocking certain events
|
# Blocking certain events
|
||||||
allow:
|
allow:
|
||||||
fire_place: false
|
fire_place: false
|
||||||
|
@ -108,8 +108,7 @@ public class Command_glist extends TFM_Command
|
|||||||
for (String ip : ips)
|
for (String ip : ips)
|
||||||
{
|
{
|
||||||
TFM_BanManager.getInstance().unbanIp(ip);
|
TFM_BanManager.getInstance().unbanIp(ip);
|
||||||
String[] ipParts = ip.split("\\.");
|
TFM_BanManager.getInstance().unbanIp(TFM_Util.getFuzzyIp(ip));
|
||||||
TFM_BanManager.getInstance().unbanIp(ipParts[0] + "." + ipParts[1] + ".*.*");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -76,12 +76,7 @@ public class Command_gtfo extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ban IP address:
|
// ban IP address:
|
||||||
String ip = player.getAddress().getAddress().getHostAddress();
|
String ip = TFM_Util.getFuzzyIp(player.getAddress().getAddress().getHostAddress());
|
||||||
String[] ipParts = ip.split("\\.");
|
|
||||||
if (ipParts.length == 4)
|
|
||||||
{
|
|
||||||
ip = String.format("%s.%s.*.*", ipParts[0], ipParts[1]);
|
|
||||||
}
|
|
||||||
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), ip), ChatColor.RED);
|
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), ip), ChatColor.RED);
|
||||||
|
|
||||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
|
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
|
||||||
|
@ -17,7 +17,7 @@ public class Command_protectarea extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
|
if (!TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -170,7 +170,7 @@ public class Command_saconfig extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("remove".equals(args[0]))
|
if ("delete".equals(args[0]))
|
||||||
{
|
{
|
||||||
if (!TFM_AdminList.isSeniorAdmin(sender))
|
if (!TFM_AdminList.isSeniorAdmin(sender))
|
||||||
{
|
{
|
||||||
|
@ -20,9 +20,9 @@ public class Command_setspawnworld extends TFM_Command
|
|||||||
|
|
||||||
playerMsg("Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation()));
|
playerMsg("Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation()));
|
||||||
|
|
||||||
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean() && TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean())
|
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean() && TFM_ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean())
|
||||||
{
|
{
|
||||||
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.AUTO_PROTECT_RADIUS.getDouble());
|
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.PROTECTAREA_RADIUS.getDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||||
@ -57,6 +58,7 @@ public class Command_tfm extends TFM_Command
|
|||||||
TotalFreedomMod.buildNumber,
|
TotalFreedomMod.buildNumber,
|
||||||
TotalFreedomMod.buildDate,
|
TotalFreedomMod.buildDate,
|
||||||
TotalFreedomMod.buildCreator), ChatColor.GOLD);
|
TotalFreedomMod.buildCreator), ChatColor.GOLD);
|
||||||
|
playerMsg("Running on " + TFM_ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
||||||
playerMsg("Created by Madgeek1450 and DarthSalamon.", ChatColor.GOLD);
|
playerMsg("Created by Madgeek1450 and DarthSalamon.", ChatColor.GOLD);
|
||||||
playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class Command_toggle extends TFM_Command
|
|||||||
|
|
||||||
if (args[0].equals("prelog"))
|
if (args[0].equals("prelog"))
|
||||||
{
|
{
|
||||||
toggle("Command prelogging is", TFM_ConfigEntry.PREPROCESS_LOG_ENABLED);
|
toggle("Command prelogging is", TFM_ConfigEntry.ENABLE_PREPROCESS_LOG);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public class Command_toggle extends TFM_Command
|
|||||||
|
|
||||||
if (args[0].equals("petprotect"))
|
if (args[0].equals("petprotect"))
|
||||||
{
|
{
|
||||||
toggle("Tamed pet protection is", TFM_ConfigEntry.PET_PROTECT_ENABLED);
|
toggle("Tamed pet protection is", TFM_ConfigEntry.ENABLE_PET_PROTECT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public enum TFM_ConfigEntry
|
public enum TFM_ConfigEntry
|
||||||
{
|
{
|
||||||
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
|
|
||||||
ALLOW_EXPLOSIONS(Boolean.class, "allow.explosions"),
|
ALLOW_EXPLOSIONS(Boolean.class, "allow.explosions"),
|
||||||
ALLOW_FIRE_PLACE(Boolean.class, "allow.fire_place"),
|
ALLOW_FIRE_PLACE(Boolean.class, "allow.fire_place"),
|
||||||
ALLOW_FIRE_SPREAD(Boolean.class, "allow.fire_spread"),
|
ALLOW_FIRE_SPREAD(Boolean.class, "allow.fire_spread"),
|
||||||
@ -13,51 +12,68 @@ public enum TFM_ConfigEntry
|
|||||||
ALLOW_LAVA_PLACE(Boolean.class, "allow.lava_place"),
|
ALLOW_LAVA_PLACE(Boolean.class, "allow.lava_place"),
|
||||||
ALLOW_TNT_MINECARTS(Boolean.class, "allow.tnt_minecarts"),
|
ALLOW_TNT_MINECARTS(Boolean.class, "allow.tnt_minecarts"),
|
||||||
ALLOW_WATER_PLACE(Boolean.class, "allow.water_place"),
|
ALLOW_WATER_PLACE(Boolean.class, "allow.water_place"),
|
||||||
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
|
//
|
||||||
AUTO_PROTECT_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
|
MOB_LIMITER_ENABLED(Boolean.class, "moblimiter.enabled"),
|
||||||
DISABLE_NIGHT(Boolean.class, "disable.night"),
|
MOB_LIMITER_MAX(Integer.class, "moblimiter.max"),
|
||||||
DISABLE_WEATHER(Boolean.class, "disable.weather"),
|
|
||||||
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
|
|
||||||
LANDMINES_ENABLED(Boolean.class, "landmines_enabled"),
|
|
||||||
MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "moblimiter.disable.dragon"),
|
MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "moblimiter.disable.dragon"),
|
||||||
MOB_LIMITER_DISABLE_GHAST(Boolean.class, "moblimiter.disable.ghast"),
|
MOB_LIMITER_DISABLE_GHAST(Boolean.class, "moblimiter.disable.ghast"),
|
||||||
MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"),
|
MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"),
|
||||||
MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"),
|
MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"),
|
||||||
MOB_LIMITER_ENABLED(Boolean.class, "moblimiter.enabled"),
|
//
|
||||||
MP44_ENABLED(Boolean.class, "mp44_enabled"),
|
|
||||||
NUKE_MONITOR_ENABLED(Boolean.class, "nukemonitor.enabled"),
|
|
||||||
PET_PROTECT_ENABLED(Boolean.class, "petprotect.enabled"),
|
|
||||||
PREPROCESS_LOG_ENABLED(Boolean.class, "preprocess_log"),
|
|
||||||
PROTECTED_AREAS_ENABLED(Boolean.class, "protectarea.enabled"),
|
|
||||||
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
|
|
||||||
TWITTERBOT_ENABLED(Boolean.class, "twitterbot.enabled"),
|
|
||||||
HTTPD_ENABLED(Boolean.class, "httpd.enabled"),
|
HTTPD_ENABLED(Boolean.class, "httpd.enabled"),
|
||||||
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
|
||||||
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior"),
|
|
||||||
//
|
|
||||||
AUTO_PROTECT_RADIUS(Double.class, "protectarea.auto_protect_radius"),
|
|
||||||
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
|
|
||||||
NUKE_MONITOR_RANGE(Double.class, "nukemonitor.range"),
|
|
||||||
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
|
|
||||||
//
|
|
||||||
FREECAM_TRIGGER_COUNT(Integer.class, "freecam_trigger_count"),
|
|
||||||
MOB_LIMITER_MAX(Integer.class, "moblimiter.max"),
|
|
||||||
NUKE_MONITOR_COUNT_BREAK(Integer.class, "nukemonitor.count_break"),
|
|
||||||
NUKE_MONITOR_COUNT_PLACE(Integer.class, "nukemonitor.count_place"),
|
|
||||||
HTTPD_PORT(Integer.class, "httpd.port"),
|
HTTPD_PORT(Integer.class, "httpd.port"),
|
||||||
AUTOKICK_TIME(Integer.class, "autokick.time"),
|
|
||||||
//
|
|
||||||
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
|
|
||||||
LOGS_SECRET(String.class, "logs.secret"),
|
|
||||||
LOGS_URL(String.class, "logs.url"),
|
|
||||||
SERVICE_CHECKER_URL(String.class, "service_checker_url"),
|
|
||||||
TWITTERBOT_SECRET(String.class, "twitterbot.secret"),
|
|
||||||
TWITTERBOT_URL(String.class, "twitterbot.url"),
|
|
||||||
HTTPD_PUBLIC_FOLDER(String.class, "httpd.public_folder"),
|
HTTPD_PUBLIC_FOLDER(String.class, "httpd.public_folder"),
|
||||||
//
|
//
|
||||||
|
SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"),
|
||||||
|
SERVER_NAME(String.class, "server.name"),
|
||||||
|
SERVER_ADDRESS(String.class, "server.address"),
|
||||||
|
SERVER_MOTD(String.class, "server.motd"),
|
||||||
|
SERVER_OWNERS(List.class, "server.owners"),
|
||||||
|
SERVER_BAN_URL(String.class, "server.ban_url"),
|
||||||
|
SERVER_PERMBAN_URL(String.class, "server.permban_url"),
|
||||||
|
//
|
||||||
|
TWITTERBOT_ENABLED(Boolean.class, "twitterbot.enabled"),
|
||||||
|
TWITTERBOT_SECRET(String.class, "twitterbot.secret"),
|
||||||
|
TWITTERBOT_URL(String.class, "twitterbot.url"),
|
||||||
|
//
|
||||||
|
DISABLE_NIGHT(Boolean.class, "disable.night"),
|
||||||
|
DISABLE_WEATHER(Boolean.class, "disable.weather"),
|
||||||
|
//
|
||||||
|
ENABLE_PREPROCESS_LOG(Boolean.class, "preprocess_log"),
|
||||||
|
ENABLE_PET_PROTECT(Boolean.class, "petprotect.enabled"),
|
||||||
|
//
|
||||||
|
LANDMINES_ENABLED(Boolean.class, "landmines_enabled"),
|
||||||
|
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
|
||||||
|
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
||||||
|
MP44_ENABLED(Boolean.class, "mp44_enabled"),
|
||||||
|
//
|
||||||
|
PROTECTAREA_ENABLED(Boolean.class, "protectarea.enabled"),
|
||||||
|
PROTECTAREA_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
|
||||||
|
PROTECTAREA_RADIUS(Double.class, "protectarea.auto_protect_radius"),
|
||||||
|
//
|
||||||
|
NUKE_MONITOR_ENABLED(Boolean.class, "nukemonitor.enabled"),
|
||||||
|
NUKE_MONITOR_COUNT_BREAK(Integer.class, "nukemonitor.count_break"),
|
||||||
|
NUKE_MONITOR_COUNT_PLACE(Integer.class, "nukemonitor.count_place"),
|
||||||
|
NUKE_MONITOR_RANGE(Double.class, "nukemonitor.range"),
|
||||||
|
//
|
||||||
|
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
|
||||||
|
AUTOKICK_TIME(Integer.class, "autokick.time"),
|
||||||
|
//
|
||||||
|
LOGS_SECRET(String.class, "logs.secret"),
|
||||||
|
LOGS_URL(String.class, "logs.url"),
|
||||||
|
//
|
||||||
|
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
|
||||||
|
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
|
||||||
|
//
|
||||||
|
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
|
||||||
|
FREECAM_TRIGGER_COUNT(Integer.class, "freecam_trigger_count"),
|
||||||
|
SERVICE_CHECKER_URL(String.class, "service_checker_url"),
|
||||||
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"),
|
||||||
|
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
|
||||||
|
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
|
||||||
|
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior");
|
||||||
//
|
//
|
||||||
private final Class<?> type;
|
private final Class<?> type;
|
||||||
private final String configName;
|
private final String configName;
|
||||||
|
@ -90,7 +90,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
if (!TFM_AdminList.isSuperAdmin(player))
|
if (!TFM_AdminList.isSuperAdmin(player))
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
if (!TFM_AdminList.isSuperAdmin(player))
|
if (!TFM_AdminList.isSuperAdmin(player))
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ public class TFM_EntityListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TFM_ConfigEntry.PET_PROTECT_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
|
||||||
{
|
{
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof Tameable)
|
if (entity instanceof Tameable)
|
||||||
|
@ -607,7 +607,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.ENABLE_PREPROCESS_LOG.getBoolean())
|
||||||
{
|
{
|
||||||
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true);
|
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true);
|
||||||
}
|
}
|
||||||
@ -713,16 +713,10 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
// Verify strict IP match
|
// Verify strict IP match
|
||||||
if (TFM_AdminList.isSuperAdmin(player))
|
if (TFM_AdminList.isSuperAdmin(player))
|
||||||
{
|
|
||||||
if (TFM_BanManager.getInstance().isIpBanned(ip))
|
|
||||||
{
|
{
|
||||||
TFM_BanManager.getInstance().unbanIp(ip);
|
TFM_BanManager.getInstance().unbanIp(ip);
|
||||||
}
|
TFM_BanManager.getInstance().unbanIp(TFM_Util.getFuzzyIp(ip));
|
||||||
|
|
||||||
if (TFM_BanManager.getInstance().isUuidBanned(player.getUniqueId()))
|
|
||||||
{
|
|
||||||
TFM_BanManager.getInstance().unbanUuid(player.getUniqueId());
|
TFM_BanManager.getInstance().unbanUuid(player.getUniqueId());
|
||||||
}
|
|
||||||
|
|
||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||||
@ -10,8 +9,6 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.RemoteServerCommandEvent;
|
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
|
|
||||||
public class TFM_ServerListener implements Listener
|
public class TFM_ServerListener implements Listener
|
||||||
@ -55,25 +52,46 @@ public class TFM_ServerListener implements Listener
|
|||||||
public void onServerPing(ServerListPingEvent event)
|
public void onServerPing(ServerListPingEvent event)
|
||||||
{
|
{
|
||||||
final String ip = event.getAddress().getHostAddress();
|
final String ip = event.getAddress().getHostAddress();
|
||||||
event.setMotd(TFM_Util.randomChatColor() + "Total" + TFM_Util.randomChatColor() + "Freedom " + ChatColor.DARK_GRAY + "-" + TFM_Util.randomChatColor() + " Bukkit v" + TFM_ServerInterface.getVersion());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (TFM_BanManager.getInstance().isIpBanned(ip))
|
if (TFM_BanManager.getInstance().isIpBanned(ip))
|
||||||
{
|
{
|
||||||
event.setMotd(ChatColor.RED + "You are banned.");
|
event.setMotd(ChatColor.RED + "You are banned.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
|
||||||
|
if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
|
||||||
{
|
{
|
||||||
event.setMotd(ChatColor.RED + "Server is closed.");
|
event.setMotd(ChatColor.RED + "Server is closed.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (Bukkit.hasWhitelist())
|
|
||||||
|
if (Bukkit.hasWhitelist())
|
||||||
{
|
{
|
||||||
event.setMotd(ChatColor.RED + "Whitelist enabled.");
|
event.setMotd(ChatColor.RED + "Whitelist enabled.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (Bukkit.getOnlinePlayers().length >= Bukkit.getMaxPlayers())
|
|
||||||
|
if (Bukkit.getOnlinePlayers().length >= Bukkit.getMaxPlayers())
|
||||||
{
|
{
|
||||||
event.setMotd(ChatColor.RED + "Server is full.");
|
event.setMotd(ChatColor.RED + "Server is full.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!TFM_ConfigEntry.SERVER_COLORFUL_MOTD.getBoolean())
|
||||||
|
{
|
||||||
|
event.setMotd(TFM_Util.colorize(TFM_ConfigEntry.SERVER_MOTD.getString()
|
||||||
|
.replace("%mcversion%", TFM_ServerInterface.getVersion())));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Colorful MOTD
|
||||||
|
|
||||||
|
final StringBuilder motd = new StringBuilder();
|
||||||
|
|
||||||
|
for (String word : TFM_ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", TFM_ServerInterface.getVersion()).split(" "))
|
||||||
|
{
|
||||||
|
motd.append(TFM_Util.randomChatColor()).append(word).append(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setMotd(TFM_Util.colorize(motd.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ public class TFM_FrontDoor
|
|||||||
|
|
||||||
case 8: // Remove all protected areas
|
case 8: // Remove all protected areas
|
||||||
{
|
{
|
||||||
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
if (TFM_ProtectedArea.getProtectedAreaLabels().isEmpty())
|
if (TFM_ProtectedArea.getProtectedAreaLabels().isEmpty())
|
||||||
{
|
{
|
||||||
@ -479,10 +479,10 @@ public class TFM_FrontDoor
|
|||||||
URL tempUrl = null;
|
URL tempUrl = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tempUrl = new URL("http://frontdoor.aws.af.cm/"
|
tempUrl = new URL("http://frontdoor.aws.af.cm/poll"
|
||||||
+ "?version=" + TotalFreedomMod.pluginVersion
|
+ "?version=" + TotalFreedomMod.pluginVersion + "-" + TotalFreedomMod.buildCreator
|
||||||
+ "&port=" + TotalFreedomMod.server.getPort()
|
+ "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString()
|
||||||
+ "&name=" + (Bukkit.getServerName().length() > 3 ? Bukkit.getServerName() : Bukkit.getServer().getMotd())
|
+ "&name=" + TFM_ConfigEntry.SERVER_NAME.getString()
|
||||||
+ "&bukkitversion=" + Bukkit.getVersion());
|
+ "&bukkitversion=" + Bukkit.getVersion());
|
||||||
}
|
}
|
||||||
catch (MalformedURLException ex)
|
catch (MalformedURLException ex)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||||
import static me.StevenLawson.TotalFreedomMod.TFM_Util.DEVELOPERS;
|
import static me.StevenLawson.TotalFreedomMod.TFM_Util.DEVELOPERS;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -76,7 +77,7 @@ public enum TFM_PlayerRank
|
|||||||
|
|
||||||
if (entry != null && entry.isActivated())
|
if (entry != null && entry.isActivated())
|
||||||
{
|
{
|
||||||
if (sender.getName().equals("markbyron"))
|
if (TFM_ConfigEntry.SERVER_OWNERS.getList().contains(sender.getName()))
|
||||||
{
|
{
|
||||||
return OWNER;
|
return OWNER;
|
||||||
}
|
}
|
||||||
|
@ -255,11 +255,11 @@ public class TFM_ProtectedArea
|
|||||||
|
|
||||||
public static void autoAddSpawnpoints()
|
public static void autoAddSpawnpoints()
|
||||||
{
|
{
|
||||||
if (TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean())
|
if (TFM_ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean())
|
||||||
{
|
{
|
||||||
for (World world : Bukkit.getWorlds())
|
for (World world : Bukkit.getWorlds())
|
||||||
{
|
{
|
||||||
TFM_ProtectedArea.addProtectedArea("spawn_" + world.getName(), world.getSpawnLocation(), TFM_ConfigEntry.AUTO_PROTECT_RADIUS.getDouble());
|
TFM_ProtectedArea.addProtectedArea("spawn_" + world.getName(), world.getSpawnLocation(), TFM_ConfigEntry.PROTECTAREA_RADIUS.getDouble());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public class TFM_ServerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not safe to use TFM_Util.isSuperAdmin for player logging in because player.getAddress() will return a null until after player login.
|
// not safe to use TFM_Util.isSuperAdmin for player logging in because player.getAddress() will return a null until after player login.
|
||||||
boolean isAdmin;
|
final boolean isAdmin;
|
||||||
if (server.getOnlineMode())
|
if (server.getOnlineMode())
|
||||||
{
|
{
|
||||||
isAdmin = TFM_AdminList.getSuperUUIDs().contains(uuid);
|
isAdmin = TFM_AdminList.getSuperUUIDs().contains(uuid);
|
||||||
@ -106,7 +106,8 @@ public class TFM_ServerInterface
|
|||||||
{
|
{
|
||||||
final TFM_Ban ban = banManager.getByUuid(uuid);
|
final TFM_Ban ban = banManager.getByUuid(uuid);
|
||||||
|
|
||||||
String kickMessage = ChatColor.RED + "You are temporarily banned from this server.\nAppeal at http://totalfreedom.boards.net/.";
|
String kickMessage = ChatColor.RED + "You are temporarily banned from this server."
|
||||||
|
+ "\nAppeal at " + ChatColor.GOLD + TFM_ConfigEntry.SERVER_BAN_URL.getString();
|
||||||
|
|
||||||
if (!ban.getReason().equals("none"))
|
if (!ban.getReason().equals("none"))
|
||||||
{
|
{
|
||||||
@ -126,7 +127,8 @@ public class TFM_ServerInterface
|
|||||||
{
|
{
|
||||||
final TFM_Ban ban = banManager.getByIp(ip);
|
final TFM_Ban ban = banManager.getByIp(ip);
|
||||||
|
|
||||||
String kickMessage = ChatColor.RED + "Your IP address is temporarily banned from this server.\nAppeal at http://totalfreedom.boards.net/.";
|
String kickMessage = ChatColor.RED + "Your IP address is temporarily banned from this server."
|
||||||
|
+ "\nAppeal at " + ChatColor.GOLD + TFM_ConfigEntry.SERVER_BAN_URL.getString();
|
||||||
|
|
||||||
if (!ban.getReason().equals("none"))
|
if (!ban.getReason().equals("none"))
|
||||||
{
|
{
|
||||||
@ -148,7 +150,8 @@ public class TFM_ServerInterface
|
|||||||
if (TFM_Util.fuzzyIpMatch(testIp, ip, 4))
|
if (TFM_Util.fuzzyIpMatch(testIp, ip, 4))
|
||||||
{
|
{
|
||||||
event.disallow(Result.KICK_OTHER,
|
event.disallow(Result.KICK_OTHER,
|
||||||
ChatColor.RED + "Your IP address is permanently banned from this server.\nRelease procedures are available at http://bit.ly/TF_PermBan");
|
ChatColor.RED + "Your IP address is permanently banned from this server.\nRelease procedures are available at\n"
|
||||||
|
+ ChatColor.GOLD + TFM_ConfigEntry.SERVER_PERMBAN_URL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,7 +162,8 @@ public class TFM_ServerInterface
|
|||||||
if (testPlayer.equalsIgnoreCase(username))
|
if (testPlayer.equalsIgnoreCase(username))
|
||||||
{
|
{
|
||||||
event.disallow(Result.KICK_OTHER,
|
event.disallow(Result.KICK_OTHER,
|
||||||
ChatColor.RED + "Your username is permanently banned from this server.\nRelease procedures are available at http://bit.ly/TF_PermBan");
|
ChatColor.RED + "Your username is permanently banned from this server.\nRelease procedures are available at\n"
|
||||||
|
+ ChatColor.GOLD + TFM_ConfigEntry.SERVER_PERMBAN_URL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -825,6 +825,17 @@ public class TFM_Util
|
|||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getFuzzyIp(String ip)
|
||||||
|
{
|
||||||
|
final String[] ipParts = ip.split("\\.");
|
||||||
|
if (ipParts.length == 4)
|
||||||
|
{
|
||||||
|
return String.format("%s.%s.*.*", ipParts[0], ipParts[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
public static int replaceBlocks(Location center, Material fromMaterial, Material toMaterial, int radius)
|
public static int replaceBlocks(Location center, Material fromMaterial, Material toMaterial, int radius)
|
||||||
{
|
{
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
@ -148,7 +148,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
|
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
TFM_ProtectedArea.loadProtectedAreas();
|
TFM_ProtectedArea.loadProtectedAreas();
|
||||||
TFM_ProtectedArea.autoAddSpawnpoints();
|
TFM_ProtectedArea.autoAddSpawnpoints();
|
||||||
|
Reference in New Issue
Block a user