mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Merge pull request #708 from FlyingPikachu/modules
Use modules and particle system by @Sataniel98
This commit is contained in:
commit
856a543c81
55
.gitignore
vendored
55
.gitignore
vendored
@ -1,27 +1,28 @@
|
||||
# Ignore IDEA files
|
||||
/.idea
|
||||
*.iml
|
||||
/bin/
|
||||
|
||||
# Eclipse files
|
||||
/.settings/
|
||||
*.project
|
||||
*.classpath
|
||||
*.recommenders
|
||||
|
||||
# NetBeans files
|
||||
nbproject/private/
|
||||
build/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
# Maven files
|
||||
/target
|
||||
|
||||
# Java files
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
hs_err_pid*
|
||||
# Ignore IDEA files
|
||||
/.idea
|
||||
*.iml
|
||||
/bin/
|
||||
|
||||
# Eclipse files
|
||||
/.settings/
|
||||
*.project
|
||||
*.classpath
|
||||
*.recommenders
|
||||
|
||||
# NetBeans files
|
||||
nbproject/private/
|
||||
build/
|
||||
nbbuild/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
# Maven files
|
||||
*/target
|
||||
*dependency-reduced-pom.xml
|
||||
|
||||
# Java files
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
hs_err_pid*
|
||||
/target/
|
||||
|
64
dist/pom.xml
vendored
Normal file
64
dist/pom.xml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-dist</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>Quests-${project.version}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package-all</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/all-jar.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-main</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-v1_8_R3</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-v1_8_R2</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-v1_8_R1</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
15
dist/src/main/assembly/all-jar.xml
vendored
Normal file
15
dist/src/main/assembly/all-jar.xml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>all-jar</id>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<unpack>true</unpack>
|
||||
<useTransitiveDependencies>false</useTransitiveDependencies>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
BIN
lib/Parties-2.4.7.jar
Normal file
BIN
lib/Parties-2.4.7.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
161
main/pom.xml
Normal file
161
main/pom.xml
Normal file
@ -0,0 +1,161 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-main</artifactId>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citizens</id>
|
||||
<url>http://repo.citizensnpcs.co/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>http://maven.sk89q.com/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>heroes-stripped</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Vault</id>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- For Parties -->
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizens</artifactId>
|
||||
<version>2.0.21-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aufdemrand</groupId>
|
||||
<artifactId>denizen</artifactId>
|
||||
<version>1.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.5.00</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${user.dir}/lib/mcMMO.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.herocraftonline.heroes</groupId>
|
||||
<artifactId>heroes-stripped</artifactId>
|
||||
<version>4dd3dd85</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.codisimus</groupId>
|
||||
<artifactId>PhatLoots</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${user.dir}/lib/PhatLoots.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldedit</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldguard</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ro.nicuch</groupId>
|
||||
<artifactId>CitizensBooks</artifactId>
|
||||
<version>2.4.7</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${user.dir}/lib/CitizensBooks-2.4.7.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.live.bemmamin</groupId>
|
||||
<artifactId>GPS</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${user.dir}/lib/GPSAPI.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.AlessioDP.Parties</groupId>
|
||||
<artifactId>parties-api</artifactId>
|
||||
<version>2.4.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>lang/**/*.*</include>
|
||||
<include>config.yml</include>
|
||||
<include>plugin.yml</include>
|
||||
<include>events.yml</include>
|
||||
<include>quests.yml</include>
|
||||
<include>data.yml</include>
|
||||
<include>strings.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/</directory>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>README.md</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
67
main/src/main/java/me/blackvein/quests/NpcEffectThread.java
Normal file
67
main/src/main/java/me/blackvein/quests/NpcEffectThread.java
Normal file
@ -0,0 +1,67 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.blackvein.quests.particle.ParticleProvider;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
|
||||
public class NpcEffectThread implements Runnable {
|
||||
|
||||
final Quests plugin;
|
||||
|
||||
public NpcEffectThread(Quests quests) {
|
||||
plugin = quests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||
if (nearby.isEmpty() == false) {
|
||||
for (Entity e : nearby) {
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(e)) {
|
||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(e);
|
||||
if (plugin.hasQuest(npc, quester)) {
|
||||
showEffect(player, npc, plugin.getSettings().getEffect());
|
||||
} else if (plugin.hasCompletedRedoableQuest(npc, quester)) {
|
||||
showEffect(player, npc, plugin.getSettings().getRedoEffect());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a particle effect above an NPC one time
|
||||
* @param player Target player to let view the effect
|
||||
* @param npc Target NPC to place the effect above
|
||||
* @param effectType Value of EnumParticle such as NOTE or SMOKE
|
||||
*/
|
||||
public void showEffect(Player player, NPC npc, String effectType) {
|
||||
Location eyeLoc = npc.getEntity().getLocation();
|
||||
eyeLoc.setY(eyeLoc.getY() + 1.5);
|
||||
ParticleProvider.sendToPlayer(player, eyeLoc, effectType);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************************************** */
|
||||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class ParticleProvider {
|
||||
|
||||
private static ParticleProvider loaded;
|
||||
|
||||
static {
|
||||
try {
|
||||
String packageName = ParticleProvider.class.getPackage().getName();
|
||||
String internalsName = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
if (internalsName.startsWith("v1_8_R")) {
|
||||
loaded = (ParticleProvider) Class.forName(packageName + "." + internalsName).newInstance();
|
||||
} else {
|
||||
loaded = new ParticleProvider_Bukkit();
|
||||
}
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException exception) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Quests could not find a valid implementation for this server version.");
|
||||
}
|
||||
}
|
||||
|
||||
abstract Map<PreBuiltParticle, Object> getParticleMap();
|
||||
|
||||
abstract void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data);
|
||||
|
||||
/**
|
||||
* Sends the particle to the player.
|
||||
*
|
||||
* @param player
|
||||
* The player to send the particle to.
|
||||
* @param location
|
||||
* The location to play the particle at.
|
||||
* @param particleId
|
||||
* The particle identifier.
|
||||
* @param offsetX
|
||||
* The offset of the particle in the X direction.
|
||||
* @param offsetY
|
||||
* The offset of the particle in the Y direction.
|
||||
* @param offsetZ
|
||||
* The offset of the particle in the Z direction.
|
||||
* @param speed
|
||||
* The speed that the particle effect will be played at.
|
||||
* @param count
|
||||
* The number of particles to send to the player.
|
||||
* @param data
|
||||
* An integer array needed for some particles, this is used for
|
||||
* packets such as block crack or particle colour on redstone /
|
||||
* firework particles.
|
||||
*/
|
||||
public static void sendToPlayer(Player player, Location location, String particleId, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
|
||||
Object particle;
|
||||
PreBuiltParticle pbp = PreBuiltParticle.fromIdentifier(particleId);
|
||||
if (pbp != null) {
|
||||
particle = loaded.getParticleMap().get(pbp);
|
||||
} else {
|
||||
try {
|
||||
particle = Particle.valueOf(particleId);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
return; // Fail silently
|
||||
}
|
||||
}
|
||||
loaded.spawnParticle(player, location, particle, offsetX, offsetY, offsetZ, speed, count, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the particle to the player.
|
||||
*
|
||||
* @param player
|
||||
* The player to send the particle to.
|
||||
* @param location
|
||||
* The location to play the particle at.
|
||||
* @param particleId
|
||||
* The particle identifier.
|
||||
*/
|
||||
public static void sendToPlayer(Player player, Location location, String particleId) {
|
||||
PreBuiltParticle particle = PreBuiltParticle.fromIdentifier(particleId);
|
||||
if (particle != null) {
|
||||
Location pos = location.clone();
|
||||
if (particle.getVector() != null) {
|
||||
pos.add(particle.getVector());
|
||||
}
|
||||
sendToPlayer(player, location, particle);
|
||||
} else {
|
||||
try {
|
||||
loaded.spawnParticle(player, location, Particle.valueOf(particleId), 0, 0, 0, 1, 3, null);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
// Fail silently
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the particle to the player.
|
||||
*
|
||||
* @param player
|
||||
* The player to send the particle to.
|
||||
* @param location
|
||||
* The location to play the particle at.
|
||||
* @param particle
|
||||
* The pre-built particle.
|
||||
*/
|
||||
public static void sendToPlayer(Player player, Location location, PreBuiltParticle particle) {
|
||||
Location pos = location.clone();
|
||||
if (particle.getVector() != null) {
|
||||
pos.add(particle.getVector());
|
||||
}
|
||||
loaded.spawnParticle(player, pos, loaded.getParticleMap().get(particle), particle.getOffsetX(), particle.getOffsetY(), particle.getOffsetZ(), particle.getSpeed(), particle.getCount(), null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************************************** */
|
||||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class ParticleProvider_Bukkit extends ParticleProvider {
|
||||
|
||||
private static Map<PreBuiltParticle, Object> PARTICLES = new HashMap<>();
|
||||
|
||||
static {
|
||||
PARTICLES.put(PreBuiltParticle.ENCHANT, Particle.ENCHANTMENT_TABLE);
|
||||
PARTICLES.put(PreBuiltParticle.CRIT, Particle.CRIT);
|
||||
PARTICLES.put(PreBuiltParticle.SPELL, Particle.SPELL_INSTANT);
|
||||
PARTICLES.put(PreBuiltParticle.MAGIC_CRIT, Particle.CRIT_MAGIC);
|
||||
PARTICLES.put(PreBuiltParticle.MOB_SPELL, Particle.SPELL_MOB);
|
||||
PARTICLES.put(PreBuiltParticle.NOTE, Particle.NOTE);
|
||||
PARTICLES.put(PreBuiltParticle.PORTAL, Particle.PORTAL);
|
||||
PARTICLES.put(PreBuiltParticle.DUST, Particle.REDSTONE);
|
||||
PARTICLES.put(PreBuiltParticle.WITCH, Particle.SPELL_WITCH);
|
||||
PARTICLES.put(PreBuiltParticle.SNOWBALL, Particle.SNOWBALL);
|
||||
PARTICLES.put(PreBuiltParticle.SPLASH, Particle.WATER_SPLASH);
|
||||
PARTICLES.put(PreBuiltParticle.SMOKE, Particle.TOWN_AURA);
|
||||
}
|
||||
|
||||
@Override
|
||||
Map<PreBuiltParticle, Object> getParticleMap() {
|
||||
return PARTICLES;
|
||||
}
|
||||
|
||||
@Override
|
||||
void spawnParticle(Player player, Location location, Object particle, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) {
|
||||
player.spawnParticle((Particle) particle, location, count, offsetX, offsetY, offsetZ, speed, data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************************************** */
|
||||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public enum PreBuiltParticle {
|
||||
|
||||
ENCHANT("enchant", 0, 1, 0, 1, 10),
|
||||
CRIT("crit", 0, 0, 0, .35f, 3),
|
||||
SPELL("spell", 0, 0, 0, 1, 3),
|
||||
MAGIC_CRIT("magiccrit", 0, 0, 0, .35f, 3),
|
||||
MOB_SPELL("mobspell", 0, 0, 0, 1, 3),
|
||||
NOTE("note", 0, 0, 0, 1, 1, new Vector(0, .5, 0)),
|
||||
PORTAL("portal", 0, 0, 0, 1, 5),
|
||||
DUST("dust", 0, 0, 0, 1, 1, new Vector(0, .5, 0)),
|
||||
WITCH("witch", 0, 0, 0, 1, 3),
|
||||
SNOWBALL("snowball", 0, 0, 0, 1, 3),
|
||||
SPLASH("splash", 0, 0, 0, 1, 4, new Vector(0, .5, 0)),
|
||||
SMOKE("smoke", 0, 1, 0, 1, 20);
|
||||
|
||||
private static Map<String, PreBuiltParticle> FROM_IDENTIFIER = new HashMap<>();
|
||||
|
||||
static {
|
||||
Stream.of(values()).forEach(p -> FROM_IDENTIFIER.put(p.identifier, p));
|
||||
}
|
||||
|
||||
private String identifier;
|
||||
private float offsetX, offsetY, offsetZ, speed;
|
||||
private int count;
|
||||
private Vector vector;
|
||||
|
||||
PreBuiltParticle(String identifier, float offsetX, float offsetY, float offsetZ, float speed, int count) {
|
||||
this.identifier = identifier;
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
this.offsetZ = offsetZ;
|
||||
this.speed = speed;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
PreBuiltParticle(String identifier, float offsetX, float offsetY, float offsetZ, float speed, int count, Vector vector) {
|
||||
this(identifier, offsetX, offsetY, offsetZ, speed, count);
|
||||
this.vector = vector;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public float getOffsetX() {
|
||||
return offsetX;
|
||||
}
|
||||
|
||||
public float getOffsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
public float getOffsetZ() {
|
||||
return offsetZ;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vector applied to the default spawn location or null if the location isn't modified.
|
||||
*
|
||||
* @return the vector applied to the default spawn location or null if the location isn't modified
|
||||
*/
|
||||
public Vector getVector() {
|
||||
return vector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PreBuiltParticle represented by the specified identifier.
|
||||
*
|
||||
* @param identifier the identifier
|
||||
* @return the PreBuiltParticle represented by the specified identifier
|
||||
*/
|
||||
public static PreBuiltParticle fromIdentifier(String identifier) {
|
||||
return FROM_IDENTIFIER.get(identifier);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user