Search in sources :

Example 6 with ServerScoreboard

use of net.minecraft.scoreboard.ServerScoreboard in project kull by Sxmurai.

the class WorldServer method init.

public World init() {
    this.mapStorage = new MapStorage(this.saveHandler);
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.loadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    this.worldScoreboard = new ServerScoreboard(this.mcServer);
    ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.mapStorage.loadData(ScoreboardSaveData.class, "scoreboard");
    if (scoreboardsavedata == null) {
        scoreboardsavedata = new ScoreboardSaveData();
        this.mapStorage.setData("scoreboard", scoreboardsavedata);
    }
    scoreboardsavedata.setScoreboard(this.worldScoreboard);
    ((ServerScoreboard) this.worldScoreboard).func_96547_a(scoreboardsavedata);
    this.getWorldBorder().setCenter(this.worldInfo.getBorderCenterX(), this.worldInfo.getBorderCenterZ());
    this.getWorldBorder().setDamageAmount(this.worldInfo.getBorderDamagePerBlock());
    this.getWorldBorder().setDamageBuffer(this.worldInfo.getBorderSafeZone());
    this.getWorldBorder().setWarningDistance(this.worldInfo.getBorderWarningDistance());
    this.getWorldBorder().setWarningTime(this.worldInfo.getBorderWarningTime());
    if (this.worldInfo.getBorderLerpTime() > 0L) {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize(), this.worldInfo.getBorderLerpTarget(), this.worldInfo.getBorderLerpTime());
    } else {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize());
    }
    return this;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) ScoreboardSaveData(net.minecraft.scoreboard.ScoreboardSaveData) VillageCollection(net.minecraft.village.VillageCollection) MapStorage(net.minecraft.world.storage.MapStorage)

Example 7 with ServerScoreboard

use of net.minecraft.scoreboard.ServerScoreboard in project UtilityClient2 by Utility-Client.

the class WorldServer method init.

public World init() {
    this.mapStorage = new MapStorage(this.saveHandler);
    String s = VillageCollection.fileNameForProvider(this.provider);
    VillageCollection villagecollection = (VillageCollection) this.mapStorage.loadData(VillageCollection.class, s);
    if (villagecollection == null) {
        this.villageCollectionObj = new VillageCollection(this);
        this.mapStorage.setData(s, this.villageCollectionObj);
    } else {
        this.villageCollectionObj = villagecollection;
        this.villageCollectionObj.setWorldsForAll(this);
    }
    this.worldScoreboard = new ServerScoreboard(this.mcServer);
    ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.mapStorage.loadData(ScoreboardSaveData.class, "scoreboard");
    if (scoreboardsavedata == null) {
        scoreboardsavedata = new ScoreboardSaveData();
        this.mapStorage.setData("scoreboard", scoreboardsavedata);
    }
    scoreboardsavedata.setScoreboard(this.worldScoreboard);
    ((ServerScoreboard) this.worldScoreboard).func_96547_a(scoreboardsavedata);
    this.getWorldBorder().setCenter(this.worldInfo.getBorderCenterX(), this.worldInfo.getBorderCenterZ());
    this.getWorldBorder().setDamageAmount(this.worldInfo.getBorderDamagePerBlock());
    this.getWorldBorder().setDamageBuffer(this.worldInfo.getBorderSafeZone());
    this.getWorldBorder().setWarningDistance(this.worldInfo.getBorderWarningDistance());
    this.getWorldBorder().setWarningTime(this.worldInfo.getBorderWarningTime());
    if (this.worldInfo.getBorderLerpTime() > 0L) {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize(), this.worldInfo.getBorderLerpTarget(), this.worldInfo.getBorderLerpTime());
    } else {
        this.getWorldBorder().setTransition(this.worldInfo.getBorderSize());
    }
    return this;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) ScoreboardSaveData(net.minecraft.scoreboard.ScoreboardSaveData) VillageCollection(net.minecraft.village.VillageCollection) MapStorage(net.minecraft.world.storage.MapStorage)

Example 8 with ServerScoreboard

use of net.minecraft.scoreboard.ServerScoreboard in project LoliServer by Loli-Server.

the class CraftScoreboardManager method getNewScoreboard.

