#help-development
1 messages · Page 1108 of 1
With custom resource packs can you have like multiple UIs under one name so I e.g can use the furnace inv as a normal furnace but also as a custom mashine when I give it a special tag or smth
Not really
Such invs are made by having custom fonts and items with custom textures for overlays (which have a custom model data specified)
So in the Furnace you have the option to put such an item in one of the slots, which would sacrifice this slot to the purpose of showing the custom ui
why items
you literally just use a bitmap for the background
thats it
bruh
forget that u can change the title
i literally said 'by having custom fonts' 🤦🏻♂️
yep, my brain aint be braining again
what is better to store the link together with the text or separately in the database?
Omg i was sooo sleepy sorry -> when i am driving the boat with a shift trigger (event cancelled)
Using nms to set blocks is it posible to do it async? Or it has to be in the main thread as well
The world is not thread safe
You can do it async with both api and nms as long as it's on the main thread
See work distro
?workdistro
what do you think about Scala
you're a borderline scripting language.
💀
(@jagged quail is the bitch.)
What is the right way to remove tooltip attributes from a GUI item now that ItemFlags no longer work in 1.21?
they work ™️ you just need to add a dummy attribute modifier first
itemMeta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier("test", 0, AttributeModifier.Operation.ADD_SCALAR))
itemMeta.addItemFlags(ItemFlag.values());
itemStack.setItemMeta(itemMeta);```
Something like this?
yea sure
Enchantment still appears thought
Hmm
highly flexible system
Fixed the issue was how I was adding the enchantment totally my bad 🤦♂️
how do i get a .png (any size) from myfiles
to change to a 128x128 and then to a ingame minecraft map that i can use later?
yea but then to a minecraft map
how can I check if a player hit a crit?
Make a map renderer
declaration: package: org.bukkit.map, class: MapRenderer
I believe you need to check the conditions manually
how is that
thnks
return player.getFallDistance() > 0.0F && !player.isOnGround() && !player.isSprinting() && !player.isInWater() && player.getVelocity().getY() < 0;
}```
this should do it
you cant get BlockFace class from Vector class
isn't direction a vector?
yes
ow i saw can instead of can't for a second my bad
so what should i do in newer versions?
You can calculate the block face yourself
getBlockFace() has never been a method of Vector
return location.getWorld().getEntities().stream()
.filter(entity ->
VersionMediator.isItemFrame(entity) &&
(!VersionMediator.supportEntityFacing() || entity.getFacing() == location.getDirection().getBlockFace()) &&
boundingBox.contains(entity.getLocation().toVector())
)
.map(entity -> {
final Location entityLocation = entity.getLocation();
Vector flooredEntityLocation = new Vector(
entityLocation.getBlockX(),
entityLocation.getBlockY(),
entityLocation.getBlockZ()
);
final Vector relativeLocation = flooredEntityLocation.subtract(location.toVector());
final int x = (int) relativeLocation.dot(location.getDirection().getXDirection());
final int y = (int) relativeLocation.dot(location.getDirection().getYDirection());
final int height = layout.getSize().getHeight();
final int width = layout.getSize().getWidth();
if (y < 0 || y >= height || x < 0 || x >= width) {
return null;
}
ItemFrame itemFrame = (ItemFrame) entity;
return new FrameContainer(itemFrame, x, y);
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
this is the java code i'm trying to use
That is not spigot api
hello, do someone have a plugin or something to disable players collisions?
iirc you can disable that in your spigot/paper config
i'l check!
i'm sure it is in paper configs, not sure about spigot
paper do that yep, thx
vanilla teams can do it to if u need to change it at some point in ur plugin
this is a general question, i was wondering, when i have a client-server setup, how does the client access server methods? does they client just have the servers-module as a dependency? or is this handled completely different?
(with sockets)
It doesn't access server methods, instead it sends a packet asking the server to do a specific thing which it then does
are these packets in a common module? so both have access to the class
Yes I believe
this would also mean that the common module has a depency of the server-module, so that the packets can do their thing?
i thought of packets in more of a abstract method "doThing"
its like deciding to use json between your front and backend
There can be packet classes/definitions inside of the common module and the server or client can then define how sending and receiving these is implemented
it would be a server.sendPacket(Packet.DO_THING(whatever))
they just agree on a format that the data will be in
and then the server and client send and receive these packets of data and from what they agreed on they know what to do
and that agreement is the packet module with all the packet definitions probably
bastard.
okay, thanks, do you have an idea on how i can implement methods for each packet? does they server just have a map of all the different packets and then a runnable to decide what to do?
do you mean implement as a server?
yeah how does the server implement the logic if it isnt directly in the packet
i would need a map or something
right, well there is like a giant listener on the client server connection that probably decodes the packets and then determines what to do
im not sure exactly the details of it
but it would have to be some big ass switch statement probably xD
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
and stop screaming please
?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
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
is there a way i can detect whether a class is vanilla java or not?
what do you mean by vanilla java
and why do you need to do that
a class that comes with java
like Object
Integer
.
odd design choice
?
You can probably use the package name and class loder
though I see no reason to do so
how else am i supposed to deserialize?
??
well, how are you deserializing?
and what does skipping "fields that exist in java" mean and how does that play a role in your deserialization process
im saving fields name and value, if its a object thats not from plain java i will get the values and fields from that too
im not breaking it down to bytes
so, you aren't deserializing Lists?
yes, both applications are java so i can just send lists in their normal form
and why not other objects
this is so absurdly confusing
what are you serializing to? what's your target format
it doesnt matter, whats the proper way to deserialize?
it does matter
there is no one universal way of serializing an object without knowing the target format
like, how does this format work that you need to serialize custom types and objects but a built-in ArrayList isn't?
because both applications are java, but both applications dont have all the same libraries
you still need to serialize lists and maps in some form
you can't just send that through the wire like you can pass it to a method
but they are being serialized somehow to be able to be sent over the network
ah yes
you can't just send a List through a network socket lol
not to mention that the individual elements of the list/map might be custom types as well
i just did
what did you send? the list's hashcode?
ObjectOutputStream objectOutputStream = new ObjectOutputStream(socket.getOutputStream());
objectOutputStream.writeObject(new HashMap<>());
💀 object stream
?
nice
you'll still have to handle the case of ^ :3
you can provide any Serializable object to the OOS
you don't have to manually serialize anything
but ¯_(ツ)_/¯
that aside, what you asked for isn't exactly viable, not all classes in the jdk are Serializable, meaning the OOS will fail to serialize them (e.g. ByteBuffer)
:(
Not like you can't serialize them yourself
but not all objects are serializable
RegistryFriendlyByteBufs my beloved
what does that have to do with anything
idk you mentioned bytebufs
I like rollercoasters
I prefer deep fried images
metal window frames are better
Hmm maybe, but what about carrying over the bits instead?
How does the knowledge book handle custom items? As in, items with a custom model/texture which apply NBT tags to override PAPER?
I have a working custom item, with a working recipe (which shows in the knowledge book), but despite having the correct ingredients in my inventory, the recipe only shows as red. Clicking the red recipe puts all the correct items in the table -- I'm curious why this would be and if the crafting table/knowledge book is funky when it comes to custom items/recipes?
is there something that is similar to threads but isn't really threads? it's still sync but i can stop execution
my adhd ass could not be assed to read any of the context and just saw byte bufs
or delay it
line 1
line 2
line 3
line 4
line 5```
if this code was in the "thread" and i stop the "thread" execution at line 3 it wouldn't pass to line 4 or 5
and if i delay the "thread" at line 2 by 100 ms, it would take 100ms after line 3's execution to execute line 4
if that makes sense (it prob doesn't)
i also have to express my love for nms on a daily basis
Hi can someone help me? Im trying to fix a plugin for my server, the thing is not working is a unclaim system to a towny alternative.
The error is for the code lines:
`val edit = FastBlockEditSession(world)` *fastblockeditsession is highlighted red*
`val edit = FastBlockEditSession(world)` *fastblockeditsession is highlighted red*
import phonon.blockedit.FastBlockEditSession blockedit is highlighted red
is phonon some kind of library or something?
I think yes
phonon is the name of the creator
i can send you the source if you want
i compiled the plugin as it says on the guys github
can you delay a loop without delaying the whole thread
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
that won't work
?
that delays a statement
why
i want to delay the next iteration
scheduler. just write your code properly
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
not async
but u get idea
can u show what are u trying to do
and what u want to be delayed ?
something similar to skript's delay
for (ParsedElement element : parent.getElements()) loop ?
yeah
Why the itemDisplay is like this and not an item on the ground?
ItemDisplay itemDisplay = (ItemDisplay) world.spawn(item.getLocation().subtract(0, .2, 0), ItemDisplay.class, (item_display) -> {
item_display.setItemStack(item.getItemStack());
item_display.setItemDisplayTransform(ItemDisplay.ItemDisplayTransform.GROUND);
});
skript's iterating depends on the current action calling "walk" or whatever it is, so it just delays the call to "walk"
i can't tell if they're genius or i'm dumb, but i'm prob gonna do that as well
It's inside a block
i want an item on the ground, not a block
Trying to build my own cross server auction house(for learning redis). I have not yet built the cross server commutation part that actually uses redis yet but I'm looking for any tips you giys might have about ensuring that something isn't bought twice. My general setup is going to be as such
Item posted on auction house, push to mysql and redis and send a message on a pub sub channel. Then when a player tried to buy the item, I check that it's still in redis before allowing them to buy it. And then removing it. The issue sort of lies here where by another server with a player also can check if the item exists in redis before removing it and in essence, the item is able to be bought twice
Well blocks are rendered like that
You just gotta scale it down
Is there any sort of Map.remove like in java where I can get and remove in 1 op?
it's an itemDisplay not a blockDisplay tho
That way i can attempt removal and see if something was actually removed
yes
Does it have to be a hash command?
String commands have getdel
you can use
I'm not 100% set on anything yet and idk redis well which is why I'm doing this project to learn
That works ty
https://paste.md-5.net/agakijefeg.cs
actions:
- "test":
- "broadcast test1"
- "broadcast test2"
- "test":
- "broadcast test3"
- "broadcast test4"```
"test" just executes what's inside of it, TurboAction#next just calls the other next method
don't
ever
use bukkit scheduler for async
bukkit scheduler for async should only really be used when you would like to have your task executed at the time of the tick loop, just async to the thread
i think i fixed it, idfk how but it just worked after messing around with numbers
ok now it broke again lmfao
https://paste.md-5.net/nipoyetogu.cs
actions:
- "test":
- "broadcast test1"
- "broadcast test2"
- "test":
- "broadcast test3"
- "test":
- "broadcast test4"
- "broadcast test5"```
it broadcasts from test1 to test3 then spams test4 and never gets to test5
how can I get all the keys used after in a config section?
after what
for example in a myster-boxes I'd like to get all keys used
ConfigurationSection#getKeys(false)
like here 1 was used
^^
Hey,
I'm trying to implement automated tests into my plugin. Do you know any good (and up to date) framework?
Hello, is there anyone who can help me out with making custom spawners? like Pig spawners?, i know i can drop one down and put an egg on it but i cant seem to be able to pick those spawners up
If you want to store an existing spawner you can use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/BlockStateMeta.html
declaration: package: org.bukkit.inventory.meta, interface: BlockStateMeta
Hello guys, i seem to have a very common problem but i don't find any solution.
I want to have an inventory with one empty slot and the player to put an inventory into that slot. After putting the item into the slot I want to close the inventory and do something with the item. My problem is that in the InventoryClickEvent, the currentItem and also the inventory is the old version like before the action happend. So both of them are null at the point the event is called. But I just want to know which item the player put into the empty slot. Do you guys have an idea how to solve this problem ?
The event is called before the item is fully placed in to the slot
you probably want getCursor
Do note there are other ways of moving the item such as the number keys
and also draging an item causing the InventoryDragEvent
Can someone help me pls? Im trying to compile a plugin
`FAILURE: Build failed with an exception.
- What went wrong:
Could not determine the dependencies of task ':compileJava'.
Could not resolve all dependencies for configuration ':compileClasspath'.
You must have git installed and available on your PATH in order to use paperweight.`
It does tell you what to do
i have git installed
Looks like it's not on your path
how do i fix it
The installer should place it there but if it for some reason didn't
you can put it there manually
like the git installer?
Are you on Windows
yes
yes
ok
Open environmental variables for the system and find PATH
add a new entry pointing to the bin folder of your git install
what
i dont understand that
Which part
Path is a list, you'll see when you get there
hi, my sword is "losing" attributes when the item is not full health, I'm setting setAttributesModifiers(null), but if I getAttributesModifiers() before is also null
Sword full health -> (have attributes)
Sword not full health -> (lost damage attributes)
Then find Path
Is it path in sys variables or user?
It exists in both
Oh thats right
I'm trying to merge the two mechanism of combat (old school 1.7 with the new one of 1.9+)
Depends on if you want a system install or just an account install
like this
?
well not install but you get what I mean
oh wait i cant send 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
If you want to hide the modifier information
use addItemFlags
now add a new entry with the path to the bin or cmd folder of your git install
just like the other entries are
No the folder where git is installed
They are both in the same folder
no I want the info shown, the problem is that the sword is losing the attributes and doing damage like fists
ok, so C:\Program Files\Git or C:\Program Files
C:\Program Files\Git\cmd
Then you have something modifying damage
yes
ok
I'm just setting AttributesModifers to null, but it is already null
There is something else messing with damage then
same error
items won't just randomly loose their attack
Restart cmd
ok
when I set AttributesModifiers to null with no enchants and sword full life nothing happens, but setAttributesModifiers to null when it has enchantment or ir damaged the sword lose the attack damage
because I have 2 system of combats, player can toggle it with /toggle-combat
Remove the attribute modifiers you've added
I'm setting to null to reset the combat to "vanilla (1.9 cooldown)"
hm so I have to remove it by uuid? but it is already null by default
private ItemStack fixDamage(boolean attackSpeed, ItemStack itemStack)
{
if(itemStack != null && TYPE_DAMAGES.containsKey(itemStack.getType()))
{
ItemMeta meta = itemStack.getItemMeta();
meta.setAttributeModifiers
(
attackSpeed ? null : TYPE_DAMAGES.get(itemStack.getType())
);
itemStack.setItemMeta(meta);
}
return itemStack;
}
That's a bad way of doing it
As I said don't forcibly override all of the attribute modifiers
Add the ones you want
and remove them when you no longer need them
ok I 'll try it
This is a nitpick but why would attack speed be a boolean? I'd try to find a better descriptor for that variable
I mean I understand why, just feels very misleading
attackSpeed is like "newCombat"
Yeah I get that
It's just you can modify the actual attack speed attribute by a float iirc, that being said this should be called like newCombat or something
so instead of set null i will try to loop (if it is not null) and clear them all
but it is weird because in doc it says "Set all Attributes and their AttributeModifiers. To clear all custom attribute modifiers, use null. "
Do NOT remove modifiers added by someone else
is that what I want clear all CUSTOM attributes
"To set no modifiers (which will override the default modifiers), use an empty map."
didn;t paper drop CB versioning at 1.17?
You're running a 1.18.2 plugin on a 1.20.1 server
1.20.5 i believe
ah okies
also that is a question for #help-server
Ok srry
I'm having a weird problem with World#getFullTime
it is always returning the same value, 15129
Did you freeze the daylight cycle
oh lol
yes
and just to clarify, the method is basically System#currentTimeMillis but for ticks instead of milliseconds, right?
RequestCreateMap implements Request, so what is wrong with this?
PECS
PECS?
Producer Extends, Consumer Super
You're trying to put stuff in that map so it should be super
Instead of extends
Could you show the RequestCreateMap
You're most likely better of not using a wildcard in this case
I don't really see why you would want to
i need to use wildcards so that all the classes of a type are accepted, no?
That applies without the wildcard too
You sure you have the right import
yes im gonna invalidate caches now
still the same
when hovering over the requestcreatemap it even shows
so im not sure what java wants from me
try just going back to ? extends
yeah
How do i update a plugin? from 1.18.2 to 1.20.1
This question can be taken in many different directions. First of all, do you have the source code of the plugin or is the project an open source project?
yes it is open source
so if it is you can update it but you need java knowledge.
😦
i need to update it because of a NMS class that changed from 1.18.2 to 1.20.1
outdated plugin
I have never heard of phonon
his nodes plugin is for geo servers
there is an official Flagwar plugin for towny
a copy of towny with different war and territory sistem
is like
the plugin works doing small territories so you cant annex a town capturing a few chunks only
last I checked Towny is NCND so you likely will not get any help with a fork
are you turkish?
no
hm
if you want to rebuild some old projects just start with version independent project architecture. @tender shard has brilliant guide for it you should look at it!
Ok thx
?paste
I have fantasies from 1.5.2 . Smth like making hunger games plugins in 2024. it was our childhood gaming pleasures with my friends.
and you did the smart thing of stopping
I got banned...
did too many yo mama jokes?
i know many of you will not help me because it is question for help with something im making for legacy version but if you can take a look and see for yourself because i dont know what would be fix for this it should work normally console normally prints names for each server icon but it throws error anyways
even better
Actually no, I was false banned cuz moonwalk bridging had just came out and I was actually kinda good at it
so I got banned for scaffolding
lots of words I do not understand 🙂
might someone have a look ty
Teddynator
IGN: TheTeddynator
Instagram: https://www.instagram.com/theteddynator/
Twitter: https://twitter.com/TeddynatorThe
Twitch: https://www.twitch.tv/theteddynator
Music: Shermanology & GRX - Can't You See (https://www.youtube.com/watch?v=UbjVJTfugLY)
(I looped the moonwalk because I didn't get a good clip that fast and I wanted to u...
Scaffolding is a cheat that lets you just sprint + place blocks
true
Well I thought I'd explain since elgarl said they don't understand kek
it is easy to make blatant one but something that would bypass ac is quite hard
See that's the thing, I wasn't cheating so I wasn't flagging, a literal hypixel admin banned me
egh hypixel european people cant even play normally on it how much the ping sucks
Moonwalking came out like maybe 2 months after ninja bridging and was like 1.8 blocks /sec faster so I started practicing and then got decent
Brought it to hypixel and then got banned 😦
is unban purchesable ?
Made an appeal, they reviewed the clip and said it was sufficient proof that I was cheating lmao even though I never flagged watchdog so like smh
Don't think so, not on hypixel
well maybe you could download mod for writing out how fast you are going and just record POV of your hand and monitor
This ban was like 6 years ago
yikeesss
i got banned for turning my auto clicker on
would some of you care to help me a bit im in dead end situation in my code :3
i totally turned it on accidentally
The technique I was using is at 6:48
Tbf it really doesn't look legit kek
But I swear it is, I've literally done it
?paste
hypixel used to false ban a lot until they made it almost impossible to get banned by flagging an anticheat, at some point using reach of 3.4 was bannable
moderators used to false ban too and there was no way to get unbanned even if you had evidences, I literally know no situation when someone got their ban appeal accepted
I only play on my own hosted servers. I know I can;t get banned then 🙂
I believe now they almost do not ban anyone if they aren't sure or if it's not obviously blatant
sadly i was, in fact, cheating
chat i fucked up and got banned from my own server
Use the WorldCreator class
Ty
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException```
Any Idea why it does this with any dependency file I add but when I remove the plugin it works(Except I need it to remap cuz im using nms)
Like I don't get why it's checking the repos for the local files also everything was working perfectly withh 1.19.3 and rn I'm updating to 1.21.1
It isn't just item-nbt-api-plugin it's literally any plugin I try to add as a dependency
Using Java 21
update version of special source
its 2.0.3
and probably others too
I update item-nbt-api
I used it in another project
and the others are made by me
so ik they're fine
(Also I used them all in a 1.21.1 project earlier)
special source is old
Is there a newer version?
no I just said it was old for no reason
Im using 2.0.3
um, I was sure there was a newer one
I'm sorry you are upto date
in which case post your full pom and build log
?paste
alr 1s
pom.xml: https://paste.md-5.net/umuvemaqoc.xml
build log: https://paste.md-5.net/ribaxoxulu.sql
I gtg I'll be back soon if u have any questions or sum I'll answer them when Im back
So I was of the impression that redis is a cache and does not persist
But it does infact persist
That's good ig
How do i ensure my redis cache is uptodate with my actual data?
Guess I'll faafo
Best way to learn
i mean, you can try just not even letting it get out of date, what is your concern and how do you think your data will get outdated?
Yes
How can i create custom enchants in 1.21?
Do boss bars have a decent performance impact or can I just spam them? If they do, how about packet boss bars
they have basically no impact
Hey guys is there a point in making my own NPCs or should I just use Citizens API
Citizens is probably just fine for most use cases
hey guys i wanna remove dropped item when the player break block,
Player player = blockBreakEvent.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() == Material.AIR) return;
Block block = blockBreakEvent.getBlock();
block.setType(Material.AIR);
blockBreakEvent.setCancelled(true);
System.out.println("test ");
I tried this but it doesn't work well how can I cancel to drop item?
looks like theres a setDropItems method
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
set it as false?
probably yeah
if (blockBreakEvent.isDropItems()) {
Block block = blockBreakEvent.getBlock();
blockBreakEvent.setCancelled(true);
blockBreakEvent.setDropItems(false);
block.getDrops().clear();
block.setType(Material.AIR);
System.out.println("hi?");
}
it doesn't work still...
Is there a way to grab ALL passive mobs into 1 entityType
Does anyone know how I can make stacked spawners? Like is there something I can do to the blocks data
have you registered the listener
yeah
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
I already tried this :
blockDropItemEvent.setCancelled(true); blockDropItemEvent.getItems().clear();
```but sometimes it works, but sometimes it doesn't work
Is ur plugin dropping items wjen breaking bloxks?
Its most likely one of ur plugins dropping items but not calling that event while doing so
I have a message broker to link my servers and my proxy, is better to have one channel per server or one channel for proxy and one another channel for all servers ?
It totally depends on what kind of messages you want to exchange
It dépend, in the most time all servers need to get it but sometimes just 1 need to get it
Then it's better to only use one. It is way easier to manage and shouldn't have some efficiency issues
Maybe I can use one global and one per server ?
Hey guys is there any way to retrieve all color stained glass & pane?
I fixed it dropItem has existed in my another plugin lol
Easiest way is one global
When you need only one server to get it, do some logic on your message to identify the server
Get all Materials (Material#values) and filter the names containing "STAINED_GLASS"
Thank youuu i fixed it
glassList.addAll(Stream.of(Material.values())
.filter(material -> material.name().contains("STAINED_GLASS") || material.name().contains("STAINED_GLASS_PANE"))
.toList());
you can remove the unecessary material.name().contains("STAINED_GLASS_PANE") ("STAINED_GLASS_PANE" is included in "STAINED_GLASS")
And don't forget to fill this glass list only once for performance issues
got it thank you
does Player#setRespawnLocation set the spawn location even for the player's first join?
i.e. if I call it in PlayerJoinEvent (or earlier, maybe PlayerLoginEvent), will they spawn at the location I set? or do I need to teleport them?
It's not written on the doc. Might have to try it yourself
yeah i wasn't getting the info i needed from doc so asked here
ill try it out. thx
update: it doesn't
how do I do setResourcePack("http://localhost:8888/rp.zip) for whatever reason it says failed to download 1 of 1 but the pack definitely works and is fine if I host on google drive etc.
How do you get localhost working with setResourcePack(), bearing in mind I have gone into my server's docker container (pterodactyl) and I can curl the resource perfectly fine!
localhost would be the clients localhost. remember, the client always downloads it. remember to check its console if any errors occur
Ah. How would I get it to download off the servers localhost? Ad the console never displays any errors! Very annoying, I have tried adding debug statements etc.
i meant the clients console. you would need to expose that port and use the external ip
Hmmmm. Super annoying you can't just use local files, as its packaged in with my plugin. Is there any nicer ways to handling resource packs?
nope, that's the only way
since the client has to download it
it cannot be sent directly as that would exceed the packet size limit i believe?
so that's not a thing
Is the server and client on the same system?
Yeah, makes sense. Shame the server can't mandate it, I can have it set in server.properties and do it that way, but I don't like it.
No. It makes complete sense now, as @blazing ocean pointed out its done from the client not the server
- you can kick on rejection, there's an event for status change
also for the sake of your users, i would provide the hash to that method call so it actually gets updated on change / no need to redownload it every time
I could have saved a few hours just by joining this discord yesterday!
Ideally I wanted the resourcepack within the jar, that then uploads it to the server (which it does), spins up a http server and pulls it down. But if it is starting the http server on the server, the client cant grab that unless I open the port
You can make a tiny http server in your plugin to provide resource pack. You dont need to hard set in server.properties you can just send the packet instead with the url which would be ip or domain of mc server
Yeah I need to open up a port then
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#setResourcePack(java.lang.String,byte[],boolean) probably what you are looking for
declaration: package: org.bukkit.entity, interface: Player
Thank you both! Can't believe I missed client v server localhost! So silly.
Typically port 80 is not blocked unless you have a firewall settings already for the host system of the mc server
I'll probably dump it on a random point anyhow to avoid any clashes, unless there is a neat way to host the file on 80 or 443
And have it like http(s)://<myserver>/resourcepacks
Yes you can unless you already have a webserver listening on those ports
Maybe NGINX?
If you have nginx then why you need resource pack in your plugin?
i would recommend using something like javalin inside of your plugin, i host my pack servers on (mc port) - 1 or similar
This is ideal since next port higher is used for udp
Could you expand a little " host my pack servers on (mc port) - 1 or similar"
i run a web server on that port which provides the pack
If port for mc is 25565 then minus 1 which id 25564 for port
Sorry, I am VERY new to all of this 😁 Very helpful
And with that time for me to go home
essentially, i:
- compile my resourc pack
- create a zip file to /tmp
- read the bytes of that and store it in memory
- remove the file
- start a web server which then responds with those bytes
my system is a bit more complex since i am using my own resource pack compiler library but it should get the point across
It does. I will get that working later, thanks all
Anyone know
What are "stacked spawners"
like if you right click a spawner block with another spawner it adds it to the "stack", for easier placement of spawners
i mean, you could increase the amount of mobs that spawn each cycle
yeah that is something i think i would do but is there some data value i can change so that when they are broken it drops the amount in the stack
Use Persistant Datacontainer on that placed spawner. When you break that bloc just get the value and change the drops
alright thank you
@Override
public void onEnable() {
// Plugin startup logic
getServer().getPluginManager().registerEvents(new NewShit(), this);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
Bukkit.broadcastMessage("Welcome To Our Beautiful Server");
}```
what I am doing wrong? I just started going into spigot
did I register wrong class?
you cannot create a new instance of your plugin
you can just registerEvents(this, this)
for more stuff, see
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
ohh I get it now thx
this is for when you want to use your plugin in a different class
new NewShit() registers it again yeah?
yeah
@blazing ocean Got my resource pack working with your suggestions 🙂
👍
Is there a way to play the potion drink animation, as I cancel the normal consume and then do custom actions
cs.setSpawnedType(EntityType.CREEPER);```
anyone know why this doesnt work
im not familiar with spawners so if its bad lmk
^
meanwhile guice:
why tf not use an object
Should I have multiple repository patterns and combine them into a single service, or just implement the service directly?
What is multiple repository patterns
Usually you'd have multiple repositories
Repo pattern is a pattern where there will be layer that have no business logic, it's just interacting with db
And yes, u usually have multiple repos, depending on your model
How do you expect that constructor to be called
Okay that's how I have always done it
rad told me "why tf not use an object", that was my reply
Oh
I meant the @singleton
i don't get it
Any ideas on how to install ProtocolLib with Gradle on 1.21.1 on Pterodactyl
I think I need the jar on my Pterodactyl server, is there no way I can do this through my build.gradle and plugin.yml?
For other jars I just use
libraries:
- "io.javalin:javalin:6.2.0" as an example
plugin.yml can only load libraries from maven central
it doesn't work with the libraries feature, you need to compileOnly("..."), add their repo and install the plib jar
quick question how do you get a block cords like diamond_block?
you mean the name
So does this need to be done manually or can you use plugin.yml?
Material.DIAMOND_BLOCK.getKey().getKey() would be "diamond_block"
oke thanks
you do that in your gradle build script
is that in all worlds all cods?
cods?
x y z
you want to get a list of all coordinates where a certain block type is placed?
yea
@copper spade https://github.com/dmulloy2/ProtocolLib?tab=readme-ov-file#using-protocollib they have a section about gradle
or in a rotation of like 100 of a player
then you have to loop over all blocks that are within X blocks of the player, check their block type, add the matching ones to a list or set or whatever, and return it at the end
o sounds lagy XD
So I have dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
compileOnly('com.comphenix.protocol:ProtocolLib:5.1.0')
}
and repositories {
mavenCentral()
maven {
name = "Minecraft ProtocolLib"
url = "https://repo.dmulloy2.net/repository/public/"
}
it downloads fine but then on the server i get org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [ProtocolLib]. Please download and install these plugins to run 'PotionMaster'.
you can do it async with a chunk snapshot
?
well you need to install ProtocolLib
also cache it and only search on chunk load event
add the protocollib jar to your plugin directory
oke i think i got it
Yes that was what I was asking, can this not be done automatically through plugin.yml
no, you need the plib plugin too
Urgh thats a shame. I guess I could upload the jar to the plugins dir in my gradle build.
can i send basecomponent as title somehow?
you need to install the plugin on the server
nms
bruh
are you not using adventure?
yeah and if I upload the .jar in the build.gradle and send a reload confirm then this would automate that process
wdym upload it in your build.gradle?
Send a post request to the server with the jar file
ok ok ok
When making an api for my server(lets say for storing data to a database): Do i create it as a normal plugin or as some weird library thingy?
a plugin is fine
and where do i then put general api functions? like lets say to specfiy the database url idk
The database url should be provided in a config file
Don't hardcode it in to the plugin
also true, bad example. In my case its a kit api so where would i put methods like getKit(Player player)? KitManager class?
or a seperate KitAPI class for general methods
Both are fine
If you want the KitAPI class you'd usually just have it as a wrapper for the kit manager
to make other developers life easier
and the KitAPI is not the JavaPlugin child right?
Alr thank you!
How to send mob setPose packet
quick question how do i make a while a player is online like:
while (isPlayerOnline) {
}
Is there no way to send a drinking animation without mods?
texturepacks?
for what purpose
while(player.isOnline()) {
}
This will kill the server* or be unsafe and waste of resources if run in another thread
Unexpected token
Cannot resolve symbol 'player'
.
You don't have a variable called player
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
^^ suggest following some Java tutorials before starting with Spigot
yeah but skipping it won't help you
How would I do this. I already have a texture pack remapping food items to look like potions. Could I add the drinking animation to that then ?
i really don't understand why IJ only sometimes shows the parameter name
fore server?
like forced texturepack?
kotlin 🤢
No no texture pack is working but how could I make it so that the item has the drink animation?
ummm wait
I assume it’s because I do an event cancel so that stops it and then I apply stuff but obviously won’t have the animation
If it’s not possible that’s fine
It's something weird, it's called inlay hints if you wanna check settings
How to send mob setPose packet
I checked my settings, I had only some of them enabled, now I enabled all but still no change :/
It's like if the method param is the same name as a variable you pass it doesn't have it but if it's diff it does
Why do I get this error?```fix
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project untitled: Compilation failure
[ERROR] location of system modules is not set in conjunction with -source 17
[ERROR] not setting the location of system modules may lead to class files that cannot run on JDK 17
[ERROR] --release 17 is recommended instead of -source 17 -target 17 because it sets the location of system modules automatically
[ERROR]
[ERROR] -> [Help 1]
How to send mob setPose packet
Is source and target set to different versions
btw add @Language("SQL") to such strings
Now I get a empty error just a build failed
Send the entire build log
also systemPath dependencies are deprecated
You shouldn't be using them
How to send mob setPose packet
playerconn.sendPacket?
^^
connection.sendPacket pose packet
Anyways stop spamming the same question over and over again
If no one answers you improve the question with more information or open a thread
Cannot resolve method 'sendPacket' in 'ServerPlayerConnection'
What should I use then?
- Use official repo/dependency
- Download source and mvn install it or use jitpack to do it
- Use install jar to add it to your local maven repo
^ in order of what's best to do
Is mvn a command or?
Sometimes you have a certain .jar file that you need as dependency, but the author of that .jar was too lazy to properly upload it to a public repository. That’s bad, but not a problem. There are two ways to solve this, but only one proper way. The proper way: install the dependency The proper...
my current code:
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
fun onBlockPlace(event: BlockPlaceEvent) {
forEach(event.player, PlaceBlock::class) { tracked ->
if(event.itemInHand.type == tracked.quest.task.data) {
progress(tracked)
}
}
}
@Suppress("UNCHECKED_CAST")
private inline fun <reified T: Task<E>, E> forEach(player: Player, taskKClass: KClass<T>, action: (TrackedQuest<E>) -> Unit) {
questManager.getTrackedQuests(player.uniqueId).filter { it.quest.task is T }.forEach {
action(it as TrackedQuest<E>)
}
}
does anyone know if I can somehow change it so that I can call it just like this: ```kotlin
forEach<PlaceBlock>(event.player) { ... }
?
currently I have to pass the class as parameter and I'm not even using the parameter
if you dont have the Klass param, you have to call it as forEach<T> no?
i think to clean this up you can also do ```kt
getTracked().mapNotNull { it.quest.task as? T }.forEach(action)
that's what I want but I also need the cast to TrackedQuest<E>
if I specify the generic parameter for the method in <..> I have to specify both
however E should be "detected" from T, as it's a Task<E>
ah wait you have two type params
I think I could make the task class sealed
why do you even need the E?
so that I got the correct type here (e.g. Material for "BreakBlock" as T, which looks like the second screenshot:
cant you just not care and specifiy the bound as Task<*>?
im loosing my mind already
I could but I don't like that
Says I don't have mvn
you can run it from within intellij, or you download and install maven locally
It doesn't even let me extract the file from https://maven.apache.org/download.cgi
which file did you download
also as mfnalex said you can just open the project with Intellij and run install from there
I get the same response inside intelliij atleast if I use the terminal
are you on windows? then use the zip: https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.zip
otherwise the tar.gz: https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
Open the maven tab on the right
alternatively, as said, use IntelliJ, but use the "run maven goal" button
and find install
not the terminal
do you have the dependency as project, or do you only got the .jar file?
The project is on github
Jar file
clone the repository with intellij, then open it, double click on maven -> install, done
I have never used intellij so I got no idea how to clone a repo
File -> New Project -> From Version Control
then enter the github URL as olivo sent it
A simple question. If I code a plugin in 1.18.2 and I set in config a 1.21 material for an ItemStack, I'll get an error?
None say specifically install on the maven tab
Should be under lifecycle
Huh 😭
So I have to create a custom Material class?
because yes.
[ERROR] Failed to execute goal on project multiworld-api-core: Could not resolve dependencies for project com.dev7ex:multiworld-api-core:jar:1.6.5-SNAPSHOT
[ERROR] dependency: com.dev7ex:facilis-common-core:jar:1.0.5-SNAPSHOT (provided)
[ERROR] Could not find artifact com.dev7ex:facilis-common-core:jar:1.0.5-SNAPSHOT
does that project have subprojects?
API and the base plugin
Holy fuck that's quite a few subprojects
quite common for multi version modules
Never wrote those
ig they only contain at most two files
Yeah but I can't find those that say root
I wanna write some software that would generate some for you
It's probably from before his kotlin times
people are scared of the kt stdlib being that big
i'm only scared of not having access to kt stdlib
Yeah 2mb women are indeed quite big
i mean in 2024, what is 2mb
A whole 2000 kb
im wondering how its even that big, how big is javas stdlib?
You don't shade javas stdlib tho
That's what makes the difference
But it's huge
uh ye
because I'll get an error. How can I ensure compatibility of all versions?
from 1.18.2 to 1.21.1
Only set items that exist on the server version you're running
You develop against 1.18.2 API and pray it works
Otherwise I guess look at something like XMaterials
XSeries in general is pretty good for crossversion support
the plugin is in 1.18.2 not the server
oh ok, thx
wdym, its 5pm
no its 4pm
Hello! Can someone please help? I made a pickaxe with a custom enchantment that breaks 2x3 blocks when mining. I've made it so that when a player mines with this pickaxe, the blocks break naturally. However, when I do this, the pickaxe becomes unbreakable because the plugin destroys the blocks. How can I make it so that the blocks are destroyed using the player's pickaxe, so the durability also decreases?
My code: https://paste.md-5.net/ibelamoneq.java
do the breaks 1 tick later.
that will allow the event to finish and apply damage to the tool
How can i create custom enchants in 1.21?
data packs
any ideas on how to create a map reset system without copying the world
why not the copy method?
i mean if the reset is for a map created you can just save what need (chunks and not data) and use that... or copy the world and "clear" that useless data?
how so?
hey, i wanted to ask if any of you guys were able to create like a dark screen effect for players for a horror game using resource packs or anything, and if so how? i've attempted shaders which work but for clients using sodium and i assume optifine as well it won't work, and the darkness effect won't do it because it pulses in and out, and the blindness radius is just too tiny
Anyone know a way I could send data from my plgin e.g a current cooldown of ability to a mod (So i can show it on a hud)
and btw what if i wanted to have multiple arenas in one world?
Does anyone know how I can create an explosive crossbow ?
Hello! I have made a pickaxe that mines in a 3x3x2 area, but now I need to create a pickaxe that will mine in a 3x3x1 area, so it will only mine one block forward and three blocks around it. I don't understand this math. Can someone please help?
Here is my code: https://paste.md-5.net/ifidokuzid.java
You should probably study some more math
XD
Disable world saving, kick all players from the world, restore world from disk
chatGPT can help you
To be fair yes it can, I wouldn't rely on it obviously, but it has gotten a lot better at math so I've heard
None has that
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 plan on making a 1.7/1.8 pvp server but my question is should i use the 1.20 verison of spigot and only allow connections on 1.7/1.8 or develop using the 1.8 version of spigot?
Stay updated, there are really easy ways to emulate 1.8 pvp in 1.20.x ie weapon attributes iirc
?1.8
Too old! (Click the link to get the exact time)
couldn't i just not allow any 1.20 stuff but use that version of spigot for development or is that not a smart thing to do?
I mean you just get so much more stuff whether it be QOL or whatever, staying up to date would really help the development imo
why would you build against 1.20 if your actual target is 1.8?
1.8 pvp
still no reason to build against 1.20
updated versions of spigot have alot more features no?
yes
A lot more
and less support from other plugins for 1.8 / legacy verisons
yes but he is building for 1.8
MultiWorld -> Lifecycle -> Install
And if that's your only reason to be using 1.8 then just stay updated
you also need to run mvn install on "facilis-common-core", whatever that is
alternatively, run the command from my blog post through IJ
just open any maven project in IJ, then click "Execute Maven Goal" , then enter the mvn install:install-file ... command
Errors reading the pom
show a screenshot
well then delete the pom.xml or rename it
mvn install:install-file doesnt need a pom but if there is one, it shouldn't be a broken one
Weird error
where can I promote my Spigot project?
modrinth
cool
I don't like it
💀
SkullMeta
It's almost as if we were in the spigot discord
ah yes, that's exactly what I wanted as tab completion
How did the jdocs get in there kek
I accidentally did this:
acf.commandCompletions.registerAsyncCompletion("quest_ids") {
questManager.getQuests().map { Quest<*>::databaseId.toString() }
}
instea of this:
acf.commandCompletions.registerAsyncCompletion("quest_ids") {
questManager.getQuests().map { it.databaseId.toString() }
}
Wait the (Kotlin..) bit is apart of the id?
I mean I get the issue here for the databaseId descriptor but uh how did the kotlin comment get in there too?
idk, but I'll find out now
bro accidentally used {
just add another map
that'd ofc work too
that's coming from KProperty's toString
Wait so then wheres the kotlin comment held?
Which plugin's event will be executed first, the one that loaded earlier or later?
If they have the same priority
in load order, if all other things are equal
So the one that loaded later?
Thanks
not that that is behaviour that should be relied on
What other things besides priority might there be?
when the listeners are registered
I have two plugins. Both track a specific event, and both with the same priority
When loading the plugin, no?
do you nee4d one to go first?
Yes
that's what priorities are for
Got you
Don't really want to edit someone else's code
never trust a HandlerList you haven't replaced with 7 proxy classes yourself
finally my listener looks good
I did a similar one for block protection
Mine was superior though as it was Java 😉
.forEach(progress) cmon
you mean ::progress?
injecting :5head:
telling guice to throw random instances at the constructor
and then you get instances through the injector
this.questManager = injector.getInstance(QuestManager::class.java)
I think the only instance I create manually is my database provider because it requires a logger as constructor param
weird
it kinda became worse over time
or, you got better but it stayed the same
probably worse over time
AI is getting dumber
well somewhat dumber
I wouldn't be surprised if the training set is so poluted its damaging the actual output at this point
well people write code with ai, and its feeding on it
||and then you have rad who writes awful rust code||
im mainly doing systems programming lol
dont think c cares about dependency injection frameworks
so neither do i in kotlin
DI container it's just more efficient when you project is growing and you want to keep DI principals
public void withDIContaner() {
var container = Dependance.newContainer()
.registerSingleton(A.class)
.registerSingleton(B.class)
.registerSingleton(C.class)
.registerSingleton(D.class)
.build();
//Creating instance
A instance = container.find(A.class);
}
public void withoutContainer() {
//Creating instance
D d = new D();
C c = new C(d);
B b = new B(c);
A instance = new A(b);
}
now you have no clue about the data streams between components
well, it's not canceling the data streams architecture
is EntityDamageByEntity safe for all usages?
meaning, does this trigger for every entity getting damaged by another entity?
including bows and such
it should work for every case of an entity damaging an entity