Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
compileOnly(libs.li.cinnazeyy.langlibs.api)
compileOnly(libs.commons.io.commons.io)
compileOnly(libs.io.papermc.paper.paper.api)
compileOnly(libs.asia.buildtheearth.asean.discord.discord.plotsystem.api)
}

val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ io-papermc-paper-paper-api = "1.21.8-R0.1-SNAPSHOT"
li-cinnazeyy-langlibs-api = "1.5.1"
org-mariadb-jdbc-mariadb-java-client = "2.7.4"
com-intellectualsites-bom-bom-newest = "1.55" # Ref: https://github.com/IntellectualSites/bom
asia-buildtheearth-asean-discord-discord-plotsystem-api = "1.2.3" # Ref: https://github.com/ASEAN-Build-The-Earth/discordsrv-plotsystem

[libraries]
com-alpsbte-alpslib-alpslib-hologram = { module = "com.alpsbte.alpslib:alpslib-hologram", version.ref = "com-alpsbte-alpslib-alpslib-hologram" }
Expand All @@ -35,4 +36,5 @@ de-oliver-fancynpcs = { module = "de.oliver:FancyNpcs", version.ref = "de-oliver
io-papermc-paper-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "io-papermc-paper-paper-api" }
li-cinnazeyy-langlibs-api = { module = "li.cinnazeyy:LangLibs-API", version.ref = "li-cinnazeyy-langlibs-api" }
org-mariadb-jdbc-mariadb-java-client = { module = "org.mariadb.jdbc:mariadb-java-client", version.ref = "org-mariadb-jdbc-mariadb-java-client" }
com-intellectualsites-bom-bom-newest = { module = "com.intellectualsites.bom:bom-newest", version.ref = "com-intellectualsites-bom-bom-newest" }
com-intellectualsites-bom-bom-newest = { module = "com.intellectualsites.bom:bom-newest", version.ref = "com-intellectualsites-bom-bom-newest" }
asia-buildtheearth-asean-discord-discord-plotsystem-api = { module = "asia.buildtheearth.asean.discord:discord-plotsystem-api", version.ref = "asia-buildtheearth-asean-discord-discord-plotsystem-api" }
6 changes: 5 additions & 1 deletion src/main/java/com/alpsbte/plotsystem/PlotSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.alpsbte.plotsystem.core.system.tutorial.TutorialEventListener;
import com.alpsbte.plotsystem.core.system.tutorial.utils.TutorialNPCTurnTracker;
import com.alpsbte.plotsystem.core.system.tutorial.utils.TutorialUtils;
import com.alpsbte.plotsystem.utils.DependencyManager;
import com.alpsbte.plotsystem.utils.DiscordUtil;
import com.alpsbte.plotsystem.utils.Utils;
import com.alpsbte.plotsystem.utils.io.ConfigPaths;
Expand All @@ -32,7 +33,6 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.ipvp.canvas.MenuFunctionListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.sql.SQLException;
Expand Down Expand Up @@ -129,6 +129,10 @@ public void onEnable() {
Bukkit.getScheduler().runTaskTimerAsynchronously(FancyNpcsPlugin.get().getPlugin(), new TutorialNPCTurnTracker(), 0, 1L);
}

// Register discord Integration
org.bukkit.plugin.Plugin discordPlugin = DependencyManager.getDiscordIntegration();
if(discordPlugin != null) DiscordUtil.init(discordPlugin);

