#help-development
1 messages Β· Page 981 of 1
but a 2d bounding box is quite hard to intersect with
Itβs easy in 2D
unless you mean if it's in x z
just use a fucking rectangle π
then you can set y from max to - whatever is the min now
a 2d bounding box is a fuckin rectangle
I only needed the contains function of the three dimensional one so I remade it real quick.
@AllArgsConstructor
public class TwoDimensionalBoundingBox {
private int minX;
private int minZ;
private int maxX;
private int maxZ;
public boolean contains(double x, double z) {
return x >= this.minX && x < this.maxX && z >= this.minZ && z < this.maxZ;
}
}
Sure I could set Y to 0 but it's called a few dozen times per tick so I need it to be as performant as possible
(a few dozen times per tick per player)
Thatβs really not much :p
if you need it to be as performant as possible you wouldn't make it an object
I only create the object once
a few dozen times per tick per player
which is at max 2000 times
thats not much at all by 2016 standards
ic
The game does a ton of bounding box checks each frame
Now it does a few more 
idk i find it weird how people try to optimise the shit that does not need optimisation at all
Why would I not when it's literally 1 minute of effort, and does somewhat improve readability aswell?
because now you have more code to maintain
compound this over a few more decisions and suddenly 30% of your codebase is unnecessary optimisations
while you couldve used the existing apis with 1) more readibility and 2) 0.003% less performance
why have a weird ass class named TwoDimensionalBoundingBox with one method when the standard already has a 2 dimensional bounding box which called.. guess what? a rectangle
yeah I renamed it to rectangle already. But I'll check if the java rectangle has a contains already
it does
Well it does if you create a Point. If you call it with x,z it calls a deprecated function that seems kinda overkill to me.
Also why are their variables upper case π₯²
due to name collision is my guess
Yeah I guessed that, too. But that's horrible D:
took me a while to differ between X and x
you need contains
not inside
hm
contains just calls inside
:kek:
that's what I said
they deprecated inside to rename it to contains and call it internally π―
anyways the point is you should be calling contains which isnt deprecated
the renaming is actually a wise decision
as inside sounds weird ahh
i feel like the standard probably knows a faster algorithm than you do
their weird assignments don't seem faster though
compilers are an interesting breed
i'd bet money that that code was optimised against the bytecode
they can't deal with negative coords though
they can
did u even read their code?
Whats the player getting
You bought Upgrade " + upgradeLevel + " for the Phantom Kit! is showing twice
is the player losing the money twice?
also yes
oh you can set x,z and width+height seperately. I see
the reason of that I can't tell from the code you sent
Show where you call processUpgrade
?paste
idk how to explain it but checking e.getClick() == ClickType.LEFT_CLICK would prolly fix it
Hello, why some of you prefer Eclipse instead of Intellij? Or, why did you switched to Eclipse?
I mostly used Eclipse because I find the default theme of IntelliJ very ugly. Now, I have switched to IJ Ultimate because I created my own Theme I like
hmm okay, someone who uses eclipse instead of intellij for a technical aspect?
yeah I think there are some slight feature differences. But, remember, the IDE choice nowadays is like 99% just personal preference
yeah, but maybe there are some technical differences?
I mean yeah, they're different products, different keybinds, different plugin systems, different build tools interesting, dependency management
I use eclipse purely because eclipse better suits my workflow
wdym?
but in the end it depends on your preference and what you'll like more
In my case I cannot live without having like 5 projects open at the same time
hmmm i see
the only real thing I don't like is that eclipse takes forever to support newer versions of java (still not J22 support :( - although I guess I could also be using bleeding edge versions, so shame on me?) and the fact that it still hasn't sorted out the duplicate @NotNull annotation problem
The latter problem annoys me so much that I tried to fix it myself a while ago, only to then not be able to reproduce it. So fate really wants me to stay with these issues
lol
pretty interesting, but then i think that IDEA is better for me then
try one for a month or two, then the other one
find the one that suits you after getting familiar with them etc
i used eclipse before
Eclipse's maven support is quite nice
when i was using a bad pc from 2008
TIL hotdogs aren't actually hot dogs
From what I have heard is that eclipse's debugger is one of the stronger debugger on the markets. I don't quite trust that but oh well
what there is more thn IDEA for that?
Eclipses debugger could be better. Especially when it comes to obtaining locals while stepping. But I suppose this isn't something I can blame eclipse for
idk how to use debugger for plugins x)
Well given that IJ doesn't allow opening more than a project, it's kinda irrelevant. But eclipse will automatically resolve inter-project maven dependencies and thus allow you to debug connected maven projects even faster even if they aren't multi-module
is intellij have project explorer ?
it literally does?
if its not im not gonna use it
what are you talking about
yeah
well one module
huh
But unless you are on macos from what I have heard it does not support it
hmm
I have literally no clue what you're talking about
for multi module projects i think
modules are gonna come down to your build tool, maven/gradle
it most certainly does support that
Under IJ I'd be only able to have micromixin and it's subprojects open, but not launcher-micromixin
and you can also open multiple projects at the same time
not in the same window however, but it's certainly doable
its possible
opening the folder containing those
Though if you have it in multiple windows, would the class search work? I.e. whatever IJ's Ctrl + Shift + T is
project explorer is op
humm for that idk
if you have dependencies set up correctly yes?
yeah, but it wouldn't allow mixing and matching gradle and maven projects, no?
but module dependencies come down to the build tool
it will works for that
The main "problem" I have set myself is that I mix and match gradle and maven a LOT
resolving those correctly
yes sure, but would it find the types even if I don't install/publish to maven local?
why would you not publish it if the build tool needs it to build?
for maven/gradle to find the other dependency, from some other unrelated project, it needs to be published to a repo, and that becomes searchable when pulled
"fellas, can I use spring without it being on a repo?"
Well under eclipse it becomes instantly searchable, which is what I'm going for
I saw that, I laught
tbh I usually use the package explorer - but that is only caused by me having only a single multi-module project for quite a very long time
hmmm
okay perhaps janino was the only other multi-module project I have imported into eclipse in the last three years
well, I think IDEA is better for me for now
technically you can do it, but I wouldn't suggest it if you're gonna add the dependency anyway lol
it would probably get confused if you did the two and there's some version conflict or something
Well especially when I am writing something from scratch there is a rather long period (~1 week) where almost all code isn't tested and thus isn't frequently published (only to the extend required for the compiler to not complain about ABI). Once the projects become larger, being able to quickly jump between classes of completely different projects by name is quite useful
Heyo, how can I detect when player start/ends eating an item.
I can use interactEvent to see when player starts eating (tho it is not perfect and "out of box"), but ending is harder
I suppose you could use techniques employed by datapacks (https://www.youtube.com/watch?v=QsJzDxrkXL8)
JK.
I would rather not have to do this :D
I mean for as long as you know when they are still eating you can easily deduce when they have to stop eating
if you don't know if they are still eating, uh yeah
if (sender instanceof BlockCommandSender) {
is it possible to catch datapacks senders?
How do I unregister an event listener?
@sterile axle WEll i had created one without maven and then tried to make it a maven project after learning what it was, (no idea how i got it working). Still dont know to ho fill up test folder
its a heavy operation registering listeners. You should not register/unregister unless you really have to
if you are using maven, then plugin.yml goes into src/main/resources, then when building with maven it will automatically copy plugin.yml to your jar file. any further guidance, i won't be able to help as i'm busy
good luck
ty
ah so I should be caching them
ic
damn i thought registering listeners would be pretty lightweight
but I guess it's probably related to reflection or some shit
?xy
its slow so that calling them is fast
register a listener and pass it around any code you need to run.
How do I get to a CommandBlockSender using CommandBlock
CommandBlock commandBlock = (CommandBlock) cmdWorld.getBlockAt(0, -1, 0).getState();
Bukkit.(blockCommandSender, commandToExecute);
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
what's the content of plugin.yml
make sure your plugin is actually being built with maven. Open the jar with 7zip or similar to check that it is actually there (spoiler: it isnt)
no no idea
probably, first time working with maven
there's only main folder
how are you building
you should be pressing the M button on the right hand side of your IDE
and pressing package
Build ... build project
yeah no
don't think you can. If there's a need, open a pull request / feature request
you're building with intellij
why does intellij make things so complicated
I still don't understand why they let you compile a maven project like that
completely idiotic design
bruh it says there is no maven project to display xd
π
ahahahah
do you have a pom.xml
ok i have a need for this but can't wait and will work around:
if (sender instanceof BlockCommandSender) {
does it exist for datapacks?
can i convert in anyway to trigger a true to this with datapacks?
i have pressed the + and selected the src folder
then pressed package
it did some stuff
but still the same error
do you not have a pom.xml
i do have it
I dont understand what youre doing
why tho? xD
Wants to know if a command is executed by an mcfunction
java's default build system is aids to work with comparitvely
Unsure how those are sent through
Feels wrong to say they're server commands and they're most certainly not command blocks
go into your terminal and type mvn package
what
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
i have done ||kinda took it from internet|| something to preprocess some commands from commands blocks for example having some mathematical operations. (ezylang stuff)
I want to use this in my datapack in my commands
press the maven button send another screenshot
press package
there is also other things but this one is the easiest to understand
one sec gotta find someone who uses maven forgot how to do this
also read this, im afraid i made a mess by doing so...
xd
its okay though beginners make shit poms
may it be because of my empty test folder?
i'm traumatized by poms, it's so hard, i'm now avoiding touching it
it's beacause you can improve it a lot and i'm sure in the end it's gonna be good and you'll be proud
I know i was joking ahah thank you tho
no idea on how to learn this stuff xD
experience
practice
can you help me plz?
I still dont understand what you need to know and why
i have done ||kinda took it from internet|| something to preprocess some commands from commands blocks for example having some mathematical operations. (ezylang stuff)
I want to use this in my datapack in my commands
I dont understand, and stop randomly spoilering please
what don't you understand i'm bad at explaing
ok i'll stop
First. Change groupId value to whatever your package source is usually me.muteaye3
Second. Change artifactId value to whatever your project name.
Third
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>``` Throw this below the groupId and artifactID and version.
This will standardize which java version source is and what you're compiling too. UTF-8 Just standardizes a source Encoding not as important but can cause issues if not set.
```xml
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
``` Put this below your dependencies. This is to define a explicit version of the compiler version just incase the one your project is using is for some reason out of date to a detrement.
@EventHandler(
priority = EventPriority.MONITOR
)
public void onCommandBlockDispatch(ServerCommandEvent e) {
if (e.getSender() instanceof BlockCommandSender) {
String cmd = e.getCommand();
if (cmd.startsWith("/")) {
cmd = cmd.replaceFirst("/", "");
}
if ((cmd.startsWith("minecraft:") && !cmd.contains("$"))||cmd.contains("forloop")) {
return;
}
if (SELECTOR_PATTERN.matcher(cmd).find()) {
String selector = getSelectorWithArguments(cmd);
List<Entity> entities = this.mapping.getEntitiesFromSelector(selector, ((BlockCommandSender)e.getSender()).getBlock());
Iterator var5 = entities.iterator();
String a= cmd;
while(var5.hasNext()) {
Entity o = (Entity)var5.next();
String ent;
if (o instanceof Player) {
ent = o.getName();
}else{
ent = o.getUniqueId().toString();}
if (cmd.contains("$")){
cmd=analyse(cmd,ent,o);
if(cmd.contains("Β£")){
cmd=calcule(cmd);
}
}
if (o != null) {
cmd = cmd.replace(selector, ent);
}
Bukkit.dispatchCommand(e.getSender(), cmd);
cmd=a;
}
e.setCancelled(true);}}}```
ok, now what is the issue you are facing
and dont cancel events with priority.monitor
i wan't this preprocessing, before the command is actually catched, to be aplied also on commands that comes from datapacks
ok and what is the issue with the code you have?
alr, now what?
same stuff as before?
yep
w8
i don't know how to catch if a command as been sent by a datapack
what is e.getSender() in that case?
event.getSender()
with ServerCommandEvent event
yes, print it and see what it is
@river oracle Still
wait
my plugin is not getting updated
wait wait wait
no ,still
[WARNING] JAR will be empty - no content was marked for inclusion!
[03:25:50 INFO]: org.bukkit.event.server.ServerCommandEvent@26815841
weird the src folder should be automatically marked for inclusion with maven
unless specifically otherwise specified
specifically any contents in src/main/java
sender, not event
oh wait a second
so what's the issue? this is caught by your code
this is when i use it with a command block so it's working perfectly
he wants it printed out when you send a command with a datapack
if the event doesn't trigger via a datapack
that's something that should be noted
yup i'm doing that
its clearly coming from a command block
sorry I really don't understand what you want
seems like they want to know when a datapack sends a command?? but again command blocks are iirelevant to that
functions are executed in the context of what executes them, in this case a command block
jar copntains only maven stuff
META-INF
turns out, i'm just dumb srry ;-;
also ide died and its not helping me anymore
invalidate caches
alr 1 sec
it has probably not refactored all the stuff moving everything in the new java folder
it seems like it cant find any package i made
im going insane
help how do I cast a generic list to a specific (List<ItemStack>) YamlConfiguration.getList("somehting here")
it's giving me classcastexception
I know that
how do I change it to the type I want
wait actually it's not giving me an error, just warning that it's an unchecked cast
list.stream().map(ItemStack.class::cast).collect(Collectors.toList()) might works, never try to get list of ItemStack on config.
why
? avoid unchecked cast
can't I just check it
like I have a try catch block right now but it's still giving the warning and also try catch feels wrong
how you can know if List<?> is List<ItemStack>
It should be a list of itemstacks unless someone edits the yaml because I set it to that, and if it isn't I want to just log an error message
you know because you set it, the compiler didnt
yeah, so how do I reassure the compiler that I'll log an error message
you tell it to shut the fuck up
wait actually how do I check if it's a list of itemstacks because I'm not sure if try catch will work
(by adding a @SuppressWarnings)
technically, you would need to check every element in the list
is there like a utilty method for that
not something super nice and tidy, and what approach you take depends on how you want it to react
do you want to ignore/throw away non-ItemStack elements? do you want to error?
I just want it to error in the console if it's not a list of itemstacks
log error and continue or error and abort?
then this is gonna shit the bed just as you want
error and continue is fine
with a ClassCastEzceptipn
ok, but what's the difference between (List<ItemStack>) YamlConfiguration.getList("somehting here") and that
casting like you're showing there doesn't immediately throw
you're trusting the source to contain ItemStacks but it may not
and at a later time once you pull out an item that isn't, then it's gonna throw
My solution will not get unchecked cast like you, because i explicitly providing the type information.
and be confusing
is there an event for breeding attempts not breeding success? i want to make a plugin that basically detects why villager breeding is failing (anger particles)
Hi, currently trying to add 1.20.5 support to a plugin with NMS and whenever I try to view net.minecraft.world.item.ItemStack.class I get // INTERNAL ERROR // in the viewer while on 1.20.4 it works just fine, if anyone can help with that error, it would be great.
If you can't provide support for that, then could anyone tell me how to convert this code from 1.20.4 to 1.20.5:
CompoundTag compound = new CompoundTag();
compound = nmsItemStack.save(compound);```
Currently it says:
```Required type: Provider
Provided: CompoundTag```
and since I can't view the class I have no way of telling what exactly I need to convert it all
?xy
What are you doing the api cant?
personally not 100% sure since I'm trying to add support to a open source plugin which I'm new at doing, but, in the section it shows:
* Convert an Item to a Text Compount. Used in Text Component Builders to show
* items in chat.
*
* @category ItemUtils
* @param itemStack
* @return
*/
@Override
String ItemToTextCompoundString(ItemStack itemStack) {
// First we convert the item stack into an NMS itemstack
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
CompoundTag compound = new CompoundTag();
compound = nmsItemStack.save(compound);
return compound.toString();
}```
So from what it's saying it's trying to convert a itemstack into an NMS itemstack apparently
@worldly ingot does the chat api support this?
Yeah I think so. You should be able to pass ItemMeta#getAsString() into a hover event
(with the item type prepended as well)
e.g.
public static HoverEvent createHoverEvent(ItemStack itemStack) {
String contents = itemStack.getType().getKey().toString();
if (itemStack.hasItemMeta()) {
contents += itemStack.getItemMeta().getAsString();
}
return new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(contents));
}
I think that works
Would have to use it with a BaseComponent though obviously
Right now I can't even get the spigot api ItemStack into a NMS ItemStack apparently, and the methods now seem to have changed completely from 1.20.4 to 1.20.5 and I currently can't see a way to get it to work
The idea is that you don't need to use NMS at all
I may be wrong but I think what they're saying is that there's no need to use nms since the API is capable of doing that task as shown in the example Choco sent
ah
If you just want a string, you can do this:
public static String createHoverEvent(ItemStack itemStack) {
String string = itemStack.getType().getKey().toString();
if (itemStack.hasItemMeta()) {
string += itemStack.getItemMeta().getAsString();
}
return string;
}
Will get you pretty much 1:1 what that code above does
will it work to 1.16.4 to 1.20.5?
It will work down to whenever ItemMeta#getAsString() was added, but I don't remember when I added that
or should I just replace only the 1.20.5 with the new one
1.18 or something
ah
Alright, I'll try this and hopefully it works
thank you in advance if it does
Yeah, 1.18.2 it was added
Not a bad guess tbh lol
Note that there's no guarantee of this for serialization. If you're wanting to serialize/deserialize, use Bukkit's configuration serializable stuff
The above snippet also excludes amount, which is a property of the item stack itself, not of the item meta
okay
i have two methods that read and write to a yml file below. all the debugging logs i have in them all print correctly with the values they should, but the data.yml file isn't being changed at all. any clue why?
you never save it?
Relatable
are there any "safe" ways to get a chunk?
I've found my server mysteriously crashing due to some sort of race condition involving chunk generation
getChunk method?
shit I just noticed that this won't work either. If I wait one tick all blocks are already exploded and I won't know which of the air blocks are new
and the set method won't work either since I can't run an event at exactly the end of a tick
More context? When do you want to get a chunk, why do you want to get a chunk?
- every time an entity spawns
- cancel mob spawns if there are too much nearby entities (I have someone with a mob grinder w/ spawners in 2 nearby chunks that lags the server with hundreds of entities if given enough time)
the issue in question occurs since entities can be spawned in chunks that are right next to generating chunks
Try using a Scheduled task (every tick) to wipe the Set. Pretty sure the events all run before the scheduler ticks
I did try that already
is there an event for when you throw an item like an enderpearl or a snowball
Doesn't the projectile event trigger?
ProjectileLaunchEvent
perfect thanks
how do I check if the player swaps a item with another? (via cursor or smth)
This just partially works..
Same is if I did it in survival
https://imgur.com/ZKslo9H can somebody explain what's going on here? I'm giving 0.2 credits and it's doing some weird floating point stuff instead. I don't get that with 0.5 credits
you must be dividing somewhere
I'm literally not
if (!_gm.isEdit_Test && tntOwner != null) {
if (posOwner != null && !posOwner.equals(tntOwner.pc)) {
tntOwner.credits += IslandWars.cfg.playerBlockExplodeCredits;
}
else if (posOwner == null) {
tntOwner.credits += IslandWars.cfg.otherBlockExplodeCredits;
}
}
this is the only place where I'm giving the credits
ok chat filter wtf
bro what is this garbage chat filter
Its a rounding error with floating point precision
I konw that much
you can use a BigDecimal to fix it
THIS FILTER
this is where I'm showing the notification
sendActionBar(Component.text("+" + amount + " credits (" + this.credits + ")"));
what on earth
it filters get_Bukkit without the underscore
I'm triyng to show you that there is nothing wrong
these types are hyper annoying to deal with
that is a banned word
for one it's illegal to distribute compiled server jars
isn't the get_Bukkit website official?
no
Why haven't I won the lottery yet
what license are you using?
GNU goes to court for you if you're using one of their licenses
for free
Its not about the Spigot/bukkit license
it is about the license
if the license forbids it
that's what code licenses are for
a compiled server jar contains propietary Mojang code.
then why is get_Bukkit banned if it's not your beer?
What about the ancient dmca thing
because its illegal
no
why not, tehy also contain mojang source code
neither distribute compiled server jars
??????
for Spigot you run BuildTools to get as jar. For the others they compile when run
https://imgur.com/LIhsTns what do you meann
it's plenty fast then though
and why would get_Bukkit not just use the spigot jars directly?
because they don;t care? Ask them
Hello, how can I use yarn mappings for my spigot plugins?
like why would they go out of their way to distribute their own kinds of spigot builds if they can just take the legal ones off the spigot website
spigot != fabric?
Magic 8 ball says... Ask later
what
I'm struggling to understand why one is illegal and the other one isn't, even though they should distribute the same thing
I already told you they are not the same
Spigot does not distribute Mojang code
get B does
a compiled server jar contains Mojang code
Spigot doesn't distribute jars at all, paper distributes bootstrap jars or whatever they're called, basically automated buildtools, getbucket distributes the whole jar
Which you are not permitted to distribute
hello everytime i restart my server (and not change anything in the plugins), all the List reset. Is it normal?
well anyway, please fix the stupid chat filter to allow pasting code without being filtered
What list
Why yarn mappings?
Map*
what map
fabric != yarn
map where i stock the player and somme coordinate
???
because I want to do something special with yarn mappings, instead of translating a lot of classes from yarn mappings to mojang mappings
Literally no sane individual uses yarn anywhere else than fabric
a restart loads a fresh server/jar Your data will be lost
When I write fabric I write in mojmaps
how can i stock some data so?...
save/load it
anyway, is there a way to use yarn mappings for nms spigot?
how?
if you want yarn write a fabric mod bruh
Β―_(γ)_/Β―
fabric mods can work like plugins
but they generally have a different target audience
do i need to create a another .yml ?
hmmm
there's a project called cardboard that combines both fabric and spigot, but the developer apparently stole a lot of code from other projects. Maybe there's a successor to it by now
I don't want to use spigot plugins in fabric π
I'm trying to tell you that there are ways to use plugins and fabric mods at the same time to allow you to do what you want to do
Idk how bt remaps jars, but there should be some mappings file meaning just theoretically, you can replace it by a yarn mappings file. Just theoretically tho.
Whatβs this something special?
fabric in spigot x)
maybe it looks stupid
I'm not doing that π€βοΈ
Im a bit confused what exactly is meant by this
I didn't start
Explain
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
Why not clone them and remap them to mojmaps instead?
As in on-the-go or just translating a jar into a new jar?
because they use fabric methods
so I would need to translate fabric also
u mean fabric api?
yeah
Well, it sounds like whatever you do you'll end up with a megabyte of code and a custom classloader
soo, none know how to do something like this?
mods
ngl, looks chaotic
no mods, only plugin
you talking about that tab? then TAB
TAB can't modify the players section
Tab, Action bar, I forget teh middle one, Scoreboard, and probably cleaverly placed Displays
you sure?
first time?
Its called CustomTab
yo
maybe not spigotunlocked .-.
so events with a higher priority can override the effects it caused
ah
is this TAB plugin?
no
it does though
the priority describes what event will stand above the others/overide
and not when its called
Hi I m trying to use this packet:
But it is giving this error
Anyone that tried to use this packet ?
Why are you using unmapped
anyone know if citizens api could be used to forcefully keep a singular chunk loaded?
would rather do that than use nms
Just use the Spigot API?
declaration: package: org.bukkit, interface: Chunk
How can i give strength effect to a player?
PotionEffectType.INCREASE_DAMAGE this, right?
oh thats handy
yes
i have problem with tab complete in game commands
console shows this
com.earth2me.essentials.Essentials.onTabComplete(Essentials.java:641) ~[?:?]at org.bukkit.command.PluginCommand.tabComplete(PluginCommand.java:141) ~[spigot-api-1.20.5-R0.1-SNAPSHOT.jar:?]... 25 more
Is there any case when you break a block that a registered BlockBreakEvent method isn't called?
Could the canecllation of another event prevent it implicitly from being called?
How can I use mapped ?
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
?y2k
@faint swift ^ sorry I'm fucking losing my mind
π
bros gonna be the next joker
I'm going to be the joker of the mc server software
Can't wait to watch everything burn
So I have to use Mojang code to packets if I want to see the code mapped?
No?
If you need to access NMS classes from inside your Spigot plugin, it is a very good idea to use the so called Mojang mappings. Disclaimer: This post is written for 1.20.4. If you use another version, you of course have to replace every occurance of β1.20.4β with the version you actually use. What are...
I am so stupid ong
Does anyone know a library to view/modify the inventory of an offlineplayer?
Who knows how to connect a mixin to your plugin and how to work with it?
you may want to modify it when they join
I can hear my network going brrrrrrrrrrrrrr
.
Shouldn't be. Unless you're on 1.20.5 and it's a bug, but it would be a very, very, very niche bug that nobody's caught yet
The more likely scenario is that you either don't have an @EventHandler annotation on your listener or you haven't actually registered it
Could the canecllation of another event prevent it implicitly from being called?
If you have ignoreCancelled set to true, yes
get out slo-poke >:(

When you cancel PlayerLoginEvent, is there a PlayerJoinEvent called for the same player?
Well if the player cannot login..
It's not cancellable but you can prevent them from logging in in that event, in which case, no
disallow() instead
I was asking if another event entirely, not multiple @EventHandlers for a BlockBreakEvent.
The example I was going to provide is similar to the disallow behvaior between PlayerLoginEvent and PlayerJoinEvent. If there's another event that when cancelled, then refutes the call for BlockBreakEvent
What if they dont join until the server reboots, Iβd have to store this info in files. And howd I get their inventory in the first place? I think it will be better to just get it from the .dat file and then save it.
any devs that wanna develop plugins voluntary please dm
check dms
Hi, there,
I'm making a plugin, where I have to get the name of my HOPPER, except that when I put my block it doesn't work any idea where it comes from?
private static Core core;
@EventHandler
public void onPlayerInteract(BlockPlaceEvent event) {
Player player = event.getPlayer();
Block placedBlock = event.getBlockPlaced();
String blockname = event.getBlockPlaced().getType().toString();
if (placedBlock.getType().toString().equalsIgnoreCase("HOPPER")) {
if (blockname.equalsIgnoreCase(core.getInstance().getConfig().getString("items.foreuse.name"))) {
player.sendMessage("Β§6Vous avez posΓ© une Foreuse !");
}
}
}
}```java
@young knoll was there a reason we didn't have an OfflinePlayer#getInventory()? Technical limitations?
Isnt that stored in the world files?
Yes, but we have methods that interact with those files. Statistics, location, etc.
playerdata?
Okay
Now you got me curious
Would make sense if you could just have a util to read their inventory
does player.hidePlayer(anotherPlayer) still work in 1.20.4+?
Yes
tnq, idk why its not working for me
Are you using it wrong? :p
I just never finished that api :p
Time to fork your own spigot
I don't think this snippet is doing what you want it to do. Are you trying to check the name of the hopper block? Because that's not what you're doing
@EventHandler
private void onPlaceHopper(BlockPlaceEvent event) {
Player player = event.getPlayer();
Block block = event.getBlockPlaced();
if (block.getType() != Material.HOPPER) {
return;
}
String expectedName = core.getInstance().getConfig().getString("items.foruse.name");
Hopper hopper = (Hopper) block.getState(); // org.bukkit.block.Hopper
if (expectedName.equals(hopper.getCustomName())) {
// The hopper has a name, this is probably what you want
}
}```
Ah okay, so it wasn't a technical limitation, it was just LAZINESS >:(
Hello! Is there a full list of all default permissions for 1.20.4? https://bukkit.fandom.com/wiki/CraftBukkit_Commands is quite outdated I think
I think it's pretty much up to date, but the commands might not be. Though for commands, it's just going to be minecraft.command.<command> or bukkit.command.<command>, depending on whether it was added by Minecraft or Bukkit
e.g. bukkit.command.plugins, vs minecraft.command.give
We do have this for reference though, https://www.spigotmc.org/wiki/spigot-commands
Hey @worldly ingot , could you help me out when you're free?
okay, thx, I thought so lol, but had to ask for to clarify ;p
I'm in version 1.8.8 the getCustomName, she didn't work :/
tu parle franΓ§ais ?
I do but I keep it English so others can join in and help as well. I'm unsure what the alternative would be for 1.8
It's like a 9 year old version or something
Okay, no problem, I wait suggestion of others person ^^
Does #.getClickedBlock exist?
In PlayerInteractEvent, yes
oh my god HIDE_POTION_EFFECTS was renamed to HIDE_ADDITIONAL_TOOLTIP
the benevolence
beyond reason
So im trying making a plugin that makes it possible to plant sugar cane on mud without water. So i have come so far to have the base down. Im able to plant sugar cane without water only on mud blocks, but when it grows it get destroyed. How can i make it so it doesent get destroyed when growing on a mud block without water?
?paste
https://paste.md-5.net/tidinusoha.java
im getting cannot reslove player
public void determineTeamAndTeleport(Player player)
and its stating that there shuld be a simicolen before (Plyer player)
Missing brace.
ah i see it. thanks
that fix it. thank you. it would have taken me awhile to catch that
Implicitly declared classes are not supported at language level '8' is what im getting now for the rest of the code on the bottom portion
private Location findClosestSpawn(Location location, List<Location> spawnLocations) {
double minDistance = Double.MAX_VALUE;
Location closestSpawn = null;
for (Location spawn : spawnLocations) {
double distance = location.distanceSquared(spawn);
if (distance < minDistance) {
minDistance = distance;
closestSpawn = spawn;
}
}
return closestSpawn;
}
private void teleportToSpawn(Player player, Location spawnLocation) {
}
private void loadSpawnLocations() {
}
private boolean isTeamsFull() {
return false;
}
private void determineTeamAndTeleport(Player player) {
}
}```
this portion is stating that error
hi i have a question why spigot 1.19.4 has less space?
i mean spigot 1.19.4 is 41kb
but spigot 1.16.5 is 50kb
will there be a loss in features?
?paste
https://paste.md-5.net/tahijivuxu.java
So im trying making a plugin that makes it possible to plant sugar cane on mud without water. So i have come so far to have the base down. Im able to plant sugar cane without water only on mud blocks, but when it grows it get destroyed. How can i make it so it doesent get destroyed when growing on a mud block without water?
disable sugarcane growth event
and add block yourself
i mean
when sugarcane will grow
cancel event
and get sugarcane up
and add 1 more suger cane
So I found the problem these error:
The cause is when I send the packet to add a new player
The latency is null
What makes sense because i m creating a npc
is there no way to differentiate between a Creeper, Fireball, and TnT explosion?
BlockExplodeEvent isn't going to be called for any of those
oh nice
those are all entities
that's right
so EntityExplodeEvent or similar?
then I can match the provided Entity what
Is it possible to write a bytebuf directly onto the pipeline without it going through the encoder? I wanna write a bytebuf where the red arrow is pointing. By default doing channel.writeAndFlush() will write it to where the purple arrow is
Okay i see, but when i tried it just made the sugar cane a bit buggy and creates a lot of lag might be why the sugercane bugs but still. https://paste.md-5.net/ahejoguvuv.java
Is there a way to change a motd through java? I'm a developer at heart so I always want to change stuff through scripts. I don't want to do it through server.properties
why u do scheduler ?
please ping me here if you reply
To get the sugar cane to grow every 20 ticks. Is that wrong?
u mean that ?
oh
i can't upload pictures
It seems like symlinks on macos doesn't work
Does anyone know how I can automatically move the plugin file into the local server's plugins folder
Bukkit#motd(Component) or PaperServerListPingEvent
yes why u need grow sugar cane every 20 ticks ?
use random tick speed i guess
how do i remove the glow effect on enchanted armor usign nms? i know for a fact its possible
without removing the enchants
That sounds fine if you need it to be exactly 20 ticks
hm
i'm not sure if you can even use random tick speed
it just creates alot of lag so.
well sure you're creating a fuck ton of schedulers that could be the issue
are you sure that is the cause of lag tho
yeah but how could i target it like my server is inputting this
Can't keep up! Is the server overloaded? Running 61296ms or 1225 ticks behind
Yeah if i remove the part it doesent lag
Will the PaperServerList event still work if I'm using Spigot and not Paper?
Hm
okay ic
lemme read the code rq
oh
what the fu-
Okay so so so so
you cna do the following
- split the work into multiple ticks
- cache the locations of the sugar cane
no
take a wild guess
use ServerListPingEvent if you want spigot
and you'll be wrong if you guessed yes
Okay, thanks
okay smartass lol
something like this?
https://paste.md-5.net/mutasezute.java
Yes that would be caching it
though a few things.
at start up you obviously want to fill that set, this part doesn't matter that it's slow since startup doesn't matter much
plus, I'd make it so the set assumes that the mud block has a sugar cane above it
it's been 2 hours and a half and i cant understand this fucking error (i already allowed it using "ufw allow 25565")
16:16:04 ERROR]: [null] Votifier was not able to bind to /45.91.92.107:25565
com.vexsoftware.votifier.io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Cannot assign requested address
cant find nothing useful on the internet
no firewall blocking it since it works fine for my other server
already updated the plugin
wtf is going on here
bsaically
something is probably already on 25565
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityExplodeEvent.html#blockList() is this mutable?
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
iirc yes
i tried to also use like 9273 as port and allowed it
if I want to modify the explosion block list, can I just mutate blockList() on LOWEST then cancel on MONITOR and break the blocks manually?
or if I mutate it does it already do that effectively
like does the implementation respect changes to blockList, not just allow them
ig it respects it but not entirely sure
Like this
https://paste.md-5.net/awisunozax.cs
yeah
ight heads up, it seems it does respect it (at least for dragons)
is there a thing such as PDCs for items
yeah
so i added everything no lag and anything the only problem is that it just breaks when it grows
pdc is on items
itemmeta is a persistentdataholder iirc
through their ItemMeta you can call getPersistentDataContainer
what happens when it grows
oh im blind
just destroys
destroys?
wait it send viodeo
intellij this is not reformatting
jesus christ waht is that if statement
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
public class PlayerDeath implements Listener {
@EventHandler
public void onDeath(PlayerRespawnEvent e){
Player p = e.getPlayer();
FileConfiguration cfg = PracCore.getPlugin().getConfig();
String worldStr = cfg.getString("spawn." + ".world");
World world = Bukkit.getServer().getWorld(worldStr);
double x = cfg.getDouble("spawn." + ".x");
double y = cfg.getDouble("spawn." + ".y");
double z = cfg.getDouble("spawn." + ".z");
Location spawn = new Location(world, x, y, z);
p.teleport(spawn);
Location yaw = p.getLocation();
yaw.setYaw(90);
p.teleport(yaw);
}
}
why does this not work
you didnt register the event
i did
is there an event for when a player offhands an item
Might have to delay by a tick
how can i do this?
?scheduling
PlayerSwapHandItemsEvent
jesus that's a mouthful
can i send the video private else i can't send it?
sure
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
--
question,
when am I supposed to return false and when am i supposed to return true in CommandExecutor#onCommand
Can you accept friend request else i can't message
i have sent the video
HoverEvent is apparently deprecated the way I use it
I need some sort of Content thingie but it's an abstract class
Ah nevermind found it
apparently it's from Text
Entity, Item, Text
Item? interesting
comparing to true wont work if its (Boolean) null
yeah i changed it up again
What is the best java library for reading NBT files?
im keep getting this error even tho there is no errors in the editor
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "org.scott.mcpaintball.Mc_paintball.getCommand(String)" is null
at org.scott.mcpaintball.Mc_paintball.onEnable(Mc_paintball.java:30) ~[mc-paintball.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:287) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:188) ~[paper-1.20.4.jar:git-Paper-496]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.4.jar:git-Paper-496]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugin(CraftServer.java:639) ~[paper-1.20.4.jar:git-Paper-496]
at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugins(CraftServer.java:550) ~[paper-1.20.4.jar:git-Paper-496]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:671) ~[paper-1.20.4.jar:git-Paper-496]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:431) ~[paper-1.20.4.jar:git-Paper-496]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:309) ~[paper-1.20.4.jar:git-Paper-496]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1131) ~[paper-1.20.4.jar:git-Paper-496]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[paper-1.20.4.jar:git-Paper-496]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]```
Did you set the command in the plugin.yml
startgame:
description: Start the paintball game
usage: /startgame
endgame:
description: end the paintball game
usage: /endgame
commandlist:
description: Lists all commands
Usage: /commandlist
setredspawn:
description: sets red team location
usage: /setredspawn
setgreenspawn:
description: sets green team location
usage: /setgreenspawn
permissions:
Mc_paintball.admin:
description: Allows access to admin commands
default: op```
oh i see it now
there was a captial U
and some of the things wasnt in the right spot
Helloo, today im inspirated and i want to learn about how to correctly design an event-driven api. Those apis which are designed for creating events and listening to them. I seen them as a really important phase of code developing because most of the time you want to listen to own events not only from Spigot, in general development is more common
I would be really thankfull if you can help me linking to documentation or tutorial that you really recommend. Or you think or used to learn from them
Guys how do I disable DAMAGE_INDICATOR particles from getting through to the player?
It causes lag on the client when big boi damage
I had some code that made it work but it relies on protocollib and i'd rather not have that
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Server.WORLD_PARTICLES) {
@Override
public void onPacketSending(final PacketEvent event) {
final PacketContainer packet = event.getPacket();
if (packet.getNewParticles().read(0).getParticle() != Particle.DAMAGE_INDICATOR) {
return;
}
event.setCancelled(true);
}
});```
It's quite a large api and bringing that in just for this one very specific thing doesn't seem worth it
Well really the only way to do it is to listen to packets, there is a thing called "PacketEvents" I'm pretty sure if you want to try use that instead
In software design and engineering, the observer pattern is a software design pattern in which an object, named the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
It is often used for implementing distributed event-handling systems in e...
Parameter is not a subclass of org.bukkit.event.Event Compiling and running this listener may result in a runtime exception
which makes sense
but how do you even hook into nms events
lemme see
huh?
https://github.com/retrooper/packetevents @lilac vector
Ohh#
thanks Goski, any special recommendation
You can also shade it into your plugin, basically not needing to have an external plugin/api @lilac vector
That is a general pattern, I bet there are countless resources about its variations and usages
Yoooo nitro since when
oh allright, and what about something more similar to spigot system? I was looking some event driven more similar to that one or like the one in luckperms if im not sure - But anything thanks
2 years and 25 days 
wtf
lmaoo, moneys is freedom in europe?
I swear I've never seen you have nitro
You have paid 2y of nitro which is equipvalent to a cpu lmao, $200 brother thats a lot haha π
1/3 of my country minium wage paid
Afaik spigot store "observers" in the static handler list, altrough idk much more then it
Yup
oh right, i always asked why do they do it like that. Static handlers allways fucks you because you have to manually add it, seems weirds from one hand
I think the idea was to have it singletonic to each concrete event class
and then for an event instance youβd still be able to get the handler singleton instance with the instance method getHandlers()
oh okay, thats right. I know this not paper, but have you seen their system? The one they do it with lambda expressions not sure if its from paper but i seen it in Luckperms and many others plugins
Yes I know what youβre talking about
right now i cant remember the library name but we talking the samne thing atleast haha
You have to remember bukkitβs event system is VERY OLD
it was at the time when coding conventions werenβt as βagreed uponβ as it is today
yeah i realized that tho. Most of bukkit things are from around 10 to 15y being generous of course, must be more haha
Yea
I think even if md5 had the chance to change it without causing any compatibility issues he wouldve done so
But yeah, when an api reflects a static design, it becomes extremely hard to change it in the future
right, so would you use the one i talked about? Im looking more like an event driven system which work in any platform without issues not mattering if the plugin is run on spigot nor bungee for saying some examples
subswibe UwU
there are some good libraries u may wna checkout verano
UwU
right thaks Conclure
i would have to give a deeper check thru github
idk why but i seem that github capability is reduced, their finding system used to be more precise time ago
I am going tuwu subscwibe tuwu bwockbweakevent awnd pwayewmoveevent
sounds like google
google is like dying to AI
Dont they use ai nowadays in their engine?
their is so much AI content now googles AI is simply struggling to find anything deecnt
yeah lmao, totally agree. I find even faster to search with Ai rather google, not because gives you all info directly without having to resoome it bu hand. If not by the posibility of not having to read thru pages and pages to not found something
you misinterpret what I say kek
what is the purpose of buildtools
googles results are literally get shit on because of the amount of AI content
maybe babab
to build spigot
(Check the modules of the repo for how its used)
https://github.com/KyoriPowered/event
(Seems to be archived now)
what benifit does it have over regularly building
yeah, searching engines struggle now a days
Ah it redirects to https://github.com/seiama/event
wdym regularly building BuildTools is the only legal way to obtain spigot
yeah it seems like 50% of images on google are AI
thankss conclure, always generous as when i meet you π€
with gradle or maven
:)
if you've been obtaining it otherways you better hope and pray your ass didn't download malware
π«΄
yeah I'm done
Done, why do I need buildtools?
why dont you use Graven is the best building tool π€£
^
to run the spigot server
how else do you get the server jar???
Graven for the ogs
why tf would I clone spigot
the download page?
and open the project
THEIR IS NO OFFICIAL LEGAL DOWNLOAD OUTSIDE OF BUILDTOOLS
You've been installing a pirated jar
MD_5 says this every update π why can no one read!
Sue em
the site where you download spigot jar builtin all those are illegals
I stg reading is a dying art
99% of ALL technical problems can be solved by reading error messages and people refuse to do it
not only related to coding
public void onTab(PlayerCommandSendEvent e) {
e.getCommands().clear();
}```
this event clear player command list or tab completer ?
Idk man, I mentioned to a friend that I was reading up on psychology and they said I'm stupid for trying to learn about something that people have been doing for years...
who else over think that? haha
it clears all commands
just a quick question what jdk version should i use when making a plugin on a 1.8.9 server?
They are no longer my friend...
well hop back in time 9 years. Look at what they use. using my time machine I deduce java 8
;-; yesss siir
yep
Reading is dead, long live reading π¦
if we continues creating IA we will have more usesless people as we already have in the world percentage - Thats the whole truth tho
This is why we need an alien invasion
but im using
π
tab completers not working but commands working π
I would just cancel the the completetion event, isnt better?
tabcompletion event ?
yeah
i did this not worked @EventHandler public void onTab(TabCompleteEvent e) { e.getCompletions().clear(); }
Just create a config list with bocked cmds and then loop over it, if the command is there cancel the event
how do you cancel it?
@EventHandler
public void onTab(TabCompleteEvent e) {
e.getCompletions().clear();
e.setCancelled(true);
}
okay, did you register your listener in main plugin class ΒΏ?
how would I "run buildtools" with these? I ran buildtools now I see this screen, how do I add these lines to it
yes
Select those versions
my other event working
i will try to add debug
in the same directory as the project?
anywhere
preferably have a separate folder for buildtools though
so that you can store its stuff there
should I run all of those lines or just the 1.20.4 one
it generates like 30k files lol
all of them
the project you're working on seems to support 1.8.8 through 1.20.5 AND use nms, so they probably do some multi moduling stuff
I got a buildtools.exe when downloading, how do I get a jar?
you can choose lol
he is trying to understand how to use Bt i wouldnt recommend using NMS tho, not being rude
he's compiling invsee++
he can't just recode the plugin to not use nms
that would probably be quite some coding
oh okayy, thats totally different. I thot he was new trying to joing coding world
just so you know, thot does not usually mean thought and usually means something entirely different
is nms needed for creating a custom mob?
right, thanks brother. As far im not native i over think too much how to write what i think
i'm also not native, don't worry, you're doing good, the more you speak english the better you get at it obv
depends on how custom you want it to be
e.g. if you want custom pathfinding then yes, if you just want it to have different attribute values and health then no
where can i check the available pathfindings?
damn how long does this take? to install craftbook
sorry, i have only done pathfinding once so i barely know anything about it
it
uh
craftbukkit*
quite a while
np
is there a tutorial on how to use offline manager api in ur plugins
you can go for a walk and have dinner in the meantime
ok I'll only do 1.20.4 as thats the only version I need
on my pc it can take upwards to 6 minutes for one version, you're compiling multiple
the plugin won't compile
you'll have to strip out the lower versions
then it will
ok which file I could I modify to strip those out
ohh, thanks for all man. I really appretiate
no idea, i have not seen invsee++'s project structure
do some investigation
ok
it's probably not a single file but multiple
path finding what its? Its like the ray trace from games engines
making a mob behave in a certain way e.g. walking to a certain point or targeting a certain player
how much GB does craftbukkit 1.20.4 take up?

