#help-development
1 messages · Page 107 of 1
never done smth related lol
1.16.1
That’s when Mojang added biome registry syncing
you just gotta add your custom thing to the "registry" thingy
lemme look through my NMS code
this is how I get the biome per location. it uses the Registry.BIOME_REGISTRY https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_19_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_R1/NMSBiomeUtils.java
basically you can just add your own biome to that registry and that's it
(but ofc this will not alter the default world generation, in case that's what youre talking about)
yeah
(although I hate datapacks)
(because I dont understand how they work)
does anyone here know the Blaze and Caves datapack or whats it called?
idk that one
I used to use this in my ingame events
I used to do advancement speedruns with a custom plugin
e.g. people did /challenge and it opened a GUI with "non-vanilla" achievements and whoever did one of those first, got some prize
e.g. "be the first one to have a full set of "flower pots" with ALL kinds of flowers in one chunk"
stuff like that
or "look at a beacon with a spyglass from at least 200+ blocks distance"
Way to much bloat
but it makes a great thingy for stuff like give away events
Advancements are meant to be neat little challenges, not “Craft a trapdoor”
How to run WorldCreator#createWorld() async?
you don't
then how can I overcome that stall?
maybe paper has a feature for this
when generating
but lynx probably would have said that already if there were any
I mean, world loading is slow /shrug
https://bukkit.org/threads/creating-a-world-asynchronously.243470/
#16
Wondering if this could work
on paper you can disable loading the spawn chunks
yee but it just laggs everyone at server
you can do same thing in Bukkit
no
what ?
since when does bukkit/spigot support not loading spawn chunks
that feature does not even exist in spigot 
@EventHandler
public void disableInitChunkLoad(WorldInitEvent e){
e.getWorld().setKeepSpawnInMemory(false);
}
I meant Spigot
?xy
Asking about your attempted solution rather than your actual problem
what are you trying to achieve?
Im just trying to create worlds without having all players stuck on place due to lag
I'd go for bungee and use a separate server
how big are those worlds?
are they limited in size?
300x300
if so I'd use a "placeholder" void world
you can load a void world on startup
and then paste your "world" into the void world
but how to generate terrain after
by using a normal world and using per player world borders
and just teleporting them to that world?
teleporting but also changing some blocks at some coords
why dont you just use a totally normal world?
and then you can keep track of stuff like
player 1 has its world at 0|0
player 2 has its world at 1000|0
player 3 has its world at 0|1000
etc
im creating minigame
and for easier management im creating new World for each game
since each Game doesn't need that much resources
its really light weight
except that generation part
yeah but that's overkill
why not use the same world for all games
just put them apart by 1000 blocks if its only 300x300
don't want to manage Tab
hm
well
but yeah world loading will always cause lag
if not even paper has a feature for it, then I am pretty sure you cannot just do it in spigot
if I would just use void world and then for each chunk in border I would do : chunk.load("generate"true);
it would lag, but I could controll when it will lag
?
How can i change all words i texted in the class?
"generate"true?
by using your IDE's search and replace feature
e.g. Ctrl+R in intelliJ
"generate" that IntelliSens thing
in case you wouldn't know what that true would do
oh I see
you could try to use PaperLib
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user "+ player.getName() + " meta setsuffix "+ badges_int +" §7§lʃ §f§lѺ");
Hi, I want to put a suffix of luckperm from the console but there are spaces so it doesn't put me the whole suffix.
it can create new chunks async on paper, or sync on spigot
ooh never head of that
@eternal night is PaperLib still a thing?
yea
Because there's so many nice features I could think of
e.g. making stuff listen to PlayerJumpEvent
You can always PR those
If I'll add BukkitTask to the Map<Location, BukkitTask>, after scheduled task execution Map.containsKey(blockLocation) will return true or false?
not my kind of stuff lol
I mean paperlib only uses paper api
nothing internal
you don't really have to understand paper lol
e.g. suggestion for PaperLib:
A PlayerJumpEvent. On paper, it uses the native event. on Spigot it could use the IncrementStats event
PaperLib is executable?
I thought its some sort of API
and then pass it on to plugins
so people can enjoy the jump event on both spigot and paper without having to worry about whether someone uses spigot or apper
I am storing itemstack by their custom model data. Would it be a risk?
PaperLib is something you shade into your own plugin
it wont remove itself just by executing if thats what you mean?
not really tho like, why not just some key/value in the PDC
ooh
also prob. time to look at some tutorial about it
if youre willing to dintinguish those itemstacks, yes
still true
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user "+ player.getName() + " meta setsuffix "+ badges_int +" §7§lʃ §f§lѺ");
Hi, I want to put a suffix of luckperm from the console but there are spaces so it doesn't put me the whole suffix.
PDC is so long
wtf
yes, that's what I meant. I thought if it'll become null map pointer will return false
wat 😂
PersistentDataContainer is a long word, yes
but your IDE PROOOOBABLY has a tab-completion feature
All of its methods either
are you currently complaining about method name length ? xD
no
I think
what they mean is this:
- you gotta pass in the namespacedkey (damn, what a long word)
- you gotta pass in the data type
- you gotta pass in the value you wanna set
Well yea, you gotta pass a few "a lot of characters to create" parameters
i asked this yesterday but didnt get a working answer, any ideas?
some people complain about PDC, meanwhile I'd totally make out with lynx for adding it
PDC for real is like NBT on crack
item.getCustomModelData();
``` which is longer
it even has stuff builtin to translate your complex classes into primitive stuff that are "storable"
the first one. but the first one does something different
obviously
mate you are coding not writing an essay
there also is an executable which helps people manage their papers 💀
and I downloaded that one ☠️
I mean, what's longer? the chinese wall, or your cock?
a method length is not a valid argument
the chinese wall is longer but it's also something very different
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user "+ player.getName() + " meta setsuffix "+ badges_int +" §7§lʃ §f§lѺ");
Hi, I want to put a suffix of luckperm from the console but there are spaces so it doesn't put me the whole suffix.
It fucks the brain
wouldn't you wanna use the luckperms plugin API
if a method siganture of that size "fucks your brain"
maybe don't code java yet ?
the design of PDC is straightforward. You toss in
- the "name of your key"
- the datatype you expect
- THATS IT ALREADY
if you have problems with that, maybe take a look at assembly
all "methods" there are only 3 letters
Ok mfnalex
asm is meant only for gods
instead of getPersistentDataContainer(), it should have been getPDC() 😛
😡
lol
I mean, for all I care, static import the data types
store the PDC in a variable or smth
pdc not contains untickable blocks
I have PaperLib setted up..
Should I get chunk async and try to async generate it?
what plugin are you using for that auto completion?
the way u completed new NamespacedKey..
Github Copilot
copilot gang
it's paid, unless you have a university or school email address
item.getCustomModelData(); shorter btw
yes
you know what else is shorter?
player.kick()
copilot is free with school emails? hell yeah I need that
yeah limpeex is trolling since hours
it is
well
at least it is for my university email
apply for github student pacl
I'm in 19th semester now lmao
u gotta have some form of verification of being in school
I have 2, maybe one will work
like a report card or somthing
the "verification" is just the email address
i had to send my report card
wtf
got it a few hours later but i checked 2 weeks after
hm then your school's domain isn't part of their "trusted schools" list
yeah its not
well almost all universities get accepted automatically
i can say with confidence no one has ever tried to get github student pack in my entire school
e.g. I got unlimited @still fulcrum-muenster.de and @wwu.de addresses and they all get accepted automatically, everywhere
at jetbrains, at github, at adobe, at microsoft, ...
im not in uni
yeah okay
im in a school
alex tries to present as many counterargumen as he can
if you're only on a "regular" school, then yeah they will have to accept it manually, that's normal
thank you
lmao
about what?
actually I think this is time to block this troll
I am not a troll
you are
and I gave you examples of what's even more short
player.kick() is even shorter than myItemMeta.getCustomModelData()
ahhh right shorter code
somehow some people think that verbose methods are bad
save the bytes
I for myself would rather System.out.println(...) than doing std::cout
like wtf is cout?
does anyone know?
if your method name doesn't trigger a word wrap you are not doing it correctly
meanwhile "cout" = whut?
System.out.print(String) is java's version of std::cout
yeah i know
yeah but what's the question then
i dont even know
lol
saw you comparing std::cout to sysout
Giorno are you italian?
no im british
or however its spellt
means day
weed all day
I stopped putting the weed into my body 3 years ago
now all I inhale is jägermeister and tobacco
and, sometimes, fresh air
while(!dead) breath();
no wait, I can do this better
all i breathe is air
@Override
public void tick() {
if(!dead) breath();
...
also where my name came from but Felix420 was taken
dont forget to run it in a scheduler
why not Felix42 or Felix421
why not Felix_420
doesnt flow as well
not needed - it's overriding the entity's tick method which gets called by the server itself every tick
why not Xx_Felix420_xX
already had a xX_Xx name at the beginning, not dong that again
was hilarious at the time
Yes, but I had already tested but there is no setSuffix
when initialising an NPC is there a way to change their name after setting their GameProfile
Update the name and respawn the npc
getting such an ugly GUI requires THIS many lines of code: https://paste.md-5.net/owegowudum.java (and it's only paaaaaart of it)
bruh
ive always hated guis, especially since im mostly a rust dev and the gui ecosystem over there is hell
GUIs are always hell
I do GUI apps since 10 years and they are ALWAYS hell
What do you need bro?
apple is the only company that got it at least HALFWAY right
I seen a ping from you
i dont remember pinging you
you gotta be german
yes, but why?
"since 10 years"
how do wildcards again
oh
seit 10 jahren
is it "for 10 years"?
yes
I mean it was like 19hours ago
yes
Hello guys, I'm trying to add mongodb on my plugin, but when I start it using java -Xmx1G -Xms1G -classpath "spigot-1.17.1.jar:lib/*" org.bukkit.craftbukkit.Main The console give me this error: java.lang.NoClassDefFoundError: org/litote/kmongo/KMongo, everything is working in the plugin
that would be correct i guess
yea
it would be
What are u doing?
trying to make the check generic
but you usually dont say it like that in this context
im checking if all instances of the innermost arraylist are exactly 1 in size
you have to shade the mongo lib you're using
are you using maven @austere wave ?
Yes
?paste your pom.xml file
for(ArrayList<ArrayList<?>> list1 : rItems){
for(ArrayList<?> list2 : list1){
if(list2.size()!=1) return false;}}
return true;
Lmao i was going to cry when ser the for
https://blog.jeff-media.com/common-maven-questions/ @austere wave read the second headline in this pls
but if i say T instead of ? it says 'symbol not found'
Me that I only like lambda stream
what's the problem? You cannot just use T without having it declared in the method signature
How to use PaperLib with NMS Remapped?
public <T> ArrayList<T> name()
it has nothing to do with NMS or remapped
Done
you just do PaperLib.doStuff()
also send the link
basically this alex
For paper support they have a discord
Maybe ask there
yee but when I package plugin and try to use it
I get NoClassDefFoundError pointing to io/papermc/lib/PaperLib
sure thing
hm that actually looks good. how do you compile? Are you using IntelliJ?
Because spigot != paper
PaperLib is a separate dependency @sterile token
I mean mostly here do spigot stuff so they wont know anything about paper
Ohh ok
My bad
Also who is pinging me?
😂 😂
PaperLib is like a lib that makes people use paper features on paper, or fall back to normal stuff on spigot
^
click this button and you'll see
can i somehow figure out the name of an item that the client shows? i want to add a prefix to the item name
umm, how to change custom model data for trident ( and the entity) using resources pack?
that depends on whether that item has a "translatable" chat component, or not
try casting it
OH MY
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user "+ player.getName() + " meta setsuffix "+ badges_int +" §7§lʃ §f§lѺ");
Hi, I want to put a suffix of luckperm from the console but there are spaces so it doesn't put me the whole suffix.
Yes, I compile it using java -cp "spigot-1.17.1.jar:lib/*" org.bukkit.craftbukkit.Main
what boolean value is null
why ArrayList inside ArrayList inside ArrayList
yeah that's wrong
you must compile it using maven
one sec
what does this even mean
in intellij, on the right side, click on "maven" and then double click on "package"
or that, but that'll only work if they have maven on their $PATH$
that makes no sense
it cannot work
What the hell is he doing?
I dont understand what the fuck is doing with an array inside another Array
🤔
every Boolean can be null 😛
but booleans will be false instead of null
its the raw data structure returned by a scan method
material -> blocks of that material -> entities standing on that block
@smoky oak paste your whole class
English-english, not english-dev lang. Hahaha take care im not very good with thechnical things
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lp user "+ player.getName() + " meta setsuffix "+ badges_int +" §7§lʃ §f§lѺ");
Hi, I want to put a suffix of luckperm from the console but there are spaces so it doesn't put me the whole suffix.
Noo please
Never do that
Same error
?
Please use Luckperms api for doing that
did you actually use the new .jar? maven creates the compiled .jar inside <yourIntelliJProjectFolder>/target/YourPlugin-Version.jar
Yes, but I had already tested but there is no setSuffix (Or I not find)
You have to grab the group, then the mentada
Metadata*
you added a space yourself
And then set the Prefix I think
if you wanna get rid of it, remove the space?
Yes
Logical I want it
then you're doing something wrong. If you upload your whole project to github, I can check it out. If you won't, I can't help you
I can
Give me 30m
aight, upload it then send a link and ping me
But will it be on the group or on the player?
Martin go ahead and ask there
They will support better
Ok
Because they are experience with their api
Because doing vía code is better than harcoding it vía command
lmao I'm stuck between 1199 and 1200 users
am I doing it right?
since I always get error: Unsupported class file major version 61
why using a dumb date format tho
if i have a message "# hi" or "# this is a message" how could i remove the # and all of the spaces that follow it?
where do you get this? while compiling? while running the plugin?
while packaging plugin in maven
How can I get one persistent location from any of 4 blocks of the double door? Current block pointer already is pointing to the bottom block of the door
all Doors are BiSected
cast to BiSected, gotTop
sorry getHalf(TOP)
or whatever it is
I don't have problem with top/down
upgrade your "maven-shade-plugin"
set it to "3.3.0"
or show your pom.xml
?paste
i somehow resolved it
I had wrong shade plugin code prob..
I just quickly swapped from remap plugin to shade so it wasn't working
I then tried using original shade plugin and it works greatly
your problem was that you had an old maven-shade-plugin version
3.3.0 can do java 17 code, but the older versions, e.g. 3.2.2 can only handle up to java 15 or so IIRC
to stop it, just return "false" in "canUse"
yeah well, I dont know how you'd know how to stop it
when do you wanna stop it?
then you can just do something like this in canUse():
if(myMob.isNear(targetLocation)) return false;
return true;
so just check if it's already near the target. if yes, no need for your goal. if no, "canUse = true"
that will only happen if you didnt add any other goals
or if you deleted all other goals
normally you want to keep the vanilla goals, and only add yours "on top"
what priority did you use to add your goal?
it's zombie specific, right?
no, I meanwhen you do goalSelector.addGoal(NUMBER, ...)
what did you use for NUMBER?
should work fine then
the normal entity goals are 4 and 8
so if your goal returns "false" for "canUse", it should continue with the normal zombie behaviour
I'd do something like this:
if zombie is nearby where I want the zombie to go: return false for "canUse"
otherwise return true
and with nearby, I mean like +/- 2 blocks in every direction or so
no, that was pseudo code
just take your target location, and the actual location
then check if the actual location is inbetween targetLocation + and - 2 in every direction
and if yes, it's "near"
yeah well
1 minute
public static boolean isNear(Location target, Location actualLocation, double radius) {
return target.getWorld().equals(actualLocation.getWorld()) && target.distance(actualLocation) <= radius;
}```
copilot
lm ao
He's just best developer :>
I only wrote the signature
copilot wrote the actual method content
hahahaha
copilot codes for you
just check this
I just wrote "isBettanationANicePerson" and it said "return true"
if I see one more person using distance instead of radius * radius
imma grab my pitchfork
well well well
ofc people should use distanceSquared instead
on the other hand
do some benchmarking and you'll see that it's totally neglibable on modern CPUs
I mean, its free cpu cycles
I'd also go for distance squared instead
nah
copilot is awesome
have you tried it?
I have tho It has not helped me much
hm it has helped me very much
mostly because I spend most of my time thinking how I design the solution to my problem
the implementation usually is trivial
until some devs finds their code in another product, sues and finds out it was copilot that put it in there.
so the speed up was negligible
yeah it depends
then they both sue Google
sometimes its EXTREMELY USEFUL while sometimes it also just suggests bullshit
yea I personally don't agree enough with github copilots moral point of view
to use it
for the little speed up it yielded me
well
big companies and morals...
I mean
does not mean I have to support them
then you also must not order food at macdonalds or not order stuff from amazon or not buy books from <insert random book company> and stuff, I guess 😄
also true
I got copilot for free anyway so why not use it?
sometimes it's REALLY helpful
even for simple stuff like this
student mail supremacy
it can even detect that an "AIR" item is basically considered "kinda null"
I don;t use it as I don't want to get into a habit of using it only for it to go premium.
some methods do return an ItemStack of AIR with amount = 0
but no method ever returns an itemstack of CAVE_AIR
depends on what canUse does
no
@Override
public boolean canUse() {
return !isNear(myMob.getLocation(), myTargetLocation, 2.0D);
in the tick() function, you don't worry about whether you're already near or not
in tick(), you just move to target
and in canUse(), you check if you're already "there"
@tender shard i'll send you the link in dm
@somber pivot I cannot accept random friend requests for help-dev questions
just use this channel please
I need the plugin to compile kotlin
but you do not have any kotlin code
No
pretty sure you do
its in the jetbrains kotlin maven guide
unless you configured your kotlin plugin different
and changed the source sets
its there
The plugin works fine with that configuration, its just the mongodb which causes the error
thought you needed help compiling
no
I need help with this error java.lang.NoClassDefFoundError: org/litote/kmongo/KMongo
I am using multi modules in maven to support NMS in multiple versions, and I need to use the plugin instance in the api module. How can I get this without using cyclic dependencies?
The API should never depend on the implementation
How should I get the Main plugin class then?
You make an interface with the methods that you need
Your main class then implements said interface
Do you guys have information/links about models?
What model format?
wdym
There are many model formats. Which one do you need information about?
blocks
idk if its a format
Block models are used to depict all the blocks in the game, whereas item models are used to display the items in the players, hand, on their head (helmets and hats), on the ground, in the inventory, in item frames and on armor stands. As there are different variants of some blocks, block states are used to link these with the corresponding model...
^^ That's what you want
You can use Blockbench to make it easier for yourself when making custom models
That's not exactly what I wanted to do. The class I am talking about does not necessarily have to be in the api module, because it is just a regular class. It is a handler which loads and gets config files from the resources folder. Initially I put it in the main plugin module, but because I couldn't call it from the version specific modules, I put it in the api module and faced the same problem: cyclic dependency. Do you have any advice on what I should do in this situation? I'm new to pom projects.
I explain you
Your version specific modules can not depend in any other module. not API not your main plugin
- plugin-api-module (Should mostly contain interfaces or abstract classes)
- plugin-core-module (Should contains api implementations and others things)
If your version specific module needs a file it should expose a method in the API to provide that
I have some questions about the relation between api == core
How to get rid of flying trees in custom Tree Populator?
for (int iteration = 0; iteration < 25; iteration++) {
int x = random.nextInt(16) + chunkX * 16;
int z = random.nextInt(16) + chunkZ * 16;
int y = 319;
while(limitedRegion.getType(x, y, z).isAir() && y > -64) y--;
if(!limitedRegion.getType(x, y, z).isAir()
&&limitedRegion.getType(x,y,z)!=Material.WATER
&&limitedRegion.getType(x,y-1,z)!=Material.OAK_LEAVES
&&limitedRegion.getType(x,y-1,z)!=Material.OAK_LOG) {
limitedRegion.generateTree(new Location(Bukkit.getWorld(worldInfo.getUID()),x,y,z),random,tree);
}
}
I also did check earlier for ending of Material name, not just for OAK
?paste
Because some times in the api moule i want to expose some manager getters but i cannot do it, because managers should go into the core module
Depends what they are managing
remember there are two things API and implementation.
API is simply how you get access to the methods.
For example let say i want to expose a UserManager on the api module, but the manager is done inside the core module
Then you have probems....
implementation is teh operation code behind the API
then you don;t do the user management in teh code
?
well depends what yoru core module is
if your core module is behind the API then its not an issue
I mean
Let say:
-
The api module contains something like an interface PluginNameAPI and there i want to expose a UserManager getter
-
The core contains the UserManager and will do the api implementation
How do i do that? Because api wont even know what its UserManager
Do i explained ?
the API only exposes method not implementation. it doesn;t need to know anything about the UserManager
But the UserManager doesnt exists on the api module
So there you have problems
I dont think im explaning well
blockInteract on the door is invoked before or after door open state is changed? I mean in blockInteract method door.isOpen() == thue is open when player is opening the door?
ok
Your UserManager depends on API.
Your Plugin depends on API.
Your API depends on nothing
I understand that the API should have abstract classes/interfaces with methods for the main/version modules to use. In this case I want those modules to be able to use this abstract method, BUT the abstract method requires the plugin instance. This is the code in my Main class.
private lateinit var version: String
override fun onEnable() {
Configs().loadConfigs(this)
}
fun getVersion(): String {
return version
}
And this is the method in the Config class of my API module.
fun loadConfigs(plugin: Main) {
if (plugin.getVersion() != "v1_8_R3") loadConfig("legacy-pvp", "legacy-pvp", plugin)
loadConfig("config", "config", plugin)
loadConfig("modules/bows/config", "modules_bows_config", plugin)
loadConfig("modules/damage/config", "modules_damage_config", plugin)
loadConfig("modules/projectiles/config", "modules_projectiles_config", plugin)
loadConfig("modules/projectiles/entities/arrows", "modules_projectiles_entities_arrows", plugin)
loadConfig("modules/projectiles/entities/eggs", "modules_projectiles_entities_eggs", plugin)
loadConfig("modules/projectiles/entities/fireballs", "modules_projectiles_entities_fireballs", plugin)
loadConfig("modules/projectiles/entities/fishingrods", "modules_projectiles_entities_fishingrods", plugin)
loadConfig("modules/projectiles/entities/snowballs", "modules_projectiles_entities_snowballs", plugin)
}
As you can see, the API depends on the main module and the Main class depends on the API module. Since I want to use the methods of this Config class in all other modules, I put it in the api module. But to use the Main class, it needs cyclic dependencies. Is there any way around this? Should I put the Config handler in my main module? If I do this, I cannot use it in version modules because of again cyclic dependencies. This might just be me not understanding exactly how pom projects work, but I really don't understand how to get this to work.
API shoudl not depend on anything
not unless its a pass through
IE you add a depend in yoru API to Spigot-api so everything that implements your API can also access spigot
your API contains all the interfaces you are going to expose.
so Your core module depends on your API. Your API contains the interface for yoru core module
Does someone have default vannila Tree Populator?
So if I were to create an abstract class for the Config handler, I would still need to override the method in my core module for it to work with the Main instance? So then, how should I get the Main instance in my version specific modules without cyclic dependencies?
You don;t get an instance you pass an instance from your main when you ask for something from your module
eg, the Bukkit scheduler requires you pass a plugin instance when you use it
Think of the API as a firewall. It knows nothing beyond it. Anything you want it to know about you have to pass it through
how would i change TimeAPI.Time.MS to Time.MS
why?
because it looks better
that would break teh API as you would be setting Time static
?paste
Im trying to add setspawn command to my plugin and when i try to save values to config.yml it deletes the rest and that is it and i really dont know why since it doesnt make any errors in console my code is here https://paste.md-5.net/ofekuqifiw.java
if you want the command to work for each player, they each need their own entry
wdym
you only have one entry in the config
Sorry for asking this noob question but how i do allow a player to break/place blocks when another plugin is calling it?
world,c,y,z,pitch,yaw
🤔
its not under any key
so it has to be under some key ?
if you want more than one
what calling
and you shoudl be using .set not addDefault
that sentence doesnt make sense
Not sure what getConfig() does, but maybe it always loads the config new which will not keep the changes before. So you should store it in a variable.
don;t store config in a variable, it always leads to stale references
I mean im doing something like a build mode right?
You can definitely do it inside the methods scope
Yes inside the scope is fine
So if it enabled i the player should be able to break or place blocks, but what happen when another plugin is blocking that?
Calling getConfig 10 times is just bad
have a higher priority in your event
Not really, its memory resident. its only reading from a Map
it gets default config from resource folder
Yea but dont call this method again for each entry you add
you can always check javadocs or impl
No I cant
so what would be the best way to do it ?
something like Highest right?
hmm probably
And then?
something like that (just pseudo code)```java
Config config = getConfig();
config.add(....)
config.add(....)
config.add(....)
config.save()
then your listener will be called last so overriding other listeners with a lower priority
if those other plugin use highest priority too then fuck them
So that will allow to place blocks no matter if other plugin cancel it right?
mye
mye?
Are you are you are ayou sure?
im not sure if i can set Config as type of variable there is like nothing from bukkit
im sure yes
and i accidentally fucked everything
int data = e.getCurrentItem().getItemMeta().getCustomModelData();
if(data == 1) {
p.openInventory(Pazar.swordGUI);
}else if(data == 2) {
p.openInventory(Pazar.foodGUI);
}else if(data == 3) {
p.openInventory(Pazar.blockGUI);
}else if(data == 4) {
p.openInventory(Pazar.toolGUI);
}else if(data == 5) {
p.openInventory(Pazar.mineGUI);
}```
int data = e.getCurrentItem().getItemMeta().getCustomModelData();
switch (data) {
case 1: p.openInventory(Pazar.foodGUI);
case 2: p.openInventory(Pazar.swordGUI);
case 3: p.openInventory(Pazar.blockGUI);
case 4: p.openInventory(Pazar.toolGUI);
case 5: p.openInventory(Pazar.mineGUI);
}```
man just grab some list and store those guis in there
Just replace it with whatever getConfig returns
mmkay
What is the difference between those
i said highest
Hmn, lowest is executed first?
yes
so highest is last so they can override other listeners
Ohh ok
and then you have monitor, which should not change the event anyhow
But im mixed up haha
Because if a plugin blocks break right?
And my plugin has priority lowest will get executed after, so i will be able to break blocks in theory?
lowest gets executed first
I have a nightmare
same
Lowest priority is executed first so higher priorities get the option of overriding it
that wont work mate
?deeplp-translator
hmm love it when my screenshotting tool breaks
are you assuming that we have command for anything you want
ah fuck i forgot break
isnt a command?
ofc not
?where-to-get-weed wont work either
Look I am making a plugin that will have a build mode which when you execute a command it should let you build. But the problem is that my plugin will not take care of protecting it from breaking, etc. But a separate plugin will do it.
Is it better now?
a separate plugin will handle whether or not you can break blocks?
Yes!!!
whats the problem then
sound like a bad way
you're willing to check if you can break a block?
I just dont know how to allow breaking blocks them
you already have a plugin that allows or does not allow you to break blocks 💀
im confused
Its diff
I mean i cannot said much because its not for me i mean
you don;t allow breaking. you prevent it or you do nothing
true
Let said you have a server with random protection plugin and this plugin im doing, the protection plugin wont allow to break/place blocks right? So when you enable the build mode you should be able to build
and what's the problem now#
override the listener of the protection plugin
so you have final say
by having a higher event priority
listen on Highest and uncancel the blockbreak if it is cancelled
Isnt what i first sent in the crenshot?
🧐
Not 100% reliable though
you sent a screen with lowest priority
No
Or yes?
You burned my brains
😂 😂 😂
Sorry for being painful but its something confused what i explained
🤙
The only way you can reliably override a cancelled BlockBreak is in your plugin break it manually and handle the drops.
@EventHandler(priority = EventPriority.HIGHEST)
private void onBlockBreakWhatever(BlockBreakEvent event) {
event.setCancelled(false);
// do whatever idk
}```
?
well did it and thanks for that tip but still when i try to write something to config it deletes everything and idk why
Not 100% reliable
dont have ignoreCancelled cuz that will not fire if the event was cancelled before
I dont understand that technical words
you can;t guarantee you will be the last plugin running Highest
also that
Oh idk i dont care
As it not for me
☝️
That is owner responsability
leave the event alone, and do it yourself. breakNaturally and drop items
anyways breaking my head about an algorithm about how to parse math expressions based on their operator priority 🤓
tried that and it is still not working
i added it under key Spawn so now it is Spawn.X Spawn.Y Spawn.Z
still deletes everything from config
show code
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
if(sender instanceof Player){
Player player = (Player) sender;
if(player.hasPermission("ghc.setspawn")){
Configuration config = GermitHC.plugin.getConfig();
config.set("Spawn.World", player.getLocation().getWorld().getName());
config.set("Spawn.X", player.getLocation().getX());
config.set("Spawn.Y", player.getLocation().getY());
config.set("Spawn.Z", player.getLocation().getZ());
config.set("Spawn.Yaw", player.getLocation().getYaw());
config.set("Spawn.Pitch", player.getLocation().getPitch());
GermitHC.plugin.saveConfig();
player.sendMessage("§7[" + GermitHC.plugin.getConfig().getString("MainColor")+"!§7] §fYou have successfully set spawn");
} else{
player.sendMessage("§7[§c!§7] §fYou don't have permission to set spawn");
}
} else {
System.out.println("[X] You have to run this commands as player!");
}
return false;
}
rn i can only do things like this
?paste
The green ones are special and only show if the item has no attributes
isnt that working?
it works
in way
that it can be runned
and then
i deletes everything
from config.yml
and that is it
it removes the comments and fucks up indents i guess?
dont know why it would delete everything
well most of comments
and everything else
keys and values
?paste
if you are using save() it will remove comments
this is the start
this is how it should be
this is default config
and content of config
and also remove " from some strings if they dont have special characters because yaml doesn't need it
#Size can be: 9 - 18 - 27 - 36 - 45 - 56
No it cannot actually, 56 is invalid, 54 is
just a side note
cool
fixed
nice
How i can add a terminal to intellij
Im really idiot and i have closed it
And now i cannot find an option to set it back
click it
Thanks mate
np
I was really scare dhahaha
is it possbile to make it so only specific players can see blocks? basically im trying to make it so only certain people can see a campfire that is lit
Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
in 'reader', line 2, column 1:
name: BuildMode
^
expected <block end>, but found '<block mapping start>'
in 'reader', line 13, column 2:
build:
^
Can someone explain what its wrong?
Haha
i think there was like sendblockchange or whatever
I know the problem is inside the plugin.yml but not why
well something's with your yaml file
I know that but what?
it may be that you accidentally used tabs
Validate and Verify your YAML documents, optimized for Ruby on Rails
Hmn
can you send me the file
yeah
name: BuildMode
version: '$[project.version}'
author: Alexito2060
main: x.x.BuildPlugin
api-version: 1.13
Worst case scenario you'll just use json
Version probably should be version: '${project.version}'
?
YAML is a superset of json, using json is fully accepable in yaml space
there should be 2 spaces
Enable the show whitespace characters in your IDE
jetbrains ultimate?
Cntains that?
just do this for now
I know eclipse does, and so does any text editor I know of
Also its telling me an error in the name of the plugin
also you misspelt the usage for buildmode
Thanks
The name till doesnt work ps
Something its really wrong
awesome
BlockData data = (Campfire) Bukkit.getWorld("birchForest").getBlockData(new Location(Bukkit.getWorld("birchForest"),120, 94, -38));``` maybe i did smth wrong but i cant get the method data.setLit
dont get world twice
BlockData -> CampFire
doesnt casting it work?
Me plugin isn't logging in correct format, expected behavior: [PluginName]: Message, [com.github.Dependency] is it now
what
oh it's the wrong log prefix
what do you use to log?
Just normal getLogger().info, but i'm using dependency Discord JDA
Does someone have advanced TreePopulator?
mine spawns trees in the air
makes it fun for gathering wood
How i cancel a player to add things into some inventories like, Chest, Enderchest, Furnaces, etc?
cancel player? wdym
I mean cancelling a user to put things into some inventories type, like chest, enderchest, furnaces, etc
InventoryClickEvent
That wont work
Because you can dupe
So i need to disable the interaction
packets?
Does anyone know of a good minigame library
What do you mean by minigame library¡
Multi versioning! from 1.13 to 1.19
To make your own minigames
So packets are off ancientking there
oof
could save the players inventory and when you detect them putting something in the container reset the container and compare current inventory with saved one
then put items back that are missing
I was thinking disabling inventory type interaction
inventory type is chest, enderchest, etc cancel the event
Hi, how can I execute all scheduled tasks on mod unload? (I have them all stored in Map<Vector, BukkitTask>)
Spigot != Forge
lol i chased a bunch of entities into unloaded chunks and my entire world unloaded
so im just chillin in the void
well spawn chunks are probably loaded
wtf?
If you need mod support you should ask it on forge discord
Why do you think about forge?
is spigotcraft still down
I program spigot plugin
nope
You said mod instead of plugin
Agree
Campfire campfire = (Campfire) Bukkit.getWorld("birchForest").getBlockData(120, 94, -38);
campfire.setLit(true);```
nvm idk what im doing wrong
Omg, I'm so sorry. But I said BukkitTask in the same message
Mod != Plugin
Just letting you know!
Typo.
Also is there a page were i can find all 1.19 blocks including their id?
Not what you might want, but https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
declaration: package: org.bukkit, enum: Material
Because im doing an enum with all the block which contains menus
since on 1.19 you have blocks with menus which doesnt exists on 1.13
Hello I have a quick question, when you change the player's display name using Player#setDisplayName, do you set it back to normal just using the same method but you set it to the player's name?
Like this I mean player.setDisplayName(player.getName());?
How can I execute all scheduled tasks on plugin disable? (I have them all stored in Map<Vector, BukkitTask>)
map.forEach((vector, task) -> {
Bukkit.getScheduler().runTask(plugin, task);
})```
probably
Oh, I'm asking because there is nothing like Player#resetDisplayName
yeah makes sense
what is happening currently
Could you solve it?
I was on my way home, I'll try it soon. Thank you
My Dependencies are loging with there own groupid, how to force these to the plugin name?
what?
Can you be more detailed
Dependency is logging: net.dv8tion.jda.api.JDA, i want just my PluginName there
Oh ok
They are logging as [JDA] right?
errors
disable parent logger?
[net.dv8tion.jda.api.JDA] as this right
One way is to disable the dependency logger
send the errors
he want to disable dependency logging
libs?
so they log as [PluginName]
he cant really
Yeah
You can
never did it before /; wish him gl
Logger.getLogger("package.LoggingCLassName").setLevel(Level:OFF);
Nice, i'll try it
No
Its work with everything
Logger is from i think
Yup


