leave group command

This commit is contained in:
LunarAkai 2025-06-05 22:27:17 +02:00
commit f1545ba687
6 changed files with 59 additions and 11 deletions

View file

@ -69,10 +69,8 @@ public class MinecleanerManager {
this.sizes.put(3, "experte");
this.confirmPlayingInventory = plugin.getServer().createInventory(null, InventoryType.HOPPER, plugin.getDisplayedPluginName() + " starten?");
this.confirmPlayingInventory.setItem(1,
ItemStacks.lore(ItemStacks.rename(new ItemStack(Material.GREEN_CONCRETE), ChatColor.GREEN + "Bestätigen")));
this.confirmPlayingInventory.setItem(3,
ItemStacks.lore(ItemStacks.rename(new ItemStack(Material.RED_CONCRETE), ChatColor.RED + "Abbrechen")));
this.confirmPlayingInventory.setItem(1, ItemStacks.rename(new ItemStack(Material.GREEN_CONCRETE), NamedTextColor.GREEN + "Bestätigen"));
this.confirmPlayingInventory.setItem(3, ItemStacks.rename(new ItemStack(Material.GREEN_CONCRETE), NamedTextColor.RED + "Abbrechen"));
// Settings

View file

@ -19,12 +19,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class InviteCommand extends SubCommand {
/*
TODO:
- Invite other Players to play in Duo Mode
- Add Functionality to support multiple Players in the same game
- use settings of player that invited the other player
*/
private final MinecleanerPlugin plugin;

View file

@ -0,0 +1,53 @@
package de.lunarakai.minecleaner.commands.groups;
import de.iani.cubesideutils.bukkit.commands.SubCommand;
import de.iani.cubesideutils.bukkit.commands.exceptions.DisallowsCommandBlockException;
import de.iani.cubesideutils.bukkit.commands.exceptions.IllegalSyntaxException;
import de.iani.cubesideutils.bukkit.commands.exceptions.InternalCommandException;
import de.iani.cubesideutils.bukkit.commands.exceptions.NoPermissionException;
import de.iani.cubesideutils.bukkit.commands.exceptions.RequiresPlayerException;
import de.iani.cubesideutils.commands.ArgsParser;
import de.lunarakai.minecleaner.MinecleanerPlugin;
import de.lunarakai.minecleaner.utils.ChatUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class LeaveGroupCommand extends SubCommand {
private final MinecleanerPlugin plugin;
public LeaveGroupCommand(MinecleanerPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getUsage() {
return "";
}
@Override
public boolean requiresPlayer() {
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String commandString, ArgsParser args) throws DisallowsCommandBlockException, RequiresPlayerException, NoPermissionException, IllegalSyntaxException, InternalCommandException {
Player player = (Player) sender;
if(plugin.getGroupManager().getGroup(player) == null) {
ChatUtils.sendSimpleWarningMessage(player, "group.common.notingroup");
return true;
}
Player groupOwnerPlayer = Bukkit.getPlayer(plugin.getGroupManager().getGroup(player).getOwner());
if(player == groupOwnerPlayer) {
ChatUtils.sendSimpleWarningMessage(player, "group.leave.usedismantle");
return true;
}
plugin.getGroupManager().getGroup(player).removePlayerFromGroup(player);
return true;
}
}