diff --git a/src/main/java/buttondevteam/presents/hello/Hello.java b/src/main/java/buttondevteam/presents/hello/Hello.java index fa78dbb..9afc375 100644 --- a/src/main/java/buttondevteam/presents/hello/Hello.java +++ b/src/main/java/buttondevteam/presents/hello/Hello.java @@ -8,15 +8,18 @@ import buttondevteam.presents.hello.commands.HelloLoad; import buttondevteam.presents.hello.commands.HelloSave; import buttondevteam.presents.hello.commands.HelloTime; import buttondevteam.presents.hello.effects.HelloBedsplode; +import buttondevteam.presents.hello.effects.HelloBlock; import buttondevteam.presents.hello.effects.HelloCow; import buttondevteam.presents.hello.effects.HelloItem; import buttondevteam.presents.hello.effects.HelloMagicPotato; +import buttondevteam.presents.hello.effects.HelloParticle; +import buttondevteam.presents.hello.effects.HelloSound; public class Hello extends Component{ @Override public void register(JavaPlugin plugin) { - this.registerCommand(plugin, new HelloCommand(plugin)); + this.registerCommand(plugin, new HelloCommand()); this.registerListener(plugin, new HelloBedsplode()); this.registerCommand(plugin, new HelloCow()); this.registerCommand(plugin, new HelloItem()); @@ -24,5 +27,8 @@ public class Hello extends Component{ this.registerCommand(plugin, new HelloSave()); this.registerCommand(plugin, new HelloLoad()); this.registerCommand(plugin, new HelloTime()); + this.registerCommand(plugin, new HelloBlock()); + this.registerCommand(plugin, new HelloParticle()); + this.registerCommand(plugin, new HelloSound()); } } diff --git a/src/main/java/buttondevteam/presents/hello/commands/HelloCommand.java b/src/main/java/buttondevteam/presents/hello/commands/HelloCommand.java index 199cef6..4f1bbbb 100644 --- a/src/main/java/buttondevteam/presents/hello/commands/HelloCommand.java +++ b/src/main/java/buttondevteam/presents/hello/commands/HelloCommand.java @@ -1,15 +1,10 @@ package buttondevteam.presents.hello.commands; import org.bukkit.command.CommandSender; -import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.presents.architecture.commands.BaseCommand; public class HelloCommand extends BaseCommand { - JavaPlugin plugin; - public HelloCommand(JavaPlugin plugin) { - this.plugin = plugin; - } @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { diff --git a/src/main/java/buttondevteam/presents/hello/effects/HelloBlock.java b/src/main/java/buttondevteam/presents/hello/effects/HelloBlock.java new file mode 100644 index 0000000..e977ad0 --- /dev/null +++ b/src/main/java/buttondevteam/presents/hello/effects/HelloBlock.java @@ -0,0 +1,19 @@ +package buttondevteam.presents.hello.effects; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import buttondevteam.presents.architecture.commands.PlayerCommand; + +public class HelloBlock extends PlayerCommand { + + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + player.getWorld().getBlockAt(player.getLocation()).setType(Material.CAKE_BLOCK); + return false; + } + public String GetCommandPath(){ + return "hello block"; + } + +} diff --git a/src/main/java/buttondevteam/presents/hello/effects/HelloParticle.java b/src/main/java/buttondevteam/presents/hello/effects/HelloParticle.java new file mode 100644 index 0000000..996e28e --- /dev/null +++ b/src/main/java/buttondevteam/presents/hello/effects/HelloParticle.java @@ -0,0 +1,16 @@ +package buttondevteam.presents.hello.effects; + +import org.bukkit.Particle; +import org.bukkit.entity.Player; + +import buttondevteam.presents.architecture.commands.PlayerCommand; + +public class HelloParticle extends PlayerCommand { + + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 10); + return false; + } + +} diff --git a/src/main/java/buttondevteam/presents/hello/effects/HelloSound.java b/src/main/java/buttondevteam/presents/hello/effects/HelloSound.java new file mode 100644 index 0000000..7d82f4e --- /dev/null +++ b/src/main/java/buttondevteam/presents/hello/effects/HelloSound.java @@ -0,0 +1,38 @@ +package buttondevteam.presents.hello.effects; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import buttondevteam.presents.architecture.commands.PlayerCommand; + +public class HelloSound extends PlayerCommand{ + + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + int volume = 0; + int pitch = 0; + if (args.length >= 2){ + try{ + volume = Integer.parseInt(args[0]); + pitch = Integer.parseInt(args[1]); + }catch(NumberFormatException e){ + volume = 0; + pitch = 0; + player.sendMessage("Incorrect input:"); + player.sendMessage(args[0] + " must be an int."); + player.sendMessage(args[1] + " must be an int."); + }catch(Exception e){ + player.sendMessage("Incorrect Input"); + player.sendMessage(e.toString()); + } + + } + player.getWorld().playSound(player.getLocation(), Sound.BLOCK_ANVIL_FALL, volume, pitch); + return false; + + } + public String GetCommandPath(){ + return "hello sound"; + } + +}