Jump to content

I am accepting plugin requests

Posted

Because I'm so bored I have decided to make plugins for people (this is totally not because Venk opened plugin requests /j). I have made several plugins in the past for both public and private use. If you are interested please reply here suggesting what you want as long as it follows the guidelines.

1. Plugins must not be for malicious use or break ClassiCube TOS.

2. A plugin that is to be requested must not already exist. If it does exist then I will simply link to the existing one. If it requires fixing up I may be able to provide a fixed version or a rewritten version.

3. The request must not be of a fully featured plugin with various features (ex: entire games, survival, physics mechanics, etc.) because I'm doing all of this for free and out of my spare time.

4. The plugin may not be for an esoteric server software or software stack. (I will only be accepting requests for servers that run MCGalaxy using either Mono or .Net 8.)

Edited by icanttellyou

Owner and founder of Good old Lava Survival, MCGalaxy plugin developer, Master of evil hacks not supported by UnknownShadow.

  • Replies 26
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • This thread is dead for a reason.

  • For your first request, I have a plugin that does that on Omegabuild. Please see https://gist.github.com/SpicyCombo/ab3da242a187f0c8c74584b250aba30e For your second request, you can take a look at htt

  • It was not compiling because the plugin is missing the using statement for the Database class. Adding the below line at the top of the file should make it work. I've updated the GitHub Gist. using MCG

Posted Images

Featured Replies

  • Author

This thread is dead for a reason.

Owner and founder of Good old Lava Survival, MCGalaxy plugin developer, Master of evil hacks not supported by UnknownShadow.

  • 10 months later...

Can you make a plugin that shows the player's XP in front of their name? Also can you add a /flair command similar to NA2's? Thanks.

Creator of the InfiniBuild server.

3 hours ago, RainZhang said:

Can you make a plugin that shows the player's XP in front of their name? Also can you add a /flair command similar to NA2's? Thanks.

For your first request, I have a plugin that does that on Omegabuild. Please see https://gist.github.com/SpicyCombo/ab3da242a187f0c8c74584b250aba30e

For your second request, you can take a look at https://github.com/cloverpepsi/MCGalaxy-stuff/blob/main/CmdShortname.cs

Former Omegabuild Staffer / Developer

13 hours ago, 75 said:

For your first request, I have a plugin that does that on Omegabuild. Please see https://gist.github.com/SpicyCombo/ab3da242a187f0c8c74584b250aba30e

For your second request, you can take a look at https://github.com/cloverpepsi/MCGalaxy-stuff/blob/main/CmdShortname.cs

When compile using mcs and linking in _MCGalaxy.dll it shows this error:

plugins/FormatPrefix.cs(48,35): error CS0103: The name `Database' does not exist in the current context

How do you fix this?

Creator of the InfiniBuild server.

44 minutes ago, RainZhang said:

When compile using mcs and linking in _MCGalaxy.dll it shows this error:

plugins/FormatPrefix.cs(48,35): error CS0103: The name `Database' does not exist in the current context

How do you fix this?

It was not compiling because the plugin is missing the using statement for the Database class. Adding the below line at the top of the file should make it work. I've updated the GitHub Gist.

using MCGalaxy.SQL;

Former Omegabuild Staffer / Developer

Do I need to change them in order to show the xp/flair?

20 hours ago, 75 said:

For your first request, I have a plugin that does that on Omegabuild. Please see https://gist.github.com/SpicyCombo/ab3da242a187f0c8c74584b250aba30e

For your second request, you can take a look at https://github.com/cloverpepsi/MCGalaxy-stuff/blob/main/CmdShortname.cs

Creator of the InfiniBuild server.

12 hours ago, RainZhang said:

Do I need to change them in order to show the xp/flair?

No. FormatPrefix adds to the player’s prefix, but Shortname changes the player’s nickname that is all

Former Omegabuild Staffer / Developer

2 minutes ago, 75 said:

