Added sounds, blocks, and particles
This commit is contained in:
parent
01316ad297
commit
bdff3fa6d1
5 changed files with 80 additions and 6 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue