#help-development
1 messages Β· Page 13 of 1
hmmm.. oky
new ArrayList(entrySet)
dont understand this part. im new to programming so bear with me here lol
??
i dont like the look of those yellow thingies..
oky
what do i do here then π€
should it be <Enchantment> instead?
christ this is getting confusing π
you can use placeholders
in maven it's called "filtering resources", but no idea how it works in gradle
in maven it's basically just one line in the pom, and then you can use placeholders in all resources like this
name: MyPlugin
version: ${project.version}
wait a second.. it should already check for incompatibilities..
but it says it does NOT check incompatibilities
you might have to manually go through the existing enchantments, then check if they are compatible with the new one
Does anyone know how to remove the Banner "Attributes/names" that occurs when you add a Pattern array to your BannerMeta
The five lines right under the blue "HOLD NAVN"
the world would've been perfect if it checked for conflicts lol
i dont think its possible. MAYBEEE one of the item flags (the potion effects one maybe) works https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html
declaration: package: org.bukkit.inventory, enum: ItemFlag
Yea i read abotu that, but it didn't seem to fix it
did you try to add all flags?
Hmm... nope, lemme try
try this
ItemStack item = ...;
ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.values());
item.setItemMeta(meta);
if this doesn't work, you can only use packets to make it disappear
Alright i found the problem
As i am new to the Spigot Api, please don't hate. I used the removeItemFlags, instead of addItemFlags.........
Welp, it works now, soo thank you :)
π
do you know which flag exactly was required to hide the patterns?
I just wonder
I read a post somewhere but i couldn't get it to work (because my dumbass used the wrong shit)
Perfect ;)
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/776/overview added. should probably be merged quickly π
Anyone knows why this might be happening
I'm adding the Residence.jar as library to my project
are you using maven?
did you add it to your pom?
and it reads that from the resources?
No, it works like this. one sec, I'll explain
mvn install:install-file -Dfile=Residence.jar -DgroupId=com.bekvon -DartifactId=residence -Dversion=5.0.1.7 -Dpackaging=jar
I did this
and then had
hot
when compiling, maven copies all the resources into the "target" folder, while replacing all the placeholders. The ${project.version} is whatever you defined as <version> in pom.xml. I am sure that gradle has a similar thing but I am not familiar with gradle
Are datapacks faster than plugins?
and did that show "BUILD SUCCESS"?
well depends, I guess
if the plugin is shitty, yes
Let's say you use the most optimal solution for both
it still depends. datapacks require to manually run many commands for certain things. in that case I think the plugin would be better
np
it should normally be enough to click the maven reload button
this one
yep
anyone know if jitpack is free for private repositories
it cannot access private repositories
it can
how?
acess token
does that file only contain information about this one player?
so only for this player? then I don't see any problem
it would be shitty to save a file that contains information about all players
no problem, go for it
but expect for admins to hate you
"uugh I have 7972 files now, this slows down my backup"
that's why I switched to using PDC for playerdata
because people used FTP for backups and that sucks when having many small files
Zip first then ftp 
I always just backup the entire VM's "hard disk file"
@tender shardok
can you tell me for what reason is maven trying to pull a dependency from repo thats not even supposed to have it?
im about to break something
It searches all repositories for dependencies
but for what reason
It tells me it cannot find the dependency in that repo
no shit
it's not there
;p It wants to be thorough
How's it supposed to know
You can specify which repos serve which artifacts
It's local
But how is it supposed to know without checking
It does
Maybe you're skipping a step
Stop jumping to conclusions
Your artifact might be in the wrong place
Or have the wrong version
Are you sure it's in maven local
^
And that you haven't specified another maven local in your IDE
yes
i used mvn install:install-file
to install it
same way I installed another one
Sounds like you made a typo
it tries them all, ofc
Get off your high horse lmao
We're trying to help you by running through everything that could be wrong that you haven't said
You still haven't shown us your pom or your file structure in your maven local
So the ways we can help are pretty limited
We're not psychic
do mvn clean compile -U -X then send the full log
are you sure about that?
your under estimating my power π
then you did not have it in your local repo
I did
can't be
It said build succesfull every time
apparently not
if it didnt work, but works after installing it, it wasnt in your repo before. otherwise this wouldnt have fixed it
But you never actually checked that the file was where you expected?
million times
this time it worked
dude
I used
the same command
20000 times
and somehow it works now
And you expected it to do something but never checked that it actually did
my bad i expected it to work when it said build successfull
Then acted like we were insulting your intelligence by asking you these basics
When you're getting mad at code you need to take a step back and cool off
When you're angry you become much worse at debugging
You get tunnel vision
and drink some vodka?
definitely sounds like drinking vodka
try gradle, it's even more annoying
Only if you can hit the ballmer peak
oh shit
I don't do enough cocaine to hit the ballmer peak
and with "not enough" i mean "none"
:sad noises:
I took a lot of THC yesterday and played clash of code
I was actually a god somehow
I think I hit my ballmer peak at some point in there
I can't code after weed. but I don't do it since 3 years anymore anyway
I got a 41 second submission on one problem
And it wasn't a one-liner, it was like 4 or 5 lines
Found out event priorities are on the byte scale. Priority.HIGHEST = 64. Will priority be EVEN higher if i change it to 127?
this is pretty relatable to me though
Time feels a lot slower when I'm high
yep
So maybe the answer is that I'm actually in perpetual bullet time
Which lets me think and type inhumanly fast
Can't think of any other explanation because a 41 second solution is insane
Lmao yall talking bout weed in #help-development Now thats funny
lmao i just sleep
makes me tired
has anyone ever done the thingy that makes a compass point to the closest player?
that's what this channel is for lol
it's basically ```java
while(noQuestionPosted()) goOffTopic();
pretty much
there's my question tho
where?
here lol
literally right above your message xD
yes
lol
It's easy
any help pls? c:
what's your question?
Well what part are you confused about
I have no clue where to start lmao
We're not just gonna write all the code for you
how do I access the compass pointing?
Player#setCompassTarget()
and is there an specific way of getting the closest player or that's just algorithm?
oh lol
Hmm
you can do getNearbyEntities and then sort them by distance
thanks a ton but i didnt understand what you were saying. instead, i just ended up checking conflicts b/w the tool and the enchanted book's currently selected enchantment in the loop lol
I want to get the closest one with certain specifications btw
nice, does that have a distance limit? bc my players might be like ~1000 blocks away
Anywayβ¦
does this work for anyone else in 1.19 btw? or did the event break
Found out event priorities are on the byte scale. Priority.HIGHEST = 64. Will priority be EVEN higher if i change it to 127?
Maybe but don't
Wow
?
some tiny idea
static {
new Runnable() {
@Override
public void run() {
for(Player player : Bukkit.getOnlinePlayers()) {
setCompassTarget(player);
}
}
};
}
private static void setCompassTarget(Player player) {
Player other = getNearestPlayer(player);
if(other != null) {
player.setCompassTarget(other.getLocation());
}
}
private static Player getNearestPlayer(Player player) {
return player.getWorld().getPlayers().stream().filter(other -> player != other).sorted((o1, o2) -> (int) o1.getLocation().distanceSquared(o2.getLocation())).findFirst().orElse(null);
}
ofc the runnable has to be scheduled
I just quickly typed this down, might have a quirk or two, but this is the general idea on how to make everyone's compass point to the closest other player
wdym with byte scale
also didnt you post that like 3 times already today lol
Variable βbyteβ
Was desperate for answer lmao
i still dont get it
there is no variable called "byte" in EventPriority
you cant?
I litteraly did at home
I still dont get it
but wont that just jump back to the default since it doesnt recognize the priority ^or doesnt even compile
Maybe its on paper. Sorry bout the confusion bois
have to be
It didnt show me errors at home
paper also doesn't allow a byte value
are we talking bout thread priority?
Was i in an alternate universe
probs
well a wrong import would also not compile
Thread allows to use an int for priority but it must be between 1 and 10
at least it must be between 1 and 10 in the JDK I'm using lol
I wonder why they didnt allow to go from -20 to 19 like UNIX does
Is there a way to check whenever a bell is actually used, rather than just clicked on? (if you click on the sides it does not activate)
fair point
I FUCKING HATE PEOPLE LIKE THIS
- Ask a question
- Reply to yourself "nvm I figured it out" without providing their solution
- Also close the thread
lmfao
It's fine I'll just use sides
They should be banned ngl
I also dont understand why people close threads in the first place. Someone else might have a question related to it, found it on google, and then they cannot replx
fr
but thred necroooooooo nuuuuuuuuuuuuuuuuuuuuu
JavaDocs is a Thing, they know that?
to whom are you replying to?
the Dude in the Image
but erm
looks pretty good, I think I'll try it later (: I'll just have to change a thing or two to fit another verification but pretty much what I needed, tysm
no problem! Have you used streams before?
nope but I think I'll have to learn it now! lol
Wanted to learn about that already anyways so better now than ever xd
you could of course just replace the stream with a for loop, or take this as a go to look into how streams work :3
yup, I'll do that xd
basically the filter(...) part just removes the "own" player from the list, then the sorted(...) stuff sorts the remaining players by distance
we're using distanceSquared instead of distance because it's faster, it doesn't need to get the square root like the normal distance method would have to do
and yeah then it just gets the first player in that list (so the nearest one), or null if there is no other player
i fucking love GH copilot
wake me up when september ends (because then I gotta renew my github thing). until then I don't have to code anything, just press tab
how can I check the direction of a block btw
you can't cast block to directional (well you can but it errors)
cast the blockstate to Directional
tbf I don't need instanceof Directional since I only need it for a particular block type
ohhhh nice
Yeah, that actually makes a lot of sense in the code lol
sorry if I take a while to answer, I'm working on 1 pc and here on discord on another lol
yeah I already love them bc they always seem so useful, I just get scared of the ->(){} thingies lmao
those are lambdas
but explained it makes sense and makes it easier to understand so tysm
yeah lambdas scare me lol
class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftBell cannot be cast to class org.bukkit.material.Directional (org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftBell and org.bukkit.material.Directional are in unnamed module of loader java.net.URLClassLoader @484b61fc) casting block.getBlockData()
they are easy
they are like functions
but without a name
actually
they are fun
they are literally functions without a name
and hot
Consumer<String> string = str -> {
return "String: " + str;
}
string.accept("hey"); // String: hey
and
public String string(String str) {
return "String: " + str;
}
string("hey"); // String: hey
are both the same
only that lambdas can be passed as variables in functions
@willow widget
dont call it string two times π
wdym
yeah that won't work
oh ye
fixed
ofc you can just type "String: " + str after the -> but with return you can understand the example better so ye
also alex
what is that bs
I'm trying to get an entity location off thread, is there a good way of doing that?
cast the state not the data?
why async?
Safest way is to jump back to main get it and then go back off thread
^^
I am used to fabric with getDefaultState() but only getBlockData() appeared, so I assumed it was called data in spigot
(tried getBlockState as it made sense)
oh wow I just had an extremely nice chat with someone who uses one of my plugins on 1.8 even though it only supports 1.9+
and that dude was really extremely nice
didnt expect that
lol
some 1.8 players are chill
That's a rare find
yeah I was kinda surprised lol
Directional directional = (Directional) block.getState(); why does this error
I am confus
show the error
ngl kinda got confused, where did the string.accept() come from? XD
ty, just saved the link for study after work hehe
if you take a look at the consumer interface you ll see java interface Consumer<T> { void accept(T t); }
I want to detect whenever a player open a book in a lectern, do i just use PlayerInteractEvent?
it's part of Consumer
tbh I think what Ike send is a very confusing example
stuff like what he sent made me hate lambdas etc lol
that's why I wrote the blog post, it explains it in a way how I would have understood it lol
I'll just give a more "real life" example
this
can be replaced with this:
notice how the "Comparator<Location>" only has one method, with the parameters being called "o1" and "o2"
and the lambda way just starts with (o1, o2) ->
and then just declares the same thing
tbh I haven't use declarations that way either so it was kinda confusing XD
not my best idea to learn this stuff while working π©
oh alright lol. Just check out the blog post, it's explained as easy as possible there
mfnalex you should make a post on custom heads with spigot api
yeah, will do lol
I'm tired of explaining it
custom heads? wdym?
you mean base64 texture?
Yes
I always just send people to my SkullUtils class
Ew NMS
(I'm NOT using PlayerProfile because this is supposed to work with 1.16+)
Make a post on the new api
yeah could probably do that
or you write it π
I hate writing on my macbook because it has this broken keyboard that sometimes adds double letters
Not home for 2 weeks and I'd rather not write that on my phone
<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>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
</filters>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>H:\server\server\plugins\${project.name}-${project.version}.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>
Why it does not shade?
what's up gamers say is making a sex plugin allowed on spigot
how do you compile?
I think so
maybe ping optic to be sure
@vagrant stratus
Anybody know a Coinsapi which works for 1.19
wtf is a Coinsapi
should work. But why did you define a different location for the shaded .jar?
playerpoints
why? it doesnt say so in the rules
I want to output it to server dir
No
delete this then https://www.spigotmc.org/resources/du-sexe.92089/
you should rather define the output location in th emaven-jar-plugin
lmao
I thought you wanted to do a sex plugin yourself
something's wrong with your head
but how does it work? spawn NPCs when two players right click each other?
why would I make a sex plugin for a game whose main audience seems to be 9
to teach them to use condoms, wtf do I know lol
I believe it is grabify
that goes into the list of top 10 things that will not get you out of the lawsuit going your way
Later lol, dealing with PC stuff
are the javadocs valid english? copilot wrote it, but i never heard "farthest" before
it just goes to google.com
yes
It is correct
kkk thx
hol' up
that's a crime, one too many k's
afraid that gets your account banned
nooo
it's "kkk"
I always do it like that
enjoy jail bigot
when I am extremely satisfied with the answer, I might even go "kkkkk"
NO U
now that does hold up in court, if you say that to the judge after sentencing the judge has to go to jail
how the turntables...
lawyers hate this one weird trick
I can confirm this. I used this many times while I was still a lawyer
disgraced lawyer is a term with such a negative connotation, we prefer using differently graced lawyer around here
i tried to convert an ItemStack to json - but it throws this error: Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Object java.util.Optional.value accessible: module java.base does not "opens java.util" to unnamed module @60fad1ab
my code: ```java
import com.google.gson.Gson;
// it = instanceof ItemStack
// gson = new Gson();
invv.add(gson.toJson(it, ItemStack.class));```
ItemStack already has a serialize() method that returns a Map<String,Object> and also implements ConfigurationSerializable - is there a reason why you want to use json instead?
to save it to a file
You can just use a yml file
I'd just use a YamlConfiguration
myYmlConfig.set("item",myItemStack);
?config-files
?customconfig
What was the command again
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Ah
i already have everything done
except inventory saving
first draft trying to actually link my projects together on spigot, how's this looking?
ignore the path at the top i forgot to properly crop it
that doesnt really look like json to me o0
what if an item's name contains ||| because someone renamed it on an anvil?
probably just urlencode it
or just swich to even more complex split patterns
ku klux klan??!?
why dont you just go full json for your data
Or yml
or make your life easy and use a Yaml
yeah
sorry but your current solution looks like a horrible workaround
@tender shard They are not attachable either
hm
one sec
okay I also couldnt find anything
oh wait
I remember
they indeed dont have any "facing"
yeah they dont have any facing by design
they always "attach" to all blocks that are "nearby"
last time I checked, they always attached to all "nearby" solid blocks
The MultipleFacing interface implements those 6 facing blockstate fields
And is used by regular vines and glow lichen
fyi for that sex plugin I warned about earlier, there's a decent chance the author's spigot account is compromised or something, somehow it went from a restart with a custom message plugin to a sex plugin and the version also went out the window
I don't think that's quite right
hm then I also have non idea, sorry
if you're really concerned about that, report the resource or send an email to tmp-support@spigotmc.org
See how it works in NMS. If it's like a vine make a PR and add the interfaces
I'll just wait, it's fine
I reported it, I don't really care beyond that just noticed I still had to tab open
dl it and run it at your own risk
Sounds like malware if account is compromised
preferably in a vm
Decompile it and take a look
are there any other comparators that one could commonly need in spigot plugins?
What is the best way to save information and store it in files? So that each player has their "own" file
just store it by the player's UUID
<uuid>.yml
yep dl page just leads to google the fuck is going on with this lol
do you need this data to be accessible even when the player is not online?
store the "end date" in some file, then check every second / minute if that date has been reached
Yea
player by distance is a huge one and one that is very easy to optimize for
how?
skip checking all entities check only online players
oh yeah but I didnt even have any player location comparator yet, do I? lol
Im trying to make a "teams" plugin, and i need somewhere to store information for each player, like what team they are on, their roles etc.
I thought people can just use the entity one for players, no need to get an extra one for that
Most efficient way to place multiple blocks?
how many blocks?
I'd say at least 80% of distance checks are for players specifically so I would do it
but one could still use the entity one
I mean it's just a comparator, it doesn't get the list of entities itself
100+
oh
if it's less then, say, thousands of blocks, just use the API
I thought you were also getting the list
Location#setBlablabla?
no, physics updates like water
someBlock.setType(Material.AIR, false)
can i make low horizontal knockback multyplayer on 1.8?
Oh
this will stop physics checks like... whether signs are attached to that bblock, etc
what is a low horizonntal knockback multyplayer?
What if its over 1000 blocks?
? :) and if i do <UUID>.yml how exactly do i create a file for each individual? I've seen some tutorials, that could help, but they didn't create files in a seperate folder. if this makes any sense at all
just use the API for now, with physics disabled. If you really run into problems, read this https://www.spigotmc.org/threads/how-to-set-blocks-incredibly-fast.476097/
can i modify knockback power?
So like
plugins folder >
Teams folder >
TeamPlayerData folder >
*lots of files with seperat player files*```
You can just do something like this
File file = new File(playerUUID + ".yml");
if(!file.exists()) file.create();
YamlConfiguration config = YamlConfiguration.load(file);
i dont know. 1.8 was released like 3 years before I started coding plugins, which is also already 4 years ago
Mfnalex, but if i wanna create files in a folder inside the plugin resource folder, how would i do that
how about
just no
slayy
then you just use getDataFolder(). example:
File myFile = new File(myPlugin.getDataFolder(), "filename.txt");
if im going to make a gui leaderboard, would I just loop for every player and check who has the highest score?
Im really sry for being a pain, but doesn't that just get access the the plugins resource folder? where the config.yml is stashed aswell?
yes, you want to use a subfolder?
Yea if thats what it is called :)
/plugins/MyPlugin/filename.txt is what that does
okay fine the NBT tags dont even work
as shown in this bad example xd
File subFolder = new File(getDataFolder(), "playerData");
File perPlayerFile = new File(subFolder, playerUUID + ".yml");
NBT? π’
are you on 1.8, or why do you use NBT?
Thanks
i'm just used to command blocks, the {display:{Name:'{"text":"yippee","italic":false}'}} stuff
@tender shard
you can "nest" files like this:
File file = new File(parentDirectory, fileName);
oh ok
I thought you wanted to store information inside entities / items / blocks or so
because since 1.14.1+, we got the PersistentDataContainer for that stuff
it's like "NBT on steroids" lol
(in a good way)
yo does anybody here know how to set the "You can sleep only at night" text
i know its possible
just send an action bar message
thx
somePlayer.spigot().sendMessage(ChatMessageType.ACTION_BAR, "You can only sleep on... DAYS?!");
lmao
I still wonder why Player.Spigot exists
@worldly ingot Do you know this maybe?
why didnt they add the methods directly to Player
Oh yes, my bad
TextComponent.fromLegacyText("text")
somePlayer.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("You can only sleep on... DAYS?!"));
or that, yeah
:D
Some methods from there were added, others weren't. They're mostly legacy, but the reason we still do it now-a-days is if we have to in order to avoid name clashes
For instance, Inventory#getTitle():String and Inventory#getTitle():BaseComponent[] can't both exist because they have the same signatures
(those don't exist, but it's an example)
hmmmm yeah
oh if only they existed
so it's basically just for legacy reasons
Mostly, yeah
makes sense, thx :3
yeah
everything below 1.14 is complete shit
well it was good back then, but now, not so much π
that's how it works lol
what if I made it automatically choose between .yml and .yaml
wdym?
normally it's just .yml
and since you generate the files yourself, you dont have to worry about whether its yml or yaml
man how am i supposed to verify if my account is already verified to a different deleted one π
you ask support
either ping one of the green staff membes, or you write a mail to tmp-support@spigotmc.org
I think only the green staff members can do this
@worldly ingot
no can verify (my account is already verified to a different (deleted) discord account))
I want to have some builds saved and then load them in. Would I use api?
yes
So block#?
Block#setType(Material, false);
i have a project to make which is FarmEXP, Grown Crops drops Experience Orb
i have a problem to add Pumpkin which will cause players to keep getting Experience Orb, is there a way to prevent this?
my use is BlockBreakEvent on Wheat,Potato etc.
you mean you wanna detect whether a block is naturally grown or player placed?
yes!
I have made a library that lets you store information "inside" blocks
shit, wrong link
it automatically resets when a block gets broken / naturally grows etc
so you just do it like this:
in onEnable, use CustomBlockData.registerListeners() once
Can I get block from location?
then in BlockPlaceEvent, if its a pumpkin, set some custom data to that block
nbt data exists π
and in blockbreakEvent, check if the broken block has that custom data - if yes, dont do anything
not for blocks, bro
fair nuff fair nuff
getLocation().getHlock()
Thanks
What is so special about pumpkins?
awesome thanks will take good look at this cause this is my first plugin, i made it this far so should be doable thanks mate β€οΈ
they asked about pumpkins, so I suggested that
Oh I thought I would do it when placing the blocks
I guess the difference between wheat / pumpkins is that wheat needs time to fully grow, while pumpkins don't have any "age"
excacly :3
no problem π I hope you're using maven though π
wtf Jonathan Nathan - your parents just added an extra syllable to your last name and used that as surname lol
i will try, i kinda like doing this, feels like brainstorming :p
so i am trying to get a list of materials from my config and check if the block under matches one of the materials in the list but for some reason its not getting that list, i am using the ItemsAdder api
String ns = event.getNamespacedID().replace(":", "") + ".can-place";
if (Iaddon.getInstance().getConfig().getStringList(ns).contains(bunder)) return;
feel free to ping me if you got any questions π
lol
wdym "not getting the list"?
is the list empty?
or is it null?
no the list contains GRASS_BLOCK
ehm if it isn't much to ask is it okay if you could send me message of all the stuff you said, just hate to scroll up and down π
okay so it retrieves the list correctly - I don't really understand what exactly the problem is, can you try to rephrase your question? π
lol erm I could DM you with one message and then you can copy/paste the messages yourself there, because tbh I am too lazy to look them all up again
so i have an error message that prints to the console and it shows the path is correct but it isnt accessing the path
Iaddon.getInstance().getServer().getConsoleSender().sendMessage("[BlockLimiter] "+player.getName()+" Was denied placement for a block, namespace - "+n[0]+" | Id - "+n[1]+" | block - "+bunder+" | ns - " + ns+" you can disable these messages in the config");
?paste the FULL stacktrace please
not a stacktrace its the code above
please use proper logging and not that :)
ok but any reason this isnt working
How does it Not work?
"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.
does anything like YamlConfiguration.getFloat exist? it's weird that getDouble, getInt etc exists, but when it comes to Float, only getFloatList works
just do getDouble and cast it to float
good idea
float number = (float) myConfig.getDouble("...");```
so umm it is getting the list
why isnt my if statement returning true though
What ist bundler?
the block under the placed block
which if statement exactly?
String ns = event.getNamespacedID().replace(":", "") + ".can-place";
if (Iaddon.getInstance().getConfig().getStringList(ns).contains(bunder)) {
return;
} else {}
i did
k
Bukkit.getLogger().info(Iaddon.getInstance().getConfig().getStringList(ns + " " + bunder).toString());
block under
Is it a String?
if bunder is a block, ofc it will not be "contains" in List<String>
you should use bunder.getType().name() instead
(also, don't call List#contains too frequently)
well [17:39:31 INFO]: []
So it's a collection?
its a list
just send your full code
Do you want to Check whether all Elements prΓ€sent in that list at prΓ€sent in your config list or what?
prΓ€sent
Autokorrektur ist halt blΓΆd
what? lol
@ OPTIC BAN BBAN BAN HE SPOKE GERMAN
BAN
?BAN
he speck german
Anyways, do bunder.toDtrimg()
@ COn CLU Re @ Ge OL sopek on german
bunder.getType().name()
Binder is Material
why getName() tho
Under is location
then its a string
Exactly
getName() is just a fancy method that does the same as toString() and name()
your IDE should cream at you for using contains(Material) anyway
what if i just do
Iaddon.getInstance().getConfig().getStringList(ns).contains(bunder.toString())
You would want to have a Set<Material> either way If Performance is a concern
What is better for getting specific block?
Location location = new Location(bla);
Block block = location.getBlock();
Should work
Depends on circumstances
IntelliJ would tell you that a List<String> cannot contain a Material
Please use Di over singleton!!!
?
Isnt di better?
some people claim it's better and then give obscure reasons
imho both are equally good
yoooooooo thx gy\uys
Oh ok i stoped to use it because all here doesnt like when someone uses DI
did you fix it?
Depends on what DI
a static getter is perfectly fine for stuff that's a singleton by design anyway
yes i get no place message if i place on anything other than a GRASS_BLOCK
Guice DI and Friends belongs in the locker
did anyone knows how to change biome of custom world?
biomeProvider(String biomeProvider) i've seen this method but i don't really know how to use that.
Guava isn't a DI lib, my Bad heh
I also always have to laugh really loud when people claim "lombok is shit" but use guice at the same time lol
Did the existing attributes in plugin.yml change with Minecraft versions?
https://www.spigotmc.org/wiki/plugin-yml/
not really
I mean, for example, on 1.7.10 were the same attributes or were some of them missing?
1.16.5 added the optional "libraries" tag
1.13 added the "kinda-optional" "api-version" tag
that's it
What does do that extra tag?
which one
api-version
How would I give a player the warden's darkness?
if its not present, all the enums in MATERIAL you get will be the legacy names
I always set the api-version to "1.13"
By the way, does anyone know if this plugin has backward compatibility?
https://www.spigotmc.org/wiki/spigot-plugin-yml-annotations/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
And the Server Starts a good 10 Seconds later than usual
thats not a plugin
okay, and what about when need to block all mobs entities damages on 1.16 and 1.19
yeah
it takes ages on my macbook to init the legacy stuff
like 30+ seconds
"resource" π
mfalex?
mfnalex
i have that dude tho
i've had a few dudes myself
bump
player.addPotionEffect
you dont have to bump stuff after 30 seconds
?jd-s
@fleet comet π
Optionstype.DARKNESS?
in what?
declaration: package: org.bukkit.potion, class: PotionEffectType
oh
just apply this potion effect to the player
Yeah, ofc
does this look better
All effects that are visible on the top right bar are potions
better than what?
or you mean your ||| thing
yes, it's WAY better
i just thought cause i couldn't use /effect
Nah the (float( getDouble()
it is 100000% better
why are people doing config.load and catching the exception instead of YamlConfiguration.load(file)?
thanks
Ah that
like this?
yes
ye
(it's basically the same thing)
Because catching can be usefull
yeah sometimes you wanna throw your own error msg instead
Or handle stuff gracefully
ye but most of the time i see people doing it and just printing the stacktrace
not very gracefully then
yo ive got a question is it possible to fire a custom made player death event
Whatever - it does the same thing
it should get fired when you do this
true, i'm still learning java and have no idea how to send something other than location, so I just throw an error and then just catch it
yeah ive just had a silly idea
will try and confirm
Event constructors are Not Public API so only kinda
no problem, you can do that without problems
well but they literally NEVER changed
False
EntityShootBowEvent
Oh okay
Or something like that
what has changed there?
Don't really remember, lemme Look Up ancient EnchantmentsPlus Code brb
Basically added a few args https://github.com/Geolykt/EnchantmentsPlus/blob/3xx/src/main/java/de/geolykt/enchantments_plus/compatibility/CompatibilityAdapter.java#L929
@tender shard im guessing for writing something like this? sorry if im being annoying lmao
thats how i did it https://paste.md-5.net/sepizitire.java
how did you get that to compile? o0 did you add the old AND the new API as dependency?
Reflections
looks good but you should print the error when saving failed
wtf how to use it
just use ACF instead
what is it?
ACF is way more powerful and has better documentation
acf π
thx
but what versions does it support?
dog marriages?
basically every version
?paste the stacktrace
not sure why saving a file per mariage
well you can but you'd end up with alot of small files meh
why is there no setDrops method for EntityDeathEvent
yes
because noone added it yet
HashSet#forEach isnt going to follow its insertion order right?
can I modify the list from getDrops?
how do i make a reload command
wdym?
depends on what you need to reload lmao
@tender shard oh my god it actually works (except for effects for some reason)
tysm
you register a command and then inn the executor, do everthing that's needs to be done to reload your plugin
Iaddon.getInstance().saveConfig();
Iaddon.getInstance().reloadConfig();
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&3Reload complete!"));
was this sarcasm
why do you save the config?
no
well
dint you need to
it did let me add items
Is it possible to put a subcommand in a separate class with ACF?
no, it makes no sense
im just making my subcommand in different methods
I dont think so
how would i spawn something 1 to the left and 1 up of the player?
hm maybe I am confusing it with the BlockBreakEvent's getDrops method (or was it BlockDropItemEvent?)
There is definitely at least one event that has a getDrops() method where you can only remove things, but not add any new things
get the player's location and then do some math π
getting the "left" side of the player depends on where they are looking at
did you try on plain spigot, or on paper?
oh ok
spigot
I am 100% sure that at least for block drops, the drop is immutable (except for removing things)
but if it works, it works, so eversthing fine I guess
or maybe it was only immutable in older versions. I really cannot remember
it's BlockDropItemEvent
oh yeah
although it'll still be possible to mimic adding a new drop though
by just spawning a new item on the break location
i wonder why spigot doesnt do that
yeah its weird
I also have no idea
that's basically why my Drop2InventoryPlus plugin has to use very weird complicated things to properly detect block drops D:
idk what that plugin even is
it makes drops go directly to your inventory
instead of actually dropping them, only to wait for players to pick them up 1 second later
https://www.youtube.com/watch?v=FyHi2eT-BvY&feature=emb_title basically just this
Drop2Inventory Plus is the best automatic drop collection plugin available! Compatible with all other plugins! https://www.spigotmc.org/resources/drop2inventory-plus.87784/
oh
i see
also question
elixir-max-age-increase:
overworld: 10
nether: 15
end: 25
how do I read the values of overwolrd, nether, and end
is it just config.getInt("elixir-max-age-increase.overworld")?
yes
alright
hey, quick question - to customize the behaviour of an existing mob (say, to make horses walk faster across the board) would i still create a custom entity?
there is still no custom entity API, so yes - you'll need your own NMS version of horses
so i have this and it executes twice for some reason player.sendMessage(ChatColor.translateAlternateColorCodes('&',Iaddon.getInstance().getConfig().getString("messages.wrong-block").replace("%player-name%", player.getName())));
are jitpack private repositories free
You are creating an instance of your main clas somewhere
but when i dont registre it it doesnt work (obviusly)
in your interactListener constructor
what
you can only have a single class extend java plugin
and a single instance of that class
but when i remove it i cant acces the config
see this
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
and then set that in the constructor
after that you can call plugin.getConfig()
and go from there
note```java
private final MaginClass plugin;
private final String configValue = plugin.getConfig().getString("path");
does not work
you have to do that work in the constructor
give it a quick google search xD
no
the main method is just an example
on what it means to have a parameterised constructor
like that?
public Main() != public static void main(String[] args)
a plugin does not want/need a main method
if Info is your main class nam,e
then yea
sure
you should use Strings instead of the actual UUID object
why dont you just look at the jitpack website
probably old enough to buy booze by now
basically like this
// when saving
myConfig.set("uuid",uuid.toString());
// when loading
UUID uuid = UUID.fromString(myConfig.getString("uuid"));
I mean,
- Please don't register events in the constructor. This should never have been a trend because doing
new InteractListener();in your onEnable() is so non-descript Bukkit.getServer()>plugin.getServer()every timeMainis not a great name for your plugin's class because it entails that it's the main entry point of a program (e.g. has themain()method)infodoesn't exist. That's why you're getting errors ;p
Is there a way to replicate the cooldown animation displayed by minecraft for attacking and shield disabling with the bukkit api?
Yes. I PR'd it a while ago. It's Player#setCooldown(Material, int) iirc
?paste
Time in ticks
hmmm So i'd assume its impossible with specific item stacks
Yeah
do you think i could get away with sending packets to achieve the look atleast
Can somebody check out my item system for any things i can work on it with? https://paste.md-5.net/epomefolop.cs
Those cooldowns are set to types, not stacks
- yeah, registering in their own constructor is a weird design flaw.
- I disagree, it's basically exactly the same thing, so no problem
- I kinda disagree. It's the "Main" class of that plugin, after all
- Makes sense π