Add command for igniting another player

This commit is contained in:
Dan Buch 2015-04-24 20:44:28 -04:00
parent 427739bd55
commit d246e8fa17
2 changed files with 31 additions and 0 deletions

View File

@ -1,5 +1,9 @@
package com.meatballhat.linksadventure; package com.meatballhat.linksadventure;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public final class LinksAdventure extends JavaPlugin { public final class LinksAdventure extends JavaPlugin {
@ -12,4 +16,25 @@ public final class LinksAdventure extends JavaPlugin {
public void onDisable() { public void onDisable() {
getLogger().info("onDisable has been invoked!"); getLogger().info("onDisable has been invoked!");
} }
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!cmd.getName().equalsIgnoreCase("ignite")) {
return false;
}
if (args.length != 1) {
return false;
}
Player target = Bukkit.getServer().getPlayer(args[0]);
if (target == null) {
sender.sendMessage(args[0] + " is not currently online.");
return true;
}
target.setFireTicks(10000);
return true;
}
} }

View File

@ -1,3 +1,9 @@
name: "LinksAdventure" name: "LinksAdventure"
main: "com.meatballhat.linksadventure.LinksAdventure" main: "com.meatballhat.linksadventure.LinksAdventure"
version: "0.1.0-SNAPSHOT" version: "0.1.0-SNAPSHOT"
commands:
ignite:
description: Ignite a player
usage: "/ignite <player>"
permission: LinksAdventure.basic
permission-message: You may not ignite