From 7452825503d8b7c7b60a9ce125217c4017378a0b Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 5 Aug 2016 05:05:39 -0400 Subject: [PATCH] AliShulker Addition --- .classpath | 8 +++++++ .gitignore | 1 + .project | 17 ++++++++++++++ plugin.yml | 7 ++++++ src/alisolarflare/AliShulker.java | 39 +++++++++++++++++++++++++++++++ src/alisolarflare/MainPlugin.java | 12 ++++++++++ 6 files changed, 84 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 plugin.yml create mode 100644 src/alisolarflare/AliShulker.java create mode 100644 src/alisolarflare/MainPlugin.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..cefbd63 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.gitignore b/.gitignore index 32858aa..a031ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* +/bin/ diff --git a/.project b/.project new file mode 100644 index 0000000..6fcc3e1 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + AliPresents + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..868d3a2 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,7 @@ +main: alisolarflare.MainPlugin +name: AliPresents +version: 1.0.0 + +commands: + alishulker: + description: Spawns a shulker at player location. /Alishulker \ No newline at end of file diff --git a/src/alisolarflare/AliShulker.java b/src/alisolarflare/AliShulker.java new file mode 100644 index 0000000..91efc03 --- /dev/null +++ b/src/alisolarflare/AliShulker.java @@ -0,0 +1,39 @@ +package alisolarflare; + +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Shulker; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class AliShulker implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!(sender instanceof Player)){ + sender.sendMessage("You must be a player to use this command!"); + return false; + } + Player player = (Player) sender; + if(!(player.getName().equals("iie"))){ + return false; + } + Location location = player.getLocation(); + Entity entity = player.getWorld().spawnEntity(location, EntityType.SHULKER); + Shulker shulker = (Shulker) entity; + shulker.setHealth(10); + + shulker.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 1728000, 5, false)); + shulker.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1728000, 5, false)); + shulker.setAI(false); + shulker.setGlowing(true); + + return false; + } + +} diff --git a/src/alisolarflare/MainPlugin.java b/src/alisolarflare/MainPlugin.java new file mode 100644 index 0000000..bd92fca --- /dev/null +++ b/src/alisolarflare/MainPlugin.java @@ -0,0 +1,12 @@ +package alisolarflare; + +import org.bukkit.plugin.java.JavaPlugin; + +public class MainPlugin extends JavaPlugin{ + public void onEnable(){ + registerCommands(); + } + public void registerCommands(){ + getCommand("alishulker").setExecutor(new AliShulker()); + } +}