#help-development
1 messages ยท Page 108 of 1
lemme just show u the full code
Campfire campfire = (Campfire) Bukkit.getWorld("birchForest").getBlockData(120, 94, -38);
campfire.setLit(true);
player.sendBlockChange(new Location(Bukkit.getWorld("birchForest"),120, 94, -38), (CraftBlockData) campfire);```
you could also send the errors
which is a lot more useful
since they tell you whats wrong
I mean i need to block every interaction that has an inventory, so as the plugin should work on 1.13, 1.14, etc, until 1.19 i need an enum with all block which contains inventory
PATIENT
alr gimme a sec
ok
If need fast support go and look for someone on services
We are not getting paid for help so just be quiet and wait patienly until someone answer/help
I mean
i thought you were one of those stupid kids that comes here & types gibberish into this channel then leaves
i had to read that like 5 times
?
I dont udnerstand your point
have you seen that mc contains items which has inventories right? So that items are diff on each version (1.13, 1.14, etc until 1.19) so i cant just loop over a Set<Material> with all that type of blocks
I'm so confused...
How come when I have brackets [ & ] in my text component the formatting works perfectly, but when I remove them it no longer allows me to reset the bold?
The [ & ] is from converting a list to a string btw
The base code I use for converting to a string and coloring everything is:
// Convert the string list to a string
private String formatHoverMessage(Player p, List<String> strList) {
String output = strList.toString().replace(", ", "&r\n&r").replace("[", "").replace("]", "");
return output;
}
// Convert string to colored Text
public Text textCompChatColor(String str) {
Text textComp = new Text(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', str), ChatColor.WHITE));
// Allow user to use & instead of the weird minecraft color codes
return textComp;
}
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.type.Campfire (org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData and org.bukkit.block.data.type.Campfire are in unnamed module of loader java.net.URLClassLoader @7aec35a)
at moody.core.commands.test.onCommand(test.java:32) ~[MoodyCore.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18-R0.1-SNAPSHOT.jar:?]
... 21 more```
just write one yourself
im pretty sure theres a function to check if a block id exists or not
He?
I dont understand what you mean
You are talking in english really closed which i cant understand
si
are u spanish?
AttributeModifier modifier = new AttributeModifier("generic.attack_damage", 0, AttributeModifier.Operation.MULTIPLY_SCALAR_1);
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modifier);``` is this the correct way to set the sword damage to 0?
yes
yeah this is already too long
nu
instead of casting to campfire try to cast to https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/Lightable.html
declaration: package: org.bukkit.block.data, interface: Lightable
can anyone help now
Lightable campfire = (Lightable) Bukkit.getWorld("birchForest").getBlockAt(120, 94, -38);
campfire.setLit(true);
player.sendBlockChange(new Location(Bukkit.getWorld("birchForest"),120, 94, -38), campfire.getMaterial().createBlockData());```
same error
what erro?
what is line 32 of test.java
uh
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
Player player = (Player) sender;
Lightable campfire = (Lightable) Bukkit.getWorld("birchForest").getBlockAt(120, 94, -38);
campfire.setLit(true);
player.sendBlockChange(new Location(Bukkit.getWorld("birchForest"),120, 94, -38), campfire.getMaterial().createBlockData());```
thats lines 32
you changed getBlockData to getBlockAt
cursed
why cant I run a method in a "onCommand" method
lmao
inside
you cant declare method
inside of another method
your code looks like
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public static void allSpawnTp(String mapName){}
}
?
no
then send your code
its like 1k lines long
only relevant part
remove dot
braindead
Ima go back to learning java basics
its ok i am also braindead
๐ค
We all are sometimes
very big L moment
error Code-18?
SystemdotoutdotprintlnparenthesisquotationmarksHello Worldquotationmarksparenthesissemicolon
nope, Bukkit.getScheduler().runTask takes BukkitRunnable but I have BukkitTask
and it runs on the next tick, I fear plugin wont exist on the next tick
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Container.html
i will just put this here idk if it helps
declaration: package: org.bukkit.block, interface: Container
do someone know why player#rayTraceBlocks() don't detect entities ?
it always return me null
Doesn't work
method getLogger in class org.bukkit.plugin.java.JavaPlugin cannot be applied to given types;
it should return null only if its not in range
what are you putting as args ?
only the range
what range
oh you originally said it doesn't work for block too
because its probably rayTraceBlocks
so it will trace blocks
So what is the difference between instantiated value and the value?
im using switch case
anyway
dont judge me please
can i use Biome in enum?
Biome is already an enum
but it dont allow me to use StringValueOf in biome
lol
Like e.getBlock()
Block block = e.getBlock();
You can get eye location with Player#getEyeLocation()
and then vector with Location#getDirection() i guess
what
I have a data.yml file in my resource folder in intelij and it compiles fine but when I run the plugin when starting the minecraft server the folder does not show up, what am I doing wrong ?
can you show your code where you write data.yml
Its a premade file, however I do work with it in a certain class, want that ? ๐ค
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
check Using custom configuration
I see what i did wrong thanks
Is there a way to get all items which are used while crafting (CraftItemEvent) except the result item ?
Either get the recipe or read the matrix
If i get the recipe i get the wrong itemstack (wrong itemmeta) or ?
What do you mean with "read the matrix" ?
The event has a getInventory() method. That will have the crafting matrix in it
or just use the recipe, if the action was to remove the result
I tried it with
CraftingInventory craftingInventory = event.getInventory();
-> craftingInventory.getContents()
But it also contains the result item.
I only need the items which are consumed after crafting for some checks e.g. custom model data.
CraftingInventory has a method getMatrix()
This is what i searched for, thanks!
"worldgen plugin"
the more you look, the worse this gets
hi, how can i add disable-world to my plugin?
"i dont wanna do this anymore."
agh i'm in pain
i'm trying to make it so that when i choose a class in my GUI it saves the username to the config.yml file but it's beeing really annoying
How are you trying to save it? It should be as simple as this.
getConfig().set("path.to.username.variable", player.getName());
saveConfig();
i can show my code in a bit, but for now, all i'm doing is trying to save the config in an eventhandler
Is it possible to block wither invulnerability particles or is it client side?
and i can't find a way to saveconfig
i can do getconfig by accessing Bukkit.getServer().spigot().getConfig()
^
"Non-static method can not be referenced from a static context
I believe that this returns the spigot.yml config file that's in the main directory, not your plugin's config.
static abuse moment
either that or by passing objects, in this case the plugin
It may help to read this wiki page about config files.
https://www.spigotmc.org/wiki/config-files/
Because that is reffering to instance method
Class#method(parameters)
yep
ok
please learn java basics before starting spigot :)
You would need to pass object instance
Cant do just Plugin.getConfig()
so i would get the plugin
right
how? i can't input more than one parameter into a event
Through the constructor.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
how do i remove these: [โIMG]
from my spigot page?
like its not in the editor
i wish i could post pictures
You just need to verify your spigot account to post images.
It's either ?verify of !verify.
in the resource description if its showing up it means it generally cant locate that image
so reupload them/new link
its not in the editor
either
Yea, broken image links. Likely doesn't exist anymore.
So you'll have to update the image link, or just remove it.
The advanced editor is all I use. ๐
Menu menu = new Menu(); hmm this breaks because i have some set paramaters in the constructor. i can't remove them because i assume that would break the executors
ong, it actually shows the link now!
i assume spending 12 hours in front of my computer isn't helping my common sense
Well... then... have you considered, I don't know, maybe, just perhaps, passing in the required parameters instead?
i should take a water break
thankyou
is there an easy way to slow down mining speed without just using mining fatigue?
the whole point of this is so that i can input the plugin into the eventhandler
packets
but you would still need to use mining fatigue a bit
Seems more like a #help-server question to me.
+1 Shadow
Oh lol sorry, I was in the wrong channel. Thanks!
i'm sorry for being rude :/ i'll just go take that water break lol
you arent giving us any information
ill check it out, thanks
aa i'm back, do you want my code?
should i put it in a pastebin or just put it right here
https://paste.md-5.net/evukucelif.java (This is my Menu.java)
https://paste.md-5.net/uvoqesehul.java (My main file (ClassSystem.java))
https://paste.md-5.net/uvodiwunos.cpp (My config.yml)
I'm trying to implement a class system that saves the player's class in the config files
Uhhhhh, I don't believe that is a valid config.yml
but as Goksi said, you should use a db
some other things of note I see
(don't mind me being dumb, but i use a sql for that right?)
Sure
sql is one of many options
I personally like postgresql, but there are much more options
and, i know my code's really unoptimized lol
a few other things I see; for getting your config in the Menu class you are getting it from Bukkit.getServer.spigot.getConfig; just use your main class .getConfig
Commands in the main class- drop the Objects.requireNonNull it's just makes it look stupid. Only reason it will be null is if it does not exist in the plugin yml.
Yaml and json are also fine for storing data. At least starting off. The problem with them comes with larger datasets. Mostly file overhead and speed vs a much faster and more optimized database.
the yellow highlights were annoying me TwT
They are both not used as data storages, its probably better to learn sql from the start
Or some kind of database, relational or not, doesn't matter
Some things I see.
- Registering listeners in the constructor of the class.
- This is only bad because if this class gets instantiated again for some reason during runtime, the entire event listener list has to be remade/recalculated.
- No break keywords in your switch statements.
- With the newer style of switch statements, you can omit them, but they are still required for the older style.
- What is this
implements ClassSystem.Variables
i don't know how to access the main class... i have been trying for 2+ hours with all the methods i learned from w3schools but nothing rlly worked
singleton
Sure, YAML isn't made for data storage, but I'm pretty sure JSON is.
oh...
Google about dependency injection or singleton pattern
OR
i'm fricking dumb
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
which you can use
as you basically have it already
you're using DI for registering listeners, all you would need to do is set a variable in said class to your main class which you got through the contructor
(rough explination, read the wiki lol)
It's not, json is made for human readable data transfer
so should i register listeners in main class?
ye
ok
still pass your plugin instance; you can use that for DI (the wiki)
spigot has no mixins and shit right?
it does not
lol
what do you mean by mixins?
then why NCR dev sent me to some page with mixins
ppl just like to be quirky and have no idea why they write it
there is ignition
????
But it is both. https://en.wikipedia.org/wiki/JSON
an open standard file format and data interchange format that uses human-readable text to store and transmit data objects
Mongo uses JSON to store data. It's more than capable of storing data reliably.
Not technically true Shadow
yes it uses Json
BUT it really uses Bson- their version of it, which saves it as binary
I won't argue over it, but here is straight from json site
i have a set of variables in my classsystem that i use to enable/disable godmode
for each player
its an array
straight from Mongo's website in regards to JSON https://www.mongodb.com/json-and-bson
whats the problem?
?
what even is this argument about
Whether or not JSON is a valid way to store data compared to a standard database.
its not argument
json is a non relational flat-file database
Does JSON get used for storing data? Yes. Is it JSON's use case? No.
sorry, but you don't know what are you talking about
Hm? prove me wrong then
this is my updated Menu.java https://paste.md-5.net/gorigejako.java
this is my updated ClassSystem.java https://paste.md-5.net/acewujoril.java
i mean, using that logic, you can use txt for saving data
I mean... you can.
And?
i mean i'm gonna use sql, it's really good to learn
that's pretty much wrong
for like website databases
nothing, do what you want ๐
json and yml are specifically made for storing data
i was just using config.yml's cuz i forgot i could use sqls
dude you must be trolling
ยฏ_(ใ)_/ยฏ
Using the built in config is fine. If you wanted to make it a little more advanced, you could make a per-player file system and only load players when they join, but at a certain point, you would want your end users to switch to a database.
Files are fine to start off with. Nothing wrong with it. However, if you have a large amount of players/data of players, then a database is the better choice.
and seeing this, https://github.com/Goksi/PteroGUI/blob/master/src/main/java/tech/goksi/pterogui/apps/MainWindow.java
i dont think you really know what you;re doing either
ah, so you said that that isn't a valid config.yml file, how would i make it valid?
?
No need to be rude, just pointing some things out ๐
I don't see how am I rude
Well, if you are just storing player names in a list. You could make your structure something like this.
class:
rogue:
- "UUID1"
- "UUID2"
- "UUID3"
warrior:
- "UUID1"
- "UUID2"
- "UUID3"
#etc, etc
simply saying that you're in no place to say that people have no idea about what theyre doing, when you're not in that high of a level yourself
hmmm, why storing uuid's instead of names?
Because player names can change.
players can change their account names
UUIDs cannot.
ohhh yeah
yes
thanks
๐
I would like you to point me out how can i improve my code
my dms are open :3
I will just do it here anyways
well first off, why use init
when you can just use a constructor and make your variablles final
so would i put filler just like that in those or just keep the text blank OR just put nothing in them
Wdym? You would just add the player's UUID to the proper list when they choose their class.
Alternatively, you could save yourself some hassle and instead of saving player UUID's per class. Save the class per player UUID.
Because that code might be ran again without reinitailizing object ๐
String pName = ("" + pUUID); i'm assuming this is a really bad way of doing it?
so you're abusing mutability?
^
UUID#toString()
why is it abusing ? ๐ค
I believe that #toString() is something available for every object. So you can use it on nearly everything.
and plus, it cant be ran again without initializing another object anyways
since it's non static
so my config file looks like this right now, is this good?
rogue:
warrior:
scout:
mage:
cleric:```
I like it this way, any more suggestions ๐ค
Yes, that should be fine, but if you wanted it be a proper empty list, you would do this.
class:
rogue: []
warrior: []
scout: []
mage: []
cleric: []
I don't think that it's 100% necessary when using Spigot's API, but if you were using another YAML interpreter, then you would need to be specific like this.
the next thing is somewhat opinionated, but a good thing to know
{} represents a map. [] represents a list.
u should not have a public method that isnt being inherited
same as using json for data storage, its not meant like that, but it works ๐ค
since an object working without a contract is impossible to mock in a unit test. Second, a contract-less object is impossible to extend via decoration
what
from elegant objects principles
what
seven virtues of a good object
Who is that properly designed object in an object-oriented world? What name, behavior, habits, interfaces, and friends does he have? Let's look at it from a different perspective.
when i run /menu in minecraft it just says "/menu" in chat
would you mind explaning further
there are no errors
how would i able to access that method if its outside of package
You likely return false in your command. So maybe some of your if statement conditions aren't being met.
Who is that properly designed object in an object-oriented world? What name, behavior, habits, interfaces, and friends does he have? Let's look at it from a different perspective.
read this
it isnt that long
every object should work by contract
meaning that no matter what the object is, as long as it abides by a certain contract, you can use it
in simple terms
dont be racist with objects!
it must be in my Menu.java then, i'll look through it for a bit, if u want u can too
this is badly named as well
I still dont understaind ๐ค
it's pretty simple
So explain please ๐
"The rule here is simple: every public method in a good object should implement his counterpart from an interface. If your object has public methods that are not inherited from any interface, he is badly designed."
hm lemme try something
Oh, it looks like you haven't registered your command. You may have put it in the plugin.yml, but you still need to register it in your onEnable() method.
oh
wait
thanks so much LOL
i assumed this.getServer().getPluginManager().registerEvents(new Menu(this), this); this would register it lmfao
I see no reason to have Impl class
or interface if it would implement just one class
and in here
https://github.com/Goksi/PteroGUI/blob/master/src/main/java/tech/goksi/pterogui/data/Data.java
you're not caching things, and calling get() everytime
it shouldn't cache
it runs just on program startup
you never know how ur project will expand
this.getServer().getPluginManager().registerEvents(new Menu(this), this);```
fixed it i think
yap
yeah and the class name should be changed too
"Data" is too vague, it's almost an interface
to what ?
will refactor if i get reason to ๐
hahaha i'm not funny twt
that's hard to maintain for larger projects
unscalable
Its not larger project, just small thingy to help me manage servers
so i really see no reason to have Impl classes
i don't need any type of abstraction here
I mean if you're not planning to maintain it
error when i click something pain https://paste.md-5.net/eyahedoref.sql
then yeah
also i would like to hear your suggestion for this
oh wait i don't think i set up the saveDefaultConfig();
im not sure what your project even does, but a concrete class shouldnt be called "Data"
Its holding all nececery data that should be persistent after restart of application
You may also have an outdated config. Make sure to delete the config in your plugin's data folder when you update it in your project.
oh good idea
so i really can't think of any other name ๐ค
what data is it of
app url, api key
no thanks ๐
sure
no problem
well that's it for that project i guess
like if i have something like server:custom.yes how would i play it
You just need to add your sounds to the proper path, setup the accompanying json file and then you can call it using the custom namespace you gave it.
Here you'll learn how to add and configure custom sounds or replace default sounds in a Minecraft resource pack.
whats the difference between ItemStack#getenchants and Itemstack#getItemmeta#getenchants
ik how to add them, just not play via playSound
Like, with spigot code or the vanilla command? Cause the vanilla command uses the namespace you set.
/playsound customsound:example.path.to.sound neutral @s ~ ~ ~ 1 1
If you want the spigot alternative, it looks like you need to use #playSound() and pass in the namespaced path as a string.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#playSound(org.bukkit.Location,java.lang.String,float,float)
hi. i wanted to develop my next simple plugin in 1.19.2 but i get error for commands: unknown or incomplete command
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length > 1) {
if (args[0].equals("enable")) {
Tough.isEnabled = true;
}
}
}
i also get warnings about notnull/nullable in intellij
Can you send a screenshot of the error?
You kinda have to. Block hardness isn't something accessible via the API, so you are left with NMS.
i think im not allowed to share images here
Unknown or incomplete command, see below for error
You can if you're verified. Otherwise, you have to share image links.
getCommand(ToughCommand.COMMAND).setExecutor(new ToughCommand());
this is how i register the command
I am making a GUI with which you can change the look of my plugins text. What block do you think represents the italic font type the best?
my plugin.yml looks like: commands:
commands: tough enable: description: Enables the plugin usage: /<command> tough disable: description: Disables the plugin usage: /<command> tough cure: description: Cures the player usage: /<command>
dont need nms last time I checked
stick
or iron bar
cuz the symbol is an I
Never knew those events existed. That's crazy.
Ok thank a lot i really searching one for a long time
Ah, there's your problem. Your commands section is meant to only house the base command. Then your command executor is what handles the subcommands. (enable, disable, cure)
thanks! i will try
it is still same ๐ฆ it behaves like the command is not registered
so i get the same error if i use a random command that doesnt really exist
Integer.MAX_VALUE?
that 2 is the tick length
What's the string that you set in your #getCommand() registration?
it keeps saying i'm not a mage even tho in the config files i am one https://paste.md-5.net/goqilumema.java
show config
๐
i gotta put class.mage instead of mage
also just some friendly advice. this is probably not the best way to store this information
config?
i'm just starting to learn this and am gonna reimplement it in sql when i get a better understanding
its much better in my opinion to save data per player for example
uuid:
class: mage
this way you dont have 5 different lists
๐
then again i either would not save data in yml at all. but as you said ur reimplementing in sql so thats good
yea ty
uhhhhhhh
its almost done, trust
LMFAO
wait nope its still not working
alright then show your current code & config
ok
https://paste.md-5.net/nagezibaki.java // code for the function
rogue:
warrior:
scout:
mage:
cleric:```
defaults for the yml
ok and whats it looking like where ur testing
it says in chat "You are not a mage"
and the config looks like this:```class:
Rogue: []
Mage:
- 38387f3b-0edb-4d38-a5e5-4413e3769bdd
Scout: []
Warrior: []
Cleric: []
Mage is capital M there
oh
in ur code its not
Use a database ๐ญ
i'm learning how to rn
Good. Way better than configs
Is this event called when the player is already, phisically in the new server?
well on the java doc is does say Called when a player has **changed** servers.
so i would assume so
Always go with how the javadoc is worded. If its wrong complain
^ ๐
Hi i was wondering if someone could help. I want to make a plugin that allows players to rename items using a command but i was it to mimic the normal cost to rename the item that is being held
is there a way to do this?
if you look up how the cost is calculated. sure it is
store a hash of them
I believe it's just 1 level for rename
sha1
it's only one mysql password tho
oh i thought u meant hashmap i'm stupid
at some point those can become "too expensive" too no?
if you need the password you can;t store a hash, you need the password
if you only want to validate they entered teh correct password you store a hash/sha1
That message happens if cost is more than 40 levels. Don't think that can happen if it's just rename
no like
storing the mysql account password
so @warm saddle simply take 1 level from the player and rename the item
okay then
any effort you make to encrypt it, they can just look at your code to see how you extract it
ig
it isn't always 1 level is it?
your MySQL server should be same machine or at least on teh same network protected by a firewall
but what if the item has been previously enchanted
but how come when i've tested in an anvil it can be up to like 30 levels?
yeah so i just tested and it wasn't just 1
Ah yeah that says in addition to any prior work penalty
yea @warm saddle you were right. it does add the past penalty
yes its worded rlly weird
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/Repairable.html#getRepairCost()
^
Use this and add 1
declaration: package: org.bukkit.inventory.meta, interface: Repairable
ok so i have now run into a different issue where when comparing if the player has enough exp to do the rename, its always saying that the player doesn't have enough exp
i probably know whats going wrong. but show us some code
here is the bit that is comparing the exp to the cost```java
float cost = getRepairCost(player, meta);
if (player.getExp() < cost) {
player.sendMessage(PREFIX + "You do not have enough experience to rename this item. Required Experience: " + cost);
return;
}``` here is the getRepairCost() method
private static float getRepairCost(Player player, ItemMeta meta) {
float cost = 1;
if(player.getGameMode().equals(GameMode.CREATIVE) || player.getGameMode().equals(GameMode.SPECTATOR))
return 0;
else if(meta instanceof Repairable repairable) {
cost = repairable.getRepairCost() + 1;
return Math.min(cost, maximumRepairCost);
}
return cost;
}```
did you check what getRepairCost returns?
Use getLevel instead of getExp
also mind getExp gets the progress towards the next level
Also if you want it to be like vanilla instead of using a math min it should just fail if cost is too high
also the way you're doing it right now it always adds 2 levels to rename instead of 1
Ok that has fixed the issue, thank you guys so much for your help :D
which is the best way to create a delay? I have tried runtakslatter but i use external variables and doesn't work
?scheduling
plugin is null
For loop from 0 to size of inv. Check if each slot has something, if not set it to glass
how, i followed the instructions
you are passing a plugin field which you never set. plugin field is null
at teh top of that class you created a field YourPluginClass plugin; You never initialized it.
thanks, how do you detect the error
i just realized that runtaskslater delay the task but they are stacking on my code so everything occurs at the same time, how can i make the code to wait instead of delaying the task
I've been getting this error. As far as I can tell its a error with ProtocolLib and I haven't been able to figure out how to fix it. Yes ProtocolLib is listed as a dependency in my plugin.yml. https://pastebin.com/NKFm3t0N
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
wrong plib version
Or you are shading in plib
which you should not
I've been asked about that before and they had me show them my pom.xml and such and they said that I am NOT shading it into my jar.
And the server has it? And you depend on it in your config?
- spigot version
- plib version
- pom.xml
- How do you compile
1.19, protocol lib dev version 600(latest), I compile using the Maven Package in IntelliJ
how would i do this? what's the default config.yml?
and how do i add the uuid
Open the compiled jar and see if you have a com.comphenix.protocol package in it.
Jars are just zip files basically. So 7zip or winrar will do.
using YamlConfiguration#set
default will just be empty
no
1 second let me type up an example
Download the latest plib version (5.0.0) and place it into your server. The server might be running an outdated version.
I did
for example
FileConfiguration conf = getConfig();
UUID uuid ...;
conf.set(uuid.toString() + ".class", "mage");
if you were to do in your main class
this would result in
uuid:
class: "mage"
yea. or any placeholder
Well we are running out of possibilities here.
If you hop on your server and get the enabled plugins + their
version, what do you see?
aka /protocol version
I looked at my server logs and it shows ProtocolLib v5.0.0-SNAPSHOT-b600, the other plugin is luckperms(used for other purposes)
thanks so much, you're a lifesaver
/protocol versionand show the output

dmulloy2 and Comphenix
Issues: https://github.com/dmulloy2/ProtocolLib/issues```
Then the only other possibility is you shading plib into your plugin
Send a whole server log
agh how do i stop it complaigning aobut reassigned local variable, i know i'm reassigning it that's the whole point
Tell me which button you press or which command you type into terminal in order to compile your plugin
On the right side I click maven then I click lifecycle and then package.
in Intelij IDEA
could you show me the code?
its complaigning about string playerclass = null on line 41 and then when i change it in each of the cases
i don't think i care about it
its not gonna give me an error... right?
oh yeah
Then do a clean and afterwards install.
Also make sure that this problem only occurs when your plugin is enabled.
There is not much else that could be wrong. Its either a missing/wrong plib version (which we excluded)
or some plugin is shading in plib. Nothing else can cause this behavior (besides a nasty exception in a static block inside plib)
still complaining after the default case
its not giving me an error in the build tho so i think its fine
its just gray right?
should be fine
i like how you keep notes in your code to remind you of stuff haha
That would be uninstalling and reinstalling intelliJ right? or are you meaning maven or?
I want to clarify before I go screwing things over
writing stuff down helps me remember
maven
in terminal its just
mvn clean install
At line:1 char:1
+ mvn clean install
+ ~~~
+ CategoryInfo : ObjectNotFound: (mvn:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException```
Would this be caused by me being in the wrong location to run this? I got this error when I ran that command in the terminal.
This is caused by maven not being installed on your pc
Would it matter if the location of the project is not on my pc(stored on a separate file server) but edited from my pc?
^
Is it possible to check if a vector intercepts a block?
That sounds like a bad idea... But the os should see the files as local files meaning if you install maven then you should be fine.
nevermind looks like raycasting is right for me
Yes
You just want to get the block a player is looking at?
Whats your use case
Check if there is a block between a tnt explosion and the block it explodes
So I can protect blocks behind other blocks
Would I be installing maven using cmd or just like googling maven?
Actually would any of these work?
Isnt that already how vanilla explosions work?
Im cancelling a block from exploding, and I want all blocks behind it to also not explode
Ah i see
Just google install maven
So I installed Maven. What do I do now?
Probably want to restart your ide and try the commands you wanted to run before
Well the cmd's worked but the main goal(fixing the error) was not achieved(I still get the error mentioned in the message I replied to just now)
when was the feature added to be able to send an actionbar without nms
Anyone know how/why this is happening?
https://pneumonoultramicroscopicsilicovolcanoconiosis.club/3cpa34g8
are you trying to process something async and you shouldn't
Or you're looping an iterator without checking hasNext
A long time ago. If you have to ask this then your version is way too old.
probably
i am checking
oh yea im doing it in a lambda
agh
How can I run it in a for loop? I want to do it for multiple blocks.
a lambda is fine, if you loop over checking it hasNext
idk why its called blocksToAdd but
you are calling .next twice in the loop
Hey guys, is the only way to execute code after an event is completed by using tasks/runnables? I feel like just delaying a task a couple ticks so the event is completed is really hacky and there is no guarantee that the event is complete by then
I haven't found much on the net other than people suggesting runnables
yes
The event finishes once the event exits. 1 tick
the actions of some events will not be seen immediately
Hey I need some help with this https://github.com/KyTDK/NeoUtils/tree/master/api/src/main/java/com/neomechanical/neoutils/bungeecord
?details
Please provide your server version, relevant server logs ( https://paste.md-5.net/ ), a list of plugins, and what you've already tried doing.
I want maven for complier plugin
I want to send a plugin message with a method that returns a callback
Okay, I had a feeling that would be the case. I'll have to play around with it
Thanks
rude I was still typing
Google your question before asking it:
https://www.google.com/
There is no callback on plugin messaging
What search
fucking beautiful
also how do I make people interested in contributing to my open projects?
- Money
- Project has to have a large following/userbase.
- Get lucky with some god tier programmer who's bored out of their mind.
@lost matrix nice. Please fix red the sub-channel should be read.
Is it cool if I copy some of that code for my project, I'll put your socials and stuff in the code so people known where it came from
I'm bumping this as despite a lot of attempts to help from others this issue still hasn't been solved.
Can you set a villagers target on a zombie, so that it will not run away from the zombie?
what protocol lib version you using
Well, something is outdated. Either the version of ProtocolLib you are using is too old, or the plugin is using an older version of the API that doesn't exist in newer versions. It's most likely the former though.
Latest dev version. Also you can see everything we tried by going up to that message and following the trace of replies between myself and 7smile7
According to my IDE nothing seems out of date. I also sent this over to ProtocolLib's dev and all they've said is to add ProtocolLib as a dependency in my plugin.yml(which I did and let them know and they just have stopped responding(this was over a week ago)).
thats strange you have covered all bases
Well, your IDE likely won't tell you if something is out of date as it has no context for what out of date means. The best it can do is tell you that your dependencies are outdated and newer ones are available, but even that is limited to certain build tools. I'd check to see if your plugin is depending on the latest version of the API available and if so, try recompiling and load it up again. Who knows, maybe it just needs a refreshed jar or something. Restarts are weird sometimes.
I've tried that 7 or 8 times now
wait
if you're depending on it, wouldn't it say could not find depdendency etc in console
rather than a noclassdef error
The plugin is their.
can i see your plugin.yml
wait no you did that already
dang
have you tried running the plugin on a diff server environment
Also for some odd reason whether the protocollib plugin is their or not I get the same error... Also other thing I didn't send my plugin.yml so here it is
drop your plugin jar in here
Tried both
yeah I'd be down to run your plugin if you want
Can you share your pom as well?
see if it happens on my end aswell
Pom is shared earlier in the convo if you follow my original message
Aight
That jar is missing the depend section in the plugin.yml
put depend at the top of my plugin.yml file?
yeah
So, why do you have the shade plugin if you aren't shading anything in your project?
Likely it was added as a default. I never added a "shade" plugin.
Well, I'd remove it since it's not needed anyways.
lol bug in latest build of paper. it creates a file called plugins instead of a folder ๐ฆ
Would you point out to me where that is. I think I know but I haven't used the "shade" plugin so I don't know exactly what to remove.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
The second one in that section of that pom.
This is a new compiled version of the plugin with the depend placed at the top of the plugin.yml
you're shading minimessage
Also it still gave same issue.
Also, you should add a defaultGoal to your build so you don't have to run maven commands manually.
on a callback return, can I somehow return that callback in the method it is in or convert it to a completable future and return that? So instead of executing all the code in a callback I would use a variable as a placeholder that could have the return result.
same deal
Sorry if I seem stupid but I don't know exactly what that means
your depend isnt in the compiled jar
<build>
<defaultGoal>clean package</defaultGoal>
</build>
Doesn't that wipe my target folder each time? Part of the reason why I change the version each time I compile it is so that I can keep previous versions(I can't get github to work) when I last ran that it wiped all the previous versions that were saved their.
why cant you get github working lol
I use a network drive to store most of the things I work on and github doesn't like it for some reason. I've tried a bunch of stuff and non of it has worked. Also reason for network drive is so that I can work on my stuff when I'm not at my computer(or can't use my pc)
@mighty aurora you have protocollib imports/fields in yrou main class.
yeah... why?(why is that relevant)
I'm betting it's trying to instance them before the classloading is done
That would be inconsistent with how other plugins load would it not?
you have a depend which means spigot will not try to LOAD your plugin before Protocollib but it will be instanced
or it MAY be instanced before Plib
you should not reference anythign plib before onEnable
Another thing(don't know how relevant it is) the plugin has the error regardless of whether ProtocolLib is on the server or not.
yes, you are being instanced before plib
move all plib code out of your main, and init it when you get to onEnable
The only things that are located above my onEnable function are variable definitions.
fix your depend loading in your plugin.yml
i guarantee you it's just loading before protocollib
how?
spaces are fine. they will be ignored
ah
yeah, no depend line
put it in the right order aswell
Also it is being loaded prior to PLib
I just checked
yeah thats most definitely the reason
depend, name, version, main, api-ver
that order
yep, it works for me with the depend
I'd still not have anything plib in my main though
I try not to reference any other plugins in my main plugin class
This is what my plugin.yml file looks like. Is their anything wrong?
no
So then why wouldn't it be compiling
what? a plugin.yml will not prevent compiling
I was meaning why wouldn't the depend part not be compiling
you didn;t do a clean package
I think you are copying the wrong jar. If you haven't been cleaning out your build folders, then you have a potential chance to grab the wrong one.
if you really need copies of jars just move it to another folder
and your ide didn't pick up the change to the plugin.yml because you didn't hit F5 after editing it
^ to build folders. Your jar should be found in the target folder
So I need to draw a vector from one location to another and check if there is a specific block in between
Anyone know how I would go about doing this?
rayTraceBlocks
Do you know of any resources that can help me?
thanks
to get a Vector from two locations java Vector vector = endLoc.toVector().subtract(startLoc.toVector());
I know I am copying the correct version because I change it each time and ensure I grab the latest.
is it possible to make text display just above the players hotbar? i want to send actionbar type messages so a player can see them from a gui
just run mvn clean package
with a resourcepack, yes
why not just send an actionbar message?
shows up way above the playes hotbar
You know you can see actionbar messages just fine outside of the GUI if your GUI scale is set to anything other than the default.
The GUI Scale option in your video settings.
ah but id rather not rly do that since not everyone would
I mean, I only know one person who uses the default GUI scale of 4, but everyone else I know uses a GUI scale of 2. However, I understand wanting to support those who refuse to change their settings.
But, yea. That does leave you with resource packs as your only real option.
adding a newline wouldnt move it down?
no, only resourcepacks
Nope. The actionbar text is a oneliner fixed position. You would need to modify the location of the message, which can only be done with resourcepacks.
ah thats anoying :/
how can i delay the code to occur?
?scheduling
yea i tried that but that delay the task and the tasks get stacked
Sounds like you're doing something wrong then.
If that's not what you wanted to happen anyways.
i used runtasklatter on a for where every cycle the parameters change but when i test it everything occurs after 5 seconds as i establish but the tasks get stacked
show your code
?paste
wheres the runnable
i deleted it because doesn't worked
im asking for the code with the code that wasnt working
Can you cast a uuid to a player?
Bukkit.getPlayer(uuid)
No, but you can use a UUID to get a player object. Bukkit#getPlayer(uuid)
not casting, use uuid to get the player
what happend is that i'm seaching for an alternative for the scheduler something lige thread.sleep, that worked but the server clashed
So this should get me the player which I can for example teleport to somewhere?
yep
Never sleep the main thread. Scheduling is the correct way to do it
just use scheduling, and write it correctly
thats why im asking for your scheduling code so we can see what you did wrong and help
I believe this was related to the conversation we were having. I tried this and it did absolutely nothing. It still doesn't contain the depend in the plugin.yml despite doing that.
here is the code: https://paste.md-5.net/ezavibozec.cs
well its using some old cache somewhere, its hard to tell
this code schedules every task to run at the same time
1 second later
thats gonna run a lot of times
i wanna make a cube increase on the past of time
then only schedule the blockUnder.getRelative(x, y, z).setType(Material.NETHERRACK); line
increasing each time
ah you want a full cube to grow each time
yes
So how would I fix that?
sorry if i'm not expressing well because i speak spanish, but what the code does is to generate a bigger cube every cycle and i wanna create a delay beetween does cycles
basically each iteration of the while loop you need to multiple 20L by that count
first iteration 20L * 1
second iteration 20L * 2
20 is the time or not
yes
but its teh time from This code execution
20L = 1 second (about)
so you make each task run later and later by multiplying 20L
the time is always the same
yes, increase it
Does anyone know how to fix the issue mentioned in the message I'm replying to? Cause I certainly don't(Also Sorry Buoobuoo I wasn't gonna ping you but i misclicked)
Can someone tell me if this should work compile times are very long java public static Future<byte[]> send(String channel, String message) { Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null); ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF(channel); out.writeUTF(message); player.sendPluginMessage(NeoUtils.getInstance(), "BungeeCord", out.toByteArray()); CompletableFuture<byte[]> future = new CompletableFuture<>(); NeoUtils.getInstance().getBungeeCord().getPluginMessageBroker().request(player, channel, (rec, msg) -> future.complete(msg)); return future; }
request returns a callback (we know the callback works)
how tf am I meant to read the error when its spamming it!
https://pneumonoultramicroscopicsilicovolcanoconiosis.club/0LARAlVx
This line throws a NPE when it damages a player. Works fine when no player is nearby. 1.8.9 dont judge.
paste the full error
and don't code tease, send full in pastebin
here you go https://pastebin.com/CZgTpCvB
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
at me.gtx.bedwars.twist.Boom.projectileHit(Boom.java:96)
loc.getWorld().createExplosion(e.getEntity().getLocation(), 2L, false);
that is line 96 in Boom.java?
yea
thats weird
impossible
thats seriously impossible
Maybe its a SportPaper error
is it possible that the world is somehow not registered?
Its used tons of other times
line 10 in your paste will throw an error though
line 9 you call e.getEntity().remove(). You then use e.getEntity in line 10
that is your npe
Nope
Still erroring
I just swapped the two lines
Also once again it works if its not in range of damaging a player
your supposed line 96 is impossible to npe
so it must be an error in the branch of spigot im using?
change top line to java if (e.getEntity() == null || e.getEntity().getLocation() == null) return;
thast the only possible thing you are not checkign could be null
I need with completable futures crashing my server, my code is here https://github.com/KyTDK/NeoUtils/blob/master/api/src/main/java/com/neomechanical/neoutils/bungeecord/BungeeCordUtils.java and its for getting the playercount. Using the future I set the lore of an item to the playercount every x amount of ticks in my game selector constructor (maybe might need a new name for that). Constructor: https://paste.md-5.net/okigupeman.coffeescript
Its working now?
How does that fix it
It didnt make it return
It fixed it
oop nevermind
I was in creative ๐ฅฒ
my crash report is here https://paste.md-5.net/bakucegigi.md
I just pushed my current code so refresh if you are looking at it
I'm quite certain SpecialItem isn't causing the crash, but the code is here if ur curious https://github.com/KyTDK/NeoUtils/blob/master/api/src/main/java/com/neomechanical/neoutils/items/SpecialItem.java
So to reiterate I'm using completeable futures to update the playercount on an items lore, however, I'm crashing the server.
BungeeCordUtils.playerCount returns a CompleteableFuture, yes?
yes
My guess is you're crashing at this line then.
return Arrays.toString(BungeeCordUtils.playerCount(gameItem.getServerName()).get());
get() is a blocking method. You're halting the server thread.
So how do I ensure that I get() after its been unblocked?
Use CompleteableFuture's methods such as thenAccept(), thenRun(), etc
is this an async problem?
Those are callback methods that are called when the Future is completed.
I mean sorta I guess? More of the lack of async, although you're modifying and item so adding another Thread here doesn't do you any good because I don't think you can change ItemMeta asynchronously
sorry my internet went down