Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Fireball Plugin
package erath.xp10d3.main; // Imports. Add external archive (archive is Spigot-1.14.4.jar import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.entity.SmallFireball; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.plugin.java.JavaPlugin; // Public class. Adds a listener. public class Main extends JavaPlugin implements Listener { // @Override allows errors to show (in Eclipse). @Override public void onEnable(){ getServer().getPluginManager().registerEvents(this, this); } // Event Handler allows right click action to be called. @EventHandler public void onRightClick(PlayerInteractEvent event) { // Action.RIGHT_CLICK_AIR and Action.RIght_CLICK_BLOCK allows right click action to be sensed in the air and on a block. if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { Player player = event.getPlayer(); // Checks if player is holding a blaze rod. if (event.getItem().getType() == Material.BLAZE_ROD) { // Creates a fireball and sets the values of it. SmallFireball smallfireball = (SmallFireball) player.launchProjectile(SmallFireball.class); smallfireball.setShooter(player); smallfireball.setVelocity(player.getLocation().getDirection().multiply(1.8)); smallfireball.setIsIncendiary(true); smallfireball.setYield(7.0f); } } } } // Hey Abhiram. This is Ian. I'm in Homeroom right now. Type under here if you see this. The purpose of this is for a blaze rod to right click and shoot a fireball.
run
|
edit
|
history
|
help
0
Speed
jb12.0 threads.enums
several at a time
Problem: on_off
Remove unbalanced parentheses in a given expression
JAVA # Boşluklu bir metinde kaç adet boşluk var
4.a
classwork
Wenfeng Ou
test1