Jump to content
  • Sign Up

AllergenX

Member
  • Content Count

    14
  • Joined

  • Last visited

  • Days Won

    3

AllergenX last won the day on November 26 2024

AllergenX had the most liked content!

Community Reputation

4 Up-and-coming

Recent Profile Visitors

464 profile views
  1. Take some snack crackers, put ketchup on it. Then take a slice of pepperoni or hotdog and put it in the microwave.
  2. I think the goal here is pretty simple, I need to cancel an OnBlockChanging event. I have tried to set the variable "cancel" to true, but it doesn't seem to cancel the block being placed. Here's my code, if it is helpful: using System; using System.Collections.Generic; using System.IO; using MCGalaxy; using MCGalaxy.Events.ServerEvents; using MCGalaxy.Events.PlayerEvents; using MCGalaxy.Blocks.Extended; using BlockID = System.UInt16; using System.Reflection; using MCGalaxy.Tasks; namespace PluginAllersSurvival { public class AllersSurvival : Plugin { public override string name { get { return "AllersSurvival"; } } public override string MCGalaxy_Version { get { return "1.9.4.9"; } } public override string welcome { get { return "Thanks for using my plugin, Aller's Survival!"; } } public override string creator { get { return "AllergenX"; } } public static Dictionary<string, int> blockCounts = new Dictionary<string, int>(); // Called when this plugin is being loaded (e.g. on server startup) public override void Load(bool startup) { OnBlockChangingEvent.Register(OnBlockChanging, Priority.High); Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { blockCounts[p.DisplayName] = 0; } } // Called when this plugin is being unloaded (e.g. on server shutdown) public override void Unload(bool shutdown) { OnBlockChangingEvent.Unregister(OnBlockChanging); } public static void OnBlockChanging(Player p, ushort x, ushort y, ushort z, BlockID block, bool placing, ref bool cancel) { if (p.Level.Config.MOTD.Contains("+survival")) { if (placing == false) { blockCounts[p.DisplayName] = blockCounts[p.DisplayName] + 1; p.Message("You have " + Convert.ToString(blockCounts[p.DisplayName]) + " blocks."); } else { if (placing == true) { if (blockCounts[p.DisplayName] >= 1) { blockCounts[p.DisplayName] = blockCounts[p.DisplayName] - 1; p.Message("You have " + Convert.ToString(blockCounts[p.DisplayName]) + " blocks."); } else if (blockCounts[p.DisplayName] <= 0) { p.Message("You are out of blocks."); cancel = true; p.Message(Convert.ToString(cancel)); } } } } } // Displays help for or information about this plugin public override void Help(Player p) { p.Message("Super simple and awesome survival plugin."); } } } Yes, it messages me "You are out of blocks." and yes, it messages me "True".
  3. Fixed! Now it's // REQUIRES THE LATEST DEVELOPMENT BUILD OF MCGALAXY!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. Thank you SO MUCH! I'll definitely use these changes and info!
  5. I'd love constructive criticism on everything! This is my first plugin, so its probably not very great :) I also made them lowercase
  6. Hey there! I made a simple tone indicators plugin. All it does is it takes tone indicators like /j or /s among others, and puts a little tag, like [JOKING], in front of your chat message. You can find the source code for it here: https://github.com/AllergenStudios/MCGalaxy-Plugins/blob/main/ToneIndicators.cs Use it for whatever server you want, no credit required. If you use it on your server, it would be cool to comment your server name so I can check it out!
  7. I am trying to make a tone indicators plugin, where when people say something like '\j', it puts JOKING in their chat message But I can't figure out how to cancel events, since I don't want the player to send the chat message and instead have the server send it with the word "JOKING" in it. Here's my code incase needed: using System; using MCGalaxy; using MCGalaxy.Events.ServerEvents; using MCGalaxy.Events.PlayerEvents; namespace PluginToneIndicators { public sealed class ToneIndicators : Plugin { public override string name { get { return "ToneIndicators"; } } public override string MCGalaxy_Version { get { return "0.1"; } } public override string creator { get { return "AllergenX"; } } public override void Load(bool startup) { OnPlayerChatEvent.Register(HandlePlayerChat, Priority.High); } public override void Unload(bool shutdown) { OnPlayerChatEvent.Unregister(HandlePlayerChat); } static void HandlePlayerChat(Player p, string message) { if (message.Contains("\\j") == true) { // Cancel the event somehow // Ignore the rest of the code from this comment Chat.Message(ChatScope.Global, "&aJOKING", null, null, true); } } } }
×
×
  • Create New...