mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
SPIGOT-4496: Undeprecate MapView.getId and make int
This commit is contained in:
parent
ec937d0e07
commit
b4ee04baae
2 changed files with 11 additions and 2 deletions
|
@ -31,11 +31,12 @@ public final class CraftMapView implements MapView {
|
||||||
addRenderer(new CraftMapRenderer(this, worldMap));
|
addRenderer(new CraftMapRenderer(this, worldMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getId() {
|
@Override
|
||||||
|
public int getId() {
|
||||||
String text = worldMap.getId();
|
String text = worldMap.getId();
|
||||||
if (text.startsWith("map_")) {
|
if (text.startsWith("map_")) {
|
||||||
try {
|
try {
|
||||||
return Short.parseShort(text.substring("map_".length()));
|
return Integer.parseInt(text.substring("map_".length()));
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex) {
|
catch (NumberFormatException ex) {
|
||||||
throw new IllegalStateException("Map has non-numeric ID");
|
throw new IllegalStateException("Map has non-numeric ID");
|
||||||
|
|
|
@ -199,6 +199,14 @@ public class Commodore
|
||||||
@Override
|
@Override
|
||||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf)
|
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf)
|
||||||
{
|
{
|
||||||
|
// SPIGOT-4496
|
||||||
|
if ( owner.equals( "org/bukkit/map/MapView" ) && name.equals( "getId" ) && desc.equals( "()S" ) )
|
||||||
|
{
|
||||||
|
// Should be same size on stack so just call other method
|
||||||
|
super.visitMethodInsn( opcode, owner, name, "()I", itf );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( modern )
|
if ( modern )
|
||||||
{
|
{
|
||||||
if ( owner.equals( "org/bukkit/Material" ) )
|
if ( owner.equals( "org/bukkit/Material" ) )
|
||||||
|
|
Loading…
Reference in a new issue