Skip to content

Commit

Permalink
arrow defer
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudda committed Aug 4, 2017
1 parent f5f513e commit fb612f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Vivecraft-Spigot-Extensions
version: '1.12-r2'
version: '1.12-r3'
main: org.vivecraft.VSE
website: http://www.vivecraft.org/
author: jrbudda, jaron780
Expand Down
15 changes: 10 additions & 5 deletions src/org/vivecraft/listeners/VivecraftCombatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public void onProjectileLaunch(ProjectileLaunchEvent event) {
return;

Player pl = (Player)proj.getShooter();
VivePlayer vp = (VivePlayer)VSE.vivePlayers.get(pl.getUniqueId());
final VivePlayer vp = (VivePlayer)VSE.vivePlayers.get(pl.getUniqueId());

int hand = 0;
if (proj instanceof CraftArrow) hand = 1;
final int hand = proj instanceof CraftArrow ? 1 : 0;

//TODO: check for seated mode.

if ((vp == null) && (this.vse.getConfig().getBoolean("general.debug"))) {
Expand All @@ -46,11 +46,16 @@ public void onProjectileLaunch(ProjectileLaunchEvent event) {
//this only works if the incoming speed is at max (based! on draw time)
//TODO: properly scale in all cases.

proj.teleport(vp.getControllerPos(hand));

if(proj.getType() == EntityType.ARROW && vp.getDraw() != 0) {
proj.setVelocity(proj.getVelocity().multiply(vp.getDraw()));
}

vse.getServer().getScheduler().scheduleSyncDelayedTask(vse, new Runnable() {
@Override
public void run() {
proj.teleport(vp.getControllerPos(hand));
}
}, 1);
}

@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
Expand Down

0 comments on commit fb612f3

Please sign in to comment.