diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ce873b1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.yml] +indent_size = 2 diff --git a/.vscode/settings.json b/.vscode/settings.json index d2c75fd..ebabc58 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "yaml.schemas": { - "https://json.schemastore.org/bukkit-plugin.json": "file:///home/laurent/Documents/Cours/ENSEEIHT/S8%20-%20Mod%C3%A9lisation%20G%C3%A9om%C3%A9trique/proj/src/main/resources/plugin.yml" - } + "https://json.schemastore.org/bukkit-plugin.json": "${workspaceFolder}/src/main/resources/plugin.yml" + }, + "java.configuration.updateBuildConfiguration": "automatic" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 8d4b0c6..dafb936 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,10 @@ plugins { id 'java' } +jar{ + destinationDirectory = file("$rootDir/minecraft-server-volume/plugins/") +} + group 'spigot.gradle.project' version '1.0.0' @@ -14,4 +18,4 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT' -} \ No newline at end of file +} diff --git a/docker-compose.yml b/docker-compose.yml index b0459c2..39bc8e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,13 +3,17 @@ version: "3.9" services: minecraft: image: "marctv/minecraft-papermc-server" + hostname: mcserver container_name: "mcserver" environment: MEMORYSIZE: "1G" + PUID: 1000 + PGID: 1000 volumes: - "./minecraft-server-volume:/data:rw" ports: - "25565:25565" + restart: unless-stopped # The following allow `docker attach minecraft` to work stdin_open: true tty: true diff --git a/src/main/java/com/tocard/cam/Camera.java b/src/main/java/com/tocard/cam/Camera.java new file mode 100644 index 0000000..d9ec46c --- /dev/null +++ b/src/main/java/com/tocard/cam/Camera.java @@ -0,0 +1,32 @@ +package com.tocard.cam; + +import java.util.List; +import java.util.logging.Level; + +import org.bukkit.Location; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; + +public class Camera extends JavaPlugin implements Listener { + + List locations; + + @Override + public void onEnable() { + getServer().getPluginManager().registerEvents(this, this); + this.getCommand("point").setExecutor(new NewPoint()); + } + + @Override + public void onDisable() { + + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) { + getLogger().log(Level.INFO, "player joined !"); + + } +} diff --git a/src/main/java/com/tocard/cam/NewPoint.java b/src/main/java/com/tocard/cam/NewPoint.java new file mode 100644 index 0000000..1622f0e --- /dev/null +++ b/src/main/java/com/tocard/cam/NewPoint.java @@ -0,0 +1,24 @@ +package com.tocard.cam; + +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class NewPoint implements CommandExecutor { + + // This method is called, when somebody uses our command + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (sender instanceof Player) { + Player player = (Player) sender; + + Location loc = player.getLocation(); + // System.out.println(loc); + + player.teleport(loc.add(0, 10, 0)); + } + return true; + } +} diff --git a/src/main/java/com/tocard/minecam/Camera.java b/src/main/java/com/tocard/minecam/Camera.java deleted file mode 100644 index 8b7092d..0000000 --- a/src/main/java/com/tocard/minecam/Camera.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.tocard.minecam; - -import org.bukkit.plugin.java.JavaPlugin; - -public class Camera extends JavaPlugin { - @Override - public void onEnable() { - - } - - @Override - public void onDisable() { - - } -} \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 09f4403..897a208 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,11 @@ name: TocardCam # the plugins name as it should appear in the plugin list /pl -main: com.tocard.minecam.Camera +main: com.tocard.cam.Camera version: "1.0" # the plugin's version api-version: "1.18" # the version of the API you want to use, required starting with 1.13 author: Turbo Tocard description: This plugin is so fucking lit ! +commands: + point: + description: Add a new camera point + usage: /point + permission: com.tocard.cam.addPoint