Skip to content

Commit

Permalink
Updated Version string and optimised Debugger.debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hutch79 committed Mar 14, 2023
1 parent ecb6c01 commit a4a18cf
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ch.hutch79</groupId>
<artifactId>F-Command</artifactId>
<version>beta.2</version>
<version>2.3</version>
<packaging>jar</packaging>

<name>F-Command</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/hutch79/Debugger.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

public final class Debugger {
public static void debug(String message) {
if (FCommand.isDebug()) Bukkit.getConsoleSender().sendMessage(message);
if (FCommand.isDebug()) Bukkit.getConsoleSender().sendMessage("§cFcmd-debug §8> §7 " + message);
}
}
20 changes: 10 additions & 10 deletions src/main/java/ch/hutch79/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void EventListenerInit() {
Set<String> commandOptions2 = Objects.requireNonNull(FCommand.getInstance().getConfig().getConfigurationSection("command")).getKeys(false);
commandOptions = new ArrayList<>(commandOptions2.size());
commandOptions.addAll(commandOptions2);
Debugger.debug("§cFcmd-debug §8> §7commandOptions list: §e" + commandOptions);
Debugger.debug("commandOptions list: §e" + commandOptions);

Bukkit.getConsoleSender().sendMessage("§dF-Command §8> §7Loaded Commands: " + commandOptions);
}
Expand All @@ -37,48 +37,48 @@ private String getInfo(int count, String value){
@EventHandler
public void onSwapHandItemsEvent(PlayerSwapHandItemsEvent e) {

Debugger.debug("§cFcmd-debug §8> §7PlayerSwapHandItemsEvent detected");
Debugger.debug("PlayerSwapHandItemsEvent detected");

Player player = e.getPlayer();

for (int count = 0; count < commandOptions.size(); count++) {

Debugger.debug("§cFcmd-debug §8> §7Event while count: §e" + (count));
Debugger.debug("§cFcmd-debug §8> §7Event while current command: §e" + commandOptions.get(count));
Debugger.debug("Event while count: §e" + (count));
Debugger.debug("Event while current command: §e" + commandOptions.get(count));


if (!getInfo(count, "permission").equalsIgnoreCase("None")) { // Correct Permission?
if (!player.hasPermission(getInfo(count, "permission"))) {
Debugger.debug("§cFcmd-debug §8> §7return permission - §e" + commandOptions.get(count));
Debugger.debug("return permission - §e" + commandOptions.get(count));
continue;
}
}

if (getInfo(count, "requireShift").equalsIgnoreCase("true")) {
if (!player.isSneaking()) {
Debugger.debug("§cFcmd-debug §8> §7return sneaking 1 - §e" + commandOptions.get(count));
Debugger.debug("return sneaking 1 - §e" + commandOptions.get(count));
continue;
}
} else if (getInfo(count, "requireShift").equalsIgnoreCase("false")) {
if (player.isSneaking()) {
Debugger.debug("§cFcmd-debug §8> §7return sneaking 2 - §e" + commandOptions.get(count));
Debugger.debug("return sneaking 2 - §e" + commandOptions.get(count));
continue;
}
}


if (getInfo(count, "cancel").equalsIgnoreCase("true")) {
e.setCancelled(true);
Debugger.debug("§cFcmd-debug §8> §7event canceled - §e" + commandOptions.get(count));
Debugger.debug("event canceled - §e" + commandOptions.get(count));
}


if (getInfo(count, "executeAsServer").equalsIgnoreCase("true")) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), mainInstance.replacePlaceholders(player,getInfo(count, "command")));
Debugger.debug("§cFcmd-debug §8> §7Executed by Server - §e" + commandOptions.get(count));
Debugger.debug("Executed by Server - §e" + commandOptions.get(count));
} else {
player.performCommand(mainInstance.replacePlaceholders(player,getInfo(count, "command")));
Debugger.debug("§cFcmd-debug §8> §7Executed by Player - §e" + commandOptions.get(count));
Debugger.debug("Executed by Player - §e" + commandOptions.get(count));
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/ch/hutch79/FCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,34 @@ public void onEnable() {
getLogger().warning("If you find any Bugs, please report them on GitHub: https://github.com/Hutch79/CookieClicker");
}

Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5======================================================");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §6F-Command " + pdf.getVersion() + " §bby Hutch79");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §7Has been §2Enabled");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5------------------------------------------------------");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §cIf you find any Bugs, please report them on GitHub");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §6https://github.com/Hutch79/CookieClicker");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §9Discord: §6https://dc.hutch79.ch");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5======================================================");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5======================================================");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §6" + pdf.getName() + " " + pdf.getVersion() + " §bby Hutch79");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §7Has been §2Enabled");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5------------------------------------------------------");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §cIf you find any Bugs, please report them on GitHub");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §6https://github.com/Hutch79/CookieClicker");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §9Discord: §6https://dc.hutch79.ch");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5======================================================");

if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §aPlaceholderAPI §7has been found, hooking into it now.");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §aPlaceholderAPI §7has been found, hooking into it now.");
isPlaceholderApiInstalled = true;
}
else {
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §aPlaceholderAPI §7has not been found.");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §aPlaceholderAPI §7has not been found.");
}
}

@Override
public void onDisable() {
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5======================================================");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §6F-Command " + pdf.getVersion() + " §bby Hutch79");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §7Has been §cDisabled");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5------------------------------------------------------");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §cIf you find any Bugs, please report them on GitHub");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §6https://github.com/Hutch79/F-Command");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5| §9Discord: §6https://dc.hutch79.ch");
Bukkit.getConsoleSender().sendMessage(dF-Command §8> §5======================================================");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5======================================================");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §6F-Command " + pdf.getVersion() + " §bby Hutch79");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §7Has been §cDisabled");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5------------------------------------------------------");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §cIf you find any Bugs, please report them on GitHub");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §6https://github.com/Hutch79/F-Command");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5| §9Discord: §6https://dc.hutch79.ch");
Bukkit.getConsoleSender().sendMessage(d" + pdf.getName() + " §8> §5======================================================");
}

public static FCommand getInstance() {
Expand Down

0 comments on commit a4a18cf

Please sign in to comment.