Initialized Plugin with AliArrow Subplugin #1

Merged
alisolarflare merged 1 commit from AliLaptop into master 2016-06-26 00:50:37 +00:00
11 changed files with 170 additions and 0 deletions
Showing only changes of commit 419121bc28 - Show all commits

8
.classpath Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="C:/Users/Elmar-Laptop/Personal/Hobbies/The Button Rebirth/Button Plugin/Minecraft Test Server/craftbukkit-1.9.2.jar"/>
<classpathentry kind="lib" path="C:/Users/Elmar-Laptop/Personal/Hobbies/The Button Rebirth/Button Plugin/Minecraft Test Server/spigot-1.9.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
.project Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ButtonPluginBucket</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

Binary file not shown.

View file

@ -0,0 +1,40 @@
package buttondevteam;
import java.util.logging.Logger;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.alisolarflare.aliarrow.AliArrowSubPlugin;
public class MainPlugin extends JavaPlugin {
private PluginDescriptionFile pdfFile;
private Logger logger;
private AliArrowSubPlugin aliArrowSubPlugin;
public void onEnable(){
//Logs "Plugin Enabled", registers commands
pdfFile = getDescription();
logger = getLogger();
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
registerSubPlugins();
registerCommands();
registerEvents();
logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion()+ ").");
}
private void registerSubPlugins() {
aliArrowSubPlugin = new AliArrowSubPlugin(this);
aliArrowSubPlugin.register();
}
private void registerCommands() {
// TODO Auto-generated method stub
}
private void registerEvents() {
// TODO Auto-generated method stub
}
}

View file

@ -0,0 +1,39 @@
package buttondevteam.alisolarflare.aliarrow;
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;
}
}
}

View file

@ -0,0 +1,25 @@
package buttondevteam.alisolarflare.aliarrow;
import java.util.logging.Level;
import buttondevteam.MainPlugin;
public class AliArrowSubPlugin {
private MainPlugin plugin;
public AliArrowSubPlugin(MainPlugin plugin){
this.plugin = plugin;
}
public void register(){
registerEvents();
registerCommands();
plugin.getLogger().log(Level.INFO, "Discord Sub Plugin Registered!");
}
private void registerEvents(){
plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin);
}
private void registerCommands(){
}
}

View file

@ -0,0 +1,30 @@
package buttondevteam.alisolarflare.aliarrow;
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();
}
}
}