From 4271d719b68521f91770574b3064525512116670 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 7 Aug 2014 01:07:32 +0200 Subject: Added SetDoDaylightCycle() and IsDaylightCycleEnabled() to cWorld. I need this for a GameRule plugin. --- src/ClientHandle.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 3e046f38d..286c17513 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -342,7 +342,16 @@ void cClientHandle::Authenticate(const AString & a_Name, const AString & a_UUID, } // Send time - m_Protocol->SendTimeUpdate(World->GetWorldAge(), World->GetTimeOfDay()); + Int64 TimeOfDay = World->GetTimeOfDay(); + if (!World->IsDaylightCycleEnabled()) + { + TimeOfDay *= -1; + if (TimeOfDay == 0) + { + TimeOfDay = -1; + } + } + m_Protocol->SendTimeUpdate(World->GetWorldAge(), TimeOfDay); // Send contents of the inventory window m_Protocol->SendWholeInventory(*m_Player->GetWindow()); -- cgit v1.2.3