From 88a12385933d5611448506656fa3e6bb69a0ce14 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 18 Apr 2020 21:37:14 +0200 Subject: [PATCH] add licence header --- .../network/session/cache/BossBar.java | 37 ++++++++++++++----- .../java/JavaBossBarTranslator.java | 3 +- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java index 8ff2c9459..abb9016a2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2019-2020 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + package org.geysermc.connector.network.session.cache; import com.github.steveice10.mc.protocol.data.message.Message; @@ -6,9 +31,11 @@ import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.packet.AddEntityPacket; import com.nukkitx.protocol.bedrock.packet.BossEventPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; +import lombok.AllArgsConstructor; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.MessageUtils; +@AllArgsConstructor public class BossBar { private GeyserSession session; @@ -20,16 +47,6 @@ public class BossBar { private int overlay; private int darkenSky; - public BossBar(GeyserSession session, Message title, float health, int color, int overlay, int darkenSky) { - this.session = session; - this.entityId = session.getEntityCache().getNextEntityId().incrementAndGet(); - this.title = title; - this.health = health; - this.color = color; - this.overlay = overlay; - this.darkenSky = darkenSky; - } - public void addBossBar() { addBossEntity(); updateBossBar(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java index 375384d77..2c32ef6fe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java @@ -41,7 +41,8 @@ public class JavaBossBarTranslator extends PacketTranslator BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); switch (packet.getAction()) { case ADD: - bossBar = new BossBar(session, packet.getTitle(), packet.getHealth(), 0, 1, 0); + long entityId = session.getEntityCache().getNextEntityId().incrementAndGet(); + bossBar = new BossBar(session, entityId, packet.getTitle(), packet.getHealth(), 0, 1, 0); session.getEntityCache().addBossBar(packet.getUuid(), bossBar); break; case UPDATE_TITLE: