Multiple Messages From Disband Fixed
This commit is contained in:
parent
efae187e1a
commit
66ad927b2f
@ -12,6 +12,7 @@ import com.massivecraft.factions.cmd.check.CheckTask;
|
|||||||
import com.massivecraft.factions.cmd.check.WeeWooTask;
|
import com.massivecraft.factions.cmd.check.WeeWooTask;
|
||||||
import com.massivecraft.factions.cmd.chest.AntiChestListener;
|
import com.massivecraft.factions.cmd.chest.AntiChestListener;
|
||||||
import com.massivecraft.factions.cmd.reserve.ListParameterizedType;
|
import com.massivecraft.factions.cmd.reserve.ListParameterizedType;
|
||||||
|
import com.massivecraft.factions.cmd.reserve.ReserveAdapter;
|
||||||
import com.massivecraft.factions.cmd.reserve.ReserveObject;
|
import com.massivecraft.factions.cmd.reserve.ReserveObject;
|
||||||
import com.massivecraft.factions.discord.Discord;
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.discord.DiscordListener;
|
import com.massivecraft.factions.discord.DiscordListener;
|
||||||
@ -418,6 +419,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
.registerTypeAdapter(LazyLocation.class, new MyLocationTypeAdapter())
|
.registerTypeAdapter(LazyLocation.class, new MyLocationTypeAdapter())
|
||||||
.registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter())
|
.registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter())
|
||||||
.registerTypeAdapter(Inventory.class, new InventoryTypeAdapter())
|
.registerTypeAdapter(Inventory.class, new InventoryTypeAdapter())
|
||||||
|
.registerTypeAdapter(ReserveObject.class, new ReserveAdapter())
|
||||||
.registerTypeAdapter(Location.class, new LocationTypeAdapter())
|
.registerTypeAdapter(Location.class, new LocationTypeAdapter())
|
||||||
.registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY);
|
.registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.cmd.reserve.ReserveObject;
|
||||||
import com.massivecraft.factions.discord.Discord;
|
import com.massivecraft.factions.discord.Discord;
|
||||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.event.FactionCreateEvent;
|
import com.massivecraft.factions.event.FactionCreateEvent;
|
||||||
@ -52,6 +53,12 @@ public class CmdCreate extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReserveObject factionReserve = FactionsPlugin.getInstance().getFactionReserves().stream().filter(factionReserve1 -> factionReserve1.getFactionName().equalsIgnoreCase(tag)).findFirst().orElse(null);
|
||||||
|
if (factionReserve != null && !factionReserve.getName().equalsIgnoreCase(context.player.getName())) {
|
||||||
|
context.msg(TL.COMMAND_CREATE_ALREADY_RESERVED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<String> tagValidationErrors = MiscUtil.validateTag(tag);
|
ArrayList<String> tagValidationErrors = MiscUtil.validateTag(tag);
|
||||||
if (tagValidationErrors.size() > 0) {
|
if (tagValidationErrors.size() > 0) {
|
||||||
context.sendMessage(tagValidationErrors);
|
context.sendMessage(tagValidationErrors);
|
||||||
@ -85,7 +92,9 @@ public class CmdCreate extends FCommand {
|
|||||||
|
|
||||||
// finish setting up the Faction
|
// finish setting up the Faction
|
||||||
faction.setTag(tag);
|
faction.setTag(tag);
|
||||||
|
if (factionReserve != null) {
|
||||||
|
FactionsPlugin.getInstance().getFactionReserves().remove(factionReserve);
|
||||||
|
}
|
||||||
// trigger the faction join event for the creator
|
// trigger the faction join event for the creator
|
||||||
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||||
|
@ -21,8 +21,6 @@ public class CmdDisband extends FCommand {
|
|||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//TODO: Add Disband Confirmation GUI
|
|
||||||
|
|
||||||
private static HashMap<String, String> disbandMap = new HashMap<>();
|
private static HashMap<String, String> disbandMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@ -105,8 +103,11 @@ public class CmdDisband extends FCommand {
|
|||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")){
|
||||||
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
context.fPlayer.setFFlying(false, false);
|
context.fPlayer.setFFlying(false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,7 @@ public class ReserveAdapter implements JsonSerializer<ReserveObject>, JsonDeseri
|
|||||||
|
|
||||||
public ReserveObject deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
public ReserveObject deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||||
JsonObject object = jsonElement.getAsJsonObject();
|
JsonObject object = jsonElement.getAsJsonObject();
|
||||||
ReserveObject faction = new ReserveObject(object.get("username").getAsString(), object.get("name").getAsString());
|
return new ReserveObject(object.get("username").getAsString(), object.get("name").getAsString());
|
||||||
return faction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonElement serialize(ReserveObject data, final Type type, final JsonSerializationContext jsonSerializationContext) {
|
public JsonElement serialize(ReserveObject data, final Type type, final JsonSerializationContext jsonSerializationContext) {
|
||||||
|
@ -966,8 +966,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
if (!damage) {
|
if (!damage) {
|
||||||
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
||||||
if (!fly)
|
if (!fly) sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
||||||
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
|
||||||
} else {
|
} else {
|
||||||
msg(TL.COMMAND_FLY_DAMAGE);
|
msg(TL.COMMAND_FLY_DAMAGE);
|
||||||
}
|
}
|
||||||
|
@ -296,6 +296,7 @@ public enum TL {
|
|||||||
COMMAND_CHECKPOINT_CLAIMED("&c&l[!]&7 Your current &cfaction checkpoint&7 is claimed, set a &cnew &7one!"),
|
COMMAND_CHECKPOINT_CLAIMED("&c&l[!]&7 Your current &cfaction checkpoint&7 is claimed, set a &cnew &7one!"),
|
||||||
COMMAND_CHECKPOINT_DESCRIPTION("Set or go to your faction checkpoint!"),
|
COMMAND_CHECKPOINT_DESCRIPTION("Set or go to your faction checkpoint!"),
|
||||||
|
|
||||||
|
COMMAND_CREATE_ALREADY_RESERVED("&c&l[!] &7This faction tag has already been reserved!"),
|
||||||
COMMAND_CREATE_MUSTLEAVE("&c&l[!]&7 You must &cleave &7your &ccurrent faction &7first."),
|
COMMAND_CREATE_MUSTLEAVE("&c&l[!]&7 You must &cleave &7your &ccurrent faction &7first."),
|
||||||
COMMAND_CREATE_INUSE("&c&l[!]&7 That tag is &calready &7in use."),
|
COMMAND_CREATE_INUSE("&c&l[!]&7 That tag is &calready &7in use."),
|
||||||
COMMAND_CREATE_TOCREATE("to create a new faction"),
|
COMMAND_CREATE_TOCREATE("to create a new faction"),
|
||||||
|
Loading…
Reference in New Issue
Block a user