Set wasInBed in postEnable to prevent kicking with plugin managers.

This commit is contained in:
asofold 2014-08-01 21:06:23 +02:00
parent 427a877b17
commit e84027a919
3 changed files with 22 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.Check; import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
public class BedLeave extends Check { public class BedLeave extends Check {

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.access.ACheckData; import fr.neatmonster.nocheatplus.checks.access.ACheckData;
import fr.neatmonster.nocheatplus.checks.access.CheckDataFactory; import fr.neatmonster.nocheatplus.checks.access.CheckDataFactory;
import fr.neatmonster.nocheatplus.checks.access.ICheckData; import fr.neatmonster.nocheatplus.checks.access.ICheckData;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.utilities.ActionFrequency; import fr.neatmonster.nocheatplus.utilities.ActionFrequency;
import fr.neatmonster.nocheatplus.utilities.PenaltyTime; import fr.neatmonster.nocheatplus.utilities.PenaltyTime;

View File

@ -38,6 +38,7 @@ import fr.neatmonster.nocheatplus.checks.blockbreak.BlockBreakListener;
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener; import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener;
import fr.neatmonster.nocheatplus.checks.blockplace.BlockPlaceListener; import fr.neatmonster.nocheatplus.checks.blockplace.BlockPlaceListener;
import fr.neatmonster.nocheatplus.checks.chat.ChatListener; import fr.neatmonster.nocheatplus.checks.chat.ChatListener;
import fr.neatmonster.nocheatplus.checks.combined.CombinedData;
import fr.neatmonster.nocheatplus.checks.combined.CombinedListener; import fr.neatmonster.nocheatplus.checks.combined.CombinedListener;
import fr.neatmonster.nocheatplus.checks.fight.FightListener; import fr.neatmonster.nocheatplus.checks.fight.FightListener;
import fr.neatmonster.nocheatplus.checks.inventory.InventoryListener; import fr.neatmonster.nocheatplus.checks.inventory.InventoryListener;
@ -862,22 +863,25 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
* Actions to be done after enable of all plugins. This aims at reloading mainly. * Actions to be done after enable of all plugins. This aims at reloading mainly.
*/ */
private void postEnable(final Player[] onlinePlayers, Runnable... runnables){ private void postEnable(final Player[] onlinePlayers, Runnable... runnables){
LogUtil.logInfo("[NoCheatPlus] Post-enable running..."); LogUtil.logInfo("[NoCheatPlus] Post-enable running...");
for (final Runnable runnable : runnables){ for (final Runnable runnable : runnables){
try{ try{
runnable.run(); runnable.run();
} }
catch(Throwable t){ catch(Throwable t){
LogUtil.logSevere("[NoCheatPlus] Encountered a problem during post-enable: " + t.getClass().getSimpleName()); LogUtil.logSevere("[NoCheatPlus] Encountered a problem during post-enable: " + t.getClass().getSimpleName());
LogUtil.logSevere(t); LogUtil.logSevere(t);
} }
} }
for (final Player player : onlinePlayers){ for (final Player player : onlinePlayers){
updatePermStateReceivers(player); updatePermStateReceivers(player);
NCPExemptionManager.registerPlayer(player); NCPExemptionManager.registerPlayer(player);
} if (player.isSleeping()) {
// TODO: if (online.lenght > 0) LogUtils.logInfo("[NCP] Updated " + online.length + "players (post-enable).") CombinedData.getData(player).wasInBed = true;
LogUtil.logInfo("[NoCheatPlus] Post-enable finished."); }
}
// TODO: if (online.lenght > 0) LogUtils.logInfo("[NCP] Updated " + online.length + "players (post-enable).")
LogUtil.logInfo("[NoCheatPlus] Post-enable finished.");
} }
/** /**