Add reset zone and restore defaults settings to UI

https://imgur.com/a/ZViyX
This commit is contained in:
Connor Monahan 2017-07-29 00:35:21 -05:00
parent f6b41bd015
commit 4f00befeb2
15 changed files with 209 additions and 142 deletions

View File

@ -1,15 +1,14 @@
package com.tommytony.war.command;
import java.util.logging.Level;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.mapper.WarYmlMapper;
import com.tommytony.war.mapper.WarzoneYmlMapper;
import com.tommytony.war.structure.ZoneLobby;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.logging.Level;
/**
* Deletes a warzone.
@ -21,6 +20,22 @@ public class DeleteZoneCommand extends AbstractZoneMakerCommand {
super(handler, sender, args);
}
public static void forceDeleteZone(Warzone zone, CommandSender sender) {
War.war.getWarzones().remove(zone);
WarYmlMapper.save();
WarzoneYmlMapper.delete(zone);
if (War.war.getWarHub() != null) { // warhub has to change
War.war.getWarHub().getVolume().resetBlocks();
War.war.getWarHub().initialize();
}
String msg = "Warzone " + zone.getName() + " removed by " + sender.getName() + ".";
War.war.log(msg, Level.INFO);
War.war.msg(sender, msg);
}
@Override
public boolean handle() {
Warzone zone;
@ -49,19 +64,7 @@ public class DeleteZoneCommand extends AbstractZoneMakerCommand {
return true;
}
War.war.getWarzones().remove(zone);
WarYmlMapper.save();
WarzoneYmlMapper.delete(zone);
if (War.war.getWarHub() != null) { // warhub has to change
War.war.getWarHub().getVolume().resetBlocks();
War.war.getWarHub().initialize();
}
String msg = "Warzone " + zone.getName() + " removed by " + this.getSender().getName() + ".";
War.war.log(msg, Level.INFO);
this.msg(msg);
forceDeleteZone(zone, getSender());
return true;
}

View File

@ -1,17 +1,16 @@
package com.tommytony.war.command;
import java.util.Iterator;
import java.util.logging.Level;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.tommytony.war.Team;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.Warzone.LeaveCause;
import com.tommytony.war.job.PartialZoneResetJob;
import com.tommytony.war.structure.ZoneLobby;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Iterator;
import java.util.logging.Level;
public class ResetZoneCommand extends AbstractZoneMakerCommand {
@ -19,6 +18,31 @@ public class ResetZoneCommand extends AbstractZoneMakerCommand {
super(handler, sender, args);
}
public static void forceResetZone(Warzone zone, CommandSender sender) {
zone.clearThieves();
for (Team team : zone.getTeams()) {
team.teamcast("The war has ended. " + zone.getTeamInformation() + " Resetting warzone " + zone.getName() + " and teams...");
for (Iterator<Player> it = team.getPlayers().iterator(); it.hasNext(); ) {
Player p = it.next();
it.remove();
team.removePlayer(p);
if (!zone.getReallyDeadFighters().contains(p.getName())) {
p.teleport(zone.getEndTeleport(LeaveCause.RESET));
}
}
team.resetPoints();
team.getPlayers().clear();
}
War.war.msg(sender, "Reloading warzone " + zone.getName() + ".");
PartialZoneResetJob.setSenderToNotify(zone, sender);
zone.reinitialize();
War.war.log(sender.getName() + " reset warzone " + zone.getName(), Level.INFO);
}
@Override
public boolean handle() {
Warzone zone;
@ -39,35 +63,14 @@ public class ResetZoneCommand extends AbstractZoneMakerCommand {
} else {
return false;
}
if (zone == null) {
return false;
} else if (!this.isSenderAuthorOfZone(zone)) {
return true;
}
zone.clearThieves();
for (Team team : zone.getTeams()) {
team.teamcast("The war has ended. " + zone.getTeamInformation() + " Resetting warzone " + zone.getName() + " and teams...");
for (Iterator<Player> it = team.getPlayers().iterator(); it.hasNext();) {
Player p = it.next();
it.remove();
team.removePlayer(p);
if (!zone.getReallyDeadFighters().contains(p.getName())) {
p.teleport(zone.getEndTeleport(LeaveCause.RESET));
}
}
team.resetPoints();
team.getPlayers().clear();
}
this.msg("Reloading warzone " + zone.getName() + ".");
PartialZoneResetJob.setSenderToNotify(zone, this.getSender());
zone.reinitialize();
War.war.log(this.getSender().getName() + " reset warzone " + zone.getName(), Level.INFO);
forceResetZone(zone, this.getSender());
return true;
}

View File

@ -1,14 +1,13 @@
package com.tommytony.war.command;
import java.util.logging.Level;
import com.tommytony.war.War;
import com.tommytony.war.ui.WarUI;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import com.tommytony.war.War;
import org.bukkit.entity.Player;
import java.util.logging.Level;
/**
* Handles commands received by War
@ -47,10 +46,10 @@ public class WarCommandHandler {
return true;
}
} else if (command.equals("war") || command.equals("War")) {
// show /war help
War.war.msg(sender, cmd.getUsage());
if (sender instanceof Player) {
War.war.getUIManager().assignUI((Player) sender, new WarUI());
} else {
War.war.badMsg(sender, "Use /war help for information.");
}
return true;
} else {

View File

@ -1,17 +1,15 @@
package com.tommytony.war.config;
import java.util.EnumMap;
import java.util.Map;
import java.util.logging.Level;
import com.tommytony.war.Team;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.mapper.WarzoneYmlMapper;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import java.util.EnumMap;
import java.util.Map;
import java.util.logging.Level;
public class TeamConfigBag {
@ -25,15 +23,43 @@ public class TeamConfigBag {
public TeamConfigBag() {
this.warzone = null;
}
public static void afterUpdate(Team team, CommandSender sender, String namedParamReturn, boolean wantsToPrint) {
final Warzone zone = team.getZone();
WarzoneYmlMapper.save(zone);
String zoneReset = "Some changes may require a /resetzone. ";
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONCONFIGCHANGE)) {
zone.reinitialize(); // bring back team spawns etc
zoneReset = "Zone reset. ";
}
if (wantsToPrint) {
War.war.msg(sender, "Team config saved. " + zoneReset + namedParamReturn + " " + War.war.printConfig(team));
} else {
War.war.msg(sender, "Team config saved. " + zoneReset + namedParamReturn);
}
War.war.log(sender.getName() + " updated team " + team.getName() + " configuration in warzone " + zone.getName() + "." + namedParamReturn, Level.INFO);
if (War.war.getWarHub() != null) { // maybe the zone was disabled/enabled
War.war.getWarHub().getVolume().resetBlocks();
War.war.getWarHub().initialize();
}
}
public boolean contains(TeamConfig config) {
return this.bag.containsKey(config);
}
public void reset() {
this.bag.clear();
}
public boolean isEmpty() {
return this.bag.keySet().size() == 0;
}
public void put(TeamConfig config, Object value) {
this.bag.put(config, value);
}
@ -48,7 +74,7 @@ public class TeamConfigBag {
public Object resolveValue(TeamConfig config) {
if (this.contains(config)) {
return this.bag.get(config);
return this.bag.get(config);
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
// use Warzone default config
return this.warzone.getTeamDefaultConfig().resolveValue(config);
@ -57,7 +83,7 @@ public class TeamConfigBag {
return War.war.getTeamDefaultConfig().resolveValue(config);
}
}
public Double getDouble(TeamConfig config) {
if (this.contains(config)) {
return (Double)this.bag.get(config);
@ -86,7 +112,7 @@ public class TeamConfigBag {
public Integer resolveInt(TeamConfig config) {
if (this.contains(config)) {
return (Integer)this.bag.get(config);
return (Integer) this.bag.get(config);
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
// use Warzone default config
return this.warzone.getTeamDefaultConfig().resolveInt(config);
@ -105,7 +131,7 @@ public class TeamConfigBag {
public Boolean resolveBoolean(TeamConfig config) {
if (this.contains(config)) {
return (Boolean)this.bag.get(config);
return (Boolean) this.bag.get(config);
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
// use Warzone default config
return this.warzone.getTeamDefaultConfig().resolveBoolean(config);
@ -124,7 +150,7 @@ public class TeamConfigBag {
public String resolveString(TeamConfig config) {
if (this.contains(config)) {
return (String)this.bag.get(config);
return (String) this.bag.get(config);
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(config)){
// use Warzone default config
return this.warzone.getTeamDefaultConfig().resolveString(config);
@ -136,7 +162,7 @@ public class TeamConfigBag {
public FlagReturn resolveFlagReturn() {
if (this.contains(TeamConfig.FLAGRETURN)) {
return (FlagReturn)this.bag.get(TeamConfig.FLAGRETURN);
return (FlagReturn) this.bag.get(TeamConfig.FLAGRETURN);
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(TeamConfig.FLAGRETURN)){
// use Warzone default config
return this.warzone.getTeamDefaultConfig().resolveFlagReturn();
@ -148,14 +174,14 @@ public class TeamConfigBag {
public FlagReturn getFlagReturn() {
if (this.contains(TeamConfig.FLAGRETURN)) {
return (FlagReturn)this.bag.get(TeamConfig.FLAGRETURN);
return (FlagReturn) this.bag.get(TeamConfig.FLAGRETURN);
}
return null;
}
public TeamSpawnStyle resolveSpawnStyle() {
if (this.contains(TeamConfig.SPAWNSTYLE)) {
return (TeamSpawnStyle)this.bag.get(TeamConfig.SPAWNSTYLE);
return (TeamSpawnStyle) this.bag.get(TeamConfig.SPAWNSTYLE);
} else if (this.warzone != null && this.warzone.getTeamDefaultConfig().contains(TeamConfig.SPAWNSTYLE)){
// use War default config
return this.warzone.getTeamDefaultConfig().resolveSpawnStyle();
@ -166,11 +192,11 @@ public class TeamConfigBag {
public TeamSpawnStyle getSpawnStyle() {
if (this.contains(TeamConfig.SPAWNSTYLE)) {
return (TeamSpawnStyle)this.bag.get(TeamConfig.SPAWNSTYLE);
return (TeamSpawnStyle) this.bag.get(TeamConfig.SPAWNSTYLE);
}
return null;
}
public void loadFrom(ConfigurationSection teamConfigSection) {
for (TeamConfig config : TeamConfig.values()) {
if (teamConfigSection.contains(config.toString())) {
@ -194,7 +220,7 @@ public class TeamConfigBag {
if (style != null) {
this.put(config, style);
}
}
}
}
}
}
@ -202,7 +228,7 @@ public class TeamConfigBag {
public void saveTo(ConfigurationSection teamConfigSection) {
for (TeamConfig config : TeamConfig.values()) {
if (this.contains(config)) {
if (config.getConfigType().equals(Integer.class)
if (config.getConfigType().equals(Integer.class)
|| config.getConfigType().equals(Boolean.class)
|| config.getConfigType().equals(Double.class)) {
teamConfigSection.set(config.toString(), this.bag.get(config));
@ -212,7 +238,7 @@ public class TeamConfigBag {
}
}
}
public String updateFromNamedParams(Map<String, String> namedParams) {
String returnMessage = "";
for (String namedParam : namedParams.keySet()) {
@ -237,11 +263,11 @@ public class TeamConfigBag {
TeamSpawnStyle spawnValue = TeamSpawnStyle.getStyleFromString(namedParams.get(namedParam));
this.bag.put(teamConfig, spawnValue);
}
returnMessage += " " + teamConfig.toString() + " set to " + namedParams.get(namedParam);
returnMessage += " " + teamConfig.toString() + " set to " + namedParams.get(namedParam);
} else if (namedParam.equals("delete")) {
String toDelete = namedParams.get(namedParam);
teamConfig = TeamConfig.teamConfigFromString(toDelete);
// param delete (to restore inheritance)
if (teamConfig != null) {
this.bag.remove(teamConfig);
@ -251,28 +277,4 @@ public class TeamConfigBag {
}
return returnMessage;
}
public static void afterUpdate(Team team, CommandSender sender, String namedParamReturn, boolean wantsToPrint) {
final Warzone zone = team.getZone();
WarzoneYmlMapper.save(zone);
String zoneReset = "Some changes may require a /resetzone. ";
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.RESETONCONFIGCHANGE)) {
zone.reinitialize(); // bring back team spawns etc
zoneReset = "Zone reset. ";
}
if (wantsToPrint) {
War.war.msg(sender, "Team config saved. " + zoneReset + namedParamReturn + " " + War.war.printConfig(team));
} else {
War.war.msg(sender, "Team config saved. " + zoneReset + namedParamReturn);
}
War.war.log(sender.getName() + " updated team " + team.getName() + " configuration in warzone " + zone.getName() + "." + namedParamReturn, Level.INFO);
if (War.war.getWarHub() != null) { // maybe the zone was disabled/enabled
War.war.getWarHub().getVolume().resetBlocks();
War.war.getWarHub().initialize();
}
}
}

View File

@ -33,7 +33,7 @@ public enum TeamKind {
private final Material material;
private final int potionEffectColor;
private TeamKind(DyeColor blockHeadColor, Material material, ChatColor color, int potionEffectColor) {
TeamKind(DyeColor blockHeadColor, Material material, ChatColor color, int potionEffectColor) {
this.dyeColor = blockHeadColor;
this.material = material;
this.chatColor = color;
@ -50,6 +50,15 @@ public enum TeamKind {
return null;
}
public static TeamKind getTeam(String teamName) {
for (TeamKind team : TeamKind.values()) {
if (team.toString().equalsIgnoreCase(teamName)) {
return team;
}
}
return null;
}
/**
* Get wool block data for the dye color.
*
@ -140,15 +149,6 @@ public enum TeamKind {
return new Wool(this.dyeColor);
}
public static TeamKind getTeam(String teamName) {
for (TeamKind team : TeamKind.values()) {
if (team.toString().equalsIgnoreCase(teamName)) {
return team;
}
}
return null;
}
/**
* Check if a block is this team's color block.
*
@ -191,6 +191,10 @@ public enum TeamKind {
return this.getColor() + this.name().toLowerCase() + ChatColor.WHITE;
}
public String getCapsName() {
return String.valueOf(name().charAt(0)) + name().substring(1).toLowerCase();
}
/**
* Get a colored hat item for the team.
* @return Hat item with the team's color.

View File

@ -96,6 +96,10 @@ public class WarzoneConfigBag {
return this.bag.containsKey(config);
}
public void reset() {
this.bag.clear();
}
public void loadFrom(ConfigurationSection warzoneConfigSection) {
for (WarzoneConfig config : WarzoneConfig.values()) {
if (warzoneConfigSection.contains(config.toString())) {

View File

@ -15,8 +15,6 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.text.MessageFormat;
/**
* Created by Connor on 7/27/2017.
*/
@ -36,7 +34,8 @@ public class EditOrCreateZoneUI extends ChestUI {
player.sendTitle("", ChatColor.RED + "This feature requires WorldEdit.", 10, 20, 10);
return;
}
War.war.getUIManager().getPlayerMessage(player, "Select zone region using WorldEdit and then type a name:", new StringRunnable() {
player.getInventory().addItem(new ItemStack(Material.WOOD_AXE, 1));
War.war.getUIManager().getPlayerMessage(player, "Select region for zone using WorldEdit and then type a name:", new StringRunnable() {
@Override
public void run() {
WorldEditPlugin worldEdit = (WorldEditPlugin) War.war.getServer().getPluginManager().getPlugin("WorldEdit");
@ -59,7 +58,7 @@ public class EditOrCreateZoneUI extends ChestUI {
item = new ItemStack(Material.BOOK_AND_QUILL);
meta = item.getItemMeta();
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + zone.getName());
meta.setLore(ImmutableList.of(ChatColor.DARK_GRAY + "Click to edit"));
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to edit"));
item.setItemMeta(meta);
this.addItem(inv, i++, item, new Runnable() {
@Override

View File

@ -46,9 +46,9 @@ public class EditTeamUI extends ChestUI {
});
item = new ItemStack(Material.TNT, 1);
meta = item.getItemMeta();
meta.setDisplayName("Delete");
meta.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Delete");
item.setItemMeta(meta);
this.addItem(inv, 9*3-1, item, new Runnable() {
this.addItem(inv, getSize() - 1, item, new Runnable() {
@Override
public void run() {
if (team.getFlagVolume() != null) {
@ -67,6 +67,18 @@ public class EditTeamUI extends ChestUI {
War.war.msg(player, "Team " + team.getName() + " removed.");
}
});
item = new ItemStack(Material.SNOW_BALL);
meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "" + ChatColor.BOLD + "Restore Defaults");
item.setItemMeta(meta);
this.addItem(inv, getSize() - 2, item, new Runnable() {
@Override
public void run() {
team.getTeamConfig().reset();
TeamConfigBag.afterUpdate(team, player, "All options set to defaults in team " + team.getName() + " by " + player.getName(), false);
War.war.getUIManager().assignUI(player, new EditTeamUI(team));
}
});
final TeamConfigBag config = team.getTeamConfig();
UIConfigHelper.addTeamConfigOptions(this, player, inv, config, team, team.getZone(), i);
}

View File

@ -2,6 +2,7 @@ package com.tommytony.war.ui;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.config.WarzoneConfigBag;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -38,6 +39,19 @@ public class EditZoneConfigUI extends ChestUI {
}
});
UIConfigHelper.addTeamConfigOptions(this, player, inv, zone.getTeamDefaultConfig(), null, zone, i);
item = new ItemStack(Material.SNOW_BALL);
meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "" + ChatColor.BOLD + "Restore Defaults");
item.setItemMeta(meta);
this.addItem(inv, getSize() - 1, item, new Runnable() {
@Override
public void run() {
zone.getWarzoneConfig().reset();
zone.getTeamDefaultConfig().reset();
WarzoneConfigBag.afterUpdate(zone, player, "All options set to defaults in warzone " + zone.getName() + " by " + player.getName(), false);
War.war.getUIManager().assignUI(player, new EditZoneConfigUI(zone));
}
});
}
@Override

View File

@ -2,6 +2,8 @@ package com.tommytony.war.ui;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.command.DeleteZoneCommand;
import com.tommytony.war.command.ResetZoneCommand;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -26,7 +28,7 @@ public class EditZoneUI extends ChestUI {
ItemMeta meta;
item = new ItemStack(Material.CHEST);
meta = item.getItemMeta();
meta.setDisplayName("Options");
meta.setDisplayName(ChatColor.YELLOW + "Options");
item.setItemMeta(meta);
this.addItem(inv, 0, item, new Runnable() {
@Override
@ -36,7 +38,7 @@ public class EditZoneUI extends ChestUI {
});
item = new ItemStack(Material.CHEST);
meta = item.getItemMeta();
meta.setDisplayName("Teams");
meta.setDisplayName(ChatColor.YELLOW + "Teams");
item.setItemMeta(meta);
this.addItem(inv, 1, item, new Runnable() {
@Override
@ -46,17 +48,46 @@ public class EditZoneUI extends ChestUI {
});
item = new ItemStack(Material.CHEST);
meta = item.getItemMeta();
meta.setDisplayName("Loadouts");
meta.setDisplayName(ChatColor.YELLOW + "Loadouts");
item.setItemMeta(meta);
item = new ItemStack(Material.CHEST);
meta = item.getItemMeta();
meta.setDisplayName("Structures");
meta.setDisplayName(ChatColor.YELLOW + "Structures");
item.setItemMeta(meta);
item = new ItemStack(Material.NETHER_STAR);
meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "Reset Blocks");
item.setItemMeta(meta);
this.addItem(inv, 7, item, new Runnable() {
@Override
public void run() {
ResetZoneCommand.forceResetZone(zone, player);
}
});
item = new ItemStack(Material.TNT);
meta = item.getItemMeta();
meta.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Delete");
item.setItemMeta(meta);
this.addItem(inv, 8, item, new Runnable() {
@Override
public void run() {
War.war.getUIManager().getPlayerMessage(player, "Delete zone: are you sure? Type \"" + zone.getName() + "\" to confirm:", new StringRunnable() {
@Override
public void run() {
if (this.getValue().equalsIgnoreCase(zone.getName())) {
DeleteZoneCommand.forceDeleteZone(zone, player);
} else {
War.war.badMsg(player, "Delete aborted.");
}
}
});
}
});
}
@Override
public String getTitle() {
return ChatColor.RED + "Warzone \"" + zone.getName() + "\"";
return ChatColor.RED + "Editing Warzone \"" + zone.getName() + "\"";
}
@Override

View File

@ -34,7 +34,7 @@ public class JoinTeamUI extends ChestUI {
Team team = warzone.getTeamByKind(kind);
ItemMeta meta = item.getItemMeta();
if (team != null) {
meta.setDisplayName(ChatColor.BOLD + "" + kind.getColor() + "Team " + kind.name().toLowerCase());
meta.setDisplayName(kind.getColor() + "Team " + kind.getCapsName());
meta.setLore(ImmutableList.of(MessageFormat.format(ChatColor.GRAY + "{0}/{1} players", team.getPlayers().size(), team.getTeamConfig().resolveInt(TeamConfig.TEAMSIZE)),
MessageFormat.format(ChatColor.GRAY + "{0}/{1} pts", team.getPoints(), team.getTeamConfig().resolveInt(TeamConfig.MAXSCORE)),
MessageFormat.format(ChatColor.GRAY + "{0} lives left", team.getRemainingLives()),

View File

@ -21,7 +21,7 @@ public class JoinZoneUI extends ChestUI {
public void build(final Player player, Inventory inv) {
ItemStack item = new ItemStack(Material.TNT, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.RED + "Warhub");
meta.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Warhub");
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Teleports you to the " + ChatColor.RED + "Warhub" + ChatColor.GRAY + " lobby",
ChatColor.DARK_GRAY + "Warzone doors located here"));
item.setItemMeta(meta);

View File

@ -8,7 +8,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
@ -16,7 +15,6 @@ import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* Created by Connor on 7/25/2017.
@ -42,15 +40,13 @@ public class UIManager implements Listener {
public void getPlayerMessage(Player player, String prompt, StringRunnable action) {
messageMap.put(player, action);
for (int i = 0; i < 10; i++) {
player.sendMessage("");
}
player.sendMessage("CHAT DISABLED WHILE WAITING FOR RESPONSE");
player.sendMessage("|");
player.sendMessage("|");
player.sendMessage("|");
player.sendMessage("|");
player.sendMessage("|");
player.sendMessage("|");
player.sendMessage("|");
player.sendMessage("|");
for (int i = 0; i < 8; i++) {
player.sendMessage("|");
}
player.sendMessage(prompt);
}

View File

@ -45,11 +45,11 @@ public class WarAdminUI extends ChestUI {
@Override
public String getTitle() {
return ChatColor.DARK_RED + "" + ChatColor.BOLD + "War Admin";
return ChatColor.DARK_RED + "" + ChatColor.BOLD + "War Admin Panel";
}
@Override
public int getSize() {
return 9*9;
return 9 * 7;
}
}

View File

@ -49,8 +49,8 @@ public class WarUI extends ChestUI {
private ItemStack getCreateWarzoneItem() {
ItemStack item = new ItemStack(Material.WOOD_AXE, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.YELLOW + "Create Warzone");
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to create, or edit a " + ChatColor.AQUA + "Warzone"));
meta.setDisplayName(ChatColor.YELLOW + "" + ChatColor.BOLD + "Create Warzone");
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to create, or edit a " + ChatColor.AQUA + "Warzone" + ChatColor.GRAY + "."));
item.setItemMeta(meta);
return item;
}
@ -58,8 +58,8 @@ public class WarUI extends ChestUI {
private ItemStack getJoinWarzoneItem() {
ItemStack item = new ItemStack(Material.IRON_SWORD, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.RED + "Join Warzone");
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to access " + ChatColor.AQUA + "Warzones",
meta.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Join Warzone");
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to access " + ChatColor.AQUA + "Warzones" + ChatColor.GRAY + ".",
ChatColor.DARK_GRAY + "Play in PVP areas, with multiple gamemodes here."));
item.setItemMeta(meta);
return item;
@ -68,9 +68,9 @@ public class WarUI extends ChestUI {
private ItemStack getWarAdminItem() {
ItemStack item = new ItemStack(Material.EYE_OF_ENDER, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.BOLD + "" + ChatColor.DARK_RED + "Manage War");
meta.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Manage War");
meta.setLore(ImmutableList.of(ChatColor.GRAY + "Click to display " + ChatColor.DARK_RED + "Admin" + ChatColor.GRAY + " access panel",
ChatColor.DARK_GRAY + "Play in PVP areas, with multiple gamemodes here."));
ChatColor.GRAY + "Includes: " + ChatColor.DARK_GRAY + "Permissions, managing warzones, configs, etc."));
item.setItemMeta(meta);
return item;
}