Added suppress-tick-sync-warnings option.

This commit is contained in:
sk89q 2011-02-05 13:45:05 -08:00
parent d042185660
commit cc72d370ea
3 changed files with 46 additions and 0 deletions

View File

@ -21,6 +21,8 @@
summary-on-start: on
suppress-tick-sync-warnings: false
protection:
enforce-single-session: on
item-durability: on

View File

@ -0,0 +1,35 @@
// $Id$
/*
* WorldGuard
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldguard;
import java.util.logging.Filter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
public class TickSyncDelayLoggerFilter implements Filter {
public boolean isLoggable(LogRecord record) {
if (record.getMessage().equals("Can't keep up! Did the system time change, or is the server overloaded?")
&& record.getLevel() == Level.WARNING) {
return false;
}
return true;
}
}

View File

@ -52,6 +52,7 @@
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.TickSyncDelayLoggerFilter;
import com.sk89q.worldguard.blacklist.*;
import com.sk89q.worldguard.blacklist.loggers.*;
import com.sk89q.worldguard.domains.DefaultDomain;
@ -92,6 +93,8 @@ public class WorldGuardPlugin extends JavaPlugin {
// Configuration follows
boolean suppressTickSyncWarnings;
boolean enforceOneSession;
boolean itemDurability;
@ -161,6 +164,10 @@ public WorldGuardPlugin(PluginLoader pluginLoader, Server instance,
loadConfiguration();
postReload();
registerEvents();
if (suppressTickSyncWarnings) {
Logger.getLogger("Minecraft").setFilter(new TickSyncDelayLoggerFilter());
}
}
/**
@ -262,6 +269,8 @@ public void loadConfiguration() {
Configuration config = getConfiguration();
config.load();
perms.load();
suppressTickSyncWarnings = config.getBoolean("suppress-tick-sync-warnings", false);
enforceOneSession = config.getBoolean("protection.enforce-single-session", true);
itemDurability = config.getBoolean("protection.item-durability", true);