diff --git a/README.md b/README.md index 2ab70121a..9f80282b5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Quests -Quests mod for Spigot. This plugin depends highly on code contributions! +Quests plugin for Spigot. This work depends highly on code contributions! ## Usage diff --git a/lib/craftbukkit-1.12.jar b/lib/craftbukkit-1.12.jar new file mode 100644 index 000000000..a56265ca5 Binary files /dev/null and b/lib/craftbukkit-1.12.jar differ diff --git a/pom.xml b/pom.xml index a3ca41edb..46acdace2 100644 --- a/pom.xml +++ b/pom.xml @@ -1,195 +1,401 @@ - - 4.0.0 - - me.blackvein.quests - quests - 2.7.6 - quests - https://github.com/FlyingPikachu/Quests/ - jar - - - - UTF-8 - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public/ - - - citizens - http://repo.citizensnpcs.co - - - sk89q-repo - http://maven.sk89q.com/repo/ - - - - - - org.bukkit - craftbukkit186 - 1.8.6-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.8.6.jar - - - org.bukkit - craftbukkit183 - 1.8.3-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.8.3.jar - - - org.bukkit - spigot18 - 1.8-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.8.jar - - - org.bukkit - spigot192 - 1.9.2-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.9.2.jar - - - org.bukkit - spigot194 - 1.9.4-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.9.4.jar - - - org.bukkit - spigot110 - 1.10-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.10.jar - - - org.bukkit - spigot111 - 1.11-R0.1-SNAPSHOT - system - ${project.basedir}/lib/craftbukkit-1.11.jar - - - org.bukkit - bukkit1710 - 1.7.10-R0.1 - system - ${project.basedir}/lib/craftbukkit-1.7.10-R0.1.jar - - - org.bukkit - bukkit179 - 1.7.9-R0.3 - system - ${project.basedir}/lib/craftbukkit-1.7.9-R0.3.jar - - - org.bukkit - bukkit172 - 1.7.2-R0.4 - system - ${project.basedir}/lib/craftbukkit-1.7.2-R0.4.jar - - - net.citizensnpcs - citizens - 2.0.16-SNAPSHOT - provided - - - net.aufdemrand - denizen - 0.9.7-SNAPSHOT - system - ${project.basedir}/lib/denizen-0.9.7-SNAPSHOT.jar - - - net.milkbowl.vault - Vault - 1.4.1 - system - ${project.basedir}/lib/Vault.jar - - - com.gmail.nossr50.mcMMO - mcMMO - 1.5.00 - system - ${project.basedir}/lib/mcMMO.jar - - - com.herocraftonline - Heroes - 1.5.5.4 - system - ${project.basedir}/lib/Heroes.jar - - - com.codisimus - PhatLoots - 3.8.1 - system - ${project.basedir}/lib/PhatLoots.jar - - - com.sk89q - worldedit - LATEST - provided - - - com.sk89q - worldguard - LATEST - provided - - - - - Quests-${project.version} - - - - . - ${basedir}/src/main/resources/ - true - - config.yml - plugin.yml - events.yml - quests.yml - - - - . - ${basedir}/ - false - - README.md - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - true - 1.6 - 1.6 - - - - + + + 4.0.0 + me.blackvein.quests + quests + 2.8.0 + quests + + https://github.com/FlyingPikachu/Quests/ + + UTF-8 + + + + org.bukkit + bukkit112 + 1.12-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.12.jar + + + org.bukkit + bukkit111 + 1.11-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.11.jar + + + org.bukkit + bukkit110 + 1.10-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.10.jar + + + org.bukkit + bukkit194 + 1.9.4-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.9.4.jar + + + org.bukkit + bukkit192 + 1.9.2-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.9.2.jar + + + org.bukkit + bukkit186 + 1.8.6-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.8.6.jar + + + org.bukkit + bukkit183 + 1.8.3-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.8.3.jar + + + org.bukkit + bukkit18 + 1.8-R0.1-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.8.jar + + + org.bukkit + bukkit1710 + 1.7.10-R0.1 + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.7.10-R0.1.jar + + + org.bukkit + bukkit179 + 1.7.9-R0.3 + system + C:\Users\Dylan\git\Quests/lib/craftbukkit-1.7.9-R0.3.jar + + + net.citizensnpcs + citizens + 2.0.16-SNAPSHOT + provided + + + net.aufdemrand + denizen + 0.9.7-SNAPSHOT + system + C:\Users\Dylan\git\Quests/lib/denizen-0.9.7-SNAPSHOT.jar + + + net.milkbowl.vault + Vault + 1.4.1 + system + C:\Users\Dylan\git\Quests/lib/Vault.jar + + + com.gmail.nossr50.mcMMO + mcMMO + 1.5.00 + system + C:\Users\Dylan\git\Quests/lib/mcMMO.jar + + + com.herocraftonline + Heroes + 1.5.5.4 + system + C:\Users\Dylan\git\Quests/lib/Heroes.jar + + + com.codisimus + PhatLoots + 3.8.1 + system + C:\Users\Dylan\git\Quests/lib/PhatLoots.jar + + + com.sk89q + worldedit + LATEST + provided + + + com.sk89q + worldguard + LATEST + provided + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public/ + + + citizens + http://repo.citizensnpcs.co + + + sk89q-repo + http://maven.sk89q.com/repo/ + + + + false + + central + Central Repository + http://repo.maven.apache.org/maven2 + + + + + + never + + + false + + central + Central Repository + http://repo.maven.apache.org/maven2 + + + + C:\Users\Dylan\git\Quests\src\main\java + C:\Users\Dylan\git\Quests\src\main\scripts + C:\Users\Dylan\git\Quests\src\test\java + C:\Users\Dylan\git\Quests\target\classes + C:\Users\Dylan\git\Quests\target\test-classes + + + . + true + C:\Users\Dylan\git\Quests\src\main\resources + + config.yml + plugin.yml + events.yml + quests.yml + + + + . + false + C:\Users\Dylan\git\Quests + + README.md + + + + + + C:\Users\Dylan\git\Quests\src\test\resources + + + C:\Users\Dylan\git\Quests\target + Quests-2.8.0 + + + + maven-antrun-plugin + 1.3 + + + maven-assembly-plugin + 2.2-beta-5 + + + maven-dependency-plugin + 2.8 + + + maven-release-plugin + 2.3.2 + + + + + + maven-compiler-plugin + 2.3.2 + + + default-compile + compile + + compile + + + true + 1.6 + 1.6 + + + + default-testCompile + test-compile + + testCompile + + + true + 1.6 + 1.6 + + + + + true + 1.6 + 1.6 + + + + maven-clean-plugin + 2.5 + + + default-clean + clean + + clean + + + + + + maven-resources-plugin + 2.6 + + + default-testResources + process-test-resources + + testResources + + + + default-resources + process-resources + + resources + + + + + + maven-jar-plugin + 2.4 + + + default-jar + package + + jar + + + + + + maven-surefire-plugin + 2.12.4 + + + default-test + test + + test + + + + + + maven-install-plugin + 2.4 + + + default-install + install + + install + + + + + + maven-deploy-plugin + 2.7 + + + default-deploy + deploy + + deploy + + + + + + maven-site-plugin + 3.3 + + + default-site + site + + site + + + C:\Users\Dylan\git\Quests\target\site + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + + + + default-deploy + site-deploy + + deploy + + + C:\Users\Dylan\git\Quests\target\site + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + + + + + C:\Users\Dylan\git\Quests\target\site + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + + + + + + C:\Users\Dylan\git\Quests\target\site + \ No newline at end of file diff --git a/src/main/java/me/blackvein/particles/Eff_1_12_R1.java b/src/main/java/me/blackvein/particles/Eff_1_12_R1.java new file mode 100644 index 000000000..edd8bf195 --- /dev/null +++ b/src/main/java/me/blackvein/particles/Eff_1_12_R1.java @@ -0,0 +1,86 @@ +package me.blackvein.particles; + +import me.blackvein.quests.util.ReflectionUtil; +import net.minecraft.server.v1_12_R1.EnumParticle; +import net.minecraft.server.v1_12_R1.PacketPlayOutWorldParticles; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +public enum Eff_1_12_R1 { + + + EXPLOSION(EnumParticle.EXPLOSION_NORMAL), + EXPLOSION_LARGE(EnumParticle.EXPLOSION_LARGE), + EXPLOSION_HUGE(EnumParticle.EXPLOSION_HUGE), + FIREWORKS_SPARK(EnumParticle.FIREWORKS_SPARK), + BUBBLE(EnumParticle.WATER_BUBBLE), + WAKE(EnumParticle.WATER_WAKE), + SPLASH(EnumParticle.WATER_SPLASH), + SUSPENDED(EnumParticle.SUSPENDED), + DEPTH_SUSPEND(EnumParticle.SUSPENDED_DEPTH), + CRIT(EnumParticle.CRIT), + MAGIC_CRIT(EnumParticle.CRIT_MAGIC), + SMOKE(EnumParticle.SMOKE_NORMAL), + LARGE_SMOKE(EnumParticle.SMOKE_LARGE), + SPELL(EnumParticle.SPELL), + INSTANT_SPELL(EnumParticle.SPELL_INSTANT), + MOB_SPELL(EnumParticle.SPELL_MOB), + MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT), + WITCH_MAGIC(EnumParticle.SPELL_WITCH), + DRIP_WATER(EnumParticle.DRIP_WATER), + DRIP_LAVA(EnumParticle.DRIP_LAVA), + ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY), + HAPPY_VILLAGER(EnumParticle.VILLAGER_HAPPY), + TOWN_AURA(EnumParticle.TOWN_AURA), + NOTE(EnumParticle.NOTE), + PORTAL(EnumParticle.PORTAL), + ENCHANTMENT_TABLE(EnumParticle.ENCHANTMENT_TABLE), + FLAME(EnumParticle.FLAME), + LAVA(EnumParticle.LAVA), + FOOTSTEP(EnumParticle.FOOTSTEP), + CLOUD(EnumParticle.CLOUD), + RED_DUST(EnumParticle.REDSTONE), + SNOWBALL_POOF(EnumParticle.SNOWBALL), + SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL), + SLIME(EnumParticle.SLIME), + HEART(EnumParticle.HEART), + BARRIER(EnumParticle.BARRIER), + ICONCRACK_(EnumParticle.ITEM_CRACK), + BLOCKCRACK_(EnumParticle.BLOCK_CRACK), + BLOCKDUST_(EnumParticle.BLOCK_DUST), + DROPLET(EnumParticle.WATER_DROP), + TAKE(EnumParticle.ITEM_TAKE), + MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE), + SWEEPING_DUST(EnumParticle.SWEEP_ATTACK), + DRAGON_BREATH(EnumParticle.DRAGON_BREATH), + ENDROD(EnumParticle.END_ROD), + DAMAGE_INDICATOR(EnumParticle.DAMAGE_INDICATOR), + FALLING_DUST(EnumParticle.FALLING_DUST), + SPIT(EnumParticle.SPIT), + TOTEM(EnumParticle.TOTEM); + + + private final EnumParticle particleEnum; + + Eff_1_12_R1(EnumParticle particleEnum) { + this.particleEnum = particleEnum; + } + + public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception { + PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); + ReflectionUtil.setValue(packet, "a", particleEnum); + ReflectionUtil.setValue(packet, "b", (float) location.getX()); + ReflectionUtil.setValue(packet, "c", (float) location.getY()); + ReflectionUtil.setValue(packet, "d", (float) location.getZ()); + ReflectionUtil.setValue(packet, "e", offsetX); + ReflectionUtil.setValue(packet, "f", offsetY); + ReflectionUtil.setValue(packet, "g", offsetZ); + ReflectionUtil.setValue(packet, "h", speed); + ReflectionUtil.setValue(packet, "i", count); + ReflectionUtil.setValue(packet, "k", data); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + } + +} \ No newline at end of file diff --git a/src/main/java/me/blackvein/particles/Eff_1_7_R1.java b/src/main/java/me/blackvein/particles/Eff_1_7_R1.java deleted file mode 100644 index 204e5d491..000000000 --- a/src/main/java/me/blackvein/particles/Eff_1_7_R1.java +++ /dev/null @@ -1,68 +0,0 @@ -package me.blackvein.particles; - -import me.blackvein.quests.util.ReflectionUtil; -import net.minecraft.server.v1_7_R1.PacketPlayOutWorldParticles; - -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public enum Eff_1_7_R1 { - - HUGE_EXPLOSION("hugeexplosion"), - LARGE_EXPLODE("largeexplode"), - FIREWORKS_SPARK("fireworksSpark"), - BUBBLE("bubble"), - SUSPEND("susgpend"), - DEPTH_SUSPEND("depthSuspend"), - TOWN_AURA("townaura"), - CRIT("crit"), - MAGIC_CRIT("magicCrit"), - MOB_SPELL("mobSpell"), - MOB_SPELL_AMBIENT("mobSpellAmbient"), - SPELL("spell"), - INSTANT_SPELL("instantSpell"), - WITCH_MAGIC("witchMagic"), - NOTE("note"), - PORTAL("portal"), - ENCHANTMENT_TABLE("enchantmenttable"), - EXPLODE("explode"), - FLAME("flame"), - LAVA("lava"), - FOOTSTEP("footstep"), - SPLASH("splash"), - LARGE_SMOKE("largesmoke"), - CLOUD("cloud"), - RED_DUST("reddust"), - SNOWBALL_POOF("snowballpoof"), - DRIP_WATER("dripWater"), - DRIP_LAVA("dripLava"), - SNOW_SHOVEL("snowshovel"), - SLIME("slime"), - HEART("heart"), - ANGRY_VILLAGER("angryVillager"), - HAPPY_VILLAGER("happyVillager"), - ICONCRACK("iconcrack_"), - TILECRACK("tilecrack_"); - - private final String particleName; - - Eff_1_7_R1(String particleName) { - this.particleName = particleName; - } - - public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception { - PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); - ReflectionUtil.setValue(packet, "a", particleName); - ReflectionUtil.setValue(packet, "b", (float) location.getX()); - ReflectionUtil.setValue(packet, "c", (float) location.getY()); - ReflectionUtil.setValue(packet, "d", (float) location.getZ()); - ReflectionUtil.setValue(packet, "e", offsetX); - ReflectionUtil.setValue(packet, "f", offsetY); - ReflectionUtil.setValue(packet, "g", offsetZ); - ReflectionUtil.setValue(packet, "h", speed); - ReflectionUtil.setValue(packet, "i", count); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } - -} diff --git a/src/main/java/me/blackvein/quests/NpcEffectThread.java b/src/main/java/me/blackvein/quests/NpcEffectThread.java index 7264c274f..38ed137b0 100644 --- a/src/main/java/me/blackvein/quests/NpcEffectThread.java +++ b/src/main/java/me/blackvein/quests/NpcEffectThread.java @@ -2,7 +2,6 @@ package me.blackvein.quests; import java.util.List; -import me.blackvein.particles.Eff_1_7_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; @@ -12,6 +11,7 @@ import me.blackvein.particles.Eff_1_9_R1; import me.blackvein.particles.Eff_1_9_R2; 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 net.citizensnpcs.api.npc.NPC; import org.bukkit.Bukkit; @@ -61,9 +61,7 @@ public class NpcEffectThread implements Runnable { private static void showEffect(Player player, NPC npc) { - if (Bukkit.getBukkitVersion().contains("1.7.2")) { - showEffect_R1(player, npc); - } else if (Bukkit.getBukkitVersion().contains("1.7.9")) { + if (Bukkit.getBukkitVersion().contains("1.7.9")) { showEffect_R3(player, npc); } else if (Bukkit.getBukkitVersion().contains("1.7.10")) { showEffect_R4(player, npc); @@ -85,8 +83,132 @@ public class NpcEffectThread implements Runnable { showEffect_1_10_R1(player, npc); } else if (Bukkit.getBukkitVersion().contains("1.11")) { showEffect_1_11_R1(player, npc); + } else if (Bukkit.getBukkitVersion().contains("1.12")) { + showEffect_1_12_R1(player, npc); } } + + private static void showEffect_1_12_R1(Player player, NPC npc) { + + //Get and set eye location, because npc.getBukkitEntity() is deprecated. + Location eyeLoc = npc.getEntity().getLocation(); + eyeLoc.setY(eyeLoc.getY() + 1.5); + + if (Quests.effect.equalsIgnoreCase("enchant")) { + + try { + Eff_1_12_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 10, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("crit")) { + + try { + Eff_1_12_R1.CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("spell")) { + + try { + Eff_1_12_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("magiccrit")) { + + try { + Eff_1_12_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("mobspell")) { + + try { + Eff_1_12_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("note")) { + + try { + Location old = eyeLoc; + Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); + Eff_1_12_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("portal")) { + + try { + Eff_1_12_R1.PORTAL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 5, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("dust")) { + + try { + Location newLoc = new Location(player.getWorld(), eyeLoc.getX(), eyeLoc.getY() + (float) 0.5, eyeLoc.getZ()); + Eff_1_12_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("witch")) { + + try { + Eff_1_12_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("snowball")) { + + try { + Location old = eyeLoc; + Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); + Eff_1_12_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("splash")) { + + try { + Location old = eyeLoc; + Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); + Eff_1_12_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else if (Quests.effect.equalsIgnoreCase("smoke")) { + + try { + Eff_1_12_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20, null); + } catch (Exception e) { + e.printStackTrace(); + } + + } else { + + try { + Eff_1_12_R1.valueOf(Quests.effect).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null); + } catch (Exception e) { + Quests.getInstance().getLogger().info(Quests.effect + " is not a valid effect name!"); + e.printStackTrace(); + } + } + + } + private static void showEffect_1_11_R1(Player player, NPC npc) { //Get and set eye location, because npc.getBukkitEntity() is deprecated. @@ -1161,118 +1283,4 @@ private static void showEffect_1_9_R2(Player player, NPC npc) { } - private static void showEffect_R1(Player player, NPC npc) { - - //Get and set eye location, because npc.getBukkitEntity() is deprecated. - Location eyeLoc = npc.getEntity().getLocation(); - eyeLoc.setY(eyeLoc.getY() + 1.5); - - if (Quests.effect.equalsIgnoreCase("enchant")) { - - try { - Eff_1_7_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 10); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("crit")) { - - try { - Eff_1_7_R1.CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("spell")) { - - try { - Eff_1_7_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("magiccrit")) { - - try { - Eff_1_7_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("mobspell")) { - - try { - Eff_1_7_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("note")) { - - try { - Location old = eyeLoc; - Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); - Eff_1_7_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("portal")) { - - try { - Eff_1_7_R1.PORTAL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 5); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("dust")) { - - try { - Location old = eyeLoc; - Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); - Eff_1_7_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("witch")) { - - try { - Eff_1_7_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("snowball")) { - - try { - Location old = eyeLoc; - Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); - Eff_1_7_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("splash")) { - - try { - Location old = eyeLoc; - Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); - Eff_1_7_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (Quests.effect.equalsIgnoreCase("smoke")) { - - try { - Eff_1_7_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - } - } diff --git a/src/main/java/me/blackvein/quests/ParticleEffect.java b/src/main/java/me/blackvein/quests/ParticleEffect.java deleted file mode 100644 index 8a88514cf..000000000 --- a/src/main/java/me/blackvein/quests/ParticleEffect.java +++ /dev/null @@ -1,69 +0,0 @@ -package me.blackvein.quests; - -import me.blackvein.quests.util.ReflectionUtil; -import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles; - -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public enum ParticleEffect { - - HUGE_EXPLOSION("hugeexplosion"), - LARGE_EXPLODE("largeexplode"), - FIREWORKS_SPARK("fireworksSpark"), - BUBBLE("bubble"), - SUSPEND("susgpend"), - DEPTH_SUSPEND("depthSuspend"), - TOWN_AURA("townaura"), - CRIT("crit"), - MAGIC_CRIT("magicCrit"), - MOB_SPELL("mobSpell"), - MOB_SPELL_AMBIENT("mobSpellAmbient"), - SPELL("spell"), - INSTANT_SPELL("instantSpell"), - WITCH_MAGIC("witchMagic"), - NOTE("note"), - PORTAL("portal"), - ENCHANTMENT_TABLE("enchantmenttable"), - EXPLODE("explode"), - FLAME("flame"), - LAVA("lava"), - FOOTSTEP("footstep"), - SPLASH("splash"), - LARGE_SMOKE("largesmoke"), - CLOUD("cloud"), - RED_DUST("reddust"), - SNOWBALL_POOF("snowballpoof"), - DRIP_WATER("dripWater"), - DRIP_LAVA("dripLava"), - SNOW_SHOVEL("snowshovel"), - SLIME("slime"), - HEART("heart"), - ANGRY_VILLAGER("angryVillager"), - HAPPY_VILLAGER("happyVillager"), - ICONCRACK("iconcrack_"), - TILECRACK("tilecrack_"); - - private final String particleName; - - ParticleEffect(String particleName) { - this.particleName = particleName; - } - - public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] unknown) throws Exception { - PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); - ReflectionUtil.setValue(packet, "a", particleName); - ReflectionUtil.setValue(packet, "b", (float) location.getX()); - ReflectionUtil.setValue(packet, "c", (float) location.getY()); - ReflectionUtil.setValue(packet, "d", (float) location.getZ()); - ReflectionUtil.setValue(packet, "e", offsetX); - ReflectionUtil.setValue(packet, "f", offsetY); - ReflectionUtil.setValue(packet, "g", offsetZ); - ReflectionUtil.setValue(packet, "h", speed); - ReflectionUtil.setValue(packet, "i", count); - ReflectionUtil.setValue(packet, "k", unknown); - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - } - -} diff --git a/src/main/java/me/blackvein/quests/Quester.java b/src/main/java/me/blackvein/quests/Quester.java index 9854b5858..6c96fd05b 100644 --- a/src/main/java/me/blackvein/quests/Quester.java +++ b/src/main/java/me/blackvein/quests/Quester.java @@ -33,6 +33,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.Potion; public class Quester { @@ -2058,52 +2059,6 @@ public class Quester { return prettyString; } - public static String fullPotionString(ItemStack is) { - - Potion potion = Potion.fromItemStack(is); - String potionName = ""; - boolean isPrimary = false; - - try { - - potionName = "Potion of " + potion.getType().getEffectType().getName(); - - } catch (NullPointerException e) { // Potion is primary - - isPrimary = true; - - if (is.getDurability() == 0) { - potionName = "Water Bottle"; - } else if (is.getDurability() == 16) { - potionName = "Awkward Potion"; - } else if (is.getDurability() == 32) { - potionName = "Thick Potion"; - } else if (is.getDurability() == 64) { - potionName = "Mundane Potion (Extended)"; - } else if (is.getDurability() == 8192) { - potionName = "Mundane Potion"; - } - - } - - if (isPrimary == false) { - - if (potion.hasExtendedDuration()) { - potionName = potionName + " (Extended)"; - } else if (potion.getLevel() == 2) { - potionName = potionName + " II"; - } - - if (potion.isSplash()) { - potionName = "Splash " + potionName; - } - - } - - return potionName; - - } - public static String prettyMobString(EntityType type) { String baseString = type.toString(); diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index 45b33e71a..3895288d3 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -5,7 +5,6 @@ import java.io.FilenameFilter; import java.io.IOException; import java.util.Collections; import java.util.Comparator; -import java.util.EnumMap; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -148,15 +147,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, @Override public void onEnable() { - - /*if(getServer().getBukkitVersion().equalsIgnoreCase(validVersion) == false) { - - getLogger().severe("Your current version of CraftBukkit is " + getServer().getBukkitVersion() + ", this version of Quests is built for version " + validVersion); - getLogger().severe("Disabling..."); - getServer().getPluginManager().disablePlugin(this); - return; - - } */ pListener = new PlayerListener(this); effListener = new NpcEffectThread(this); npcListener = new NpcListener(this); @@ -182,16 +172,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, linkOtherPlugins(); - defaultConfigFile(); + saveDefaultConfig(); + //defaultConfigFile(); + + saveResource("quests.yml", false); + saveResource("events.yml", false); + saveResource("data.yml", false); + + defaultLangFile(); + //defaultQuestsFile(); + //defaultEventsFile(); + //defaultDataFile(); loadConfig(); loadModules(); - - defaultLangFile(); - defaultQuestsFile(); - defaultEventsFile(); - defaultDataFile(); - + loadData(); loadCommands(); getServer().getPluginManager().registerEvents(pListener, this); @@ -241,7 +236,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, }, 5L); } - private void defaultDataFile() { + /*private void defaultDataFile() { if (new File(this.getDataFolder(), "data.yml").exists() == false) { getLogger().info("Data file not found, writing default to file."); FileConfiguration data = new YamlConfiguration(); @@ -255,17 +250,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, } else { loadData(); } - } + }*/ - @SuppressWarnings("deprecation") - private void defaultEventsFile() { + /*private void defaultEventsFile() { if (new File(this.getDataFolder(), "events.yml").exists() == false) { getLogger().info("Events data not found, writing defaults to file."); FileConfiguration data = new YamlConfiguration(); data.options().copyHeader(true); data.options().copyDefaults(true); try { - data.load(this.getResource("events.yml")); + data.load(this.getTextResource("events.yml")); data.save(new File(this.getDataFolder(), "events.yml")); } catch (IOException e) { e.printStackTrace(); @@ -273,16 +267,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, e.printStackTrace(); } } - } + }*/ - @SuppressWarnings("deprecation") - private void defaultQuestsFile() { + /*private void defaultQuestsFile() { if (new File(this.getDataFolder(), "quests.yml").exists() == false) { getLogger().info("Quest data not found, writing defaults to file."); FileConfiguration data = new YamlConfiguration(); try { - data.load(this.getResource("quests.yml")); + data.load(this.getTextResource("quests.yml")); data.set("events", null); data.save(new File(this.getDataFolder(), "quests.yml")); } catch (IOException e) { @@ -292,15 +285,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, } } - } + }*/ - @SuppressWarnings("deprecation") - private void defaultConfigFile() { + /*private void defaultConfigFile() { if (new File(this.getDataFolder(), "config.yml").exists() == false) { getLogger().info("Config not found, writing default to file."); FileConfiguration config = new YamlConfiguration(); try { - config.load(this.getResource("config.yml")); + config.load(this.getTextResource("config.yml")); config.save(new File(this.getDataFolder(), "config.yml")); } catch (IOException e) { e.printStackTrace(); @@ -308,7 +300,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, e.printStackTrace(); } } - } + }*/ public void loadCommands() { @@ -624,6 +616,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, JarFile jarFile = new JarFile(jar); Enumeration e = jarFile.entries(); + jarFile.close(); URL[] urls = {new URL("jar:file:" + jar.getPath() + "!/")}; @@ -1936,7 +1929,8 @@ try{ cs.sendMessage(completed); } - private void questsJournal(final Player player) { + @SuppressWarnings("deprecation") + private void questsJournal(final Player player) { Quester quester = getQuester(player.getUniqueId()); @@ -2803,7 +2797,6 @@ try{ failedToLoad = false; if (config.contains("quests." + questName + ".name")) { - // TODO why have a name attr then path key can be guest name? quest.name = parseString(config.getString("quests." + questName + ".name"), quest); } else { skipQuestProcess("Quest block \'" + questName + "\' is missing " + RED + "name:"); @@ -3430,8 +3423,6 @@ try{ } private void processStages(Quest quest, FileConfiguration config, String questName) throws StageFailedException { - int index = 1; - ConfigurationSection questStages = config.getConfigurationSection("quests." + questName + ".stages.ordered"); for (String s2 : questStages.getKeys(false)) { diff --git a/src/main/java/me/blackvein/quests/util/QuestMob.java b/src/main/java/me/blackvein/quests/util/QuestMob.java index ee927d9b9..62f4588bb 100644 --- a/src/main/java/me/blackvein/quests/util/QuestMob.java +++ b/src/main/java/me/blackvein/quests/util/QuestMob.java @@ -1,13 +1,9 @@ package me.blackvein.quests.util; import me.blackvein.quests.Quests; -import net.minecraft.server.v1_10_R1.EnumItemSlot; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; -import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.inventory.EntityEquipment; @@ -89,44 +85,33 @@ public class QuestMob { dropChances[0] = dropChance; } - public void spawn() { + @SuppressWarnings("deprecation") + public void spawn() { World world = spawnLocation.getWorld(); for (int i = 0; i < spawnAmounts; i++) { - Entity entity = world.spawnEntity(spawnLocation, entityType); + LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLocation, entityType); if (name != null) { - ((LivingEntity) entity).setCustomName(name); - ((LivingEntity) entity).setCustomNameVisible(true); + entity.setCustomName(name); + entity.setCustomNameVisible(true); } - + + EntityEquipment eq = entity.getEquipment(); + try{ - ((CraftEntity) entity).getHandle().setEquipment(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(inventory[0])); - ((CraftEntity) entity).getHandle().setEquipment(EnumItemSlot.FEET, CraftItemStack.asNMSCopy(inventory[1])); - ((CraftEntity) entity).getHandle().setEquipment(EnumItemSlot.LEGS, CraftItemStack.asNMSCopy(inventory[2])); - ((CraftEntity) entity).getHandle().setEquipment(EnumItemSlot.CHEST, CraftItemStack.asNMSCopy(inventory[3])); - ((CraftEntity) entity).getHandle().setEquipment(EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(inventory[4])); + eq.setItemInHand(inventory[0]); + eq.setBoots(inventory[1]); + eq.setLeggings(inventory[2]); + eq.setChestplate(inventory[3]); + eq.setHelmet(inventory[4]); } catch (Exception e) { Bukkit.getLogger().severe("Entity NMS is invalid for this version of CraftBukkit. Please notify the developer"); e.printStackTrace(); } - /*for (int j = 0; j < 5; j++) { - if (inventory[j] != null) { - try{ - ((CraftEntity) entity).getHandle().setEquipment(j, CraftItemStack.asNMSCopy(inventory[j])); - } catch (Exception e) { - Bukkit.getLogger().severe("Entity NMS is invalid for this version of CraftBukkit. Please notify the developer"); - e.printStackTrace(); - } - } - }*/ - - //EntityEquipment eq = ((CraftLivingEntity) entity).getEquipment(); - EntityEquipment eq = ((LivingEntity)entity).getEquipment(); - if (dropChances[0] != null) { eq.setItemInHandDropChance(dropChances[0]); }