Skip to content

Commit

Permalink
First Release
Browse files Browse the repository at this point in the history
feat: Add support for dispenser and other projectile sources
  • Loading branch information
heyxmirko committed Apr 29, 2024
1 parent c8d45dd commit 2e6653b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.lukyn76</groupId>
<artifactId>ImageFireworksPro</artifactId>
<version>0.1.0</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>ImageFireworksPro</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
}

0 comments on commit 2e6653b

Please sign in to comment.