Merge pull request #1275 from Howaner/BlockEntitys
Verify beacon effects sent by the client before setting them.
This commit is contained in:
commit
543b0ccf75
@ -90,6 +90,7 @@ bool cBeaconEntity::SetPrimaryEffect(cEntityEffect::eType a_Effect)
|
||||
{
|
||||
if (!IsValidEffect(a_Effect, m_BeaconLevel))
|
||||
{
|
||||
m_PrimaryEffect = cEntityEffect::effNoEffect;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -111,6 +112,7 @@ bool cBeaconEntity::SetSecondaryEffect(cEntityEffect::eType a_Effect)
|
||||
{
|
||||
if (!IsValidEffect(a_Effect, m_BeaconLevel))
|
||||
{
|
||||
m_SecondaryEffect = cEntityEffect::effNoEffect;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,22 @@ void cClientHandle::HandleBeaconSelection(const char * a_Data, size_t a_Length)
|
||||
|
||||
Window->SetSlot(*m_Player, 0, cItem());
|
||||
BeaconWindow->GetBeaconEntity()->SetPrimaryEffect(PrimaryEffect);
|
||||
|
||||
// Valid effect check. Vanilla don't check this, but we do it :)
|
||||
if (
|
||||
(SecondaryEffect == cEntityEffect::effNoEffect) ||
|
||||
(SecondaryEffect == cEntityEffect::effRegeneration) ||
|
||||
(SecondaryEffect == BeaconWindow->GetBeaconEntity()->GetPrimaryEffect())
|
||||
)
|
||||
{
|
||||
BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(SecondaryEffect);
|
||||
}
|
||||
else
|
||||
{
|
||||
BeaconWindow->GetBeaconEntity()->SetSecondaryEffect(cEntityEffect::effNoEffect);
|
||||
}
|
||||
|
||||
m_Player->CloseWindow(true);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user