No. FormatPrefix adds to the player’s prefix, but Shortname changes the player’s nickname that is all

I also noticed that when I use /xp give [code] [amount] and the player levels up FormatPrefix doesn't change the number at the beginning. I've restarted the server to no avail.

Creator of the InfiniBuild server.

1 hour ago, RainZhang said:

I also noticed that when I use /xp give [code] [amount] and the player levels up FormatPrefix doesn't change the number at the beginning. I've restarted the server to no avail.

You need to call p.SetPrefix(); in the XP plugin each time the player’s level is updated.

Former Omegabuild Staffer / Developer

How do you do that?

4 hours ago, 75 said:

You need to call p.SetPrefix(); in the XP plugin each time the player’s level is updated.

Creator of the InfiniBuild server.

2 hours ago, RainZhang said:

How do you do that?

Line 133 of XP.cs

image.png

Former Omegabuild Staffer / Developer

1 hour ago, 75 said:

Line 133 of XP.cs

image.png

It doesn't work.

Code: if (pl != null && curLevel != newLevel) p1.SetPrefix; pl.Message("You are now level &b" + newLevel);

Error: plugins/XP.cs(133,61): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

Compiled using: mcs -target:library -r:MCGalaxy_.dll -out:plugins/XP.dll plugins/XP.cs

In case you were wondering, the command was run from the MCGalaxy root folder.

Creator of the InfiniBuild server.

6 minutes ago, RainZhang said:

It doesn't work.

Code: if (pl != null && curLevel != newLevel) p1.SetPrefix; pl.Message("You are now level &b" + newLevel);

Error: plugins/XP.cs(133,61): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

Compiled using: mcs -target:library -r:MCGalaxy_.dll -out:plugins/XP.dll plugins/XP.cs

In case you were wondering, the command was run from the MCGalaxy root folder.

Please post the whole source code if what you're trying to compile

5 minutes ago, Goodly said:

Please post the whole source code if what you're trying to compile

//reference System.Core.dll


/*

You will need to replace all "secretcode" values with a random code.

- To reward XP from an external plugin/command, use 'Command.Find("XP").Use(p, "secretcode " + [player] + " [xp amount]");'

- To make it easier/harder to level up, modify the "0.02" value accordingly.


*/


using System;

using System.Collections.Generic;


using MCGalaxy;

using MCGalaxy.Commands;

using MCGalaxy.SQL;


namespace MCGalaxy

