#help-development
1 messages ยท Page 174 of 1
In gradle you'd need to write it from the bottom up
This means either depending on maven maven or doing all the maven publish logic yourself
Libraries will only help you for the FTP part of the thing, but not the mavne part of the thing
you can specify a maven repo by url in gradle too or does it not support the FTP protocol
by default
You still have no
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>de.geolykt.enchantments_plus.bstats</shadedPattern>
</relocation>
Poms are just a mess of arrow code
yes gradle ftw
<relocation>
<pattern>de.jeff_media.jefflib</pattern>
<shadedPattern>de.jeff_media.customdrops.libs.de.jeff_media.jefflib</shadedPattern>
</relocation>
Yes.
I wish you weren't joking ๐
im not joking
Also you have two shade plugins
All the kids in this discord suck off maven
OH you have three shade plugins
three*
yeah idk why
Likely the only users lol
You can merge all three shade blocks into one
Real chads use https://github.com/Starloader-project/slbrachyura anyways
Hi everyone i have a little question :
How i can clear the chat for only one specific player please ? Like when the player press F3+D
bro the programmatical structure is so nice
you can automate the configuration of modules
Hey, I have these items and I want to read data from them and display particles with said data.
Here's my interpretation of this data in a class: https://paste.md-5.net/ogadatotiy.java
Setting up an instance of the class is not an issue, playing the particle is: The player#spawnParticle method takes in a class that varies from particle to particle called "data", and this fluctuating class can be used to change the color, material, and motion fields of a particle.
This is probably just a simple java question, but how can I do this without writing horrible dry code with a switch statement/if statement per particle?
instead of having to copy over 52 kilobytes of XML
Spam a bunch of empty system messages
Is the only one solution ?
yes
Yes and that is the issue
gradle > maven ez, i stand with you @next stratus
that it doesnt support FTP?
Yes
If Y doesn't support X and you need X, then you can't use Y
It's as simple as that
yeah
Primary reason I am writing sl-brachyura
am i the only one wondering why the fk anyone needs ftp over some other more actual sane solution to hosting artifacts
why does the sword not show up?
for (i in amount) {
Player#sendMessage(" ") ;
}
I am too lazy and still use a normal apache http server to host my maven repository
in in amount ?
It's late lol
Works well enough, but means that you cannot use PUSH
x)
and for example i put I var to 10 it's that ?
i mean, you can use even a github repo for it at that point lol
and im sure gradle supports that
Hm?
Publish, not download
If i make :
for (i in amount) {
Player.sendMessage(" ");
}
That send how many message ?
i have come to the conclusion that BlockGrowEvent cannot be cancelled
for (int i = 0; i>20; i++) {
player.sendMessage("ur mum")
}
you can't download from a github maven repo?
publish, not download
eh idk, this stuff is beyond me, i just run a simple artifactory in docker
they want to publish
not problematic for me in either case
can any 1 help??
Sheeesh "ur mum" ๐
it can
lol
@EventHandler
public void onGrow(BlockGrowEvent e) {
System.out.println("grow");
MinigameManager minigameManager = MinigameManager.get();
ChunkMinigame cm = ((ChunkMinigame) minigameManager.getMinigameFromLocation(e.getBlock().getLocation()));
if (cm != null) {
System.out.println("grow2");
if (!cm.getModifiedBlocks().contains(e.getBlock().getLocation())) {
System.out.println("grow3, list size: " + cm.getModifiedBlocks().size());
e.setCancelled(true);
}
}
}```
[07:20:31 INFO]: [ChunkDefence] [STDOUT] grow
[07:20:31 INFO]: [ChunkDefence] [STDOUT] grow2
[07:20:31 INFO]: [ChunkDefence] [STDOUT] grow3, list size: 0```
explain this then
@next stratus can you send your build.gradle idk if you sent it already but if so it has been buried
Which?
I am currently making PVP map with different character that have different abilities. I want to change player's skin depending on his tag so you can see which characters are other players playing. Is there plugin that could help?
1.19
I mean, my friend has a maven repo right? And I wanna work out how to publish to it lol
using FTP?
just a bunch of files?
found this on gradle plugins btw
I mean, the publish command is a thing right
are you using maven-publish or publish
https://github.com/UntouchedOdin0/PrivateMines/blob/master/build.gradle#L109 I've tried with all this lol
Here is the thing little gradle fanboy: You'll need to publish it yourself
I use maven publish plugin
These plugins are merely libraries
...
no shit
................................................................................................................................................
I'm not a fan boy. And I just don't have the experience in doing it yet.
Maven kids are weird.
true
https://github.com/orbyfied/j8/blob/master/buildSrc/j8-module.gradle
maybe you can find something in here, the publishing code is at the bottom
just go old school and use plain old java ๐
no maven or gradle
Thse publishing blocks only work for sftp with password, https, http and probably a few other formats though
Cool shout, I'll try when I get 5 mins.
btw you could try to make a custom task which just uploads to ftp
My friend hosts his own repo but I just can't work out how to publish to it lol
JUST ANSWER ME THE DAMN QUESTION!!! this is not #maven-or-gradle-war
youll have to include some FTP client shit idk how
For FTP/SFTP I recommend publishing to a file:// repo and pushing it to the actual maven repo
this is #help-development
Chill..
lol
is smithing inventory an anvil or smth different
ye
You need to get patience
1.16 I believe
its an anvil?
it isnt
does the inventory open
ye
try slot index 0
the item just doesnt show up
tried
Good
?jd-s
nah its smithing
this mf said "ye" to me twice
maybe the inventory holder is fucking things up with sending data idk
What exactly do you want to set? The result (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/SmithingInventory.html#setResult(org.bukkit.inventory.ItemStack)) or somethign else?
i want to set an item in the gui
The smithing table has three slots
im guessing its similar to anvil in that 0 is the left ingredient, 1 is right ingredient, and then there's result. and you're trying to put a diamond sword in the right ingredient, which yeah is prob not gonna work
and what number is the result?
oh
it has index 2
cast to SmithingInventory
and use setResult
I'd use setResult anyways
yeah
Better be safe than sorry
hey python devs. Is there any package manager like gradle or maven for python?
a good one
SmithingInventory inv = (SmithingInventory) Bukkit.createInventory(...) or something
pip?
pip?
Anvils are nasty
alr ima try that
On paper they are semi-fine though
a smithing table has a similar layout
other than that pls
so maybe it has a similar bug?
Yes, but not the same nastiness
As long as the recepie is declared it shouldnt be an issue
one like gradle/maven where you need to create a file and list everything there
Why my code don't pass into this boucle ? ๐ค
for (int i = 0; i>10; i++) {
player.sendMessage("test");
System.out.println("DEBUG");
}
pip's requirements.txt?
it gave me classcastexeption
what the hell
wha
lol
Getting the dependencies installed is just a subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt']) after than
i want something near maven or gradle
bet you can use gradle
with some python plugin
you can use it for C++ so someone must have made smth for python
I have not heard about gradle supporting python
well, it is technically possible
its possible with a plugin
Quality is another thing after that
you could just use java ProcessBuilder to use pip through gradle too
Write in Java, C++, Python or your language of choice. Package for deployment on any platform. Go monorepo or multi-repo. And rely on Gradle's unparalleled versatility to build it all.
Okay, gradle supports python natively
interesting
i tried it with all numbers and 3 gave me an exeption... so it only doesnt register the item which should be added
Because you don't know how for loop is functioning
Is it possible to have an arraylist under a hashmap and then add to the arraylist in the hashmap?
logging.info("Making sure pip is installed...")
try: # Debian and Ubuntu require pip to be installed differently because they disable ensurepip
import distro
linuxDistro = distro.linux_distribution()
if linuxDistro[0] == "Debian" or linuxDistro[0] == "Ubuntu":
try:
subprocess.check_call(['apt', 'install', 'python3-pip', '-y'])
except subprocess.CalledProcessError:
logging.fatal("You need to be the superuser to install pip and the dependencies")
sys.exit(-4)
except ModuleNotFoundError: # If the system is not Linux, the module "distro" will not load, causing a ModuleNotFoundError exception and the normal "ensurepip" module will work
subprocess.check_call([sys.executable, '-m', 'ensurepip']) # The module ensure pip check if pip is installed and installs it if it isn't
logging.info("Pip is installed")
# Make sure that dependencies are installed
logging.info("Installing dependencies...")
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
And "just" invoking pip isn't a thing either
because 0 is < than 10
for (init; condition; op)
// is like
init;
while (condition) {
op;
}
I fixed that thank for response ๐
What do you mean there?
I know HashMaps contain a key and value, would it be possible to have an array list as the value and then interact with the list inside of the HashMap?
Something like HashMap<Object, ArrayList<Object>>?
Something like that, yeah.
That is fully possible yes
But would it be possible to get the value and interact with it?
It works like any other object
Such as adding new elements or getting different ones.
yes, its a reference so it will 'reflect' its changes in the map
So
List<Object> list = myMap.get(myKey);
list.add(new Object());
would work
Would that do what I'm looking for then?
Although you need to create the arraylist if it does not already exist
helpeh
yeah or create it when you need it with computeIfAbsent
List<?> l = map.computeIfAbsent(key, __ -> new ArrayList<>());
Thanks. ๐
can somebody help be plssss?
How do I cancel grass growing
i think this
@EventHandler
public void yourmother(BlockGrowEvent event) {
if (event.getBlock().getType() == Material.GRASS) {
event.setCancelled(true);
}
}```
@EventHandler
public void onGrow(BlockGrowEvent e) {
System.out.println("grow");
MinigameManager minigameManager = MinigameManager.get();
ChunkMinigame cm = ((ChunkMinigame) minigameManager.getMinigameFromLocation(e.getBlock().getLocation()));
if (cm != null) {
System.out.println("grow2");
if (!cm.getModifiedBlocks().contains(e.getBlock().getLocation())) {
System.out.println("grow3, list size: " + cm.getModifiedBlocks().size());
e.setCancelled(true);
}
}
}```
[07:20:31 INFO]: [ChunkDefence] [STDOUT] grow
[07:20:31 INFO]: [ChunkDefence] [STDOUT] grow2
[07:20:31 INFO]: [ChunkDefence] [STDOUT] grow3, list size: 0```
explain this then
?
read
how can i do like an "everyone but a certain player" thing
i am trying to send a RemoveEntitiesPacket and i only want one player to see the entity
filter on a for loop
or stream ig
ew no
why
rude
how is that rude
i like streams
I'm not going to go into this argument again
streams are overkill for this
streams are just repeated for loops ๐คทโโ๏ธ
if you've seen the source of them, that's literally what they do kekw
Streams are O(n) for every chain operation you do
for(Player other : Bukkit.getOnlinePlayers()) {
if(other.equals(thePlayerWhoMaySeeTheEntity)) continue;
Packet<?> packet = new Packet.......
}
cache the packet
instead of init every iteration
these peeps are highly unlikely to be compsci majors, and probably have no idea what big O notation is let alone care about time complexity kek
stream everything
I care about not doing many iterations
Let's say you stream, filter, map and collect
yes i know
owo
im with you on this, im just saying most of these ppl have no idea what you're talking about
it:
- loops through the entire set, filters
- loops through the entire set, maps
- loops through the entire set, collects
lol I don't like streams ๐ญ
they just want minecraft go brrr
You can just loop once
hey purple
yes i know
I mostly just hate most java 8 things
optionals are a fancy nullability wrapper that provides 0 value
In a bungeecord postLoginEvent, how do I get the player's version
I guess they tried redefining the standard but failed
haha truee
Functional interfaces and lambdas are nice, anything else can go home
we should all just go back to using C and having nothing provided by the stdlib
need an arraylist? ok, make it yourself
๐
wooo consumerss
Suppliers, Consumers n all are great
abcdefwhyisntthisworking
you never add to your collection
also
use block locations
i do
or block keys
h o w d o i d o t h i s
locations can have decimals
check pins
for
also it checks if the location is not in there
and it adds a block.getlocation into the list
on break or place
and the size is 0, it doesn't matter
show code
no need for math
it checks if it is not in there
only for loops
3x3 is 3 in diameter etc
@EventHandler
public void onGrow(BlockGrowEvent e) {
System.out.println("grow");
MinigameManager minigameManager = MinigameManager.get();
ChunkMinigame cm = ((ChunkMinigame) minigameManager.getMinigameFromLocation(e.getBlock().getLocation()));
if (cm != null) {
System.out.println("grow2");
if (!cm.getModifiedBlocks().contains(e.getBlock().getLocation())) {
System.out.println("grow3, list size: " + cm.getModifiedBlocks().size());
e.setCancelled(true);
}
}
}```
this
3 diameter = 1.5 radius
it says grow3
it says fuckin grow3 because the empty set doesn't contain your block
because it's e m p t y
yes
so therefore it should cancel...
it doesn't cancel
๐คฆ
fix it
???
fix it then
can we just take a moment to appreciate how terrible single letter variable names are
except for x, y, z and i
not i
you aren't doing quantum physics
I use index for i
yall are telling me how to fix everything but my problem istg
yes
๐ญ
sorry son!
because you tried being obnoxious asking for help at the worst time
@torn oyster all i can think is that perhaps there is some other plugin that is not behaving properly and is allowing it to continue even if you previously set it to cancelled
oh, maybe
so yes
yeah i tried that lol
but problem is, i can't remove plugins because i only use dependencies as plugins
i have no non-dependency plugins things
void onKill(EntityDamageEntityEvent e1) {
try {
Entity e2 = e1.getEntity();
Entity e3 = e2.getKiller();
// ...
} catch (Exception e4) {
// ...
}
}
very useful
fix it
rn
i mean, dont keep it there, but try eventpriority MONITOR. if that works then for sure something is misbehaving, you're not supposed to cancel events with MONITOR priority but...you can try it

I agree dessie
my eyes burn looking at this
i need it to be literally just everyone else
not just people who have joined the server or people who are online
what?
public void breakBlocks(Location location, int diameter) {
double offset = diameter/2d;
Vector offsetVector = new Vector(offset, offset, offset);
for(int x = 0; x <= diameter; x++) {
for(int y = 0; y <= diameter; y++) {
for(int z = 0; z <= diameter; z++) {
Location target = location.clone().add(x, y, z).subtract(offsetVector);
Block targetBlock = target.getBlock();
}
}
}
}
I hate fuckin spoon feeding, feels dirty
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
what a nice interaction
ok i'm convinced BlockGrowEvent doesn't get called for grass
probs not
if so then what is it
it's BlockSpreadEvent
what event is for grass
woo
ok epic
ty alex ily โค๏ธ
is there a block decay event
try it and see
theres a LeavesDecayEvent if you're trying to stop leaves from decaying
ok thank you
woudn't have found it there lol
pro tip, https://hub.spigotmc.org/javadocs/spigot/
search box
try stuff, like "decay" and boom there it is
package index
yes because a tree is made up of more than just a single block
the other is for blocks growing naturally
Because a pumpkin isn't a structure
so it's a structure
ok
๐ฅ
Yes ๐
For the prefix ?
ye
Its bytemap, in texturepack
oh nvm
i meant in like normal p.sendmessage()
i want to make the message gold and bold
Yes i a p.sendMessage but with a specialCharacter
ChatColor.Bold + ChatColor.Gold
I think in dev the ChatColor. is better than ยง
but it's only my review
like this? ๐คจ
ik i tried that but it didnt work
What is the error ?
wait
oh
Oh yes sorry
oh tysm!
Why not just translate color codes
also does any 1 know the answer to this?
In 1.19.2 ?
Another option is to use ChatColor.translateAlternateColorCodes()
sry i i didnt mean to send attachment
1.19
I have that under an util to shorten it a lot
I'd love to know how to do that, I hate the method name so much.
I can send it tomorrow
@serene sigil work for me in 1.19
ty ๐
thx
I might try to make my own method for it then since it's really just taking in a string value either way.
for some reason this doesnt show up
Made a colorCode method to replace translateAlternateColorCodes lol
Way nicer now.
public class Chat {
public static String style(@NotNull String text) {
return ChatColor.translateAlternateColorCodes('&', text);
}
public static List<String> style(@NotNull List<String> text) {
return text.stream().map(Chat::style).collect(Collectors.toList());
}
}
player.sendMessage(Chat.style("&6&lHello")); // Single line
player.sendMessage(Chat.style());
?
I am trying to add a storage to my plugin so when I save a variable it doesn't reset its value when the plugin is disabled and enabled (when the server stops). Anyone know some websites or anything that I can use to learn how to do this?
What store are u using?
nothing
There different types for them, you have flatfile one or databases one
I have basic spigot plugin and im looking to add a storage and learn how to put stuff in it
I need a really big storage for like hypixel skyblock type stuf
f
It depends on what you are wondering to do
Well so if you are creating a big plugin a database will be your option
No, they have their own
I mean they have their own machines
not that big yk but I just want somethign that can store a lot of variables for like stats and stuff
basically having own machines == do what their ass sings
yeah I have my own machine
yeah they most likely have their own server hardware
I have a server in my house that I run my mc server on
pretty sure hypixel uses mongodb
it runs vmware
for basically everything
Yes
why
or a custom impl of mongo
so I can create a lot of computers and run a mc server on all of em and link em together so I can get a server network
w/ bungeecord
is what im doin rn
you dont need a seperate vm per server
orby maybe they use something like firebase but based on json documents
you can run multiple servers on one computer
well then how do I get a different ip for each one
you don't need a different IP for each one
Agree
you dont need a diff ip for each
yea ig
only different port
Each sever must have a diff port not ip address
ok whatever
you have like 25565-3000 for ports you'll be fine only time you need to modularize is with minigames
in that case you can spinup with docker
no vmware will fuck your server from behind so hard trust me its so slow
use something like docker
how do I change the port of each server
anyways hypixel uses mongodb for basically everything i read it on the dev blog
mk
also wont it be confusing if I have like 10 mc servers running on 1 computer
or vm
you can remap the port using docker or just change the port in the server.properties for a static server
why
less confusing than 10 vms
docker :P
istg if you use the vmware anyways
Having some problems using a plugin as a dependancy
yeah
slow as fuck
expect like 5 tps with 4 players
Did you register the command in plugin.yml?
kotlin :(
my server I got runs vmware as a default os so I cant change anyway that easily
kotlin>>>>> java
Kotlin >
I can't help you with trashlin , but look at line 29 HackCheckMenu.kt:29
Kotlin syntax is worst than my child writting whatever
do you use a server host or do you have a physical computer
so much for null safety ๐
Chad kotlin enjoyer
looks like a null error there
physical pc you should be able to reinstall it with ubuntu
I have a physical computer
Virgin java supporter
honestly man if you use java, just switch?
and install docker, configure some ufw ports and run a server
java is going nowhere hate to break it to you guys :)
install docker on what?
ubuntu pc
whats at line 29 on your HackMenuCheck class
Oh like me hahaha, but i have something with a hgiher level. I have those old Intel Xeon servers.
if you reinstall it with ubuntu
I literally cant keep up with how much stuff is being said lol
2 servers of 16 cores, 32gb of ram and 1tb sdd each machine
damn
I'm pretty sure I am tbh which is what's confusing me
I don't know gradlew either so Ican't help you there
but if your shading it and your still getting an error ask the api dev
But those machine make my billls going from $30 what we normally consume in summer to $60-70 with the machines active
do what works for you rn and maybe upgrade later idk do what works for you
heheeha
I am the api dev
๐ข
oh lordie
That's not very nice is it mate
idk if there is like a spigot kotlin gradlew community but 99% of people here using java
lmao google
Honestly went off java when i tried out kt
i'm pretty sure like the entire point of kotlin is null safety and clearly that isn't working to well for you so far xD
It's got plenty more than that
hi @quaint mantle
Alright well
I got it working but not how I wanted
Actually
This is fine
I'm not 100% sure why I was trying to do it the other way
yk I tried kotlin once than I was like yk what I don't feel like spending hte next 50 hours of my life learning new syntax for a java reskin and went back to using java
I love how my ItemBuilders look lol
something so satisfying about this
MenuItemBuilder.builder()
.item(Items.getInstance().getAxe()))
.event((e) -> {
e.getWhoClicked().sendMessage("Hello, world!");
})
.slot(0)
.make());```
i hate that there isnt a way to return this automatically without generics
inded kotlin is engorrous for reading the syntax
imagine
.build() would look better than .make()
its overwriting a .build method
oh ok
.create()
y2k are you doing your own menu api?
nice
I'm just testing it
Shit i cannot implement the fucked authorization sever from oAuth - fucked oAuth
๐ก
GuiButton()
.click {
left = { it.whoClicked.sendMessage("Hello, world!") }
} slot 0 childOf this material Material.WOODEN_AXE
๐คข kotlin
that looks like aids
Use vanilla Java
this is 1000% less readable
how
I dont know why u use kotlin if then is compile to java ๐
is it more readable
Indeed
you guys don't have extension functions :3
does anyone know how to send the client a packet to make it look like a chest opened
java fanboys ๐
tf is that
Kotlin compiles to java ๐ค
show example
jvm is best and java was the original language for the jvm so java is best
logic
also
fun async(task: (BukkitTask) -> Unit) {
Bukkit.getScheduler().runTaskAsynchronously(HackChecker.instance, task)
}
fun sync(task: (BukkitTask) -> Unit) {
Bukkit.getScheduler().runTask(HackChecker.instance, task)
}
fun syncDelay(delay: Long, task: (BukkitTask) -> Unit) {
Bukkit.getScheduler().runTaskLater(HackChecker.instance, task, delay)
}```
async {
println("hello world")
}```
cringe static access
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Btw I started to learn kotlin like week ago, shouldn't that be inlined?
Was going to swear that
how r u supposed to know that that closure receives a task
looks like groovy
yeah it actually should
That's from an old thing
fun String.translatable() : String? {
return config.getString(this)
}```
send a block action packet
https://wiki.vg/Protocol#Block_Action
this is a neat little extension function
nonononono not the question marks
Anyone knows a decent guide for custom (pathfinder) goals with the new remapped stuff?
i can just call
"path.to.string".translatable()```
to get a string from a config
ok thags nice
Weird!! Compalta Compalta (Share share)
mmmm so focking beautiful something about builder pattern just makes me so happy to look at it
and it might clash with other functions
fuck what's that youtuber called again??? ๐ญ
the closures just look shit
they look lovely
holy shit is this schedule builder open sourced
uhh not really
syncRepeat(10) game.getEntityManagement().registerPlayer(player);*
sadge I'll remake it myself then
it's very nice to use but it internally just calls bukkit's methods lol
even better eh
69 dolar
๐
BRANDON FARRIS!!
I made this like 3 years ago
Sign up for Current using my link below!
current.com/imbrandonfarris and use code Brandon for a chance to win $500!
think imma just use a table
that's the video
I'll remake it and it'll be in my y2kcommons liib
Do u want to me help u?
you can commit if you want just make sure they are good or they won't get accepted
y2k commons
@sterile token 500$ bitcoin
I was thinking on remaking the schedulebuilder to follow a more CompletableFuture style
thenCompose(otherBuilder)
type deal
hi, i am using 1.12.2, id like to make an itemstack containing a skull with custom skin value (https://minecraft-heads.com/custom-heads/decoration/40317-redstone-chalice). does anyone know how i can do this or find a non-outdated guide? ty
That is diff
Because 1.12 itself is outdated
?
I mean if the version 1.12 is really outside of road map
Logic explains that it wont be any updated tutorial if the version itself its outdated
pretty sure my item builder supports it
you just copy the value tag
GameProfile does not exist it appears
you gotta import authlib
ah
or use spigot-parent
maven { url = "https://libraries.minecraft.net" }
sorry, what does this mean?
Are u using maven or gradle?
maven
Who do I talk to cuz I payed 2 time for the rank me up and I didn't get anything in my account so now I'm down 14 something
Rank for what King?
The 7.40 someone I for got the name
It was the hunter one
I don't care if they just give me the 14.99 rank I payed for it anyway
My name in the server is MoNsTeR6076 and I'm on the Rayquaza server
I have the proof if you need it
Well that is not this server
You must ask those server members as unfortunately it is outside of our capabilities to assist you.
go to their discord and ask
we are not that server
?whereami
I'm working on making some custom recipes, but for more flexibility I tried to create more implementations of RecipeChoice, to allow for my custom item crafting as well as different amounts of items. Attached below are those implementations. This works without error, except for when you actually try to craft. At least to my understanding, the RecipeChoice#test method is what controls whether an item is valid for the recipe, and I've modified it accordingly, to no avail. Perhaps it's an issue with the RecipeChoice#hashCode function, as I didn't really change anything about that and instead copied the ShapedRecipe version of it. If anyone could give me any insight as to why this doesn't work, then that would be great.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
(The other alternative if this doesnt work would be making a custom Crafting GUI but I'd rather stay away from that as long as possible.
you cannot extend bukkit clases
I'm not even sure how you could register a recipe like that without throw new IllegalArgumentException("Unknown recipe stack instance " + bukkit);
And just so we're all clear
lol
If you want more types of recipe choices you can always PR to Bukkit, however I'm uncertain as to what a "ComplexItem" is
Sir
And CraftBlockState
This is a Wendy's
Then fired events
What class do I have to extend in order to register CustomEntities? So they keep their pathfinders and added attributes on a server restart?
So I have to add everything again after a restart?
https://www.spigotmc.org/threads/creating-custom-entitys-with-pathfindergoals-1-11.236443/
I found this thread where they registered them by extending RegistryMaterial
is this no longer a thing?
So that means they will always lose their pathfinders and I have to re-add them?
Yeh
๐
Let me guess. In order to prevent respawning them completely I have to do it by reflection
There is probably no way to add those things to an already spawned entity (without reflection)
is there a way to make two same-material item stacks different
so .equals() doesn't work
i'm making custom items but i have to deal with taking and removing items
and whenever i do that
and add it back
it listens for two items
and when that player clicks, it runs twice
Pdc
Why not set a PDC value for it
Metadata

Nbt
is that a thing with items
?pdc
Are you checking the hands aswell?
๐คฆ
god damn it i thought it meant player data container i'm actually stupid
Chunk pdc
๐ฅน
I confirm your thoughts
Stupid question:
When doing the remapped thingy for nms...
Which jar is the correct one to publish?
<name>-<version>.jar
<name>-<version>-remapped.jar
<name>-<version>-remapped-obf.jar
?
The default one I suppose?
-remapped.jar
Im not sure
But doesnt make sense publishing the remapped obfuscated one
I thought the point is to publish the obfuscated one since Mojang does not allow to use those mappings?
Or is the point to not use their obfuscated mappings with .a() .b() etc since that's not allowed?
.ab(), .b() mojang doesnt care
I mean they care when you push their source code itself
You mean by forgetting scope provided?
No no
I mean they just care about remppaed jar
Because is they pure code in other words deobfuscated
let me use the translator so you understand better
Yeah I'm a little confused now xD
Mojang only cares when you publish their source code since it is obviously their property and they have their own rules. So when you publish a plugin with remapped you could have problems since remapped is basically their source code but deobfuscated.
Is it more clarify now?
But the -remapped has the same size as the base one. So there is no way that it contains mojangs code?
Only some method names probably
Alright, np ^^ Maybe someone else knows.
Sadly I'm never able to find the original post from md5 about the whole remapping
Any idea why it is not working? Basically everything works fine until I add a new circle (click) https://github.com/WizardlyBump17/physics-test
guys
how do i write predicate here
e instanceof LivingEntity
world.getNearbyEntities(loc, 64, 64, 64, /*e -> e instanceof LivingEntity*/).forEach(/**/);```
x -> x instanceof LivingEntity
world.getNearbyEntities(loc, 1,2,3), 64, 64, 64, x -> x instanceof LivingEntity); in full
Or did I understand the question wrong?
I thought you wanted to know how to do a predicate xD
this thing
lol
List<LivingEntity> entities = world.getNearbyEntities(location, 64, 64, 64. entity -> entity instanceof LivingEntity);
yeah i know
predicate just didn't work for some reason
then i commented and uncommented it
and it worked
idk why
probably i had e -> e ->
and erased it when commented
oh probably
do i have to cancel tasktimer in onDisable
or it's getting cancelled automatically
with plugin disable
it's automatic
atleast on a reload. I never checked what happens if you just call disablePlugin()
Oh, this makes sense then I guess- but my "ComplexItem" RecipeChoice is a recipechoice that checks for a specific NBT tag instead of a material or exact itemmeta, but it's specific to my plugin and my plugin only, so it wouldn't really be fit for Bukkit in general. I suppose at the end of the day I could also use PrepareItemCraftEvent to check it, but I wanted to see if there was a way I could implement it so that it would be in-line with Bukkit/Minecraft
I didn't get any runtime errors.. so I'm not really sure
I am writing a simple 2d collision detector. How can I detect collision between multiple objects?
.setLocation(Location location)
for direction you can setVelocity iirc
https://github.com/WizardlyBump17/physics-test my current code is like this but some bugs happen with multiple objects (add more by clicking)
Is there a way to set an nms entities yaw before spawning it? I tried .setXRot(50); but it doesn't seem to do anything.
else arrow.setVelocity(target.getLocation().toVector().subtract(arrow.getLocation().toVector()).normalize().multiply(getConfig().getDouble("arrow-speed-multiplier")));
i like that
isn't it weird how arrow doesn't have a setLocation
but has a getlocation
and teleport
wait but players do right
i swear i remember something had setlocation
yeah idk im having a stroke then ig
You are probably thinking about Location in teh move event being mutable
how would i create a Iterable<Map.Entry<K, V>>?
no
yea i realized lmao
yeah maybe
i dont think that's a thing
you could use teh methods of their BoundingBox
i just made if distance between them is less than 0.5
stop my thingy
idk if gonna work tho
public void onEnable() {
BuiltsPlugin builts = (BuiltsPlugin) getServer().getPluginManager().getPlugin("BuiltsPlugin");
if (builts == null) return;
BuiltsAPI api = builts.getApi();
WandSelection selection = api.getSelections().getSelection(uuid);
if (!selection.hasBothPos()) return;
Structure structure = api.getStructures().getStructure("hub-server");
if (structure == null) return;
api.getWorker().work(() -> structure.load(selection)).complete((event) -> getLogger().info("Structure " + event.getStructure().getName() + " has been loaded");
}
yep
Anyone have a forum for tips and tricks on improving your plugin performance?
anyone has 1.19.2 local server running
I can click 4 buttons and have one running
alr test my plugin

docker run -d --name=spigot -p 25565:25565/tcp -v ./spigot:/spigot -e ACCEPT_EULA=true qmcgaw/spigot
There would be almost no code to a homing arrow
yeah that's why it's 6.89 kb
public void setTarget(final Projectile projectile, final Location targetLoc) {
final Vector velocityVector = targetLoc.toVector().subtract(projectile.getLocation().toVector());
velocityVector.normalize().multiply(projectile.getVelocity().length());
projectile.setVelocity(velocityVector);
}```
you call that in a runnable every tick
Yeah but you just pass in the new targetLoc every tick
just stop calling when teh hit event fires
i just remove arrow from a map so it's not triggered by scheduler
yep
is that ij with eclipse format or eclipse with ecplise format
what InventoryAction is right clicking
and also shift clicking
eclipse
i'm too stupid to think
ij better
it loves moving actions to the next line
when if statement has no {}
togglable tho
i'm just too lazy
BRUUUUH
i had < 1
and tried to figure out why arrow goes random direction
added print mob arrow is aiming at
was random creeper underground
somewhere behind me
...
can you use Bukkit.unloadWorld() asynchronously?
Is there any way to find the part of my code that's causing the most lag?
I know it's my plugin that's causing the lag but I just don't know why. I can't seem to find any active tasks that could be lagging the server and it's not a memory problem as my server shows at least 2gb of ram free. But the cpu is always at high utilization
Take a heap dump.
or attach a profiler
is this project of yours something you are willing to let us see the code?
there are some things in the API that if you used enough can generate lag
however as said above if you want to do it yourself you are going to need a profiler and two different kinds possibly
Yeah sure I can do that
Not rn though cuz I am not on my computer
one to see methods being used and the other is a GC profiler
also, it could be just that you are not using optimal JVM flags for the server as well
or allocating too much ram without changing any of the JVM flags. giving java a lot of ram tends to do the opposite of improving anything unless you tweak other settings
?aikars
?aikar
?flags
Aikar's garbage collection flags: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
I used to have factions on my server it and it worked just fine until I made my own custom claiming plugin
bingo
So I don't think jvm flags are the issue
alright, well was just letting you know. Lots of people come here and they tend to think they really know java ๐
Hey so I have this code,
@EventHandler
public void onFall(EntityDamageEvent e) {
if (e.getEntity() instanceof Player p) {
if (e.getEntity().getLastDamageCause().equals(FALL)) {
int i = (int) e.getEntity().getFallDistance();
p.sendMessage(String.valueOf(i));
int max = 5;
if (i < 5) {
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 99999999, 1));
}
}
``` Which is supposed to basically get the fall distance of a player when the player takes fall damage from falling and if its greater than 5 then give them slowness, but it returns null?
I uploaded my code to github
which line exactly returns null
In console it just says cannot get object (object) equals because returns null
So the damage cause line
then lastDamageCause returns null i guess
Yes but like why does it return null
EntityDamagEevent#getCause()
Returned null for some reason
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
It returns null as well
I will try and play around with it, maybe Iโm reading the error wrong
Well ouch
Wdym I used pattern match
also don't nest if's
No really other way to do this?
@EventHandler
public void onFall(EntityDamageEvent e) {
if (!(e.getEntity() instanceof Player p)) return;
if (e.getCause() != DamageCause.FALL) return;
int i = (int) p.getFallDistance();
if (i > 5) p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 99999999, 1));
}
@Override
public void yourEventName(Event Event) {
Entity entity = event.getEntity();
if (!(Entity instanceof Player p)) return;
ect
what nuker said
tho
forgot to do it
and you are actually applying SLOW when player's fall distance is less than 5
not greater
changed that in my code
full stack trace please
Iโm not at my laptop anymore Iโll send it tomorrow hopefully but
IS there anything else I should be aware of ?
Thanks for the advice/scold on my code ๐ญ
next time use JavaDocs
But fr thank you I appreciate it man, Iโll make sure to fix those and goodnight!
for both java and spigot
I doooo
I do use javadocs
But idk still new to this whole spigot programming thing
FREE JAVA LESSONS tho
checkmybio
In dms?
yes
Gotchu thank you!
The weirdest thing is happening, when I execute a command I made in chat it says It errors.. The console is clear! I checked logs too!
any response iin chat
best bet is to add debug statements
sender.sendmessage system.out bukkit.broadcast all work
latest
dude i'm asking for help not for a lesson