Spigot/Bukkit plugin not showing up - bukkit

So this is my code:
http://pastebin.com/26vTQqrZ
And this is my plugin.yml:
name: Testing Plugin
version: 1.0.0
main: me.TechnicPR.Main
Commands:
Cameron
description: Says the best developer in the world!
But for some reason when I do /cameron It says un known command, and when I do /pl it show nothing.

You must indent your informations.
e.g
name: Name
version: 1.0
main: my.main.class
commands:
example:
description: Example command
If it's just StackOverflow, say it in the comments.
And please post your log as well.

Ok, first off you have some major issues. I don't know if you're teaching yourself or using tutorials, but I would recommend using these tutorials.
So I'll start with your plugin.yml file, as the setup for that is very specific. It should look exactly like this:
name: TestingPlugin
version: 1.0.0
main: me.TechnicPR.Main
commands:
cameron:
description: Says the best developer in the world!
usage: /<command>
These sections can be in any order; name does not have to go first, for instance. But every section must be lowercase. If it is capitalized as you had "Commands:", then it will throw an error. Also, you should always provide the "usage" section in each command. Remember to not use tabs; you must use spaces, or it will throw an error for that too.
As for your code, I first off would like to very strongly urge you to NOT put your onCommand method in your main class. You main class should only ever deal with file loading and saving, and your onEnable/onDisable methods. Having the plugin in your main class gets messy really quick, and complicates simple things.
But, whether or not you only use a Main class, you still need to register your command. Make a new method, above your onCommand method, called "onEnable()". Inside that, use
getCommand("Cameron").setExecutor(this, this);
It should look something like this:
public void onEnable(){
getCommand("Cameron").setExecutor(this, this);
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
if(cmd.getName().equalsIgnoreCase("Cameron")){
sender.sendMessage("Hello!");
}
return true;
}
Notice that the onCommand returns true. You will need to have it set to true to get a proper result.
That's not everything that should be corrected, but you seem somewhat new to this and I don't want to seem heavy-handed. ;) Hope this helped!
If you want or need more help with making commands, the above mentioned link will give you any information you will need. Request any tutorial to that guy, and He'll make it asap.

It may be that you are not setting the executor class for the command, I'm not sure if it applies to the JavaPlugin class. Try adding this to your onEnable,
getCommand("Cameron").setExecutor(this);

Related

CakePHP 3.7 Shell commands inside a plugin couldn't execute

namespace Admin\Shell;
use Cake\Console\Shell;
class AdminAlertShell extends Shell{
...
...
}
Here 'Admin' is plugin, So I created this file inside the plugins folder structure.
File path : /plugins/Admin/src/Shell/AdminAlertShell.php
Tried to run this in CLI
bin/cake admin_alert
But an exception throws
Exception: Unknown command cake admin_alert. Run cake --help to get the list of valid commands. in [localpath/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 346]
It was working. But I don't know what happened to this. I had upgraded cakephp 3.5 to 3.7. But, I am not sure this caused the issue.
I just tracked down the source of the issue in my project.
Inside my plugin there was a file: src/Plugin.php
Inside this class there was the following lines of code:
/**
* #inheritDoc
*/
public function console(CommandCollection $commands): CommandCollection
{
// Add console commands here.
return $commands;
}
This was probably generated via bake.
I saw that the parent was not called. In the path is added in the parent.
Change this method to look like this:
/**
* #inheritDoc
*/
public function console(CommandCollection $commands): CommandCollection
{
// Add console commands here.
$commands = parent::console($commands);
return $commands;
}
Now the parent is called and the path is added to the command collection.
As a side note I also see the middleware is not calling its parent.
Think it would be a good idea to fix that one aswell.
As an alternative you can just clear out the class and all defaults should be used.
Hope this saves someone the hours it cost me to figure this one out.

Integrating SDelete into C++ Program

I am trying to securely clear out a directory using SDelete. I know that this is used from the Command line, but how I would I go about automatically clearing the directory from my C++ code, also using Qt if this has a built any built in functions. I could not find anything with searching and this is my first time doing something like this. Any help would be greatly appreciated, thanks.
It is good that you're not trying to re-create the functionality of SDelete. It would be a LOT of work to do as good as a job as what SDelete does. Invoking the existing application is a wise choice.
Now, on to your question... If you want to use QT, then what you need is something like this:
QString path = QString("sdelete", QStringList() << "Bogus.txt");
QProcess sdelete;
sdelete.start( path );
sdelete.waitForFinished();
That will start the process sdelete with the parameter Bogus.txt and then wait until the application is finished.
More Info: https://doc.qt.io/archives/qt-4.8/qprocess.html#start
Edit from OP : I found that using the following worked for me with the argument being passed in being a QString.
QProcess::execute("sdelete -s path");

Aspose.PDF Triggers Breakpoint

I implemented Aspose.Cells and Aspose.PDF into our companies existing application.
While I had some trouble with this (mostly caused by the fact that I tried to implement both APIs into the exat same file which was a bad idea)
I figured out how to make it work more or less.
My Problem now is while Aspose.Cells works perfectly fine and doesn't seem to have any unusual behavior Aspose.PDF already struggles with setting the license and even when I eventually got this to work I can't even initiate a Aspose::Pdf::Document.
So the first totally unusual thing is the way I had to set the License in the Example code given with the Aspose Package and in the official resources the license is set like this.
auto lic = System::MakeObject<Aspose::Pdf::License>();
lic->SetlLicense("c:\\Foo\fooproj\\Aspose.Total.C++.lic");
This code won't run on my machine and cause the error.
Rough Translation
food.exe triggered a breakpoint
Original
food.exe Hat einen Haltepunkt ausgelöst
The same happens when I initialise a System::String with a emtpy constructor like this.
auto lic = System::MakeObject<Aspose::Pdf::License>();
System::String str;
str.FromUtf8("C:\\foo\fooproj\\Aspose.Total.C++.lic");
lic->SetLicense(str);
BUT if I initialise the System::String with an empty String in the first place setting the license seems to work just fine so this works.
auto lic = System::MakeObject<Aspose::Pdf::License>();
System::String str(u"");
str.FromUtf8("C:\\Projekte\\Aspose\\Lizens\\Aspose.Total.C++.lic");
lic->SetLicense(str);
If this code above works and I try to make an object from Aspose::Pdf::Document this will crash.
void Aspose_pdf::helloWorld()
{
auto doc = System::MakeObject<Aspose::Pdf::Document>();
.....
.....
}
I actually have no idea what's going on. I am not using any using namespace commands at the moment.
Would be greate if someone had an idea how to fix this.
Edit:
The error occures exactly in smart_ptr.h in the following function.
typename std::enable_if<!IsSmartPtr<T>::value, SmartPtr<T> >::type MakeObject(Args&&... args)
{
System::Detail::OwnNextObject ownershipSentry;
T *const object = ::new T(std::forward<Args>(args)...);
ownershipSentry.CreatedSuccessfully(object);
return SmartPtr<T>(object);
}
in the second line so T *const object = ::new T(std::forward<Args>(args)...);
is "causing" the error or atleast here the error will ne triggered.
Edit2:
Here you will find a simple example of how my code looks in general.
I Started with implementing Aspose.Pdf into my Programm so I edited my
Additional Library directories,additional dependencies, additional include directories,preprozessor definitions and my stacksize to fit these settings given in the Aspose.Pdf examples.
After this I created my Aspose_Pdf class and tested it. worked perferctly so far.
After this I made the same edits to fit Aspose.Cells aswell. Also I created a class Aspose_Cells and tested it. While this worked now my Aspose_Pdf class stoped working. After a little time passed I managed to atleast get the License Activation for Aspose_Pdf to work from this point on I had the problems described above.
Additional Dependencies:
...
Aspose.PDF_vc141x64d.lib
aspose_cpp_vc141x64d.lib
Aspose.Cells.lib
Additional Librariedirectories:
...
..\Aspose\Aspose.PDF\lib\Debug
..\Aspose\Aspose.Cells\lib64
additional Includedirectories
...
..\Aspose\Aspose.PDF\lib\Debug
..\Aspose\Aspose.PDF\include\asposecpplib
..\Aspose\Aspose.PDF\include\Aspose.Pdf.Cpp
..\Aspose\Aspose.Cells\Include
..\Aspose\Aspose.Cells\Include\icu\include
..\Aspose\Aspose.Cells\Include\boost
I've never heard about Aspose.Pdf neither I know how does System::MakeObject< work. But for me it looks that all the code might be simplified to next:
Aspose::Pdf::License^ lic = gcnew Aspose::Pdf::License();
System::String^ str = "C:\\foo\\fooproj\\Aspose.Total.C++.lic";
lic->SetLicense(str);
When it comes to Pdf.Document the initialization might look like this:
Aspose::Pdf::Document^ doc = gcnew Aspose::Pdf::Document();

