Browse Source

Added RenX.KickDupes

Updated Jupiter version
pull/13/head
Jessica James 5 years ago
parent
commit
e72fa2486d
  1. 2
      src/Jupiter
  2. 1
      src/Plugins/RenX/CMakeLists.txt
  3. 3
      src/Plugins/RenX/RenX.KickDupes/CMakeLists.txt
  4. 58
      src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp
  5. 35
      src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h

2
src/Jupiter

@ -1 +1 @@
Subproject commit d552a20869c1a8a1b7840405325cb420d9f86ff0 Subproject commit 916d58ea1628c56e7d660c8bb711eb77dd443a30

1
src/Plugins/RenX/CMakeLists.txt

@ -19,6 +19,7 @@ add_subdirectory(RenX.ExtraLogging)
add_subdirectory(RenX.Greetings) add_subdirectory(RenX.Greetings)
add_subdirectory(RenX.HybridUUID) add_subdirectory(RenX.HybridUUID)
add_subdirectory(RenX.IRCJoin) add_subdirectory(RenX.IRCJoin)
add_subdirectory(RenX.KickDupes)
add_subdirectory(RenX.Ladder) add_subdirectory(RenX.Ladder)
add_subdirectory(RenX.Ladder.All-Time) add_subdirectory(RenX.Ladder.All-Time)
add_subdirectory(RenX.Ladder.Daily) add_subdirectory(RenX.Ladder.Daily)

3
src/Plugins/RenX/RenX.KickDupes/CMakeLists.txt

@ -0,0 +1,3 @@
add_renx_plugin(RenX.KickDupes
RenX_KickDupes.cpp
RenX_KickDupes.h)

58
src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp

@ -0,0 +1,58 @@
/**
* Copyright (C) 2020 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include "RenX_Core.h"
#include "RenX_Server.h"
#include "RenX_Functions.h"
#include "RenX_PlayerInfo.h"
#include "RenX_KickDupes.h"
using namespace Jupiter::literals;
bool RenX_KickDupesPlugin::initialize() {
return true;
}
void RenX_KickDupesPlugin::RenX_OnPlayerIdentify(RenX::Server &in_server, const RenX::PlayerInfo &in_player) {
// Safety checks
if (in_player.hwid.isEmpty()) {
// Somehow, the player's identified without any HWID. TODO: log this
return;
}
// Exempt development servers from this check
if (in_server.getGameVersion().findi("-DEV"_jrs) != Jupiter::INVALID_INDEX) {
return;
}
// Check to see if any other players on the server have the same HWID
for (auto& player : in_server.players) {
if (player.hwid == in_player.hwid && player.id != in_player.id) {
// Two players have the same HWID, but separate player IDs; kick the pre-existing player.
in_server.forceKickPlayer(player, "Ghost client detected"_jrs);
}
}
}
// Plugin instantiation and entry point.
RenX_KickDupesPlugin pluginInstance;
extern "C" JUPITER_EXPORT Jupiter::Plugin *getPlugin()
{
return &pluginInstance;
}

35
src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h

@ -0,0 +1,35 @@
/**
* Copyright (C) 2020 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Written by Jessica James <jessica.aj@outlook.com>
*/
#if !defined _RENX_KICKDUPES_H_HEADER
#define _RENX_KICKDUPES_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
#include "RenX_Plugin.h"
class RenX_KickDupesPlugin : public RenX::Plugin
{
public: // RenX_KickDupesPlugin
virtual bool initialize() override;
public: // RenX::Plugin
void RenX_OnPlayerIdentify(RenX::Server &server, const RenX::PlayerInfo &player) override;
};
#endif // _RENX_KICKDUPES_H_HEADER
Loading…
Cancel
Save