Jump to content

RainZhang

Member
  • Joined

  • Last visited

  1. Are you actually contributing to this or are you just quoting previous discussions?
  2. You do know that you can turn it off, right? And it's just because some devs thought it would be nice to add more features. By the way, typo check before posting. Excerpt taken from the ClassiCube Github page: | ClassiCube aims to replicate the 2009 Minecraft Classic client while offering optional enhancements to improve gameplay. ClassiCube can run on many systems, including desktop, | web, mobile, and even some consoles.
  3. Ah, it works now.
  4. Is it case-sensitive?
  5. Somehow reads like AI for some reason... Anyways, I agree.
  6. How to set the default minimum perbuild for /os maps for whole server? Thanks.
  7. How do you make TNTWars include placeable TNT but prevent the TNT from marring the landscape?
  8. My XP isn't saved on server restart and the xp prefix still doesn't work for some reason.
  9. 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.
  10. The level up still doesn't change. I'll send you the PasteBin link: https://pastebin.com/raw/53svX7Bp
  11. 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
  12. Link: https://pastebin.com/raw/CCL5swpW
  13. //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."); } } }
  14. 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.
  15. Ah, so the 'dumb' reaction will reduce the rep, right?