#help-development
1 messages ยท Page 60 of 1
Strings
you wanna convert it back
i need the item
config = YamlConfiguration.loadConfiguration(new File("this/is/where/config/file/is/config.yml"));
my config work is fine
aight
gimme a sec
idk what the ==: is for
next to org.bukkit.inventory.ItemStack
unless that's using the serialiser?
YamlConfiguration configuration = null;
List<String> StringList = configuration.getStringList("Enderchest");
for(String string : StringList) {
YamlConfiguration stringBlob = YamlConfiguration.loadConfiguration(new CharArrayReader(string.toCharArray()));
ItemStack it = stringBlob.getItemStack("");
}
something along theses lines
what is better for scoreboard?
multiline string
but yeah this should work
look up
also found a flaw
theres a StringReader
so
YamlConfiguration configuration = null;
List<String> StringList = configuration.getStringList("Enderchest");
for(String string : StringList) {
YamlConfiguration stringBlob = YamlConfiguration.loadConfiguration(new StringReader(string));
ItemStack it = stringBlob.getItemStack("");
}
hi, i have a question... can i use a normal sleep command to make a waiting time in a action of my plugin?
never on the main thread
throwback to "why my server crashing? I use Thread.sleep(900000000) to get wait"
Sleeping the main thread so it can take a break
what event should i use for when a player obtains and item?
whether that be through crafting, smelting, etc.
InventoryItemPickupEvent doesn't have a getPlayer function
use a bukkitrunnable
You're going to need quite a fee events to manage that logic
you can get the viewers and the holders though, which are a humanEntity, that you can cast to player
ok
quick question about port forwarding, is beacon safe to port forward with? has anyone had experience with beacon? Iโve never used it so I just want to make sure https://www.spigotmc.org/wiki/port-forwarding/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Anyone know why Im getting this error?
This is the code for the packet listener:
protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.LOWEST, PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketSending(PacketEvent event) {
Player player = event.getPlayer();
Entity interacted = protocolManager.getEntityFromID(player.getWorld(), event.getPacket().getIntegers().read(0));
if (spiritEntityManager.getCustomClass(interacted, null) != null) {
event.setCancelled(true);
}
}
});
?paste
Ohh sorry here: https://paste.md-5.net/vilaxitodi.php
Im just le very confused
I just dont get this error
Why not portforward without an external program
Where should i put default values, like in the onEnable, and then extend it to another class?
Wdym by default values
post some code
i have a class with a deserialization method that gets a location from config. it gets the information on server start.
im getting this error: java.lang.IllegalArgumentException: unknown world
not sure how to fix
post
your
code
you can;t create a Location for a world that is not yet loaded
i found this thread, https://www.spigotmc.org/threads/custom-sheep-crashing-the-server-on-spawn.512870/ which was exactly what my problem was but i don't exact get what the OP means by "but I renamed the "initPathfinder" and it works!" because isn't the point of naming the function initPathfinder so that the super's initPathfinder get's overrided and instead we set our pathfindergoals in our class? (ping when respond please!)
bro wait
my brain
brb
LootpoolObj b = new LootpoolObj((String) d.get("name"), (Double) d.get("dropChance"), (Integer) d.get("delay"), (Integer) d.get("radius"));
HashMap<ItemStack, Double> i = (HashMap<ItemStack, Double>) d.get("drops");
b.setLocation((Location) d.get("center"));
b.start();
for(Map.Entry<ItemStack, Double> e : i.entrySet()) {
b.addDrop(e.getKey(), e.getValue());
}
return b;
}
@Override
public Map<String, Object> serialize() {
Map<String, Object> s = new HashMap<>();
s.put("name", name);
s.put("dropChance", dropChance);
s.put("delay", delay);
s.put("center", center);
s.put("radius", radius);
s.put("drops", drops);
return s;
// return null;
}```
ive got this running on a sync bukkit task for 0 ticks (which i believe should run once the worlds are loaded)
As in values that need to be set beforehand, I cant set values in events, because they will be reset every time the event is called
oops
Good deal honestly
ikr
you have no idea how much grinding it takes for those ingots btw
i made it so you have to smelt the shard thingy for 10 minutes to get one nugget
and you need 9
to get one ingot
i love trolling
10 minutes LOL
i think the issue is that it's loading before the world is loaded
idk how to fix that though
Does anyone have experience with grafana?
have u registered the event?
yes -__
Anyone has a clue about this?
fixed this
Would it be possible to make it so hoppers that are under a chest, can't take items from the chest?
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
Cancel this event iirc
Is there a way I can simultaneously change the Material Type of a list of blocks? I am currently trying to replace a pool of water with air by iterating through the list, but it seems like the water replaces itself before all of it is removed. https://paste.md-5.net/hoqafocoha.cs
setType(Air, false)
Oh, I will give that a shot. Are there any potential unwanted side effects from canceling the physics on the air block?
huh
if anyone can give input in #1007898521942372364 it would be great
Is there any long-standing api that does pathfinding goals?
Why does everyone use Gradle? Iโve always used Maven so Iโm just interested ๐
caching is interesting especially in regards to NMS
beyond that, having the ability to just code whatever you want in your build script is pretty nice
I see, is the syntax much harder?
Iโve only found it worse when compiling other peoples stuff because it had to download the gradle version but it could be better on recompile
maven allows this too
it is just done differently is all
So just get 9 ovens
spigot get item name without legacy?
And the Minestom docs are written for it, thatโs the only time Iโve really used it
you can make any custom maven plugins that do whatever you really want it to do
I myself use Brachyura (specifically my own fork of it) whenever maven does not suffice these days
Ah, so is it just easier in gradle?
what do you mean using their maven resolver?
https://mvnrepository.com/artifact/org.apache.maven.resolver/maven-resolver-api along the other countless artifacts required for it
bro how do i fix this. I literally did what minimessage said to-do. Im also on a Paper build
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
these are the only dependencies you need to make a maven plugin.
0 (useable) documentation, 100% enterprise-level
there is no requirements to have your custom maven plugin hosted on maven central either unless you are intending to share it
but even then, don't need maven central to share it either just makes it easier to do so
https://discord.gg/MMfhJ8F or https://discord.gg/papermc but put it on https://paste.gg before asking || thatโs a lot of embeds ||
A sensible, modern pastebin. Share text and source code snippets with no hassle.
Sure but its less flexible as u have to compile the plugin and what not
that isn't less flexible. You mean to say it can be a bit inconvenient.
Gradle, just write it out, nothing needed other than that
It is less flexible in my experience
I don't percieve that as the main selling point of gradle
It isnt
You are not limited in what you can or can't do in a maven plugin as its a programming language you are writing in. Java.
From Java, you can invoke literally anything and only limited by your abilities and creativity
That may be true but I doubt that you want to use the Unsafe class just to circumvent shoddy API
Writing something in java doesn't necessarily mean you can manipulate other programs to do something you want to
shouldn't need to use Unsafe and not sure what shoddy API you would be referring to
But you can
Myes, but gradle becomes easier to bend, or adjust at will at any moment, as you have to rewrite a plugin sometimes in order to change behavior thus requiring recompilation (maven) , gradle has its api, ready to go which with groovy or preferably kotlin dsl becomes way more accessible, flexible and convenient for that part
Java has a native interface
The shoddy API was a blanket statement
sometimes rewriting a plugin might be necessary, but that is just poor planning when you realize that maven plugins can be used in multiple projects
So?
It doesnt deduct the fact that gradle is way more accessible to arbitrary and powerfully impactful configurations
What do you think it is
not sure what you mean more accessible. Java isn't limiting anything
Very easy deployment
Yea but you need to learn the mojo api, and you need to in principle have a good ide to compile your mojo in etc, with gradle its pretty much just write and it works assuming you didnt write anything semantically erroneous
i want help in this code i know some things are wrong thats because i need help
Code: https://paste.md-5.net/huhoquqope.java
Also the api vs implementation/providedApi vs provided scopes are another neat main selling point (though that falls under deployment again)
mfw using kotlin
true, but keep in mind we are indeed talking about two very different methods to accomplish the same thing. One uses plugins the other uses scripts. Technically you can use scripts in Maven too, just need to invoke the appropriate thing is all.
what do you want us to do? Perform code review?
maven allows arbitrary code executing as part of the build script ?
did I miss a maven update
The entire step of having to write a maven plugin as an extra, additional go makes it less accessible and somewhat inflexible, but yeah it would be possible to add scripting to maven in which I guess the difference would be even less significant (theoretically at least)
If so public static HashMap<Player, Player> tpa = new HashMap<>(); is an immediate red flag as what do you want to do if a player disconnects?
it has always allowed this o.O
wat ?
how does someone import a world from singleplayer into a world that can be copied via spigot
what arbitrary code can you define in your pom.xml
yes just view the code and tell me whats wrong please ๐
plugins
custom maven plugin
You can even define custom maven plugin repos
what should I be using instead of AsyncPlayerChatPreviewEvent?
Ah no, it's just draft API
org.bukkit.event.player.AsyncPlayerChatPreviewEvent is deprecated
might just be my opinion then but a custom maven plugin that has to be compiled and published in order to work cross devices is so far off from the arbitrary code definitions you can do in gradle it is laughable to compare the two
Why the hell is draft API in production
_ _
One of the deprecation moments, but not for removal
to collect feedback ?
Its because it's draft
importing a singleplayer world and then trying to call GetWorld on the name of said world just returns null
it doesn't need to be published. Just needs to be somewhere accessible. And yes you need to compile the plugins, but you are not limited in what you can or can't do in a maven plugin either.
is it ok to use?
you cannot include your maven plugin in the repo directly can you ?
We are waiting years for the material rewrite which has been drafted but not put in production yet this draft API goes to prod instantaneously? The spigot team is built out of a bunch of clowns huh
like gradles build-src
yes you can
Might change arbitrarily and significantly, but yeah its fine to use
ah so you code up an entire plugin
and then compile that as part of your pipeline ?
Probably because it's a breaking change but dumb to withhold still
jhfdgajihgfsduihjsdgfuihjsdgfuihjgfsd
adding draft API for a single event or smaller system is a lot easier than something as massive as the material enum to registry change
you could if you wanted to, but typically you would have your plugin compiled before hand. However, as far as where you can put it to be accessible, literally anywhere as long as you are able to tell maven where it is at, or you could just manually include it. That is download it and toss it into your maven repo
I mean, if I have to download a custom compiled maven plugin from some github repo for a project to compile
that is kinda the end of it
oh so you don't use specialsource?
having it as part of the project to auto compile or publish it to a maven repo seems to be the only usable options omi
because that is a custom maven plugin
which is published to a maven repo ?
Paper ๐
but you do with buildtools
Anyways point being, yes specialsource has a maven repo, and most custom plugins for maven typically have their own maven repo or are on maven central and that is if you want to share it
It is easy to use custom repos for maven plugins
<pluginRepositories>
<pluginRepository>
<id>apache-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
if your plugin isn't intended for everyone else, then it doesn't really matter
Yea, that is the point I am on
if I just wanna do a small piece of custom code logic in my build pipeline
maven sucks hard compared to gradle
which, that is usually the amount of custom logic you need
everything beyond that is a proper plugin which, both maven and gradle, keep those published in proper maven repos
or you know just make the maven plugin invoke a console of your choosing and using whatever scripting language you want. Wouldn't surprise me if there is a maven plugin on central that does this already
that sounds like the hackiest solution possible
so that is why BT is so unstable?
in what way is it unstable?
People (as in complete strangers) over at #spigot ask for help concerning BT not working all the time
I mean, idk if I'd personally show off build tools as "look up easy custom code is in maven"
only because the majority do things that are clearly stated to not do
and then the other small percentage is because of the git library that is the only decent one to use occasionally encounters problems
and then the rest is because their internet sucks
Welp /shrug, if you wanna actually argue that custom logic in build scripts is as easy in maven as in gradle, I don't think a discussion on this is worth much
idk why build tools still exists, paperclip is just
like better in every way ?
it isn't. BuildTools is to maven as paperclip is to gradle
You missed the analogy then
I mean it probably is concerning that gradle uses a more or less custom programming language for scripting
I might have, unless your point was "build tools is outdated bloated and slow like maven whereas paperclip is faster, more convenient like gradle"
paperclip does what buildtools does, just differently. You could view it as being better but it does have drawbacks
one of the drawbacks is making it more difficult to code against
Have you compared the two setups for NMS ? xD
paperclip and bt were more or less written for two different purposes
not sure how buildtools is bloated
patching and building the entire server is not needed
as seen in paperclip
which like, that is the nr 1 reason people use build tools
there is a reason pages like getbukit exist
it is needed. To build against paper server you need to run paperclip
otherwise you won't have the source including patches
no you just install a gradle plugin ๐
the difference is that buildtools just goes ahead and does it in the beginning
paperclip just does it later on
right because everyone uses gradle
build tools doing so ahead is a pretty not clever decision
it doesn't need to be clever
it is simple and easy
that is the intended goal
they should do ๐
Maybe you are not around often enough for the people that think it isn't easy enough and end up on illegal pages like getbukit
no, there are better alternatives
at least for a sizeable portion of projects
tbf, I do have my fair share of maven project xD
I have yet to encounter a reason to use gradle
And for some things gradle is unusuable
still work well, at least you don't have to update maven every other week lol
until I encounter that reason, I stick with maven and it hasn't let me down yet
Want to deploy your artifact to a maven repo using ftp? Not possible. Using ssh? Nope
That joke seems to have caused a ruckus. whoops
both are those are possible and I have done both
Not anymore
you need to use the wagon plugin
Guys, might be a dumb af question, but in onCommand I return true by default, would I return true after specific parts too to exit the code?
yes to tell spigot the command has been handled
Nah, that was removed in a recent gradle release from what I have heard
I typically like to return false at the end, and return true in the various code bits
most plugins aren't managed by gradle?
oh you were talking about gradle. I was talking about maven
Yeah, in maven it is quite easy
Alright thanks guys, was something I haven't really thought about yet
return false if you want to display the "command not found" message
Return true if not
yeah I don't want that message to pop up that's why I always return true
That litterally is the only purpose of the boolean
then how does the maven publish plugin do it? https?
then why bother asking?
Though ideally you wouldn't want to ALWAYS return true
correct.
it depends on your configuration
https'post or something like that
i'm saving Item names but they're wrong!
how to fix legacy?
it can use https, ftp, ftps, ssh
Cause I literally have only one return true in the whole onCommand, was wondering whether I should add more to exit code early
exit code early if you don't need it to continue further
otherwise you are just wasting resources on unnecessary checks
yeah that's what I was worried about
Again Gradle's maven publish plugin cannot do ftp even if you are hacky and try to insert your own wagon
that is just weird for gradle not being about to do that
lol
even more of a reason for me to stick with maven ๐
I mean seeing as the script files for grade are just groovy/kotlin you could always handle it manually
pretty sure I have seen plugins for that too, but eek
I just feel like gradle is a lot more obvious what it's doing
Welp does not matter
Gradle is great cause you can do anything with it really
in the end, personal subjective decision
of course
because it's the standard for kotlin I just got used to it and never looked back
you can do anything with both
as we just explained above
both do it differently
fixed - api-version: 1.18
but you can't just write your logic in xml, you'd have to write a separate maven plugin to do what you want and use that (afaik)
you don't necessarily need separate maven plugins, that is just if you decide to have separate ones. Also, most of the time a maven plugin already exists for what you are wanting, just have to do a bit of searching
maven can also invoke ant as well, which is a build script language
and there is already a maven plugin for ant
what if windows
yep it definitely can
can invoke git-bash
what if no git-bash / cygwin ๐
just write windows compatible bash
then they are not a developer then and shouldn't be messing with maven anyways
okat now I'm trolling
LOL
I'll be quiet
literally trolling
Thanks! That works for removing the water in the specified blocks. However, when the water gets placed, even though I use .setType(Material.Water, false) , the water flows normally. The water that flows out of the zone doesn't get removed. I have been trying to cancel the BlockFromToEvent for blocks inside the flood area, but I haven't been able to figure out how to get the list of blocks from the command to the event handler.
In plugin.yml, if you depend on a plugin, will this plugin be disabled before the dependency?
if you want to affect the flowing water you have to enable physics
I am trying to prevent the water from flowing.
or you search for connected water, not just source blocks
I am worried that if I search for connected water, it could lead to the plugin trying to delete an ocean or something.
So you're saying that if I want to stop the water from flowing, I have to enable physics?
No, if you want to affect water which is already flowing, you have to allow physics when you remove its source block
to prevent water from beginning to flow, you replace/place it with no physics
Okay, I am trying to stop it from beginning.
I tried to do it like this https://paste.md-5.net/ebohasotof.cs
The water on top of the trees does not flow, but the water that spawns on the ground does flow.
I've never had any issue spawning static water anywhere
odd
Should I send all my code?
there is an event for water flowing but I can;t remember the name of it
I don;t think its teh spread event
listen for any of your blocks triggering that event
declaration: package: org.bukkit.event.block, class: BlockPhysicsEvent
I have been trying to cancel that event for blocks in the flood zone, but I am having an issue getting the list of blocks to the event handler.
you add them to a List so just DI
What is DI?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
as its all in one class you don;t need DI
Okay
all you need do in the event is java if (block_list.contains(event.getBlock())) event.setCancelled(true);
Do you think there is an issue with the current if statement I have there?
I don't think the block list is getting into the event code block because "Water flow cancelled" never fires.
does water flow detected?
Yes
then your blocklist is empty
as yoru sysout for cancelled is not included in the if condition so it shoudl print for every block
I donโt know how to get the full blocklist out of the scope of the command and into the event
its already a field
so long as that event is exactly as it shows in teh paste
do you register it as a CommandExecutor and a Listener?
first of all
he wants to do something with blocks in the flood zone
so you want a map ig
no?
The class implements CommandExecutor and Listener, and it is registered as an event and a command in main
ok
I'm trying to send PacketPlayInBlockPlace but I don't know what is it's fields (using Protocollib) where can I find it?
You want to use separate classes for different functions
a CommandExecutor should only hold the command
then you get a Map of Blocks and their Location
yes, but he shoudl get it workgin first. Before he goes worryign about single responsibility
and you check if a block and it's location is in that flood zone
and then cancel the event
thats not what he is trying to do. He's simply spawning static water and tryign to prevent the blocks from flowing
spawning without physics is correct, but I believe he is triggering a physics update when the grass breaks
as such he needs to prevent any of the blocks he placed from spreading
His List is just fine as a Block is a single instance, it simply points to a Location.
all he has to do is ask if teh FromTo block is in his list
@strong parcel try using the line of code I showed you in the event
I really recommend he uses single responsibility, adheres to coding style and camelCase
would probably make it easier for himself to diagnose the issue
Working and ugly code is better than broken but pretty
His code design has nothing to do with his issue
He's actually making it simpler to diagnose with it all in one class
lol
Yep I looked at the video again, the physics event is being triggered when the grass breaks next to the water which is higher than it.
alright guys I got a dumb question again like usual
I need to get all field names of the beehive block I punch
We got lots of dumb answers ๐
CraftBeehive craftBeehive = (CraftBeehive) event.getBlock().getState();
Class hiveClass = craftBeehive.getClass();
for(Field f : hiveClass.getDeclaredFields()) {
System.out.println(f.getType() + " " + f.getType().getCanonicalName() + " " + f.getName());
}
this outputs nothing
Now if I output the class name of the Beehive block it just returns CraftBlock, not CraftBeehive
I don't belive getDeclaredFields will get private fields
If i remember there is a different method to get private ones
this is most likely what is causing a physics update
anytime something gets modified or triggered, a physics update is triggered for the surrounding blocks/chunk
Hmmmmmโฆ.
yo what api is that even
I'm looking at spigot javadocs and I can't find any of the methods
Nope I was wroing https://www.baeldung.com/java-reflection-class-fields
So Iโm just doing it wrong or
You need the correct class to start
You will not read fields in the super class
only those in teh class you look at
Iโve tried Beehive and CraftBeehive both
Both return nothing for declared fields
Aight
Correct, CraftBeehive has no fields
so class.getSuperclass().getDeclaredFields()
So use that?
give it a try
outputs this
[19:43:43] [Server thread/INFO]: class net.minecraft.world.level.block.entity.TileEntity net.minecraft.world.level.block.entity.TileEntity tileEntity
[19:43:43] [Server thread/INFO]: class net.minecraft.world.level.block.entity.TileEntity net.minecraft.world.level.block.entity.TileEntity snapshot
what specific field are you after?
I need to set the entitycount
Is intelliJ stupid or am I? It says this method is always inverted
public boolean hasControlCache(Player p) {
for (ControlCache c : controlCacheStorage) {
if(c.getUuid().equals(p.getUniqueId())) {
return true;
}
}
return false;
}```
is there a way to do something like #PrepareAnvilEvent but for grindstones?
I'm looking for either a sorta convenient way to open a book to collect user data or an api that does it for me
its in the snapshot<Beehive>
look at teh CraftBehive link I posted
look at teh method isFull()
it looks at teh snapshot
now open the second link I sent
CraftBlockEntityState.java
its has a field private final T snapshot;
ok I see that part
so then would I need to keep using CraftBeehive?
or TileEntityBeehive
well you need the snapshot field
why isn't this working? Im trying to do api.doStuff() but it isn't working
does api exist
public class API {
public static void doStuff() {
Bukkit.getLogger().log(Level.INFO, "ew");
}
}```
does doStuff exist
which is a TileEntityBeehive
yes
which would be TileEntity
public CraftBlockEntityState(World world, T tileEntity) {
super(world, tileEntity.getBlockPos(), tileEntity.getBlockState());
this.tileEntity = tileEntity;
// copy tile entity data:
this.snapshot = this.createSnapshot(tileEntity);
this.load(snapshot);
}
yeah
TileEntityBeehive
'api'
which would be the blockstate
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
ik java
not enough
the stupid tutorial
?learnjava!
use do API.doStuff()
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
bro he jerking off java
TileEntityBeehive cannot be cast to CraftBeehive @eternal oxide
but I need to get that somehow
You should be able to cast CraftBeehive to CraftBlockEntityState
then you can getDeclaredFields()
always inverted means anytime you call that method in your codebase you use it inverted
it's just a warning
@eternal oxide
Beehive hive = (Beehive) event.getBlock().getState();
CraftBeehive craftBeehive = (CraftBeehive) hive;
TileEntityBeehive tileEntityBeehive = craftBeehive
I have disabled that type of warnings because they are really shity
Ahh I understand
I only see #getSnapshotNBT
Any suggestions? I have already done a brief google search
so you'd want to recreate the method to check if a player doesn't have it
instead of have it
since you're always using it like that
Sorry CraftBlockEntityState
TileEntityBeehive is NMS
so
Beehive hive = (Beehive) event.getBlock().getState();
CraftBlockEntityState entityState = (CraftBlockEntityState) hive;
for(Field f : entityState.getClass().getDeclaredFields()) {
System.out.println(f.getType() + " " + f.getType().getCanonicalName() + " " + f.getName());
}
```?
nothing still
no clue then, I don;t have an IDE open
shit
thats definitely the class you need as thats where the snapshot field is
no ide(a)?
Why are you tryign to access a field via reflection again?
cause there isnt a set method exposed
there is a hive#getEntityCount but no hive#setEntityCount
Whats that theme and how do I get it?
dracula
yeah you won;t be able to set teh count no matter what, They are actual entities being stored
well its an int...
damn I didn't know it was so hot
was told id have to use reflection
yes but it references actual stored entities
they arent actually stored
no?
how to spawn Particle.REDSTONE? it is not working as the other ones
boom, "7" "bees" "stored"
I thought it stored teh actual entity with its PDC and everything
not this
every time a bee exits it gets a new uuid
So I have this hive, a bee has entered 3 times
and it says 3 bees belong to it
private final List<TileEntityBeehive.HiveBee> stored = Lists.newArrayList();
thats the NMS
๐คท
public boolean isFull() {
return this.stored.size() == 3;
}```
there is no actual int you are looking for
its an array
that isFull methodf is also bad code
all I know is.... once the same bee enters 7 times (my max entities that I have set), it doesnt let the bees enter anymore
dont bees just stop existing the moment they enter
there is a constant in teh class for public static final int MAX_OCCUPANTS = 3;
I remem someone talking about it
they respawn
Not looking at teh nms, it actually stores the bee
@eternal oxide beehive.setMaxEntities
its normally less but I set it to 7 or whatever
so I can have 7 enter
but only once..
cause each time one enters it increases the number
Vivian what icons are you using?
thought so
i might be dumb
actually I'm wrong, it stores a new set of data, not teh actual bee that entered public void storeBee(NBTTagCompound nbttagcompound, int i, boolean flag) { this.stored.add(new TileEntityBeehive.HiveBee(nbttagcompound, i, flag ? 2400 : 600)); }
well i am for sure but..
im cancelling them from spawning and spawning my own entity instead
kinda edging the hive
so i guess they stay stored forever..? idk
so maybe instead of cancelling the spawn I need to let them spawn but despawn them right away...?
let them spawn and kill them
https://www.youtube.com/watch?v=epZVZKLRI6w
Is this a vanilla bug or is there a way I can fix this in my plugin?
(When a player has his inventory opened twice)
ah yes
opening your own inventory?
You could recreate that easily, but idk if there is a buggy way of doing it
Idk if I'm mentally-impaired (apparently the other word violates guidelines) or bad at organizing my code by I can't find a class of mine for the life of me. Is there a way to search for classes in intellij?
Ctrl N
Thank you, thats actually so good
No problem; IntelliJs search system is nice
yep that was the issue...cancelling the spawn was making it so the stored amount never went down.
you could cancel the bottom inventory? then inventory is open 
sorry i'm a little confused
what you making?
In my amazing code, is there a better way to inherit the settings of the parent inventory to the new page? https://github.com/KyTDK/NeoUtils/blob/master/src/main/java/com/neomechanical/neoutils/inventory/managers/data/InventoryGUI.java
Like 68 specifically
InventoryGUI newPage = InventoryUtil.createInventoryGUI(null, getSize(), title);
if (pagesInheritParentSettings) {
newPage.setPagesInheritParentSettings(true);
if (openOnClose != null) {
newPage.setOpenOnClose(openOnClose);
}
if (unregisterOnClose) {
newPage.setUnregisterOnClose(true);
}
}```
It's not bad, I just want to make sure that I'm not dishonoring myself.
why can you say fuck but not retort
What if I just made it so only one furnace can be turned on in the world at a time?
just to annoy people
pain
Don't worry, I have more in plan
Making it so
it says the Location
so players gotta battle for one furance
:)
fun minigame
Making a boss that spams one shot moves with a 1/80 chance of dropping something
Good idea
cough fireflies
basically it's a /popup command which opens a player's inventory to him, however if you run it on yourself you have your own inventory open twice
bans
Maybe I should just prevent people from running the command on themselves
that would be easier haha
it doesn't make sense to look at your own player inventory
you can litterally press e
ikr
๐คฃ
idk why I didn't include that simple check back then lmao
but funny to see that some people used the command like that and even reported it xD
Fine, I'll exploit the reporting system to ban anyone that uses a furnace outside of the specific spot
i thought about p == p?
Now you're getting it
but ye ignoring / skip
sounds a good idea
pfffffff!!!!!
hahaha
must pain full game mode
@arctic moth i gotta each other idea
make stamina
the lower
the slower you're
ik that there are class names available like from the screenshot, but nms doesn't have them. is there a way to get nms with class names?
ss from a liveoverflow video btw
use buildtools to make a remapped jar
how do i do that?
oh nvm got it
--remapped
i have another question
is there a way to use nms with paper?
Yup
We're Saper
lol
huehhu
What event does using a goat horn call?
?whereami
How could I make a check determining what the item is? java ItemStack item = player.getInventory().getItemInMainHand();
Wdym
Get the type and compare with a material
Could you explain that a bit more? I was assuming something as simple as this: java if (player.getInventory().getItemInMainHand().equals(Material.AIR)) {
.getType
if (player.getInventory().getItemInMainHand().getType().equals(Material.AIR)) {``` so this?
Yeah
Thank you!
I want to create a custom mob, and I need it to attack all hostile mobs. I was thinking using a zombie, but I wasnt sure how to make it not attack the other custom mobs like itself. I would eventually retexture them so that they arent zombies. Any ideas on how I would go about doing this? (Version 1.19.2)
Use == to compare enums rather than .equals
if (player.getInventory().getItemInMainHand().getType() == Material.AIR) { as == is null safe
Ah, thank you!
on your target selector there is a last parameter for predicate
just check if the entity is the correct custom one
dont think passing the actual custom entity class in wiould work though
dont base your system off of names
does if it extends Entity, but I doubt you are setting your custom mobs like that
simple
tags n such
Custom mobs should always extend entity?
I can check if its uuid is the same as any of the custom entities
that will work
just use an id in nbt
yeah
Check if its an instance of your custom entity or tag your entities using theit nbt data
But custom entities don't persist do they?
ok
how can I get a Mob and a Creature from a Entity, can I just simply cast it? (I googled it, couldnt find anything, I might just suck at googling tho)
nope, have to make a system for it
Well... you just have to add it to the entity registry. Then they are persisted.
or that
You can cast an entity to a Mob if its an instance of a Mob.
Same goes for every cast. Its like this:
- You have an abstraction
Car - In reality, this is a Ford (Which extends Car)
- You can not cast this Car to BMW because its not an instance of BMW. Its an instance of Ford.
- So first, check if its an instance of X. If it is then you can safely cast.
Just casting your Object to something more specific without checking first is bad practice.
yeah, I thought I could just cast it, wasnt sure. I hadnt looked that far into the hierarchy. I do know how casting works, but thanks for the reminder ๐
In Intellij you can just press ctrl + H
Ah, thats cool, I didn't know that. Thanks
I was just hovering over classes and looking at the first layer of extensions/implementations
IntelliJ can even do more
thats hot
That's one thing I do kind of wish Eclipse would do. I'm sure there's a plugin for it but meh
Eclipse ๐คข
Eclipse is so good
I use it on the daily
Ik
I would even use VScode over eclipse
Preference is the word you are searching
I think its a fact at this point
because all the hurt get together?
Lmao
Eclipse is shit
Its good for beginners in a sense
Dont get mad bro i was joking when i reply to you
No because tools can be preferenced differently. If its a fact then you can
quantify and prove it. Which you cant.
Sorry, I didn't know you had a thing for eclipse
So I have this: java if (player.getInventory().getItemInMainHand().getType() == Material.SHULKER_BOX) How can I make all shulker box colors be included in that?
I most certainly dont. Doesnt mean i have to vilify it.
You guys most certainly dont have enough experience with
any of those two tools to make any meaningful statement about them.
I was good for me when I was learning, but as you get into more complicated projects you most likely will benefit from using intellij
USER FRIENDLY? Oh please common on
what
I can accept others argument but that one one please
There is a Tag for shulkers
Yeah i really hate it
thats an opinion
How much experience do you have with both tools? I mean hands on.
eclipse 2y and intellij exactly 1
if intellij wasnt made i bet eclipse would be heavily used still ๐๐
oof sorry to hear that
ItemStack itemStack = ...;
if(Tag.SHULKER_BOXES.isTagged(itemStack.getType())) {
}
Ah, thank you very much!
You cant import "Spigot 1.19.2"
Do you mean the artifactId?
Well... the same as for every version. Just with 1.19.2
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
Using this, but its not allowing my nms for some reason.
spigot artifact is not on maven repository
You have to build it yourself
Did you run BuildTools ?
yeah
For that exact version
maybe just need to reboot idea..
cd BuildTools
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
java -jar BuildTools.jar --rev %Input% --remapped
pause```
?
You need to build it with the remapped version for the version you want to use
He said he already run it ----
thx babe
๐
Also why remapped flag doesnt work on 1.12?
Funny
Because mojang mappings where introduced in 1.17
OH that why
Before that spigot had their own
Im a idiot
I dont understand your question. Spigot has their own mappings.
Which is what you see when you simply use nms in older versions.
Or else everything would be obfuscated.
Uhm... spigot has a transitive vulnerability through commons-codec
Ok, so what we can do?
Report it to spigot?
Well its not too bad. Just blind base32 conversion. So unless the user has a way of writing base32 Strings that get persisted and has information
about the backend implementations, this is pretty negligible.
is it possible to make a bridge between a spigot plugin & velocity plugin? i cant find any solution
Yes there are several ways of achieving this. Do you want a custom solution or is it for a public plugin?
custom solution its just a private plugin anyways
Ok so then i can think about 3 ways right now.
- Plugin messaging channel
- Sockets
- Redis topics
oh
i dont have redis so i may use sockets or plugin messaging channel could you describe more about them?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i'd hope that it works on velocity thanks
Yes it should
yeah it does thanks so much
i did completablefutures ๐๐
Yeah CF is also a good approach for that.
i smell cap
I was bullshitting lol
Is it a good idea of having one connection instance of an sqlite db in a class with static crud methods
yeah, db connections are async anyway
idk about the necessity of them being static though
Singleton object of the db class
Oh nvm I'll do dependency injection
Disregard the static above
Why does this not stop item drops on block break?
event.setDropItems(false);
No. You shouldnt only use one connection. Also always close a connection after it has been used.
Use a connection pool like HikariCP which handles connections for you.
cant connection pool for sqlite
its file based
hikaricp will let you connect using the lib, but it wont use connection pooling for it
Every database is file based in the end. Why do you think that you couldnt have a pool for specifically SQLite?
yes and no. you cant have mulitple file connections opened for the same file. for read purposes it is possible, but in general the OS doesn't like it
the is no server software for sqlite, therefore connection pooling wont work
he is correct, hikari doesnt support connection pooling with sqlite
I mean technically you dont need a connection pool when the db is on the same machine in general because the connection
is established instantly anyways. But i think its good practice to write your code agnostic of the backend.
you do if you are doing tcp connections even if local
So just write it once for SQL and dont worry about the dialect
however, since java 17 allows linux sockets, if the libs would update to allow that type of connection then you would be correct in that connection pooling won't be necessary
Wondering why my mob health is insane in my server.. didn't ever edit it nor do I know how to. Legit didn't change anything and the mobs are 10x as strong as default
There is no network overhead when the db is on the same machine...
there is if you use tcp
not sure where you get the idea that the headers don't exist and all
just because it doesn't leave the machine doesn't mean they are not still created
now it will be quicker for the OS to process though if you are using the loop back device
This is just a tiny bit of data. A few more packets that are not even routed through the NIC. Its directly available between applications.
if you are using the IP assigned to the machine from the network device
then it will go out and hit the network device and then come right back
No it wont. All network Layer 3 adresses are locally mapped to the loopback address.
difficulty?
Normal
Probably one of your plugins then
It was fine yesterday, implemented some new plugins and it changed
DM's, sent a pic of plugins
Yeah not gonna look through those. Ill gladly help with development related questions but otherwise you should visit #help-server
this is not true
Actually let me fire up wireshark and double check. But im almost certain that the local routing table has the loopback address as next jump mapped.
I think you mean to say all layer 3 addresses are all mapped to a single layer 2 address per physical interface
How do I get a serializable value of a Material? is there an ID of some sort? And how can I reacquire it when loading
I mean you literally have Enum#name() and Material#valueOf
Well... if we are speaking about LAN and you have only one NIC then you will also just have one MAC address. Sure.
But even before that. On layer 3, or more specifically IP, the routing table has your IP address mapped to the loopback
address which means it doesnt even bother the network controller but rather keeps the communication on the bus.
it's an enum, you serialize it the same way any enum is
So enum -> String
And String -> Enum#valueOf(String)
Material has a safer method Material#matchMaterial(String) which also supports namespaced keys and doesnt throw an exception
sure, but valueOf(name()) is guaranteed to work because they're provided (and final iirc) by the Enum abstraction, so no problem in using those over matchMaterial
it's not like you're having the user give them to you via a config
it would depend on your OS for the mapping of loopback to the router assigned IP
a typical routing table, does not map the loop back device to router assigned ip or vice versa
since most systems have one physical device, it is quite common to see multiple layer 3 addresses mapped to the same layer 2 address
taah why u lurking
Might be true. But then just use the loopback address when creating a connection ๐คท
it is generally advised to use loopback if the connection does not need to leave the system
as yes it will cut out some but not all overhead
since the headers will still exist and still need to be created as per the protocol requires
you know that 7smile said there was no network overhead, not that there isn't any protocol overhead
that is pretty much the same thing
how
๐
because the only additional overhead the network does beyond the protocol, is querying for where to send the packets for the next hop. Other then that, the overhead that is typically referred to is mostly coming from the protocol being used for the connection.
mm I took it more literally, as in the first part
TCP has overhead in the creation of the headers, the packet body and padding out the packets to be appropriate sizes. And then once the tcp packet is sent, a response is required
if the response isn't received in the configured time for the device
it will send those packets again
if I remember right, the default typically is 3 retries before failing
well that's because TCP tries to fix a problem, one that doesn't exist for local connections, but I don't think 7smile was arguing that TCP doesn't have overhead
well even if the connection is local, the protocol still does the same thing
the only difference is that it will be quicker and there shouldn't be failing
right, because the implementations don't care where the connection is
if there is you got some major problems XD
yeah, probably more major than connection optimization xd
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.71 35
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
192.168.1.0 255.255.255.0 On-link 192.168.1.71 291
192.168.1.71 255.255.255.255 On-link 192.168.1.71 291
192.168.1.255 255.255.255.255 On-link 192.168.1.71 291
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.1.71 291
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 192.168.1.71 291
this is what my routing table right now looks like
as you can see, the network assigned ip is not at all mapped to loopback
or the loop back mapped to network assigned ip
this is the standard routing table for most people, unless you configured it differently with some scripts or the OS you use just does that for you or something
What is this thing called %count%
A placeholder?
If I spawn entity in unloaded chunk will be spawned?
off the top of my head, no idea, Id just try it and see
I am confused. If I don't need to use DI, what do I need to do to fix the list being empty?
Yes. First the chunk will be loaded/generated and then the entity will be spawner. After that the chunk will be unloaded again.
Thanks
Whats the issue?
I am trying to temporarily spawn static water in a radius around the player. I have tried setting applyPhysics to false when setting the air to water and vice versa, but for some reason some of the water still spreads. To stop the water from spreading, I am trying to cancel the BlockFromToEvent for blocks in the flooded area by iterating through the list of blocks in the area and checking if they are equal to the source block in the event. However, the list of blocks appears empty in the event handler, which means the event handler can't check if the source block is in the flooded area.
The problem here is that you probably create two different instances of your flood.class
Each of those two instance has their own fields. So each has a completely different block_list variable.
Before we continue i would suggest that you fix your style issues first.
Class names are always defined in upper camel case. So a manager for player movement would be named PlayerMovementManager
and your flood class should be named Flood
variables and methods are defined in lower camel case. So a method which kills every player with a helmet should be named
killEveryPlayerWithAHelmet() and your block_list should be named blockList
You can right click the variable or class name and then select "Refactor" > "Rename"
Is there an alternative to listening for mob spawning events to naturally spawn in custom mobs?
like adding them to minecraft's spawning queue?
mapping values are not allowed here
Okay, I renamed the files that started in lower case, and all of the methods already used camel case. I started with Python, so I use snake_case for variables.
Only with a bunch of nms. This needs quite a bit of tinkering.
Would reflection be any simpler?
Alright. Are you aware what the difference between a class and an instance of a class are?
Reflection is just using nms. Its literally the same with the only difference that you dont need nms as a dependency.
You can have multiple instances of a class that operate independently of each other, right?
That's the point of OOP essentially but yes
let's say i create a custom geyser particle effect
the class is sort of like a blueprint
whereas an instance is a single geyser
Cool, I understand.
i think i actually prefer that. Guess ill have to peek into the sources or just straight up copy the spawning code
I would suggest that you create 3 classes.
A command, a listener and a manager class.
The manager class contains the blockList and each the listener and the command contain the same instance of your manager class.
Thats how you usually do it with everything.
^^
point of that is to make sure the manager, listener, and command handler in your code always refer to the same one
So the command class would pass the block list to the manager?
you can go about it a few ways
- have a reference of what you want be passed in in the constructor
- have the main class have a reference to everyinthing and a static reference to itself so it can be accessed anywhere
- probably a lot of other ways
I think the command should essentially tell the manager to spawn a Flood at the sender's location.
as for the block list, i usually store a public static list of all instances of Flood so i can access all of the affected blocks. Though i'm not sure if that's good practice
it does work though
So the flood class would create the block list based on the players location the moment it is initialized?
yup
organize your code by "responsability"
"would it make sense for flood to handle its blocks?" if so, then Flood should handle it
I mean... i would use a completely different approach
I'm all ears to new perspectives
and also one last thing that is sort of unrelated but might help if I understand your case correctly
if the water is purely there for visuals and doesn't need to be actual water, don't use real blocks, use sendBlockUpdate, that way since the water doesn't actually exist it won't be updated, whenver you wanna make it disseapear just call sendBlockUpdate again but with the actual block there
pros :
- will never grief the world, especially useful for things like chests
- no need to cancel any events, the water is fake
- if there is a reload mid-way/crash/bug, the water isnt real so no damage will be done
cons :
- it's not actual water, but only essentially a collective illusion
edit : - if the block gets clicked, it resets to the real one
What would your approach be?
By the way, you guys have been very helpful. Thank you!
?paste
For Particle#FIREWORKS_SPARK is it possible to set the spark color to whatever color I want like a actual firework has?
unfortunately no, and it sucks (as of 1.18.2 didnt check 1.19)
download itemsadders
the plugin needs itemsadders but its not installed
dam, it would be a perfect effect to use, I need a red fire work lmao
there is the redstone particle as a "replacement"
its too big of a particle :/
you cas set a custom rgb color and size to it
Wisp.this.bat.getWorld().spawnParticle(Particle.REDSTONE, Wisp.this.bat.getLocation(), 1, 0.05, 0.05, 0.05, 0.01f, new DustOptions(Color.fromRGB(5764863), 3));
sample from one of my plugins
This is meant to be a pvp power that players can trigger. The water needs to slow people down and interact with Depth Strider and Riptide.
i have the items adder but i think i need LoneLibs
the three at the end dictates the size
then you need it to be actual water, since riptide gets checked serverside
public record Flood(UUID floodId, Set<Location> locations) {
}
public class FloodManager {
private final Map<UUID, Flood> activeFloods = new HashMap<>();
private final Set<Location> floodedLocations = new HashSet<>();
public void addFlood(Flood flood) {
floodedLocations.addAll(flood.locations());
activeFloods.put(flood.floodId(), flood);
}
public void removeFlood(UUID floodId) {
Flood flood = activeFloods.get(floodId);
if(flood != null) {
floodedLocations.removeAll(flood.locations());
}
}
public boolean isFlooded(Location location) {
return floodedLocations.contains(location);
}
}
Ive kept it simpler than i would personally implement it but this is a good start.
so you would keep the list in the manager and have it handle that
I wouldnt use any lists in the first place. But yes. The FloodManager should be able to handle mutliple floods.
i suppose if the list is only ever accessed to know what blocks to check in the listener that would be better
yeah it works, but doesn't look good as a sort of flying away particle :/ guess white it is
y u p
Thanks!
is HikariCP is the best sql library out there?
HicariCP is not an SQL library
technically its a jdbc library
A connection pool to be precise
What are you looking for? More automatization? Then take a look at hibernate.
gonna check out hibernate
man its just so good
tbh i just want get lost of all the boilterplate code
like the connection and shit
u know
so i will have only to add commands
and create tables that i need
Hey guys, I have this in my pom.xml
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.12</version>
<scope>provided</scope>
</dependency>```
But I'm not able to access classes like `EditSession` and `BukkitAdapter` am i supposed to download a different artifactId?
did you add the maven repository?
This right? <repository> <id>sk89q-repo</id> <url>https://maven.enginehub.org/repo/</url> </repository>
yep
How does one make a /itemrename command that allows you to have spaces in the name, I cant figure it out or find anything on it cause I'm dumb
spaces in the name?
like /command this 2
Yes
Just take the last N elements from your args array and join them
n elements?
like uh
I just need to join the args together
yesh
of usage or something
yeah use ARGS
here is an simple example from my code
if you dont know what is "args" do some java homework
yeah final was not nessacery here
Oh if that's bad lord help you if you see my code
thats my first plugin o/ it meant to replace essentials lol
i made it like 2 years ago
Hello, according to the hooking instructions from the placeholder api, I added these lines to build.gradle. But when I want to use Placeholderapi in some class, it doesn't work.
I'm kinda making a plugin to replace ess, since the people I work with dont lik eit
and its actually fine
you gotta replace the version
ยฏ_(ใ)_/ยฏ
nesting bad
ยฏ_(ใ)_/ยฏ
still nothing
its minimessage
but i need papi
https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI all from this page i have done
API Version v2.11.2
oh.. i had one extra character there, sorry :D
fellas?
can you accses other classes from the api?
sometimes the docs are outdated ยฏ_(ใ)_/ยฏ
yep, which one, core or bukkit?
Show us the other ones below
Looks fine. Is the problem happening when you compile your jar or is it that you can't import the classes?
Ah, the problem seems to be with intellij not having it indexed I think? I couldn't autocomplete it
Manual imports seem to work though, is there any way to force intellij to index the jars?
File > Invalidate Caches and restart
intellij moment
use vim
How can I listen for permission queries like LuckPerms verbose (for now I don't want to use API, however it going to be too much other I will)
Thanks, appreciate it
read what I said
I did
and can I add that to my lib and redistribute it?
provided


