commit fef27e973e6806cf19653477d1b13085deccd3f5 Author: ZockerKatze Date: Mon Apr 28 10:00:23 2025 +0200 initial diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..a0ccf77 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Environment-dependent path to Maven home directory +/mavenHomeManager.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..5cdc2be --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..942f3a2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..8c89be5 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..bd1edea --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..809315c --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..eda147d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..46392d4 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/discord.iml b/discord.iml new file mode 100644 index 0000000..3cf00db --- /dev/null +++ b/discord.iml @@ -0,0 +1,13 @@ + + + + + + + PAPER + + 1 + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..60f700e --- /dev/null +++ b/pom.xml @@ -0,0 +1,87 @@ + + + 4.0.0 + + org.discord + discord + 1.0-SNAPSHOT + jar + + discord + + + 21 + 2.2.0-Beta1 + UTF-8 + + + + clean package + ${project.basedir}/src/main/kotlin + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + compile + + compile + + + + + ${java.version} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.3 + + + package + + shade + + + + + + + + src/main/resources + true + + + + + + + papermc-repo + https://repo.papermc.io/repository/maven-public/ + + + sonatype + https://oss.sonatype.org/content/groups/public/ + + + + + + io.papermc.paper + paper-api + 1.21.5-R0.1-SNAPSHOT + provided + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + diff --git a/src/main/kotlin/org/discord/discord/Discord.kt b/src/main/kotlin/org/discord/discord/Discord.kt new file mode 100644 index 0000000..154e547 --- /dev/null +++ b/src/main/kotlin/org/discord/discord/Discord.kt @@ -0,0 +1,46 @@ +package org.discord.discord + +import org.bukkit.ChatColor +import org.bukkit.command.Command +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import org.bukkit.plugin.java.JavaPlugin + +class Discord : JavaPlugin() { + + private var discordLink = "discordlink.here" + + override fun onEnable() { + // Plugin startup logic + logger.info("Discord plugin has been enabled!") + + // Save default config + saveDefaultConfig() + + // Load discord link from config if exists + if (config.contains("discord-link")) { + discordLink = config.getString("discord-link") ?: discordLink + } else { + // Save default link to config + config.set("discord-link", discordLink) + saveConfig() + } + } + + override fun onDisable() { + // Plugin shutdown logic + logger.info("Discord plugin has been disabled!") + } + + override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array): Boolean { + if (command.name.equals("discord", ignoreCase = true)) { + if (sender is Player) { + sender.sendMessage("${ChatColor.GREEN}Join our Discord server: ${ChatColor.BLUE}${ChatColor.UNDERLINE}$discordLink") + } else { + sender.sendMessage("Join our Discord server: $discordLink") + } + return true + } + return false + } +} \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..6a79cc7 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1 @@ +discord-link: "discordlink.here" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..04d4bd2 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,14 @@ +name: discord +version: 1.0-SNAPSHOT +main: org.discord.discord.Discord +api-version: 1.21 +description: A simple plugin to display Discord server link +commands: + discord: + description: Displays the Discord server link + usage: /discord + permission: discord.use +permissions: + discord.use: + description: Allows users to use the /discord command + default: true \ No newline at end of file