master
Default 4 years ago
parent 0c4de37532
commit 1c0f4b6d44
  1. 2
      plugin.yml
  2. 12
      src/main/java/com/benjocraeft/sharehealth/Commands.java
  3. 6
      src/main/java/com/benjocraeft/sharehealth/Sharehealth.java

@ -10,4 +10,4 @@ commands:
sharehealth: sharehealth:
usage: /<command> usage: /<command>
aliases: [sh] aliases: [sh]
description: Defined by ShareHealth plugin description: Commands to control the Sharehealth System added by the Plugin

@ -1,14 +1,21 @@
package com.benjocraeft.sharehealth; package com.benjocraeft.sharehealth;
import org.bukkit.command.CommandExecutor;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Commands implements CommandExecutor { import java.util.List;
public class Commands implements TabExecutor {
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
return null;
}
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
@ -129,5 +136,4 @@ public class Commands implements CommandExecutor {
String msg = "Unknown command, use help."; String msg = "Unknown command, use help.";
sender.sendMessage(msg); sender.sendMessage(msg);
} }
} }

@ -2,6 +2,7 @@ package com.benjocraeft.sharehealth;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
@ -60,7 +61,10 @@ public class Sharehealth extends JavaPlugin {
//Register Events and Commands //Register Events and Commands
Bukkit.getPluginManager().registerEvents(new PlayerListeners(), this); Bukkit.getPluginManager().registerEvents(new PlayerListeners(), this);
Objects.requireNonNull(getCommand("sharehealth")).setExecutor(new Commands()); Commands commands = new Commands();
PluginCommand pluginCommand = Objects.requireNonNull(getCommand("sharehealth"));
pluginCommand.setExecutor(commands);
pluginCommand.setTabCompleter(commands);
//Ready to go //Ready to go
getLogger().info("ShareHealth has been enabled!"); getLogger().info("ShareHealth has been enabled!");

Loading…
Cancel
Save