summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-11-23 11:50:48 +1100
committermd_5 <git@md-5.net>2018-11-23 11:50:48 +1100
commitb4ee04baae8fc9bddd37950fc444aab692795ea6 (patch)
treebfe83edd584cfe7fd2b33f61bbcc7e75348c21de
parentec937d0e077012134545c79cd749e7c7f4d3a0c5 (diff)
downloadcraftbukkit-b4ee04baae8fc9bddd37950fc444aab692795ea6.tar
craftbukkit-b4ee04baae8fc9bddd37950fc444aab692795ea6.tar.gz
craftbukkit-b4ee04baae8fc9bddd37950fc444aab692795ea6.tar.lz
craftbukkit-b4ee04baae8fc9bddd37950fc444aab692795ea6.tar.xz
craftbukkit-b4ee04baae8fc9bddd37950fc444aab692795ea6.zip
SPIGOT-4496: Undeprecate MapView.getId and make int
-rw-r--r--src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java5
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/Commodore.java8
2 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
index 186c04be..d52fcde1 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
@@ -31,11 +31,12 @@ public final class CraftMapView implements MapView {
addRenderer(new CraftMapRenderer(this, worldMap));
}
- public short getId() {
+ @Override
+ public int getId() {
String text = worldMap.getId();
if (text.startsWith("map_")) {
try {
- return Short.parseShort(text.substring("map_".length()));
+ return Integer.parseInt(text.substring("map_".length()));
}
catch (NumberFormatException ex) {
throw new IllegalStateException("Map has non-numeric ID");
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 6674943e..24d60839 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -199,6 +199,14 @@ public class Commodore
@Override
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 ( owner.equals( "org/bukkit/Material" ) )