1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-06 00:08:13 +01:00

Fixed ClassCastException when put a new sign

- Fixed issue when a player use the [toplist] line in sign, then randomly hide from sign
This commit is contained in:
montlikadani 2019-05-03 16:35:23 +02:00
parent 956acf8dd1
commit 197232cdfc
2 changed files with 40 additions and 3 deletions

View File

@ -3240,6 +3240,30 @@ public class ItemManager {
return false;
}
public static boolean isWallSign(Material mat) {
CMIMaterial m = CMIMaterial.get(mat);
if (m == null)
return false;
return m.isWallSign();
}
public boolean isWallSign() {
switch (this) {
case WALL_SIGN:
case ACACIA_WALL_SIGN:
case BIRCH_WALL_SIGN:
case DARK_OAK_WALL_SIGN:
case JUNGLE_WALL_SIGN:
case OAK_WALL_SIGN:
case SPRUCE_WALL_SIGN:
return true;
default:
break;
}
return false;
}
public static boolean isWall(Material mat) {
CMIMaterial m = CMIMaterial.get(mat);
if (m == null)

View File

@ -18,6 +18,8 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
import com.gamingmesh.jobs.container.TopList;
@ -173,7 +175,7 @@ public class SignUtil {
timelapse--;
} else {
if (one.GetNumber() > PlayerList.size())
continue;
return true;
TopList pl = PlayerList.get(one.GetNumber() - 1);
String PlayerName = pl.getPlayerName();
@ -227,8 +229,19 @@ public class SignUtil {
public boolean UpdateHead(final org.bukkit.block.Sign sign, final String Playername, int timelapse) {
try {
timelapse = timelapse < 1 ? 1 : timelapse;
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
BlockFace directionFacing = signMat.getFacing();
BlockFace directionFacing = null;
if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
directionFacing = signMat.getFacing();
} else {
if (CMIMaterial.isWallSign(sign.getType())) {
org.bukkit.block.data.type.WallSign data = (org.bukkit.block.data.type.WallSign) sign.getBlockData();
directionFacing = data.getFacing();
} else {
org.bukkit.block.data.type.Sign data = (org.bukkit.block.data.type.Sign) sign.getBlockData();
directionFacing = data.getRotation();
}
}
final Location loc = sign.getLocation().clone();
loc.add(0, 1, 0);