本文整理汇总了Java中nl.riebie.mcclans.api.ClanPlayer类的典型用法代码示例。如果您正苦于以下问题:Java ClanPlayer类的具体用法?Java ClanPlayer怎么用?Java ClanPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClanPlayer类属于nl.riebie.mcclans.api包,在下文中一共展示了ClanPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isPlayerFriendlyToThisClan
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public boolean isPlayerFriendlyToThisClan(ClanPlayer clanPlayer) {
if (clanPlayer == null) {
return false;
}
if (clanPlayer instanceof ClanPlayerImpl) {
ClanPlayerImpl clanPlayerImpl = (ClanPlayerImpl) clanPlayer;
ClanImpl clan = clanPlayerImpl.getClan();
if (clan != null) {
if (clan.getTag().equals(tag)) {
return true;
}
if (isClanAllyOfThisClan(clan)) {
return true;
}
}
return false;
} else {
throw new NotDefaultImplementationException(clanPlayer.getClass());
}
}
示例2: createClan
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public Result<Clan> createClan(String tag, String name, ClanPlayer owner) {
if (tag == null || name == null || owner == null) {
throw new IllegalArgumentException("arguments may not be null");
}
if (!(owner instanceof ClanPlayerImpl)) {
throw new NotDefaultImplementationException(owner.getClass());
}
ClanPlayerImpl ownerImpl = (ClanPlayerImpl) owner;
if (ownerImpl.getClan() != null) {
throw new IllegalArgumentException("provided player may not already be in a clan");
}
if (!isTagAvailable(tag)) {
throw new IllegalArgumentException("provided tag already taken");
}
ClanCreateEvent.Plugin clanCreateEvent = EventDispatcher.getInstance().dispatchPluginClanCreateEvent(tag, name, owner);
if (clanCreateEvent.isCancelled()) {
return ResultImpl.ofError(clanCreateEvent.getCancelMessage());
} else {
Clan clan = createClanInternal(tag, name, ownerImpl);
return ResultImpl.ofResult(clan);
}
}
示例3: parseValue
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public ParseResult<ClanPlayer> parseValue(CommandSource commandSource, String value, NormalFilledParameter parameter) {
ClanPlayerImpl clanPlayer = null;
if (value.startsWith("@")) {
Set<Entity> entities = Selector.parse(value).resolve(commandSource);
if (entities.size() > 0 && entities.toArray()[0] instanceof Player) {
UUID uuid = ((Player) entities.toArray()[0]).getUniqueId();
clanPlayer = ClansImpl.getInstance().getClanPlayer(uuid);
} else {
return ParseResult.newErrorResult("Selector produced no results");
}
} else {
clanPlayer = ClansImpl.getInstance().getClanPlayer(value);
}
if (clanPlayer != null) {
return ParseResult.newSuccessResult((ClanPlayer) clanPlayer);
} else {
UUID playerUUID = UUIDUtils.getUUID(value);
Optional<Player> playerOp = playerUUID == null ? Optional.empty() : Sponge.getServer().getPlayer(playerUUID);
if (playerOp.isPresent()) {
return ParseResult.newSuccessResult(ClansImpl.getInstance().createClanPlayer(playerUUID, value));
} else {
return ParseResult.newErrorResult(Messages.PLAYER_DOES_NOT_EXIST);
}
}
}
示例4: isPlayerMember
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public boolean isPlayerMember(UUID uuid) {
for (ClanPlayer clanPlayer : getMembers()) {
if (clanPlayer.getUUID().equals(uuid)) {
return true;
}
}
return false;
}
示例5: isPlayerInvited
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public boolean isPlayerInvited(String playerName) {
for (ClanPlayer clanPlayer : getInvitedPlayersImpl()) {
if (clanPlayer.getName().toLowerCase().equals(playerName.toLowerCase())) {
return true;
}
}
return false;
}
示例6: setOwner
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public Result<ClanPlayer> setOwner(ClanPlayer clanPlayer) {
if (clanPlayer == null) {
throw new IllegalArgumentException("clan player may not be null");
}
if (!(clanPlayer instanceof ClanPlayerImpl)) {
throw new NotDefaultImplementationException(clanPlayer.getClass());
}
ClanPlayerImpl clanPlayerImpl = (ClanPlayerImpl) clanPlayer;
if (clanPlayer.getClan() == null || !this.equals(clanPlayer.getClan())) {
throw new IllegalArgumentException("player not a member of this clan");
}
if (owner.equals(clanPlayer)) {
// Already the owner, yay! Do nothing.
return ResultImpl.ofResult(clanPlayerImpl);
}
ClanOwnerChangeEvent event = EventDispatcher.getInstance().dispatchPluginClanOwnerChangeEvent(this, owner, clanPlayerImpl);
if (event.isCancelled()) {
return ResultImpl.ofError(event.getCancelMessage());
} else {
setOwnerInternal(clanPlayerImpl);
return ResultImpl.ofResult(clanPlayerImpl);
}
}
示例7: addMember
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public void addMember(ClanPlayer player) {
if (player == null) {
return;
}
if (player instanceof ClanPlayerImpl) {
ClanPlayerImpl clanPlayerImpl = (ClanPlayerImpl) player;
members.add(clanPlayerImpl);
TaskForwarder.sendUpdateClanPlayer(clanPlayerImpl);
} else {
throw new NotDefaultImplementationException(player.getClass());
}
}
示例8: removeMember
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public void removeMember(ClanPlayer player) {
ClanPlayerImpl member = getMember(player.getUUID());
if (member != null) {
member.setClan(null);
member.setRankInternal(null);
members.remove(member);
TaskForwarder.sendUpdateClanPlayer(member);
}
}
示例9: addInvitedPlayer
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public void addInvitedPlayer(ClanPlayer player) {
if (player == null) {
return;
}
if (player instanceof ClanPlayerImpl) {
invitedMembers.add((ClanPlayerImpl) player);
} else {
throw new NotDefaultImplementationException(player.getClass());
}
}
示例10: removeClanPlayer
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public void removeClanPlayer(ClanPlayer clanPlayer) {
if (clanPlayer == null) {
return;
}
if (clanPlayer instanceof ClanPlayerImpl) {
ClanPlayerImpl clanPlayerImpl = (ClanPlayerImpl) clanPlayer;
String playerName = clanPlayerImpl.getName();
ClanImpl clan = clanPlayerImpl.getClan();
ClanInvite clanInvite = clanPlayerImpl.getClanInvite();
if (clan != null) {
if (clan.getOwner().equals(clanPlayerImpl)) {
disbandClanInternal(clan);
} else {
clan.removeMember(clanPlayerImpl);
}
}
if (clanInvite != null) {
ClanImpl invitingClan = clanInvite.getClan();
invitingClan.removeInvitedPlayer(playerName);
}
clanPlayers.remove(clanPlayerImpl.getUUID());
TaskForwarder.sendDeleteClanPlayer(clanPlayerImpl.getID());
} else {
throw new NotDefaultImplementationException(clanPlayer.getClass());
}
}
示例11: ClanCreateEvent
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public ClanCreateEvent(String clanTag, String clanName, ClanPlayer owner) {
super("Clan creation cancelled by an external plugin", Cause.of(NamedCause.owner(owner)));
this.clanTag = clanTag;
this.clanName = clanName;
this.owner = owner;
}
示例12: getMembers
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
@Override
public List<ClanPlayer> getMembers() {
return new ArrayList<ClanPlayer>(members);
}
示例13: dispatchPluginClanCreateEvent
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public ClanCreateEvent.Plugin dispatchPluginClanCreateEvent(String clanTag, String clanName, ClanPlayer owner) {
ClanCreateEvent.Plugin event = new ClanCreateEvent.Plugin(clanTag, clanName, owner);
dispatchEvent(event);
return event;
}
示例14: dispatchUserClanCreateEvent
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public ClanCreateEvent.User dispatchUserClanCreateEvent(String clanTag, String clanName, ClanPlayer owner) {
ClanCreateEvent.User event = new ClanCreateEvent.User(clanTag, clanName, owner);
dispatchEvent(event);
return event;
}
示例15: dispatchAdminClanCreateEvent
import nl.riebie.mcclans.api.ClanPlayer; //导入依赖的package包/类
public ClanCreateEvent.Admin dispatchAdminClanCreateEvent(String clanTag, String clanName, ClanPlayer owner) {
ClanCreateEvent.Admin event = new ClanCreateEvent.Admin(clanTag, clanName, owner);
dispatchEvent(event);
return event;
}