mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-03-14 13:59:43 +01:00
53 lines
1.5 KiB
Java
53 lines
1.5 KiB
Java
![]() |
package com.gmail.nossr50.commands.party;
|
||
|
|
||
|
import org.bukkit.ChatColor;
|
||
|
import org.bukkit.command.Command;
|
||
|
import org.bukkit.command.CommandExecutor;
|
||
|
import org.bukkit.command.CommandSender;
|
||
|
import org.bukkit.entity.Player;
|
||
|
|
||
|
import com.gmail.nossr50.Users;
|
||
|
import com.gmail.nossr50.mcPermissions;
|
||
|
import com.gmail.nossr50.config.LoadProperties;
|
||
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||
|
import com.gmail.nossr50.locale.mcLocale;
|
||
|
import com.gmail.nossr50.party.Party;
|
||
|
|
||
|
public class AcceptCommand implements CommandExecutor {
|
||
|
@Override
|
||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||
|
if (!LoadProperties.acceptEnable) {
|
||
|
sender.sendMessage("This command is not enabled.");
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
if (!(sender instanceof Player)) {
|
||
|
sender.sendMessage("This command does not support console useage.");
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
Player player = (Player) sender;
|
||
|
PlayerProfile PP = Users.getProfile(player);
|
||
|
|
||
|
if (!mcPermissions.getInstance().party(player)) {
|
||
|
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
if (PP.hasPartyInvite()) {
|
||
|
Party Pinstance = Party.getInstance();
|
||
|
|
||
|
if (PP.inParty()) {
|
||
|
Pinstance.removeFromParty(player, PP);
|
||
|
}
|
||
|
PP.acceptInvite();
|
||
|
Pinstance.addToParty(player, PP, PP.getParty(), true);
|
||
|
|
||
|
} else {
|
||
|
player.sendMessage(mcLocale.getString("mcPlayerListener.NoInvites"));
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
}
|