mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merged with master
This commit is contained in:
commit
b6d3e5baca
@ -1,3 +1,4 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Tue Aug 26 18:22:59 CEST 2014
|
||||
build.number=934
|
||||
build.number=935
|
||||
|
||||
|
@ -36,8 +36,6 @@ allow:
|
||||
tnt_minecarts: false
|
||||
explosions: false
|
||||
|
||||
explosive_radius: 4.0
|
||||
|
||||
# Blocked commands:
|
||||
#
|
||||
# How blocked commands work:
|
||||
@ -114,7 +112,7 @@ blocked_commands:
|
||||
- 's:a:/restart'
|
||||
- 's:b:/setblock:_'
|
||||
|
||||
# Automatically wipe dropped objects:
|
||||
# Automatically wipe dropped objects
|
||||
auto_wipe: true
|
||||
|
||||
# Nuking prevention
|
||||
@ -125,8 +123,9 @@ nukemonitor:
|
||||
range: 10.0
|
||||
|
||||
freecam_trigger_count: 10
|
||||
explosive_radius: 4.0
|
||||
|
||||
# Show all attempted commands in the log, will result in duplicate log messages:
|
||||
# Show all attempted commands in the log, will result in duplicate log messages
|
||||
preprocess_log: true
|
||||
|
||||
# Disable certain events
|
||||
@ -135,13 +134,12 @@ disable:
|
||||
weather: true
|
||||
|
||||
|
||||
# Enable misc. features:
|
||||
# Enable misc. features
|
||||
landmines_enabled: false
|
||||
mp44_enabled: false
|
||||
tossmob_enabled: false
|
||||
|
||||
# Moblimiter:
|
||||
|
||||
# Moblimiter
|
||||
moblimiter:
|
||||
enabled: true
|
||||
max: 50
|
||||
@ -154,7 +152,8 @@ moblimiter:
|
||||
# Flatlands
|
||||
flatlands:
|
||||
generate: true
|
||||
# Flatlands generation parameters, uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
|
||||
|
||||
# Flatlands generation parameters - Uses CleanroomGenerator syntax - http://dev.bukkit.org/server-mods/cleanroomgenerator/
|
||||
generate_params: 16,stone,32,dirt,1,grass
|
||||
|
||||
# Admin-Only Mode
|
||||
@ -176,6 +175,21 @@ host_sender_names:
|
||||
- rcon
|
||||
- remotebukkit
|
||||
|
||||
# Announcer
|
||||
announcer:
|
||||
enabled: true
|
||||
|
||||
# Interval between announcements, in seconds.
|
||||
interval: 600
|
||||
|
||||
# Prefix for all announcements
|
||||
prefix: '&5[&eTotalFreedom&5] &b'
|
||||
|
||||
announcements:
|
||||
- 'Be sure to visit our forums at &6http://totalfreedom.boards.net/'
|
||||
- 'You can always review the server rules here: &6http://totalfreedom.me/'
|
||||
- 'If you aren''t OP, be sure to ask!'
|
||||
|
||||
# Players who cannot be banned by username
|
||||
unbannable_usernames:
|
||||
- honeydew
|
||||
@ -226,7 +240,7 @@ twitterbot:
|
||||
petprotect:
|
||||
enabled: true
|
||||
|
||||
# Logs Registration
|
||||
# Logviewer
|
||||
logs:
|
||||
url: ''
|
||||
secret: ''
|
||||
@ -234,7 +248,7 @@ logs:
|
||||
# Mojang service checker
|
||||
service_checker_url: http://status.mojang.com/check
|
||||
|
||||
# HTTPD
|
||||
# HTTPD server
|
||||
httpd:
|
||||
enabled: true
|
||||
port: 28966
|
||||
@ -243,7 +257,9 @@ httpd:
|
||||
# Inactivity Auto-Kick (Requires Essentials)
|
||||
autokick:
|
||||
enabled: true
|
||||
|
||||
# autokick_threshold - Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0
|
||||
threshold: 0.9
|
||||
|
||||
# autokick_time - Time, in seconds, after which a player should be kicked when inactive
|
||||
time: 120
|
||||
|
@ -14,6 +14,11 @@ public class Command_rollback extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
if ("purgeall".equals(args[0]))
|
||||
@ -40,8 +45,10 @@ public class Command_rollback extends TFM_Command
|
||||
playerMsg("Rolled back " + TFM_RollbackManager.rollback(playerName) + " edits for " + playerName + ".");
|
||||
playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (args.length == 2)
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
if ("purge".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
@ -54,8 +61,10 @@ public class Command_rollback extends TFM_Command
|
||||
}
|
||||
|
||||
playerMsg("Purged " + TFM_RollbackManager.purgeEntries(playerName) + " rollback history entries for " + playerName + ".");
|
||||
return true;
|
||||
}
|
||||
else if ("undo".equalsIgnoreCase(args[0]))
|
||||
|
||||
if ("undo".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
final String playerName = TFM_RollbackManager.findPlayer(args[1]);
|
||||
|
||||
@ -67,17 +76,10 @@ public class Command_rollback extends TFM_Command
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Reverting rollback for player: " + playerName, false);
|
||||
playerMsg("Reverted " + TFM_RollbackManager.undoRollback(playerName) + " edits for " + playerName + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,11 @@ public enum TFM_ConfigEntry
|
||||
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
|
||||
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
|
||||
//
|
||||
ANNOUNCER_ENABLED(Boolean.class, "announcer.enabled"),
|
||||
ANNOUNCER_INTERVAL(Integer.class, "announcer.interval"),
|
||||
ANNOUNCER_PREFIX(String.class, "announcer.prefix"),
|
||||
ANNOUNCER_ANNOUNCEMENTS(List.class, "announcer.announcements"),
|
||||
//
|
||||
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
|
||||
FREECAM_TRIGGER_COUNT(Integer.class, "freecam_trigger_count"),
|
||||
SERVICE_CHECKER_URL(String.class, "service_checker_url"),
|
||||
|
112
src/me/StevenLawson/TotalFreedomMod/TFM_Announcer.java
Normal file
112
src/me/StevenLawson/TotalFreedomMod/TFM_Announcer.java
Normal file
@ -0,0 +1,112 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.Config.TFM_ConfigEntry;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class TFM_Announcer
|
||||
{
|
||||
private static final List<String> ANNOUNCEMENTS = new ArrayList<String>();
|
||||
private static boolean enabled;
|
||||
private static long interval;
|
||||
private static String prefix;
|
||||
private static BukkitRunnable announcer;
|
||||
|
||||
private TFM_Announcer()
|
||||
{
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static List<String> getAnnouncements()
|
||||
{
|
||||
return Collections.unmodifiableList(ANNOUNCEMENTS);
|
||||
}
|
||||
|
||||
public static long getTickInterval()
|
||||
{
|
||||
return interval;
|
||||
}
|
||||
|
||||
public static String getPrefix()
|
||||
{
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public static void load()
|
||||
{
|
||||
stop();
|
||||
|
||||
ANNOUNCEMENTS.clear();
|
||||
|
||||
for (Object announcement : TFM_ConfigEntry.ANNOUNCER_ANNOUNCEMENTS.getList())
|
||||
{
|
||||
ANNOUNCEMENTS.add(TFM_Util.colorize((String) announcement));
|
||||
}
|
||||
|
||||
enabled = TFM_ConfigEntry.ANNOUNCER_ENABLED.getBoolean();
|
||||
interval = TFM_ConfigEntry.ANNOUNCER_INTERVAL.getInteger() * 20L;
|
||||
prefix = TFM_Util.colorize(TFM_ConfigEntry.ANNOUNCER_PREFIX.getString());
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isStarted()
|
||||
{
|
||||
return announcer != null;
|
||||
}
|
||||
|
||||
public static void start()
|
||||
{
|
||||
if (isStarted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
announcer = new BukkitRunnable()
|
||||
{
|
||||
private int current = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
current++;
|
||||
|
||||
if (current >= ANNOUNCEMENTS.size())
|
||||
{
|
||||
current = 0;
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg(prefix + ANNOUNCEMENTS.get(current));
|
||||
}
|
||||
};
|
||||
|
||||
announcer.runTaskTimer(TotalFreedomMod.plugin, interval, interval);
|
||||
}
|
||||
|
||||
public static void stop()
|
||||
{
|
||||
if (announcer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
announcer.cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
announcer = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -70,8 +70,6 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_Log.info("Made by Madgeek1450 and DarthSalamon");
|
||||
TFM_Log.info("Compiled " + buildDate + " by " + buildCreator);
|
||||
|
||||
TFM_Util.deleteCoreDumps();
|
||||
|
||||
if (!TFM_ServerInterface.COMPILE_NMS_VERSION.equals(TFM_Util.getNmsVersion()))
|
||||
{
|
||||
TFM_Log.warning(pluginName + " is compiled for " + TFM_ServerInterface.COMPILE_NMS_VERSION + " but the server is running "
|
||||
@ -79,19 +77,27 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_Log.warning("This might result in unexpected behaviour!");
|
||||
}
|
||||
|
||||
// Admin list
|
||||
TFM_Util.deleteCoreDumps();
|
||||
TFM_Util.deleteFolder(new File("./_deleteme"));
|
||||
|
||||
// Create backups
|
||||
TFM_Util.createBackups(SUPERADMIN_FILE);
|
||||
TFM_AdminList.load();
|
||||
|
||||
// Permban list
|
||||
TFM_Util.createBackups(PERMBAN_FILE);
|
||||
TFM_PermbanList.load();
|
||||
|
||||
// Playerlist and bans
|
||||
// Load services
|
||||
TFM_AdminList.load();
|
||||
TFM_PermbanList.load();
|
||||
TFM_PlayerList.load();
|
||||
TFM_BanManager.load();
|
||||
TFM_Announcer.load();
|
||||
|
||||
TFM_Util.deleteFolder(new File("./_deleteme"));
|
||||
// Protect area
|
||||
// TODO: Refractor to single .load() method
|
||||
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||
{
|
||||
TFM_ProtectedArea.loadProtectedAreas();
|
||||
TFM_ProtectedArea.autoAddSpawnpoints();
|
||||
}
|
||||
|
||||
final PluginManager pm = server.getPluginManager();
|
||||
pm.registerEvents(new TFM_EntityListener(), plugin);
|
||||
@ -107,6 +113,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.warning("Could not load world: Flatlands");
|
||||
}
|
||||
|
||||
try
|
||||
@ -115,6 +122,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TFM_Log.warning("Could not load world: AdminWorld");
|
||||
}
|
||||
|
||||
// Initialize game rules
|
||||
@ -127,6 +135,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.NATURAL_REGENERATION, true, false);
|
||||
TFM_GameRuleHandler.commitGameRules();
|
||||
|
||||
// Disable weather
|
||||
if (TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
|
||||
{
|
||||
for (World world : server.getWorlds())
|
||||
@ -138,16 +147,17 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
}
|
||||
}
|
||||
|
||||
if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||
{
|
||||
TFM_ProtectedArea.loadProtectedAreas();
|
||||
TFM_ProtectedArea.autoAddSpawnpoints();
|
||||
}
|
||||
|
||||
// Heartbeat
|
||||
new TFM_Heartbeat(plugin).runTaskTimer(plugin, HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||
|
||||
// metrics @ http://mcstats.org/plugin/TotalFreedomMod
|
||||
// Start services
|
||||
TFM_ServiceChecker.start();
|
||||
TFM_HTTPD_Manager.start();
|
||||
TFM_FrontDoor.start();
|
||||
|
||||
TFM_Log.info("Version " + pluginVersion + " for " + TFM_ServerInterface.COMPILE_NMS_VERSION + " enabled");
|
||||
|
||||
// Metrics @ http://mcstats.org/plugin/TotalFreedomMod
|
||||
try
|
||||
{
|
||||
final Metrics metrics = new Metrics(plugin);
|
||||
@ -158,13 +168,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
TFM_Log.warning("Failed to submit metrics data: " + ex.getMessage());
|
||||
}
|
||||
|
||||
TFM_ServiceChecker.start();
|
||||
TFM_HTTPD_Manager.start();
|
||||
TFM_FrontDoor.start();
|
||||
|
||||
TFM_Log.info("Version " + pluginVersion + " for " + TFM_ServerInterface.COMPILE_NMS_VERSION + " enabled");
|
||||
|
||||
// Delayed Start:
|
||||
// Load commands later
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user