diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..522e341 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: "Auto Release" + +on: + push: + tags: + - "v*" + + +jobs: + build: + runs-on: "ubuntu-latest" + permissions: write-all + name: "Build & Release" + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: "Build with Maven" + run: mvn -B package --file pom.xml + + - name: "Make a New Release" + run: | + echo "done!" + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + target/*.jar diff --git a/pom.xml b/pom.xml index b51385f..b747d52 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.lukyn76 ImageFireworksPro - 0.1.0 + 1.0.0 jar ImageFireworksPro diff --git a/src/main/java/me/lukyn76/imagefireworkspro/core/ImageFirework.java b/src/main/java/me/lukyn76/imagefireworkspro/core/ImageFirework.java index a4d6654..d7fdb0f 100644 --- a/src/main/java/me/lukyn76/imagefireworkspro/core/ImageFirework.java +++ b/src/main/java/me/lukyn76/imagefireworkspro/core/ImageFirework.java @@ -34,13 +34,13 @@ public void setImageName(String imageName) { this.imageName = imageName; } - public void explode(Location location, double playerViewRotation) throws IOException { - displayImage(location, playerViewRotation); + public void explode(Location location, double yawRotation) throws IOException { + displayImage(location, yawRotation); } - private void displayImage(Location explodeLocation, double playerViewRotation) throws IOException { + private void displayImage(Location explodeLocation, double yawRotation) throws IOException { ImageFireworksPro plugin = ImageFireworksPro.getInstance(); File imageFile = new File(plugin.getDataFolder(), "images/"+imageName); @@ -54,7 +54,7 @@ private void displayImage(Location explodeLocation, double playerViewRotation) t int width = image.getWidth(); int height = image.getHeight(); - double yawRadians = Math.toRadians(playerViewRotation); + double yawRadians = Math.toRadians(yawRotation); BukkitTask taskId = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, () -> { for(int x = 0; x < width; x++) { diff --git a/src/main/java/me/lukyn76/imagefireworkspro/listeners/FireworkExplodeListener.java b/src/main/java/me/lukyn76/imagefireworkspro/listeners/FireworkExplodeListener.java index b27e2f6..5ee798a 100644 --- a/src/main/java/me/lukyn76/imagefireworkspro/listeners/FireworkExplodeListener.java +++ b/src/main/java/me/lukyn76/imagefireworkspro/listeners/FireworkExplodeListener.java @@ -1,11 +1,9 @@ package me.lukyn76.imagefireworkspro.listeners; -import me.lukyn76.imagefireworkspro.ImageFireworksPro; import me.lukyn76.imagefireworkspro.core.ImageFirework; import me.lukyn76.imagefireworkspro.util.ConfigManager; import org.bukkit.Location; import org.bukkit.entity.Firework; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.FireworkExplodeEvent; @@ -24,13 +22,11 @@ public void onFireworkExplode(FireworkExplodeEvent event) throws IOException { int customModelData = fireworkMeta.getCustomModelData(); ImageFirework imageFirework = ConfigManager.getImageFirework(customModelData); - ImageFireworksPro.getInstance().getServer().getPlayer("lukyn76").sendMessage("Firework: " + imageFirework); if (imageFirework == null) return; Location explodeLocation = event.getEntity().getLocation(); - Player shooter = (Player) event.getEntity().getShooter(); - double playerViewRotation = shooter.getLocation().getYaw(); + double yawRotation = explodeLocation.getYaw(); - imageFirework.explode(explodeLocation, playerViewRotation); + imageFirework.explode(explodeLocation, yawRotation); } }