Botcraft 1.21.4
Loading...
Searching...
No Matches
ServerLinksUnstrustedEntry.hpp
Go to the documentation of this file.
1#if PROTOCOL_VERSION > 766 /* > 1.20.6 */
2#pragma once
3
6
7namespace ProtocolCraft
8{
10 {
12
15
20
22
23 GETTER(TypeId);
24 GETTER(Uri);
26
27 protected:
28 bool GetIsTypeId() const
29 {
30 return IsTypeId;
31 }
32
33 public:
34 auto& SetTypeId(const std::optional<int>& TypeId_)
35 {
36 TypeId = TypeId_;
37 IsTypeId = TypeId.has_value();
38 if (TypeId.has_value())
39 {
40 Uri = std::nullopt;
41 }
42 return *this;
43 }
44
45 auto& SetUri(const std::optional<Chat>& Uri_)
46 {
47 Uri = Uri_;
48 IsTypeId = !Uri.has_value();
49 if (Uri.has_value())
50 {
51 TypeId = std::nullopt;
52 }
53 return *this;
54 }
55 };
56}
57#endif
SERIALIZED_FIELD_WITHOUT_GETTER_SETTER(Link, std::string)
auto & SetUri(const std::optional< Chat > &Uri_)
auto & SetTypeId(const std::optional< int > &TypeId_)
DEFINE_CONDITION(HasUri, !GetIsTypeId())
SERIALIZED_FIELD_WITHOUT_GETTER_SETTER(TypeId, Internal::Conditioned< VarInt, &THIS::HasTypeId >)
SERIALIZED_FIELD_WITHOUT_GETTER_SETTER(IsTypeId, bool)
SERIALIZED_FIELD_WITHOUT_GETTER_SETTER(Uri, Internal::Conditioned< Chat, &THIS::HasUri >)
DEFINE_CONDITION(HasTypeId, GetIsTypeId())
A type wrapper to conditionally serialize a type.
Definition Templates.hpp:83