It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
#help-development
1 messages · Page 413 of 1
?paste your pom
im not working in maven
Above the ping is a paste link with intellij throwing exceptions
Figured you might know something since you use intellij
alex it happened after i added the pdc tags
throw your jar in here
that will leak my ip
you have your IP in your plugin?
sort of
lol no config for ip
We have no code either
So we cant really help further
Anyways driving home now. So no more help from me until then
me.Danko.CSTMItems cannot be cast to class org.bukkit.plugin.Plugin
twice problem with casting
its also about the loader, so probably shaded his own plugin somehow, or that class is not extending JavaPlugin
fixed it
i might be kinda dumm but i did
it was my fault
i said instance = this in a non-Main class iykwim
That's API spigots fork of Bukkit added after paper
yeah if it is a plugin main class instance
that is understandable
big error
Not, just in the autocompletion. Which still is nice enough. Perhaps ECJ was also made to only define it once in the bytecode, but we will continue to be haunted by the javadoc issues when using jetbrain's @NotNull/@Nullable
laffs in using vscode rn
Isn't it using JDT too?
can someone use the command for spliting large tasks
?workdistro
what class
PlayerInteractEvent Action class
one question, how could I create a world with only 1 iome?
like the world options in singleplayer
doesn't have an action class
oh
wait I see it
it is as the name implies
Mojang developer moment.
Nope, came from bukkit
it is as the name implies though
as funny as it may seem, it is quite literal
Bukkit is mojang's offical server software or I'm wrong?
While mojang may own CB/Bukkit, Mojang has never used any code from it or even touched it
so no
Mojang didn't create CB/Bukkit either
hey frost, can you take a look at #1084938453730459770
So mojang use bukkit software as minecraft world?
I cannot figure out how to actually make it rotate lmao
No
mojang does not use bukkit
Oh
bruh
i already told you 😉
Hey, I am currently working on a Lobby System Plugin and I am encountering the following issue:
Players get a few different items (server selector, cosmetics menu, etc...) and when they click on a specific item (by right, left clicking or by clicking it with the cursor) they open another inventory. but when they click on the item with the cursor, they create a ghost-item when reopening the inventory. It's hard to describe but here is a short clip of what is happening: ||https://streamable.com/ubdo74||
I am using this Eventhandler to cancel the InventoryClickEvent and to open other Inventories:
@EventHandler
public void onMenuClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
event.setCancelled(true);
if (!(event.getCurrentItem() == null)) {
if (event.getCurrentItem().hasItemMeta()) {
if (event.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase
(ChatColor.AQUA + "Server Selector " + ChatColor.DARK_GRAY + "(Right Click)")) {
serverGui serverGui = new serverGui();
player.openInventory(serverGui.getInventory());
} else if (event.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase
(ChatColor.AQUA + "Cosmetics " + ChatColor.DARK_GRAY + "(Right Click)")) {
cosmeticsGui cosmeticsGui = new cosmeticsGui();
player.openInventory(cosmeticsGui.getInventory());
} else if (event.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase
(ChatColor.WHITE + "Players: " + ChatColor.GREEN + "Visible" + ChatColor.DARK_GRAY + " (Right Click)")) {
player.closeInventory();
player.sendMessage(Main.getInstance().prefix + ChatColor.RED + "Feature coming soon");
}
}
}
}
}```
I am looking at https://hub.spigotmc.org/javadocs/spigot/org/bukkit/generator/ChunkGenerator.html rn
declaration: package: org.bukkit.generator, class: ChunkGenerator
and
but it is as the name implies lmao
which is the irony
@terse ore
You should restructure your code
if (!(event.getCurrentItem() == null)) {
????? Why
and instead of doing a if statement each time, just return if it's false
you definitely need jree fava lessons
is link not working for me only tho?
and don't get a new ItemMeta each time, that is inefficient as it is being cloned each time
^
Yo where can I get jree fava lessons
Sorry but that is not what I have asked for 😄 I coded this a long time ago
checkmybio
I aint gonna look through that if I get a panic attack
and structuring it can help you to find the cause
lol why
are they blocking everything now like china
your f key messed up?
ah
guys just leave ru
because of one line of code you are getting a panic attack and refuse to help me :o thank you very much sir!
No problem
are you sure it's not a visual bug or smth
can you throw this item or place it after you get it
i am currently learning java and spigot developement and you are most definitely not helping me do that
just ignore them 🙂
I am just not spoon feeding you, if you really want to learn then you have to find a solution yourself
no, that's why i said it is a ghost-item
additional to that I also need to do some more stuff
well, you can try setting
can I dm you or make a thread to keep things clear
i tried many things but i can't find a solution
@warm mica don't act like you are superior to me or whatever just because you are more experienced
close old one
thanks i'll try that
Is there a way I can enable a plugin from a jar i just downloaded from code?
Player#closeInventory()
wait what
What?
I want to make an auto updater that does not require a restart. I download the jar from the web and want to enable it
^^
i was already thinking about that, but it looks a bit less smooth. But if it is necessary i will implement that
unless you are going to use reflection and hook into spigots class loader you will need to restart
^^
just shut your goofy ass up and stop harassing people without that much knowledge
All I did was to give a really important tip that you firstly have to clean up, and you are getting mad because of that?
getta hell out of here
as I said earlier just ignore them before you get yourself in trouble 🙂
you were very rude about that
you don't need to engage them
sorry
well you can call me so i can help you
if you stream the result
How was I rude by stating a fact? lmao
odds are the problem resides in your servergui code
for the ghost item problem
really? i never even thought about that
ty i will try some things first :)
I don't see anything in the code above you posted that would cause it
so the only other thing in that code is servergui
a class from my plugin
its their Class for creating the GUI and tracking it
have you guys tried the new UI on intellij?
some probably have
i jave servergui (the actual inventory holder) and serverguihandler (its a listener)
Where did you get that
Preferences -> Appearance & Behavior -> Enable new UI
it looks like vs code now, that's interesting
thank you very much, that works 😄
ez
now please restructure this code
Thanks
It looks really nice
yeah, i will do that
for?
don't think I have seen or heard that command before
there is if you know where to look
Well, apparently i am not the only one lol
just sent the link bot sends
@oak locust
i will look trough that thank you
this is personal preference
you should return early if possible, but there is cases where you have no choice but to nest if statements
just because you don't like the look, doesn't mean it is bad because this is more or less under style/formatting which you can do in your own IDE
my IDE, I can collapse code I don't need to look at
therefore, its a none issue in what style/format people use as long as its pretty consistent and sane lol
is it possible to run a bukkit code with value computed asynchronously via CompletableFuture without freezing the server? I'm trying this:
CompletableFuture.supplyAsync(updater::tryDownloadLatestVersion)
.thenAccept(updater::disableOldAndEnableNew);
but it throws exception
saying plugin cant be disabled asynchronously
You could wrap it with Scheduler.runTask
so i download the file synchronously?
No
you disable synchronously
You disable the plugin synchronously
Only almost everything bukkit related
like this?
Bukkit.getScheduler().runTask(plugin, () -> {
CompletableFuture.supplyAsync(updater::tryDownloadLatestVersion)
.thenAccept(updater::disableOldAndEnableNew);
});
No
Only the part where you call updater::disableOldAndEnableNew
Right now you are synchronizing that the completable is being called async
like this?
CompletableFuture.supplyAsync(updater::tryDownloadLatestVersion)
.thenAccept(it -> {
Bukkit.getScheduler().runTask(plugin, () -> updater.disableOldAndEnableNew(it));
});
Yes that will likely work
thanks!
+1 to the new person helping
?
hmm, now to remember the command for cafebabe to keep track
?karma
!karma
.karma
guess we don't have that anymore as well
all well
why does cba exist
?cba
Frostalf#3075 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
carefall#2257 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
CafeBAbe
zyzz😎
the clean version of cba meaning is couldn't better assist
fun fact about cafebabe
you used to be able to engage in conversation with her
sadly she has been silenced so, that is no longer possible
how
this seems like a perfect opportunity to integrate the chatgpt api
she has an AI attached
that allowed her to talk to you 🙂
not always smart, but was good enough and she would sometimes make fun of you as well lol
and then the guy goes "omg bot is so rude..."
it is?
ive always known it as cant be arsed
I said clean version
why is it that if i disable a plugin and then load and enable the same plugin from different jar and try to execute a command from that plugin internal error occurs saying that the previous version of the plugin is disabled?
Not sure that you can swap plugin jars while server is running
should i delete an object or do i leave it to garbace gollector
all other features work fine though
Leave it to collector
ok
not without using reflection to hook into the classloader of the server to remove all the classes off the path
so you are correct
Look at frostalf response, have you done that system? ^
No, I just disable it with plugin manager and delete the file
Yeah that won't work
the jvm loads all the classes onto the path
hence why you can delete the file while the server is running and the plugin still works in the server 😉
so you need to use reflection and a javagent to do what is called hotswapping of classes
And imo it's not really worth, just restart server
yeah, restarting is not that bad lol
Yeah it's just that someone requests an auto updater for my plugin which wouldn't require restart 🤷♂️
unfortunately, that isn't something that is going to be easily doable and they will just have to live with restarting
if you really want to implement it, I gave you the keywords/things to research
I don't think I'm gonna go that deep, but thanks anyway!
ig an example would be how plugwoman unloads and loads stuff
i think, no idea though
send best sqlite implementation
Nah, it hardly does anything differently from its original fork. It still the same old PluginManager#disablePlugin and PluginManager#enablePlugin but with some extra steps on the disable part.
how can i prevent blocks from placing within a radius of a specific block type
so for example, i place a gold_block, and within 5 blocks of radius i want to despawn any blocks placed
i thought it did some thread unloading jank stuff
so i can only place any other block that is 5 blocks aways from the target block
Not really. This is what it actually does. As far as I can tell, it doesn't even touch threads.
https://github.com/Redempt/PlugWoman/blob/master/src/redempt/plugwoman/PlugWoman.java#L246
probably because the former catches exceptions the latter doesn't
catches and handles the exceptions
hello.
ah
i am concerned.
for some reason, block break events on my server are being cancelled and i cannot discern why.
Spawn protection?
i am looking at all the event handlers registered, none of them appear to have event.setCancelled(true); and are registered as block break events.
Set it to 0
in the server.properties file
lol that confused me so much.
another question, what is material for crops as in things placed in the world called?
nvm.
different for each crop iirc
it is POTATOES for potatoes probably.
yes
bukkit should have different enums for items and blocks
that would be a lot easier
They could differ between items and blocks but they try to stay as close as possible to mojang
Well, I think it gets worse now that microsoft owns it - but that's not the channel to discuss about this
microsoft probably has owned mojang for very long now.
too late to discuss that.
but yep, mojang and microsoft bad.
very bad.
I mean so far so good. The problem I have with them developing minecraft is that they will probably start cancelling mc-java-edition in the next 3 years
I don't wanna be forced to play Bugrock-Edition 😢
did they say that?
No they stated that they will continue developing both versions for now
you wouldn't, this would open up creativity to the community if mojang stopped
which is most likely the reason why they won't
what do you mean?
well, everyone uses the vanilla client because mojang maintains it. If they stopped updating the Java edition, this allows the community to start adding their own stuff since no more updates from mojang
Even if the java community would take matters into their own hands I still expect 90+% of players to shift to bedrock edition at this point.
Since java edition will not be in the same launcher anymore, not downloadable on minecraft.net etc.
custom launchers already exist
I know they already exist but the majority of players probably won't bother downloading a custom launcher to play a minecraft version that has far less players.
The only real chance for survival I see is to keep crossplay with bedrock up in java edition
who uses the default launcher? I use multimc lol.
I would expect atleast 2/3 of players on bedrock, even though there are no official numbers.
Bedrock supports all platforms and not just PC
I do
I HAD THIS IN MIND FOR SO LONG!
I'd probably quit Minecraft altogether if they discontinued the java edition. It's the only damn edition that runs on linux atm. I could potentially play dungeons through Steam, but I bought it through Microsoft themselves.
I also use the default launcher. Even though it is super annoying how slow that launcher got
mojang does a terrible job of updating the game, just have them no longer update the game and instead let the modmakers do it.
java > bedrock
not everyone on pc plays bedrock, while I do have the bedrock edition of mc in my ms store, I don't play apps or even use it. There is a lower limit that isn't 0 in terms of players
mojang could just provide a modding api of sorts if anything.
simply because not all PC players play bedrock
They announced that at one point. Never went anywhere with it.
they tried, thank evilseph for killing it
only thing thats cool is that you can let the clients load custom stuff directly in bedrock
who?
in case you don't know who that is, that is the person who tried to kill bukkit
what?
I thought that was Wolverness?
Wolverness DMCA'ed after
what?
?dmca
An unofficial explanation of the DMCA can be found here: https://www.spigotmc.org/wiki/unofficial-explanation-about-the-dmca/
EvilSeph is also the only bukkit dev member to be forced to resign from Mojang too
Bukkit api was sued??
You're not referring to DarkSeraphim are you?
but he was the one that was supposed to create a mc mod api type thing but either failed or never did it
mojang owns bukkit?
failed, got mad and griefed 
Yes
what?
they have for several years now
they own spigot?
what is going on?
Spigot is built on top of CraftBukkit/Bukkit
yep.
CraftBukkit/Bukkit is owned by Mojang
However Mojang doesn't touch it or do anything with it, and has left it for the community to maintain
nor they should probably.
they do a terrible job of maintaining a block game, with over 1000 employees lol.
with billions of dollars.
However because they own it, they prevented exactly what they wanted to prevent. Someone like EvilSeph attempting to kill off the project

not to mention microsoft's trillions of dollars.
Mojang only has like 30ish people.
it says they have like 1000 employees when you google it?
Well I mean employee does't mean developer
hm.
They count all the spigot devs /s
they could be counting the janitors for all we know 😛
but even then, with so much money, they should probably be doing a better job maintaining a block game perhaps?
True. Maybe they got 1 janitor per room
but yeah employee doesn't mean developer. In terms of developers its like 30 some odd people
Mojang doesn't have that much money
microsoft is a trillion dollar company.
its more money than some countries combined.
Indeed, but it isn't going to give Mojang a trillion dollars to spend or play with
Microsofts focus is certainly not minecraft
nor could they
time to kill windows, we need more money allocated to minecraft
lol
ok.
What really gets them all their money is probably MS office or business server licenses and support
who?
Huh, they actually have a larger team now. Still only a handful of actual devs though.
https://minecraft.fandom.com/wiki/Mojang_Studios#Employees
ok.
Kinda ironic that DoD uses Windows. Unless they use it to test windows vulnerabilities lol
maybe the latter, to hack into everyone's computers perhaps?
potential conspiracy?
Its used for office related stuff because its easier to monitor and setup Virtual desktops
That guy is a god 
serialize it and save it to file
Serialize it and write it to disk.
the config file system probably does that already.
Or you could hire people that now linux instead of windows and achieve the same thing with more security.
I'm not a "go linux or go home" guy since I play a lot of games but it's a fact that windows has more (already used) attack vectors than linux
depends how they want to save it
there isn't anything close to what Microsoft server provides from linux
microsoft's servers are hosted on linux?
especially in terms of remote user environments, the ability to create them on the fly and setup with CAC
the closest you could get on the linux side with slim clients is network booting, but windows provides it in a completely different way
That's true, yet still instead of investing billions of dollars into microsoft enterprise and support you could hire people to develop what is needed
no
cheaper to just let microsoft handle it
and it doesn't cost billions of dollars either
its more like millions
Now that I'm thinking about it - they get a discount by collecting the taxes from every sale anyway
military isn't taxed....
Microsoft is
You know, I'm kinda surprised that linux doesn't have similar alternatives to what Microsoft offers at this point. At least on the enterprise side.
Government contracts are not taxed
Oh I did not know that
You'd think with all this time that has passed someone would have made some sort of contribution or startup project.
I am pretty sure it is most likely due to the fact the under taking to replicate such a system
not only do you have to develop a server
but you have to develop a client as well to go with it
windows desktop works with the windows server because both are designed to be that way specifically. It isn't like some addition that comes from an outside source to make it possible lol
Sure, but you'd think with all of the containerization that linux is capable of that something would have come along. Like docker instances that could be managed like windows VMs.
well the remote desktop environments are not really VM's
And it has to be a lot cheaper/better than what microsoft delivers to actually make people (especially large companies that have adapted to windows for decades) swap. Would be like all those smaller mobile phone companies against Samsung/Apple and maybe Google
I mean they kind of are but at same time are not
Also, another thing to consider, the Government simply can't just choose to use opensource stuff because they want to exclude a business from being able to take up government contracts. They have to allow both sides equal opportunity
Yo, Is it normal that when I just persistant data on a bow it work and when I disconnected and then reconnect, the persistant data wont work ?
I mean, I set a data named "bow_type" and if when a shoot is made with and the value is "fire_ball" it will launch a fireball instead of the arrow.
But when I do it a first time it work, and will work UNTIL I disconnect and reconnect
Are you sure you are setting PDC data and not Metadata?
and are you sure you are actually saving it
Yes I am sure
Saving it ? I never had to save it on player, is it needed to save it on item ?
Well all that considered I guess Microsoft will keep its monopoly.
Although I would have said the same about Google 2 years ago. Now OpenAI is applying a lot of pressure on Google
the government contracts with google too
so no, microsoft doesn't have a monopoly
as I said, everyone has to be given equal opportunity with the government contracts 🙂
But Google doesn't offer a server OS (or any OS, besides Android)
While true, they do offer GPS and Maps and some other stuff
Yeah what I meant is the monopoly in terms of (server) OS
And googles monopoly (that is currently shrinking) is a search engine
Internet Explorer
The latter took a hard hit. And if microsoft should manage to make bing viable with their OpenAI investment it might get worse
Oh, well if you're using bungee, then you'll need to call ConfigurationProvider#save()
thats fine, but microsoft isn't going to beat google in the maps anytime soon
That's true. No other company is close to beating google maps. The closest it gets is probably apple maps
but yeah when it comes to the US government, its allowed to save money but it simply can't just not hand out government contracts either
But with all the cheap android devices using google maps, apple has not nearly enough data to compete with google
What do you mean by "but it simply can't just not hand out government contracts either"?
And since most open source software companies are not competing for government contracts because they are not there to make bids or represented, you tend to see corporations like microsoft or google getting the contracts because they made the bids for it.
So, if the government can hire a business or create a contract for businesses to bid on, it must consider that and in most cases must do that. Because it is part of creating jobs and other things. The Government has rules it has to follow
Oh now I get it. Yeah someone would actually have to start a business based on Linux and be competition for microsoft/google. Which ofc would be a huge investment and a loooong way
is there an event for stepping on pressure plates or stepping on tripwires perhaps?
Interact event should work. You can somehow check for PHYSICAL. Lemme check the docs
Action == Action.PHYSICAL, ye
Btw frostalf since I see you answering questions here quite a lot - do you know how spigot determines spots to spawn mobs?
Is there any way to get a random "natural" spawn location to summon a mob?
not sure what you mean by natural, and spigot isn't the one that determines anything with the exception of possibly modifying or hooking into the code area
most of it is from mojang
Well then let me rephrase: Does Spigot offer a possibility to get a spawning position for a specific mob?
Lets say I want to spawn a zombie - I would need a 2 block space with light level 0 and it can not be like 3 blocks around a player.
Maybe it's more than 3. Idk the exact monster spawn rules
And it probably differs for mobs from spawners aswell
While I can implement all those rules myself - mojang has logic to enforce that somewhere in their code. So it would be cool to just reuse it
You might want to read up on this. Some of it is randomized.
https://minecraft.fandom.com/wiki/Spawn#Spawn_cycle
it does differ from spawners
spawners have different rules then natural spawned mobs
and shadow gave you the link to pretty much read everything in regards to spawning
all spigot does or hooks into, other then allowing from the api to spawn stuff, is providing configuration to limit spawns and amounts
it doesn't actually change the prediction code or anything
now whether or not could you hook into this code is a different matter entirely, fortunately the odds are probably yes with NMS and reflection, the unfortunate part is that the odds are that all this prediction code is probably spread out in a number of classes and not just a single few lol
That's sad. I would really like to just spawn mobs "naturally".
For a custom mob plugin I am currently waiting for a zombie to spawn, then cancelling that spawn and spawning my custom zombie instead.
Would be cleaner to simply call something like
Location loc = World.getRandomViableSpawnLocation(EntityType.ZOMBIE, player.getLocation());
loc.spawnCreature(...);
I might try with reflection then. I did the same to add pathfinder and other goals to already existing entities
You can do it without reflection if you spawn new entities. You still need NMS obviously
oh
you could use the location of the entity that was about to spawn and place your custom entity instead
That's what I do. I was hoping for a better solution that is not based on other entities spawning :D
implementing your own spawn system
while that might sound better
you are still having to cancel the entity for your custom one
Yup that's why I added a chance aswell. So you don't disable normal mobs.
In simple terms -> On zombie spawn if the chance of 5% is met, spawn custom and cancel normal zombie, otherwise do nothing
thats the way to go
well if are not completely removing the normal mob that your custom is based off of, you can just create some random algo for spawning it
get the location of new spawned mob
but if you are swapping between them like above, that is the way to go or keep it
and in scheduler spawn your own after 1 minute if light level haven't changed 😉
gonna fuck up your cpu ig
Save all Locations a mob spawned and remove them when light level changes. Lemme just buy 128GB of RAM for my server 😛
just cycle stuff through the paging
Yeah I guess I'll take a look at mojangs code / keep the current solution for now.
It's not that bad that less normal mobs spawn when custom mobs exist
Would have been cool to spawn like 10 custom mobs at natural locations if a certain event is triggered but guess I'll have to deal without that for now
i let you
go for it 😉
At some point you will have every non obstructed block in that list
(that is at ground level)
truee
but in 1 minute block would be removed from the list anyways
so depends on player amount
and loaded chunks amount
You don't want to delete the Locations. In case the chunk gets loaded again you need them.
BUT: You can save them per chunk and only load the chunks locations on chunk load and persist them on unload
In that case you don't even need that much RAM. Just a lot of storage space 😛
Idk. I won't do that anyway. It's a horrible solution
I could do it for a worst practice example 🤔
I do have a local server, why?
just put them in a memory mapped file
pull them from the file when they are needed
Yup. Yet still you would have to recheck and re-save all Locations when the light level changes.
Well but you need the light level in the file. Otherwise you will loop through wrong blocks while trying to find a valid spawn location
well sine you only need the relevant locations around a given area you can always check to see if the light levels changed at that point and just remove the ones no longer valid
but essentially how you would store it is like a grid system
but you wouldn't use human readable text since you can't store stuff efficiently like that nor could you really represent 3 dimensions visually in a file anyways
2 dimensions if we don't care about the y value
That would also work, ye. It could cause lag when a large area was lighted up after the last spawn and thousands of blocks are checked and overwritten before a spot was found (or none at all)
memory mapping wouldn't cause lag
as the memory mapped file is separate from the program
and because it is a memory mapped file you can also use another process that checks
What can I do to make a custom bow, like I want to add a data to a bow with "fireball".
what I mean by this is, you could if you wanted just have a background process that reads region files and checks your memory mapped file
pdc
because memory mapped files are not locked to a single process
?pdc
I wanted to do that, and I did that, but when I disconnect and reconnect, the custom bow don't work
Like I made a fireball bow and it was shooting fireball and I disconnecd reconnected and it stopped shooting fireball
pdc's are not touched with restarts
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
2sec I'll give him lol
w8ing
I guess that would be a valid solution in that case. But it's still super overkill, just to spawn a few mobs lol.
But I'll keep that solution in mind as it might come in handy for other problems
...
Yeah I am one of the people around here that advocates memory map file usage 😛
Bow :
ItemStack fireballBow = new ItemStack(Material.BOW);
ItemMeta fireballBowMeta = fireballBow.getItemMeta();
fireballBowMeta.setDisplayName(fireball_bow_name);
fireballBowMeta.setLore(Collections.singletonList(fireball_bow_lore));
fireballBowMeta.getPersistentDataContainer().set(new NamespacedKey(MyCustomBow.getPlugin(MyCustomBow.class), "bow_type"), PersistentDataType.STRING, "fire_ball");
fireballBow.setItemMeta(fireballBowMeta);
player.getInventory().addItem(fireballBow);
OnShoot
public class bowShootListener implements Listener {
@EventHandler
private void onShoot(EntityShootBowEvent event) {
if (!(event.getEntity() instanceof Player)) return;
Player player = (Player) event.getEntity();
ItemStack bow = event.getBow();
Entity arrow = event.getProjectile();
if (bow.getItemMeta().getPersistentDataContainer().getOrDefault(new NamespacedKey(MyCustomBow.getPlugin(MyCustomBow.class), "bow_type"), PersistentDataType.STRING, "-1") == "fire_ball") {
arrow.remove();
player.launchProjectile(Fireball.class);
} else if (bow.getItemMeta().getPersistentDataContainer().getOrDefault(new NamespacedKey(MyCustomBow.getPlugin(MyCustomBow.class), "bow_type"), PersistentDataType.STRING, "-1") == "lightning") {
arrow.getPersistentDataContainer().set(new NamespacedKey(MyCustomBow.getPlugin(MyCustomBow.class), "bow_type"), PersistentDataType.STRING, "lightning");
} else if (bow.getItemMeta().getPersistentDataContainer().getOrDefault(new NamespacedKey(MyCustomBow.getPlugin(MyCustomBow.class), "bow_type"), PersistentDataType.STRING, "-1") == "tnt") {
arrow.getPersistentDataContainer().set(new NamespacedKey(MyCustomBow.getPlugin(MyCustomBow.class), "bow_type"), PersistentDataType.STRING, "lightning");
}
}
}
and I know how it can be used in some pretty creative ways
also, memory mapped files if the server dies for whatever reason
get saved on their own by the OS as it is OS managed
not process managed
Is there any disadvantage compared to a usual file?
also it is a handy way for two programs to communicate too if need be
That's stored like every 5 minutes and on shutdown?
unless the system just suddenly shuts down or you run out of ram
what is this "-1" thing for
those are the only two disadvantages
oh i see
you can memory map files in 2 ways
try debugging this
a random value if the bow isn't a "custom bow"
cuz from what i see it should work
you can either load the entire file into memory or you can just load partial and just have a buffer that loads and unloads as you go through the file
even if you reconnect
I'll try
I can let you come on the serv to try if you want
Ok i'll try
cuz you know, gc is working around both string pool and heap
I replaced with .equals() and work perfectly
yourString.intern() == "fire_bow".intern()
What intern for ? I never saw that
Oh okay, thanks you !
That actually sounds pretty cool. Why does spigot not use that for config files?
cuz spigot utilizes SnakeYaml with yaml?
Thanks !
today i gave free java lessons
It's a pleasure x)
dear diary,
it does
snakeyaml the lib that spigot depends and extends a bit, loads plugin configs into memory
and then for custom configs if you make use of the appropriate methods and retain a reference also loads files into memory
hence why there is a MemoryConfiguration in the API
but this type of memory loading is different as its done through the process
and not through the OS in terms of memory mapping
how can i install java 16 without login in oracle?
Adopt OpenJDK
guys, how could i prevent players from placing the same block type as my target block within 5 block radius?
lets suppose i have a beacon placed randomly, and i dont want players to be able to place a block less than 5 blocks away
blockplaceevent
in case guy wants NxN blocks radius, distance won't work well
cuz distance is just operating with xyz sphere
three nested for loops
for x y z
or bounding box at least
cuz distance is operating with default maths
if block is 3 blocks away on x
and 4 blocks away on z
distance is 5
cuz dist = sqrt((x0-x1)^2 + (y0-y1)^2 + (z0-z1)^2)
Manhattan distance
so, what do i do exactly? xD
?jd-s
declaration: package: org.bukkit.util, class: BoundingBox
BoundingBox#contains(placedBlockX, placedBlockY, placedBlockz)
ultimately, what i wanna do is a custom money machine for rankup servers, which will then merge to an already placed machine within the defined radius
is it a custom block with nbt on chunk or smth
or just a simple block
with coords in config or smth
no, at the moment will be just a normal gold_block
then
it has a custom name, but not any nbt
when you just place a golden block
you loop through all blocks in radius 5
and if there is another golden block
with custom name
you cancel the blockplace + send message
Why people don't read the Docs i mean they are there to give us (the devs) facilites while coding 💀💀
?
Yeah Lot of people ask simple questions which can be self answered ig they ** read the Docs
Is not dificulta and don't take more than 5m to read the Docs about what y are trying to use
Most yelling about those devs which don't read the Docs, and the question they ask, are explained thrnself just by reading the fkg Docs
💀🤡
somebody triggered you or smth
Triggered ?
🤔🤔
i just asked a question man, dont hunt me for the rest of my life
He?? No iwas talking in general not cuz of You
Sorry i make You thought that
i mean, you came here tilting after i asked a question so... xD
I mean i was on fired caused a dm question
Now calma down i just realize You where asking smth related. My bad
i didnt even try, i thought man wanted me dead or some
Custom model on 1.8.8 r3? It's there any api / library
Oh no, don't think that
I'm really weird these days
I havent mucho free time to code so that males me mad
im joking, don't worry
Oh jajaja i don't cath jokes, i'm really weird
even if it was for me, it's true that I should read the docs
Shity cellphone corrector
Imagine not having free time
are you spanish?
BRUH really i don't have free time
Yes, from Uruguay
Why are you on discord then
If need smth just dms me
I was the first who finishrd the database subject work/activty
didnt quite got the idea of setting my radius
is there a way i can create like a int radius = 5 then it makes the thing
Location + radius
anyone knows why i am not getting the another onCommand function?
for (double x = block.getX() - 5; x <= block.getX() +5; x++) {
}
and same for y and z
Kotlin 💀💀
if (block.getWorld().getBlockAt(x, y, z).getType() == Material.GOLD_BLOCK) return;
i use kotlin for android apps only
yeah better than java
i code java too, but kotlin is just simpler
so i make a for loop for both z and x and put this in both?
and y too
Better, is not better its needs more resources than Java m
for me it is, this is called opinion
you put this if inside those nested loops
Simplicity != Better
i am not here to discuss programming langs, just trynna get some help, so if u can't help, try not to bother me
Okay generations facts 💀💀

npc animation scripts
so, this?
for (double x = block.getX() - 5; x <= block.getX() +5; x++) {
for (double z = block.getZ() - 5; z <= block.getZ() +5; z++) {
for (double y = block.getY() - 5; y <= block.getY() +5; y++) {
if (block.getWorld().getBlockAt((int) x, (int) y, (int) z).getType() == Material.GOLD_BLOCK) return;
}
}
}
Oh Nice, did You code an api?
ye
Wow looks really good
imma make some look and lookentity stuff
Indirectly a simple IA
yea
basic AI, no variables no nothing
made it in like 2 hours
the dialogue system is something else I have
so, the block should be my already placed gold block, right?
Ohhh ok right that males more sense nos
no, the block you currently place
oh, so this will create a radius of 5 around the block im placing and unplace if theres is a gold_block within the bounding box?
Wow, and what happen with the menus api, did You re write as You mention it some months ago
yes exactly
I was working on a pathfunding algorithm in class today, maybe some day ill be able to implement mob ai
but this algorithm would run for every golden block placed on the server
but we can't do anything about it
that's fine, it would be only placed inside plots which are all more than 5 blocks away from each other
so this will just prevent the player from placing my custom block too close
and i'll then try to make a way of merging the blocks into the existing one, so it stacks
Oh You created a config api named config-wise, it's prívate i can suppouse
but the new menu engine has a whole layer, element & selection system
no
Oh My bad i understand what ever haha
menu system is complex now
i'm trying to make a Rankup Money Machine, idk if you've ever played rankups with that feature
It's the smallest "big library" we use
This new animation scripting system integrates npcs and dialogues together
you can also reload dialogues and scripts in runtime
no ig
you know spawners? that stacks mobs and then you get loot from, lets say, 245x rabbits?
same idea, but with a machine
and btw, it didn't prevent my block from placing
Oh ok i thought they we're separes
Show tour code please
?paste
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Oh such a good cmd, it's must be smth new
idk
the boundingbox i thought i would need it
and block against was my first attempt to remove block when i placed them against another gold block
and it worked, but its not used so
only block is used
so
.
yes
does your logger log smth
you need to both cancel and return
ok
cancel
return
doesn't let me place any block
can you send your latest version of code
oh i see
i'm dumb
your block is also in the radius 5
which you just placed
you need to add one more if
or
try cancelling the event before loop
and after the loop setCancelled(false);
so if loop haven't found any golden block in radius 5, code goes to the next line after loop
which is setCancelled(false)
@EventHandler
public void onMachinePlace(BlockPlaceEvent event) {
Block block = event.getBlock();
if (block.getType() != Material.GOLD_BLOCK) return;
event.setCancelled(true):
for (double x = block.getX() - 5; x <= block.getX() +5; x++) {
for (double z = block.getZ() - 5; z <= block.getZ() +5; z++) {
for (double y = block.getY() - 5; y <= block.getY() +5; y++) {
if (block.getWorld().getBlockAt((int) x, (int) y, (int) z).getType() == Material.GOLD_BLOCK) {
Bukkit.getLogger().info("Gold block within 5 block radius.");
return;
}
}
}
}
event.setCancelled(false);
}```
like this
i'll try
if this doesn't work, then you need one more line in the loop
https://gyazo.com/68a060d5ebe007eba389e70b447188b1
What could be the reason for me not being able to import EntityArmorStand properly?
it didn't work
your dependency
does logger log anything?
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>```
Thought this dependency would cover it hmm
idk, i need to go now, i'll try again later
see ya, and thanks for the help anyways
@EventHandler
public void onMachinePlace(BlockPlaceEvent event) {
Block block = event.getBlock();
if (block.getType() != Material.GOLD_BLOCK) return;
int pX = block.getBlockX(), pY = block.getBlockY(), pZ = block.getBlockZ();
for (int x = pX - 5; x <= pX + 5; x++) {
for (int y = pY - 5; y <= pY + 5; y++) {
for (int z = pZ - 5; z <= pZ + 5; z++) {
if (x == pX && y == pY && z == pZ) continue;
if (block.getWorld().getBlockAt(x, y, z).getType() == Material.GOLD_BLOCK) {
Bukkit.getLogger().info("Gold block within 5 block radius.");
event.setCancelled(true);
return;
}
}
}
}
}```
here it is
should work 99%
@wispy wyvern
Hello friends, do you know any good "image map api"?
Currently i'm working on a coupon project, where players can interact with fancy looking Material.FILLED_MAP items.
I tried the built-in map api, but somehow after a server restart, the map gets empty and won't stack with the new "same maps".
🚨
My grappling isnt working and its giving erors, can anyone help me please? https://paste.md-5.net/ifaqekadol.pl
Sorry I'm late what is this doing? Generally curious
cancelling block placement of gold if there is another gold block nearby
Can’t have too much gold in one place
yes
Might cause a local economic collapse
true
are you sure?
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.level.Level;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;```
all other imports seem to work, just not the EntityArmorStand one
it should be ArmorStand i guess
hmm okay
EntityArmorStand might be nms one
yah I am trying to get the nms one
meaning?
Sweet I might give a wack at polishing it as there is one thing giving my poor brain a wobble.
What if they change their mind and want it as 6?
hmm
cringe
ig
EntityArmorStand was the spigot mapping name iirc
need to change 5 to radius
now paper stopped updating their javadocs
might now have different name
the only possible reason
if you are getting nms one
paper added a boolean to all SErverListPingEvent constructors, making it incompatible with spigot again, and don't even mention that in their javadocs
hi
how's it goin'
so that would work too?
alex can you help me with this
it would be armorstand too, but not org.bukkit.entity
cooldowns is null
your cooldowns map is null
btw why are yo uusing a plain map? I usually use a proper class for cooldowns so you don't have to recode the whole logic if you need a second cooldown
maybe use 👀 to read 📖
My problem might've been that I join on 1.19.4 (latest). While my code with NMS is 1.19.3 (Things might've changed)
oops
ah nonetheless still errors, welp time to attempt fix
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.entity.decoration.ArmorStand sadge times
if you would have remapped, it would be called net.minecraft.world.entity.decoration.EntityArmorStand instead
hmmm there has to be something I'm failing to do:
https://gyazo.com/a538ed8e4f3203a3ef46654177bdbaa2
what the heck are you doing
in your code you must use the remapped name
which is just ArmorStand
?nms
And then maven will remap things when you build
Ready for the big cringe?
Block place event
If its Gold block:
Grab x,y,z and save to an array list that is within a hashmap of chunks and lists (saved somewhere and initialised on enable).
Look for any locations that is:
Block-5<Location<Block+5
You've just turned a max of 125 loops into potentially less than 10
Could anyone help me merge 2 plugins so they both work at the same time they are simple combat plugins dual weild and perry plugin
I could have a gander ^_^
where are you stuck
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
or are you trying to do this yourself? if so, what's the issue
Well the dual weilding works but then when i try to perry when i have a sword in my offhand it doesnt work
i see
should be just about editing some event then right
like where it checks for the hand to parry
Ye
I would prefer if it was like i could use my dual weilding when not shifting and only perry when shifting which is in the config for dual weilding but not for perrying
Does anyone have documentation for why a lot of nbt tags are stupid smooth brain and cause server lag?
I know of the concept but wanted to do some more reading up on the issue
do you reckon you could help me i dont rly know about developing plugins
well I know nothing about the plugins you are trying to use
first of all do you have the source code for both of them?
no
edit: I'm stupid, looked at the wrong version
its not a big plugin tho its just 2 class files
i opened it with win rar
then you should hire someone to do it
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
idk what that means
See paper is in kind of a weird place
It has a much bigger share of servers than spigot, but that is only because it supports 99% of spigot plugins
it means they garbled it up so noone can read it
I mean unless you can read what the class files say
they break compatibility more and more every day
I mean if they break compat with spigot plugins their share will drop
you are forgetting there is more forks of spigot then there is of paper
there's many things incompatible to spigot, it's just that it's usually small things and plugin devs use workarounds to support both
e.g. the monster of a class I just send
I simply don't care to support paper
I mean I can't lie their API is wonderful
But spigot is just too established for it to be practical
easier to base off spigot then it is paper in my opinion
edit: looked at the wrong version
i opened it with a decompiler
edit: I'm stupid, looked at the wrong version
Yeah that seems weird
What even is the boolean
but in reality, paper's constructors have an additional boolean parameter in every single one
shouldSendChatPreview
Isn't chat preview gone
I don't know
Mojang removed it
so nothing to worry about then 🙂
I'm forced to use paper 1.19.2 because in 1.19.3 they added their shitty paper-plugin.yml so MockBukkit doesn't work on 1.19.3 yet
one day they will stop depending on spigot
And their share will plummet
fine by me
They would need to have a place to upload paper plugins first
they do
did anybody actually ever use hangar?
they have a beta thing called hangar
Oh did hanger actually make it to beta?
anyways, I will be glad once paper is its own thing and then I don't have to hear about it hopefully anymore 🙂
well people regularly join my discord because my plugins don't run on fabric
And then devs will be forced to support it
not me
And then you'll need yet another implementation module
people can complain all they want if my plugins don't work on some implementation I don't support anyways
not going to make me do anything about it lol
its possible to pick the particle of a specific block and use World#spawnParticle
o.O
tryna display the breaking particles of a certain block?
yes
pretty sure you can do that by playing an effect using
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#playEffect(org.bukkit.Location,org.bukkit.Effect,int,int)
and this effect
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Effect.html#STEP_SOUND
declaration: package: org.bukkit, enum: Effect
declaration: package: org.bukkit, interface: World
it will also play the block break sound tho. not sure if you can do it with just the particles
probably with packets but idk with the api
You can
BLOCK_CRACK - Uses BlockData as DataType
BLOCK_DUST - Uses BlockData as DataType
yes but the step sound would be in the block im playing the effect because the particle i want to get are on top of the block where the particle will be displayed
how?
ah well there ya go
and u supply BlockData of whatever block u wanna display particles as T
but how can i supply the blockdata in the particle
using this method
why is there both a listener and an EventExecutor? Which of those am I going to use for the actual event listening logic? o0
probably for registering custom events
or if you have an event class that extends
hm the javadocs don't say anything about it, and it's declared in PluginManager, not in SimplePluginManager
I just need it for a test class
EventExecutor executor = new EventExecutor() {
@Override
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!eventClass.isAssignableFrom(event.getClass())) {
return;
}
// Spigot start
boolean isAsync = event.isAsynchronous();
if (!isAsync) timings.startTiming();
method.invoke(listener, event);
if (!isAsync) timings.stopTiming();
// Spigot end
} catch (InvocationTargetException ex) {
throw new EventException(ex.getCause());
} catch (Throwable t) {
throw new EventException(t);
}
}
};
this is the impl
basically its job is to trigger the listener event
or "execute" the listener
people do some nasty stuff in there from time to time
weird, why is it in PluginManager and not in SimplePluginManager then :/
you can do some dynamic type registration with it
if I wanna return a CompletableFuture of which I already have the value, I'd do it like this right?
public static CompletableFuture<String> getEffectiveMotd() {
if(LOCALHOST == null) {
return CompletableFuture.completedFuture(Bukkit.getMotd());
}
// Otherwise do some actual async stuff and use supplyAsync
yep
thx
or do like some either thing but that looks good to me
I just checked, the Listener is unnecessary - it doesn't do any logic, no method inside it gets called
I wonder what the listener is needed for
@Test
public void testMotdEvent() throws ExecutionException, InterruptedException {
getServer().getPluginManager().registerEvent(ServerListPingEvent.class, new Listener() {
@EventHandler
public void onListPing(ServerListPingEvent event) {
System.out.println("Listener called");
}
}, org.bukkit.event.EventPriority.NORMAL, (listener, event) -> {
System.out.println("EventExecutor called");
}, getPlugin());
String motd = ServerUtils.getEffectiveMotd().get();
System.out.println("Motd: " + motd);
}
this only prints "EventExecutor called"