Skip to content

Commit

Permalink
check if command startswith help
Browse files Browse the repository at this point in the history
  • Loading branch information
moom0o committed Jul 19, 2021
1 parent f218363 commit 3a3db2f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions me/moomoo/help/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
Expand All @@ -12,6 +11,7 @@

public class Main extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();

public void onEnable() {
saveDefaultConfig();
System.out.println("[ENABLED] AnarchyExploitFixes - Made by moomoo");
Expand All @@ -21,13 +21,13 @@ public void onEnable() {
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onCommandPreprocess(PlayerCommandPreprocessEvent evt){
if(evt.getMessage().equalsIgnoreCase("/help")){
public void onCommandPreprocess(PlayerCommandPreprocessEvent evt) {
if (evt.getMessage().toLowerCase().startsWith("/help")) {
getConfig().getList("help").forEach(b -> evt.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', (String) b)));
evt.setCancelled(true);
}
if(evt.getMessage().toLowerCase().startsWith("/kill ") || evt.getMessage().equalsIgnoreCase("/kill")){
if(getConfig().getBoolean("killcommand")){
if (evt.getMessage().toLowerCase().startsWith("/kill ") || evt.getMessage().equalsIgnoreCase("/kill")) {
if (getConfig().getBoolean("killcommand")) {
evt.getPlayer().setHealth(0.0D);
evt.setCancelled(true);
}
Expand Down

0 comments on commit 3a3db2f

Please sign in to comment.