Implement Scoreboard API. Adds BUKKIT-3776
This implementation facilitates the correspondence of the Bukkit Scoreboard API to the internal minecraft implementation. When the first scoreboard is loaded, the scoreboard manager will be created. It uses the newly added WeakCollection for handling plugin scoreboard references to update the respective objectives. When a scoreboard contains no more active references, it should be garbage collected. An active reference can be held by a still registered objective, team, and transitively a score for a still registered objective. An internal reference will also be kept if a player's specific scoreboard has been set, and will remain persistent until that player logs out. A player's specific scoreboard becomes the scoreboard used when determining team structure for the player's attacking damage and the player's vision. By: mbax <matt@phozop.net>
This commit is contained in:
@@ -24,7 +24,6 @@ import org.bukkit.*;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
@@ -38,6 +37,7 @@ import org.bukkit.craftbukkit.CraftSound;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.map.CraftMapView;
|
||||
import org.bukkit.craftbukkit.map.RenderData;
|
||||
import org.bukkit.craftbukkit.scoreboard.CraftScoreboard;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
@@ -50,6 +50,7 @@ import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.messaging.Messenger;
|
||||
import org.bukkit.plugin.messaging.StandardMessenger;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
@DelegateDeserialization(CraftOfflinePlayer.class)
|
||||
public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -420,6 +421,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
server.getHandle().playerFileData.save(getHandle());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void updateInventory() {
|
||||
getHandle().updateInventory(getHandle().activeContainer);
|
||||
}
|
||||
@@ -974,4 +976,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
super.resetMaxHealth();
|
||||
getHandle().triggerHealthUpdate();
|
||||
}
|
||||
|
||||
public CraftScoreboard getScoreboard() {
|
||||
return this.server.getScoreboardManager().getPlayerBoard(this);
|
||||
}
|
||||
|
||||
public void setScoreboard(Scoreboard scoreboard) {
|
||||
Validate.notNull(scoreboard, "Scoreboard cannot be null");
|
||||
this.server.getScoreboardManager().setPlayerBoard(this, scoreboard);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user