{

public class XP : Plugin

{

public override string creator { get { return "Venk"; } }

public override string MCGalaxy_Version { get { return "1.9.3.0"; } }

public override string name { get { return "XP"; } }


public override void Load(bool startup)

{

Command.Register(new CmdXP());

InitDB();

}


public override void Unload(bool shutdown)

{

Command.Unregister(Command.Find("XP"));

}


ColumnDesc[] createLevels = new ColumnDesc[] {

new ColumnDesc("Name", ColumnType.VarChar, 16),

new ColumnDesc("XP", ColumnType.Int32),

new ColumnDesc("Level", ColumnType.Int32),

};



void InitDB()

{

Database.CreateTable("Levels", createLevels);

}

}


public sealed class CmdXP : Command2

{

public override string name { get { return "XP"; } }

public override string type { get { return "economy"; } }


int GetInt(string s) { return s == "" ? 0 : int.Parse(s); }


/// <summary>

/// The amount of XP required until the player reaches the next level.

/// </summary>


int nextLevel(int userLevel)

{

return calculateLevel(userLevel + 1);

}


/// <summary>

/// Calculates the amount of XP required to reach a specific level.

/// </summary>


int calculateLevel(int level)

{

// XP = (Level / 0.02) ^ 2

return (int)(Math.Pow(level / 0.02, 2) / 100);

}


/// <summary>

/// Checks to see whether or not the player has levelled up.

/// </summary>


int checkLevelUp(int curXP, int number)

{

// level = floor((0.02 √(curXP + number)) 10)

double xp = (0.02 Math.Sqrt(curXP + number)) 10;

return (int)Math.Floor(xp);

}


/// <summary>

/// Checks to see whether or not the player has levelled down.

/// </summary>


int checkLevelDown(int curXP, int number)

{

if ((curXP - number) <= 0) return 0;


// level = floor((0.02 √(curXP + number)) 10)

double xp = (0.02 Math.Sqrt(curXP - number)) 10;

return (int)Math.Floor(xp);

}


public override void Use(Player p, string message, CommandData data)

{

p.lastCMD = "secret";


string[] args = message.SplitSpaces();


if (args[0] == "secretcode")

{

// To add XP: /xp secretcode [name] [xp]

if (args.Length < 3) { Help(p); return; }

if (PlayerInfo.FindMatchesPreferOnline(p, args[1]) == null) return;

List<string[]> rows = Database.GetRows("Levels", "Name, XP, Level", "WHERE Name=@0", args[1]);


int number = int.Parse(args[2]);


if (rows.Count == 0)

{

int curXP = 0;

int newLevel = checkLevelUp(curXP, number);


Player pl = PlayerInfo.FindExact(args[1]); // Find person receiving XP

int curLevel = 0;

if (pl != null && curLevel != newLevel) pl.Message("You are now level &b" + newLevel);

Database.AddRow("Levels", "Name, XP, Level", args[1], args[2], newLevel);

return;

}

else

{

int curXP = int.Parse(rows[0][1]); // First row, second column

int newLevel = checkLevelUp(curXP, number);


Player pl = PlayerInfo.FindExact(args[1]); // Find person receiving XP

int curLevel = GetInt(rows[0][2]);

if (pl != null && curLevel != newLevel) p1.SetPrefix; pl.Message("You are now level &b" + newLevel);


Database.UpdateRows("Levels", "XP=@1", "WHERE NAME=@0", args[1], curXP + number); // Give XP

Database.UpdateRows("Levels", "Level=@1", "WHERE NAME=@0", args[1], newLevel); // Give level

}

}


else

{

string pl = message.Length == 0 ? p.truename : args[0];

List<string[]> rows = Database.GetRows("Levels", "Name,XP,Level", "WHERE Name=@0", pl);


int userLevel = rows.Count == 0 ? 0 : int.Parse(rows[0][2]); // User level

int curXP = rows.Count == 0 ? 0 : int.Parse(rows[0][1]); // User XP


if (message.Length 0 || args[0] p.name)

{

p.Message("&eYour Information:");

}

else

{

if (PlayerInfo.FindMatchesPreferOnline(p, args[0]) == null) return;

p.Message("&b" + args[0] + "&e's Information:");

}


if (userLevel == 100)

{

p.Message("&5Level: &6" + userLevel + " (&bmax level)");

}


else

{

p.Message("&5Level: &6" + userLevel + " (&b" + curXP + "xp/" + nextLevel(userLevel) + "xp&6)");

}

}

}


public override void Help(Player p)

{

p.Message("&T/XP - &HShows your level and current XP needed to level up.");

p.Message("&T/XP [player] - &HShows [player]'s level and current XP needed to level up.");

p.Message("&T/XP [secret code] [player] [xp] - &HGives [player] XP.");

}

}

}

Edited by RainZhang
Changed it

Creator of the InfiniBuild server.

image.png

Issue is here. You accidentally typed p1 instead of pl (lowercase L). Also, SetPrefix is a method, which requires ().

Also, CURLY BRACKET MISSING WARNING!!! When you don't use { } after an if statement, it only executes the very first statement, even if you have more statements on the same line. The code you have now is about to execute like this:

image.png

As a general rule, you should just always add curly brackets. If you have more than one statement inside the if, put them both on new lines.

2 hours ago, 75 said:

Line 133 of XP.cs

image.png

It still doesn't update upon leveling up/joining.

Oh, and MCGalaxy logs yields this:

Type: SQLiteException

Source: MCGalaxy_

