Lots of progress was made towards jailing the player.
We now handle the jailing of the players and even store their inventory. Unjailing hasn't been tested at all yet, so that's still to do.
This commit is contained in:
@ -2,6 +2,7 @@ package com.graywolf336.jail.beans;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Chest;
|
||||
@ -32,6 +33,11 @@ public class Cell {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/** Updates the signs of the cell, with the player name and time and such. TODO */
|
||||
public void update() {
|
||||
//TODO: Update the signs
|
||||
}
|
||||
|
||||
/** Sets the prisoner in this cell. */
|
||||
public void setPrisoner(Prisoner prisoner) {
|
||||
this.p = prisoner;
|
||||
@ -102,4 +108,20 @@ public class Cell {
|
||||
|
||||
return (Chest) this.chest.getLocation().getBlock().getState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the chest location doesn't equal null and if it is a double chest.
|
||||
*
|
||||
* @return true if there is a chest, false if there isn't.
|
||||
*/
|
||||
public boolean hasChest() {
|
||||
if(getChest() != null) {
|
||||
if(getChest().getInventory().getSize() == 40) return true;
|
||||
else {
|
||||
Bukkit.getLogger().severe("The cell " + this.name + " has chest that isn't a double chest, please fix.");
|
||||
return false;
|
||||
}
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.Location;
|
||||
* @version 2.0.1
|
||||
*/
|
||||
public class Prisoner {
|
||||
private String name, reason;
|
||||
private String name, reason, inventory, armor;
|
||||
private boolean muted, offlinePending, teleporting;
|
||||
private long time;
|
||||
private Location previousPosition;
|
||||
@ -36,6 +36,8 @@ public class Prisoner {
|
||||
this.teleporting = false;
|
||||
this.previousPosition = null;
|
||||
this.previousGameMode = null;
|
||||
this.inventory = "";
|
||||
this.armor = "";
|
||||
}
|
||||
|
||||
/** Gets the name of this player. */
|
||||
@ -153,4 +155,24 @@ public class Prisoner {
|
||||
else if(previous.isEmpty()) return;
|
||||
else this.previousGameMode = GameMode.valueOf(previous);
|
||||
}
|
||||
|
||||
/** Gets the inventory string for this player, it is encoded in Base64 string. */
|
||||
public String getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
/** Sets the inventory Base64 string. */
|
||||
public void setInventory(String inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
/** Gets the armor content, encoded in Base64 string. */
|
||||
public String getArmor() {
|
||||
return this.armor;
|
||||
}
|
||||
|
||||
/** Sets the armor inventory Base64 string. */
|
||||
public void setArmor(String armor) {
|
||||
this.armor = armor;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user