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.

I'm having trouble with a Plugin

I need help i'm tryning to learn MCGalaxy and tried and make a simple dice roll plugin.However when i try and load it it says line 39 and 40 i should use p.Message instead of Player.Message and I do that but then it says "Static Member "MCGalaxy.Player.Message(MCGalaxy.Player, string)" cannot be accessed with an instant reference, qualify it with a name type instead" i'm stuck.

Featured Replies

  • Author

Here's the source code:

 

using System;
using MCGalaxy;
using MCGalaxy.Commands;
 
namespace Server {
public sealed class DiceGame : Plugin {
public override string name { get { return "The Dice Game"; } }
public override string creator { get { return "PoldiB"; } }
public override string MCGalaxy_Version { get { return "1.9.3.8"; } }
 
public override void Load(bool startup) {
Command.Register(new CmdDice());
Chat.MessageGlobal("&aDice plugin succesfully loaded!");
}
 
public override void Unload(bool shutdown){
Command.Unregister(Command.Find("dice"));
Chat.MessageGlobal("&cDice plugin succesfully unloaded");
}
 
public class CmdDice : Command {
public override string name { get { return "Dice"; } }
public override string shortcut { get { return "roll"; } }
public override string type { get { return "fun"; } }
 
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
 
public override void Use(Player commandUser, string args) {
Random rnd = new Random();
int dice1 = rnd.Next(1, 6);
int dice2 = rnd.Next(1, 6);
int score = dice1 + dice2;
 
Chat.MessageGlobal(commandUser.name + "&fhas rolled &a" + dice1 + "&f and &a" + dice2 + "&f in Dice!");
Chat.MessageGlobal("&fThat's &a" + score + "&f points!");
}
 
public override void Help(Player p){
p.Message(player, "%T/dice");
p.Message(Player, "%HRoll dice.");
}
}
}
}

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.