mirror of
https://github.com/taoneill/war.git
synced 2024-09-27 22:18:11 +02:00
Loadouts and inventory storage works. :D
This commit is contained in:
parent
b1ceaa3f46
commit
efa3b63ea9
@ -88,7 +88,7 @@ public class War extends JavaPlugin {
|
|||||||
this.defaultLifepool = 7;
|
this.defaultLifepool = 7;
|
||||||
this.defaultFriendlyFire = false;
|
this.defaultFriendlyFire = false;
|
||||||
this.defaultAutoAssignOnly = false;
|
this.defaultAutoAssignOnly = false;
|
||||||
getLogger().info("Loading War secrets...");
|
getLogger().info("Loading War files...");
|
||||||
WarMapper.load(this, this.getServer().getWorlds()[0]);
|
WarMapper.load(this, this.getServer().getWorlds()[0]);
|
||||||
getLogger().info("War v" + version + " is on.");
|
getLogger().info("War v" + version + " is on.");
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class Warzone {
|
|||||||
private HashMap<Integer, ItemStack> loadout;
|
private HashMap<Integer, ItemStack> loadout;
|
||||||
private boolean drawZoneOutline;
|
private boolean drawZoneOutline;
|
||||||
|
|
||||||
private HashMap<String, List<ItemStack>> inventories = new HashMap<String, List<ItemStack>>();
|
private HashMap<String, ItemStack[]> inventories = new HashMap<String, ItemStack[]>();
|
||||||
private World world;
|
private World world;
|
||||||
private Material[] originalSoutheastBlocks;
|
private Material[] originalSoutheastBlocks;
|
||||||
private Material[] originalNorthwestBlocks;
|
private Material[] originalNorthwestBlocks;
|
||||||
@ -343,11 +343,7 @@ public class Warzone {
|
|||||||
private void handleRespawn(Team team, Player player){
|
private void handleRespawn(Team team, Player player){
|
||||||
// Reset inventory to loadout
|
// Reset inventory to loadout
|
||||||
PlayerInventory playerInv = player.getInventory();
|
PlayerInventory playerInv = player.getInventory();
|
||||||
// BUKKIT
|
playerInv.clear();
|
||||||
// for(int i = 0; i < playerInv.getSize(); i++){
|
|
||||||
// playerInv.setItem(index, new ItemStack(Material.))
|
|
||||||
// playerInv.setItem(i, null);
|
|
||||||
// }
|
|
||||||
for(Integer slot : loadout.keySet()) {
|
for(Integer slot : loadout.keySet()) {
|
||||||
// if(slot == 101) {
|
// if(slot == 101) {
|
||||||
// playerInv.setLeggings(loadout.get(slot));
|
// playerInv.setLeggings(loadout.get(slot));
|
||||||
@ -367,7 +363,6 @@ public class Warzone {
|
|||||||
} else if (team.getMaterial() == Material.IRON_BLOCK) {
|
} else if (team.getMaterial() == Material.IRON_BLOCK) {
|
||||||
playerInv.setHelmet(new ItemStack(Material.IRON_BOOTS));
|
playerInv.setHelmet(new ItemStack(Material.IRON_BOOTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
//player.setHealth(20);
|
//player.setHealth(20);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -439,23 +434,18 @@ public class Warzone {
|
|||||||
|
|
||||||
public void keepPlayerInventory(Player player) {
|
public void keepPlayerInventory(Player player) {
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
List<ItemStack> invToStore = new ArrayList<ItemStack>();
|
ItemStack[] contents = inventory.getContents();
|
||||||
for(int i=0; i < inventory.getSize(); i++) {
|
inventories.put(player.getName(), contents);
|
||||||
invToStore.add(i, inventory.getItem(i));
|
|
||||||
}
|
|
||||||
inventories.put(player.getName(), invToStore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restorePlayerInventory(Player player) {
|
public void restorePlayerInventory(Player player) {
|
||||||
List<ItemStack> originalContents = inventories.remove(player.getName());
|
ItemStack[] originalContents = inventories.remove(player.getName());
|
||||||
PlayerInventory playerInv = player.getInventory();
|
PlayerInventory playerInv = player.getInventory();
|
||||||
// BUKKIT
|
playerInv.clear();
|
||||||
// for(int i = 0; i < playerInv.getSize(); i++) {
|
playerInv.remove(Material.DIAMOND_BOOTS.getId());
|
||||||
// playerInv.setItem(i, new ItemStack(Material.AIR));
|
playerInv.remove(Material.GOLD_BOOTS.getId());
|
||||||
// }
|
playerInv.remove(Material.IRON_BOOTS.getId());
|
||||||
// for(int i = 0; i < playerInv.getSize(); i++) {
|
playerInv.setContents(originalContents);
|
||||||
// playerInv.setItem(i, originalContents.get(i));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMonument(String monumentName) {
|
public boolean hasMonument(String monumentName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user