Allow resisting arrests via the jail stick.
This commit is contained in:
parent
c9b0fc8480
commit
86082e2f63
@ -54,7 +54,7 @@ public class JailStickManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.sticks.put(m, new Stick(a[2], a[3], Long.valueOf(a[1])));
|
this.sticks.put(m, new Stick(a[2], a[3], Long.valueOf(a[1]), Double.valueOf(a[4])));
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
pl.getLogger().severe(s);
|
pl.getLogger().severe(s);
|
||||||
|
@ -11,27 +11,42 @@ package com.graywolf336.jail.beans;
|
|||||||
public class Stick {
|
public class Stick {
|
||||||
private String jail, reason;
|
private String jail, reason;
|
||||||
private long time;
|
private long time;
|
||||||
|
private double health;
|
||||||
|
|
||||||
public Stick(String jail, String reason, long time) {
|
public Stick(String jail, String reason, long time, double health) {
|
||||||
this.jail = jail;
|
this.jail = jail;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
|
this.health = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the name of the jail a player will be sent when jailed via this jail stick. */
|
||||||
public String getJail() {
|
public String getJail() {
|
||||||
return this.jail;
|
return this.jail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the reason a player will be jailed for when jailed via this stick. */
|
||||||
public String getReason() {
|
public String getReason() {
|
||||||
return this.reason;
|
return this.reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the amount of time a player has to serve when they are jailed via this stick. */
|
||||||
public long getTime() {
|
public long getTime() {
|
||||||
return this.time;
|
return this.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the amount of health a player has to have before getting jailed via this stick.
|
||||||
|
*
|
||||||
|
* <p />
|
||||||
|
*
|
||||||
|
* See here for reference: http://dev.bukkit.org/bukkit-plugins/jail/tickets/415/
|
||||||
|
*/
|
||||||
|
public double getHealth() {
|
||||||
|
return this.health;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return time + "," + jail + "," + reason;
|
return time + "," + jail + "," + reason + "," + health;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,10 @@ public enum LangString {
|
|||||||
PROVIDEAPLAYER ("jailing"),
|
PROVIDEAPLAYER ("jailing"),
|
||||||
/** The message sent to the sender when they need to provide a jail. */
|
/** The message sent to the sender when they need to provide a jail. */
|
||||||
PROVIDEAJAIL ("jailing"),
|
PROVIDEAJAIL ("jailing"),
|
||||||
|
/** The message sent to someone trying to jail someone else with a jail stick that requires health below a certain amount. */
|
||||||
|
RESISTEDARRESTJAILER ("jailing"),
|
||||||
|
/** The message sent to the person someone else is trying to jail that requires their health below a certain amount. */
|
||||||
|
RESISTEDARRESTPLAYER ("jailing"),
|
||||||
/** The message sent when to a prisoner about their status in jail. */
|
/** The message sent when to a prisoner about their status in jail. */
|
||||||
STATUS ("jailing"),
|
STATUS ("jailing"),
|
||||||
/** The message sent to the sender of a command when suggesting a cell. */
|
/** The message sent to the sender of a command when suggesting a cell. */
|
||||||
|
@ -223,6 +223,7 @@ public class PlayerListener implements Listener {
|
|||||||
}else {
|
}else {
|
||||||
Stick s = pl.getJailStickManager().getStick(attacker.getItemInHand().getType());
|
Stick s = pl.getJailStickManager().getStick(attacker.getItemInHand().getType());
|
||||||
|
|
||||||
|
if(player.getHealth() <= s.getHealth() || s.getHealth() == -1) {
|
||||||
Prisoner p = new Prisoner(player.getUniqueId().toString(), player.getName(),
|
Prisoner p = new Prisoner(player.getUniqueId().toString(), player.getName(),
|
||||||
pl.getConfig().getBoolean(Settings.AUTOMATICMUTE.getPath()),
|
pl.getConfig().getBoolean(Settings.AUTOMATICMUTE.getPath()),
|
||||||
s.getTime(), attacker.getName(), s.getReason());
|
s.getTime(), attacker.getName(), s.getReason());
|
||||||
@ -260,6 +261,10 @@ public class PlayerListener implements Listener {
|
|||||||
attacker.sendMessage(ChatColor.RED + e.getMessage());
|
attacker.sendMessage(ChatColor.RED + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
attacker.sendMessage(pl.getJailIO().getLanguageString(LangString.RESISTEDARRESTJAILER, player.getName()));
|
||||||
|
player.sendMessage(pl.getJailIO().getLanguageString(LangString.RESISTEDARRESTPLAYER, attacker.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,4 +77,4 @@ jailpay:
|
|||||||
priceInfinite: 10000
|
priceInfinite: 10000
|
||||||
jailstick:
|
jailstick:
|
||||||
enabled: true
|
enabled: true
|
||||||
sticks: ["stick,30,,Running away"]
|
sticks: ["stick,30,,Running away,-1", "blaze_rod,15,,Having too much fun,6"]
|
@ -63,6 +63,8 @@ language:
|
|||||||
protectionmessagenopenalty: '&cProtection enabled for %0%, do not do it again.'
|
protectionmessagenopenalty: '&cProtection enabled for %0%, do not do it again.'
|
||||||
provideaplayer: '&cPlease provide a player when %0% &cthem.'
|
provideaplayer: '&cPlease provide a player when %0% &cthem.'
|
||||||
provideajail: '&cPlease provide a jail to %0% &cthem to.'
|
provideajail: '&cPlease provide a jail to %0% &cthem to.'
|
||||||
|
resistedarrestjailer: '&c%0% has resisted arrest thanks to having more health than you can jail at.'
|
||||||
|
resistedarrestplayer: '&cYou have resisted arrest due to having more health than %0% can jail at.'
|
||||||
status: "&2You have been jailed with a reason of '%0%' by %1% and have %2% minutes remaining."
|
status: "&2You have been jailed with a reason of '%0%' by %1% and have %2% minutes remaining."
|
||||||
suggestedcell: '&cAn empty cell in the same jail, %0%, was found: %1%'
|
suggestedcell: '&cAn empty cell in the same jail, %0%, was found: %1%'
|
||||||
telein: "&9Teleported %0% to %1%'s teleport in location."
|
telein: "&9Teleported %0% to %1%'s teleport in location."
|
||||||
|
Loading…
Reference in New Issue
Block a user