pluginEnabled = true;
getComponentLogger().info(text("Enabled Plot-System plugin.", DARK_GREEN));
getComponentLogger().info(text("------------------------------------------------------", GOLD));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void onCommand(CommandSender sender, String[] args) {

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {
if (PlotUtils.Actions.abandonPlot(plot, DiscordUtil.AbandonType.MANUALLY)) {
sender.sendMessage(Utils.ChatUtils.getInfoFormat(langUtil.get(sender, LangPaths.Message.Info.ABANDONED_PLOT, plot.getID() + "")));
sender.sendMessage(Utils.ChatUtils.getInfoFormat(langUtil.get(sender, LangPaths.Message.Info.ABANDONED_PLOT, plot.getId() + "")));
player.playSound(player.getLocation(), Utils.SoundUtils.ABANDON_PLOT_SOUND, 1, 1);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void onCommand(CommandSender sender, String[] args) {

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {
PlotUtils.Actions.undoSubmit(plot);
DiscordUtil.getOpt(plot.getID()).ifPresent(DiscordUtil.PlotEventAction::onPlotUndoSubmit);
DiscordUtil.getOpt(plot.getId()).ifPresent(DiscordUtil.PlotEventAction::onPlotUndoSubmit);

sender.sendMessage(Utils.ChatUtils.getInfoFormat(langUtil.get(sender, LangPaths.Message.Info.UNDID_SUBMISSION, plot.getId() + "")));
player.playSound(player.getLocation(), Utils.SoundUtils.FINISH_PLOT_SOUND, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ private void submitReview() {
if (!isRejected) {
reviewerConfirmationMessage = Utils.ChatUtils.getInfoFormat(LangUtil.getInstance().get(getMenuPlayer(), LangPaths.Message.Info.PLOT_MARKED_REVIEWED, Integer.toString(plot.getId()), getParticipantsString()));
if(!acceptPlot(review.getScore(), review.getSplitScore())) return;
DiscordUtil.getOpt(plot.getID()).ifPresent(DiscordUtil.PlotEventAction::onPlotApprove);
DiscordUtil.getOpt(plot.getId()).ifPresent(DiscordUtil.PlotEventAction::onPlotApprove);
} else {
reviewerConfirmationMessage = Utils.ChatUtils.getInfoFormat(LangUtil.getInstance().get(getMenuPlayer(), LangPaths.Message.Info.PLOT_REJECTED, Integer.toString(plot.getId()), getParticipantsString()));
PlotUtils.Actions.undoSubmit(plot);
DiscordUtil.getOpt(plot.getID()).ifPresent(DiscordUtil.PlotEventAction::onPlotReject);
DiscordUtil.getOpt(plot.getId()).ifPresent(DiscordUtil.PlotEventAction::onPlotReject);
}

Bukkit.getScheduler().runTask(PlotSystem.getPlugin(), () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,6 @@ public static void checkPlotsForLastActivity() {

for (Plot plot : plots) {
LocalDate lastActivity = plot.getLastActivity();

if(lastActivity == null) continue;
long interval = plot.isRejected() ? rejectedInactivityIntervalDays : inactivityIntervalDays;
LocalDate abandonDate = lastActivity.plusDays(interval);

Expand Down Expand Up @@ -579,7 +577,7 @@ public static boolean abandonPlot(@NotNull AbstractPlot plot, @NotNull DiscordUt
}
}
// Send to discord
DiscordUtil.getOpt(plot.getID()).ifPresent(event -> event.onPlotAbandon(type));
DiscordUtil.getOpt(plot.getId()).ifPresent(event -> event.onPlotAbandon(type));
} catch (IOException | WorldEditException ex) {
PlotSystem.getPlugin().getComponentLogger().error(text("Failed to abandon plot with the ID " + plot.getId() + "!"), ex);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public boolean undoReview() {
PlotSystem.getPlugin().getComponentLogger().error("Failed to remove plot review with ID {} from database!", reviewId);
}

DataProvider.PLOT.setCompletedSchematic(plot.getID(), null);
DataProvider.PLOT.setCompletedSchematic(plot.getId(), null);
DiscordUtil.getOpt(this.plot.getId()).ifPresent(DiscordUtil.PlotEventAction::onPlotUndoReview);

return successful;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.mvplugins.multiverse.core.MultiverseCoreApi;

import java.util.Objects;
Expand All @@ -26,6 +27,10 @@ public static boolean isWorldGuardExtraFlagsEnabled() {
return PlotSystem.getPlugin().getServer().getPluginManager().isPluginEnabled("WorldGuardExtraFlags");
}

public static @Nullable org.bukkit.plugin.Plugin getDiscordIntegration() {
return PlotSystem.getPlugin().getServer().getPluginManager().getPlugin("DiscordPlotSystem");
}

/**
* @param worldName Name of the world
* @return Config path for the world
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/alpsbte/plotsystem/utils/DiscordUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ private static final class DiscordDataProvider implements PlotCreateProvider {
geoCoordinates = CoordinateConversion.convertToGeo(mcCoordinates.x(), mcCoordinates.z());
} catch (IOException | OutOfProjectionBoundsException ignored) { }

int plotID = plot.getID();
int plotID = plot.getId();

UUID ownerUUID = plot.getPlotOwner().getUUID();

String cityProjectID = cityProject.getID();
String cityProjectID = cityProject.getId();

String countryCode = cityProject.getCountry().getCode();

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/alpsbte/plotsystem/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@
import static com.alpsbte.plotsystem.core.system.tutorial.utils.TutorialUtils.TEXT_HIGHLIGHT_END;
import static com.alpsbte.plotsystem.core.system.tutorial.utils.TutorialUtils.TEXT_HIGHLIGHT_START;
import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.format.NamedTextColor.DARK_AQUA;
import static net.kyori.adventure.text.format.NamedTextColor.DARK_GRAY;
import static net.kyori.adventure.text.format.NamedTextColor.DARK_GREEN;
import static net.kyori.adventure.text.format.NamedTextColor.DARK_RED;
import static net.kyori.adventure.text.format.NamedTextColor.GOLD;
import static net.kyori.adventure.text.format.NamedTextColor.GRAY;
import static net.kyori.adventure.text.format.NamedTextColor.GREEN;
import static net.kyori.adventure.text.format.NamedTextColor.LIGHT_PURPLE;
import static net.kyori.adventure.text.format.NamedTextColor.RED;
import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
import static net.kyori.adventure.text.format.TextDecoration.BOLD;
Expand Down