Created
February 11, 2018 19:00
-
-
Save Densyakun/342e682f03ac523eb449703d7f1f45e3 to your computer and use it in GitHub Desktop.
[BukkitPlugin] "Attack2Jump" 攻撃されるとジャンプしてしまう。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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