Initialized Plugin with AliArrow Subplugin
This commit is contained in:
parent
3235b06374
commit
419121bc28
11 changed files with 170 additions and 0 deletions
8
.classpath
Normal file
8
.classpath
Normal 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
17
.project
Normal 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>
|
11
.settings/org.eclipse.jdt.core.prefs
Normal file
11
.settings/org.eclipse.jdt.core.prefs
Normal 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
|
BIN
bin/buttondevteam/MainPlugin.class
Normal file
BIN
bin/buttondevteam/MainPlugin.class
Normal file
Binary file not shown.
BIN
bin/buttondevteam/alisolarflare/aliarrow/AliArrowListener.class
Normal file
BIN
bin/buttondevteam/alisolarflare/aliarrow/AliArrowListener.class
Normal file
Binary file not shown.
BIN
bin/buttondevteam/alisolarflare/aliarrow/AliArrowSubPlugin.class
Normal file
BIN
bin/buttondevteam/alisolarflare/aliarrow/AliArrowSubPlugin.class
Normal file
Binary file not shown.
BIN
bin/buttondevteam/alisolarflare/aliarrow/AliArrowTask.class
Normal file
BIN
bin/buttondevteam/alisolarflare/aliarrow/AliArrowTask.class
Normal file
Binary file not shown.
40
src/buttondevteam/MainPlugin.java
Normal file
40
src/buttondevteam/MainPlugin.java
Normal 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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
30
src/buttondevteam/alisolarflare/aliarrow/AliArrowTask.java
Normal file
30
src/buttondevteam/alisolarflare/aliarrow/AliArrowTask.java
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue