mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Synchronous game end inventory resets
Still trying to fix the inventory reset bug. :( Trying out Github for Windows. :)
This commit is contained in:
parent
7f36e6991f
commit
af9d4db788
@ -5,7 +5,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -61,7 +60,6 @@ public class War extends JavaPlugin {
|
|||||||
private WarServerListener serverListener = new WarServerListener();
|
private WarServerListener serverListener = new WarServerListener();
|
||||||
|
|
||||||
private WarCommandHandler commandHandler = new WarCommandHandler();
|
private WarCommandHandler commandHandler = new WarCommandHandler();
|
||||||
private Logger logger;
|
|
||||||
private PluginDescriptionFile desc = null;
|
private PluginDescriptionFile desc = null;
|
||||||
private boolean loaded = false;
|
private boolean loaded = false;
|
||||||
private boolean isSpoutServer = false;
|
private boolean isSpoutServer = false;
|
||||||
@ -115,7 +113,6 @@ public class War extends JavaPlugin {
|
|||||||
public void loadWar() {
|
public void loadWar() {
|
||||||
this.setLoaded(true);
|
this.setLoaded(true);
|
||||||
this.desc = this.getDescription();
|
this.desc = this.getDescription();
|
||||||
this.logger = this.getServer().getLogger();
|
|
||||||
|
|
||||||
// Spout server detection
|
// Spout server detection
|
||||||
try {
|
try {
|
||||||
|
@ -230,7 +230,9 @@ public class Warzone {
|
|||||||
// everyone back to team spawn with full health
|
// everyone back to team spawn with full health
|
||||||
for (Team team : this.teams) {
|
for (Team team : this.teams) {
|
||||||
for (Player player : team.getPlayers()) {
|
for (Player player : team.getPlayers()) {
|
||||||
if (!player.getName().equals(respawnExempted.getName())) {
|
if (respawnExempted == null
|
||||||
|
|| (respawnExempted != null
|
||||||
|
&& !player.getName().equals(respawnExempted.getName()))) {
|
||||||
this.respawnPlayer(team, player);
|
this.respawnPlayer(team, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -888,7 +890,6 @@ public class Warzone {
|
|||||||
// player will die because it took too long :(
|
// player will die because it took too long :(
|
||||||
// we dont restore his inventory in handleScoreCapReached
|
// we dont restore his inventory in handleScoreCapReached
|
||||||
// check out PLAYER_MOVE for the rest of the fix
|
// check out PLAYER_MOVE for the rest of the fix
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// A new battle starts. Reset the zone but not the teams.
|
// A new battle starts. Reset the zone but not the teams.
|
||||||
for (Team t : teams) {
|
for (Team t : teams) {
|
||||||
@ -1209,18 +1210,10 @@ public class Warzone {
|
|||||||
public void handleScoreCapReached(Player player, String winnersStr) {
|
public void handleScoreCapReached(Player player, String winnersStr) {
|
||||||
// Score cap reached. Reset everything.
|
// Score cap reached. Reset everything.
|
||||||
this.isEndOfGame = true;
|
this.isEndOfGame = true;
|
||||||
ScoreCapReachedJob job = new ScoreCapReachedJob(this, winnersStr);
|
new ScoreCapReachedJob(this, winnersStr).run(); // run inventory and teleports immediately to avoid inv reset problems
|
||||||
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
|
|
||||||
this.reinitialize(player);
|
this.reinitialize(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setSpawnStyle(TeamSpawnStyle spawnStyle) {
|
|
||||||
// this.spawnStyle = spawnStyle;
|
|
||||||
// for (Team team : this.teams) {
|
|
||||||
// team.setTeamSpawn(team.getTeamSpawn());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean isDeadMan(String playerName) {
|
public boolean isDeadMan(String playerName) {
|
||||||
if (this.deadMenInventories.containsKey(playerName)) {
|
if (this.deadMenInventories.containsKey(playerName)) {
|
||||||
return true;
|
return true;
|
||||||
@ -1233,7 +1226,6 @@ public class Warzone {
|
|||||||
this.playerInvFromInventoryStash(player.getInventory(), this.deadMenInventories.get(player.getName()));
|
this.playerInvFromInventoryStash(player.getInventory(), this.deadMenInventories.get(player.getName()));
|
||||||
this.deadMenInventories.remove(player.getName());
|
this.deadMenInventories.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRallyPoint(Location location) {
|
public void setRallyPoint(Location location) {
|
||||||
|
@ -365,7 +365,6 @@ public class WarPlayerListener implements Listener {
|
|||||||
Warzone zone = hub.getDestinationWarzoneForLocation(playerLoc);
|
Warzone zone = hub.getDestinationWarzoneForLocation(playerLoc);
|
||||||
if (zone != null && zone.getTeleport() != null) {
|
if (zone != null && zone.getTeleport() != null) {
|
||||||
event.setTo(zone.getTeleport());
|
event.setTo(zone.getTeleport());
|
||||||
// player.teleport(zone.getTeleport());
|
|
||||||
War.war.msg(player, "Welcome to warzone " + zone.getName() + ".");
|
War.war.msg(player, "Welcome to warzone " + zone.getName() + ".");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.tommytony.war.job;
|
package com.tommytony.war.job;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -9,7 +10,6 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
import com.tommytony.war.Team;
|
import com.tommytony.war.Team;
|
||||||
import com.tommytony.war.War;
|
import com.tommytony.war.War;
|
||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
import com.tommytony.war.config.TeamKind;
|
|
||||||
import com.tommytony.war.config.WarzoneConfig;
|
import com.tommytony.war.config.WarzoneConfig;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user