mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Fixed respawn timer and made it changeable through /zonecfg and /warcfg.
This commit is contained in:
parent
bd872be244
commit
0b1d428266
@ -97,7 +97,7 @@ public class War extends JavaPlugin {
|
|||||||
private boolean defaultInstaBreak = false;
|
private boolean defaultInstaBreak = false;
|
||||||
private boolean defaultNoDrops = false;
|
private boolean defaultNoDrops = false;
|
||||||
private boolean defaultNoHunger = false;
|
private boolean defaultNoHunger = false;
|
||||||
private int defaultRespawnTimer = 10;
|
private int defaultRespawnTimer = 0;
|
||||||
private int defaultSaturation = 10;
|
private int defaultSaturation = 10;
|
||||||
private int defaultMinPlayers = 1; // By default, 1 player on 1 team is enough for unlocking the cant-exit-spawn guard
|
private int defaultMinPlayers = 1; // By default, 1 player on 1 team is enough for unlocking the cant-exit-spawn guard
|
||||||
private int defaultMinTeams = 1;
|
private int defaultMinTeams = 1;
|
||||||
@ -462,6 +462,10 @@ public class War extends JavaPlugin {
|
|||||||
returnMessage.append(" minteams set to " + warzone.getMinTeams() + ".");
|
returnMessage.append(" minteams set to " + warzone.getMinTeams() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (namedParams.containsKey("respawntimer")) {
|
||||||
|
warzone.setRespawnTimer(Integer.parseInt(namedParams.get("respawntimer")));
|
||||||
|
returnMessage.append(" respawntimer set to " + warzone.getRespawnTimer() + ".");
|
||||||
|
}
|
||||||
|
|
||||||
if (namedParams.containsKey("resetonempty")) {
|
if (namedParams.containsKey("resetonempty")) {
|
||||||
String onOff = namedParams.get("resetonempty");
|
String onOff = namedParams.get("resetonempty");
|
||||||
@ -680,6 +684,10 @@ public class War extends JavaPlugin {
|
|||||||
this.setDefaultMinTeams(Integer.parseInt(namedParams.get("minteams")));
|
this.setDefaultMinTeams(Integer.parseInt(namedParams.get("minteams")));
|
||||||
returnMessage.append(" minteams set to " + this.getDefaultMinTeams() + ".");
|
returnMessage.append(" minteams set to " + this.getDefaultMinTeams() + ".");
|
||||||
}
|
}
|
||||||
|
if (namedParams.containsKey("respawntimer")) {
|
||||||
|
this.setDefaultRespawnTimer(Integer.parseInt(namedParams.get("respawntimer")));
|
||||||
|
returnMessage.append(" respawntimer set to " + this.getDefaultRespawnTimer() + ".");
|
||||||
|
}
|
||||||
|
|
||||||
if (namedParams.containsKey("resetonempty")) {
|
if (namedParams.containsKey("resetonempty")) {
|
||||||
String onOff = namedParams.get("resetonempty");
|
String onOff = namedParams.get("resetonempty");
|
||||||
@ -770,6 +778,7 @@ public class War extends JavaPlugin {
|
|||||||
+ " saturation:" + color + zone.getSaturation() + normal
|
+ " saturation:" + color + zone.getSaturation() + normal
|
||||||
+ " minplayers:" + color + zone.getMinPlayers() + normal
|
+ " minplayers:" + color + zone.getMinPlayers() + normal
|
||||||
+ " minteams:" + color + zone.getMinTeams() + normal
|
+ " minteams:" + color + zone.getMinTeams() + normal
|
||||||
|
+ " respawntimer:" + color + zone.getRespawnTimer() + normal
|
||||||
+ " resetonempty:" + color + String.valueOf(zone.isResetOnEmpty()) + normal
|
+ " resetonempty:" + color + String.valueOf(zone.isResetOnEmpty()) + normal
|
||||||
+ " resetonload:" + color + String.valueOf(zone.isResetOnLoad()) + normal
|
+ " resetonload:" + color + String.valueOf(zone.isResetOnLoad()) + normal
|
||||||
+ " resetonunload:" + color + String.valueOf(zone.isResetOnUnload());
|
+ " resetonunload:" + color + String.valueOf(zone.isResetOnUnload());
|
||||||
@ -815,6 +824,7 @@ public class War extends JavaPlugin {
|
|||||||
+ " saturation:" + color + this.getDefaultSaturation() + normal
|
+ " saturation:" + color + this.getDefaultSaturation() + normal
|
||||||
+ " minplayers:" + color + this.getDefaultMinPlayers() + normal
|
+ " minplayers:" + color + this.getDefaultMinPlayers() + normal
|
||||||
+ " minteams:" + color + this.getDefaultMinTeams() + normal
|
+ " minteams:" + color + this.getDefaultMinTeams() + normal
|
||||||
|
+ " respawntimer:" + color + this.getDefaultRespawnTimer() + normal
|
||||||
+ " resetonempty:" + color + String.valueOf(this.isDefaultResetOnEmpty()) + normal
|
+ " resetonempty:" + color + String.valueOf(this.isDefaultResetOnEmpty()) + normal
|
||||||
+ " resetonload:" + color + String.valueOf(this.isDefaultResetOnLoad()) + normal
|
+ " resetonload:" + color + String.valueOf(this.isDefaultResetOnLoad()) + normal
|
||||||
+ " resetonunload:" + color + String.valueOf(this.isDefaultResetOnUnload());
|
+ " resetonunload:" + color + String.valueOf(this.isDefaultResetOnUnload());
|
||||||
|
@ -77,7 +77,7 @@ public class Warzone {
|
|||||||
private boolean instaBreak = false;
|
private boolean instaBreak = false;
|
||||||
private boolean noDrops = false;
|
private boolean noDrops = false;
|
||||||
private boolean noHunger = false;
|
private boolean noHunger = false;
|
||||||
private int respawnTimer = 10;
|
private int respawnTimer = 0;
|
||||||
private int saturation = 10;
|
private int saturation = 10;
|
||||||
private int minPlayers = 1;
|
private int minPlayers = 1;
|
||||||
private int minTeams = 1;
|
private int minTeams = 1;
|
||||||
@ -366,18 +366,17 @@ public class Warzone {
|
|||||||
((SpoutPlayer) player).setTitle(team.getKind().getColor() + player.getName());
|
((SpoutPlayer) player).setTitle(team.getKind().getColor() + player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Respawn" Timer - player will not be able to leave spawn for a few seconds
|
final LoadoutResetJob job = new LoadoutResetJob(this, team, player);
|
||||||
final Warzone w = this;
|
|
||||||
if (respawnTimer == 0) {
|
if (respawnTimer == 0) {
|
||||||
LoadoutResetJob job = new LoadoutResetJob(w, team, player);
|
|
||||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
|
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
// "Respawn" Timer - player will not be able to leave spawn for a few seconds
|
||||||
respawn.add(player);
|
respawn.add(player);
|
||||||
|
|
||||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, new Runnable() {
|
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
respawn.remove(player);
|
respawn.remove(player);
|
||||||
// Getting the Loadout as visual cue
|
|
||||||
LoadoutResetJob job = new LoadoutResetJob(w, team, player);
|
|
||||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
|
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
|
||||||
}
|
}
|
||||||
}, respawnTimer * 20L); // 20 ticks = 1 second
|
}, respawnTimer * 20L); // 20 ticks = 1 second
|
||||||
@ -1310,7 +1309,7 @@ public class Warzone {
|
|||||||
|
|
||||||
public void equipPlayerLoadoutSelection(Player player, Team playerTeam) {
|
public void equipPlayerLoadoutSelection(Player player, Team playerTeam) {
|
||||||
LoadoutSelection selection = this.getLoadoutSelections().get(player.getName());
|
LoadoutSelection selection = this.getLoadoutSelections().get(player.getName());
|
||||||
if (selection != null && this.isRespawning(player)) {
|
if (selection != null && !this.isRespawning(player)) {
|
||||||
int currentIndex = selection.getSelectedIndex();
|
int currentIndex = selection.getSelectedIndex();
|
||||||
if (currentIndex == 0) {
|
if (currentIndex == 0) {
|
||||||
this.resetInventory(playerTeam, player, this.getLoadout());
|
this.resetInventory(playerTeam, player, this.getLoadout());
|
||||||
|
Loading…
Reference in New Issue
Block a user