Skip to content

xpdustry/nohorny

Repository files navigation

nohorny

Xpdustry latest Build status Mindustry 7.0 Discord

Description

Are you sick of players turning your awesome server into a NSFW gallery ? Do you wish to bring back your logic displays without the fear of seing anime girls in questionable situations ? Well, worry no more, xpdustry cooked another banger plugin for just this situation.

Introducing nohorny 2, the successor of BMI. This mindustry plugin automatically tracks logic displays and canvases and process them when needed with the anti-nsfw API of your choice.

Enjoy this family friendly factory building game as the cat intended it to be.

Usage

Put the plugin in your config/mods directory and start your server.

Then, go to the created directory config/mods/nohorny and create a file named config.yaml.

Now you can set up the analyzer of your choice:

  • ModerateContent: Incredibly generous free tier with 10000 free requests per month.

    analyzer:
      moderate-content-token: xxx
  • SightEngine: Very nice service with a rather generous free tier (2000 operations per month). No credit card required.

    analyzer:
      sight-engine-user: xxx
      sight-engine-secret: xxx
      # Optional thresholds tweaks
      unsafe-threshold: 0.55
      warning-threshold: 0.4
      kinds:
        - "NUDITY"
        # SightEngine also support gore detection, but is very uncommon in mindustry
        # That's why it's not enabled by default
        - "GORE"
  • Debug: The debug analyzer allows you to check if the plugin properly renders the logic and canvases images, by saving them in the directory config/mods/nohorny/debug.

    analyzer: Debug

    There is also the in-game command nohorny-tracker-debug that allows you to check if displays and canvases are properly tracked.

Once you chose your analyzer, load your changes using the command nohorny-reload in the console, and enjoy, the plugin will automatically ban players that have built structures at UNSAFE Rating.

Developers

For those of you who want more control, like implementing a validation system to avoid false positives.

I suggest you to use the nohorny API in your plugin.

To do so, add the following in your build.gradle

repositories {
    maven { url = uri("https://maven.xpdustry.com/releases") }
}

dependencies {
    compileOnly("com.xpdustry:nohorny:VERSION")
}

Then you will be able to intercept ImageAnalyzerEvent, which is posted every time a cluster of NoHornyImage is processed, see NoHornyAutoBan for an example.

If you handle the ban of the player yourself (like in the above example), you should disable the auto ban of nohorny by adding the following in the config.

auto-ban: false

Installation

This plugin requires :

Building

  • ./gradlew shadowJar to compile the plugin into a usable jar (will be located at builds/libs/nohorny.jar).

  • ./gradlew runMindustryServer to run the plugin in a local Mindustry server.

  • ./gradlew runMindustryClient to start a local Mindustry client that will let you test the plugin.

  • ./gradlew spotlessApply to apply the code formatting and the licence header.

Support

Need a helping hand ? You can talk to the maintainers in the Chaotic Neutral discord in the #support channel.