Message: SQL logic error

no such table: XP

Trace: at MCGalaxy.SQL.SQLiteConnection.Prepare (System.String strSql, System.String& strRemain) [0x0008a] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.SQLiteCommand.NextStatement () [0x0004b] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.SQLiteDataReader.NextResult () [0x00006] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.SQLiteCommand.ExecuteReader () [0x00012] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.IDatabaseBackend.Iterate (System.String sql, System.Object[] parameters, MCGalaxy.SQL.ReaderCallback callback) [0x00036] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.Database.Do (System.String sql, System.Boolean createDB, MCGalaxy.SQL.ReaderCallback callback, System.Object[] args) [0x00010] in <aac90df087464427b1873dde33a35dd1>:0

Creator of the InfiniBuild server.

2 hours ago, RainZhang said:

It still doesn't update upon leveling up/joining.

Oh, and MCGalaxy logs yields this:

Type: SQLiteException

Source: MCGalaxy_

Message: SQL logic error

no such table: XP

Trace: at MCGalaxy.SQL.SQLiteConnection.Prepare (System.String strSql, System.String& strRemain) [0x0008a] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.SQLiteCommand.NextStatement () [0x0004b] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.SQLiteDataReader.NextResult () [0x00006] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.SQLiteCommand.ExecuteReader () [0x00012] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.IDatabaseBackend.Iterate (System.String sql, System.Object[] parameters, MCGalaxy.SQL.ReaderCallback callback) [0x00036] in <aac90df087464427b1873dde33a35dd1>:0

at MCGalaxy.SQL.Database.Do (System.String sql, System.Boolean createDB, MCGalaxy.SQL.ReaderCallback callback, System.Object[] args) [0x00010] in <aac90df087464427b1873dde33a35dd1>:0

yeah the plugin from Venk's repo has multiple problems

image.png

It's meant to store and retrieve data from the XP database table, but instead it creates a database table named "Levels"...

Change "Levels" to "XP" should fix it

not sure if there are additional problems that you need to fix, but that's it

Former Omegabuild Staffer / Developer

You also had to add p.SetPrefix(); for when the player doesn't exist in the database. Anyways, I've also done the following for you:

  • added /XP give, /XP take, /XP code

  • at the top, I updated the usage on how to issue player XP

You can see the new version here: https://gist.github.com/SpicyCombo/dd0ec6e654e17c8462a2d8c2bb02fb88

I might also just make a pull request on Venk's repo, and the MCGalaxy-plugins repo

Former Omegabuild Staffer / Developer

Hey, as from Venk's response on the ClassiCube Discord, it was my fault earlier for asking you to change the database name from XP to Levels. I confused myself with my own plugins instead.

Please use this version of XP.cs and FormatPrefix.cs, which should help solve these problems. I apologize for the confusions!

https://gist.github.com/SpicyCombo/7c8355522042370d0dfa291e6f8653e1

Former Omegabuild Staffer / Developer

3 hours ago, 75 said:

Hey, as from Venk's response on the ClassiCube Discord, it was my fault earlier for asking you to change the database name from XP to Levels. I confused myself with my own plugins instead.

Please use this version of XP.cs and FormatPrefix.cs, which should help solve these problems. I apologize for the confusions!

https://gist.github.com/SpicyCombo/7c8355522042370d0dfa291e6f8653e1

Thanks, it works now, only problem is that you need to restart the server for it to work. Oh, and /xp shows 'Your Information', and nothing else.

Edited by RainZhang

Creator of the InfiniBuild server.

27 minutes ago, RainZhang said:

Thanks, it works now, only problem is that you need to restart the server for it to work. Oh, and /xp shows 'Your Information', and nothing else.

I deleted the last bit of code on accident. Gist has been updated again.

https://gist.github.com/SpicyCombo/7c8355522042370d0dfa291e6f8653e1

Former Omegabuild Staffer / Developer

READ THE RULES BEFORE YOU POST

Create an account or sign in to comment