Fix wrong team member removal method signature.

This commit is contained in:
Olof Larsson 2016-05-17 19:39:18 +02:00
parent de1a28914b
commit 5daebc8e33
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474

View File

@ -26,17 +26,18 @@ public class NmsBoard17R4 extends NmsBoard
// net.minecraft.server.Scoreboard // net.minecraft.server.Scoreboard
protected Class<?> classNmsScoreboard; protected Class<?> classNmsScoreboard;
// net.minecraft.server.ScoreboardTeam
protected Class<?> classNmsScoreboardTeam;
// net.minecraft.server.Scoreboard#getTeam(String) // net.minecraft.server.Scoreboard#getTeam(String)
protected Method methodNmsScoreboardGetTeam; protected Method methodNmsScoreboardGetTeam;
// net.minecraft.server.Scoreboard#addPlayerToTeam(String, String) // net.minecraft.server.Scoreboard#addPlayerToTeam(String, String)
protected Method methodNmsScoreboardAddPlayerToTeam; protected Method methodNmsScoreboardAddPlayerToTeam;
// net.minecraft.server.Scoreboard#removePlayerFromTeam(String, String) // net.minecraft.server.Scoreboard#removePlayerFromTeam(String, net.minecraft.server.ScoreboardTeam)
protected Method methodNmsScoreboardRemovePlayerFromTeam; protected Method methodNmsScoreboardRemovePlayerFromTeam;
// net.minecraft.server.Scoreboard#getPlayerTeam(String) // net.minecraft.server.Scoreboard#getPlayerTeam(String)
protected Method methodNmsScoreboardGetPlayerTeam; protected Method methodNmsScoreboardGetPlayerTeam;
// net.minecraft.server.ScoreboardTeam
protected Class<?> classNmsScoreboardTeam;
// net.minecraft.server.ScoreboardTeam#getPlayerNameSet() // net.minecraft.server.ScoreboardTeam#getPlayerNameSet()
protected Method methodNmsScoreboardTeamGetPlayerNameSet; protected Method methodNmsScoreboardTeamGetPlayerNameSet;
@ -54,28 +55,21 @@ public class NmsBoard17R4 extends NmsBoard
@Override @Override
public void setup() throws Throwable public void setup() throws Throwable
{ {
try NmsBasics.get().require();
{
NmsBasics.get().require(); this.classNmsScoreboard = PackageType.MINECRAFT_SERVER.getClass("Scoreboard");
this.classNmsScoreboardTeam = PackageType.MINECRAFT_SERVER.getClass("ScoreboardTeam");
this.classNmsScoreboard = PackageType.MINECRAFT_SERVER.getClass("Scoreboard");
this.methodNmsScoreboardGetTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "getTeam", String.class); this.methodNmsScoreboardGetTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "getTeam", String.class);
this.methodNmsScoreboardAddPlayerToTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "addPlayerToTeam", String.class, String.class); this.methodNmsScoreboardAddPlayerToTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "addPlayerToTeam", String.class, String.class);
this.methodNmsScoreboardRemovePlayerFromTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "removePlayerFromTeam", String.class, String.class); this.methodNmsScoreboardRemovePlayerFromTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "removePlayerFromTeam", String.class, this.classNmsScoreboardTeam);
this.methodNmsScoreboardGetPlayerTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "getPlayerTeam", String.class); this.methodNmsScoreboardGetPlayerTeam = ReflectionUtil.getMethod(this.classNmsScoreboard, "getPlayerTeam", String.class);
this.classNmsScoreboardTeam = PackageType.MINECRAFT_SERVER.getClass("ScoreboardTeam"); this.methodNmsScoreboardTeamGetPlayerNameSet = ReflectionUtil.getMethod(this.classNmsScoreboardTeam, "getPlayerNameSet");
this.methodNmsScoreboardTeamGetPlayerNameSet = ReflectionUtil.getMethod(this.classNmsScoreboardTeam, "getPlayerNameSet");
this.classCraftScoreboard = PackageType.CRAFTBUKKIT_SCOREBOARD.getClass("CraftScoreboard");
this.classCraftScoreboard = PackageType.CRAFTBUKKIT_SCOREBOARD.getClass("CraftScoreboard"); this.classCraftTeam = PackageType.CRAFTBUKKIT_SCOREBOARD.getClass("CraftTeam");
this.classCraftTeam = PackageType.CRAFTBUKKIT_SCOREBOARD.getClass("CraftTeam"); this.constructorCraftTeam = ReflectionUtil.getConstructor(this.classCraftTeam, this.classCraftScoreboard, this.classNmsScoreboardTeam);
this.constructorCraftTeam = ReflectionUtil.getConstructor(this.classCraftTeam, this.classCraftScoreboard, this.classNmsScoreboardTeam);
}
catch (Throwable t)
{
t.printStackTrace();
throw t;
}
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -114,7 +108,10 @@ public class NmsBoard17R4 extends NmsBoard
if ( ! this.getMembersRaw(team).contains(key)) return false; if ( ! this.getMembersRaw(team).contains(key)) return false;
ReflectionUtil.invokeMethod(this.methodNmsScoreboardRemovePlayerFromTeam, handle, key, team.getName()); Object teamHandle = NmsBasics.get().getHandle(team);
ReflectionUtil.invokeMethod(this.methodNmsScoreboardRemovePlayerFromTeam, handle, key, teamHandle);
return true; return true;
} }