GithubHelp home page GithubHelp logo

moisterrific / serverevents Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quicm/serverevents

0.0 0.0 0.0 1.87 MB

Creates a 24hr event cycle with daily player logins, login streaks, and events to provide data

C# 100.00%

serverevents's Introduction

ServerEvents

Creates a 24hr event cycle with daily player logins, login streaks, and events to provide data

ServerEvents aims to provide a platform that other plugins can use to register events in a 24hr event cycle. It takes care of some of the basics and provides tools to allow plugin developers to add their own features. Records daily logins and login streaks Records last login time Provides a REST API endpoint for accessing the above data Allows for setting the hour and minute at which the plugin will raise its reset event (i.e., the daily server reset) Allows for registering methods to be run every x hours/minutes/seconds Allows for retrieving Login Data for any recorded user. Login Data can include: daily login status (true or false) last login time login streak (increased by successive daily logins) Allows for adding new SqlTables into the ServerEvents database Allows for reading and writing to the ServerEvents database Provides an OnPlayerLogin event which passes on Login Data Provides an OnServerReset event which is triggered once per day at the set reset hour+minute REST ServerEvents provides a REST API endpoint: /serverevents/logindata?id={value}. No token is required. {value} must be a valid user ID. Output follows the following example: Code: { "status": "200", "response": { "UserID": 1, "LastLoginDateString": "2016-01-22 07:42:58", "LoginStreak": 3, "HasLoggedIn": true } } Plugins ServerEvents is designed to be used by other plugins. The Source URL (alt) provides a link to an example plugin, but you can also access it here.

Basics: Code: ServerEventsPlugin EventsPlugin; public override void Initialize() { EventsPlugin = (ServerEventsPlugin)ServerApi.Plugins.Select(p => p.Plugin).First(plugin => plugin.Name == "Server Events"); EventsPlugin.OnPlayerLogin += EventsPlugin_OnPlayerLogin; }

public void EventsPlugin_OnPlayerLogin(TSPlayer player, LoginData loginData) { Console.WriteLine($"PLAYER {player.Name} HAS LOGIN STREAK: {loginData.LoginStreak}"); }

ServerEvents

serverevents's People

Contributors

moisterrific avatar whitexz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.