#help-development
1 messages · Page 300 of 1
maybe the namespacekey in the crafting recipe must be different????
idk
just a guess
thats pretty much the only solution i think, just a question of why they're different now
im guessing the recipe that was registered then had a different key so now you're basically crafting an item with a different key than you're using right now
which
BRUH
it doesnt work
its tge ´same
looks as if that doesnt have pdc on it
Show code
m
im guessing its because you put the PDC in its own variable
try doing the set part directly on the meta
oh no
its because you put itemmeta in its own variable
but the pdc part you did on the itemstack.getitemmeta
@remote swallow any guesses?
so instead of itemStack.getItemMeta().getPersistent... you do itemMeta.getPersistentDataContainer().set...
because as far as i know when you get the item meta of an item you actually more just get a clone of it sort of
at that point it's separate from the item
Yes
thats why you cant change the display name of an itemstack directly, gotta do it on the item meta and then re-set the item meta on the item
eh what
i already corrected myself
YESSSSSSSSSS
IT WORKS!!!!!
FILALLY!
👍
okay @tender shard ive figured out an issue
the yaml doesnt like the storage section, i changed the yaml and removed storage section and it work
okay
so
snakeyaml was dying because i had stuff in quotes
Quick question. How would I make an Iron Golem always follow a player unless their is a current goal to follow?
Meaning that it would follow the player until it needed to attack something and then when its done attacking it would go back to the player.
placeholder api
uhh let me get the method
how are you setting the scoreboard for theplayer
PlaceholderAPI.setPlaceholders(player, string);
Yes but I need the player value
where are you running that scheduler
mk
As in where it's being created/set?
Errr
is it in an event, on enable
Event I think
event.getPlayer()
that would be in a constructor
weird
oh yeah that
how?
Map<UUID, String> myMap = new HashMap<>();
for (Map.Entry entry : myMap.entrySet()) {
entry.getKey(); // returns UUID
entry.getValue(); // returns string
}
my map is a Private Final
Okay?
real chads do java map.forEach((id, str) -> { // code })
no
why dont i have syntax highlighting
it doesnt like forEach
replace your for statement to match that
change FastBoard board to Map.Entry entry
then replace board.values to board.entrySet
Im trying to find a nice and simple config updater to update configs keeping peoples changes but adding new defaults etc
I have seen Jeff Media's one on github but seems a little complicated for my use case ngl
it's not complicated
oh that's just an incomplete list of the config options
e.g. imagine this:
String myString = getConfig().getString("my.string");
instead I'd rather do
String myString = getConfig().getString(Config.MY_STRING);
so that you avoid typos in "my.string"
yep
would i use Material.matchMaterial for something that is just the material name but lowercase?
or should i just uppercase it and valueOf
does this work for nested configs
wdym?
can i somehow convert my screen into maps?
you'd just say
public class Config {
public static final String SELF_SPECTATE_MESSAGE = "language.commands.sepctate.self-spectate";
you need an image for that
your screen? wdym?
i did it before and imgurs and stuff work
My friend is telling me to do it like this
🤔
?
Does anybody know how one can increase IntelliJ's available RAM? My IDE literally crashes when trying to decompile simple classes like the Material class. I know, a sources-jar would probably be preferred, but this is just a sad thing over all, because I have 32 gigs laying around...
vault api
?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.
as in get what you're currently looking at and put it on a map? without a custom mod, no
unless you go way over the top and calculate how the screen should be rendered which is just way overcomplicated
okay, im gonna try everything i can
Why do I get ConcurrentModificationException in this line of code, I mean what am I changing during the iteration.
It's already at 8GB, lol. Well, thanks a lot for the quick response! :). I guess I'll have to leave it at that, as it's enough of a memory hog already.
what is autopsia line 88
lol weird. my intelliJ never uses more than 2GB no matter what I do lol
^
it needs more cpu not ram
everyone knows what happens when you decompile the Material class
cant you just download sources?
i added more once but i forgot howto
the line of code I sent you
the material class is a joke
yeah
what is "v"?
ah, easy
List<HumanEntity> v = new ArrayList<>(inventogy.getViewers);
this fixes it
Is the the viewers changing the problem?
yes
I procrastinate on that, :(.
so just create a copy of the list
hm i just found that i can do configSection.getName. if were to use it on configSection("vote-gui.1") on ```yml
items:
elytra: &elytraitem
Enchants:
MENDING: 1
DURABILITY: 3
Lore:
- Lore Line 1
- Lore Line 2
Name: Epic Elytra name
Material: elytra
vote-gui:
1: *elytraitem
im gonna get tas'd
how do you get a cme in that way?
i know it
Man, yaml's weird.
no its actually pretty cool
or is openInv removing them from the viewers?
assuming the inv where viewers cames from and inv as parameter are the same
List<...> viewers = inventory.getViewers(); // Okay, we got a list of all viewers now
for(HumanEntity viewer : viewers) { // Now we loop over the list
viewer.closeInventory(); // FAIL! We now changed the list we currently loop over - that is not allowed!
ah what i thought
that's why you need a copy of the list, e.g. ```java
List<...> viewers = new ArrayList<>(inventory.getViewers);
ngl, that seems hella wasteful
or Collections.unmodifiableList
Can't you just iterate the list by indices backwards so it shrinks from it's back and close one inventory after the other?
which creates a view and doesnt copy them
frick
it returns 1
does anyone happen to know how to get removed vanilla recipes back lol
doesnt have to be through code
same error I guess
one sec i need to boot mc
every time i google it, it tells me how to REMOVE recipes
which obviously, i know, thats my issue
theres a command i know i just cant remember its format
Is it confirmed that snakeyaml resolves these anchors automatically? Just curious, as I never worked with them.
theres a command for it? that would be amazing
alex was trying to tell you how your error came to be, not provide a solution for it.
if i was to loop over the values it returns the top
no, that would definitely work
just not the elytra for getName
yes
I've been using anchors since ages. SnakeYaml "replaces" them while parsing the file
Mhmhm, actually I thought it, but even changing a bit the code, I've failed every time
Ah, basically a preprocessor makro, xD. Cool thing, didn't know that!
That's now how the code looks like:
why do people do (p) and not just p
What are you trying to achieve with that? The viewers obviously already have that inventory opened.
okay so /advancement grant name only minecraft:recipe then tab in if its just one
you would need some code to run if its all vanilla recipes
oh you're right I forgot one thing
it doesnt appear to have a way to give all just recipes
mfalex can i make the Config.NOTIFY_UPDATES return boolean not string?
getBoolean
Maybe the method doesn't work
not getString
thats the one thing we dont have iirc
Uhm, can you please post the latest stacktrace once again? Preferably full and in a paste.
na u dont understand
sure
change String to Boolean
?paste
seems pretty basic
same thing for numbers
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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Yh u gotta sent a packet to open the inv with same window id
things like getDouble just get an Object and see if its a Number and then call Number::doubleValue()
no that "notify_updates" is the config path
so you dont need it as a boolean then
like language.commands.no-permissions
I know but
that restores a recipe from being removed? very nice
i wanna be able to do this
seems the paths are a bit wack but its better than nothing
you did not get what alex said
you would still have to do config.getBoolean(Config.PATH)
Are we changing the name of an open inventory?
yeah idk why i didnt rememeber that
oh actually reading the full stacktrace I've probably found the error
at me.ghost3p.autopsie.object.Autopsia.stop(Autopsia.java:125) ~[?:?]
at me.ghost3p.autopsie.listeners.InventoryClose.onInventoryClose(InventoryClose.java:15) ~[?:?]
I cannot find those mentioned line numbers with out-of-context snippets. You'd have to go look them up.
Yeah alex fixed the first problem, I guess I've to do so for the second foreach which is kinda same to the other one
you cannot do if(String)
ik im using a bool now
NOTIFY_UPDATES would have to be a boolean, yes
I would just advise you to also give my approach a shot first, as that doesn't needlessly allocate any new memory.
Maybe I got the error
I already told you how to fix it
create a NEW list
then loop over that
new ArrayList<>(inventory.getViewers()).forEach(HumanEntity::closeInventory);
okkkkk
Maybe something along these lines could also already do the trick.
Collections.unmodifiableList if u wanna do it good
uh yeah for sure
yeah even that could be a good way
It's just about efficiency here, as I do not allocate any memory (new keyword).
You're not concurrently modifying the list anymore, as you iterate it in reverse based on integer indices and are thus allowed to remove items through the side effects of #closeInventory
Could also use a while size > 0 close viewer 0 loop, but that's just taste at this point.
but idk why it gave me that error before, I mean I think iterating it using a foreach() or a fori is the same thing I guess, isn't it?
good logic
I think I'll use that
does removing in a while throw a cme?
had to learn that for my exam but alraedy forgot
It is the same thing, but you were modifying the list in a concurrent manner. I could explain this to you, but I don't know how far you're interested in it, and I don't want to bore you.
Way too general question. But the way I proposed it, it's not concurrently modifying anything.
Plugins gives you Java knowledge
I couldn't know this on my own
Not before testing it
?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.
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
so I'm glad to listen you
They offer great stumbling stones to learn java in a more fun way, yes! :)
wow first time seeing classic for loop since a while
When using ItemStack#isSimilar(ItemStack), it works unless its an player head, is there any way to fix that
actually I know java, I saw lack of times this exception
what is the item stakc
Going back to the basics, :). Nowadays programmers seem to have forgot these and are so stuck in fancy functions that they'd rather create a carbon copy to walk than to iterate it based on indices.
a player head
the alex's way worked, but I think I'll use the while (viewers.size() >0)
The while loop is arguably even more basic.
I think this is the most elegant way available.
And hey, you'll learn something new! :)
are you checking if its similar to the same head
for (HumanEntity viewer : viewers ) {}
❤️
it's a foreach written using a for
and gaves the same exception tho
my god
I feel like I should write a small text about this rn, xD.
ConcurrentModificationException
ah
I've wrote the foreach using lambda but it's the same thing using a for
well u gotta make a new list add elements to remove and after for loop remove items from new list from the first one
pretty annoying
actually no
Nooo, :(
Guys, I lost hope in humanity
i already did long ago
while (viewers.size() > 0) it's one of the best snippet I heard in 3 months
actually this could save a lot of memory
please read
A ConcurrentModificationException is basically only a protection, protecting you against ruining your own iteration process. If you iterate a list front to back, with indices, and you remove items while iterating, all indices shift. You removed index 0, advance to index 1 in your for-loop, but the list item 1 actually shifted back to index 0 and you will never reach it in your loop anymore. You'll run off the end of the list and get an index out of bounds exception.
This is why list removals are done tail to head, iterating backwards, as lists shrink back to front, so indices won't shift.
And the most elegant, most beautiful solution is a while (size > 0) remove(0), as you'll always pop off the head while there are any items left, as long as the list still has items.
and then saying you can easily create your own list impl that doesnt throw a cme
Basic index based for loops are just abstracted away by a foreach-loop, which is why it has this internal protection, as it got no means of detecting any side-effects you cause in the loop's body.
some good fresh java code
thanks @dry yacht
whut
looks terrible
Read that text, @vast raven
digitalocean says to just use an Iterator and CopyOnWriteArrayList
Iterator<String> it = myList.iterator();
while (it.hasNext()) {
String value = it.next();
System.out.println("List Value:" + value);
if (value.equals("3"))
myList.remove(value);
}
Anyone know how to remove an entities loot table from being executed?(Meaning they won't drop anything)
You pop off the head as long as there are still items left, by getting the item at index zero.
Not sure i understand
so basically
You got any shovel to quickly lend out to me while I go burry myself?
Efficiency 5 preferred
fortune 3
whys that?
You pop off the head while there are still items left.
I'll provide you with an example, gimme a second.
this channel is full of clowns, get used to it
is that a var in your pom and do you have resource filtering on
are you in php or java xd
It's not that people are clowns or dumb, it's that they have been ruined by abstractions and people trying to be a teacher who don't know jack shit about computing
Read the comments please, I hope you understand what I mean. I tried to explain it as clearly as possible.
this world is fucked up
Humanity is literally lost. We get dumber by the minute. Technology will not advance by itself if we ruin each other. We will die as a species way quicker than people believe is possible. This is a real concern.
Yeah, basically you're saying to remove the head (first index, 0) and the list removes entries index from the end
right?
The method call closeInventory removes the entry from the list, as a player who's inventory is closed is no longer a viewer anymore
So that's like list.remove(0), in essence
You have to know that tho, which is called a "side-effect", as the method is not only affecting it's own state, but the state around it.
anyone here that yamls much would this be valid ```yaml
vote-gui:
- 1: *elytraitem
cost: 150
why can i not parse 2.1 with Long.parseLong
Yo, where are all the yamlers at? You should post your full yaml btw, not just an excerpt.
inline cost under *elytraitem
This exception wich is thrown as "protection" is that bad for coders?
Why tho?
that is the full yaml section lol
also i answered my own question
found an ss off alex
It's not bad for coders, it gives coders a heads up that they are doing something wrong and should check their logic. You don't want to have bugs which only happen in edge-case situations and ruin your day, you rather have a ConcurrentModificationException, believe me!
it is just a list of config sections
It's a list, but why indent to the level of the anchor. Btw, list items are not indented, this is a common misconception because it also works.
this yaml would return a List<ConfigurationSection>
ye it works but it looks weird imo
I hope I won't get in these bad cases in the future
I mean, if you don't know how to fix the problem, you will be stucked
They can really trip you up badly, as you have to have pretty sophisticated knowledge and a strong mental model of what's going on to ever find them. On my early journey, I literally invested multiple hours to solve stupid bugs like these, haha
If you're lost, just post it here, I'll try to help you
Thanks btw
yaml is cool tbh
can 2.1 not be parsed as a long?
that is a double
in config? it can
Long.paseLong might work
No worries! I'd love for people to really understand these cases, I'm pretty invested in that, which is why I want to explain it as clearly as possible. Happy that I could help!
thats what im using
what are we talking about
get this
private static long getNewConfigVersion() {
final InputStream in = StaffSpectate.getInstance().getClass().getResourceAsStream("/config-version.txt");
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
try {
return Long.parseLong(reader.readLine());
} catch (final IOException ioException) {
ioException.printStackTrace();
return 0;
}
}
just use a scanner lol
fam 2.1 is not a long
why is that a text file
Of course it can't be, it's not valid long notation. Long is basically [-+]?[0-9]+
okay so your british
thats how alex does it
briish
String[] parts = input.split("\\.");
long major = Long.parseLong(parts[0]);
long minor = Long.parseLong(parts[1]);
bc longs arent floating point numbers
I'm not british
how could you
my teeth look good
so do mine
Is it possible to have too many entities on a server in such a way as the entities are laggy and tp around, but the server itself (and breaking and placing blocks) has no issues?
tps issues be like
Can I somehow get the code back into intelliJ from the .jar file? I somehow lost the correct version while pushing and pulling to github idk... But I still have the jar with the correct code...
tps is at 20
decompile it with something like winrar
But don't forget to check for the dot's presence, otherwise this will trip you up badly if it's user-input. Maybe even go as far to use indexOf, check for -1, and reuse that same index to substring in order to be efficient and not wasteful by splitting afterwards.
it would give you the .class files that you can open with intellij to see what the code is
yea but afaik he put it inside his jar himself so he can ensure it's correct
BytecodeViewer 💪
Don't think so, as entities and block placement (world modification) both have to happen in the same main-thread.
did that and thats the correct code but some code is different but I never changed that. Like var stuff
Oh, okay, didn't know that.
that being said, what's wrong with just using plugin.getDescription().getVersion()
that is the decompiling
Can I get rid of it or change it back automatically somehow
Which is why its very strange. Breaking and placing perfectly fine but the entities aren't
not realyl
you would have to manually change the var back to name
No chance, the decompiler will inevitably alter and obscure control flow, it just won't be the same and maybe partially a pain to work with.
hmm and what code gets changed and what doesnt?
hard to say
Hmm, are you sure that they are tho? Have you tried mining blocks in survivial mode to see if items actually drop within a reasonable response time?
Export the jar into a folder, then open that folder in the ide
from checking decompiled code i think iteration gets changed, var names
You could diff decompile code with your actual project and use human scanning (your eyes) to find what's new and what's just a decompiler artifact.
Variable names don't get changed, as they are compiled into the jar as meta-info. Only new variables which weren't there before because the decompiler added some obscure intermediary steps.
yeah i could compare it with intelliJ but I dont have the not decompiled correct version
I have. Gave myself good gear and food and went mining for around 30 minutes
it could just be the connection idk
Good idea to push your code to git repo
only the decoomplied up to date one and the old normal one
i'm doing a continuious ping and sometimes it jumps quite a bit
That is very weird indeed, yes... Maybe some plugins mess with entity movement in a way, that's immensely hard to debug.
Nah thats not it. The only plugin installed is the one i'm developing
and it doesn't mess with mobs at all
The quickest solution would be to run a profiler on the server jar, but tbh, I haven't done that in a while.
Fairly confident, aren't we? xD
You won't believe what weird cases there are out there.
Lol well my plugin isn't interacting with the mobs so
As Bukkit's API abstracts implementation details away, you have no direct way of knowing what you affect and how you affect it. You're not in full control, and maybe you misunderstood something (as I often have too in the past). Just saying that you shouldn't exclude the "impossible" so quickly.
Yea thats fair. I just think its more likely there is a ping issue with my external server. I am doing a constant ping on my command prompt and looking at entities on the server
Learning java with spigot is def more fun
the ping jumps drastically and the entities stop moving and tp
Ping is the time it takes for the keep alive packet to be acknowledged, IIRC. That's not entirely network only, but can also have something to do with the server itself lagging. Packet I/O is not synchronous either. It's hard to draw a conclusion from that.
Do you have access to the OS terminal of your server?
Or easier, just ping your server from your local terminal and check the response time. No need to do it the other way around.
This excludes minecraft
Thats what I was doing
Oh, I thought you were using a /ping utility.
Nope, ping ip -t
Well, it those response times are messed up, then you already know what's up.
Yea, I gotta contact the host tomorrow
bright side is that its not my fault thank god
Yeah, sometimes that actually helps. Maybe they even have logs which prove slow response times. But in any case, there's nobody else who can help you but the support, :/.
Yea, I'm not worried I have had no issues with them so far
bisect on the other hand, stay away from their VPS servers holy
absolute doo doo
Is this clone method good?
private static Inventory clone(Inventory inventory, String newTitle) { Inventory inv = Bukkit.createInventory(null, inventory.getSize(), newTitle); ItemStack[] is = inv.getContents(); inv.setContents(is); return inv; }
It doesn't seem to work, idk why even after I tried debugging
You probably want to get content from inventory, not inv
BTW your ide should tell you that inventory is not even used
Sometimes I feel stupid but after hours you don't even care on basic stuff
no it doesn't cause it's used in "inventory.getSize()"
Oh I'm blind
err
?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.
it literally tells you
What are you trying to do?
does anyone have/know a skript or plugin that gives the player infinite blocks (if they use blocks in their inventory, it automatically goes back to 64)?
Is there something i can use in spigot/bukkit to get only what version the server is running? Like 1.14 or 1.15.2
there is one moment
i doubt that exists
public static String getServerVersion() {
return Bukkit.getBukkitVersion().substring(0, Bukkit.getBukkitVersion().indexOf("-"));
}
```
that would return something like 1.19.1 ect
Because i want to use a part of the api that only works on 1.13 and i would have to code it differently on 1.14 and up
Ok thanks alot
if you are only using the api, its backwards compatable
i could code a plugin with the api on 1.8 and it would still work on 1.19
Ah
Then why did the tutorial say that if you're under 1.13 use this and if you're using 1.14 and up use this instead?
no clue
the api would get better methods in newer versions
so its probably that
actually
its probably pdc
It's on how to check what gui the player is in. So if below 1.14 you should use
if (e.getClickedInventory().getTitle)
My config won't load? https://paste.gg/p/anonymous/4b49a20c312b4e39a7b4ee9baf5730a3
hih
thats weird
i was having yaml problems earlier
and it was the exact same error
And if you're above you should use:
if (ChatColor.translateAlternateColorCodes('&', e.getView().getTitle()).equals(ChatColor.BOLD + "DSS Config"))
Did you get any fix?
use the inventory instance
mine was getting caused by having some stuff in quotes that didint need it
Is that by creating the whole inventory in a seperate class then just calling that class when the gui command is ran and compare the inventory with the inventory in the seperate class in the listener?
if your checking for stuff on that inv in a listener just make the listener in that class
use di and register the listener in the constructor
What is di?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
the simple answer is lets say you need your JavaPlugin instance for a scheduler or something you can pass that to another class
you expected the path you entered in getString to contain a string but it was the path of a config section (hence MemorySection#toString being called)
hmm
okay so ive just made an entire plugin and all ive tested about it is the yaml formatting
and it has an inventory
chances are its correct
im saying about 20%
i don’t think i try to get a string that doesn’t exist
Im trying to get ConfigurationSection and sometimes is working and sometimes I get error. Im not changing any values. Just only using code again.
Error:
?paste the config
Im trying to detect, if inventory is empty or not.
If is not empty is should look like:
invnentory:
1: ItemStack
whats char-id
int-UUID
well whats the id in your getConfigSection
im not sure what do you mean...
what is charID
this is charID for ex. 0-688df4f5-1dd4-3554-bf78-7b490244c6f3:
what is the id you are wanting to get the configsection for
this 0-688df4f5-1dd4-3554-bf78-7b490244c6f3 the inventory section is same for both of them
Im trying to detect, if it empty or not
if (getConfig().get("chars.id.inventory") == null)
Im making charselect plugin. If I click in GUI on character, it should check if player has saved some inventory. If I click first time no error and it returns false in that if state. If I click second time, Im getting that error.
public static void getCharInventory(Player player, String charID) {
if (RoleEngine.chars.getConfig().getConfigurationSection("chars." + charID + ".inventory").getKeys(false).isEmpty()){
player.sendMessage(ChatColor.GOLD + "test");
}
else {
player.sendMessage(ChatColor.AQUA + "bis not null");
}
}```
if there is inventory: {} in yml that returns true
I already try that
get it as a list and check if its empty maybe
there is some error with getting confSection, if I click one there is no error(executed method)
If I try more times Im getting error
Hmmm I tried...
if (RoleEngine.chars.getConfig().getList("chars." + charID + ".inventory") == null )
If there are some items is returning true
for the path chars.0-688df4f5-1dd4-3554-bf78-7b490244c6f3.inventory
There are a few free tools you can use. I can't remember off the top of my head for the best ones to use. But generally you want one that only just changes variable names etc.. nothing too extreme
Have a read of https://www.spigotmc.org/threads/approved-obfuscators.420746/ it has a list of some good ones you can use.
Thanks a lot :)
Hi guys, I'm not sure if this is an appropriate server for this, but I'm trying to create a custom resource pack for my server, to play with friends. My resource pack folder looks like this for now:
wait, I can't print the screen here D: my bad
?img
Not verified? Upload screenshots here: https://prnt.sc/
my brain doesnt understand what this is attempting to say or wants me to do, https://paste.md-5.net/moketojefe.rb, config parser class https://paste.md-5.net/ofelekadil.java, the line in VotingPointsSpigot is new ShopInventory(this, event.getPlayer());
that looks corrrect
It seems to be missing the "sounds" folder
just create it
I will need to follow the right structure, tho, right?
correct
right
I will try to follow these information online
wait
I can just copy from my minecraft folder, can't I?
:o
use this to figure out where stuff goes https://mcasset.cloud/1.19.3/assets/minecraft/sounds?utm_source=inventivetalent.org&utm_medium=slideshow
Woah
thank you!
that was exactly what I needed
If I make a folder like "ambient", but not put anything in
It will just use the default resource pack, right?
According to that error, you're trying to cast a LinkedHashMap to a ConfigurationSection
yeah that part i get i just dont know which is the LinkedHashMap that im attempting to cast
It's the for loop in the getItemsAndCost method it doesn't like
i dont cast anything there so how is there a class cast exception
It's refering to List<ConfigurationSection> configurationSections from what I can tell
Which is weird.
It shouldn't be giving the error
@remote swallow do yk how to setup pterodactyl?
im wondering if paper have recently pushed something thats changed stuff and broke a lot
because adventure/minimessage has now started crying if i have an ampersand in a string
Depends
You can just use list collector?
Also there is just Arrays.toList
Oh it's not returning array
can you not just pass the collection ConfigurationSection#getKeys returns into the constructor of ArrayList without creating a stream for it
i just changed somethign in the config parser and i think ive got my issue
its on a for loop, that runs on ConfigParser.getItem((List<ConfigurationSection>) plugin.getConfig().getList("vote-gui")))
so im guessing its that cast which is the issue
Yeah it would be
but how would ```yaml
vote-gui:
- 1: *elytraitem
cost: 150
thats a config section list
@tender shard are you awake
i just printed the config list of ```yaml
vote-gui:
- 1: *elytraitem
cost: 150 - 2: *elytraitem
cost: 900
``` to console and it printed[{1={Enchants={MENDING=1, DURABILITY=3}, Lore=[Lore Line 1, Lore Line 2], Name=Epic Elytra name, Material=elytra}, cost=150}, {2={Enchants={MENDING=1, DURABILITY=3}, Lore=[Lore Line 1, Lore Line 2], Name=Epic Elytra name, Material=elytra}, cost=900}], would that tell what might fix my issue?
Is their a way to put the player in spectator mode and allow them to completely control an entity?
Or at least make it so that the players hitbox doesn't affect anything while they are controlling the entity?
Hi, I want to attach a player to a shield for 20 seconds using player.set Cooldown(Material.SHIELD, 400);
but this is not subject to the item ban when the player is using it now. So if a player is holding a shield and I'm giving him a shield cooldown, get that cooldown but he'll still be holding a shield.
player.setCooldown(Material.SHIELD, 20 * 20);
Do you know, how can I stop him from holding a shield?
Packets?
which one?
It's not like this packet is when a player uses an item and I want to hide it from him?
Hide the item?
He is holding a shield up and i want to put it down
Any idea how to apply a withering effect on the client only using Packets with the mojang remmaps?
I think he wants it to not be real wither
How would you do it?
You can give them wither potion effect and then cancel the damage event
@zealous scroll I thought of that, but I was hoping for a solution that would be more optimized. Not needing to constantly cancel the damage
@mighty aurora @last temple Exactly. I could apply a withering effect, but I need it to be client side only. Using a resource pack, I want to hide hearts when they are using the withering texture
What's a good inventory management thingy I can use for my plugin
to make guis, ykyk
ProtocolLib provides this https://wiki.vg/Protocol#Entity_Effect
ok
Ask in #help-server
ok sorry
@idle loom I’m fairly certain ItemsAdder has a gui api, but it cost $20
Worth it for what it adds imo
Maybe someday
@last temple In my opinion, it’s not worth it for the gui, but for it’s overall features such as a custom creature animation system, it’s worth it
It’s not just an api, as it was developed to be able to be used just through commands, but it has an api
anony can help in #help-server ?
pinned message lol
how do I create a spawn egg itemstack of an entitytype?
spawneggmeta methods are like all deprecated
pls tag me in your reply 🙂
nvm im blind they are just in material xD
the image is way too small
also #help-server
so stop crossposting please
sorry user I don't understand your message since I'm in the help section so if you don't give any help please with all due respect do not interfere so this mistake of mine may help someone else
I was saying that should not be posting your questions in two channels as thats unfair for the other people trying to get help
this is help dev, so help if your server is crashing from plugin development
help server is the correct category for that
I still don't understand your anger or disgust, but if these people don't have the wit, they don't have anything unfair
what?
relax, i just wanted to point out that you have used both channels to post your problem
Please, if you will not help, I sincerely ask you not to obstruct my search for help.
okay sir
thank you very much for understanding
Good evening, I need some urgent help for my server that is crashing for no apparent reason, since it does not exceed the maximum ram (8 ram) nor does it reach the maximum storage and the image that I will send is the only thing I have before what crashes my server
... wrong channel
Does anyone know why the item given by this command : /give @p scute{display:{Name:'[{"text":"Ability:","color":"gray","bold":true},{"text":"Iron Defense","color":"##6D91A3"}]'}} 1 doesn't trigger this if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == ChatColor.BOLD.GRAY + "Ability:" + MiniMessage.miniMessage().deserialize("<#6D91A3>Iron Defense"))?
You're comparing strings with ==
And you're comparing a component with a legacy string text
Legacy string text?
- appending the adventure component like that won't work either
and im pretty sure that your second string would make everything bold and gray instead of only the Ability part
but yeah thats handled by the component in the first string
The deserialize part changes the color of the second part
That won't match either way
The give command makes an item with a component name
You're trying to compare that with a string rather than the component
Anyways... I wouldn't detect custom items by their name
Attach a PDC tag instead
?pdc
not an expert but I would assume more because it also needs the info on the record itself
but then again if its just like C++ or C struct, then its the same
because it gets compiled to the same in that case im pretty sure
It should be more since it's an object
But if you're trying to optimize on that level Java is the wrong programming language
It really doesn't matter
even if my function has 4 parameters and is called 1-30 times per second?
That's like nothing
yes even then
just asking, ok
come back when you mean a million times per second xD
ye when I get outofmemoryException I will be back XD
but yeah fyi like thousands of things happen every minecraft tick which is like 24x a second
Mojang uses immutable block pos everywhere
20 ticks is 1 second
oh 20 mb
anyone know how i can send a sound packet to a player
PacketPlayOutNamedSoundEffect didnt work
.playsound?
Yes
players around can hear
No if you send it only to one player
really
By calling it on the player object
Hi i want to use nms to make pathfinder goal but i got this error can someone help
goalSelector cannot be resolved or is not a field
targetSelector cannot be resolved or is not a field
What version?
net.minecraft.server.v1_16_R3
And how are you trying to access those fields
are you using reflection?
I found example on google and paste it in to my code
lol
Bruh
is there any reason a config section in a config section might be null even though it exists and im printing stuff from it on another method
Two different instances
but there identical
Typo could also be a problem
im even printing it before passing the section
Hi, Im starting to create plugins and I am having some troubles with my plugin.
I create Custom Totems using ItemStacks and I want to give potion effects when some player use the custom totem, I try a lot of ways, but nothing works.
Some One Can Help Me?
This is my actual Code:
@EventHandler
public void onEntityResurrect(EntityResurrectEvent e) {
Entity entity = e.getEntity();
World world = entity.getWorld();
Location loc = entity.getLocation();
if (entity instanceof Player p) {
PlayerInventory inv = p.getInventory();
ItemStack hand = inv.getItemInMainHand();
ItemStack offHand = inv.getItemInOffHand();
if (hand.getItemMeta().hasCustomModelData() && hand.getItemMeta().getCustomModelData() == 25) {
Bukkit.broadcastMessage(Formatter.format(Formatter.getPrefix() + "&7El jugador &c&l" + p.getName() + " &7ha consumido un &3&lVex &6&lTotem &7(Causa: " + Formatter.getLastCause(p.getLastDamageCause()) + "&7) Totem Numero:&6&l " + p.getStatistic(Statistic.USE_ITEM, Material.TOTEM_OF_UNDYING)));
Bukkit.getScheduler().runTaskLater(Utils.getPlugin(), () -> {
p.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 20 * 10, 0));
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 15, 0));
}, 1);
}
}
}
}
sorry for the bad inglish
(When some one use the totem the server sends a message in the chat withe the name of the person that use it totem)
And what's not working?
when i use the custom totem
you have the amplifier as 0
nothing happends
its adding an effect level 0
true, i forgot
lol
Potion levels start at 0
this is the codejava public static List<ItemStack> getItems(VotingPointsSpigot plugin, List<Map<String, Object>> jnak) { List<ItemStack> items = new ArrayList<>(); for (int i = 0; i <= jnak.size(); i++) { System.out.println(jnak.size()); for (String value : plugin.getConfig().createSection("blank.path", jnak.get(i)).getKeys(true)) { System.out.println(value); } items.add(toItemStack(parseSection(plugin.getConfig().createSection("blank.path", jnak.get(i))))); } return items; } and the method that gives the npeis ```java
public static ConfigItemData parseSection(ConfigurationSection configSection) {
Material material = Material.getMaterial(configSection.getString("Material"));
String itemName = configSection.getString("Name");
List<String> lore = configSection.getStringList("Lore");
Map<Enchantment, Integer> enchantLevelMap = new HashMap<>();
for (String key : configSection.getConfigurationSection("Enchants").getKeys(false)) {
enchantLevelMap.put(Enchantment.getByName(key), configSection.getInt("Enchants." + key));
}
Integer cost = configSection.getInt("cost");
return new ConfigItemData(material, enchantLevelMap, lore, itemName, cost);
}
theres lvl 2 rigth?
probably
Where are you holding the totem?
it needs to works in hand and off hand
but
I try with the main and off
You're only checking main hand
this prints ```
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra.Enchants
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra.Enchants.MENDING
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra.Enchants.DURABILITY
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra.Lore
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra.Name
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] elytra.Material
[04:38:23 INFO]: [VotingPointsSpigot] [STDOUT] cost
but it didnt works in main
you are only checking offhand
actually
you are checking only main hand
does the totem have custom model data
yes
add debug statements
how? sry am starting with this
Just sysout or smth
well, I finally make the message works, but the effects dididnt work
using this
if (hand.getItemMeta().hasCustomModelData() && hand.getItemMeta().getCustomModelData() == 25) {
but the effects dosent works
Bukkit.getScheduler().runTaskLater(Utils.getPlugin(), () -> {
p.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 20 * 10, 1));
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 15, 1));
}, 1);
okay so im really confused, console when it runs: https://paste.md-5.net/wirenekosa.md class: https://paste.md-5.net/gaquhivuse.js config: https://paste.md-5.net/edecuquxub.makefile
the model data isnt 25
print what the model data is
above that if statement
print it anyway
know I try to detect in the second hand if (hand.getItemMeta().hasCustomModelData() && hand.getItemMeta().getCustomModelData() == 25 || offHand.getItemMeta().hasCustomModelData() && offHand.getItemMeta().getCustomModelData() == 25) {
i just printed configSection.isSet("Enchants") and its false so im more confused
Add some more debug
what else could i debug
ive printed everything that might cause that section to be null
the only thing i can see causing that is some problem in bukkit
the yaml anchors?
Elytra can't have a value and be a section at the same time
i can get other values though
also that value isnt technically a value
putting the &elytraitem on the line lower makes it not work
okay im confused
On todays episode of spigot discord
Everyone learns about yaml anchors
ah wait i know why im getting that error
ignore
im gonna say its time to ping choco
@worldly ingot mr choco i think bukkit has an issue with creating config sections
I mean that error is coming straight from your class
slight problem
i print the config section with keys
and it exists
but bukkit says that "Enchants" is not set when it is and the values were printed before
@wet breach you yaml right? ive tried everything to get this to work and it just confuses me how the section is null when its had its values printed
is it impossible to make player npc could attack Player?
can you send a guide please
Not with the target selctor though
i had going everywhere in internet but no one said about that
Why would the player be able to pathfind
A human is supposed to control them not the computer
Anyways use the Citizens plugin and their api
oh ok
I've been enjoying the PlayerNPC library a lot more honestly
client-sided npcs
sign me up
Client sided npcs are kind of pointless if you then try to get them to interact with the world
Just more work
The Citizens API is great and many already use that plugin so no libs needed
i need to complain to md
when will he appear in here again
i could just email support
decembruary 32nd
I foresee you getting owned
what could md tell me to try that i havent already
I feel really dumb, and like this should be simple, Buttt...
How do you add hover and click events to a book?
<BookMeta>.setPages() only seems to accepts strings, not text components
hello... I don't know if anyone here is very well versed on the "ChunkGenerator" mechanics and how to use them, but I was wondering what the best way would be to keep everything the same about minecraft terrain generation, just adjust the heights of the ground level of the world accordingly. For a little more context. I have an 2d array of height values and i loop through the chunk and find the value in the array using something like this. (obv things arent initialized but they are in original code)
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
int height = getBlockHeight(heights,chunkX*16+x,chunkZ*16+z,min_height,max_height);
for (int y = 0; y < height; y++) {
chunkData.setBlock(x, y, z, Material.STONE);
}
}
}
my problem is i want a bit more than just stone
I Fix my error with my totems, but now the effects when the totem is used didint works
if (hand.equals((Items.VexTotem())) || offHand.equals((Items.VexTotem()))) {
Bukkit.broadcastMessage(Formatter.format(Formatter.getPrefix() + "&7El jugador &c&l" + p.getName() + " &7ha consumido un &8&lTótem Oscuro &7(Causa: " + Formatter.getLastCause(p.getLastDamageCause()) + "&7)"));
Bukkit.getScheduler().runTaskLater(Utils.getPlugin(), () -> {
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20 * 10, 0));
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 10, 2));
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * 5, 0));
p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 * 5, 4));
}, 20);
}
}
Y dont know why
well, its works xd
ye
what event are you listening to?
The totem use
when you post code type three backticks before hand
RerueccionEvent
?paste > code blocks
I got this error. I know that it means that I messed up in my code and defined the plugin as the wrong class but I don't remember how to fix it. Basically I defined the plugin as the class that the code is stored in rather than my main class that is the plugin. I don't remember how to pull the required piece across classes to allow the interface to properly work
ok so my initial thoughts are that by the time you are checking if the item in hand is a totem the totem is already gone...
?paste where you initialize thecommand
because resurrection is most likely called after the item use
does your check work
public void onEnable() {
instance = this;
// Plugin startup logic
this.getCommand("items").setExecutor(new CommandItem());
getLogger().info("Plugin Enabled");
getServer().getPluginManager().registerEvents(new darkMist(this), this);
}```My onEnable function
does the broadcast function?
yes
Or do you need the item class
check your plugin.yml
the broadcast is good
idk why you are saving instance when you are using di as well
create a constructor for CommandItem and add di to it
This my CommandItem class... I'm pretty sure its the line that says static Plugin instance
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
make sure you added your command to the plugin.yml too
unless theres another error thats the wrong error for plugin.yml issues
you are right i didnt read the trace oops
epic do you know anything about chunkgenerators?
specifically this?
no idea
havent really had a need to touch chunk generation
josh remember slimefun
that lovely plugin
I remember worldgen in general
It’s painful
And I still haven’t fully got a grasp on noise generators
there dropping 1.14 and 1.15 support soon
so
more servers that arent using it
when will it end
when is slimefun 6
when is the recode
can i ask some1 to make a plugin .-.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
its nothing complicated
Whats the best way for me to color item names?
i just need a small plugin tho, i dont have the money to spend on it
Still this is the wrong place
Put a request on the forums and wait
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
If it's that small, learn and make it yourself
ok then ty
tried but struggling
That's where you come and ask for help
i have 0 experience with coding so feel shy
We'd rather see you ask for help, than to ask us to do our job for free
?learnjava Time to start with this then
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.
Check DMs yoshi
mmm
Yeah or & with translate alternate color codes
Omg p word
Is there in any way to detect when fish bite on the FishHook?
Right, thank you so much
How to detect a interactions with chest, trapdoor or fence gate
PlayerInteractEvent
Ok
hi , so about perks for a pvp game [skypvp ] :
i was thinking i make only specfic perks? and that's it , users can edit the name , other stuff
price to buy it , lore , name , etc all is editable , but he can't make his own perks :_:
and iam also try to make a dataconverter from the old sql database to the new one , its changed everything is diffrent . how i can do that?
Why do you need to do that?
Yeah just disable their messages or remove them completely
/gamerule announceAdvancements false
declaration: package: org.bukkit, class: GameRule
if it does not
disable them in ur spigot.yml
can do that like so
advancements:
disable-saving: false
disabled:
- '*'
I'seen this idea of color pallet, how it is possible to pase text to player chat input like on this video?
Honestly, that is actually cool
I ask about putting text to input field
Never seen this before
Unfortunately I have only this gif from some forum
?paste
https://paste.md-5.net/cequmabuhi.cs - Anyone know why my lore isn't setting?
It all works but the lore
Everything works perfectly
is ur path to the String list correct?
oh ignore me I'm stupid I put wrong menu name 0_o
Hi, I had an idea is possible to make the world appear totally blank and then make it appear, a solution is creating another world blank, but I don't want to occupy memory only for a test, there's another method I can use?
Hello, is org.bukkit.World is an implementation of org.bukkit.craftBukkit.CraftWorld ? I think yes but why I can't see this implementation in World class ?
oh ok, when I do like location.getWorld, it returns bukkit.world right ? not craftworld ? How an implementation can be instancied and returned ?
u want an instance of CraftWorld im guessing?
yes I know how to have it by forcing the type of (CraftWorld) bukkit.world
But i'm trying to understand
if thats the case u can just cast a World to CraftWorld
getWorld indeed returns a World. but thats also a CraftWorld
Ok, I see, but How can I know that ? Because in my IDE if I use CTRL + LEFT LICK it's only shown that
I'm new on java, so i'm trying to understand how can I have this info
whitout asking or searching
i mean i guess u just know
if u have a bukkit interface. usually the implementation is "Craft<Interface>"
and u can go to the interface and Ctrl left click on its name too
the arrow i mean *
why do you need an impl?
?stash
oh yeah i see
thank you !

How did you register an event?
declaration: package: org.bukkit.plugin, interface: PluginManager
Bukkit.getServer().getPluginManager().registerEvents(new OnRightClick(), this);```
yea thats correct
'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(dev.akex.villagerinvview.listeners.OnRightClick, dev.akex.villagerinvview.VillagerInvView)'
why it cannot be applied
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I am in the main file
public class OnRightClick implements EventListener {
@EventHandler
public static void onRightClick(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
if (player.isSneaking()) {
Villager villager = (Villager) event.getRightClicked();
player.sendMessage(String.valueOf(villager.getInventory().getSize()));
}
}
}```
that's the event
oh
is it just Listener
yea
i mean there are good uses for static too
one last question

