Merged branch 'howaner/Options'.
This commit is contained in:
commit
f095e770b8
@ -124,15 +124,15 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
// Check if the Plugins section exists.
|
||||
int KeyNum = a_SettingsIni.FindKey("Plugins");
|
||||
|
||||
// If it does, how many plugins are there?
|
||||
int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
|
||||
|
||||
if (KeyNum == -1)
|
||||
{
|
||||
InsertDefaultPlugins(a_SettingsIni);
|
||||
KeyNum = a_SettingsIni.FindKey("Plugins");
|
||||
}
|
||||
else if (NumPlugins > 0)
|
||||
{
|
||||
|
||||
// How many plugins are there?
|
||||
int NumPlugins = a_SettingsIni.GetNumValues(KeyNum);
|
||||
|
||||
for (int i = 0; i < NumPlugins; i++)
|
||||
{
|
||||
AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
|
||||
@ -148,6 +148,20 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove invalid plugins from the PluginMap.
|
||||
for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end();)
|
||||
{
|
||||
if (itr->second == NULL)
|
||||
{
|
||||
PluginMap::iterator thiz = itr;
|
||||
++thiz;
|
||||
m_Plugins.erase(itr);
|
||||
itr = thiz;
|
||||
continue;
|
||||
}
|
||||
++itr;
|
||||
}
|
||||
|
||||
size_t NumLoadedPlugins = GetNumPlugins();
|
||||
@ -155,13 +169,13 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
{
|
||||
LOG("-- No Plugins Loaded --");
|
||||
}
|
||||
else if (NumLoadedPlugins > 1)
|
||||
else if (NumLoadedPlugins == 1)
|
||||
{
|
||||
LOG("-- Loaded %i Plugins --", (int)NumLoadedPlugins);
|
||||
LOG("-- Loaded 1 Plugin --");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("-- Loaded 1 Plugin --");
|
||||
LOG("-- Loaded %i Plugins --", (int)NumLoadedPlugins);
|
||||
}
|
||||
CallHookPluginsLoaded();
|
||||
}
|
||||
|
@ -1972,28 +1972,17 @@ void cClientHandle::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlock
|
||||
|
||||
void cClientHandle::SendChat(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData)
|
||||
{
|
||||
bool ShouldAppendChatPrefixes = true;
|
||||
|
||||
if (GetPlayer()->GetWorld() == NULL)
|
||||
cWorld * World = GetPlayer()->GetWorld();
|
||||
if (World == NULL)
|
||||
{
|
||||
cWorld * World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName());
|
||||
World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName());
|
||||
if (World == NULL)
|
||||
{
|
||||
World = cRoot::Get()->GetDefaultWorld();
|
||||
}
|
||||
|
||||
if (!World->ShouldUseChatPrefixes())
|
||||
{
|
||||
ShouldAppendChatPrefixes = false;
|
||||
}
|
||||
}
|
||||
else if (!GetPlayer()->GetWorld()->ShouldUseChatPrefixes())
|
||||
{
|
||||
ShouldAppendChatPrefixes = false;
|
||||
}
|
||||
|
||||
AString Message = FormatMessageType(ShouldAppendChatPrefixes, a_ChatPrefix, a_AdditionalData);
|
||||
|
||||
AString Message = FormatMessageType(World->ShouldUseChatPrefixes(), a_ChatPrefix, a_AdditionalData);
|
||||
m_Protocol->SendChat(Message.append(a_Message));
|
||||
}
|
||||
|
||||
|
@ -882,7 +882,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
|
||||
m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10);
|
||||
SaveToDisk(); // Save it, yeah the world is a tough place !
|
||||
|
||||
if (a_TDI.Attacker == NULL)
|
||||
if ((a_TDI.Attacker == NULL) && m_World->ShouldBroadcastDeathMessages())
|
||||
{
|
||||
AString DamageText;
|
||||
switch (a_TDI.DamageType)
|
||||
@ -1200,11 +1200,13 @@ unsigned int cPlayer::AwardAchievement(const eStatistic a_Ach)
|
||||
}
|
||||
else
|
||||
{
|
||||
// First time, announce it
|
||||
if (m_World->ShouldBroadcastAchievementMessages())
|
||||
{
|
||||
cCompositeChat Msg;
|
||||
Msg.SetMessageType(mtSuccess);
|
||||
Msg.AddShowAchievementPart(GetName(), cStatInfo::GetName(a_Ach));
|
||||
m_World->BroadcastChat(Msg);
|
||||
}
|
||||
|
||||
// Increment the statistic
|
||||
StatValue New = m_Stats.AddValue(a_Ach);
|
||||
|
@ -153,7 +153,7 @@ bool cGroupManager::LoadGroups()
|
||||
AString Color = IniFile.GetValue(KeyName, "Color", "-");
|
||||
if ((Color != "-") && (Color.length() >= 1))
|
||||
{
|
||||
Group->SetColor(cChatColor::Delimiter + Color[0]);
|
||||
Group->SetColor(AString(cChatColor::Delimiter) + Color[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -530,6 +530,9 @@ void cWorld::Start(void)
|
||||
// If no configuration value is found, GetDimension() is written to file and the variable is written to again to ensure that cosmic rays haven't sneakily changed its value
|
||||
m_Dimension = StringToDimension(IniFile.GetValueSet("General", "Dimension", DimensionToString(GetDimension())));
|
||||
|
||||
m_BroadcastDeathMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastDeathMessages", true);
|
||||
m_BroadcastAchievementMessages = IniFile.GetValueSetB("Broadcasting", "BroadcastAchievementMessages", true);
|
||||
|
||||
// Try to find the "SpawnPosition" key and coord values in the world configuration, set the flag if found
|
||||
int KeyNum = IniFile.FindKey("SpawnPosition");
|
||||
m_IsSpawnExplicitlySet =
|
||||
|
@ -621,6 +621,10 @@ public:
|
||||
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
|
||||
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
|
||||
|
||||
bool ShouldBroadcastDeathMessages(void) const { return m_BroadcastDeathMessages; }
|
||||
bool ShouldBroadcastAchievementMessages(void) const { return m_BroadcastAchievementMessages; }
|
||||
|
||||
|
||||
AString GetNetherWorldName(void) const { return m_NetherWorldName; }
|
||||
void SetNetherWorldName(const AString & a_Name) { m_NetherWorldName = a_Name; }
|
||||
|
||||
@ -856,6 +860,9 @@ private:
|
||||
double m_SpawnY;
|
||||
double m_SpawnZ;
|
||||
|
||||
bool m_BroadcastDeathMessages;
|
||||
bool m_BroadcastAchievementMessages;
|
||||
|
||||
double m_WorldAgeSecs; // World age, in seconds. Is only incremented, cannot be set by plugins.
|
||||
double m_TimeOfDaySecs; // Time of day in seconds. Can be adjusted. Is wrapped to zero each day.
|
||||
Int64 m_WorldAge; // World age in ticks, calculated off of m_WorldAgeSecs
|
||||
|
Loading…
Reference in New Issue
Block a user