forked from GeyserMC/Geyser
add licence header
This commit is contained in:
parent
de9c9b3dfa
commit
88a1238593
2 changed files with 29 additions and 11 deletions
|
@ -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;
|
package org.geysermc.connector.network.session.cache;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
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.AddEntityPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.BossEventPacket;
|
import com.nukkitx.protocol.bedrock.packet.BossEventPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket;
|
import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.utils.MessageUtils;
|
import org.geysermc.connector.utils.MessageUtils;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public class BossBar {
|
public class BossBar {
|
||||||
|
|
||||||
private GeyserSession session;
|
private GeyserSession session;
|
||||||
|
@ -20,16 +47,6 @@ public class BossBar {
|
||||||
private int overlay;
|
private int overlay;
|
||||||
private int darkenSky;
|
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() {
|
public void addBossBar() {
|
||||||
addBossEntity();
|
addBossEntity();
|
||||||
updateBossBar();
|
updateBossBar();
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
|
||||||
BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid());
|
BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid());
|
||||||
switch (packet.getAction()) {
|
switch (packet.getAction()) {
|
||||||
case ADD:
|
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);
|
session.getEntityCache().addBossBar(packet.getUuid(), bossBar);
|
||||||
break;
|
break;
|
||||||
case UPDATE_TITLE:
|
case UPDATE_TITLE:
|
||||||
|
|
Loading…
Reference in a new issue