mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Removed Command_minecraft and TFM_ServiceChecker.
Restored old Mojang status checker in /status. Owner of xpaw.ru requested that 3rd party applications not use his API. Batch formatting fix.
This commit is contained in:
parent
f21e50e002
commit
22bf0c2f62
@ -1,5 +1,5 @@
|
|||||||
#Wed, 10 Jul 2013 23:43:28 +0200
|
#Wed, 10 Jul 2013 21:43:33 -0400
|
||||||
|
|
||||||
program.VERSION=2.21
|
program.VERSION=2.21
|
||||||
program.BUILDNUM=297
|
program.BUILDNUM=300
|
||||||
program.BUILDDATE=07/10/2013 11\:43 PM
|
program.BUILDDATE=07/10/2013 09\:43 PM
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Wed Jul 10 23:43:28 CEST 2013
|
#Wed Jul 10 21:43:33 EDT 2013
|
||||||
build.number=298
|
build.number=301
|
||||||
|
@ -102,5 +102,4 @@ public class Command_halt extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ServiceChecker;
|
|
||||||
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.BOTH)
|
|
||||||
@CommandParameters(description = "Shows the uptime of all minecraft services.", usage = "/<command>")
|
|
||||||
public class Command_minecraft extends TFM_Command
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
playerMsg("Status of Mojang services:", ChatColor.BLUE);
|
|
||||||
for (String service : TFM_ServiceChecker.getAllStatuses())
|
|
||||||
{
|
|
||||||
playerMsg(service);
|
|
||||||
}
|
|
||||||
playerMsg("Version " + TFM_ServiceChecker.version + ", Last Checked: " + TFM_ServiceChecker.last_updated, ChatColor.BLUE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +1,42 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.JSONValue;
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Show misc. server info.", usage = "/<command>")
|
@CommandParameters(description = "Show misc. server info.", usage = "/<command>")
|
||||||
public class Command_status extends TFM_Command
|
public class Command_status extends TFM_Command
|
||||||
{
|
{
|
||||||
|
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
SERVICE_MAP.put("minecraft.net", "Minecraft.net");
|
||||||
|
SERVICE_MAP.put("login.minecraft.net", "Minecraft Logins");
|
||||||
|
SERVICE_MAP.put("session.minecraft.net", "Minecraft Multiplayer Sessions");
|
||||||
|
SERVICE_MAP.put("account.mojang.com", "Mojang Accounts Website");
|
||||||
|
SERVICE_MAP.put("auth.mojang.com", "Mojang Accounts Login");
|
||||||
|
SERVICE_MAP.put("skins.minecraft.net", "Minecraft Skins");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
@ -26,6 +52,59 @@ public class Command_status extends TFM_Command
|
|||||||
playerMsg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
|
playerMsg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
||||||
|
{
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
URL mojang_status = new URL("http://status.mojang.com/check");
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(mojang_status.openStream()));
|
||||||
|
JSONArray status_json = (JSONArray) JSONValue.parse(in.readLine());
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
Map<String, Boolean> service_status = new HashMap<String, Boolean>();
|
||||||
|
|
||||||
|
Iterator status_it = status_json.iterator();
|
||||||
|
while (status_it.hasNext())
|
||||||
|
{
|
||||||
|
JSONObject service = (JSONObject) status_it.next();
|
||||||
|
Iterator service_it = service.entrySet().iterator();
|
||||||
|
while (service_it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<String, String> pair = (Entry<String, String>) service_it.next();
|
||||||
|
service_status.put(pair.getKey(), (pair.getValue().equals("green") ? Boolean.TRUE : Boolean.FALSE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> status_output = new ArrayList<String>();
|
||||||
|
|
||||||
|
Iterator<Entry<String, Boolean>> output_it = service_status.entrySet().iterator();
|
||||||
|
while (output_it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<String, Boolean> pair = output_it.next();
|
||||||
|
String service_name = pair.getKey();
|
||||||
|
boolean service_online = pair.getValue().booleanValue();
|
||||||
|
|
||||||
|
if (SERVICE_MAP.containsKey(service_name))
|
||||||
|
{
|
||||||
|
service_name = SERVICE_MAP.get(service_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
status_output.add(String.format("%s is %s", service_name, (service_online ? ChatColor.GREEN + "ONLINE" + ChatColor.GRAY : ChatColor.RED + "OFFLINE" + ChatColor.GRAY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
playerMsg(String.format("Mojang Service Status: %s.", StringUtils.join(status_output, ", ")), ChatColor.GRAY);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,8 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "See who has a block and optionally smite", usage = "/<command> <item> [smite]", aliases="wh")
|
@CommandParameters(description = "See who has a block and optionally smite", usage = "/<command> <item> [smite]", aliases = "wh")
|
||||||
public class Command_whohas extends TFM_Command
|
public class Command_whohas extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -71,7 +70,7 @@ public class Command_whohas extends TFM_Command
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playerMsg("Players with item " + material.name() + ": "+ StringUtils.join(players, ", "));
|
playerMsg("Players with item " + material.name() + ": " + StringUtils.join(players, ", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -679,10 +679,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onServerPing(ServerListPingEvent event)
|
public void onServerPing(ServerListPingEvent event)
|
||||||
{
|
{
|
||||||
//event.setMotd(ChatColor.translateAlternateColorCodes('&', event.getMotd()));
|
event.setMotd(TFM_Util.randomChatColor() + "Total" + TFM_Util.randomChatColor() + "Freedom " + ChatColor.DARK_GRAY + "-" + TFM_Util.randomChatColor() + " Bukkit v" + TFM_ServerInterface.getVersion());
|
||||||
|
|
||||||
event.setMotd(TFM_Util.randomChatColor() + "Total" + TFM_Util.randomChatColor() + "Freedom " + ChatColor.DARK_GRAY
|
|
||||||
+ "-" + TFM_Util.randomChatColor() + " Bukkit v" + TFM_ServerInterface.getVersion());
|
|
||||||
|
|
||||||
if (TFM_ServerInterface.isIPBanned(event.getAddress().getHostAddress()))
|
if (TFM_ServerInterface.isIPBanned(event.getAddress().getHostAddress()))
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class TFM_CommandBlocker
|
public class TFM_CommandBlocker
|
||||||
{
|
{
|
||||||
|
|
||||||
public static boolean isCommandBlocked(String usedcommand, CommandSender sender)
|
public static boolean isCommandBlocked(String usedcommand, CommandSender sender)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -109,7 +108,6 @@ public class TFM_CommandBlocker
|
|||||||
TELNET("t", 3),
|
TELNET("t", 3),
|
||||||
SENIOR("c", 4),
|
SENIOR("c", 4),
|
||||||
NOBODY("n", 5);
|
NOBODY("n", 5);
|
||||||
|
|
||||||
private String letter = "n";
|
private String letter = "n";
|
||||||
private int rank = 5;
|
private int rank = 5;
|
||||||
|
|
||||||
@ -162,10 +160,5 @@ public class TFM_CommandBlocker
|
|||||||
}
|
}
|
||||||
return SenderRank.NOBODY;
|
return SenderRank.NOBODY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -171,8 +171,7 @@ public class TFM_ServerInterface
|
|||||||
kick_message = kick_message + "\nReason: " + ban_entry.getReason();
|
kick_message = kick_message + "\nReason: " + ban_entry.getReason();
|
||||||
if (ban_entry.getExpires() != null)
|
if (ban_entry.getExpires() != null)
|
||||||
{
|
{
|
||||||
kick_message = kick_message + "\nYour ban will be removed on "
|
kick_message = kick_message + "\nYour ban will be removed on " + date_format.format(ban_entry.getExpires());
|
||||||
+ date_format.format(ban_entry.getExpires());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,8 +215,7 @@ public class TFM_ServerInterface
|
|||||||
kick_message = kick_message + "\nReason: " + ban_entry.getReason();
|
kick_message = kick_message + "\nReason: " + ban_entry.getReason();
|
||||||
if (ban_entry.getExpires() != null)
|
if (ban_entry.getExpires() != null)
|
||||||
{
|
{
|
||||||
kick_message = kick_message + "\nYour ban will be removed on "
|
kick_message = kick_message + "\nYour ban will be removed on " + date_format.format(ban_entry.getExpires());
|
||||||
+ date_format.format(ban_entry.getExpires());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,8 +227,7 @@ public class TFM_ServerInterface
|
|||||||
{
|
{
|
||||||
if (test_player.equalsIgnoreCase(player_name))
|
if (test_player.equalsIgnoreCase(player_name))
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED + "Your username is permanently banned from this server.");
|
||||||
+ "Your username is permanently banned from this server.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,8 +236,7 @@ public class TFM_ServerInterface
|
|||||||
{
|
{
|
||||||
if (TFM_Util.fuzzyIpMatch(test_ip, player_ip, 4))
|
if (TFM_Util.fuzzyIpMatch(test_ip, player_ip, 4))
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED
|
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.RED + "Your IP address is permanently banned from this server.");
|
||||||
+ "Your IP address is permanently banned from this server.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,207 +0,0 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.apache.commons.lang.WordUtils;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.JSONValue;
|
|
||||||
|
|
||||||
public class TFM_ServiceChecker
|
|
||||||
{
|
|
||||||
private static final Map<String, String[]> SERVICE_MAP = new HashMap<String, String[]>();
|
|
||||||
public static String check_url = "http://xpaw.ru/mcstatus/status.json";
|
|
||||||
public static String version = "1.0";
|
|
||||||
public static String last_updated = ""; // On xpaw.ru
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
// <"up", "down", "problem">, <"Online", "Quite Slow", "Error 505", etc>, <String (Uptime percentage)>
|
|
||||||
SERVICE_MAP.put("website", new String[]
|
|
||||||
{
|
|
||||||
"up", "Online", "100.00"
|
|
||||||
});
|
|
||||||
SERVICE_MAP.put("session", new String[]
|
|
||||||
{
|
|
||||||
"up", "Online", "100.00"
|
|
||||||
});
|
|
||||||
SERVICE_MAP.put("login", new String[]
|
|
||||||
{
|
|
||||||
"up", "Online", "100.00"
|
|
||||||
});
|
|
||||||
SERVICE_MAP.put("account", new String[]
|
|
||||||
{
|
|
||||||
"up", "Online", "100.00"
|
|
||||||
});
|
|
||||||
SERVICE_MAP.put("skins", new String[]
|
|
||||||
{
|
|
||||||
"up", "Online", "100.00"
|
|
||||||
});
|
|
||||||
SERVICE_MAP.put("realms", new String[]
|
|
||||||
{
|
|
||||||
"up", "Online", "100.00"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public static Runnable checker = new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
runCheck();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public static void runCheck()
|
|
||||||
{
|
|
||||||
TotalFreedomMod.server.getScheduler().runTaskAsynchronously(TotalFreedomMod.plugin, new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
/* // Nubcakes be 403'ing us >;o
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(new URL(check_url).openStream()));
|
|
||||||
JSONObject service_json = (JSONObject) JSONValue.parse(in.readLine());
|
|
||||||
in.close();
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Well, lets bypass that! >:D
|
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(check_url).openConnection();
|
|
||||||
connection.setRequestMethod("GET");
|
|
||||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36");
|
|
||||||
connection.setRequestProperty("Host", "xpaw.ru");
|
|
||||||
connection.setRequestProperty("Accept", "*/*");
|
|
||||||
connection.setUseCaches(false);
|
|
||||||
connection.setDoInput(true);
|
|
||||||
connection.setDoOutput(false);
|
|
||||||
InputStream is = connection.getInputStream();
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(is));
|
|
||||||
JSONObject service_json = (JSONObject) JSONValue.parse(in.readLine());
|
|
||||||
in.close();
|
|
||||||
connection.disconnect();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
version = String.valueOf(service_json.get("v"));
|
|
||||||
last_updated = (String) service_json.get("last_updated");
|
|
||||||
|
|
||||||
JSONObject services = (JSONObject) service_json.get("report");
|
|
||||||
for (String service : SERVICE_MAP.keySet())
|
|
||||||
{
|
|
||||||
JSONObject service_info = (JSONObject) services.get(service);
|
|
||||||
SERVICE_MAP.put(service, new String[]
|
|
||||||
{
|
|
||||||
(String) service_info.get("status"),
|
|
||||||
(String) service_info.get("title"),
|
|
||||||
(String) service_info.get("uptime")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFormattedStatus(String service_name)
|
|
||||||
{
|
|
||||||
String[] service = SERVICE_MAP.get(service_name);
|
|
||||||
String status = ("up".equals(service[0]) ? ChatColor.GREEN
|
|
||||||
: ("down".equals(service[0]) ? ChatColor.RED : ChatColor.GOLD)).toString();
|
|
||||||
|
|
||||||
status += service[1] + ChatColor.GRAY + " (";
|
|
||||||
|
|
||||||
status += (Float.parseFloat(service[2]) >= 96.0 ? ChatColor.GREEN
|
|
||||||
: (Float.parseFloat(service[2]) > 90.0 ? ChatColor.GOLD : ChatColor.RED));
|
|
||||||
|
|
||||||
status += service[2] + "%" + ChatColor.GRAY + ")";
|
|
||||||
|
|
||||||
return ChatColor.GRAY + WordUtils.capitalize(service_name) + ChatColor.WHITE + ": " + status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<String> getAllStatuses()
|
|
||||||
{
|
|
||||||
List<String> statuses = new ArrayList<String>();
|
|
||||||
for (String status : SERVICE_MAP.keySet())
|
|
||||||
{
|
|
||||||
statuses.add(getFormattedStatus(status));
|
|
||||||
}
|
|
||||||
return statuses;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* // Mojang status
|
|
||||||
public static final Map<String, String> SERVICE_MAP = new HashMap<String, String>();
|
|
||||||
|
|
||||||
static
|
|
||||||
{
|
|
||||||
SERVICE_MAP.put("minecraft.net", "Minecraft.net");
|
|
||||||
SERVICE_MAP.put("login.minecraft.net", "Minecraft Logins");
|
|
||||||
SERVICE_MAP.put("session.minecraft.net", "Minecraft Multiplayer Sessions");
|
|
||||||
SERVICE_MAP.put("account.mojang.com", "Mojang Accounts Website");
|
|
||||||
SERVICE_MAP.put("auth.mojang.com", "Mojang Accounts Login");
|
|
||||||
SERVICE_MAP.put("skins.minecraft.net", "Minecraft Skins");
|
|
||||||
}
|
|
||||||
server.getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
URL mojang_status = new URL("http://status.mojang.com/check");
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(mojang_status.openStream()));
|
|
||||||
JSONArray status_json = (JSONArray) JSONValue.parse(in.readLine());
|
|
||||||
in.close();
|
|
||||||
|
|
||||||
Map<String, Boolean> service_status = new HashMap<String, Boolean>();
|
|
||||||
|
|
||||||
Iterator status_it = status_json.iterator();
|
|
||||||
while (status_it.hasNext())
|
|
||||||
{
|
|
||||||
JSONObject service = (JSONObject) status_it.next();
|
|
||||||
Iterator service_it = service.entrySet().iterator();
|
|
||||||
while (service_it.hasNext())
|
|
||||||
{
|
|
||||||
Entry<String, String> pair = (Entry<String, String>) service_it.next();
|
|
||||||
service_status.put(pair.getKey(), (pair.getValue().equals("green") ? Boolean.TRUE : Boolean.FALSE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> status_output = new ArrayList<String>();
|
|
||||||
|
|
||||||
Iterator<Entry<String, Boolean>> output_it = service_status.entrySet().iterator();
|
|
||||||
while (output_it.hasNext())
|
|
||||||
{
|
|
||||||
Entry<String, Boolean> pair = output_it.next();
|
|
||||||
String service_name = pair.getKey();
|
|
||||||
boolean service_online = pair.getValue().booleanValue();
|
|
||||||
|
|
||||||
if (SERVICE_MAP.containsKey(service_name))
|
|
||||||
{
|
|
||||||
service_name = SERVICE_MAP.get(service_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
status_output.add(String.format("%s is %s", service_name, (service_online ? ChatColor.GREEN + "ONLINE" + ChatColor.GRAY : ChatColor.RED + "OFFLINE" + ChatColor.GRAY)));
|
|
||||||
}
|
|
||||||
|
|
||||||
playerMsg(String.format("Mojang Service Status: %s.", StringUtils.join(status_output, ", ")), ChatColor.GRAY);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
@ -969,8 +969,7 @@ public class TFM_Util
|
|||||||
{
|
{
|
||||||
if (TFM_SuperadminList.isUserSuperadmin(p))
|
if (TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
p.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED
|
p.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ": " + ChatColor.AQUA + message);
|
||||||
+ name + ": " + ChatColor.AQUA + message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1035,7 +1034,6 @@ public class TFM_Util
|
|||||||
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
while (checkClass.getSuperclass() != Object.class && ((checkClass = checkClass.getSuperclass()) != null));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final List<ChatColor> COLOR_POOL = Arrays.asList(
|
public static final List<ChatColor> COLOR_POOL = Arrays.asList(
|
||||||
ChatColor.DARK_BLUE,
|
ChatColor.DARK_BLUE,
|
||||||
ChatColor.DARK_GREEN,
|
ChatColor.DARK_GREEN,
|
||||||
@ -1049,8 +1047,8 @@ public class TFM_Util
|
|||||||
ChatColor.RED,
|
ChatColor.RED,
|
||||||
ChatColor.LIGHT_PURPLE,
|
ChatColor.LIGHT_PURPLE,
|
||||||
ChatColor.YELLOW);
|
ChatColor.YELLOW);
|
||||||
|
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
public static ChatColor randomChatColor()
|
public static ChatColor randomChatColor()
|
||||||
{
|
{
|
||||||
return COLOR_POOL.get(RANDOM.nextInt(COLOR_POOL.size()));
|
return COLOR_POOL.get(RANDOM.nextInt(COLOR_POOL.size()));
|
||||||
|
@ -28,35 +28,35 @@ import org.mcstats.Metrics;
|
|||||||
public class TotalFreedomMod extends JavaPlugin
|
public class TotalFreedomMod extends JavaPlugin
|
||||||
{
|
{
|
||||||
public static final Server server = Bukkit.getServer();
|
public static final Server server = Bukkit.getServer();
|
||||||
|
//
|
||||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||||
public static final long SERVICE_CHECKER_RATE = 30L;
|
public static final long SERVICE_CHECKER_RATE = 30L;
|
||||||
|
//
|
||||||
public static final String CONFIG_FILE = "config.yml";
|
public static final String CONFIG_FILE = "config.yml";
|
||||||
public static final String SUPERADMIN_FILE = "superadmin.yml";
|
public static final String SUPERADMIN_FILE = "superadmin.yml";
|
||||||
public static final String PERMBAN_FILE = "permban.yml";
|
public static final String PERMBAN_FILE = "permban.yml";
|
||||||
public static final String PROTECTED_AREA_FILE = "protectedareas.dat";
|
public static final String PROTECTED_AREA_FILE = "protectedareas.dat";
|
||||||
public static final String SAVED_FLAGS_FILE = "savedflags.dat";
|
public static final String SAVED_FLAGS_FILE = "savedflags.dat";
|
||||||
|
//
|
||||||
public static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
public static final String COMMAND_PATH = "me.StevenLawson.TotalFreedomMod.Commands";
|
||||||
public static final String COMMAND_PREFIX = "Command_";
|
public static final String COMMAND_PREFIX = "Command_";
|
||||||
|
//
|
||||||
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
||||||
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||||
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||||
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
||||||
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
|
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
|
||||||
|
//
|
||||||
public static boolean allPlayersFrozen = false;
|
public static boolean allPlayersFrozen = false;
|
||||||
public static int freezePurgeEventId = 0;
|
public static int freezePurgeEventId = 0;
|
||||||
public static int mutePurgeEventId = 0;
|
public static int mutePurgeEventId = 0;
|
||||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
||||||
|
//
|
||||||
public static String pluginVersion = "";
|
public static String pluginVersion = "";
|
||||||
public static String buildNumber = "";
|
public static String buildNumber = "";
|
||||||
public static String buildDate = "";
|
public static String buildDate = "";
|
||||||
public static String pluginName = "";
|
public static String pluginName = "";
|
||||||
|
//
|
||||||
public static TotalFreedomMod plugin = null;
|
public static TotalFreedomMod plugin = null;
|
||||||
public static File plugin_file = null;
|
public static File plugin_file = null;
|
||||||
|
|
||||||
@ -106,13 +106,8 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
// Heartbeat
|
// Heartbeat
|
||||||
server.getScheduler().scheduleSyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
server.getScheduler().scheduleSyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||||
|
|
||||||
// Service uptime checker
|
|
||||||
server.getScheduler().scheduleSyncRepeatingTask(this, TFM_ServiceChecker.checker, SERVICE_CHECKER_RATE * 20L, 1 * 20L);
|
|
||||||
|
|
||||||
TFM_CommandLoader.getInstance().scan();
|
TFM_CommandLoader.getInstance().scan();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// metrics @ http://mcstats.org/plugin/TotalFreedomMod
|
// metrics @ http://mcstats.org/plugin/TotalFreedomMod
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -124,8 +119,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_Log.warning("Failed to submit metrics data: " + ex.getMessage());
|
TFM_Log.warning("Failed to submit metrics data: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "."
|
TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
||||||
+ TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -201,7 +195,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
public static boolean allowFirePlace = false;
|
public static boolean allowFirePlace = false;
|
||||||
public static Boolean allowFireSpread = false;
|
public static Boolean allowFireSpread = false;
|
||||||
public static Boolean allowLavaDamage = false;
|
public static Boolean allowLavaDamage = false;
|
||||||
@ -292,7 +286,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_Log.severe("Error loading main config: " + ex.getMessage());
|
TFM_Log.severe("Error loading main config: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static List<String> superadmins = new ArrayList<String>();
|
public static List<String> superadmins = new ArrayList<String>();
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -313,7 +307,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_Log.severe("Error loading superadmin list: " + ex.getMessage());
|
TFM_Log.severe("Error loading superadmin list: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
public static List<String> permbanned_players = new ArrayList<String>();
|
public static List<String> permbanned_players = new ArrayList<String>();
|
||||||
public static List<String> permbanned_ips = new ArrayList<String>();
|
public static List<String> permbanned_ips = new ArrayList<String>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user