Started work on ChooseColor Command
This commit is contained in:
parent
e238a4475f
commit
7e43d8f090
3 changed files with 57 additions and 0 deletions
|
@ -8,6 +8,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
import buttondevteam.presents.dictionary.DictionaryComponent;
|
||||
import buttondevteam.presents.metrics.MetricsComponent;
|
||||
import buttondevteam.presents.rtp.RandomTeleportComponent;
|
||||
import buttondevteam.presents.spawn.SpawnComponent;
|
||||
import buttondevteam.presents.test.TestComponent;
|
||||
|
||||
public class Main extends JavaPlugin{
|
||||
public void onEnable(){
|
||||
|
@ -19,6 +21,8 @@ PluginDescriptionFile pdfFile = getDescription();
|
|||
new DictionaryComponent().register(this);
|
||||
new RandomTeleportComponent().register(this);
|
||||
new MetricsComponent().register(this);
|
||||
new SpawnComponent().register(this);
|
||||
new TestComponent().register(this);
|
||||
|
||||
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||
}
|
||||
|
|
38
src/main/java/buttondevteam/presents/spawn/ChooseColor.java
Normal file
38
src/main/java/buttondevteam/presents/spawn/ChooseColor.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package buttondevteam.presents.spawn;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.lib.chat.CommandClass;
|
||||
import buttondevteam.presents.architecture.commands.UniversalCommand;
|
||||
|
||||
@CommandClass(modOnly = false)
|
||||
public class ChooseColor extends UniversalCommand {
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
if (!(sender instanceof BlockCommandSender)){
|
||||
sender.sendMessage("You must be a command block to use this command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Server server = sender.getServer();
|
||||
server.broadcastMessage("Arg 0:" + args[0]);
|
||||
server.broadcastMessage("Arg 1:" + args[1]);
|
||||
|
||||
Player player = server.getPlayer(args[0]);
|
||||
if (player != null){
|
||||
player.sendMessage("Attempting to change your name "+player.getName()+" to the color...");
|
||||
player.sendMessage(args[1]);
|
||||
player.sendMessage("Your new name: " +player.getName());
|
||||
}else{
|
||||
server.broadcastMessage("Error: Player is null");
|
||||
}
|
||||
|
||||
server.broadcastMessage("ENDOFCOMMAND");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package buttondevteam.presents.spawn;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import buttondevteam.presents.architecture.Component;
|
||||
|
||||
public class SpawnComponent extends Component{
|
||||
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
this.registerCommand(plugin, new ChooseColor());
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue