/** * Convenience method. * @deprecated Use fr.neatmonster.nocheatplus.utilities.NCPAPIProvider.getNoCheatPlusAPI() instead, this method might get removed. * @return */ public static NoCheatPlusAPI getAPI() { return NCPAPIProvider.getNoCheatPlusAPI(); }
private void updateNoCheatPlusAPI() { if (NCPAPIProvider.getNoCheatPlusAPI() == null) { lockableAPI.unlock(lockableAPIsecret); NCPAPIProvider.setNoCheatPlusAPI(this, lockableAPI); lockableAPI.lock(lockableAPIsecret); } }
/** * Set the NoCheaPlusAPI without locking against changes. Further see: * {@link #setNoCheatPlusAPI(NoCheatPlusAPI, ILockable)} * * @param noCheatPlusAPI */ static void setNoCheatPlusAPI(NoCheatPlusAPI noCheatPlusAPI) { setNoCheatPlusAPI(noCheatPlusAPI, null); }
private boolean checkUnitTest() { NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI(); return api == null || api.getClass().getSimpleName().startsWith("UnitTest"); }
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)); }
/** * Instantiates a new survival fly check. */ public SurvivalFly() { super(CheckType.MOVING_SURVIVALFLY); blockChangeTracker = NCPAPIProvider.getNoCheatPlusAPI().getBlockChangeTracker(); }
/** * Convenience method to get a Random instance from the generic registry * (NoCheatPlusAPI). * * @return the random */ // TODO: Move official stuff to some static direct access API. public static Random getRandom() { return NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Random.class); }
/** * Register actual listener(s). */ public void register() { // TODO: Replace 'if (enabled)' by actually unregistering the listeners. final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI(); for (final MiniListener<?> listener : miniListeners) { api.addComponent(listener); } }
public RegisterInstancePlayer(RegistrationContext registrationContext, Class<T> type) { super(registrationContext, type, NCPAPIProvider.getNoCheatPlusAPI().getPlayerDataManager()); }
/** * Instantiates a new creative fly check. */ public CreativeFly() { super(CheckType.MOVING_CREATIVEFLY); blockChangeTracker = NCPAPIProvider.getNoCheatPlusAPI().getBlockChangeTracker(); }
@Override public void runPostRegister() { NCPAPIProvider.getNoCheatPlusAPI().registerGenericInstance(IBridgeCrossPlugin.class, this); }
public CheckListener(CheckType checkType){ this.checkType = checkType; this.mcAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(MCAccess.class); }
public WrapBlockCache() { this(NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(MCAccess.class)); }
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); }
/** * Set the settings to apply from that moment on. <br> * Note that there is no cleanup, thus you should perform cleanup yourself, * in case of passing a custom sub class of ExemptionSettings, for the case * of your plugin disabling or NPC disabling. The given ExemptionSettings * instance will be registered as a generic instance for the * ExemptionSettings class. * * @param settings * If null, the default implementation will be used, otherwise * the instance is stored as is (see note about cleanup for * custom implementations). */ public static void setExemptionSettings(ExemptionSettings settings) { NCPExemptionManager.settings = settings; NCPAPIProvider.getNoCheatPlusAPI().registerGenericInstance(ExemptionSettings.class, settings); }
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."); } }
/** * Instantiates a new check. * * @param type * the type */ @SuppressWarnings("deprecation") public Check(final CheckType type) { this.type = type; mcAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(MCAccess.class); ViolationHistory.checkTypeMap.put(getClass().getName(), type); DataManager.registerExecutionHistory(type, histories); }
@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; }