diff --git a/plugin.yml b/plugin.yml index 0ea53e2..a7f5b98 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: Vivecraft-Spigot-Extensions -version: '1.12.X-r6' +version: '1.12.X-r7' main: org.vivecraft.VSE website: http://www.vivecraft.org/ author: jrbudda, jaron780 diff --git a/src/org/vivecraft/VSE.java b/src/org/vivecraft/VSE.java index 6e3a93a..adb4915 100644 --- a/src/org/vivecraft/VSE.java +++ b/src/org/vivecraft/VSE.java @@ -15,6 +15,7 @@ import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; @@ -44,6 +45,7 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; import org.mcstats.Metrics; import org.spigotmc.SpigotConfig; import org.vivecraft.command.ConstructTabCompleter; @@ -64,21 +66,24 @@ public class VSE extends JavaPlugin implements Listener { public static VSE me; int task = 0; - private String readurl = "https://raw.githubusercontent.com/jrbudda/Vivecraft_Spigot_Extensions/1.12/version.txt"; + private String readurl = "https://raw.githubusercontent.com/jrbudda/Vivecraft_Spigot_Extensions/master/version.txt"; public List blocklist = new ArrayList<>(); + @SuppressWarnings("deprecation") @Override public void onEnable() { super.onEnable(); + me = this; + ItemStack is = new ItemStack(Material.LEATHER_BOOTS); ItemMeta meta = is.getItemMeta(); meta.setDisplayName("Jump Boots"); meta.setUnbreakable(true); meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE); is.setItemMeta(meta); - ShapedRecipe recipe = new ShapedRecipe(is); + ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "jump_boots"),is); recipe.shape("B", "S"); recipe.setIngredient('B', Material.LEATHER_BOOTS); recipe.setIngredient('S', Material.SLIME_BLOCK); @@ -90,7 +95,7 @@ public void onEnable() { meta2.setUnbreakable(true); meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE); is2.setItemMeta(meta2); - ShapedRecipe recipe2 = new ShapedRecipe(is2); + ShapedRecipe recipe2 = new ShapedRecipe( new NamespacedKey(this, "climb_claws"), is2); recipe2.shape("E E", "S S"); recipe2.setIngredient('E', Material.SPIDER_EYE); recipe2.setIngredient('S', Material.SHEARS); @@ -188,8 +193,7 @@ public void run() { getLogger().severe("Vault not found, permissions groups will not be set"); vault = false; } - - getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() { + getServer().getScheduler().scheduleAsyncDelayedTask(this, new BukkitRunnable() { @Override public void run() { startUpdateCheck(); diff --git a/src/org/vivecraft/VivePlayer.java b/src/org/vivecraft/VivePlayer.java index f37255e..1ee7dae 100644 --- a/src/org/vivecraft/VivePlayer.java +++ b/src/org/vivecraft/VivePlayer.java @@ -50,6 +50,7 @@ public float getDraw(){ return 0; } + @SuppressWarnings("unused") public Vec3D getHMDDir(){ try { if(hmdData != null){ @@ -83,6 +84,7 @@ public Vec3D getHMDDir(){ return ((CraftPlayer)player).getHandle().f(1.0f); } + @SuppressWarnings("unused") public Vec3D getControllerDir(int controller){ byte[] data = controller0data; if(controller == 1) data = controller1data; diff --git a/src/org/vivecraft/listeners/VivecraftCombatListener.java b/src/org/vivecraft/listeners/VivecraftCombatListener.java index e235693..3eb36d9 100644 --- a/src/org/vivecraft/listeners/VivecraftCombatListener.java +++ b/src/org/vivecraft/listeners/VivecraftCombatListener.java @@ -12,7 +12,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; import org.vivecraft.VSE; import org.vivecraft.VivePlayer; @@ -53,30 +52,24 @@ public void onProjectileLaunch(ProjectileLaunchEvent event) { proj.setVelocity(proj.getVelocity().multiply(vp.getDraw())); } - vse.getServer().getScheduler().runTaskLater(vse, new Runnable() { - //The bug necessitating this to be delayed a tick has been fixed in Spigot 1.12.2, but leave here for compatibility. - @Override - public void run() { - - int hand = arrow ? 1 : 0; - - Vec3D aim = vp.getControllerDir(hand); - - if(arrow){ - aim = vp.getControllerDir(0); - if(!vp.isSeated() && vp.getDraw() !=0){ //standing - Vector m = (vp.getControllerPos(1).subtract(vp.getControllerPos(0))).toVector(); - m = m.normalize(); - aim = new Vec3D(m.getX(), m.getY(), m.getZ()); - } else { //seated or roomscale off - hand = 0; - } - } - - Location pos = vp.getControllerPos(hand); - proj.teleport(new Location(proj.getWorld(), pos.getX() + aim.x*0.6f, pos.getY()+aim.y*0.6f, pos.getZ()+aim.z*0.6f)); + int hand = arrow ? 1 : 0; + + Vec3D aim = vp.getControllerDir(hand); + + if(arrow){ + aim = vp.getControllerDir(0); + if(!vp.isSeated() && vp.getDraw() !=0){ //standing + Vector m = (vp.getControllerPos(1).subtract(vp.getControllerPos(0))).toVector(); + m = m.normalize(); + aim = new Vec3D(m.getX(), m.getY(), m.getZ()); + } else { //seated or roomscale off + hand = 0; } - }, 0); + } + + Location pos = vp.getControllerPos(hand); + proj.teleport(new Location(proj.getWorld(), pos.getX() + aim.x*0.6f, pos.getY()+aim.y*0.6f, pos.getZ()+aim.z*0.6f)); + } @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) diff --git a/src/org/vivecraft/listeners/VivecraftItemListener.java b/src/org/vivecraft/listeners/VivecraftItemListener.java index 91ae887..5a8c403 100644 --- a/src/org/vivecraft/listeners/VivecraftItemListener.java +++ b/src/org/vivecraft/listeners/VivecraftItemListener.java @@ -1,6 +1,5 @@ package org.vivecraft.listeners; -import org.bukkit.Location; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/version.txt b/version.txt index 5a521c0..d83f4f0 100644 --- a/version.txt +++ b/version.txt @@ -4,4 +4,5 @@ 1.12-r3: VSE has a newer version! 1.12.X-r4: VSE has a newer version! 1.12.X-r5: VSE has a newer version! -1.12.X-r6: VSE is up to date! +1.12.X-r6: VSE has a newer version! +1.12.X-r7: VSE is up to date! \ No newline at end of file