9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 04:19:28 +00:00

fix: break once "-s" flag found

This commit is contained in:
Craftinators
2023-02-24 12:11:22 -05:00
parent 44be4eceb8
commit 601d6f8a53
2 changed files with 9 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ public class CosmeticCommand implements CommandExecutor {
// 0 1 2
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
boolean silent = false;
if (args.length == 0) {
@@ -69,7 +69,10 @@ public class CosmeticCommand implements CommandExecutor {
if (sender.hasPermission("HMCCosmetics.cmd.silent") || sender.isOp()) {
for (String singleArg : args) {
if (singleArg.equalsIgnoreCase("-s")) silent = true;
if (singleArg.equalsIgnoreCase("-s")) {
silent = true;
break;
}
}
}
@@ -145,7 +148,7 @@ public class CosmeticCommand implements CommandExecutor {
return true;
}
CosmeticSlot cosmeticSlot = null;
CosmeticSlot cosmeticSlot;
if (sender instanceof Player) player = ((Player) sender).getPlayer();
if (sender.hasPermission("hmccosmetics.cmd.unapply.other")) {

View File

@@ -13,11 +13,12 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.jetbrains.annotations.NotNull;
public class PlayerConnectionListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
public void onPlayerJoin(@NotNull PlayerJoinEvent event) {
if (event.getPlayer().isOp() || event.getPlayer().hasPermission("hmccosmetics.notifyupdate")) {
if (!HMCCosmeticsPlugin.getLatestVersion().equalsIgnoreCase(HMCCosmeticsPlugin.getInstance().getDescription().getVersion()) && HMCCosmeticsPlugin.getLatestVersion() != null)
MessagesUtil.sendMessageNoKey(
@@ -46,7 +47,7 @@ public class PlayerConnectionListener implements Listener {
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
public void onPlayerQuit(@NotNull PlayerQuitEvent event) {
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer());
if (user == null) { // Remove any passengers if a user failed to initialize. Bugs can cause this to happen
if (!event.getPlayer().getPassengers().isEmpty()) {