diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 97e440d..d3763d2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Java CI with Maven +name: Java CI with Maven and GitHub Releases on: push: @@ -9,6 +9,9 @@ on: pull_request: branches: [ "main" ] +permissions: + contents: write + jobs: build: @@ -16,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Project Version (project.version) To Environment + run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -24,3 +29,12 @@ jobs: cache: maven - name: Build with Maven run: mvn -B -X package --file pom.xml + + - name: Publish to GitHub Releases + uses: softprops/action-gh-release@v1 + with: + files: target/*.jar + token: ${{ secrets.GITHUB_TOKEN }} + release_name: ${{ env.PROJECT_VERSION }} + tag_name: ${{ env.PROJECT_VERSION }} + overwrite: true diff --git a/.gitignore b/.gitignore index 4788b4b..c2f5746 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,5 @@ buildNumber.properties # Common working directory run/ + +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 2803ff8..f0d9abd 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,6 @@ Minimum Towny Version: `0.100.0.0` \ Minimum SiegeWar Version: `2.9.0` \ Minimum Brewery Version: `3.1` + + +### Rework by [eartho-project](https://github.com/eartho-project) & [Aomkoyo](https://github.com/aomkoyo) \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2aee697..1e87603 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.darthpeti TownyTweaks - 0.1.4 + 0.1.5 jar TownyTweaks diff --git a/src/main/java/me/darthpeti/townytweaks/Main.java b/src/main/java/me/darthpeti/townytweaks/Main.java index 077df97..b4f7e45 100644 --- a/src/main/java/me/darthpeti/townytweaks/Main.java +++ b/src/main/java/me/darthpeti/townytweaks/Main.java @@ -39,6 +39,8 @@ public void onEnable() { createCustomConfig(); loadConfig(); registerListenersAndCommands(); + log.info(prefix+" TownyTweaks has been enabled. (Version: "+instance.getDescription().getVersion()+" )"); + log.info(prefix+" TownyTweaks is a Towny addon plugin, created by DarthPeti. rework by: @Aomkoyo"); } public void createCustomConfig(){ @@ -56,6 +58,10 @@ public void createCustomConfig(){ } } + public void reloadCustomConfig(){ + customConfig = YamlConfiguration.loadConfiguration(customConfigFile); + } + public FileConfiguration getCustomConfig() { return this.customConfig; } diff --git a/src/main/java/me/darthpeti/townytweaks/towny/commands/TownyTweaks.java b/src/main/java/me/darthpeti/townytweaks/towny/commands/TownyTweaks.java index 2a3a23f..adf4875 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/commands/TownyTweaks.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/commands/TownyTweaks.java @@ -11,15 +11,36 @@ public class TownyTweaks implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { if(args.length > 0){ - if(args[0].equalsIgnoreCase("reload")){ - Main.getInstance().reloadConfig(); - if(sender instanceof Player){ - sender.sendMessage(Main.prefix + "Configuration Reloaded."); - return true; - } else { - Main.log.info("TownyTweaks Config Reloaded"); - return true; - } + switch (args[0].toLowerCase()) { + case "reload": + Main.getInstance().reloadCustomConfig(); + if(sender instanceof Player){ + sender.sendMessage(Main.prefix + "Configuration Reloaded., if no changes are visible, please restart the server or use plugman to reload the plugin."); + return true; + } else { + Main.log.info("Configuration Reloaded., if no changes are visible, please restart the server or use plugman to reload the plugin."); + return true; + } + case "version": + if(sender instanceof Player){ + sender.sendMessage(Main.prefix + "TownyTweaks Version: " + Main.getInstance().getDescription().getVersion() + " by DarthPeti, rework by: @Aomkoyo"); + return true; + } else { + Main.log.info("TownyTweaks Version: " + Main.getInstance().getDescription().getVersion()+ " by DarthPeti, rework by: @Aomkoyo"); + return true; + } + default: + if (sender instanceof Player) { + sender.sendMessage(Main.prefix + "TownyTweaks Help:"); + sender.sendMessage(Main.prefix + "/townytweaks reload - Reloads the configuration file."); + sender.sendMessage(Main.prefix + "/townytweaks version - Shows the version of the plugin."); + return true; + } else { + Main.log.info("TownyTweaks Help:"); + Main.log.info("/townytweaks reload - Reloads the configuration file."); + Main.log.info("/townytweaks version - Shows the version of the plugin."); + return true; + } } } return false; diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedNation.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedNation.java index fa6b8d8..5f21071 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedNation.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedNation.java @@ -3,6 +3,8 @@ import com.palmergames.bukkit.towny.event.DeleteNationEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,14 +21,21 @@ public DeletedNation(Logger logger) { @EventHandler public void onTown(DeleteNationEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-nation-disband").equalsIgnoreCase("true")) { + String PrefixConfigName = "nation-disband"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { String nationName = event.getNationName(); - DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(214, 99, 84)) - .setDescription("The nation of " + nationName + " has disbanded!") - ); + DiscordWebhook webhook = new DiscordWebhook(config.getString("webhook-url")); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{nationName}", nationName); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(214, 99, 84)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } + try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedTown.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedTown.java index b298a86..8823a2c 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedTown.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/DeletedTown.java @@ -3,6 +3,8 @@ import com.palmergames.bukkit.towny.event.DeleteTownEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,14 +21,20 @@ public DeletedTown(Logger logger) { @EventHandler public void onTown(DeleteTownEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-town-delete").equalsIgnoreCase("true")) { + String PrefixConfigName = "town-delete"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { String townName = event.getTownName(); - DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(214, 99, 84)) - .setDescription("The town of " + townName + " has been deleted!") - ); + DiscordWebhook webhook = new DiscordWebhook(config.getString("webhook-url")); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{townName}", townName); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(214, 99, 84)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewNation.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewNation.java index be37816..b051549 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewNation.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewNation.java @@ -3,6 +3,8 @@ import com.palmergames.bukkit.towny.event.NewNationEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,15 +21,22 @@ public NewNation(Logger logger) { @EventHandler public void onTown(NewNationEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-nation-create").equalsIgnoreCase("true")) { + // nation-create + String PrefixConfigName = "nation-create"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { String nationName = event.getNation().getName(); String kingName = event.getNation().getKing().getName(); DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(0, 81, 255)) - .setDescription(kingName + " has made a new nation called " + nationName + "!") - ); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{nationName}", nationName).replace("{kingName}", kingName); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(0, 81, 255)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewTown.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewTown.java index a6c1d2e..9030a8d 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewTown.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/NewTown.java @@ -3,14 +3,14 @@ import com.palmergames.bukkit.towny.event.NewTownEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; - import java.awt.*; import java.util.logging.Logger; - public class NewTown implements Listener { private Logger logger; @@ -21,15 +21,23 @@ public NewTown(Logger logger) { @EventHandler public void onTown(NewTownEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-town-creation").equalsIgnoreCase("true")) { + String PrefixConfigName = "town-creation"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { String townName = event.getTown().getName(); String mayorName = event.getTown().getMayor().getName(); - DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); + DiscordWebhook webhook = new DiscordWebhook(config.getString("webhook-url")); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{townName}", townName).replace("{mayorName}", mayorName); + + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(0, 81, 255)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(0, 81, 255)) - .setDescription(mayorName + " has created a new town called " + townName + "!") - ); try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/RuinedTown.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/RuinedTown.java index 15a2f16..85e1084 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/RuinedTown.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/RuinedTown.java @@ -3,6 +3,8 @@ import com.palmergames.bukkit.towny.event.town.TownRuinedEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,14 +21,21 @@ public RuinedTown(Logger logger) { @EventHandler public void onTown(TownRuinedEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-town-ruins").equalsIgnoreCase("true")) { + // town-ruins + String PrefixConfigName = "town-ruins"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { String townName = event.getTown().getName(); - DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(255, 0, 47)) - .setDescription("The town of " + townName + " has fallen into ruins!") - ); + DiscordWebhook webhook = new DiscordWebhook(config.getString("webhook-url")); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{townName}", townName); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(214, 99, 84)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionEnd.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionEnd.java index bdc40bd..9b0ba6d 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionEnd.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionEnd.java @@ -3,6 +3,8 @@ import com.gmail.goosius.siegewar.events.BattleSessionEndedEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,14 +21,20 @@ public SiegeSessionEnd(Logger logger) { @EventHandler public void onTown(BattleSessionEndedEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-siegewar-session-end").equalsIgnoreCase("true")) { - + // siegewar-session-end + String PrefixConfigName = "siegewar-session-end"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(255, 157, 0)) - .setDescription("The current battle session has ended!") - ); + String messageConfig = config.getString("message-" + PrefixConfigName); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(214, 99, 84)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionStart.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionStart.java index 040039e..3500853 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionStart.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeSessionStart.java @@ -3,6 +3,8 @@ import com.gmail.goosius.siegewar.events.BattleSessionStartedEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,14 +21,19 @@ public SiegeSessionStart(Logger logger) { @EventHandler public void onTown(BattleSessionStartedEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-siegewar-session-start").equalsIgnoreCase("true")) { - + String PrefixConfigName = "siegewar-session-start"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(255, 157, 0)) - .setDescription("A new battle session has started!") - ); + String messageConfig = config.getString("message-" + PrefixConfigName); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(214, 99, 84)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeStart.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeStart.java index 4aab34e..5345be8 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeStart.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/Discord/SiegeStart.java @@ -3,6 +3,8 @@ import com.gmail.goosius.siegewar.events.SiegeWarStartEvent; import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.DiscordWebhook; + +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -19,26 +21,42 @@ public SiegeStart(Logger logger) { @EventHandler public void onTown(SiegeWarStartEvent event) { - if (Main.getInstance().getCustomConfig().getString("notification-siegewar-session-start").equalsIgnoreCase("true")) { + String PrefixConfigName = "siegewar-siege-start"; + FileConfiguration config = Main.getInstance().getCustomConfig(); + if (config.getString("notification-"+PrefixConfigName).equalsIgnoreCase("true")) { + DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); if (event.getTargetTown().hasNation()) { - DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(255, 157, 0)) - .setDescription("An army belonging to " + event.getTownOfSiegeStarter().getName() + " has attacked " + event.getTargetTown().getNationOrNull().getName() + " at " + event.getTargetTown().getName() + "! A " + event.getSiegeType() + " siege has begun!") - ); + String attacker = event.getTownOfSiegeStarter().getName(); + String defender = event.getTargetTown().getNationOrNull().getName(); + String townName = event.getTargetTown().getName(); + String siegeType = event.getSiegeType(); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{attacker}", attacker).replace("{defender}", defender).replace("{townName}", townName).replace("{siegeType}", siegeType); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(255, 157, 0)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { logger.severe(e.getStackTrace().toString()); } } else { - DiscordWebhook webhook = new DiscordWebhook(Main.getInstance().getCustomConfig().getString("webhook-url")); - - webhook.addEmbed(new DiscordWebhook.EmbedObject() - .setColor(new Color(255, 157, 0)) - .setDescription("An army belonging to " + event.getTownOfSiegeStarter().getName() + " has attacked " + event.getTargetTown().getName() + "! A " + event.getSiegeType() + " siege has begun!") - ); + String attacker = event.getTownOfSiegeStarter().getName(); + String townName = event.getTargetTown().getName(); + String siegeType = event.getSiegeType(); + String messageConfig = config.getString("message-" + PrefixConfigName).replace("{attacker}", attacker).replace("{townName}", townName).replace("{siegeType}", siegeType); + if (config.getString("embed-" + PrefixConfigName).equalsIgnoreCase("true")) { + webhook.addEmbed(new DiscordWebhook.EmbedObject() + .setColor(new Color(255, 157, 0)) + .setDescription(messageConfig) + ); + } else { + webhook.setContent(messageConfig); + } try { webhook.execute(); } catch (java.io.IOException e) { diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/SiegeWarPearl.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/SiegeWarPearl.java index 3dfc2a1..caebd6f 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/SiegeWarPearl.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/SiegeWarPearl.java @@ -2,7 +2,6 @@ import com.gmail.goosius.siegewar.utils.SiegeWarDistanceUtil; import com.palmergames.bukkit.towny.event.actions.TownyItemuseEvent; -import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.ConfigUtil; import me.darthpeti.townytweaks.towny.util.LocationUtil; import org.bukkit.Material; diff --git a/src/main/java/me/darthpeti/townytweaks/towny/listeners/SpawnTrapPrevention.java b/src/main/java/me/darthpeti/townytweaks/towny/listeners/SpawnTrapPrevention.java index dd7ab0c..d7704c9 100644 --- a/src/main/java/me/darthpeti/townytweaks/towny/listeners/SpawnTrapPrevention.java +++ b/src/main/java/me/darthpeti/townytweaks/towny/listeners/SpawnTrapPrevention.java @@ -3,7 +3,6 @@ import com.palmergames.bukkit.towny.TownyAPI; import com.palmergames.bukkit.towny.event.damage.TownyPlayerDamagePlayerEvent; import com.palmergames.bukkit.towny.object.WorldCoord; -import me.darthpeti.townytweaks.Main; import me.darthpeti.townytweaks.towny.util.ConfigUtil; import me.darthpeti.townytweaks.towny.util.LocationUtil; import org.bukkit.event.EventHandler; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ae7ce35..2bd9793 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,11 +1,24 @@ name: TownyTweaks version: '${project.version}' main: me.darthpeti.townytweaks.Main +api: "1.16" api-version: 1.16 -authors: [ darthpeti, 0xbit, _kz_n] +authors: [ darthpeti, 0xbit, _kz_n, aomkoyo] description: Adds many features to your towny server commands: townytweaks: + permission: townytweaks.admin + permission-message: You do not have permission to use this command. + usage: /townytweaks + description: Main command for TownyTweaks + townytweaksreload: permission: townytweaks.admin permission-message: You do not have permission to use this command. usage: /townytweaks reload + description: Reloads the plugin + townytweaksversion: + permission: townytweaks.admin + permission-message: You do not have permission to use this command. + usage: /townytweaks version + description: Shows the version of the plugin + diff --git a/src/main/resources/webhook.yml b/src/main/resources/webhook.yml index 5c07a21..a6e8b08 100644 --- a/src/main/resources/webhook.yml +++ b/src/main/resources/webhook.yml @@ -5,28 +5,56 @@ webhook-url: "https://discord.com/api/webhooks/PUTSOMETHINGHERE" # Change this to your webhook's URL. This will be used for all notifications below. - -notification-town-creation: "false" # Set to true to notify players on discord whenever a new town is made. +notification-town-creation: "false" +# {townName} - The name of the town +# {mayorName} - The name of the mayor +message-town-creation: "A new town has been created! {townName} by {mayorName}" +embed-town-creation: "false" -notification-town-ruins: "false" # Set to true to notify players on discord whenever a town falls into ruins. +notification-town-ruins: "false" +# {townName} - The name of the town +message-town-ruins: "The town {townName} has fallen into ruins!" +embed-town-ruins: "false" -notification-town-delete: "false" # Set to true to notify players on discord whenever a town is fully deleted. +notification-town-delete: "false" +# {townName} - The name of the town +message-town-delete: "The town {townName} has been deleted!" +embed-town-delete: "false" -notification-nation-create: "false" # Set to true to notify players on discord whenever a new nation is made. +notification-nation-create: "false" +# {nationName} - The name of the nation +# {kingName} - The name of the king +message-nation-create: "A new nation has been created! {nationName} by {kingName}" +embed-nation-create: "false" -notification-nation-disband: "false" # Set to true to notify players on discord whenever a nation is deleted/disbaned. +notification-nation-disband: "false" +# {nationName} - The name of the nation +message-nation-disband: "The nation {nationName} has been disbanded!" +embed-nation-disband: "false" + -notification-siegewar-session-start: "false" # Set to true to notify players on discord whenever a new Siege session starts. +notification-siegewar-session-start: "false" +# Set to true to notify players on discord whenever a Siege session starts. +message-siegewar-session-start: "A new Siege session has started!" +embed-siegewar-session-start: "false" +# Set to true to notify players on discord whenever a Siege session ends. notification-siegewar-session-end: "false" # Set to true to notify players on discord whenever a Siege session ends. +message-siegewar-session-end: "The Siege session has ended!" +embed-siegewar-session-end: "false" notification-siegewar-siege-start: "false" # Set to true to notify players on discord when someone starts a Siege. - +# {attacker} - The name of the attacker +# {defender} - The name of the defender +# {townName} - The name of the town +# {siegeType} - The type of the siege +message-siegewar-siege-start: "{attacker} has started a Siege against {defender}!" +embed-siegewar-siege-start: "false" \ No newline at end of file