mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 20:59:39 +01:00
Can't get rid of block freeze bug. Going back to CB 432 (RB2) from CB 439 didnt help. Swallowing sign exceptions until I figure out how to do it properly. I need you guy's help to find a way to reproduc ethe block freeze bug. :(
This commit is contained in:
parent
58e59c75c2
commit
aba1e25569
@ -27,7 +27,6 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.tommytony.war.ChatFixUtil;
|
|
||||||
import com.tommytony.war.Monument;
|
import com.tommytony.war.Monument;
|
||||||
import com.tommytony.war.Team;
|
import com.tommytony.war.Team;
|
||||||
import com.tommytony.war.TeamChatColors;
|
import com.tommytony.war.TeamChatColors;
|
||||||
@ -39,6 +38,7 @@ import com.tommytony.war.ZoneLobby;
|
|||||||
import com.tommytony.war.mappers.VolumeMapper;
|
import com.tommytony.war.mappers.VolumeMapper;
|
||||||
import com.tommytony.war.mappers.WarMapper;
|
import com.tommytony.war.mappers.WarMapper;
|
||||||
import com.tommytony.war.mappers.WarzoneMapper;
|
import com.tommytony.war.mappers.WarzoneMapper;
|
||||||
|
import com.tommytony.war.utils.ChatFixUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -19,9 +19,9 @@ import org.bukkit.event.entity.EntityListener;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
import com.tommytony.war.LootDropperTask;
|
|
||||||
import com.tommytony.war.Team;
|
import com.tommytony.war.Team;
|
||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
|
import com.tommytony.war.jobs.LootDropperTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -18,13 +18,13 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
import com.tommytony.war.InventoryStash;
|
|
||||||
import com.tommytony.war.RestoreDeadmanInventoryJob;
|
|
||||||
import com.tommytony.war.Team;
|
import com.tommytony.war.Team;
|
||||||
import com.tommytony.war.TeamMaterials;
|
import com.tommytony.war.TeamMaterials;
|
||||||
import com.tommytony.war.WarHub;
|
import com.tommytony.war.WarHub;
|
||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
import com.tommytony.war.ZoneLobby;
|
import com.tommytony.war.ZoneLobby;
|
||||||
|
import com.tommytony.war.jobs.RestoreDeadmanInventoryJob;
|
||||||
|
import com.tommytony.war.utils.InventoryStash;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,7 @@ import org.bukkit.material.MaterialData;
|
|||||||
|
|
||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
|
import com.tommytony.war.utils.SignHelper;
|
||||||
import com.tommytony.war.volumes.Volume;
|
import com.tommytony.war.volumes.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -275,22 +276,12 @@ public class Team {
|
|||||||
// signBlock.setType(Material.SIGN_POST);
|
// signBlock.setType(Material.SIGN_POST);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
String[] lines = new String[4];
|
||||||
if(signBlock.getType() != Material.SIGN_POST) {
|
lines[0] = "Team " + name;
|
||||||
signBlock.setType(Material.SIGN_POST);
|
lines[1] = remainingLives + "/" + warzone.getLifePool() + " lives left";
|
||||||
}
|
lines[2] = points + "/" + warzone.getScoreCap() + " pts";
|
||||||
signBlock.setData((byte)signData);
|
lines[3] = players.size() + "/" + warzone.getTeamCap() + " players";
|
||||||
BlockState state = signBlock.getState();
|
SignHelper.setToSign(signBlock, (byte)signData, lines);
|
||||||
if(state instanceof Sign) {
|
|
||||||
Sign sign = (Sign) state;
|
|
||||||
if(sign.getLines() != null) {
|
|
||||||
sign.setLine(0, "Team " + name);
|
|
||||||
sign.setLine(1, remainingLives + "/" + warzone.getLifePool() + " lives left");
|
|
||||||
sign.setLine(2, points + "/" + warzone.getScoreCap() + " pts");
|
|
||||||
sign.setLine(3, players.size() + "/" + warzone.getTeamCap() + " players");
|
|
||||||
sign.update(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.material.MaterialData;
|
|||||||
|
|
||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
|
import com.tommytony.war.utils.SignHelper;
|
||||||
import com.tommytony.war.volumes.Volume;
|
import com.tommytony.war.volumes.Volume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,21 +108,12 @@ public class WarHub {
|
|||||||
// War hub sign
|
// War hub sign
|
||||||
Block signBlock = locationBlock.getFace(BlockFace.WEST);
|
Block signBlock = locationBlock.getFace(BlockFace.WEST);
|
||||||
|
|
||||||
if(signBlock.getType() != Material.SIGN_POST) {
|
String[] lines = new String[4];
|
||||||
signBlock.setType(Material.SIGN_POST);
|
lines[0] = "War hub";
|
||||||
}
|
lines[1] = "";
|
||||||
signBlock.setData((byte)8);
|
lines[2] = "Pick your battle!";
|
||||||
BlockState state = signBlock.getState();
|
lines[3] = "";
|
||||||
if(state instanceof Sign) {
|
SignHelper.setToSign(signBlock, (byte)8, lines);
|
||||||
Sign sign = (Sign) state;
|
|
||||||
if(sign.getLines() != null) {
|
|
||||||
sign.setLine(0, "War hub");
|
|
||||||
sign.setLine(1, "");
|
|
||||||
sign.setLine(2, "Pick your battle!");
|
|
||||||
sign.setLine(3, "");
|
|
||||||
sign.update(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warzone signs
|
// Warzone signs
|
||||||
for(Warzone zone : war.getWarzones()) {
|
for(Warzone zone : war.getWarzones()) {
|
||||||
@ -145,22 +137,12 @@ public class WarHub {
|
|||||||
zonePlayers += t.getPlayers().size();
|
zonePlayers += t.getPlayers().size();
|
||||||
zoneCap += zone.getTeamCap();
|
zoneCap += zone.getTeamCap();
|
||||||
}
|
}
|
||||||
|
String[] lines = new String[4];
|
||||||
if(block.getType() != Material.SIGN_POST) {
|
lines[0] = "Warzone";
|
||||||
block.setType(Material.SIGN_POST);
|
lines[1] = zone.getName();
|
||||||
}
|
lines[2] = zonePlayers + "/" + zoneCap + " players";
|
||||||
block.setData((byte)8);
|
lines[3] = zone.getTeams().size() + " teams";
|
||||||
BlockState state = block.getState();
|
SignHelper.setToSign(block, (byte)8, lines);
|
||||||
if(state instanceof Sign) {
|
|
||||||
Sign sign = (Sign) state;
|
|
||||||
if(sign.getLines() != null) {
|
|
||||||
sign.setLine(0, "Warzone");
|
|
||||||
sign.setLine(1, zone.getName());
|
|
||||||
sign.setLine(2, zonePlayers + "/" + zoneCap + " players");
|
|
||||||
sign.setLine(3, zone.getTeams().size() + " teams");
|
|
||||||
sign.update(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVolume(Volume vol) {
|
public void setVolume(Volume vol) {
|
||||||
|
@ -18,6 +18,8 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
|
|
||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
|
import com.tommytony.war.jobs.ResetCursorJob;
|
||||||
|
import com.tommytony.war.utils.InventoryStash;
|
||||||
import com.tommytony.war.volumes.VerticalVolume;
|
import com.tommytony.war.volumes.VerticalVolume;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.material.MaterialData;
|
|||||||
import bukkit.tommytony.war.War;
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
import com.tommytony.war.mappers.VolumeMapper;
|
import com.tommytony.war.mappers.VolumeMapper;
|
||||||
|
import com.tommytony.war.utils.SignHelper;
|
||||||
import com.tommytony.war.volumes.VerticalVolume;
|
import com.tommytony.war.volumes.VerticalVolume;
|
||||||
import com.tommytony.war.volumes.Volume;
|
import com.tommytony.war.volumes.Volume;
|
||||||
|
|
||||||
@ -181,35 +182,27 @@ public class ZoneLobby {
|
|||||||
|
|
||||||
// set zone sign
|
// set zone sign
|
||||||
Block zoneSignBlock = lobbyMiddleWallBlock.getFace(wall, 4);
|
Block zoneSignBlock = lobbyMiddleWallBlock.getFace(wall, 4);
|
||||||
|
byte data = 0;
|
||||||
if(zoneSignBlock.getType() != Material.SIGN_POST) {
|
|
||||||
zoneSignBlock.setType(Material.SIGN_POST);
|
|
||||||
}
|
|
||||||
if(wall == BlockFace.NORTH) {
|
if(wall == BlockFace.NORTH) {
|
||||||
zoneSignBlock.setData((byte)4);
|
data = (byte)4;
|
||||||
} else if(wall == BlockFace.EAST) {
|
} else if(wall == BlockFace.EAST) {
|
||||||
zoneSignBlock.setData((byte)8);
|
data = (byte)8;
|
||||||
} else if(wall == BlockFace.SOUTH) {
|
} else if(wall == BlockFace.SOUTH) {
|
||||||
zoneSignBlock.setData((byte)12);
|
data = (byte)12;
|
||||||
} else if(wall == BlockFace.WEST) {
|
} else if(wall == BlockFace.WEST) {
|
||||||
zoneSignBlock.setData((byte)0);
|
data = (byte)0;
|
||||||
}
|
}
|
||||||
BlockState state = zoneSignBlock.getState();
|
String[] lines = new String[4];
|
||||||
if(state instanceof Sign) {
|
lines[0] = "Warzone";
|
||||||
Sign sign = (Sign) state;
|
lines[1] = warzone.getName();
|
||||||
if(sign.getLines() != null) {
|
|
||||||
sign.setLine(0, "Warzone");
|
|
||||||
sign.setLine(1, warzone.getName());
|
|
||||||
if(autoAssignGate != null) {
|
if(autoAssignGate != null) {
|
||||||
sign.setLine(2, "Walk in the");
|
lines[2] = "Walk in the";
|
||||||
sign.setLine(3, "auto-assign gate.");
|
lines[3] = "auto-assign gate.";
|
||||||
} else {
|
} else {
|
||||||
sign.setLine(2, "");
|
lines[2] = "";
|
||||||
sign.setLine(3, "Pick your team.");
|
lines[3] = "Pick your team.";
|
||||||
}
|
|
||||||
sign.update(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
SignHelper.setToSign(zoneSignBlock, data, lines);
|
||||||
|
|
||||||
// lets get some light in here
|
// lets get some light in here
|
||||||
if(wall == BlockFace.NORTH || wall == BlockFace.SOUTH) {
|
if(wall == BlockFace.NORTH || wall == BlockFace.SOUTH) {
|
||||||
@ -573,39 +566,26 @@ public class ZoneLobby {
|
|||||||
} else if (wall == BlockFace.WEST) {
|
} else if (wall == BlockFace.WEST) {
|
||||||
direction = BlockFace.EAST;
|
direction = BlockFace.EAST;
|
||||||
}
|
}
|
||||||
|
byte data = 0;
|
||||||
if(wall == BlockFace.NORTH) {
|
if(wall == BlockFace.NORTH) {
|
||||||
block = gate.getFace(direction).getFace(BlockFace.EAST);
|
block = gate.getFace(direction).getFace(BlockFace.EAST);
|
||||||
if(block.getType() != Material.SIGN_POST) block.setType(Material.SIGN_POST);
|
if(awayFromWall) data = (byte)4;
|
||||||
if(awayFromWall) block.setData((byte)4);
|
else data = (byte)12;
|
||||||
else block.setData((byte)12);
|
|
||||||
} else if(wall == BlockFace.EAST) {
|
} else if(wall == BlockFace.EAST) {
|
||||||
block = gate.getFace(direction).getFace(BlockFace.SOUTH);
|
block = gate.getFace(direction).getFace(BlockFace.SOUTH);
|
||||||
if(block.getType() != Material.SIGN_POST) block.setType(Material.SIGN_POST);
|
if(awayFromWall) data = (byte)8;
|
||||||
if(awayFromWall) block.setData((byte)8);
|
else data = (byte)0;
|
||||||
else block.setData((byte)0);
|
|
||||||
} else if(wall == BlockFace.SOUTH) {
|
} else if(wall == BlockFace.SOUTH) {
|
||||||
block = gate.getFace(direction).getFace(BlockFace.WEST);
|
block = gate.getFace(direction).getFace(BlockFace.WEST);
|
||||||
if(block.getType() != Material.SIGN_POST) block.setType(Material.SIGN_POST);
|
if(awayFromWall) data = (byte)12;
|
||||||
if(awayFromWall) block.setData((byte)12);
|
else data = (byte)4;
|
||||||
else block.setData((byte)4);
|
|
||||||
} else if(wall == BlockFace.WEST) {
|
} else if(wall == BlockFace.WEST) {
|
||||||
block = gate.getFace(direction).getFace(BlockFace.NORTH);
|
block = gate.getFace(direction).getFace(BlockFace.NORTH);
|
||||||
if(block.getType() != Material.SIGN_POST) block.setType(Material.SIGN_POST);
|
if(awayFromWall) data = (byte)0;
|
||||||
if(awayFromWall) block.setData((byte)0);
|
else data = (byte)8;
|
||||||
else block.setData((byte)8);
|
|
||||||
}
|
|
||||||
BlockState state = block.getState();
|
|
||||||
if(state instanceof Sign) {
|
|
||||||
Sign sign = (Sign) state;
|
|
||||||
if(sign.getLines() != null) {
|
|
||||||
sign.setLine(0, lines[0]);
|
|
||||||
sign.setLine(1, lines[1]);
|
|
||||||
sign.setLine(2, lines[2]);
|
|
||||||
sign.setLine(3, lines[3]);
|
|
||||||
sign.update(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignHelper.setToSign(block, data, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeavingZone(Location location) {
|
public boolean isLeavingZone(Location location) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.tommytony.war;
|
package com.tommytony.war.jobs;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.tommytony.war;
|
package com.tommytony.war.jobs;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
@ -1,7 +1,9 @@
|
|||||||
package com.tommytony.war;
|
package com.tommytony.war.jobs;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.tommytony.war.Warzone;
|
||||||
|
|
||||||
public class RestoreDeadmanInventoryJob implements Runnable {
|
public class RestoreDeadmanInventoryJob implements Runnable {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
@ -1,7 +1,9 @@
|
|||||||
package com.tommytony.war;
|
package com.tommytony.war.jobs;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.tommytony.war.Warzone;
|
||||||
|
|
||||||
public class ScoreCapReachedJob implements Runnable {
|
public class ScoreCapReachedJob implements Runnable {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
@ -1,4 +1,4 @@
|
|||||||
package com.tommytony.war;
|
package com.tommytony.war.utils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.tommytony.war;
|
package com.tommytony.war.utils;
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
34
war/src/main/java/com/tommytony/war/utils/SignHelper.java
Normal file
34
war/src/main/java/com/tommytony/war/utils/SignHelper.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.tommytony.war.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import bukkit.tommytony.war.War;
|
||||||
|
|
||||||
|
public class SignHelper {
|
||||||
|
|
||||||
|
public static void setToSign(Block block, byte data, String[] lines) {
|
||||||
|
if(block.getType() != Material.SIGN_POST) {
|
||||||
|
block.setType(Material.SIGN_POST);
|
||||||
|
}
|
||||||
|
block.setData(data);
|
||||||
|
BlockState state = block.getState();
|
||||||
|
if(state instanceof Sign) {
|
||||||
|
Sign sign = (Sign) state;
|
||||||
|
try {
|
||||||
|
if(sign.getLines() != null) {
|
||||||
|
sign.setLine(0, lines[0]);
|
||||||
|
sign.setLine(1, lines[1]);
|
||||||
|
sign.setLine(2, lines[2]);
|
||||||
|
sign.setLine(3, lines[3]);
|
||||||
|
sign.update(true);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// just can't stand this anymore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user