Jump to content
View in the app

A better way to browse. Learn more.

ClassiCube Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[MCGalaxy] Can I require players register on my forum?

Can I require all users register on my forum before building.  Like setting a default password for all new players?  I could the send that upon registration.

Edited by tux_peng

Featured Replies

Yes. Using the server property "agree-to-rules-on-entry = true", you can prevent players from building or using commands before they agree to the rules. Then you can use a plugin to override the normal /rules agree behavior to require a password based on your specifications.

Here is an example plugin. You would place this inside a file called forumpass.cs in your plugins folder, then use /pcompile forumpass , /pload forumpass
 

using System;
using MCGalaxy;
using MCGalaxy.Events.PlayerEvents;
using MCGalaxy.Commands;

namespace Lol
{
    public sealed class ForumPass : Plugin 
    {
        public override string creator { get { return "Goodly"; } }
        public override string name { get { return "forumpass"; } }
        public override string MCGalaxy_Version { get { return "1.9.3.6"; } }
        
        public override void Load(bool startup) {
            OnPlayerCommandEvent.Register(OnPlayerCommand, Priority.Low);
            OnPlayerChatEvent.Register(OnPlayerChat, Priority.High);
        }
        public override void Unload(bool shutdown) {
            OnPlayerCommandEvent.Unregister(OnPlayerCommand);
            OnPlayerChatEvent.Unregister(OnPlayerChat);
        }
        
        static void OnPlayerCommand(Player p, string cmd, string args, CommandData data) {
            if (cmd.CaselessEq("rules")) {
                p.cancelcommand = true;
                if (args.CaselessEq("agree")) {
                    
                    if (!p.hasreadrules) {
                        p.Message("You must read the rules before agreeing to them. Dimb ass.");
                        return;
                    }
                    
                    if (p.agreed) {
                        p.Message("You already agreed to the rules.");
                        return;
                    }
                    
                    p.Message("To agree to the rules, you must enter /pass [pass] from your forum account.");
                    return;
                }
                p.hasreadrules = true;
                //Since we are overriding the normal rules command, you must display the rules here via p.Message
                p.Message("Rules:");
                p.Message("0. Make a forum account to play here.");
                p.Message("1. Don't make your level too difficult to join");
                p.Message("2. TODO");
                return;
            }
            
            if (cmd.CaselessEq("pass")) {
                p.cancelcommand = true;
                //the command /pass actually exists and does something else but we're going to hijack it because it is
                //one of the few commands that actually invokes OnPlayerCommand before the user has agreed to the rules
                if (p.agreed) { p.Message("You already correctly entered the password."); return; }
                
                if (!p.hasreadrules) { p.Message("&9You must read &T/Rules &9before entering the password."); return; }
                if (args.Length == 0) { p.Message("Please enter a password."); return; }
                
                if (args != GetPassword(p)) { p.Message("Incorrect password."); return; }
                
                p.Message("&6You've succesfully entered the password. Welcome!");
                Command.Find("rules").Use(p, "agree");
                return; //this return is only here in case you add other command cases below this if statement
            }
        }
        
        static string GetPassword(Player p) {
            //Modify this method for your requirements
            return p.name + "waow";
        }
        
        static void OnPlayerChat(Player p, string message) {
            // Optionally mute players who haven't entered pass yet
            //if (!p.agreed) { p.Message("&cBefore speaking, you must read /rules then agree to them with /agree."); p.cancelchat = true; }
        }
        
    }
}

If you modify the file and want to reload the plugin, use /punload forumpass , then /pcompile forumpass, then /pload forumpass

Archived

This topic is now archived and is closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.