Skip to content

Instantly share code, notes, and snippets.

@jwulf
Last active August 5, 2017 09:39
Show Gist options
  • Save jwulf/c19ebe872b049a227c657ce40345c71b to your computer and use it in GitHub Desktop.
Save jwulf/c19ebe872b049a227c657ce40345c71b to your computer and use it in GitHub Desktop.
The Legendary Exclusion Field™ by Ash Kyd and Josh Wulf - from Camp JS viii
/**
This spell throws all entities around you, like a repulsive shield of protection.
**/
const magik = magikcraft.io;
function r() {
const times = 5 * 1000 / 300; // 5 seconds, every 300ms
let n = times;
magik.setTimeout(shield, 300);
function shield() {
n --;
const location = magik.hic();
const nearbyEntities = location.getWorld().getNearbyEntities(location, 8, 8, 8);
nearbyEntities.forEach(entity => toss(entity));
if (n>0) {
magik.setTimeout(shield, 300)
}
}
}
function toss(entity){
if (entity.getName() == magik.getSender().getName()) {
return;
}
var Vector = Java.type('org.bukkit.util.Vector');
entity.setVelocity(new Vector(2,2,2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment