Handle objective value changes. Although the client *shouldn't* be using this for any sort of keying, it may indeed be. Closes #1116 awaiting testing.

This commit is contained in:
md_5 2014-07-22 20:24:15 +10:00
parent c42d3a375f
commit 1b18e64fb2
3 changed files with 13 additions and 2 deletions

View File

@ -1,11 +1,13 @@
package net.md_5.bungee.api.score; package net.md_5.bungee.api.score;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
/** /**
* Represents an objective entry. * Represents an objective entry.
*/ */
@Data @Data
@AllArgsConstructor
public class Objective public class Objective
{ {
@ -16,7 +18,7 @@ public class Objective
/** /**
* Value of the objective. * Value of the objective.
*/ */
private final String value; private String value;
/** /**
* Type; integer or hearts * Type; integer or hearts
*/ */

View File

@ -74,6 +74,11 @@ public class Scoreboard
return teams.get( name ); return teams.get( name );
} }
public Objective getObjective(String name)
{
return objectives.get( name );
}
public void removeObjective(String objectiveName) public void removeObjective(String objectiveName)
{ {
objectives.remove( objectiveName ); objectives.remove( objectiveName );

View File

@ -119,7 +119,11 @@ public class DownstreamBridge extends PacketHandler
serverScoreboard.removeObjective( objective.getName() ); serverScoreboard.removeObjective( objective.getName() );
break; break;
case 2: case 2:
// TODO: Handle this if we ever make an API Objective oldObjective = serverScoreboard.getObjective( objective.getName() );
if ( oldObjective != null )
{
oldObjective.setValue( objective.getValue() );
}
break; break;
default: default:
throw new IllegalArgumentException( "Unknown objective action: " + objective.getAction() ); throw new IllegalArgumentException( "Unknown objective action: " + objective.getAction() );