-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1a29968
Showing
9 changed files
with
312 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
66 changes: 66 additions & 0 deletions
66
blcmodapibungee/src/main/java/net/badlion/blcmodapibungee/BlcModApiBungee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
blcmodapibungee/src/main/java/net/badlion/blcmodapibungee/Conf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
blcmodapibungee/src/main/java/net/badlion/blcmodapibungee/listener/PlayerListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |