1.16 Bukkit plugin command with player or #a as an argument - plugins

This is my first ever plugin and I'm coding a command that can feed a certain player specified in the commands first argument how do i do this pls help
https://i.stack.imgur.com/1kjHg.png

So if you hover over the error you would get
Required type:
Player
Provided:
String
This means you are providing text, not a Player object. To do this you would need to do
import org.bukkit.Bukkit;
Player a = Bukkit.getPlayer(args[0]);

Related

How to declare an icon to show in the editor dialog?

At the very first page of the reference manual of GDScript there is a learn GDscript in x minutes with a line of code which seems to be a macro #icon("path/to.png") but that does not work on the latest version of Godot (v 3.3.stable.mono.official):
#icon minimal example
class_name Player
extends KinematicBody2D
#icon("res://icon.png")
func _ready() -> void:
pass
error
Parser Error: Parse error: Unexpected '#'
You are reading documentation for Godot 4.0 (look in the url, you want "stable" not "latest"). See also GDScript progress report: New GDScript is now merged.
In Godot 3.x to specify an script icon you do it in the class_name statement, like this:
class_name Player, "res://icon.png"
See Register scripts as classes.

Unity3D 2018 OnInspectorGUI getAssetPath not working

I've recently upgraded my Unity from 5.6 to Unity2018.4.6f1, In my project I have a script which is called "ConstantCollection", the script has an editor script (ConstantCollectionEditor) which has an OnInspectorGui override of Editor.
The method contains only these 3 lines:
ConstantCollection col = (ConstantCollection)target;
string assetPath = AssetDatabase.GetAssetPath(col).ToLower();
Debug.LogError(assetPath);
Upon creating a prefab, and attaching the ConstantCollection component to it, the code runs and prints out an empty string.
According to documentation, an empty string or null is only returned in case the asset does not exist, but obviously the asset exists.
Furthermore, this code piece was working flawlessly previous to the version update.
Can anyone shed some light on the matter?
I will add that instead of trying to get the asset path this way, I also tried extracting the guid of the object and using the utility to get path from guid, but for some reason the guid returned from the asset is "000000000000000".
After a day of fiddling around with various things I've found the reason of the issue and the solution.
First the reason -
Since I upgraded to Unity2018.4.6f1, the "prefab view" feature is added, it seems (I did not know that) that when opening a prefab with "prefab view" Unity actually creates an Instance of the prefab for the view and does not use the actual prefab, therefor when using the target in OnInspectorGUI method, it actually references an instance of the prefab and not the prefab itself.
Regarding the solution -
After roaming the unity documentation a lot and realizing that Unity refers to the prefab view as its own stage I've managed to solve the issue using the following substitution of an experimental library unity has:
This is the original implementation:
ConstantCollection col = (ConstantCollection)target;
string assetPath = AssetDatabase.GetAssetPath(col).ToLower();
Debug.LogError(assetPath);
This is the new implementation:
ConstantCollection col = (ConstantCollection)target;
string assetPath = (UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetPrefabStage(col.gameObject)).prefabAssetPath.ToLower();
Debug.LogError(assetPath);
This change locates the actual prefab from the prefab stage's instance and gets a reference to it and then you can simply fetch the asset path for it.
Hope this saves some time to people in the future.

Facebook AR Spark Studio: How to pull value from patch editor to script?

I'm trying to create a score system in a face filter with Facebook's Spark Studio.
I managed to create a counter in the patch editor and also made a script with an editable text.
Link to image
But now, how do I pull the output value from the counter in the patch editor and add reflect it into the editable text in the script?
Or if this is not the right way of creating a score system, what would be a better way?
Thank you so much for the help!
// Load in the required modules
const Scene = require('Scene');
const Diagnostics = require('Diagnostics');
const NativeUI = require('NativeUI');
// Access the text object in our scene
const text = Scene.root.find('text0');
// Change the string of the text object
NativeUI.setText('text0', 'P1score');
Use the JavaScript to Patch Bridge. Documentation and sample code can be found here: https://developers.facebook.com/docs/ar-studio/docs/visual-programming/javascript-to-patch-bridging/

go to file in eclipse by using location datatype

When clicking on a location type in the output window of eclipse, you can go to that file (location).
I would like to be able to trigger this with a method in rascal.
So to be clear, I have the location of a java method, I would like to trigger eclipse to focus on this file through rascal.
Take a look at the util::Editors module. It contains an edit function that opens any file you pass it, with the relevant editor, with optional highlights.
Note, that if you have a logical location like java+method://... you will have to lookup the actual physical location of the method in the m3 model using IO:resolveLocation, and use that. For example:
rascal>import IO;
ok
rascal>resolveLocation(|java+method:///io/usethesource/impulse/language/LanguageRegistry/IMPFileEditorMapping/setTheDefaultEditor(org.eclipse.ui.IEditorDescriptor)|)
loc: |project://impulse/src/io/usethesource/impulse/language/LanguageRegistry.java|(15638,134,<433,8>,<436,9>)
rascal>openEditor(resolveLocation(|java+method:///io/usethesource/impulse/language/LanguageRegistry/IMPFileEditorMapping/setTheDefaultEditor(org.eclipse.ui.IEditorDescriptor)|))
You are looking for openEditor in util::ValueUI.
First import util::ValueUI;, then try
openEditor(|project://rascal/src/org/rascalmpl/library/Map.rsc|);
and an editor for the Map module will open.

how to verify text present in placeholder in selenium IDE

I want to verify the text present in placeholder. I have located the element and i am using Assert text command. I've entered the same string in value. On executing it is showing actual value did not match
Use assertAttribute or verifyAttribute command.
Example:
verifyAttribute | css=#search#placeholder | Sample String
Notes:
In the Target column of Selenium IDE, you need to provide the proper path of the element followed by an # sign
and then the name of the attribute. (placeholder in your case)
Using
verifyAttibute will still continue running the test case once an
error is detected while using assertAttribute doesn't.
You need to understand that assertText function can only check static text on your webpage.
You must be getting an error message.
This is perfectly normal.
What can help in this situation is using the assertAttribute or verifyAttribute functions.
Both these functions perform the same task; the former stops the test after receiving an error message in the text box while verifyValue just records the error in the log and runs the next commands.
While giving the target, either specify the XPath or refer by using the name=name#placeholder format.
You can find the name value by inspecting the box with a firefox addon called Firepath which runs with another firefox tool called Firebug. Install them if you don't already have.
Hope this helps!
Xpath contains() is the best way.
driver.find_element_by_xpath('//input[contains(#placeholder,"email")]')
Format : '//tag[contains(#attribute,"value")]'