Skip to content

Commit

Permalink
Add VentureChat integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-225 committed Feb 21, 2024
1 parent 474563a commit f753ab7
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# BlueMap Chat Markers
# BlueMap VentureChat Markers

[![GitHub Total Downloads](https://img.shields.io/github/downloads/TechnicJelle/BlueMapChatMarkers/total?label=Downloads&color=success "Click here to download the plugin")](https://github.com/TechnicJelle/BlueMapChatMarkers/releases/latest)
[![Servers using this plugin](https://img.shields.io/bstats/servers/16424?label=Servers)](https://bstats.org/plugin/bukkit/BlueMap%20Chat%20Markers/16424)

This Paper plugin adds chat markers to [BlueMap](https://github.com/BlueMap-Minecraft/Bluemap)
This Paper plugin adds VentureChat markers to [BlueMap](https://github.com/BlueMap-Minecraft/Bluemap). It is a fork of [BlueMapChatMarkers](https://github.com/TechnicJelle/BlueMapChatMarkers) with the only changes being added support for VentureChat events and a few more config options.

![a screenshot of BlueMap with a message displayed on the map](.github/readme_assets/font_size_1.png)

Expand All @@ -18,7 +18,7 @@ To reload it, just reload BlueMap itself with `/bluemap reload`.

## Support

To get support with this plugin, join the [BlueMap Discord server](https://bluecolo.red/map-discord) and ask your questions in [#3rd-party-support](https://discord.com/channels/665868367416131594/863844716047106068). You're welcome to ping me, @TechnicJelle.
To get support with this plugin, join the [BlueMap Discord server](https://bluecolo.red/map-discord) and ask your questions in [#3rd-party-support](https://discord.com/channels/665868367416131594/863844716047106068). You're welcome to ping me, @TechnicJelle (or @Mark_225 if the question is specifically about the VentureChat integration).

![a screenshot of BlueMap with a message displayed on the map](.github/readme_assets/font_size_2.png)\
![a screenshot of BlueMap with multiple messages displayed on the map](.github/readme_assets/many_messages.png)
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
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>com.technicjelle</groupId>
<artifactId>BlueMapChatMarkers</artifactId>
<version>1.6</version>
<groupId>de.mark225</groupId>
<artifactId>BlueMapVentureChatMarkers</artifactId>
<version>1.6-ven1.0</version>
<packaging>jar</packaging>

<name>BlueMapChatMarkers</name>
<name>BlueMapVentureChatMarkers</name>

<description>Adds chat messages to BlueMap</description>
<description>Adds VentureChat messages to BlueMap. Fork of BlueMapChatMarkers.</description>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>https://github.com/TechnicJelle/BlueMapChatMarkers/</url>
<url>https://github.com/Mark-225/BlueMapVentureChatMarkers</url>

<build>
<plugins>
Expand Down Expand Up @@ -128,5 +128,11 @@
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mineverse.Aust1n46.chat</groupId>
<artifactId>VentureChat</artifactId>
<version>3.7.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import de.bluecolored.bluemap.api.BlueMapWorld;
import de.bluecolored.bluemap.api.markers.HtmlMarker;
import de.bluecolored.bluemap.api.markers.MarkerSet;
import mineverse.Aust1n46.chat.api.events.VentureChatEvent;
import mineverse.Aust1n46.chat.channel.ChatChannel;
import mineverse.Aust1n46.chat.utilities.Format;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
Expand Down Expand Up @@ -96,6 +99,18 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
});
}

@EventHandler(priority = EventPriority.MONITOR)
public void onVentureChat(VentureChatEvent event){
ChatChannel channel = event.getChannel();
if(!(config.isIncludeDefaultChannel() && Boolean.TRUE.equals(channel.isDefaultchannel()) ||
config.isIncludeAllChannels() != config.getExceptions().contains(channel.getName()))) return;
String message = Format.stripColor(event.getChat());

//Absolute hack but makes this fork easier to maintain by reusing the existing method instead of reimplementing/altering it
AsyncPlayerChatEvent dummyEvent = new AsyncPlayerChatEvent(event.isAsynchronous(), event.getMineverseChatPlayer().getPlayer(), message, event.getRecipients());
onPlayerChat(dummyEvent);
}

@Override
public void onDisable() {
// Plugin shutdown logic
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/com/technicjelle/bluemapchatmarkers/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.bukkit.configuration.file.FileConfiguration;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

public class Config {
public static final String MARKER_SET_ID = "chat-markers";
Expand All @@ -16,6 +18,12 @@ public class Config {
private final long markerDuration;
private final boolean forceful;

private final boolean includeDefaultChannel;

private final boolean includeAllChannels;

private final List<String> exceptions;

public Config(BlueMapChatMarkers plugin) {
this.plugin = plugin;

Expand All @@ -34,6 +42,11 @@ public Config(BlueMapChatMarkers plugin) {
defaultHidden = configFile().getBoolean("DefaultHidden", false);
markerDuration = configFile().getLong("MarkerDuration", 60);
forceful = configFile().getBoolean("Forceful", false);

//Venture specific values
includeDefaultChannel = configFile().getBoolean("VentureChat.IncludeDefaultChannel", true);
includeAllChannels = configFile().getBoolean("VentureChat.IncludeAllChannels", false);
exceptions = configFile().getStringList("VentureChat.Exceptions");
}

private FileConfiguration configFile() {
Expand All @@ -59,4 +72,16 @@ public long getMarkerDuration() {
public boolean getForceful() {
return forceful;
}

public boolean isIncludeDefaultChannel() {
return includeDefaultChannel;
}

public boolean isIncludeAllChannels() {
return includeAllChannels;
}

public List<String> getExceptions() {
return exceptions;
}
}
9 changes: 9 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ MarkerDuration: 60
# Set this to `true` if you have other chat management plugins that are cancelling
# the chat events, before they're able to get picked up by this plugin
Forceful: false

# VentureChat specific settings
VentureChat:
# Always display the default channel
IncludeDefaultChannel: true
# Whether or not to display all chat channels by default
IncludeAllChannels: false
# List of exceptions to the above rule. Expects a list of channel names to allow (if the above is 'false') or block (if the above is 'true')
Exceptions: []
10 changes: 5 additions & 5 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: BlueMapChatMarkers
name: BlueMapVentureChatMarkers
version: '${version}'
main: com.technicjelle.bluemapchatmarkers.BlueMapChatMarkers
api-version: 1.13
depend: [ BlueMap ]
authors: [ TechnicJelle ]
description: Adds chat messages to BlueMap
website: https://github.com/TechnicJelle/BlueMapChatMarkers
depend: [ BlueMap, VentureChat ]
authors: [ TechnicJelle, Mark_225 ]
description: Adds VentureChat messages to BlueMap. Fork of BlueMapChatMarkers.
website: https://github.com/Mark-225/BlueMapVentureChatMarkers

0 comments on commit f753ab7

Please sign in to comment.