@Override
public CraftScoreboard getNewScoreboard() {
    CraftScoreboard scoreboard = new CraftScoreboard(new ServerScoreboard(server));
    scoreboards.add(scoreboard);
    return scoreboard;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard)

Example 9 with ServerScoreboard

use of net.minecraft.scoreboard.ServerScoreboard in project Magma by magmafoundation.

the class CraftScoreboardManager method setPlayerBoard.

// CraftBukkit method
public void setPlayerBoard(CraftPlayer player, org.bukkit.scoreboard.Scoreboard bukkitScoreboard) throws IllegalArgumentException {
    Validate.isTrue(bukkitScoreboard instanceof CraftScoreboard, "Cannot set player scoreboard to an unregistered Scoreboard");
    CraftScoreboard scoreboard = (CraftScoreboard) bukkitScoreboard;
    Scoreboard oldboard = getPlayerBoard(player).getHandle();
    Scoreboard newboard = scoreboard.getHandle();
    EntityPlayerMP entityplayer = player.getHandle();
    if (oldboard == newboard) {
        return;
    }
    if (scoreboard == mainScoreboard) {
        playerBoards.remove(player);
    } else {
        playerBoards.put(player, (CraftScoreboard) scoreboard);
    }
    // Old objective tracking
    HashSet<ScoreObjective> removed = new HashSet<ScoreObjective>();
    for (int i = 0; i < 3; ++i) {
        ScoreObjective scoreboardobjective = oldboard.getObjectiveInDisplaySlot(i);
        if (scoreboardobjective != null && !removed.contains(scoreboardobjective)) {
            entityplayer.connection.sendPacket(new SPacketScoreboardObjective(scoreboardobjective, 1));
            removed.add(scoreboardobjective);
        }
    }
    // Old team tracking
    Iterator<?> iterator = oldboard.getTeams().iterator();
    while (iterator.hasNext()) {
        ScorePlayerTeam scoreboardteam = (ScorePlayerTeam) iterator.next();
        entityplayer.connection.sendPacket(new SPacketTeams(scoreboardteam, 1));
    }
    // The above is the reverse of the below method.
    server.getPlayerList().sendScoreboard((ServerScoreboard) newboard, player.getHandle());
}
Also used : ScoreObjective(net.minecraft.scoreboard.ScoreObjective) SPacketTeams(net.minecraft.network.play.server.SPacketTeams) ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard) Scoreboard(net.minecraft.scoreboard.Scoreboard) SPacketScoreboardObjective(net.minecraft.network.play.server.SPacketScoreboardObjective) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ScorePlayerTeam(net.minecraft.scoreboard.ScorePlayerTeam) HashSet(java.util.HashSet)

Example 10 with ServerScoreboard

use of net.minecraft.scoreboard.ServerScoreboard in project Magma by magmafoundation.

the class CraftScoreboardManager method getNewScoreboard.

public CraftScoreboard getNewScoreboard() {
    CraftScoreboard scoreboard = new CraftScoreboard(new ServerScoreboard(server));
    scoreboards.add(scoreboard);
    return scoreboard;
}
Also used : ServerScoreboard(net.minecraft.scoreboard.ServerScoreboard)

Aggregations

ServerScoreboard (net.minecraft.scoreboard.ServerScoreboard)11 ScoreboardSaveData (net.minecraft.scoreboard.ScoreboardSaveData)6 VillageCollection (net.minecraft.village.VillageCollection)6 MapStorage (net.minecraft.world.storage.MapStorage)5 AdvancementManager (net.minecraft.advancements.AdvancementManager)3 FunctionManager (net.minecraft.advancements.FunctionManager)3 LootTableManager (net.minecraft.world.storage.loot.LootTableManager)3 File (java.io.File)2 WorldSavedDataCallableSave (net.minecraft.world.storage.WorldSavedDataCallableSave)2 HashSet (java.util.HashSet)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 SPacketScoreboardObjective (net.minecraft.network.play.server.SPacketScoreboardObjective)1 SPacketTeams (net.minecraft.network.play.server.SPacketTeams)1 ScoreObjective (net.minecraft.scoreboard.ScoreObjective)1 ScorePlayerTeam (net.minecraft.scoreboard.ScorePlayerTeam)1 Scoreboard (net.minecraft.scoreboard.Scoreboard)1