Plot-System icon indicating copy to clipboard operation
Plot-System copied to clipboard

[Feature] Discord Integration w/ DiscordSRV

Open tintinkung opened this issue 5 months ago • 1 comments

from #175

Please see the issue i create for explanations and my system overviews.

[!IMPORTANT] I'm unsure how merging this would work. So the Global Plot-System is pushing for a release which:

  • My plugin requires DiscordSRV, where do we place the instance on that Global server
  • What forum will my webhook be creating thread in? if many build team is included in the Global server
  • Yea it doesn't really make sense for the merge, but the current main branch does not have the idea of global system yet, so it can be merge perfectly, the plugin will be optional to add for server owner anyway.

My suggesting is merging this pr and archive the main branch as 4.X.X, then force push the revamp in.

Leaving the pull request and let the release in ASEAN BTE fork also works.

Changes

The plugin is just an event system, it only register data provider from the plot-system database. Communications is one-way, the discord plugin only receive events from plot-system and handles it case-by-case.

The plugin cannot modify plot-system data, anything managed by the plugin stays in its isolated database table.

New class: com.alpsbte.plotsystem.utils.DiscordUtil

A singleton to manage all discord event system.

Plugin discordPlugin = PlotSystem.DependencyManager.getDiscordPlotSystemPlugin();
if(discordPlugin != null) {
    DiscordUtil.init(discordPlugin);
}

Example; Submitting a plot:

DiscordUtil.getOpt(plot.getID()).ifPresent(DiscordUtil.PlotEventAction::onPlotApprove)

PlotUtils#abandonPlot

https://github.com/AlpsBTE/Plot-System/blob/7e687673ecfab075e1018bb562c0ed6cf0cadd54/src/main/java/com/alpsbte/plotsystem/core/system/plot/utils/PlotUtils.java#L400

Edited for each abandon plot to have scope info for the abandon reason.

public static boolean abandonPlot(@NotNull AbstractPlot plot, @NotNull DiscordUtil.AbandonType type) {

tintinkung avatar Jul 14 '25 12:07 tintinkung

Thanks for your work. Generally it looks good for me — long term, we want it the other way around. So Plot-System offers a Plugin API which then Plugins can use to interact with the Plot-System. Also, Discord is such an Important thing for BTE & Plot-System, so maybe it will be integrated in the Plugin itself. As a Short Term Solution, this can be merged after V5 is out. Will not be merged, most likely, before.

Zoriot avatar Jul 17 '25 18:07 Zoriot