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.
This commit is contained in:
mbax
2013-03-22 17:21:33 -04:00
committed by Wesley Wolfe
parent 5634d9f701
commit d95a4705cb
15 changed files with 756 additions and 32 deletions

View File

@@ -32,8 +32,6 @@ import net.minecraft.server.EnumGamemode;
import net.minecraft.server.ExceptionWorldConflict;
import net.minecraft.server.PlayerList;
import net.minecraft.server.RecipesFurnace;
import net.minecraft.server.IProgressUpdate;
import net.minecraft.server.IWorldAccess;
import net.minecraft.server.Item;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.MobEffectList;
@@ -82,6 +80,7 @@ import org.bukkit.craftbukkit.metadata.PlayerMetadataStore;
import org.bukkit.craftbukkit.metadata.WorldMetadataStore;
import org.bukkit.craftbukkit.potion.CraftPotionBrewer;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager;
import org.bukkit.craftbukkit.updater.AutoUpdater;
import org.bukkit.craftbukkit.updater.BukkitDLUpdaterService;
import org.bukkit.craftbukkit.util.DatFileFilter;
@@ -162,6 +161,7 @@ public final class CraftServer implements Server {
private File container;
private WarningState warningState = WarningState.DEFAULT;
private final BooleanWrapper online = new BooleanWrapper();
public CraftScoreboardManager scoreboardManager;
private final class BooleanWrapper {
private boolean value = true;
@@ -1358,4 +1358,8 @@ public final class CraftServer implements Server {
public CraftItemFactory getItemFactory() {
return CraftItemFactory.instance();
}
public CraftScoreboardManager getScoreboardManager() {
return scoreboardManager;
}
}