#help-development
1 messages · Page 2060 of 1
@tall dragon so just like this i guess? ```java
public static Player getPlayer(String player)
{
Player p = Bukkit.getPlayer(player);
if (p == null)
{
for (OfflinePlayer pOff : Bukkit.getOfflinePlayers())
{
if (pOff.getName().equals(player))
{
p = pOff.getPlayer();
}
}
}
return ((p != null) ? p : null);
}
?
how do you iterate through different values to find a specific subvalue in a yaml file?
pretty much. but i would change that to test the uuid instead of the name.
is there any way of retrieving all the keys inside a pdc instance on 1.15
no
oh is what i need to do createsections?
oh how
rip thanks anyways, gonna have to drop support for 1.15
why do you need that getKeys o.O
I loop the keys to retrieve every pdc data and do something else
something like this
How can I spawn an NPC without showing the NPC on the tablist?
Does anyone know when GRASS was changed to GRASS_BLOCK in the material enum? Was it 1.13?
you can check the wiki for that item, it has history changes below
Wiki does not say anything reguarding these changes already checked
It has some history but not the direct Enum value change
you gotta do version checks then
yeah but oracles down cant get java 12 jre atm :/
put it in a static block and check bukkit versions on when it was changed
then use #matchMaterial
or just use ternary for it
if #matchMaterial returns null use the other one
which doesn't require version checks
Thats similar to what im doing, but i need to actually know when the version was changed to GRASS_BLOCK as its rather complicated what im doing
And version checks are quite required for the plugin im working on
can do a static final for it? using ternary?
not exactly, version check would just be simpler as theres multiple parts of code intercepting with GRASS and GRASS_BLOCK
private static final itemStack grass = #matchMaterial("GRASS) != null ? #matchMaterial("GRASS" : #matchMaterial("GRASS_BLOCK";
and GRASS and GRASS_BLOCK need version check as in <im trying to figure this out now> GRASS_BLOCK doesnt exist
I mean you can't use both since it changes on mc versions
thing is higher versions will return true for GRASS
oh disregard what I said
1.8.8 its the block
public static String getNest(String name) {
//how do i do this?
for (String Nests : CustomConfig.get().getKeys(false)) {
if (CustomConfig.get().getConfigurationSection(Nests+".name").equals(name)) {
return Nests;
}
}
return null;
}```
i'm trying to iterate through "nests" in a yaml file to find a specific "nest" that has a given "name"
this is how i do that?
i need to know the version where GRASS stopped being a block
hi burchard
oracles down so i cant check 1.13.2.... and i beileve thats the version it did it on
hello
can you help me w/ this yaml shit
i promise i'll eventually redo the whole project 🥺
it's a shitshow but i gotta start the server in a month
cant atm im on the clock to finish this before new release is sent out
aight
try it and see
Nests -> nest
help plz
Google java naming conventions
#help-server or contact your host
i will but i'm at school lol, can't test it from my laptop
And another thing pricedown
yeah that was a slip
CustomConfig.get() isnt a FIleConfiguration iirc you need to getConfigurationSection first
hmmm
i dont reccomend writing things out when your learning without being able to test
if your at school just wait until your home
🤷♂️ it's a separate branch
i'll sort it out
sup
most people here
mfw oracle still down
oracle cloud sucks eggs anyway
oh it is a FileConfiguration btw
oh
yee i figured
you need to get the COnfigurationSection your gonna look through, if you dont ur gonna loop through your entire config and wonder why its not working
So I got one module called hooks in side I have all NMS modules for every version now I want to add them to my core module
by only adding hook as dependancy there
but children of hook are not registered I need to add each one
to Core pom file
wdy with "children" of hook?
paste all your pom.xml files
sub modules of HOOK
normally you want hook to be submodule too and not just a dependency anyway but that shouldn'T matter
?paste all your pom.xml files pls
Does anyone know how to use plugin-annotations? It's not generating a plugin.yml file for me
Kotlin & Gradle
pom for BeastTokens?
so to be clear I want to add hook as dependancy to core.pom
and have access to all sub modules inside hook module
is that possible
or I need to do every module how I did
you don't even have hooks as dependency in cores, or am I blind?
just declaring something a module won't automagically add is as dependency to your other modules
Just a thing about organizing my classes
I don't know if it helps you in any way, but here's how I do it:
https://github.com/JEFF-Media-GbR/JeffLib
parent-pom declares all modules
dist creates the final .jar
core has all the generic stuff
then there's one module per NMS version
all stuff metnioned above is a dependency of dist (except the parent ofc)
Should I make packages that actually describe what the classes are for or should I use generic names like dataclasses, serializers, managers ?
that's totally up to you
so yeah @wary harness You want to have a "dist" module too which basically simply collects all your other modules by having them as dependency, then to compile your finished thing, run mvn install on the parent, then it should first compile all your submodules and then, at last, also compile your "dist" module which basically puts everything into one jar
If I make the package with e.g my CommandManager or BaseCommand it would conflict with the actual package that has the commands in it
ok thanks
will look in to it
np
because my pom file started being big and it is anoying adding all those modules all over again
when I need them
yeah normally all your modules should be independent from each other
except maybe a wrapper module for your NMS stuff
but yes, you'll need to declare every module you want to include in some kind of "distribution" pom
e.g.
parent pom (artifact: MyLib)
- dist pom (artifact: MyLib-dist)
- core pom (artifact: MyLib-core)
- 1.18 nms pom (artifact: MyLib-1-18-nms)
- 1.17 nms pom ( artifact: MyLib-1.17-nms)```
parent pom has all those declared as module (except the parent pom itself, of course)
all poms have parent-pom as parent (except for parent pom itself, of course)
dist pom has all those things (except parent-pom and itself of course) as dependency
Anyone have any resources on how to code a plugin with kotlin?
it works the same as with java. extend javaplugin, have a plugin.yml, that's it
aight
I want to build a plugin with Maven using 1.8.8, is it still possible?
sure
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
I'm getting Dependency 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT' not found
?paste the full pom.xml
Does anyone know how to use spigotmc plugin-annotations? It's not generating a plugin.yml file for me
using Kotlin & Gradle
what even is "plugin-annotations"?
generates a plugin.yml using annotations
https://www.spigotmc.org/wiki/spigot-plugin-yml-annotations/
looks correct. try running mvn clean compile -U
how are you building your .jar?
Oh great it works 😄
thank you
gradle, build>jar
np 🙂
exclude group: 'org.bukkit'
why did you add this?
try to remove that
including the { } braces
I didn't have that before, I copied that from someone else using them haha
still missing
tbh you should write that command down: whenever something in maven doesn't work, run mvn clean compile -U, it fixes 90% of your problems lol
how can i visualize the difference between one vector and another, for know how much a vector needs to reach?
hm sorry idk then, I have no idea about gradle
thanks lol I'll add it to my notes
free domains are cool
debatable
I don't really understand what you mean
there are no free domains
there are
.tk is... bad
.tk and .ml
maybe for first year
.gq
like .com, .me, etc
good luck transferring them
"In 2006, McAfee conducted a survey in which they claim out of the 95 percent most trafficked web sites, .tk domains were twice as likely as the global average to be used for "unwanted behaviours", including scams such as phishing and spam." wikipedia
how much does a .com domain cost
nah dw its not a website
its a redirect
to my github website
like $5 or £3
oh per year
namecheap is cheap
whut? where?
aight
thats pretty cheao
They're generally super cheap yeah
i give an example, I have a vector of the player's direction, turning the player backwards from that direction, how do I know how much of the vector of the difference in the player's direction backwards
I use namecheap with honey browser extension (no sponsor lmao)
I pay 9.36€ per year for jeff-media.com at netcup.eu
i wanna make a domain that just redirects u to a rickroll
thisisadomaincool.com is $0.98 for first year
github.io subdomain
don't fall for those offers
"first year" yeah and after that?
get a proper domain provider who doesn't raise the prices after one year
yes that's good
It's not bad after that. The website that sells .CA did a deal on it and it's still cheaper than most
"$0.98 first year"
and then $650/yr after that
about 10€/10$/8gbp per year is okay for .com
I figured it out
what was the problem?
I got fizz.red for like £8/year
I was using kotlin so I needed to use the kotlin annotation processor 'kapt' instead
oooh
yeah that makes sense, I haven't thought about that
as said, my gradle knowledge is very limited 😄
yeah but you'll have a very bad time sending emails with a .red domain
everything coming from @serene coralred is automatically considered as spam by most spam filters
yep definitely, the .red is my main url shortening and forms
why doesnt Bukkit.getOfflinePlayer() work for me?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
ok fine
do u know ?
I still don't understand this sentence tbh, sorry
The official video for “Never Gonna Give You Up” by Rick AstleyTaken from the album ‘Whenever You Need Somebody’ – deluxe 2CD and digital deluxe out 6th May ...
awesome
You just want to reverse the Vector direction?
let me show in game -_-
Multiply by -1
that's probably helpful, yes 😄
Then yeah show in game lol
let me explain my game ideia
this doesn't work if you embed it lol
put the link <like this>
Surround it in <>
I mean you build your own site and set the embed to something else
Thus tricking people
how much of a difference in the vector backwards? that's not an aspect of vectors, they are single direction. you could get the difference between two vectors from their locations
So I have this code and im using Bukkit.getOfflinePlayer() to get the offline player from the first argument of my command and its returning null for some reason. Heres my code, and there arent any errors:
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length < 2 | args.length > 3) return false;
Player target = Bukkit.getOfflinePlayer(args[0]).getPlayer();
if (target == null) return false;
return true;
}
I don't understand the question lol
yes because you do getPlayer()
not sure they do either
getPlayer() returns an Online Player if they are online
Oh that was an answer
if they are offline, it returns null
You defeat the purpose of getting offline player if you're getting the player from it
you cannot get a Player object if the player is not online
um
wouldnt that be nice?
not really lol
well how should i get the display name of an offline player, for example then?
Kotlin Plugin Error
you can't, offline players do not have display names
You store it in a database
all you could do is to save the displayname of online players while they are online
damn
^ like this
i see
i just wanted how much vector the player has moved towards, from the direction
can someone please help me with a #959109208450674709
idk but somehow I still don't understand what you're talking about lol
man cmmon
just look that image
i moved -0.5 from yaw, how i get -0.5 from this value
yes
??
yeah
dude again english is not my main
i have -12.0, then i moved my camera to a random direction, in this case i now i have -12.5 from yaw, i just need get how much the yaw is diference from the -12.0 value understand?
i see
Are you just trying to get any difference in yaw/pitch after they start shooting and then apply that to where the shots come out of?
but i dont know how to solve your problem
yeah
yes
i assume he’s making a no recoil hack
my project can't compiled at all, there is no error just "NameProject: failed"
i making a spread from my gun plugin dudd
oh
Ohhh, PlayerMoveEvent then? You know when they start shooting, so if they're shooting you store their initial location and then constantly add the change in yaw/pitch to that location, should in theory work okay I think.
i see
no i dont need a trigger
you sure?
what
why not
each time the player right clicks, i will see how much vector the player moves his camera
look
then you solves your own problem?
^?
no
there must be more error messages. how are you even compiling? maven? gradle? with your IDE? javac from CLI lol?
i just need a vector math
man is it so hard to explain? xd
The way you're doing this is weird that's why.
tbh if you explain it and 5 people don't understand it, it's probably your way of explaining that's shitty 😛
no offense, I probably couldnt explain it properly either
🤷
Can someone help me ?
this is returning me a vector right?, basically I'm going to add this to the player's direction vector, if you see a certain amount for each if, that would be the player portrait number, basically I don't want to type these values inside the plugin , I would then do this in the game and then it would already set these numbers for me
i hope now your guys understand
Uh
You can use getLocation.getDirection and multiply -(bonus)
and set vector to that
I am trying to set the skin overlay of an npc, but I always get this error:
at net.minecraft.network.syncher.EntityDataSerializers$3.copy(EntityDataSerializers.java:57) ~[?:?]
at net.minecraft.network.syncher.SynchedEntityData$DataItem.copy(SynchedEntityData.java:344) ~[?:?]
at net.minecraft.network.syncher.SynchedEntityData.getAll(SynchedEntityData.java:211) ~[?:?]
at net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket.<init>(ClientboundSetEntityDataPacket.java:19) ~[?:?]
at at.theduggy.project.npc.NPC.<init>(NPC.java:77) ~[Deutsch_DieWolke-1.0-SNAPSHOT.jar:?]
at at.theduggy.project.TestParticleCommand.onCommand(TestParticleCommand.java:28) ~[Deutsch_DieWolke-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
... 21 more
Code:
DataWatcher watcher = npc.ai();
watcher.b(new DataWatcherObject<>(15, DataWatcherRegistry.a), (byte)127);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(npc.ae(), watcher, true);
((CraftPlayer)player).getHandle().b.a(packet);
class java.lang.Byte cannot be cast to class java.lang.Float
Paper 
Yes but the DataWatcherRegistry.a works with byte
that does not change what the error says - https://docs.oracle.com/javase/8/docs/api/index.html?java/lang/ClassCastException.html
bah, what you are looking for is on this page: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/util/NumberConversions.html
?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 s for me =))), ok?
how do i check if a player deposits an item somewhere?
is it a chest or something? - somewhere is pretty vague
then you can watch for an inventory event and who is involved
in every place beside inventory
InventoryEvent class?
well a chest is an inventory type
yeah but
doesn't the event get triggered like even if a player just clicks in his inventory?
in that case wouldn't work
yeah you will have to filter and get the correct matches
ok, i'll try
from the event
...
i would stick with who caused the event
though i guess you could check to see if there are multiple viewers
but there isn't a method that says who called the event
or i missed it?
InventoryEvent class
Is there a quick way of disabling the warning in console from events taking too long?
fix the events that take too long
No ratio on that
They take "too long" for good reasons, don't worry
for the CS students in here,
does "two's complement of x" have a different meaning than "x in two's complement" ?
Cuz most sites seem to invert the number x if the former is asked, but just take the binary value of x if the latter is asked. is that right?
the result is different
alright, ty
Two's Complement Decimal Number
0101 5
that copy-paste is the reverse order of what you asked
"two's complement of x" would usually be something like: two's complement of 0101 - or if they are testing signs it might be a signed value
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryMoveItemEvent.html you might want to use this one instead as it should be called sligltly less often
https://paste.md-5.net/arotapiben.cpp which one of these is generally considered better practice? or does it not matter?
but then i realized its called only when an item moves from an hopper to a chest
hey i've been trying to create a plugin that modifies the speed of projectiles when you throw them but it doesnt seem to be working.
Just use InventoryOpenEvent
hmm should be called when a player moved an item into a chest as well
i tried debugging and didn't work
imma try again
it has a getPlayer() which returns a HumanEntity
perfect way to deubg
but then would get called only if a inventory is open
and not like when an item is moved
they are targeting a specific item put into a specific inventory - i am guessing its a quest or achievement type thing
neither, you should store your namespacekeys.
ItemStack newItem = item; doesnt clone the itemstack either, you need to directly call the .clone()
i want to make a "talisman" plugin, when a player has this item, he gets attribute boosts(configured by the owner of the plugin)
hypixel skyblock moment
wat
shhh
he doesn't have to know that
its
not
he asked me to do that, not to search if there already was something to do it
i'm doing what he asked.
anyways, anyone know this
btw ItemMOveEvent doesn't work
?
hey, could someone help me with writing stuff into config?
projectile is still an entity, and every entity has a velocity
you can manage that with vectors
through code
bruh i know how to set velocity
did you even read the code
before telling me that
projectile.setVelocity(Vector);
bruh
i didn't
then whats the point of giving me useless information
but i actually don't know how to do that well neither xD
i though you didn't know about the velocity
guys im a noob at this and if i want to program a plugin lets say if i right click a diamond and sends me a message how do i do it?
??? i linked code that literally has
what is or is not happening?
velocity editing
no errors, just no change in speed
the multipliers work ive null checked them
is it running the result?
have you tried turning it on and off again
wdym
like restarting the server?
?main, firstly...
what doesnt work?
hello?
always works at school lab
l;ol ok
he's right
just explained
here
ok, so it doesnt change speed?
yeah
is it running the result?
sout go brrr
ez debugging
Adelemphii being an extremely helpful #help-development contributer as usual 
ofc now actually what is wrong with my code
how do i make a wireframe cube the most efficient way possible?
try setting the velocity to like a new Vector(0,0,0)
wont that just freeze it
the projectile is already in motion
yeah but it will show if it actually works
Does AttributeModifier.Operation.MULTIPLY_SCALAR_1 just add 1 to the multiplier ?
e.g
the value passed in is 1
Got it, thanks
does it multiply the target attribute by 2?
case SNOWBALL:
e.getEntity().setVelocity(e.getEntity().getVelocity().multiply(new Vector(0, 0, 0)));
guys please, I need help writing into config file from code
no
i believe it times it by a scalar of 1
write some unit tests
no,
e.getEntity().setVelocity(new Vector(0, 0, 0));
MULTIPLY_SCALAR_10 would times it by 10
declaration: package: org.bukkit.attribute, class: AttributeModifier, enum: Operation
oh right thats what
ok
That says otherwise tho
no need to re-get your entity
oh so it does
anyway what is the most efficient way of making a wireframe cube?
please?
JavaPlugin#getConfig() and then you can use #set(path, value) on that
olijeffers0n
meh, try setting them really big
already done
reboated
unfortunately it does nothing
huh?????
im a god
i literally changed one thing, then built it, then press ctrl z then built again
what the hell
were you reloading with /reload
so confused rn
no my own plugin has a reload command
so how do i do a wireframe particle effect
smh
and also how do i make a plugin reload cmd
get a gaming carpet
wwhat?
also plugin reload commands are mainly just for reloading files
so the variables actually update
so?
so?
you're setting them to negative speed?
just a really big number
long is for long numbers
big is for big number
scriptus pom error
well, this is for help with development and you're not asking anything, and I'm still asking how can I save somethingto config file
What you got as of now?
what is the most efficient method for making a wireframe particle cube
my problem is that it doesn't work, I have my suctom sonfig file in a class and use this method to save into it
public static void set(String path, Object object) {
config.set(path, object);
}
but it just doesn't work
config.save() ?
Well of course you need to invoke the save function
The config object itself is just a hashmap in memory, nothing more
anyone?
public static void save() {
//plugin.saveResource("levels.yml", true);
try {
config.save("levels.yml");
} catch (IOException e){
Bukkit.getLogger().log(Level.SEVERE, e.getMessage());
if(WaterRun.get().getConfig().getBoolean("debug"))
e.printStackTrace();
}
}
``` doesn't work, its called after trying to write into file
patience young padawan
well?
ive been waiting for so long and no answer whatsoever
that's a damn shame
💀
same, wait your time
YOUVE been getting responses
meanwhile i have not
thats the difference
finally*
?
I like the tags that tell me what they're supposed to be
yeah
but some are missing
and i dont know why
maybe because it isnt the right type? but still accepted
dk
so what is the most efficient way of making a wireframe cube particle effect?
for loops
are you incapable of waiting for longer than 20 minutes
yes
don't spam the same question every 4 minutes :)
i don kno
ill just look at others' code
ok
Player#spawnParticle
a quick google search solved your problem oh wow https://www.spigotmc.org/threads/outline-a-block-with-particles.420173/
wow
and mine problem?
wow this is channel is toxic today
that is a really cool website whattt
never knew about that
noway
if you didn't get an answer yet, it's because noone knows the answer or noone had time to answer yet. There's no need to to ask why noone answered yet. people will answer to you once they got an answer for you
Mye also you’re absolutely not fucking entitled to help
oh wow, did my message get pinned? 😮
its good message
I feel i read this before xd
hey does anyone know why my velocities arent updating when i do my plugin reload command?
all my other files are updated in the same way and they all work fine
when i edit a file and reload i mean
it doesn't work, that's my problem
but, the /reload or restarting works
martinecko that’s because you can’t pass a mere string to the save method
wdym "my velocities arent updating"?
as in i have a file which i can change certain projectiles and throwable velocities, when i update them and reload nothing changes in game
wdym, that method I showed was only in config file class, calling that method is somewhere else
i use the same system for my other things and they work fine, e.g. message changing
I mean
config.save("epic.yml") won’t ever work
Because "epic.yml" is a string
this?
you have to get the fileconfiguration first right
configFile = new File(plugin.getDataFolder(), "levels.yml");
Yes you need to pass configFile to the save method
Basically
Also iirc you have to manually check for whether the file exists or not
File is not a subclass of FileConfiguration
ok but what does that have to do with anything?😅
I have that, the thing is why would then there be a save function with string that doesn't work?
There is no save function that takes a string as a parameter. Only one that takes a file.
Oh alr
theres is? its even in the code
public void save(@NotNull String file) throws IOException {
Validate.notNull(file, "File cannot be null");
save(new File(file));
}
in FileConfiguration.java
Yes but that’s not what you want
Oh shit, he’s right. There is a method that takes a string, but it’s not what you think.
Because it points towards the wrong file due to not specifying the directory
yes, I replaced it and it works, thanks
I wish the javadocs were a bit clearer about some of those methods. I’m assuming that you need to specify the full file path if you use #save(String).
I also to some extent didn’t know about that method’s existence
It’s not directly stated, but both of them share the same description so it wouldn’t be that much of a stretch to assume it.
Mye
How does one get a list of ConfigurationSections in spigot's config API?
eg.
- test: 1
test2: 2
- test: 3
test4: 4
I'd want to serialize that into a list of test and test2
ConfigurationSection#getList doesn't allow for a custom object
getKeys()?
getValues()?
if you need the key as well as subkeys though
ah, I did not know there were keys
in a list
my experience with getKeys was for an object
and getting it's keys
this is a map not a list
yeah i think you’re looking for a map not a list
what do you mean
That is a yaml list of objects
and I would like to recieve a Java list of objects
from it
so just numbers?
well no, numbers and strings, but that shoulden't matter?
It's a list of objects
the values inside the object shouldn't matter much
you ask for a string with number, thats a map, no a list
No, test is a value in an object
String:Integer is in fact a map
What are you talking about?
That is a Yaml list of objects
the string has a value of int
start of a map
even if I want it as a map (I don't, but that's for later)
or you know, just a regular hashmap
I'm really confused why you want this to be a map, since it's just a list of objects
I don't want a map
i understand you dont want a map
wonders why you would argue with an unverified member
becuase my verification is on another account that has been deleted, but okay
i’m pretty sure in your case you just need to use getValues
and then loop through all of them and add it to a list
and put them into list
I was just trying to explain that what he was looking at wasn't a list but a map
but the thing is, it is a list
so I'm unclear as to why you're trying to convince me otherwise lmao
yeah but this is a serialized object not a map
it could be a map but that’s not what it’s being used for in this case
but still you need to get it as a map if you have it stored that way
That looks like ::getMapList
In case someone didn’t already mention
It's not a map ;p
it has strings and ints
I just used only ints there
as a rudimentary example
my fault
I think I'll try getValues()
thank you
🥲

