diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..8f00030 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# GitHub Copilot persisted chat sessions +/copilot/chatSessions diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..9c91002 --- /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..aa00ffa --- /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..861936a --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..82dbec8 --- /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..467794d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/CustomBlockCMD.iml b/CustomBlockCMD.iml new file mode 100644 index 0000000..a589521 --- /dev/null +++ b/CustomBlockCMD.iml @@ -0,0 +1,13 @@ + + + + + + + SPIGOT + + 1 + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3e5cd3b --- /dev/null +++ b/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + me.nvus + CustomBlockCMD + 1.0-SNAPSHOT + jar + + CustomBlockCMD + + + 1.8 + UTF-8 + + www.FNGnation.net + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + + + src/main/resources + true + + + + + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + sonatype + https://oss.sonatype.org/content/groups/public/ + + + + + + org.spigotmc + spigot-api + 1.20.4-R0.1-SNAPSHOT + provided + + + diff --git a/src/main/java/me/nvus/customblockcmd/CustomBlockCMD.java b/src/main/java/me/nvus/customblockcmd/CustomBlockCMD.java new file mode 100644 index 0000000..a342309 --- /dev/null +++ b/src/main/java/me/nvus/customblockcmd/CustomBlockCMD.java @@ -0,0 +1,51 @@ +package me.nvus.customblockcmd; + +import org.bukkit.Material; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.plugin.java.JavaPlugin; + + +public class CustomBlockCMD extends JavaPlugin implements Listener { + + @Override + public void onEnable() { + // Register events + getServer().getPluginManager().registerEvents(this, this); + + // Load configuration + saveDefaultConfig(); + FileConfiguration config = getConfig(); + config.options().copyDefaults(true); + saveConfig(); + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); + if (event.getAction().toString().contains("RIGHT")) { + Material clickedMaterial = event.getClickedBlock().getType(); + FileConfiguration config = getConfig(); + + ConfigurationSection blockSection = config.getConfigurationSection(clickedMaterial.toString()); + if (blockSection != null) { + String cmdType = blockSection.getString("cmd-type"); + String command = blockSection.getString("command"); + String message = blockSection.getString("message", ""); + + if (cmdType.equalsIgnoreCase("player")) { + player.performCommand(command); + if (!message.isEmpty()) { + player.sendMessage(message); + } + } else if (cmdType.equalsIgnoreCase("server")) { + getServer().dispatchCommand(getServer().getConsoleSender(), command); + } + } + } + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..268a082 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,24 @@ +#======================================================================================# +# NVus PRISON SETUP # +# by never2nv # +# www.FNGnation.net # +# Discord: FNGnation.net/discord # +#======================================================================================# + +GOLD_BLOCK: + cmd-type: player + command: warp shop + message: "Teleporting to the shop..." + +DIAMOND_BLOCK: + cmd-type: server + command: give @p diamond + +IRON_BLOCK: + cmd-type: player + command: spawn + message: "Teleporting to spawn..." + +EMERALD_BLOCK: + cmd-type: server + command: give @p emerald \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..c302d3b --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,8 @@ +name: CustomBlockCMD +version: '${project.version}' +main: me.nvus.customblockcmd.CustomBlockCMD +api-version: '1.20' +prefix: Custom Block CMD +load: STARTUP +authors: [never2nv] +website: www.FNGnation.net diff --git a/target/CustomBlockCMD-1.0-SNAPSHOT.jar b/target/CustomBlockCMD-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..8d0ae24 Binary files /dev/null and b/target/CustomBlockCMD-1.0-SNAPSHOT.jar differ diff --git a/target/classes/config.yml b/target/classes/config.yml new file mode 100644 index 0000000..268a082 --- /dev/null +++ b/target/classes/config.yml @@ -0,0 +1,24 @@ +#======================================================================================# +# NVus PRISON SETUP # +# by never2nv # +# www.FNGnation.net # +# Discord: FNGnation.net/discord # +#======================================================================================# + +GOLD_BLOCK: + cmd-type: player + command: warp shop + message: "Teleporting to the shop..." + +DIAMOND_BLOCK: + cmd-type: server + command: give @p diamond + +IRON_BLOCK: + cmd-type: player + command: spawn + message: "Teleporting to spawn..." + +EMERALD_BLOCK: + cmd-type: server + command: give @p emerald \ No newline at end of file diff --git a/target/classes/me/nvus/customblockcmd/CustomBlockCMD.class b/target/classes/me/nvus/customblockcmd/CustomBlockCMD.class new file mode 100644 index 0000000..f70a35d Binary files /dev/null and b/target/classes/me/nvus/customblockcmd/CustomBlockCMD.class differ diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml new file mode 100644 index 0000000..cb28ade --- /dev/null +++ b/target/classes/plugin.yml @@ -0,0 +1,8 @@ +name: CustomBlockCMD +version: '1.0-SNAPSHOT' +main: me.nvus.customblockcmd.CustomBlockCMD +api-version: '1.20' +prefix: Custom Block CMD +load: STARTUP +authors: [never2nv] +website: www.FNGnation.net diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..29ea9a4 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=CustomBlockCMD +groupId=me.nvus +version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..3cd8c5e --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +me\nvus\customblockcmd\CustomBlockCMD.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..3f8a111 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +C:\Users\paulm\Gitea\CustomBlockCMD\src\main\java\me\nvus\customblockcmd\CustomBlockCMD.java diff --git a/target/original-CustomBlockCMD-1.0-SNAPSHOT.jar b/target/original-CustomBlockCMD-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..a7691b7 Binary files /dev/null and b/target/original-CustomBlockCMD-1.0-SNAPSHOT.jar differ