mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-08 09:17:48 +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:
parent
956acf8dd1
commit
197232cdfc
@ -3240,6 +3240,30 @@ public class ItemManager {
|
|||||||
return false;
|
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) {
|
public static boolean isWall(Material mat) {
|
||||||
CMIMaterial m = CMIMaterial.get(mat);
|
CMIMaterial m = CMIMaterial.get(mat);
|
||||||
if (m == null)
|
if (m == null)
|
||||||
|
@ -18,6 +18,8 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
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.config.CommentedYamlConfiguration;
|
||||||
import com.gamingmesh.jobs.container.TopList;
|
import com.gamingmesh.jobs.container.TopList;
|
||||||
|
|
||||||
@ -173,7 +175,7 @@ public class SignUtil {
|
|||||||
timelapse--;
|
timelapse--;
|
||||||
} else {
|
} else {
|
||||||
if (one.GetNumber() > PlayerList.size())
|
if (one.GetNumber() > PlayerList.size())
|
||||||
continue;
|
return true;
|
||||||
|
|
||||||
TopList pl = PlayerList.get(one.GetNumber() - 1);
|
TopList pl = PlayerList.get(one.GetNumber() - 1);
|
||||||
String PlayerName = pl.getPlayerName();
|
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) {
|
public boolean UpdateHead(final org.bukkit.block.Sign sign, final String Playername, int timelapse) {
|
||||||
try {
|
try {
|
||||||
timelapse = timelapse < 1 ? 1 : timelapse;
|
timelapse = timelapse < 1 ? 1 : timelapse;
|
||||||
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
|
BlockFace directionFacing = null;
|
||||||
BlockFace directionFacing = signMat.getFacing();
|
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();
|
final Location loc = sign.getLocation().clone();
|
||||||
loc.add(0, 1, 0);
|
loc.add(0, 1, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user