Merge pull request #2 from TBMCPlugins/AliBranch
Gave Ali a custom arrow trail
This commit is contained in:
commit
ca304f708a
10 changed files with 76 additions and 3 deletions
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>TheButtonMultiDevPlugin</name>
|
||||
<name>ButtonLaboratoryPlugin</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
BIN
ButtonLaboratoryPlugin.jar
Normal file
BIN
ButtonLaboratoryPlugin.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/buttondevteam/alisolarflare/aliarrowtrail/AliArrowTask.class
Normal file
BIN
bin/buttondevteam/alisolarflare/aliarrowtrail/AliArrowTask.class
Normal file
Binary file not shown.
|
@ -1,3 +1,3 @@
|
|||
main: buttondevteam.MainPlugin
|
||||
version: 1.0.0
|
||||
name: ButtonMultiDevPlugin
|
||||
name: ButtonLaboratoryPlugin
|
|
@ -5,9 +5,12 @@ import java.util.logging.Logger;
|
|||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import buttondevteam.alisolarflare.aliarrowtrail.AliArrowListener;
|
||||
|
||||
public class MainPlugin extends JavaPlugin{
|
||||
private PluginDescriptionFile pdfFile;
|
||||
private Logger logger;
|
||||
private AliArrowListener aliArrowListener;
|
||||
|
||||
public void onEnable(){
|
||||
//Logs "Plugin Enabled", registers commands
|
||||
|
@ -31,7 +34,8 @@ public class MainPlugin extends JavaPlugin{
|
|||
//Example Event: getServer().getPluginManager().registerEvents(midnightListener, this);
|
||||
|
||||
//INIT
|
||||
|
||||
aliArrowListener = new AliArrowListener(this);
|
||||
//EVENTS
|
||||
getServer().getPluginManager().registerEvents(aliArrowListener, this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package buttondevteam.alisolarflare.aliarrowtrail;
|
||||
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import buttondevteam.MainPlugin;
|
||||
|
||||
public class AliArrowListener implements Listener {
|
||||
private final MainPlugin plugin;
|
||||
|
||||
public AliArrowListener(MainPlugin plugin){
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event){
|
||||
try{
|
||||
if(!(event.getEntity().getType() == EntityType.ARROW)){
|
||||
return;
|
||||
}
|
||||
Projectile projectile = event.getEntity();
|
||||
if (!(projectile.getShooter().equals(plugin.getServer().getPlayer("Ali")))){
|
||||
return;
|
||||
}
|
||||
Arrow arrow = (Arrow) projectile;
|
||||
if (!(arrow.isCritical())){
|
||||
return;
|
||||
}
|
||||
AliArrowTask aliArrowTask = new AliArrowTask(plugin,arrow);
|
||||
aliArrowTask.runTaskTimer(plugin, 2, 1);
|
||||
}catch(Exception e){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package buttondevteam.alisolarflare.aliarrowtrail;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import buttondevteam.MainPlugin;
|
||||
|
||||
public class AliArrowTask extends BukkitRunnable{
|
||||
MainPlugin plugin;
|
||||
Arrow arrow;
|
||||
|
||||
|
||||
|
||||
public AliArrowTask(MainPlugin plugin, Arrow arrow){
|
||||
this.plugin = plugin;
|
||||
this.arrow = arrow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
|
||||
if (arrow.isOnGround() || arrow.isDead()){
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue