Gave Ali a Green Arrow Trail
Made to test user permissions for future use, (also for a little fun :D)
This commit is contained in:
parent
b89fff1ad1
commit
c6489cfeb2
10 changed files with 76 additions and 3 deletions
2
.project
2
.project
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>TheButtonMultiDevPlugin</name>
|
<name>ButtonLaboratoryPlugin</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</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
|
main: buttondevteam.MainPlugin
|
||||||
version: 1.0.0
|
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.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alisolarflare.aliarrowtrail.AliArrowListener;
|
||||||
|
|
||||||
public class MainPlugin extends JavaPlugin{
|
public class MainPlugin extends JavaPlugin{
|
||||||
private PluginDescriptionFile pdfFile;
|
private PluginDescriptionFile pdfFile;
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
private AliArrowListener aliArrowListener;
|
||||||
|
|
||||||
public void onEnable(){
|
public void onEnable(){
|
||||||
//Logs "Plugin Enabled", registers commands
|
//Logs "Plugin Enabled", registers commands
|
||||||
|
@ -31,7 +34,8 @@ public class MainPlugin extends JavaPlugin{
|
||||||
//Example Event: getServer().getPluginManager().registerEvents(midnightListener, this);
|
//Example Event: getServer().getPluginManager().registerEvents(midnightListener, this);
|
||||||
|
|
||||||
//INIT
|
//INIT
|
||||||
|
aliArrowListener = new AliArrowListener(this);
|
||||||
//EVENTS
|
//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