Synchronous game end inventory resets

Still trying to fix the inventory reset bug. :( Trying out Github for
Windows. :)
This commit is contained in:
taoneill 2012-05-29 23:18:03 -04:00
parent 7f36e6991f
commit af9d4db788
4 changed files with 5 additions and 17 deletions

View File

@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -61,7 +60,6 @@ public class War extends JavaPlugin {
private WarServerListener serverListener = new WarServerListener();
private WarCommandHandler commandHandler = new WarCommandHandler();
private Logger logger;
private PluginDescriptionFile desc = null;
private boolean loaded = false;
private boolean isSpoutServer = false;
@ -115,7 +113,6 @@ public class War extends JavaPlugin {
public void loadWar() {
this.setLoaded(true);
this.desc = this.getDescription();
this.logger = this.getServer().getLogger();
// Spout server detection
try {

View File

@ -230,7 +230,9 @@ public class Warzone {
// everyone back to team spawn with full health
for (Team team : this.teams) {
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);
}
}
@ -888,7 +890,6 @@ public class Warzone {
// player will die because it took too long :(
// we dont restore his inventory in handleScoreCapReached
// check out PLAYER_MOVE for the rest of the fix
} else {
// A new battle starts. Reset the zone but not the teams.
for (Team t : teams) {
@ -1209,18 +1210,10 @@ public class Warzone {
public void handleScoreCapReached(Player player, String winnersStr) {
// Score cap reached. Reset everything.
this.isEndOfGame = true;
ScoreCapReachedJob job = new ScoreCapReachedJob(this, winnersStr);
War.war.getServer().getScheduler().scheduleSyncDelayedTask(War.war, job);
new ScoreCapReachedJob(this, winnersStr).run(); // run inventory and teleports immediately to avoid inv reset problems
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) {
if (this.deadMenInventories.containsKey(playerName)) {
return true;
@ -1233,7 +1226,6 @@ public class Warzone {
this.playerInvFromInventoryStash(player.getInventory(), this.deadMenInventories.get(player.getName()));
this.deadMenInventories.remove(player.getName());
}
}
public void setRallyPoint(Location location) {

View File

@ -365,7 +365,6 @@ public class WarPlayerListener implements Listener {
Warzone zone = hub.getDestinationWarzoneForLocation(playerLoc);
if (zone != null && zone.getTeleport() != null) {
event.setTo(zone.getTeleport());
// player.teleport(zone.getTeleport());
War.war.msg(player, "Welcome to warzone " + zone.getName() + ".");
return;
}

View File

@ -1,6 +1,7 @@
package com.tommytony.war.job;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -9,7 +10,6 @@ import org.bukkit.inventory.PlayerInventory;
import com.tommytony.war.Team;
import com.tommytony.war.War;
import com.tommytony.war.Warzone;
import com.tommytony.war.config.TeamKind;
import com.tommytony.war.config.WarzoneConfig;