Skip to content

Instantly share code, notes, and snippets.

@dashaw92
Last active August 20, 2019 21:46
Show Gist options
  • Save dashaw92/da85db3376e67ba5c64735799bf82a0f to your computer and use it in GitHub Desktop.
Save dashaw92/da85db3376e67ba5c64735799bf82a0f to your computer and use it in GitHub Desktop.
9txCore potion effect generator
#!/bin/bash
while read LINE; do
IFS=',' read -ra ARR <<< "$LINE"
filename="${ARR[0]}.js"
effect="${ARR[2]}"
duration="${ARR[3]}"
amp="${ARR[4]//$'\r'}"
cat > "$filename" << EOF
var DonorPlayer = Java.type('org.realcodingteam.plan9.data.DonorPlayer');
var PotionEffect = Java.type('org.bukkit.potion.PotionEffect');
var PotionEffectType = Java.type('org.bukkit.potion.PotionEffectType');
function run() {
SERVER.getOnlinePlayers().forEach(function(p) {
var dp = DonorPlayer.getPlayer(p.getUniqueId());
if(!dp.receivesEffects()) return;
p.addPotionEffect(new PotionEffect(PotionEffectType.${effect}, ${duration}, ${amp//$'\r'}), true);
});
}
EOF
done < "types.csv"
speedT1 20 SPEED 120 * 20 2
speedT2 40 SPEED 240 * 20 2
speedT3 55 SPEED 360 * 20 2
invisT1 20 INVISIBILITY 120 * 20 0
invisT2 40 INVISIBILITY 240 * 20 0
invisT3 55 INVISIBILITY 360 * 20 0
hasteT1 65 FAST_DIGGING 120 * 20 1
hasteT2 115 FAST_DIGGING 240 * 20 1
hasteT3 160 FAST_DIGGING 360 * 20 1
glowyT1 15 GLOWING 120 * 20 0
glowyT2 30 GLOWING 240 * 20 0
glowyT3 60 GLOWING 360 * 20 0
regenT1 20 REGENERATION 30 * 20 1
regenT2 45 REGENERATION 60 * 20 1
regenT3 100 REGENERATION 120 * 20 1
dograce 50 DOLPHINS_GRACE 120 * 20 0
fireres 50 FIRE_RESISTANCE 360 * 20 0
conduit 85 CONDUIT_POWER 240 * 20 0
slofall 45 SLOW_FALLING 1280 * 20 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment