本文整理汇总了C#中MCForge.Plugin类的典型用法代码示例。如果您正苦于以下问题:C# Plugin类的具体用法?C# Plugin怎么用?C# Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Plugin类属于MCForge命名空间,在下文中一共展示了Plugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
public static void Register(Group.GroupSave method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnGroupSaveEvent(method, priority, plugin));
Organize();
}
示例2: Register
/// <summary>
/// Register this event
/// This will call the method "method" everytime this event is triggered
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
public static void Register(Player.OnPlayerConnect method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnPlayerConnectEvent(method, priority, plugin));
Organize();
}
示例3: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
public static void Register(Server.OnConsoleCommand method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnConsoleCommandEvent(method, priority, plugin));
Organize();
}
示例4: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
public static void Register(Player.BlockchangeEventHandler method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnBlockChangeEvent(method, priority, plugin));
Organize();
}
示例5: UnRegister
/// <summary>
/// UnRegister this event
/// </summary>
/// <param name="plugin">The plugin object that has this event registered</param>
public static void UnRegister(Plugin plugin)
{
if (Find(plugin) == null)
throw new Exception("This plugin doesnt have this event registered!");
else
events.Remove(Find(plugin));
}
示例6: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
/// <param name="bypass">Register more than one of the same event</param>
public static void Register(Level.OnLevelLoaded method, Priority priority, Plugin plugin, bool bypass = false)
{
if (Find(plugin) != null)
if (!bypass)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnLevelLoadedEvent(method, priority, plugin));
Organize();
}
示例7: Register
/// <summary>
/// Register this event
/// </summary>
/// <param name="method">This is the delegate that will get called when this event occurs</param>
/// <param name="priority">The priority (imporantce) of this call</param>
/// <param name="plugin">The plugin object that is registering the event</param>
/// <param name="bypass">Register more than one of the same event</param>
public static void Register(Player.OnPlayerChat method, Priority priority, Plugin plugin, bool bypass = false)
{
if (Find(plugin) != null)
if (!bypass)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnMessageRecieveEvent(method, priority, plugin));
Organize();
}
示例8: Find
/// <summary>
/// Find a event
/// </summary>
/// <param name="plugin">The plugin that registered this event</param>
/// <returns>The event</returns>
public static OnPhysicsUpdateEvent Find(Plugin plugin)
{
foreach (OnPhysicsUpdateEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}
示例9: Find
public static OnBlockChangeEvent Find(Plugin plugin)
{
foreach (OnBlockChangeEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}
示例10: Find
/// <summary>
/// Find a event
/// </summary>
/// <param name="plugin">The plugin that registered this event</param>
/// <returns>The event</returns>
public static OnConsoleCommandEvent Find(Plugin plugin)
{
foreach (OnConsoleCommandEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}
示例11: Find
/// <summary>
/// Find a event
/// </summary>
/// <param name="plugin">The plugin that registered this event</param>
/// <returns>The event</returns>
public static OnServerErrorEvent Find(Plugin plugin)
{
foreach (OnServerErrorEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}
示例12: Find
public static OnMessageRecieveEvent Find(Plugin plugin)
{
foreach (OnMessageRecieveEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}
示例13: Config
/// <summary>
/// Create a new config object
/// </summary>
/// <param name="p">The plugin that is using the config object</param>
/// <param name="c">The config type you want</param>
/// <param name="filename">The file name (DONT INCLUDE EXTENTION)</param>
public Config(Plugin p, ConfigType c, string filename)
{
this.filename = filename;
if (!Directory.Exists("plugins/" + p.name)) Directory.CreateDirectory("plugins/" + p.name);
if (!File.Exists("plugins/" + p.name + "/" + filename + ".config") && c == ConfigType.Setting) File.Create("plugins/" + p.name + "/" + filename + ".config");
if (!File.Exists("plugins/" + p.name + "/" + filename + ".file") && c == ConfigType.SaveFile) File.Create("plugins/" + p.name + "/" + filename + ".file");
this.p = p;
this.c = c;
}
示例14: Find
/// <summary>
/// Find a event
/// </summary>
/// <param name="plugin">The plugin that registered this event</param>
/// <returns>The event</returns>
public static OnLevelLoadedEvent Find(Plugin plugin)
{
foreach (OnLevelLoadedEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}
示例15: Find
public static OnPlayerChatEvent Find(Plugin plugin)
{
foreach (OnPlayerChatEvent p in events.ToArray())
{
if (p.plugin == plugin)
return p;
}
return null;
}