Coldfusion 8 - mapping conflict causes "argument is not of interface type" error

I have been researching this, and cannot seem to find anything about it.
We work on CF8. When my coworker tried installing my latest code updates, he started seeing errors that the argument supplied to a function was not of the specified interface type. Worked fine for me. Same set up. Sometimes it works for him. Also have the problem on our dev server.
I have since been able to isolate and reproduce the problem locally.
Here is the set up.
I have 2 mappings on the server:
"webapp/" goes to c:\webroot\
"packages/" goes to c:\webroot\[domain]
Then I created an interface, call it ISubject and a component that implements it, called Person, and saved both under packages. Here is the declaration for Person:
cfcomponent implements="packages.ISubject"
Finally, there is a component, called SubjectMediator with a function, called setSubject, that wants an object of the ISubject interface type. Here is the argument declaration for setSubject:
cfargument name="subject_object" type="packages.ISubject"
To implement:
variables.person = createObject("component", "packages.Person").Init();
variables.subjectMediator = createObject("component", "packages.SubjectMediator ").Init();
variables.subjectMediator.setSubject(variables.person);
That last line throws the error that Person is not of type ISubject. If I do isInstanceOf() on Person against ISubject it validates fine.
So the reason this is happening? Dumping getMetaData(variables.person) shows me that the interface path is webapp.[domain].ISubject. And indeed, if I change the type attribute of the argument to use this path instead of packages.ISubject, all is fine again.
Coldfusion seems to be arbitrarily choosing which mapping to resolve the interface to, and then simply doing a string comparison for check the type argument?
Anyone had to contend with this? I need the webapp mapping, and I cannot change all references to "packages" to "webapp.[domain]." I also am not able in this instance to use an application-specific mapping for webapp. While any of these 3 options would circumvent the issue, I'm hoping someone has some insight...
The best I've got is to set argument type to "any" and then check isInstanceOf() inside the function... Seems like poor form.
Thanks,
Jen
Can you move the contents of the packages mapping to outside the webroot? This seems like the easiest way to fix it.

Cocoa: get path to Contents/Resources folder in cocoa bundle

I am aware of how to get a specific file from the Resources folder in cocoa, i.e. :
NSBundle* myBundle = [NSBundle mainBundle];
NSString* myImage = [myBundle pathForResource:#"Seagull" ofType:#"jpg"];
anyways, I'd like to have a simple function that gives me the path to the Resources folder so I can use it in c++ like this.
String getResourcePath()
{
return the correct path here
}
std::ofstream theFile;
theFile.open(getResourcePath()+"test.txt");
I guess I could manually combine the main bundle name with Contents/Resources, anyways I'd like to know if there is a more robust solution!
Thanks!
If you ever wonder if an Apple-provided class has a certain method, do look up Apple's own documentation before asking the question here at SO.
In this case, the answer is this method. But let me reiterate:
If you ever wonder if an Apple-provided class has a certain method, do look up Apple's own documentation before asking the question here at SO.
And, when you do so, go over all the methods in the documentation. That way, you'll learn what kind of methods are available.