Skip to content

Commit

Permalink
Add bungee plugin and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Travisvv committed May 2, 2018
0 parents commit 1a29968
Show file tree
Hide file tree
Showing 9 changed files with 312 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.DS_Store
.settings
.project
.classpath
*.class
bin/*
lib/*
include/*
bin/
.idea/
*.iml
out/*

# maven
target/
dependency-reduced-pom.xml
58 changes: 58 additions & 0 deletions blcmodapibungee/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>badlionclientmodapi</artifactId>
<groupId>net.badlion</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>blcmodapibungee</artifactId>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<defaultGoal>clean install</defaultGoal>
<finalName>badlionclientmodapibungee</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.12-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<repositories>

</repositories>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package net.badlion.blcmodapibungee;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.badlion.blcmodapibungee.listener.PlayerListener;
import net.md_5.bungee.api.plugin.Plugin;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;

public class BlcModApiBungee extends Plugin {

public static final Gson GSON_NON_PRETTY = new GsonBuilder().enableComplexMapKeySerialization().disableHtmlEscaping().create();
public static final Gson GSON_PRETTY = new GsonBuilder().enableComplexMapKeySerialization().disableHtmlEscaping().setPrettyPrinting().create();

private Conf conf;

@Override
public void onEnable() {
if (!this.getDataFolder().exists()) {
this.getDataFolder().mkdir();
}
try {
this.conf = loadConf(new File(this.getDataFolder(), "config.json"));
} catch (IOException e) {
e.printStackTrace();
}

this.getProxy().getPluginManager().registerListener(this, new PlayerListener(this));
}


@Override
public void onDisable() {

}


public Conf loadConf(File file) throws IOException {
try (Reader reader = new BufferedReader(new FileReader(file))) {
return BlcModApiBungee.GSON_NON_PRETTY.fromJson(reader, Conf.class);
} catch (FileNotFoundException ex) {
this.getLogger().info("No Config Found: Saving default...");
Conf conf = new Conf();
this.saveConf(conf, new File(this.getDataFolder(), "config.json"));
return conf;
}
}

private void saveConf(Conf conf, File file) {
try (FileWriter writer = new FileWriter(file)) {
BlcModApiBungee.GSON_PRETTY.toJson(conf, writer);
} catch (Exception ex) {
ex.printStackTrace();
}
}

public Conf getConf() {
return this.conf;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.badlion.blcmodapibungee;

import com.google.gson.JsonObject;

import java.util.HashMap;
import java.util.Map;

public class Conf {

private Map<String, DisallowedMods> modsDisallowed = new HashMap<>();


public Map<String, DisallowedMods> getModsDisallowed() {
return this.modsDisallowed;
}

private class DisallowedMods {

private boolean disabled;
private JsonObject extra_data;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.badlion.blcmodapibungee.listener;

import net.badlion.blcmodapibungee.BlcModApiBungee;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.protocol.packet.PluginMessage;

public class PlayerListener implements Listener {

private BlcModApiBungee plugin;

public PlayerListener(BlcModApiBungee plugin) {
this.plugin = plugin;
}


@EventHandler
public void onLogin(PostLoginEvent event) {
ProxiedPlayer player = event.getPlayer();
player.unsafe().sendPacket(new PluginMessage("BLC|M", BlcModApiBungee.GSON_NON_PRETTY.toJson(this.plugin.getConf().getModsDisallowed()).getBytes(), false));
}

}
4 changes: 4 additions & 0 deletions blcmodapibungee/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: BadlionClientModAPI
main: net.badlion.blcmodapibungee.BlcModApiBungee
version: 1.0
author: Badlion
15 changes: 15 additions & 0 deletions blcmodapispigot/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>badlionclientmodapi</artifactId>
<groupId>net.badlion</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>blcmodapispigot</artifactId>


</project>
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.badlion</groupId>
<artifactId>badlionclientmodapi</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>blcmodapibungee</module>
<module>blcmodapispigot</module>
</modules>


</project>
87 changes: 87 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Badlion Client Mod API
Disable client mods and mod features via Bungee/Spigot plugin

#### Example Config

This config will fully disable the waypoints and minimap mods. It will not disable togglesneak, but it will block the player from using the inventorySneak and flySpeed features of the mod.

{
"modsDisallowed": {
"Waypoints": {
"disabled": true
},
"MiniMap": {
"disabled": true
},
"ToggleSneak": {
"disabled": false,
"extra_data": {
"inventorySneak": {
"disabled": true
},
"flySpeed": {
"disabled": true
}
}
}
}
}



### Mod Names and Fields

+ Animations
+ ArmorStatus
+ AutoGG
+ Block Overlay
+ Chat
+ Coordinates
+ biomeEnabled
+ directionEnabled
+ Crosshair
+ visibleHideGui
+ visibleDebugScreen
+ visibleSpectatorMode
+ visibleThirdPerson
+ highlightPlayer
+ highlightHostile
+ highlightPassive
+ dynamicBow
+ dynamicAttack
+ outline
+ dot
+ EnchantGlint
+ FOV Changer
+ dynamicSwiftness
+ Fullbright
+ Hitboxes
+ animalHitBoxesEnabled
+ itemDropHitboxesEnabled
+ monsterHitboxesEnabled
+ playerHitboxesEnabled
+ projectileHitboxesEnabled
+ ItemCounter
+ Keystroke
+ MiniMap
+ directions
+ Notifications
+ PotionStatus
+ Saturation
+ Scoreboard
+ showNumbers
+ ShowArrows
+ ShowCPS
+ ShowFPS
+ ShowPing
+ ShowPotions
+ ShowDirection
+ ShowEnchantedGoldenApples
+ ShowFood
+ ShowGoldenApples
+ TcpNoDelay
+ TimeChanger
+ ToggleSneak
+ flySpeed
+ inventorySneak
+ Waypoints

0 comments on commit 1a29968

Please sign in to comment.