mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 16:05:00 +00:00
transfer ranks on rename
This commit is contained in:
parent
99618d7241
commit
a4d359f3d2
3 changed files with 14 additions and 1 deletions
|
@ -74,6 +74,7 @@ public class RenameSubcommand extends Common implements CommandExecutor
|
||||||
guild.disband();
|
guild.disband();
|
||||||
guild.setIdentifier(GUtil.flatten(newName));
|
guild.setIdentifier(GUtil.flatten(newName));
|
||||||
guild.setName(newName);
|
guild.setName(newName);
|
||||||
|
guild.updateRankIdentifiers();
|
||||||
sender.sendMessage(tl(PREFIX + "Set %s%" + GUtil.colorize(newName) + "%p% as the new name of your guild%p%."));
|
sender.sendMessage(tl(PREFIX + "Set %s%" + GUtil.colorize(newName) + "%p% as the new name of your guild%p%."));
|
||||||
guild.broadcast(tl("%p%Your guild has been renamed to " + GUtil.colorize(newName) + "%p%."));
|
guild.broadcast(tl("%p%Your guild has been renamed to " + GUtil.colorize(newName) + "%p%."));
|
||||||
guild.save();
|
guild.save();
|
||||||
|
|
|
@ -282,6 +282,17 @@ public class Guild
|
||||||
plugin.guilds.save();
|
plugin.guilds.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRankIdentifiers()
|
||||||
|
{
|
||||||
|
for (GuildRank rank : ranks)
|
||||||
|
{
|
||||||
|
rank.delete();
|
||||||
|
rank.setIguild(identifier);
|
||||||
|
rank.set();
|
||||||
|
plugin.guilds.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Guild createGuild(String identifier, String name, Player owner)
|
public static Guild createGuild(String identifier, String name, Player owner)
|
||||||
{
|
{
|
||||||
if (plugin.guilds.contains(identifier))
|
if (plugin.guilds.contains(identifier))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package me.totalfreedom.tfguilds.guild;
|
package me.totalfreedom.tfguilds.guild;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.totalfreedom.tfguilds.TFGuilds;
|
import me.totalfreedom.tfguilds.TFGuilds;
|
||||||
import me.totalfreedom.tfguilds.util.GLog;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ public class GuildRank
|
||||||
private static TFGuilds plugin = TFGuilds.getPlugin();
|
private static TFGuilds plugin = TFGuilds.getPlugin();
|
||||||
|
|
||||||
// owning guild's identifier
|
// owning guild's identifier
|
||||||
|
@Setter
|
||||||
private String iguild;
|
private String iguild;
|
||||||
|
|
||||||
// identifier
|
// identifier
|
||||||
|
|
Loading…
Reference in a new issue