Update for MC 1.13, untested. Bump version number

This commit is contained in:
HappyPikachu 2018-07-31 00:50:31 -04:00
parent 02f501d9e3
commit 6f85e28ed7
4 changed files with 217 additions and 1 deletions

BIN
lib/craftbukkit-1.13.jar Normal file

Binary file not shown.

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>3.3.4</version>
<version>3.3.5</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>

View File

@ -0,0 +1,121 @@
package me.blackvein.particles;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
/**
* This is the Eff_1_13_R1 Enum, it contains all valid effects that players can
* use with the 1.13 server version.
*
* @author FlyingPikachu
* @author GregZ_
* @since 3.3.5
* @version 3
*/
public enum Eff_1_13_R1 {
EXPLOSION(Particle.EXPLOSION_NORMAL),
EXPLOSION_LARGE(Particle.EXPLOSION_LARGE),
EXPLOSION_HUGE(Particle.EXPLOSION_HUGE),
FIREWORKS_SPARK(Particle.FIREWORKS_SPARK),
BUBBLE(Particle.WATER_BUBBLE),
WAKE(Particle.WATER_WAKE),
SPLASH(Particle.WATER_SPLASH),
SUSPENDED(Particle.SUSPENDED),
DEPTH_SUSPEND(Particle.SUSPENDED_DEPTH),
CRIT(Particle.CRIT),
MAGIC_CRIT(Particle.CRIT_MAGIC),
SMOKE(Particle.SMOKE_NORMAL),
LARGE_SMOKE(Particle.SMOKE_LARGE),
SPELL(Particle.SPELL),
INSTANT_SPELL(Particle.SPELL_INSTANT),
MOB_SPELL(Particle.SPELL_MOB),
MOB_SPELL_AMBIENT(Particle.SPELL_MOB_AMBIENT),
WITCH_MAGIC(Particle.SPELL_WITCH),
DRIP_WATER(Particle.DRIP_WATER),
DRIP_LAVA(Particle.DRIP_LAVA),
ANGRY_VILLAGER(Particle.VILLAGER_ANGRY),
HAPPY_VILLAGER(Particle.VILLAGER_HAPPY),
TOWN_AURA(Particle.TOWN_AURA),
NOTE(Particle.NOTE),
PORTAL(Particle.PORTAL),
ENCHANTMENT_TABLE(Particle.ENCHANTMENT_TABLE),
FLAME(Particle.FLAME),
LAVA(Particle.LAVA),
CLOUD(Particle.CLOUD),
RED_DUST(Particle.REDSTONE),
SNOWBALL_POOF(Particle.SNOWBALL),
SNOW_SHOVEL(Particle.SNOW_SHOVEL),
SLIME(Particle.SLIME),
HEART(Particle.HEART),
BARRIER(Particle.BARRIER),
ICONCRACK_(Particle.ITEM_CRACK),
BLOCKCRACK_(Particle.BLOCK_CRACK),
BLOCKDUST_(Particle.BLOCK_DUST),
DROPLET(Particle.WATER_DROP),
MOB_APPEARANCE(Particle.MOB_APPEARANCE),
SWEEPING_DUST(Particle.SWEEP_ATTACK),
DRAGON_BREATH(Particle.DRAGON_BREATH),
ENDROD(Particle.END_ROD),
DAMAGE_INDICATOR(Particle.DAMAGE_INDICATOR),
FALLING_DUST(Particle.FALLING_DUST),
SPIT(Particle.SPIT),
TOTEM(Particle.TOTEM),
BUBBLE_COLUMN_UP(Particle.BUBBLE_COLUMN_UP),
BUBBLE_POP(Particle.BUBBLE_POP),
CURRENT_DOWN(Particle.CURRENT_DOWN),
SQUID_INK(Particle.SQUID_INK),
NAUTILUS(Particle.NAUTILUS),
DOLPHIN(Particle.DOLPHIN);
/**
* The NMS Particle to be sent to the player.
*/
private final Particle particleEnum;
/**
* Create a new instance of the Eff_1_13_R1 enum with the given particle type
* to be sent.
*
* @param particleEnum
* The particle type to be sent to the player in the
* PacketPlayOutWorldParticles packet.
*/
Eff_1_13_R1(Particle particleEnum) {
this.particleEnum = particleEnum;
}
/**
* Send the given particle to the player via NMS. It should be noted that
* all particles have the range limit set to 256 due to the second variable
* in the packet constructor being false.
*
* @param player
* The player to send the particle to.
* @param location
* The location to play the particle at.
* @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.
* @throws Exception
* A ReportedException may be thrown if the network manager
* fails to handle the packet.
*/
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
((CraftPlayer) player).spawnParticle(particleEnum, location, count, offsetX, offsetY, offsetZ, speed, data);
}
}

View File

@ -22,6 +22,7 @@ import org.bukkit.entity.Player;
import me.blackvein.particles.Eff_1_10_R1;
import me.blackvein.particles.Eff_1_11_R1;
import me.blackvein.particles.Eff_1_12_R1;
import me.blackvein.particles.Eff_1_13_R1;
import me.blackvein.particles.Eff_1_7_R3;
import me.blackvein.particles.Eff_1_7_R4;
import me.blackvein.particles.Eff_1_8_R1;
@ -83,6 +84,100 @@ public class NpcEffectThread implements Runnable {
showEffect_1_11_R1(player, npc, effectType);
} else if (Bukkit.getBukkitVersion().contains("1.12")) {
showEffect_1_12_R1(player, npc, effectType);
} else if (Bukkit.getBukkitVersion().contains("1.13")) {
showEffect_1_13_R1(player, npc, effectType);
}
}
private void showEffect_1_13_R1(Player player, NPC npc, String effectType) {
// Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5);
if (effectType.equalsIgnoreCase("enchant")) {
try {
Eff_1_13_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 10, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("crit")) {
try {
Eff_1_13_R1.CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("spell")) {
try {
Eff_1_13_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("magiccrit")) {
try {
Eff_1_13_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("mobspell")) {
try {
Eff_1_13_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("note")) {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_13_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("portal")) {
try {
Eff_1_13_R1.PORTAL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 5, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("dust")) {
try {
Location newLoc = new Location(player.getWorld(), eyeLoc.getX(), eyeLoc.getY() + (float) 0.5, eyeLoc.getZ());
Eff_1_13_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("witch")) {
try {
Eff_1_13_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("snowball")) {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_13_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("splash")) {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_13_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (effectType.equalsIgnoreCase("smoke")) {
try {
Eff_1_13_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20, null);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
Eff_1_13_R1.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
plugin.getInstance().getLogger().info(effectType + " is not a valid effect name!");
}
}
}