Skip to content

Commit

Permalink
1.12.2-0.3.0-beta Added DiscordChat compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
uberifix committed Jun 5, 2019
1 parent 6db1855 commit 0b61ec2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Added configuration file and commands
- Config for name delimiters (\<username>)
- Config to enable/disable list of colours to use for random assignment
- Config to enable/disable custom name colouring command
- Command to allow players to choose a default name colour

- Command to allow players to choose a default name colour
#### 1.12.2-0.3.0-beta release
- Added quick compatibility with discordchat https://minecraft.curseforge.com/projects/discordchat
## Todo:
- ~~Command for letting players set their own colours~~
33 changes: 10 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = "1.12.2-0.2.2-beta"
version = "1.12.2-0.3.0-beta"
group = "network.pxl8.colouredchat" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "colouredchat"

Expand All @@ -21,7 +21,7 @@ compileJava {
}

minecraft {
version = "1.12.2-14.23.5.2811"
version = "1.12.2-14.23.5.2838"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
Expand All @@ -33,28 +33,15 @@ minecraft {
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"

// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
repositories {
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
}

dependencies {
compile "discordchat:DiscordChat:1.12.2:2.3.0"
}

processResources {
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/network/pxl8/colouredchat/chat/ChatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.ServerChatEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import net.shadowfacts.discordchat.one_twelve_two.OneTwelveTwoMod;
import network.pxl8.colouredchat.config.Configuration;
import network.pxl8.colouredchat.data.ColourData;
import network.pxl8.colouredchat.lib.LibColour;
Expand All @@ -27,7 +29,7 @@ public void onPlayerLogout(PlayerEvent.PlayerLoggedOutEvent event) {
}

@SubscribeEvent
public void onServerMsg( ServerChatEvent event) {
public void onServerMsg(ServerChatEvent event) {
ColourData data = ColourData.get(event.getPlayer().world);
event.setCanceled(true);

Expand All @@ -44,5 +46,13 @@ public void onServerMsg( ServerChatEvent event) {
String newmsg = delimL + prefix + player + suffix + delimR + orgmsg;

FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendMessage(ForgeHooks.newChatWithLinks(newmsg));

//DiscordChat Compat
if (Loader.isModLoaded("discordchat")) {
String discordmsg = OneTwelveTwoMod.discordChat.filterMCMessage(orgmsg);
if (discordmsg != null) {
OneTwelveTwoMod.discordChat.sendMessage(OneTwelveTwoMod.discordChat.getFormatter().fromMC(event.getPlayer().getName(), discordmsg));
}
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/network/pxl8/colouredchat/lib/LibMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class LibMeta {
public static final String MOD_ID = "colouredchat";
public static final String VERSION = "0.2.2-beta";
public static final String VERSION = "0.3.0-beta";

public static final String SERVER_PROXY = "network.pxl8.colouredchat.proxy.CommonProxy";
public static final String CLIENT_PROXY = "network.pxl8.colouredchat.proxy.ClientProxy";
Expand Down

0 comments on commit 0b61ec2

Please sign in to comment.