public RegisterInstanceWorld(RegistrationContext registrationContext, Class<T> type) { super(registrationContext, type, NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager()); }
@Override public void log(Level level, String content) { // Ignore level for now. NCPAPIProvider.getNoCheatPlusAPI().sendAdminNotifyMessage(prefixIngame == null ? content : (prefixIngame + content)); }
public KeepAliveAdapter(Plugin plugin) { super(plugin, ListenerPriority.LOW, PacketType.Play.Client.KEEP_ALIVE); this.checkType = CheckType.NET_KEEPALIVEFREQUENCY; // Add feature tags for checks. if (NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().isActiveAnywhere( CheckType.NET_KEEPALIVEFREQUENCY)) { NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags( "checks", Arrays.asList(KeepAliveFrequency.class.getSimpleName())); } NCPAPIProvider.getNoCheatPlusAPI().addComponent(frequencyCheck); }
public MovingFlying(Plugin plugin) { // PacketPlayInFlying[3, legacy: 10] super(plugin, ListenerPriority.LOW, initPacketTypes()); // Keep the CheckType NET for now. // Add feature tags for checks. if (NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().isActiveAnywhere( CheckType.NET_FLYINGFREQUENCY)) { NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags( "checks", Arrays.asList(FlyingFrequency.class.getSimpleName())); } NCPAPIProvider.getNoCheatPlusAPI().addComponent(flyingFrequency); }
/** * On starting to adding blocks: processBlocks has to be empty. If not empty, warn and clear. */ private void checkProcessBlocks() { if (!processBlocks.isEmpty()) { processBlocks.clear(); NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.STATUS, "BlockChangeTracker: processBlocks is not empty on starting to add blocks."); } }
@Override public Collection<ConfigFile> getAllConfigs() { // Avoid duplicates, which typically should exist. final Set<ConfigFile> res = new LinkedHashSet<ConfigFile>(); final IWorldDataManager worldMan = NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager(); final Iterator<Entry<String, IWorldData>> it = worldMan.getWorldDataIterator(); while (it.hasNext()) { res.add(it.next().getValue().getRawConfiguration()); } return res; }
/** * Initializing with online players. */ public void onEnable() { final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI(); for (final MiniListener<?> listener : miniListeners) { api.addComponent(listener, false); } api.addComponent(this); }
@Override public IWorldData getCurrentWorldDataSafe() { return currentWorldData == null ? NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().getDefaultWorldData() : currentWorldData; }
public void updateBlockCacheHandle() { final IGenericInstanceHandle<BlockCache> newHandle = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(BlockCache.class); // TODO: Doesn't make much sense to disable, until reference counting is fixed/implemented. if (this.blockCacheHandle != null && this.blockCacheHandle != newHandle) { this.blockCacheHandle.disableHandle(); } this.blockCacheHandle = newHandle; }
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { final String[] kicked = NCPAPIProvider.getNoCheatPlusAPI().getLoginDeniedPlayers(); if (kicked.length < 100) Arrays.sort(kicked); sender.sendMessage(TAG + "Players denied to login (temporarily):"); sender.sendMessage(StringUtil.join(Arrays.asList(kicked), " ")); return true; }
public MovingData(final MovingConfig config, final IPlayerData pData) { this.pData = pData; morePacketsFreq = new ActionFrequency(config.morePacketsEPSBuckets, 500); morePacketsBurstFreq = new ActionFrequency(12, 5000); // Location trace. trace = new LocationTrace(config.traceMaxAge, config.traceMaxSize, NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(TraceEntryPool.class)); // A new set of workaround conters. ws = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(WRPT.class).getWorkaroundSet(WRPT.WS_MOVING); }
/** * Log that a hook was removed. * * @param hook * the hook */ private static final void logHookRemoved(final NCPHook hook) { NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.STATUS, "Removed hook: " + getHookDescription(hook) + "."); }
/** * Gets the configuration file. Can be called from any thread. * * @param worldName * the world name * @return the configuration file */ public static ConfigFile getConfigFile(final String worldName) { return NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().getDefaultWorldData().getRawConfiguration(); }
private void updateNoCheatPlusAPI() { if (NCPAPIProvider.getNoCheatPlusAPI() == null) { lockableAPI.unlock(lockableAPIsecret); NCPAPIProvider.setNoCheatPlusAPI(this, lockableAPI); lockableAPI.lock(lockableAPIsecret); } }
private void disableInstantEat() { // TODO: Do this kind of thing via registries later on. //ConfigManager.setForAllConfigs(ConfPaths.INVENTORY_INSTANTEAT_CHECK, false); NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().overrideCheckActivation( CheckType.INVENTORY_INSTANTEAT, AlmostBoolean.NO, OverrideType.PERMANENT, true); StaticLog.logInfo("Inventory checks: FastConsume is available, disabled InstantEat."); }
/** * Gets the configuration file. Can be called from any thread. * * @return the configuration file */ public static ConfigFile getConfigFile() { return NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().getDefaultWorldData().getRawConfiguration(); }
@Override public void doRegister() { super.doRegister(); if (!registerDataTypesPlayer) { registerDataTypesPlayer(NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager()); } }
public BlockChangeListener(final BlockChangeTracker tracker) { this.tracker = tracker; if (ReflectionUtil.getMethodNoArgs(BlockPistonRetractEvent.class, "getBlocks") == null) { retractHasBlocks = false; NCPAPIProvider.getNoCheatPlusAPI().getLogManager().info(Streams.STATUS, "Assume legacy piston behavior."); } else { retractHasBlocks = true; } }
private void init() { // Set some things from the global config. final ConfigFile config = ConfigManager.getConfigFile(); final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI(); if (engine != null) { engine.clear(); api.removeComponent(engine); } engine = new LetterEngine(config); api.addComponent(engine); }
@Override public void onReload() { unregister(); NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager().removeGenericInstance(NetData.class); // Currently needed for FlyingFrequency. register(Bukkit.getPluginManager().getPlugin("NoCheatPlus")); // TODO: static plugin getter? }