Readd the method I removed and also change the cells to uuid.
This commit is contained in:
parent
63e117ac72
commit
ad9c70cbbf
@ -1,5 +1,7 @@
|
|||||||
package com.graywolf336.jail;
|
package com.graywolf336.jail;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -101,6 +103,11 @@ public class PrisonerManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void jailPlayer(UUID uuid) {
|
||||||
|
Jail j = pl.getJailManager().getJailPlayerIsIn(uuid);
|
||||||
|
jailPrisoner(j, j.getCellPrisonerIsIn(uuid), pl.getServer().getPlayer(uuid), j.getPrisoner(uuid));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jails the prisoner with the proper information given.
|
* Jails the prisoner with the proper information given.
|
||||||
*
|
*
|
||||||
@ -283,7 +290,7 @@ public class PrisonerManager {
|
|||||||
Jail j = pl.getJailManager().getJailPlayerIsIn(player.getUniqueId());
|
Jail j = pl.getJailManager().getJailPlayerIsIn(player.getUniqueId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unJail(j, j.getCellPrisonerIsIn(player.getName()), player, prisoner);
|
unJail(j, j.getCellPrisonerIsIn(player.getUniqueId()), player, prisoner);
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
if(pl.inDebug()) {
|
if(pl.inDebug()) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -417,7 +424,7 @@ public class PrisonerManager {
|
|||||||
/** Forcefully releases a {@link Prisoner prisoner} from {@link Jail}. */
|
/** Forcefully releases a {@link Prisoner prisoner} from {@link Jail}. */
|
||||||
public void forceRelease(Prisoner prisoner) {
|
public void forceRelease(Prisoner prisoner) {
|
||||||
Jail j = pl.getJailManager().getJailPrisonerIsIn(prisoner);
|
Jail j = pl.getJailManager().getJailPrisonerIsIn(prisoner);
|
||||||
forceUnJail(j, j.getCellPrisonerIsIn(prisoner.getName()), pl.getServer().getPlayer(prisoner.getUUID()), prisoner);
|
forceUnJail(j, j.getCellPrisonerIsIn(prisoner.getUUID()), pl.getServer().getPlayer(prisoner.getUUID()), prisoner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}. */
|
/** Forcefully unjails a {@link Prisoner prisoner} from {@link Jail}. */
|
||||||
|
@ -184,10 +184,10 @@ public class Jail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the cell which the given player name is jailed in, null if not. */
|
/** Returns the cell which the given player name is jailed in, null if not. */
|
||||||
public Cell getCellPrisonerIsIn(String name) {
|
public Cell getCellPrisonerIsIn(UUID uuid) {
|
||||||
for(Cell c : cells.values())
|
for(Cell c : cells.values())
|
||||||
if(c.getPrisoner() != null)
|
if(c.hasPrisoner())
|
||||||
if(c.getPrisoner().getName().equalsIgnoreCase(name))
|
if(c.getPrisoner().getUUID().equals(uuid))
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.graywolf336.jail.command.subcommands;
|
package com.graywolf336.jail.command.subcommands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.graywolf336.jail.JailManager;
|
import com.graywolf336.jail.JailManager;
|
||||||
import com.graywolf336.jail.beans.Prisoner;
|
import com.graywolf336.jail.beans.Prisoner;
|
||||||
@ -11,7 +12,7 @@ import com.graywolf336.jail.enums.LangString;
|
|||||||
@CommandInfo(
|
@CommandInfo(
|
||||||
maxArgs = 0,
|
maxArgs = 0,
|
||||||
minimumArgs = 0,
|
minimumArgs = 0,
|
||||||
needsPlayer = false,
|
needsPlayer = true,
|
||||||
pattern = "status|time",
|
pattern = "status|time",
|
||||||
permission = "jail.usercmd.jailstatus",
|
permission = "jail.usercmd.jailstatus",
|
||||||
usage = "/jail status"
|
usage = "/jail status"
|
||||||
@ -19,8 +20,10 @@ import com.graywolf336.jail.enums.LangString;
|
|||||||
public class JailStatusCommand implements Command{
|
public class JailStatusCommand implements Command{
|
||||||
|
|
||||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||||
if(jm.isPlayerJailed(sender.getName())) {
|
Player pl = (Player) sender;
|
||||||
Prisoner p = jm.getPrisoner(sender.getName());
|
|
||||||
|
if(jm.isPlayerJailed(pl.getUniqueId())) {
|
||||||
|
Prisoner p = jm.getPrisoner(pl.getUniqueId());
|
||||||
//They are jailed, so let's tell them some information
|
//They are jailed, so let's tell them some information
|
||||||
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.STATUS, new String[] { p.getReason(), p.getJailer(), String.valueOf(p.getRemainingTimeInMinutes()) }));
|
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.STATUS, new String[] { p.getReason(), p.getJailer(), String.valueOf(p.getRemainingTimeInMinutes()) }));
|
||||||
}else {
|
}else {
|
||||||
|
@ -68,7 +68,7 @@ public class MoveProtectionListener implements Listener {
|
|||||||
|
|
||||||
//If the prisoner is in a cell, then let's teleport them to the cell's in location
|
//If the prisoner is in a cell, then let's teleport them to the cell's in location
|
||||||
if(j.isJailedInACell(event.getPlayer().getUniqueId())) {
|
if(j.isJailedInACell(event.getPlayer().getUniqueId())) {
|
||||||
event.setTo(j.getCellPrisonerIsIn(event.getPlayer().getName()).getTeleport());
|
event.setTo(j.getCellPrisonerIsIn(event.getPlayer().getUniqueId()).getTeleport());
|
||||||
}else {
|
}else {
|
||||||
//Otherwise let's teleport them to the in location of the jail
|
//Otherwise let's teleport them to the in location of the jail
|
||||||
event.setTo(j.getTeleportIn());
|
event.setTo(j.getTeleportIn());
|
||||||
|
@ -99,7 +99,7 @@ public class PlayerListener implements Listener {
|
|||||||
//If their remaining time is 0, let's unjail them
|
//If their remaining time is 0, let's unjail them
|
||||||
pl.getPrisonerManager().releasePrisoner(event.getPlayer(), p);
|
pl.getPrisonerManager().releasePrisoner(event.getPlayer(), p);
|
||||||
}else if(p.isToBeTransferred()) {
|
}else if(p.isToBeTransferred()) {
|
||||||
Cell c = j.getCellPrisonerIsIn(event.getPlayer().getName());
|
Cell c = j.getCellPrisonerIsIn(event.getPlayer().getUniqueId());
|
||||||
|
|
||||||
//If the player is not jailed in a cell, teleport them to the jail's in
|
//If the player is not jailed in a cell, teleport them to the jail's in
|
||||||
if(c == null) {
|
if(c == null) {
|
||||||
@ -116,7 +116,7 @@ public class PlayerListener implements Listener {
|
|||||||
p.setToBeTransferred(false);
|
p.setToBeTransferred(false);
|
||||||
} else {
|
} else {
|
||||||
//Their remaining time isn't 0 so let's proceed with jailing of the prisoner
|
//Their remaining time isn't 0 so let's proceed with jailing of the prisoner
|
||||||
pl.getPrisonerManager().jailPrisoner(event.getPlayer().getUniqueId());//TODO
|
pl.getPrisonerManager().jailPlayer(event.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public class PlayerListener implements Listener {
|
|||||||
Jail j = pl.getJailManager().getJailPlayerIsIn(event.getPlayer().getUniqueId());
|
Jail j = pl.getJailManager().getJailPlayerIsIn(event.getPlayer().getUniqueId());
|
||||||
|
|
||||||
if(j.isJailedInACell(event.getPlayer().getUniqueId())) {
|
if(j.isJailedInACell(event.getPlayer().getUniqueId())) {
|
||||||
event.setRespawnLocation(j.getCellPrisonerIsIn(event.getPlayer().getName()).getTeleport());
|
event.setRespawnLocation(j.getCellPrisonerIsIn(event.getPlayer().getUniqueId()).getTeleport());
|
||||||
}else {
|
}else {
|
||||||
event.setRespawnLocation(j.getTeleportIn());
|
event.setRespawnLocation(j.getTeleportIn());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user