diff --git a/README.md b/README.md
index 070f3b5..fae2508 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,8 @@
- Names are all white
- Drop sand in spawn area
+- can still get over wall barriers
- nullpointer
-- Allow you to change the co-ords of lobby
-- Add a command to toggle building when in said lobby.
- timer when stuck
- Can you add a config option for the assault command /help to not override normal /help if you have a permission?
- Add more game modifiers like First to 5 (stars) or Most stars in 8 minutes
diff --git a/pom.xml b/pom.xml
index 8409096..6511d07 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.thekingelessar.assault
assault
- 0.11.3
+ 0.11.4
jar
Assault
https://github.com/thekingelessar/assault
diff --git a/src/main/java/com/thekingelessar/assault/Assault.java b/src/main/java/com/thekingelessar/assault/Assault.java
index 549bc51..97bbb60 100644
--- a/src/main/java/com/thekingelessar/assault/Assault.java
+++ b/src/main/java/com/thekingelessar/assault/Assault.java
@@ -8,13 +8,11 @@
import com.thekingelessar.assault.game.map.ItemShopTrait;
import com.thekingelessar.assault.game.map.Map;
import com.thekingelessar.assault.game.world.WorldManager;
+import com.thekingelessar.assault.util.Coordinate;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.trait.TraitInfo;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.World;
+import org.bukkit.*;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@@ -33,6 +31,9 @@ public class Assault extends JavaPlugin
static public World lobbyWorld;
static public Location lobbySpawn;
+ static public GameMode lobbyGamemode = GameMode.ADVENTURE;
+ static public boolean forceLobbyInventory = true;
+
static public final String ASSAULT_PREFIX = "§5§l[§d§lAssault§5§l] " + ChatColor.RESET;
static public HashMap maps = new HashMap<>();
@@ -52,7 +53,10 @@ public void onEnable()
this.saveDefaultConfig();
mainConfig = this.getConfig();
lobbyWorld = Bukkit.getWorld(mainConfig.getString("lobby_world"));
- lobbySpawn = new Location(lobbyWorld, 0.5, 101.5, 0.5, 90, 0);
+ lobbySpawn = new Coordinate(mainConfig.getString("lobby_spawn")).toLocation(lobbyWorld);
+
+ lobbyGamemode = GameMode.valueOf(mainConfig.getString("lobby_gamemode"));
+ forceLobbyInventory = mainConfig.getBoolean("force_lobby_inventory");
List mapList = (List) mainConfig.getList("map_list");
for (String mapName : mapList)
diff --git a/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryClickHandler.java b/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryClickHandler.java
index 374aea6..665eff1 100644
--- a/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryClickHandler.java
+++ b/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryClickHandler.java
@@ -35,20 +35,23 @@ public void onInventoryClick(InventoryClickEvent inventoryClickEvent)
{
if (player.getWorld().equals(Assault.lobbyWorld))
{
- if (itemStack != null)
+ if (Assault.forceLobbyInventory)
{
- if (itemStack.equals(LobbyUtil.joinGameStar))
+ if (itemStack != null)
{
- LobbyUtil.joinQueue(player);
+ if (itemStack.equals(LobbyUtil.joinGameStar))
+ {
+ LobbyUtil.joinQueue(player);
+ }
+
+ if (itemStack.getType().equals(Material.BARRIER))
+ {
+ LobbyUtil.leaveQueue(player);
+ }
}
- if (itemStack.getType().equals(Material.BARRIER))
- {
- LobbyUtil.leaveQueue(player);
- }
+ inventoryClickEvent.setCancelled(true);
}
-
- inventoryClickEvent.setCancelled(true);
}
return;
@@ -107,7 +110,7 @@ else if (inventoryOpen.equals(gamePlayer.shopAttacking.inventory))
{
player.playSound(player.getLocation(), Sound.valueOf("BLOCK_CHEST_OPEN"), 0.5F, 1.3F);
}
-
+
player.openInventory(playerTeam.secretStorage);
inventoryClickEvent.setCancelled(true);
return;
@@ -128,7 +131,7 @@ else if (inventoryClickEvent.getInventory().equals(playerTeam.secretStorage))
{
player.playSound(player.getLocation(), Sound.valueOf("BLOCK_CHEST_CLOSE"), 0.5F, 1.3F);
}
-
+
player.openInventory(gamePlayer.shopAttacking.inventory);
inventoryClickEvent.setCancelled(true);
return;
diff --git a/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryDragHandler.java b/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryDragHandler.java
index fc5ef9a..57d3f08 100644
--- a/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryDragHandler.java
+++ b/src/main/java/com/thekingelessar/assault/game/eventhandlers/inventory/InventoryDragHandler.java
@@ -42,9 +42,10 @@ public void onInventoryClick(InventoryDragEvent inventoryDragEvent)
}
inventoryDragEvent.setCancelled(true);
-// handlePlacingTop(inventoryDragEvent);
+ // handlePlacingTop(inventoryDragEvent);
}
+ // Couldn't get working satisfactorily. Wanted to protect shop inventories while allowing dragging in player inventories.
private void handlePlacingTop(InventoryDragEvent inventoryDragEvent)
{
Inventory destInvent = inventoryDragEvent.getInventory();
@@ -73,7 +74,7 @@ private void handlePlacingTop(InventoryDragEvent inventoryDragEvent)
itemStack.setAmount(inventoryDragEvent.getOldCursor().getAmount() - payment);
inventoryDragEvent.setCursor(itemStack);
}
-
+
System.out.println("This inventory has " + inventoryDragEvent.getInventory().getSize() + " slots!");
for (Map.Entry entry : newItems.entrySet())
{
diff --git a/src/main/java/com/thekingelessar/assault/game/eventhandlers/world/PlayerItemDropHandler.java b/src/main/java/com/thekingelessar/assault/game/eventhandlers/world/PlayerItemDropHandler.java
index c1c8594..eeb0ae5 100644
--- a/src/main/java/com/thekingelessar/assault/game/eventhandlers/world/PlayerItemDropHandler.java
+++ b/src/main/java/com/thekingelessar/assault/game/eventhandlers/world/PlayerItemDropHandler.java
@@ -36,8 +36,7 @@ public void onItemDrop(PlayerDropItemEvent playerDropItemEvent)
if (itemStack != null)
{
- List undroppable = Arrays.asList(LobbyUtil.joinGameStar, LobbyUtil.rulesBook, LobbyUtil.inQueueStar, LobbyUtil.leaveBarrier, GameInstance.gameModifierItemStack);
- if (undroppable.contains(itemStack))
+ if (LobbyUtil.undroppable.contains(itemStack))
{
playerDropItemEvent.setCancelled(true);
return;
diff --git a/src/main/java/com/thekingelessar/assault/game/map/ItemShopTrait.java b/src/main/java/com/thekingelessar/assault/game/map/ItemShopTrait.java
index ab38a36..ea85270 100644
--- a/src/main/java/com/thekingelessar/assault/game/map/ItemShopTrait.java
+++ b/src/main/java/com/thekingelessar/assault/game/map/ItemShopTrait.java
@@ -57,6 +57,9 @@ public void openShop(Player player)
inventoryView = player.openInventory(gameTeam.shopBuilding.inventory);
break;
case ATTACKING:
+ System.out.println("--- OPENING ATTACK SHOP ---");
+ System.out.println("Player name: " + gamePlayer.player.getName());
+ System.out.println("Player team: " + gamePlayer.gameTeam.color);
inventoryView = player.openInventory(gamePlayer.shopAttacking.inventory); // todo: nullpointer
break;
}
diff --git a/src/main/java/com/thekingelessar/assault/game/timertasks/TaskCountdownRespawn.java b/src/main/java/com/thekingelessar/assault/game/timertasks/TaskCountdownRespawn.java
index 419c20a..ed383b7 100644
--- a/src/main/java/com/thekingelessar/assault/game/timertasks/TaskCountdownRespawn.java
+++ b/src/main/java/com/thekingelessar/assault/game/timertasks/TaskCountdownRespawn.java
@@ -63,6 +63,10 @@ public void finishTimer()
title.clearTitle(player);
GamePlayer gamePlayer = gameInstance.getGamePlayer(player);
+
+ System.out.println("--- RESPAWNING ---");
+ System.out.println("Player name: " + gamePlayer.player.getName());
+ System.out.println("Player team: " + gamePlayer.gameTeam.color);
gamePlayer.spawn(PlayerMode.ATTACKING); // todo: nullpointer
gamePlayer.taskCountdownRespawn = null;
diff --git a/src/main/java/com/thekingelessar/assault/lobby/LobbyUtil.java b/src/main/java/com/thekingelessar/assault/lobby/LobbyUtil.java
index e29dcbe..7c1e132 100644
--- a/src/main/java/com/thekingelessar/assault/lobby/LobbyUtil.java
+++ b/src/main/java/com/thekingelessar/assault/lobby/LobbyUtil.java
@@ -12,6 +12,7 @@
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Random;
@@ -22,6 +23,8 @@ public class LobbyUtil
public static ItemStack leaveBarrier = ItemInit.initBarrier();
public static ItemStack rulesBook = ItemInit.initBook();
+ public static List undroppable = Arrays.asList(LobbyUtil.joinGameStar, LobbyUtil.rulesBook, LobbyUtil.inQueueStar, LobbyUtil.leaveBarrier, GameInstance.gameModifierItemStack);
+
public static List queueList = new ArrayList<>();
public static void joinQueue(Player player)
@@ -170,7 +173,7 @@ public static void joinLobby(Player player)
player.setDisplayName(player.getName());
player.setPlayerListName(player.getName());
player.setCustomName(player.getName());
- player.setGameMode(GameMode.ADVENTURE);
+ player.setGameMode(Assault.lobbyGamemode);
player.getInventory().clear();
player.getInventory().setArmorContents(new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)});
LobbyUtil.giveStar(player);
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 842c4ef..304f811 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,7 +1,12 @@
lobby_world: lobby_world
+lobby_spawn: 0.5 101.5 0.5 90 0
+lobby_gamemode: ADVENTURE
+
+# Allow players to rearrange their inventory while in the lobby
+force_lobby_inventory: true
# References maps in the maps/ directory.
# Map files should be in the form map_[name].yml.
-# Here, they can be either saloon, map_saloon, saloon.yml, or map_saloon.yml.
+# They can take these forms: saloon, map_saloon, saloon.yml, or map_saloon.yml.
map_list:
- map_saloon
\ No newline at end of file