mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added config values for MOTD, server name and address. Resolves #178
This commit is contained in:
parent
16b02e3dec
commit
67c86aea24
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Wed May 14 16:21:24 CEST 2014
|
||||
build.number=848
|
||||
#Fri May 16 15:17:03 CEST 2014
|
||||
build.number=855
|
||||
|
@ -1,6 +1,26 @@
|
||||
# TotalFreedomMod v4.2 Configuration
|
||||
# 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
|
||||
|
||||
# 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
|
||||
allow:
|
||||
fire_place: false
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
@ -57,6 +58,7 @@ public class Command_tfm extends TFM_Command
|
||||
TotalFreedomMod.buildNumber,
|
||||
TotalFreedomMod.buildDate,
|
||||
TotalFreedomMod.buildCreator), ChatColor.GOLD);
|
||||
playerMsg("Running on " + TFM_ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
|
||||
playerMsg("Created by Madgeek1450 and DarthSalamon.", ChatColor.GOLD);
|
||||
playerMsg("Visit " + ChatColor.AQUA + "http://totalfreedom.me/" + ChatColor.GREEN + " for more information.", ChatColor.GREEN);
|
||||
|
||||
|
@ -34,6 +34,7 @@ public enum TFM_ConfigEntry
|
||||
HTTPD_ENABLED(Boolean.class, "httpd.enabled"),
|
||||
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
|
||||
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior"),
|
||||
SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"),
|
||||
//
|
||||
AUTO_PROTECT_RADIUS(Double.class, "protectarea.auto_protect_radius"),
|
||||
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
|
||||
@ -54,6 +55,11 @@ public enum TFM_ConfigEntry
|
||||
TWITTERBOT_SECRET(String.class, "twitterbot.secret"),
|
||||
TWITTERBOT_URL(String.class, "twitterbot.url"),
|
||||
HTTPD_PUBLIC_FOLDER(String.class, "httpd.public_folder"),
|
||||
SERVER_NAME(String.class, "server.name"),
|
||||
SERVER_ADDRESS(String.class, "server.address"),
|
||||
SERVER_MOTD(String.class, "server.motd"),
|
||||
SERVER_BAN_URL(String.class, "server.ban_url"),
|
||||
SERVER_PERMBAN_URL(String.class, "server.permban_url"),
|
||||
//
|
||||
BLOCKED_COMMANDS(List.class, "blocked_commands"),
|
||||
HOST_SENDER_NAMES(List.class, "host_sender_names"),
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_BanManager;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
|
||||
@ -10,8 +9,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.RemoteServerCommandEvent;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
public class TFM_ServerListener implements Listener
|
||||
@ -55,25 +52,46 @@ public class TFM_ServerListener implements Listener
|
||||
public void onServerPing(ServerListPingEvent event)
|
||||
{
|
||||
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))
|
||||
{
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
else if (Bukkit.hasWhitelist())
|
||||
|
||||
if (Bukkit.hasWhitelist())
|
||||
{
|
||||
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.");
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
@ -480,9 +480,9 @@ public class TFM_FrontDoor
|
||||
try
|
||||
{
|
||||
tempUrl = new URL("http://frontdoor.aws.af.cm/"
|
||||
+ "?version=" + TotalFreedomMod.pluginVersion
|
||||
+ "&port=" + TotalFreedomMod.server.getPort()
|
||||
+ "&name=" + (Bukkit.getServerName().length() > 3 ? Bukkit.getServerName() : Bukkit.getServer().getMotd())
|
||||
+ "?version=" + TotalFreedomMod.pluginVersion + "-" + TotalFreedomMod.buildCreator
|
||||
+ "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString()
|
||||
+ "&name=" + TFM_ConfigEntry.SERVER_NAME.getString()
|
||||
+ "&bukkitversion=" + Bukkit.getVersion());
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
|
@ -106,7 +106,8 @@ public class TFM_ServerInterface
|
||||
{
|
||||
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"))
|
||||
{
|
||||
@ -126,7 +127,8 @@ public class TFM_ServerInterface
|
||||
{
|
||||
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"))
|
||||
{
|
||||
@ -148,7 +150,8 @@ public class TFM_ServerInterface
|
||||
if (TFM_Util.fuzzyIpMatch(testIp, ip, 4))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -159,7 +162,8 @@ public class TFM_ServerInterface
|
||||
if (testPlayer.equalsIgnoreCase(username))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user