oh smh no external emojis
ye sadge
guys is there a problem with this? it wont do the sounds
public void onClick2(PlayerInteractEvent e) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (e.getHand() != EquipmentSlot.HAND) return;
if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.OAK_DOOR) {
Player p = e.getPlayer();
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 2F, 1F);
}
did u turn on sounds btw?
I did
hm?
try debugging it
add something that will write into console if it get past that if statement
you have two hands, and both hold items
There doesn't seem to be anything inherently wrong with that code, though you could use Tag.WOODEN_DOORS.isTagged(e.getClickedBlock().getType()) to account for all doors
Just make sure it's registered and has the @EventHandler annotation
this is much better than spamming the same code and changing it
will this return a true if there are a duplicate of elements in this queue?
new HashSet<>(queue).size() wha
its a couple of java tricks
Does anyone know about how I'd generate a normal world with a specific schematic generating every x blocks apart? 😅
will if you observe the code above. you know what a set is right a set is a list with no duplicates
ah thats why
where do i put it?
and putting the queue between the brackets of the hashset will be equal to it and were getting the size of that mesh and subtracting it by the queue size - 2 to see if there are duplicates
why not just return new HashSet<>(queue).size() < queue.size()?
why cant i access these variables here?
well we wanna check for duplicates and a Set removes duplicates we wanna see if the queue size has changed
because u have an intersectional condition there
since it cant at compile time ensure both predicates are gonna be false (beyond the return)
the size of the set being smaller than the queue set would mean that there are duplicates in the queue
dunno why -2
Quick question: What is the NMS version of 1.18.2? (CraftPlayer package)
you actually have a point there
im gonna try that
😶🌫️
wdym? I think they dropped version specific stuff after 1.17
Not with the org.bukkit.craftbukkit
how can i get the default attributes values?
@golden turret
anyways
doing sth like
if (!(o instanceof String str && o2 instanceof String str2))
return;
would fix it
ok but how can i get the default attribute values?
the base value?
something like DefaultAttributesBestClass.get(Attribute.AN_ATTRIBUTE)
because this is not working as expected
the base value is being changed
i thought you were naive at first because you were asking me basic stuff about java i take that back (your not naive)
?
i thought you were dumb at first now your not
how can i get enchantments from enchantment book
why not... set the attribute?
For anyone interested:
Rather than the normal:
ItemStack#getEnchantments()
You have to do the following:
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemStack.getItemMeta();
Map<Enchantment, Integer> enchantments = meta.getStoredEnchantments();
its ike
Hey. does anyone know how to get player location using Bungee??
cut it and look for the splat ?
you would have to send a command from the bungee to ask the server
how'd you go about that? Im new
the code looping is http://pastie.org/p/5AMzNW4fpfl5guYoAdVs4q
the image is the recomendation
kinda confusing sorry
timer will always be greater than zero i'd expect
why?
its a repeating task
Variable 'taskID' is accessed from within inner class, needs to be final or effectively final
but theres a timer--
yeah, that only ends your loop
that does not mean that it wont run the next sceduled repeate
i think you need to ask yourself why you are using a repeating task
because i want to spawn something X amount of times, in this case 5
with a small delay in between
i wouldnt use a repeating task for that
delayed task or scheduled task
i dont get it, why would i use a delayed task to repeat something when theres a repetitive task
for one you are running it on the main thread, if your just generating particles, there isnt a need
it is easier to have a timer run out than it is to stop the timer correctly
so i setup a few of these https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitScheduler.html#scheduleSyncDelayedTask(org.bukkit.plugin.Plugin,java.lang.Runnable)
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
5 is a pretty small number of runs to handle
after 1,2,3, etc seconds?
if you think it needs to be on the main thread, then it is at least only blocking while it is running your code if it has an issue
so something like this
for (int i = 1; i <= 5; i++){
Bukkit.getScheduler().scheduleSyncDelayedTask(FactoryIdeaV1.getInstance(), new Runnable() {
@Override
public void run() {
System.out.println("spawning");
}
}, i*20L);
}
```?
Question why cancelling the thread? Curious
i need it to spawn 5 times
your count will give you 6
Ahh CPU processing saving
you could just use a bukkit runnable instead of that entire process
I mean the scheduler works equivalently good
Hey,
I'm generating structures every x blocks away from each other.
Problem is... They only generate in one diagonal line for some reason.
Here's my code:
https://paste.md-5.net/egepoxixuh.java
Here you can see my issue:
https://youtu.be/qH0Pu_Q_MPs
Does anyone have an idea why it behaves this way?
do the first thing you posted but change the new Runnable to new BukkitRunnable
so you can stop the task inside of the brackets
Well it’s deprecated if you try to pass it through the scheduler
i mean is changing it better for the cpu?
yeah buts it just longer
yeah we are able to extend it to our object
But that’s because you can basically use its instance methods to schedule it 
"you we" lol
Literally not
Ig it could be longer, but it’s ideally gonna be shorter
this is what i have so far, it works but is there anything to improve? http://pastie.org/p/5BYttHK1RpdHY17bCtmBWq
If you use word edit, then might wanna ask them
Lucas I’m confused
Well, I'm only using WorldEdit to actually create the structure, the rest of my code has nothing to do with it

if your confused then imagine me
You could basically:
Bukkit.getScheduler().runTaskTimer(plugin, ()->{
//TODO
},0L,5L);
Yes but in a much more reasonable way
thats a repetitive task that gets cancelled?
yea
#cancel() gg done
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Just put question
oh
thats with spigot
indeed
what task
do you mean "?how to delay a task in java"
executor
Google your question before asking it:
https://www.google.com/
lol
ik but google isnt working for me sadly
Bing your question before asking it:
https://www.bing.com/
i can only use discord rn ;-;
who the heck uses bing.
i cant even open youtube
bing sucks
Rip ur internet situation
Google is quite a good tool for searching for answers
😭
Can you use your browser?
dw i have some other programming dc servers
nope
F
No one can send you any links then
yeah sadly
why cant you use your browser or yt?
well discord works with internet too my man
i use my dads hotspot and sadly his data is expired so i can only use things that is like chatting, like whatsapp, discord, instagram and ye
Use discord browser gege
you coudl ask a friend to screenshare you google :D
i dont have friends.... jk
i dont have dc friends
closed
none here
public library?
nope
you could make a bot to make an http request to the link you want and read the contents from that, i would recommend using python for this
if thats not possible setup a private ftp server with a friend, and use that
dont worry we will find a way for you to google!
Discord has a browser
but tbh idek how to use this thing XD
class MyClass {
static void sayHello(String name) {
System.out.println("Hello " + name);
}
public static void main(String[] args) {
sayHello("Ray");
}
}
what thing? internet?
It chromium
u got more context?
I literally just copied it from a tutorial and changed it
wait how did you get the tutorial without internet?
i mean i know a bit on how it works but it cant even be delayed right?
are you lying to us rn?
Thread
run it and it will print hello ray
it was a while ago
it was from nov 28 2021 and its a screenshot
from my phone
can you prove it?
how-
open a cmd, write ipconfig and then do ping www.google.com, then share what the console says
😆
do i have to ;-;
yes
NO
would you?
if you want everyone to know ur ip. thats a good way
moot
ik about ip stuff thats why im not doing it xD
if i would save all the ip's being sent here i would have a lot now
just believe that i have bad wifi
all i ask is can it be delayed? because its literally print in the system so idk
this could help
thanks
sadly idk how to really use java so this is gonna be a trial and error moment xD
you can look up the documentation in the file
the googler is still broken
Hmm 🤔
idk how to do this
rust is brilliant lol
class MyClass {
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
static void sayHello(String name) {
System.out.println("Hello " + name);
}
public static void main(String[] args) {
sayHello("Ray");
}
}
``` pls help
what do you need help with
public is something
im so confused
i dont get this delay thing brush sent me ;(
did you look at the method signature?
wait
you need to hide the key to the Executors bathroom
give me a minute i might be getting somewhere
I learned java from an app
which one?
i got to lesson 29 then i forgot
i mean not forgot i mean i deleted it cause i lost motivation ;-;
then why you're here?
took me 5 months to have motivation again
was lesson 29 how to pre-increment ?
because I got motivation again?
plus it make me feel smarter even tho im not :smugs:
anyways what is TimeUnit?
I would recommend getting browser internet Access to learn
is their an way to check if a player joined with a new name compared to last time without using a db?
is their a simple function or anything
uuid
use ip
Lesson 29 kek
omg its the same
because if they use the same wifi then youll know but i also suggest uuid
but can you dance?
i want to on playerjoin see if their name is diffrent from last join
you stopped before getters and setters
btw
💃
wait i actually didnt stop there because i learned the 31 lesson, maybe its 50 or something idk i forgot
can i ask something about website development?
no i learned that
but still i kinda forgot
lol
it uses pictures
What app is that
sololearn
what
sololeveling
website development
dont you have it?
anyways
later someday im gonna be here again but asking how to make an effect apply to a person when it eats food like enchanted chicken or something
the damn thing challenged me in java but i did all the courses ;-;
but im struggling