use of net.dzikoysk.funnyguilds.concurrency.ConcurrencyManager in project FunnyGuilds by FunnyGuilds.
the class DatabaseBasic method load.
public void load() {
Database db = Database.getInstance();
PluginConfig config = Settings.getConfig();
usersTable(db);
regionsTable(db);
guildsTable(db);
Database.getInstance().executeQuery("SELECT * FROM `" + config.mysql.usersTableName + "`", usersResult -> {
try {
while (usersResult.next()) {
User user = DatabaseUser.deserialize(usersResult);
if (user != null) {
user.changed();
}
}
FunnyLogger.info("Loaded users: " + UserUtils.getUsers().size());
} catch (Exception e) {
if (FunnyLogger.exception(e.getCause())) {
e.printStackTrace();
}
}
});
if (Settings.getConfig().regionsEnabled) {
Database.getInstance().executeQuery("SELECT * FROM `" + config.mysql.regionsTableName + "`", regionsResult -> {
try {
while (regionsResult.next()) {
Region region = DatabaseRegion.deserialize(regionsResult);
if (region != null) {
region.changed();
}
}
FunnyLogger.info("Loaded regions: " + RegionUtils.getRegions().size());
} catch (Exception e) {
if (FunnyLogger.exception(e.getCause())) {
e.printStackTrace();
}
}
});
} else {
FunnyLogger.info("Regions are disabled and thus - not loaded");
}
Database.getInstance().executeQuery("SELECT * FROM `" + config.mysql.guildsTableName + "`", guildsResult -> {
try {
while (guildsResult.next()) {
Guild guild = DatabaseGuild.deserialize(guildsResult);
if (guild != null) {
guild.changed();
}
}
FunnyLogger.info("Loaded guilds: " + GuildUtils.getGuilds().size());
} catch (Exception e) {
if (FunnyLogger.exception(e.getCause())) {
e.printStackTrace();
}
}
});
// TODO
for (Guild guild : GuildUtils.getGuilds()) {
if (guild.getOwner() != null) {
continue;
}
GuildUtils.deleteGuild(guild);
}
// IndependentThread.action(ActionType.PREFIX_GLOBAL_UPDATE);
ConcurrencyManager concurrencyManager = FunnyGuilds.getInstance().getConcurrencyManager();
concurrencyManager.postRequests(new PrefixGlobalUpdateRequest());
}
use of net.dzikoysk.funnyguilds.concurrency.ConcurrencyManager in project FunnyGuilds by FunnyGuilds.
the class Flat method loadGuilds.
private void loadGuilds() {
GuildUtils.getGuilds().clear();
File[] path = GUILDS.listFiles();
if (path != null) {
for (File file : path) {
Guild guild = FlatGuild.deserialize(file);
if (guild == null) {
file.delete();
} else {
guild.changed();
}
}
}
// TODO
for (Guild guild : GuildUtils.getGuilds()) {
if (guild.getOwner() != null) {
continue;
}
GuildUtils.deleteGuild(guild);
}
// IndependentThread.action(ActionType.PREFIX_GLOBAL_UPDATE);
ConcurrencyManager concurrencyManager = FunnyGuilds.getInstance().getConcurrencyManager();
concurrencyManager.postRequests(new PrefixGlobalUpdateRequest());
FunnyLogger.info("Loaded guilds: " + GuildUtils.getGuilds().size());
}
use of net.dzikoysk.funnyguilds.concurrency.ConcurrencyManager in project FunnyGuilds by FunnyGuilds.
the class PlayerDeath method onDeath.
@EventHandler
public void onDeath(PlayerDeathEvent event) {
Player v = event.getEntity();
Player a = event.getEntity().getKiller();
User victim = User.get(v);
victim.getRank().addDeath();
if (a == null) {
return;
}
User attacker = User.get(a);
if (victim.equals(attacker)) {
return;
}
if (PluginHook.isPresent(PluginHook.PLUGIN_WORLDGUARD)) {
if (WorldGuardHook.isOnNonPointsRegion(v.getLocation()) || WorldGuardHook.isOnNonPointsRegion(a.getLocation())) {
return;
}
}
PluginConfig config = Settings.getConfig();
MessagesConfig messages = Messages.getInstance();
if (config.rankFarmingProtect) {
if (attacker.getLastVictim() != null && attacker.getLastVictim().equals(victim)) {
if (attacker.getLastVictimTime() + (config.rankFarmingCooldown * 1000) >= System.currentTimeMillis()) {
v.sendMessage(messages.rankLastVictimV);
a.sendMessage(messages.rankLastVictimA);
event.setDeathMessage(null);
return;
}
} else if (victim.getLastAttacker() != null && victim.getLastAttacker().equals(attacker)) {
if (victim.getLastVictimTime() + (config.rankFarmingCooldown * 1000) >= System.currentTimeMillis()) {
v.sendMessage(messages.rankLastAttackerV);
a.sendMessage(messages.rankLastAttackerA);
event.setDeathMessage(null);
return;
}
}
}
if (config.rankIPProtect) {
if (a.getAddress().getHostString().equalsIgnoreCase(v.getAddress().getHostString())) {
v.sendMessage(messages.rankIPVictim);
a.sendMessage(messages.rankIPAttacker);
event.setDeathMessage(null);
return;
}
}
int[] rankChanges = new int[2];
int aP = attacker.getRank().getPoints();
int vP = victim.getRank().getPoints();
switch(config.rankSystem) {
case ELO:
rankChanges = getEloValues(vP, aP);
break;
case PERCENT:
Double d = victim.getRank().getPoints() * (config.percentRankChange / 100);
rankChanges[0] = d.intValue();
rankChanges[1] = d.intValue();
break;
case STATIC:
rankChanges[0] = config.staticAttackerChange;
rankChanges[1] = config.staticVictimChange;
break;
default:
rankChanges = getEloValues(vP, aP);
break;
}
RankChangeEvent attackerEvent = new PointsChangeEvent(EventCause.USER, attacker.getRank(), attacker, rankChanges[0]);
RankChangeEvent victimEvent = new PointsChangeEvent(EventCause.USER, victim.getRank(), attacker, rankChanges[1]);
List<String> assistEntries = new ArrayList<>();
if (SimpleEventHandler.handle(attackerEvent) && SimpleEventHandler.handle(victimEvent)) {
double attackerDamage = victim.killedBy(attacker);
if (config.assistEnable && victim.isAssisted()) {
double toShare = attackerEvent.getChange() * (1 - config.assistKillerShare);
double totalDamage = victim.getTotalDamage() + attackerDamage;
int givenPoints = 0;
Map<User, Double> damage = MapUtil.sortByValue(victim.getDamage());
int assists = 0;
for (Entry<User, Double> assist : damage.entrySet()) {
double assistFraction = assist.getValue() / totalDamage;
int addedPoints = (int) Math.round(assistFraction * toShare);
if (addedPoints <= 0) {
continue;
}
if (config.assistsLimit > 0) {
if (assists >= config.assistsLimit) {
continue;
}
assists++;
}
givenPoints += addedPoints;
String assistEntry = StringUtils.replace(messages.rankAssistEntry, "{PLAYER}", assist.getKey().getName());
assistEntry = StringUtils.replace(assistEntry, "{+}", Integer.toString(addedPoints));
assistEntry = StringUtils.replace(assistEntry, "{SHARE}", StringUtils.getPercent(assistFraction));
assistEntries.add(assistEntry);
assist.getKey().getRank().addPoints(addedPoints);
}
double attackerPoints = attackerEvent.getChange() - toShare + (givenPoints < toShare ? toShare - givenPoints : 0);
attackerEvent.setChange((int) Math.round(attackerPoints));
}
attacker.getRank().addKill();
attacker.getRank().addPoints(attackerEvent.getChange());
attacker.setLastVictim(victim);
victim.getRank().removePoints(victimEvent.getChange());
victim.setLastAttacker(attacker);
victim.clearDamage();
}
ConcurrencyManager concurrencyManager = FunnyGuilds.getInstance().getConcurrencyManager();
ConcurrencyTaskBuilder taskBuilder = ConcurrencyTask.builder();
if (config.dataType.mysql) {
if (victim.hasGuild()) {
// IndependentThread.actions(ActionType.MYSQL_UPDATE_GUILD_POINTS, victim.getGuild());
taskBuilder.delegate(new DatabaseUpdateGuildPointsRequest(victim.getGuild()));
}
if (attacker.hasGuild()) {
// IndependentThread.actions(ActionType.MYSQL_UPDATE_GUILD_POINTS, attacker.getGuild());
taskBuilder.delegate(new DatabaseUpdateGuildPointsRequest(attacker.getGuild()));
}
// IndependentThread.actions(ActionType.MYSQL_UPDATE_USER_POINTS, victim);
// IndependentThread.actions(ActionType.MYSQL_UPDATE_USER_POINTS, attacker);
taskBuilder.delegate(new DatabaseUpdateUserPointsRequest(victim));
taskBuilder.delegate(new DatabaseUpdateUserPointsRequest(attacker));
}
/*
IndependentThread.actions(ActionType.DUMMY_GLOBAL_UPDATE_USER, victim);
IndependentThread.actions(ActionType.DUMMY_GLOBAL_UPDATE_USER, attacker);
IndependentThread.actions(ActionType.RANK_UPDATE_USER, victim);
IndependentThread.action(ActionType.RANK_UPDATE_USER, attacker);
*/
ConcurrencyTask task = taskBuilder.delegate(new DummyGlobalUpdateUserRequest(victim)).delegate(new DummyGlobalUpdateUserRequest(attacker)).delegate(new RankUpdateUserRequest(victim)).delegate(new RankUpdateUserRequest(attacker)).build();
concurrencyManager.postTask(task);
String deathMessage = messages.rankDeathMessage;
deathMessage = StringUtils.replace(deathMessage, "{ATTACKER}", attacker.getName());
deathMessage = StringUtils.replace(deathMessage, "{VICTIM}", victim.getName());
deathMessage = StringUtils.replace(deathMessage, "{+}", Integer.toString(attackerEvent.getChange()));
deathMessage = StringUtils.replace(deathMessage, "{-}", Integer.toString(victimEvent.getChange()));
deathMessage = StringUtils.replace(deathMessage, "{POINTS-FORMAT}", IntegerRange.inRange(vP, config.pointsFormat));
deathMessage = StringUtils.replace(deathMessage, "{POINTS}", String.valueOf(victim.getRank().getPoints()));
deathMessage = StringUtils.replace(deathMessage, "{WEAPON}", MaterialUtil.getMaterialName(a.getItemInHand().getType()));
deathMessage = StringUtils.replace(deathMessage, "{REMAINING-HEALTH}", Double.toString(a.getHealth()));
deathMessage = StringUtils.replace(deathMessage, "{REMAINING-HEARTS}", Double.toString(a.getHealth() / 2));
if (victim.hasGuild()) {
deathMessage = StringUtils.replace(deathMessage, "{VTAG}", StringUtils.replace(config.chatGuild, "{TAG}", victim.getGuild().getTag()));
}
if (attacker.hasGuild()) {
deathMessage = StringUtils.replace(deathMessage, "{ATAG}", StringUtils.replace(config.chatGuild, "{TAG}", attacker.getGuild().getTag()));
}
deathMessage = StringUtils.replace(deathMessage, "{VTAG}", "");
deathMessage = StringUtils.replace(deathMessage, "{ATAG}", "");
event.setDeathMessage(deathMessage);
}
use of net.dzikoysk.funnyguilds.concurrency.ConcurrencyManager in project FunnyGuilds by FunnyGuilds.
the class ExcCreate method execute.
@SuppressWarnings("deprecation")
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
PluginConfig config = Settings.getConfig();
Player player = (Player) sender;
User user = User.get(player);
if (!config.guildsEnabled) {
player.sendMessage(messages.adminGuildsDisabled);
return;
}
boolean isBlockedWorld = this.checkWorld(player);
if (isBlockedWorld) {
player.sendMessage(messages.blockedWorld);
return;
}
if (user.hasGuild()) {
player.sendMessage(messages.generalHasGuild);
return;
}
if (args.length != 2) {
switch(args.length) {
case 0:
player.sendMessage(messages.generalNoTagGiven);
return;
case 1:
player.sendMessage(messages.generalNoNameGiven);
return;
default:
player.sendMessage(messages.createMore);
return;
}
}
String tag = args[0];
if (!config.guildTagKeepCase) {
tag = config.guildTagUppercase ? tag.toUpperCase() : tag.toLowerCase();
}
String name = args[1];
if (tag.length() > config.createTagLength) {
player.sendMessage(messages.createTagLength.replace("{LENGTH}", Integer.toString(config.createTagLength)));
return;
}
if (tag.length() < config.createTagMinLength) {
player.sendMessage(messages.createTagMinLength.replace("{LENGTH}", Integer.toString(config.createTagMinLength)));
return;
}
if (name.length() > config.createNameLength) {
player.sendMessage(messages.createNameLength.replace("{LENGTH}", Integer.toString(config.createNameLength)));
return;
}
if (name.length() < config.createNameMinLength) {
player.sendMessage(messages.createNameMinLength.replace("{LENGTH}", Integer.toString(config.createNameMinLength)));
return;
}
if (!tag.matches(config.tagRegex.getPattern())) {
player.sendMessage(messages.createOLTag);
return;
}
if (!name.matches(config.nameRegex.getPattern())) {
player.sendMessage(messages.createOLName);
return;
}
if (GuildUtils.nameExists(name)) {
player.sendMessage(messages.createNameExists);
return;
}
if (GuildUtils.tagExists(tag)) {
player.sendMessage(messages.createTagExists);
return;
}
if (config.checkForRestrictedGuildNames) {
if (!GuildUtils.isNameValid(name)) {
player.sendMessage(messages.restrictedGuildName);
return;
} else if (!GuildUtils.isTagValid(tag)) {
player.sendMessage(messages.restrictedGuildTag);
return;
}
}
Location guildLocation = player.getLocation().getBlock().getLocation();
if (config.regionsEnabled) {
if (config.createCenterY != 0) {
guildLocation.setY(config.createCenterY);
}
int d = config.regionSize + config.createDistance;
if (config.enlargeItems != null) {
d += config.enlargeItems.size() * config.enlargeSize;
}
if (d > player.getWorld().getSpawnLocation().distance(guildLocation)) {
player.sendMessage(messages.createSpawn.replace("{DISTANCE}", Integer.toString(d)));
return;
}
}
if (config.rankCreateEnable) {
int requiredRank = player.hasPermission("funnyguilds.vip.rank") ? config.rankCreateVip : config.rankCreate;
int points = user.getRank().getPoints();
if (points < requiredRank) {
String msg = messages.createRank;
msg = StringUtils.replace(msg, "{REQUIRED-FORMAT}", IntegerRange.inRange(requiredRank, config.pointsFormat).replace("{POINTS}", "{REQUIRED}"));
msg = StringUtils.replace(msg, "{REQUIRED}", String.valueOf(requiredRank));
msg = StringUtils.replace(msg, "{POINTS-FORMAT}", IntegerRange.inRange(points, config.pointsFormat));
msg = StringUtils.replace(msg, "{POINTS}", String.valueOf(points));
player.sendMessage(msg);
return;
}
}
List<ItemStack> requiredItems = player.hasPermission("funnyguilds.vip.items") ? config.createItemsVip : config.createItems;
int requiredExperience = player.hasPermission("funnyguilds.vip.items") ? config.requiredExperienceVip : config.requiredExperience;
double requiredMoney = player.hasPermission("funnyguilds.vip.items") ? config.requiredMoneyVip : config.requiredMoney;
if (!user.getBypass()) {
if (player.getTotalExperience() < requiredExperience) {
String msg = messages.createExperience;
msg = StringUtils.replace(msg, "{EXP}", String.valueOf(requiredExperience));
player.sendMessage(msg);
return;
}
if (VaultHook.isHooked() && !VaultHook.canAfford(player, requiredMoney)) {
String notEnoughMoneyMessage = messages.createMoney;
notEnoughMoneyMessage = StringUtils.replace(notEnoughMoneyMessage, "{MONEY}", Double.toString(requiredMoney));
player.sendMessage(notEnoughMoneyMessage);
return;
}
for (ItemStack requiredItem : requiredItems) {
if (player.getInventory().containsAtLeast(requiredItem, requiredItem.getAmount())) {
continue;
}
String msg = ItemUtils.translatePlaceholder(messages.createItems, requiredItems, requiredItem);
player.sendMessage(msg);
return;
}
}
if (config.regionsEnabled) {
if (RegionUtils.isIn(guildLocation)) {
player.sendMessage(messages.createIsNear);
return;
}
if (RegionUtils.isNear(guildLocation)) {
player.sendMessage(messages.createIsNear);
return;
}
if (config.createMinDistanceFromBorder != -1) {
WorldBorder border = player.getWorld().getWorldBorder();
double borderSize = border.getSize() / 2;
double borderX = border.getCenter().getX() + borderSize;
double borderZ = border.getCenter().getZ() + borderSize;
double distanceX = Math.abs(borderX) - Math.abs(player.getLocation().getX());
double distanceZ = Math.abs(borderZ) - Math.abs(player.getLocation().getZ());
if ((distanceX < config.createMinDistanceFromBorder) || (distanceZ < config.createMinDistanceFromBorder)) {
String notEnoughDistanceMessage = messages.createNotEnoughDistanceFromBorder;
notEnoughDistanceMessage = StringUtils.replace(notEnoughDistanceMessage, "{BORDER-MIN-DISTANCE}", Double.toString(config.createMinDistanceFromBorder));
player.sendMessage(notEnoughDistanceMessage);
return;
}
}
}
if (!SimpleEventHandler.handle(new GuildCreateEvent(EventCause.USER, user, name, tag, guildLocation))) {
return;
}
if (user.getBypass()) {
user.setBypass(false);
} else {
player.getInventory().removeItem(ItemUtils.toArray(requiredItems));
player.setTotalExperience(player.getTotalExperience() - requiredExperience);
if (VaultHook.isHooked()) {
VaultHook.withdrawFromPlayerBank(player, requiredMoney);
}
}
Manager.getInstance().stop();
Guild guild = new Guild(name);
guild.setTag(tag);
guild.setOwner(user);
guild.setLives(config.warLives);
guild.setBorn(System.currentTimeMillis());
guild.setValidity(System.currentTimeMillis() + config.validityStart);
guild.setAttacked(System.currentTimeMillis() - config.warWait + config.warProtection);
guild.setPvP(config.damageGuild);
user.setGuild(guild);
if (config.regionsEnabled) {
Region region = new Region(guild, guildLocation, config.regionSize);
guild.setRegion(region.getName());
guild.addRegion(region.getName());
if (config.pasteSchematicOnCreation) {
if (!SchematicHelper.pasteSchematic(config.guildSchematicFile, guildLocation, config.pasteSchematicWithAir)) {
player.sendMessage(messages.createGuildCouldNotPasteSchematic);
}
} else if (config.createCenterSphere) {
for (Location l : SpaceUtils.sphere(guildLocation, 4, 4, false, true, 0)) {
if (l.getBlock().getType() != Material.BEDROCK) {
l.getBlock().setType(Material.AIR);
}
}
for (Location l : SpaceUtils.sphere(guildLocation, 4, 4, true, true, 0)) {
if (l.getBlock().getType() != Material.BEDROCK) {
l.getBlock().setType(Material.OBSIDIAN);
}
}
}
if (config.createMaterialData != null && config.createMaterialData.getItemType() != Material.AIR) {
Block heart = guildLocation.getBlock().getRelative(BlockFace.DOWN);
heart.setType(config.createMaterialData.getItemType());
heart.setData(config.createMaterialData.getData());
} else if (config.createEntityType != null) {
EntityUtil.spawn(guild);
}
player.teleport(guildLocation);
}
Manager.getInstance().start();
/*
IndependentThread.actions(ActionType.RANK_UPDATE_GUILD, guild);
IndependentThread.actions(ActionType.PREFIX_GLOBAL_ADD_GUILD, guild);
IndependentThread.action(ActionType.PREFIX_GLOBAL_ADD_PLAYER, user.getName());
*/
ConcurrencyManager concurrencyManager = FunnyGuilds.getInstance().getConcurrencyManager();
concurrencyManager.postRequests(new RankUpdateGuildRequest(guild), new PrefixGlobalAddGuildRequest(guild), new PrefixGlobalAddPlayerRequest(user.getName()));
MessageTranslator translator = new MessageTranslator().register("{GUILD}", name).register("{TAG}", tag).register("{PLAYER}", player.getName());
player.sendMessage(translator.translate(messages.createGuild));
Bukkit.broadcastMessage(translator.translate(messages.broadcastCreate));
}
use of net.dzikoysk.funnyguilds.concurrency.ConcurrencyManager in project FunnyGuilds by FunnyGuilds.
the class ExcAlly method execute.
@Override
public void execute(CommandSender sender, String[] args) {
MessagesConfig messages = Messages.getInstance();
Player player = (Player) sender;
User user = User.get(player);
if (!user.hasGuild()) {
player.sendMessage(messages.generalHasNoGuild);
return;
}
if (!user.isOwner()) {
player.sendMessage(messages.generalIsNotOwner);
return;
}
Guild guild = user.getGuild();
List<InvitationList.Invitation> invitations = InvitationList.getInvitationsFor(guild);
if (args.length < 1) {
if (invitations.size() == 0) {
player.sendMessage(messages.allyHasNotInvitation);
return;
}
List<String> list = messages.allyInvitationList;
String guildNames = StringUtils.toString(InvitationList.getInvitationGuildNames(guild), false);
for (String msg : list) {
player.sendMessage(msg.replace("{GUILDS}", guildNames));
}
return;
}
String tag = args[0];
if (!GuildUtils.tagExists(tag)) {
player.sendMessage(StringUtils.replace(messages.generalGuildNotExists, "{TAG}", tag));
return;
}
Guild invitedGuild = GuildUtils.getByTag(tag);
if (guild.equals(invitedGuild)) {
player.sendMessage(messages.allySame);
return;
}
if (guild.getAllies().contains(invitedGuild)) {
player.sendMessage(messages.allyAlly);
return;
}
if (InvitationList.hasInvitationFrom(guild, invitedGuild)) {
if (!SimpleEventHandler.handle(new GuildAcceptAllyInvitationEvent(EventCause.USER, user, guild, invitedGuild))) {
return;
}
InvitationList.expireInvitation(invitedGuild, guild);
guild.addAlly(invitedGuild);
invitedGuild.addAlly(guild);
String allyDoneMessage = messages.allyDone;
allyDoneMessage = StringUtils.replace(allyDoneMessage, "{GUILD}", invitedGuild.getName());
allyDoneMessage = StringUtils.replace(allyDoneMessage, "{TAG}", invitedGuild.getTag());
player.sendMessage(allyDoneMessage);
Player owner = invitedGuild.getOwner().getPlayer();
if (owner != null) {
String allyIDoneMessage = messages.allyIDone;
allyIDoneMessage = StringUtils.replace(allyIDoneMessage, "{GUILD}", guild.getName());
allyIDoneMessage = StringUtils.replace(allyIDoneMessage, "{TAG}", guild.getTag());
owner.sendMessage(allyIDoneMessage);
}
ConcurrencyManager concurrencyManager = FunnyGuilds.getInstance().getConcurrencyManager();
ConcurrencyTaskBuilder taskBuilder = ConcurrencyTask.builder();
for (User member : guild.getMembers()) {
// IndependentThread.action(ActionType.PREFIX_UPDATE_GUILD, member, invitedGuild);
taskBuilder.delegate(new PrefixUpdateGuildRequest(member, invitedGuild));
}
for (User member : invitedGuild.getMembers()) {
// IndependentThread.action(ActionType.PREFIX_UPDATE_GUILD, member, guild);
taskBuilder.delegate(new PrefixUpdateGuildRequest(member, guild));
}
ConcurrencyTask task = taskBuilder.build();
concurrencyManager.postTask(task);
return;
}
if (InvitationList.hasInvitationFrom(invitedGuild, guild)) {
if (!SimpleEventHandler.handle(new GuildRevokeAllyInvitationEvent(EventCause.USER, user, guild, invitedGuild))) {
return;
}
InvitationList.expireInvitation(guild, invitedGuild);
String allyReturnMessage = messages.allyReturn;
allyReturnMessage = StringUtils.replace(allyReturnMessage, "{GUILD}", invitedGuild.getName());
allyReturnMessage = StringUtils.replace(allyReturnMessage, "{TAG}", invitedGuild.getTag());
player.sendMessage(allyReturnMessage);
Player owner = invitedGuild.getOwner().getPlayer();
if (owner != null) {
String allyIReturnMessage = messages.allyIReturn;
allyIReturnMessage = StringUtils.replace(allyIReturnMessage, "{GUILD}", guild.getName());
allyIReturnMessage = StringUtils.replace(allyIReturnMessage, "{TAG}", guild.getTag());
owner.sendMessage(allyIReturnMessage);
}
return;
}
if (!SimpleEventHandler.handle(new GuildSendAllyInvitationEvent(EventCause.USER, user, guild, invitedGuild))) {
return;
}
InvitationList.createInvitation(guild, invitedGuild);
String allyInviteDoneMessage = messages.allyInviteDone;
allyInviteDoneMessage = StringUtils.replace(allyInviteDoneMessage, "{GUILD}", invitedGuild.getName());
allyInviteDoneMessage = StringUtils.replace(allyInviteDoneMessage, "{TAG}", invitedGuild.getTag());
player.sendMessage(allyInviteDoneMessage);
Player owner = invitedGuild.getOwner().getPlayer();
if (owner != null) {
String allyToInvitedMessage = messages.allyToInvited;
allyToInvitedMessage = StringUtils.replace(allyToInvitedMessage, "{GUILD}", guild.getName());
allyToInvitedMessage = StringUtils.replace(allyToInvitedMessage, "{TAG}", guild.getTag());
owner.sendMessage(allyToInvitedMessage);
}
}
Aggregations