diff --git a/lib/craftbukkit-1.13.2.jar b/lib/craftbukkit-1.13.2.jar new file mode 100644 index 000000000..0501f357e Binary files /dev/null and b/lib/craftbukkit-1.13.2.jar differ diff --git a/pom.xml b/pom.xml index 20e527136..056225a24 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ me.blackvein.quests quests - 3.4.1 + 3.4.2 quests https://github.com/FlyingPikachu/Quests/ jar @@ -39,6 +39,13 @@ + + org.bukkit + bukkit1132 + 1.13.2-R0.1-SNAPSHOT + system + ${project.basedir}/lib/craftbukkit-1.13.2.jar + org.bukkit bukkit113 diff --git a/src/main/java/me/blackvein/particles/Eff_1_13_R2.java b/src/main/java/me/blackvein/particles/Eff_1_13_R2.java new file mode 100644 index 000000000..bc7eb4c28 --- /dev/null +++ b/src/main/java/me/blackvein/particles/Eff_1_13_R2.java @@ -0,0 +1,120 @@ +package me.blackvein.particles; + +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +/** + * This is the Eff_1_13_R2 Enum, it contains all valid effects that players can + * use with the 1.13.2 server version. + * + * @author FlyingPikachu + * @since 3.4.1 + * @version 3 + */ + +public enum Eff_1_13_R2 { + + 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_R2(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); + } +} diff --git a/src/main/java/me/blackvein/quests/NpcEffectThread.java b/src/main/java/me/blackvein/quests/NpcEffectThread.java index 307c0ce1e..d368d0fa8 100644 --- a/src/main/java/me/blackvein/quests/NpcEffectThread.java +++ b/src/main/java/me/blackvein/quests/NpcEffectThread.java @@ -22,6 +22,7 @@ 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_13_R2; import me.blackvein.particles.Eff_1_7_R3; import me.blackvein.particles.Eff_1_7_R4; import me.blackvein.particles.Eff_1_8_R1; @@ -63,7 +64,9 @@ public class NpcEffectThread implements Runnable { // effectType is either effectType or Quests.repeatEffect private void showEffect(Player player, NPC npc, String effectType) { - if (Quests.bukkitVersion >= 113) { + if (Quests.bukkitVersion >= 1132) { + showEffect_1_13_R2(player, npc, effectType); + } else if (Quests.bukkitVersion >= 113) { showEffect_1_13_R1(player, npc, effectType); } else if (Quests.bukkitVersion >= 112 ) { showEffect_1_12_R1(player, npc, effectType); @@ -88,6 +91,98 @@ public class NpcEffectThread implements Runnable { } } + private void showEffect_1_13_R2(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_R2.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_R2.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_R2.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_R2.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_R2.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_R2.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (effectType.equalsIgnoreCase("portal")) { + try { + Eff_1_13_R2.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_R2.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_R2.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_R2.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_R2.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4, null); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (effectType.equalsIgnoreCase("smoke")) { + try { + Eff_1_13_R2.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20, null); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + try { + Eff_1_13_R2.valueOf(effectType.toUpperCase()).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); + } catch (Exception e) { + plugin.getLogger().info(effectType + " is not a valid effect name!"); + } + } + } + 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(); diff --git a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java index 1b7506134..9016ef7b9 100644 --- a/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java +++ b/src/main/java/me/blackvein/quests/prompts/ItemStackPrompt.java @@ -97,7 +97,7 @@ public class ItemStackPrompt extends FixedSetPrompt { return menu; } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "deprecation" }) @Override protected Prompt acceptValidatedInput(ConversationContext cc, String input) { if (input.equalsIgnoreCase("0")) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index edb859821..6d929ec6d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,7 @@ name: Quests main: me.blackvein.quests.Quests version: ${project.version}-b${env.BUILD_NUMBER} +api-version: 1.13 description: An extensive questing system. website: https://www.spigotmc.org/resources/quests.3711/ dev-url: https://github.com/FlyingPikachu/Quests