mirror of
https://github.com/taoneill/war.git
synced 2024-11-13 05:54:31 +01:00
Merge pull request #638 from cmastudios/hotfix-cslotsteal
Fix item smuggling and game end bugs. Thanks @cmastudios!
This commit is contained in:
commit
bf7e1a9847
@ -375,6 +375,7 @@ public class Warzone {
|
||||
player.setExhaustion(0);
|
||||
player.setFireTicks(0); //this works fine here, why put it in LoudoutResetJob...? I'll keep it over there though
|
||||
|
||||
player.getOpenInventory().close();
|
||||
player.getInventory().clear();
|
||||
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
@ -527,6 +528,7 @@ public class Warzone {
|
||||
PlayerState originalState = this.playerStates.remove(player.getName());
|
||||
PlayerInventory playerInv = player.getInventory();
|
||||
if (originalState != null) {
|
||||
player.getOpenInventory().close();
|
||||
this.playerInvFromInventoryStash(playerInv, originalState);
|
||||
player.setGameMode(originalState.getGamemode());
|
||||
player.setHealth(originalState.getHealth());
|
||||
@ -1394,6 +1396,18 @@ public class Warzone {
|
||||
}
|
||||
invIndex++;
|
||||
}
|
||||
if (originalState.getFeet() != null) {
|
||||
playerItems.put(100, originalState.getFeet());
|
||||
}
|
||||
if (originalState.getLegs() != null) {
|
||||
playerItems.put(101, originalState.getLegs());
|
||||
}
|
||||
if (originalState.getChest() != null) {
|
||||
playerItems.put(102, originalState.getChest());
|
||||
}
|
||||
if (originalState.getHelmet() != null) {
|
||||
playerItems.put(103, originalState.getHelmet());
|
||||
}
|
||||
|
||||
if (War.war.isSpoutServer()) {
|
||||
SpoutManager.getPlayer(player).setTitle(originalState.getPlayerTitle());
|
||||
|
@ -10,6 +10,7 @@ import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.structure.ZoneLobby;
|
||||
import java.util.Iterator;
|
||||
import org.kitteh.tag.TagAPI;
|
||||
|
||||
|
||||
public class ResetZoneCommand extends AbstractZoneMakerCommand {
|
||||
@ -50,6 +51,9 @@ public class ResetZoneCommand extends AbstractZoneMakerCommand {
|
||||
for (Iterator<Player> it = team.getPlayers().iterator(); it.hasNext();) {
|
||||
Player p = it.next();
|
||||
it.remove();
|
||||
if (War.war.isTagServer()) {
|
||||
TagAPI.refreshPlayer(p);
|
||||
}
|
||||
zone.restorePlayerState(p);
|
||||
p.teleport(zone.getTeleport());
|
||||
War.war.msg(p, "You have left the warzone. Your inventory is being restored.");
|
||||
|
@ -12,6 +12,8 @@ import com.tommytony.war.Team;
|
||||
import com.tommytony.war.War;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.spout.SpoutDisplayer;
|
||||
import java.util.Iterator;
|
||||
import org.kitteh.tag.TagAPI;
|
||||
|
||||
public class ScoreCapReachedJob implements Runnable {
|
||||
|
||||
@ -41,10 +43,13 @@ public class ScoreCapReachedJob implements Runnable {
|
||||
String winnersStrAndExtra = "Score cap reached. Game is over! Winning team(s): " + this.winnersStr;
|
||||
winnersStrAndExtra += ". Resetting warzone and your inventory...";
|
||||
t.teamcast(winnersStrAndExtra);
|
||||
for (Player tp : t.getPlayers()) {
|
||||
// Send everyone to rally point (or zone lobby if not rally point)
|
||||
for (Iterator<Player> it = t.getPlayers().iterator(); it.hasNext();) {
|
||||
Player tp = it.next();
|
||||
it.remove(); // Remove player from team first to prevent anti-tp
|
||||
if (War.war.isTagServer()) {
|
||||
TagAPI.refreshPlayer(tp);
|
||||
}
|
||||
this.zone.gameEndTeleport(tp);
|
||||
|
||||
if (this.winnersStr.contains(t.getName())) {
|
||||
// give reward
|
||||
for (Integer slot : t.getInventories().resolveReward().keySet()) {
|
||||
|
Loading…
Reference in New Issue
Block a user