forked from SteamWar/SteamWar
4bea077d36
Signed-off-by: Chaoscaot <max@maxsp.de>
54 lines
1.9 KiB
Java
54 lines
1.9 KiB
Java
/*
|
|
* This file is a part of the SteamWar software.
|
|
*
|
|
* Copyright (C) 2025 SteamWar.de-Serverteam
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package de.steamwar.fightsystem.utils;
|
|
|
|
import io.papermc.paper.datacomponent.DataComponentType;
|
|
import io.papermc.paper.datacomponent.DataComponentTypes;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
public class ReflectionWrapper21 implements ReflectionWrapper {
|
|
private static final Set<DataComponentType> FORBIDDEN_TYPES = new HashSet<>();
|
|
|
|
static {
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.CUSTOM_NAME);
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.PROFILE);
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.UNBREAKABLE);
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.BLOCK_DATA);
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.BLOCKS_ATTACKS);
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.BUNDLE_CONTENTS);
|
|
FORBIDDEN_TYPES.add(DataComponentTypes.CUSTOM_MODEL_DATA);
|
|
}
|
|
|
|
@Override
|
|
public Object explosionHider(Player player, Object packet, PacketHiderFunction packetHiderFunction) {
|
|
return packet;
|
|
}
|
|
|
|
@Override
|
|
public boolean hasItems(ItemStack stack) {
|
|
FORBIDDEN_TYPES.forEach(stack::resetData);
|
|
return false;
|
|
}
|
|
}
|