I have a plugin that references a custom extension I made. So far it works fine, but whenever someone types in a chat command or when any hook is called, I get this warning message in the console. (Spams the console most times).
The custom extension I wrote runs outside of the sandbox and does things that plugins can't normally. At the same time, my plugin inherits from RustPlugin as this is how I'm responding to chat commands and rust hooks, so is there a way I can keep this functionality and not have this message be spammed in the console? Is there a way not to have oxide freak out or at least suppress this particular warning message? Any insight would be appreciated.
-Atlas
'Unable to call hook directly' warning message -- Seems to still workBug
- 1
- 2
In response to Wulf ():Your extension should be inheriting CSPlugin, not RustPlugin for its internal plugin.
Also how would other plugins besides the internal plugin be able to call functions provided by the extension without needing to be directly loaded by my extension?
In response to AtlasAttack ():When I tried this the plugin wasn't able to call things like PrintToChat or respond to chat commands...
To call methods in your extension, you'd have to add a reference to your extension in the plugin using "// Reference: Oxide.Ext.YourExtension" at the top, and then use it like you would any other C# call. You can also call parts of your extension's plugin like you would any other plugin.
What I assumed this meant was that all Plugins that referenced custom extensions had to be loaded directly from the extension itself, using pluginloader. But doing it this way meant the plugin itself wouldn't be a separate C# file like most other plugins (Including it in the plugins folder as such caused a duplicate plugin error).
In response to Wulf ():Simply adding the reference wouldn't add a reference to your extension's internal plugin, it'd only...
So when I add the //Reference to my extension I get:
"Extension is referenced by RustAlerts plugin but is not loaded! an appropriate include file needs to be saved to plugins/include/extensionname if this extension is not required"
How would I address this?
My RustPlugin:
// Reference Oxide.Ext.RustAlertsExtension
using Oxide.Core;
using Oxide.Core.Plugins;
//using Oxide.Ext.RustAlertsExtension; Commented this out to make visual studio happy
using Oxide.Ext.RustAlertsExtension.Libraries;
using Rust;
using System;
using UnityEngine;
using static Oxide.Ext.RustAlertsExtension.Libraries.RustAlert;
namespace Oxide.Plugins
{
[Info( "RustAlerts", "Atlas Incawporated", 1.1 )]
[Description( "Send server-wide alerts via global chat." )]
public class RustAlerts : RustPlugin
{
//Class implementation
}**My CS plugin
// Reference: System.Runtime
// Reference Oxide.Ext.RustAlertsExtension
using Oxide.Core.Plugins;
using Oxide.Core;
using UnityEngine;
using Oxide.Ext.RustAlertsExtension;
using RustAlertsPlugin.Logging;
using Oxide.Ext.RustAlertsExtension.Libraries;
namespace Oxide.Plugins
{
public class RustAlertsPlugin : CSPlugin
{
My Extension:
// Reference: System.Runtime
// Reference Oxide.Ext.RustAlertsExtension
using Oxide.Core;
using Oxide.Core.Extensions;
using UnityEngine;
using Oxide.Unity.Plugins;
namespace Oxide.Ext.RustAlertsExtension
{
public class RustAlertsExtension : Extension
{
}
}
Anything else or something specific you'd need to see?
The full error message I get (when starting the server) is "RustAlertsExtension is referenced by RustAlerts plugin but is not loaded! An appropriate include file needs to be saved to plugins/include/Ext.RustAlertsExtension.cs if this extension is not required."
Edit: Earlier versions of the code I posted had a typo for the // Reference part when I posted. Still giving me the same error though.
In response to Wulf ():I’d need to know exactly what you added, not an abridged version of it.
In response to Wulf ():I would need to see the exact usage you have.
Usage of what? What do you need to see I will provide it. Also I tried making a brand new test RustPlugin that references my DLL, I get the same error message when loading even that plugin. However the extension itself is loading which makes the error message even more ominous.
OnServerInitialized is called on both my internal plugin and in the logs its obvious the extension itself loads. However the second a plugin tries to reference the extension the plugin will NOT load.
Check out the test plugin I wrote :
// Reference Oxide.Ext.RustAlertsExtension
using Oxide.Ext.RustAlertsExtension.Libraries;
using Oxide.Plugins;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("TestPlugin", "Atlas Incawporated",0.1)]
public class TestPlugin : RustPlugin
{
[ChatCommand("test")]
void TestFunction(BasePlayer player) {
PrintToChat( "Test complete!", "" );
}
void Loaded() {
Debug.Log( "Test Plugin loaded -(Onloaded) called!" );
Reporter.ReportServerTime( DateTimeOffset.Now.ToUnixTimeSeconds() );
Debug.Log( "Test Plugin finished execution! -(Onloaded) called!" );
}
}
}No references to anything else, yet in the console upon loading I get:"Oxide.Ext.RustAlertsExtension
is referenced by TestPlugin but is not loaded! An appropriate include file needs to be saved to plugins/include/..(extension name) if this extension is not required."
This TestPlugin is referenced nowhere else, can you at least clarify what this error message is supposed to mean? Why does the plugin refuse to load if and only if it references an extension which is already loaded?
Merged post
Also can you point me to any examples of a RustPlugin referencing an external dll extension and not failing to load? Like I said, all of these problems went away when I loaded the plugin manually through pluginloader in the extension, but that gives me the error message I started with.
In response to Wulf ():Those are only available in specific plugin types, you'd have to create your own in extensions gener...
The TestPlugin is not used anywhere else.
- 1
- 2