Skip to content

Instantly share code, notes, and snippets.

@Densyakun
Created February 11, 2018 19:00
Show Gist options
  • Save Densyakun/342e682f03ac523eb449703d7f1f45e3 to your computer and use it in GitHub Desktop.
Save Densyakun/342e682f03ac523eb449703d7f1f45e3 to your computer and use it in GitHub Desktop.
[BukkitPlugin] "Attack2Jump" 攻撃されるとジャンプしてしまう。
package org.densyakun.bukkit.attack2jump;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class Main extends JavaPlugin implements Listener {
private double a = 0.1;
@Override
public void onEnable() {
a = getConfig().getDouble("value");
getConfig().set("value", a);
saveConfig();
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void EntityDamageByEntity(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
Vector b = e.getEntity().getVelocity();
b.setY(a);
e.getEntity().setVelocity(b);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment