Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WrapperPlayServerTitle portation to 1.17+ #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.comphenix.packetwrapper;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.CombatEventType;
import com.comphenix.protocol.wrappers.WrappedChatComponent;

public class WrapperPlayServerDeathCombatEvent extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Server.PLAYER_COMBAT_KILL;

public WrapperPlayServerDeathCombatEvent() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}

public WrapperPlayServerDeathCombatEvent(PacketContainer packet) {
super(packet, TYPE);
}

/**
* Retrieve Player ID.
*
* @return The current Player ID
*/
public int getPlayerID() {
return handle.getIntegers().read(0);
}

/**
* Set Player ID.
*
* @param value - the player's id to send the death screen to (should match client's id)
*/
public void setPlayerId(int value) {
handle.getIntegers().write(0, value);
}

/**
* Retrieve Entity ID.
*
* @return The current Entity ID
*/
public int getEntityID() {
return handle.getIntegers().read(1);
}

/**
* Set Entity ID.
*
* @param value - the killer's entity id (-1 if no obvious killer)
*/
public void setEntityId(int value) {
handle.getIntegers().write(1, value);
}

/**
* Retrieve Message.
*
* @return The current Message
*/
public WrappedChatComponent getMessage() {
return handle.getChatComponents().read(0);
}

/**
* Set Message.
*
* @param value - the message shown on the death screen
*/
public void setMessage(WrappedChatComponent value) {
handle.getChatComponents().write(0, value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.comphenix.packetwrapper;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
import com.comphenix.protocol.wrappers.WrappedChatComponent;

public class WrapperPlayServerSetTitleSubtitle extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Server.SET_SUBTITLE_TEXT;

public WrapperPlayServerSetTitleSubtitle() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}

public WrapperPlayServerSetTitleSubtitle(PacketContainer packet) {
super(packet, TYPE);
}

/**
* Retrieve Subtitle Text.
*
* @return The current Subtitle Text
*/
public WrappedChatComponent getSubtitle() {
return handle.getChatComponents().read(0);
}

/**
* Set Subtitle Text.
*
* @param value - new value
*/
public void setSubtitle(WrappedChatComponent value) {
handle.getChatComponents().write(0, value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.comphenix.packetwrapper;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
import com.comphenix.protocol.wrappers.WrappedChatComponent;

public class WrapperPlayServerSetTitleText extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Server.SET_TITLE_TEXT;

public WrapperPlayServerSetTitleText() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}

public WrapperPlayServerSetTitleText(PacketContainer packet) {
super(packet, TYPE);
}

/**
* Retrieve Title Text.
* <p>
* Notes: chat
*
* @return The current Title Text
*/
public WrappedChatComponent getTitle() {
return handle.getChatComponents().read(0);
}

/**
* Set Title Text
*
* @param value - new value.
*/
public void setTitle(WrappedChatComponent value) {
handle.getChatComponents().write(0, value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* PacketWrapper - ProtocolLib wrappers for Minecraft packets
* Copyright (C) dmulloy2 <http://dmulloy2.net>
* Copyright (C) Kristian S. Strangeland
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.comphenix.packetwrapper;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
import com.comphenix.protocol.wrappers.WrappedChatComponent;

public class WrapperPlayServerSetTitleTimes extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Server.SET_TITLES_ANIMATION;

public WrapperPlayServerSetTitleTimes() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}

public WrapperPlayServerSetTitleTimes(PacketContainer packet) {
super(packet, TYPE);
}

/**
* Retrieve Fade In.
*
* @return The current Fade In
*/
public int getFadeIn() {
return handle.getIntegers().read(0);
}

/**
* Set Fade In.
*
* @param value - new value.
*/
public void setFadeIn(int value) {
handle.getIntegers().write(0, value);
}

/**
* Retrieve Stay.
*
* @return The current Stay
*/
public int getStay() {
return handle.getIntegers().read(1);
}

/**
* Set Stay.
*
* @param value - new value.
*/
public void setStay(int value) {
handle.getIntegers().write(1, value);
}

/**
* Retrieve Fade Out.
*
* @return The current Fade Out
*/
public int getFadeOut() {
return handle.getIntegers().read(2);
}

/**
* Set Fade Out.
*
* @param value - new value.
*/
public void setFadeOut(int value) {
handle.getIntegers().write(2, value);
}
}