#help-development
1 messages · Page 2109 of 1
ive seen some countries have phone numbes like 16 numbers long
here it's 9
What country?
🇵🇹
I don't think anything annoys me in java and oop in general more than the lack of ability to do multiple class inheritance
it's so lame
🇵🇹
Interfaces are your Friends?
no, they're a crutch for the leg I lost in the inheritance wars
what is oop and inheritance
inheritance is the name of christopher paolini's fourth book of his series by the same name and oop is the sound people make when they hit their ba- never mind
Why my mysql connection give a error Too many connections
I think you might have Too many connections
How i Fix that
well presumably lower the amount of connections to mysql
yes, im in love everytime in look into the mirror
Why my mysql connection give a error Too many connections
is there a way to continue a outer for loop from a twice nested inner one?
the fuck?
since when does that exist?
Since C got released 30 plus years ago
Are optionals redundant on #getItemMeta
Also with #getLore()?
It should only be null if item is air
never throw an NPE yourself
Yeah just use the one that throws automatically at this point..
String key : configurationSection.getKeys(false)```
Does this iterate over the keys in the order they're in the config? IE
```yml
a:3
b:7
``` -> a, then b?
yes
yaml does not promise order in the key order
two people two answers bruh
concerning that underlying is a hashmap when parsed into memory, you cannot expect order
if you need order, use a list
you mean, make a separate string list of the keys in the order to process them?
well
when i use getKeys
i see everything ordered
🤔
Still just a Map so no guaranteed order
the whole config
oh right it is a linked hash map
depressing
anyway tho, the yaml format iirc does not promise it
there is lists for exactly that purpose
use them
it's not a huge issue, but has the potential to become one, hence the quesation. I need a guarantee that certain keys get proccessed last
I mean, from the looks of it the LinkedHashMap should promise you that ?
tho again, a list would by far be the more yaml-like approach
myOrderedValues:
- key: a
value: 3
- key: b
value: 7
how the hell does that work
huh ? that is a list in yaml ?
if you read the yaml in the order the things are written you should get everything ordered
no those are just objects
yes spigot should just work with keys @golden turret you were right on the linked hash map
I am just saying that yaml in general does not
it is a nice implementation detail of spigot that you get your stuff in the order you define it in, but in the end it is a node tree
i think it does if you read them line by line
bukkit?
bukkit does not exist anymore
well
technically it does
but spigot maintains it
that is all that it is there for
who in their mind runs plain bukkit
org.BUKKIT !!!!!!!!!!!!!!!!!!
lol
bukkit still exists!
welp question answered i guess
as a base for spigot 😂
and noted that this only works in spigot
so yea, you can just do that in order
👍
(https://yaml.org/spec/1.2.2/#3221-mapping-key-order) if you want to read about the mapping key order
thanks for the detail
Hi I am new
is spigotMC good for minecraft server?
have good performance?
and no crashing server?
probably the wrong channel for this, you might want to ask in #help-server
this is for plugin development
Ok
one is the time of day, the other the general game time
e.g. what you see in your f3 like (day 34)
that the part after the W: ?
I don't think it does ?
wait does this call continue on for(loop) or no
yea i know thta but does it do continue; on the outer loop
or do i need to do this if(cont){cont=false;continue;}
it breaks out of the inner loop
why do i have that error when i try to load my plugin which uses a h2 database:
No suitable driver found for, what driver do i need, and how to add it?
for(loop) {
abc: for(otherLoop) {
break abc;
}
sout("HI")
}
It does Not continue as in continue but simply procceed as usual
hi would be printed here
h2?
yep
what driver
yep
you can shade it
pretty much ye
or create a lib management plugin
orrr
if you are in 1.18
you can declare the dependency in plugin.yml
hmm
It existed for a while
I mean, the feature still is far from fleshed out imo
it makes sense it is in preview
What would need Change there?
third party repository support
the fact that this uses maven central is also eeek
maven centrals TOS might not be too happy with it
True
as a dependency ?
Well generally, if you want others to do the same you would have to deploy it to a public maven repository
if you just need it locally, you mvn install the dependency
which installs it into your local maven repository
then you can define it as a dependency the same way you'd define any other dependeny
hey so i have this code :
if (blockType == WHEAT_SEEDS){
if (player.getGameMode() != GameMode.CREATIVE){
if (getjobs(player) == Job.FERMIER) {
if (player.getInventory().getItemInHand().getType() == DIAMOND_HOE) {
Ageable ageable = (Ageable) event.getBlock().getState().getBlockData();
if (ageable.getAge() == 7) {
event.setCancelled(true);
ItemStack givenItem = new ItemStack(WHEAT, 1);
player.getInventory().addItem(givenItem);
event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation()).setType(WHEAT);
Bukkit.getScheduler().runTaskLater(this, () -> {
ageable.setAge(7);
}, 200L);
}else{
player.sendMessage("Eh Oh Attend la !");
}
}else{
event.setCancelled(true);
onError(player);
}
} else {
event.setCancelled(true);
onError(player);
}
}
}
But when i have all of what is required (the right job, right item in hand and everything) it breaks, just goes back as before and doesnt do anything (like it doesnt give me the wheat). Anyone knows why?
(ps : onError() just send an error message)
oh yeah sorry
@EventHandler
public void onBlockBroken(BlockBreakEvent event){
so what it does is
when u break it , if u have the required things ( the right job etc) u can , if its fully grown, break it. It should give u 1 wheat, replace the fully grown seed with a new seed, and then 10 sec later make it fully grown
a) you can get the block data directly from the block, don't create a state snapshot for it
b) you have to feed back the mutated block data to the block using setBlockData iirc is the method name
yep
so after i replant it i set the blockdata?
after you setAge(7)
also event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation())
like LOL
event.getBlock() is the block you want xD
getting that blocks world, to then get the block in that world at the location of the block you already have it well not optimal 😅
OH YEAH LMAO
just making sure its the right block
Ya gotta triple check that xD
all good things are 3
Question does someone know why I can't connect to Websocket in my plugin? So I created a Websocket with webbit for my Plugin to communicate with my audio client. the Problem is I can't connect to the socket does someone know if I have todo something to get it to work?
?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.
WHEAT
WHEAT
SORRY I WAS WORKING WITH ENUMS
I don't get really any errors inside my plugin. I only get a close connection from my Client who is trying to connecting. It gives me the code 1006 and saying the socket doesn't responded in time idk why. If I'll just create a main Method(Java main Method) and try there to execute the socket it is working to connect but in the plugin not.
so probably your server's browser is not compatible
or has wrong settings
regarding timeouts
Audio client and Plugin are on the same server. Webserver software is Apache 2. When I'll try to connect from outside it is also not working.
I use webbit Idk if this is maybe not working together with a plugin but I saw it on a MC Plugin for the version 1.12 on github so I also tried to use it
is there a Chunk# method to check if its a slime chunk?
declaration: package: org.bukkit, interface: Chunk
thansk
does if(!statement) compile to the same bytecode as if(statement==false)? I'd use the second one because its more readable
k
I use ! myself, but I have on occasion missed a ! in other peoples code so I read it wrong.
hi
may be true for primitives
i prefer if(allOneOrZero(iSet) == false) over if(!allOneOrZero(iSet))
okay what the fuck is this...
log("Key 0 in structureSection.getKeys() is: "+structureSection.getKeys(false).toArray()[0]);
for(String key : structureSection.getKeys(false)){
log("Handling key "+key);
...
}
log("returnValue:"+value);
results in this output:
test
returnValue: NO_RESULT```
Can someone explain how grabbing the keys works in the log function and *doesn't* in the for loop?????
?paste help
i believe the code is short enough to post it here. Anyone here offering actual advice?
I want to know how to create inverse kinematics in java, anyone here that can help me?
doesn’t seem like it’s ever getting logged
well, to receive help you need a start/to start somewhere
if(e.getCurrentItem().getItemMeta().equals(BlocksCategory.getItemMeta())) {
categoryGui category = new categoryGui("Blocks");
player.openInventory(category.getInventory());
player.sendMessage("a");
}
this never gets run
item meta is different
what items are you checking?
you try debug what are the content for this itemmetas?
im checking if the user clicked htis item
public static ItemStack BlocksCategory = FixItemCreator.FixItemCreator("§1§lBlocks", Material.GRASS_BLOCK, 1, Collections.singletonList(""));
how do i debug the content of meta
ItemStack#isSimilar
log("Make sure the code is up-to-date; first key in structureSection is, by name, 'test'.");
log("Key 0 in structureSection.getKeys() is: "+structureSection.getKeys(false).toArray()[0]);
for(String key : structureSection.getKeys(false)){
log("Handling key "+key);
Fairly sure it gets logged deo
wait why does it work now
that damn dot... i always forget the separator urgh
how does .equals() work on arrays?
bruh thats why
see thing is
.equals on arrays has no special implementation
e.g. it defaults to Object#equals
which, is just this == other
yea
i swear to god it doesnt work im going crazy
welp custom implementation it is
does this sound about right?
static boolean equals(HashMap<?,?>[] arrayA, HashMap<?,?>[] arrayB){
if(arrayA.length!= arrayB.length) return false;
for(int i=0; i<arrayA.length; i++){
if(! arrayA[i].equals(arrayB[i])) return false;
}
}
if(e.getCurrentItem().isSimilar(BlocksCategory)) {
categoryGui category = new categoryGui("Blocks");
player.openInventory(category.getInventory());
player.sendMessage("a");
}
its not sending a
I mean that will compare the two literal objects afaik
is your player object stale? is it throwing an error before it gets to that? maybe its just not similar
welp null check time Cannot invoke "java.util.HashMap.equals(Object)" because "arrayA[i]" is null
As lynx said, Arrays.equals is probably better
no errors
the latter is most likely, what are the two itemstacks?
oh thats what you mean
the latter means the last thing in a series of things. So maybe its just not similar
I mean you have the itemstack of what they clicked, what more can you want
no i want to redirect them to another inventory if a certail itemstack is clicked
my problem is when i click the itemstack (THAT HAS THE LITTERAL SAME ITEMS) its not running
and this is the moment i realize i could check the slot the user clicked in
IT DOESNT WORK
then BlocksCategory is not a similar ItemStack or it is null
i dont think its null bcs after the null check i added a debug and it ran
also it cant be diffrent
Its one of those two, or your Listener is not running
in the inventory inv.setItem(10, BlocksCategory)
it is
Those are your only three options
i think if (e.getClickedInventory().getHolder() instanceof mainShopGui) { is returning false
not sure why
Well, you never showed any of that code so I can;t comment on it.
public void onClick(InventoryClickEvent e) {
e.getWhoClicked().sendMessage("a");
if (e.getClickedInventory() == null) { return; }
if (e.getClickedInventory().getHolder() instanceof mainShopGui) {
e.setCancelled(true);
Player player = (Player) e.getWhoClicked();
player.sendMessage("aA");
if (e.getCurrentItem() == null) { return; }
if(e.getSlot() == 10) {
categoryGui category = new categoryGui("Blocks");
player.openInventory(category.getInventory());
player.sendMessage("aB");
} else if(e.getSlot() == 11) {
categoryGui category = new categoryGui("Foods");
player.openInventory(category.getInventory());
} else if(e.getSlot() == 12) {
categoryGui category = new categoryGui("Valuables");
player.openInventory(category.getInventory());
} else if(e.getSlot() == 13) {
categoryGui category = new categoryGui("Pvp");
player.openInventory(category.getInventory());
} else if(e.getSlot() == 14) {
categoryGui category = new categoryGui("Potion");
player.openInventory(category.getInventory());
} else if(e.getSlot() == 15) {
categoryGui category = new categoryGui("Mob Drops");
player.openInventory(category.getInventory());
} else if(e.getSlot() == 16) {
categoryGui category = new categoryGui("Spawners");
player.openInventory(category.getInventory());
}
}
}
i dont think he has enough code to
lol
do you see teh aA message?
yes
wait
i havent tried this one
bcs i have to go in a minute
but
i tried the one after the null check
and it ran
Thsi line will early exit if you have an empty hand if (e.getCurrentItem() == null) { return; }
after this code it sent aA
if (e.getCurrentItem() == null) { return; }
player.sendMessage("aA");
this was the debug code i used
So not the code you just showed me.
yeah i changed it a bit
Then the only mistake you are doing is trying to open an inventory IN the InventoryClickEvent. It will not work, you have to delay it. It tells you so in teh Javadoc
where
and how
?scheduling
What algorytm use Mojang to hash skin to Texture value and Texture signature?
You might need to refer to Plugin Messaging Channels (https://wiki.vg has a link to spigots docs iirc)
Could I possibly generate those values by myself?
It's Base64
You can ping Mojang's API to get the texture and signature strings.
So I need to just take bytes from Texture image and put them into Base64 right?
You can try that I suppose, I don't actually know how Mojang is turning the textures into the 2 strings.
my goal is to generate texture by myself and put it into NPC I hope that it possible
It definitely is possible since https://mineskin.org does it. It's just a matter of figuring out how they're doing it yourself.
https://wiki.vg/Mojang_API#UUID_to_Profile_and_Skin.2FCape This might help also, defines how the signature is generated.
Thanks 🙂
Considering that it is called very early it might have something to do with bungee having some strange behaviour. Idk
whats the most efficient way to do this? I want to make a system where I can easily create and destroy a armor stand and provide an item with a model which it will display, and when the player hits a raycast is made to see if they clicked it which would do something
what amount of armorstand you assume to place?
like in the world? just around 5
basically im trying to show models for maps so you can click on them to vote for the map
packets
why packets
because he wants to detect when they click on them
and?
and if the server doesn't even know they're there thats gonna be hard
still fires packetsided
Does it? 
yup
yeah
I wouldn't go that route, definitely the API can achieve what you want to do.
but im gonna be using raycasts for a custom bounding box
sure but thats not the most efficient way
so could I use packets and just store those locations? and then do raycasts like i wanted
Sometimes it's worth trading efficiency for support and ease of use lol
for what raycasting? just check if they clicked the armorstand
if you have a custom bounding box the armorstands doesnt really matter anyways
wym
the box is apart from the armorstand just at the same location or not?
so the armorstand do nothing but visualizing that there is something you could interact with
yeah
I had done exact thing like you want to do, and only if there was about 300 armor stands in one place Client starts lagging
yeah well packets and real entities probably doesnt take much from each other in this case
would real entities be easier?
yeah its just gonna be 1 spinning model, not making anything with animations etc
at least its less afford
ye I'm my case there was needed 91 Armor stands to create one Model fully
damnnn and that doesnt cause much lag?
im new to spigot dev ive mostly done bedrock stuff and client starts lagging when theres like 30 entities lol
Bedrock is quite bad ngl
But who only has 512mb these days
I was searching and i only found for old versions
True
someone knows ? 😿
No I've disable all spigot AI for ArmorStands so It was't do any calculation and my custom Hitbox detector was working on the other threat. Lags only were on the client side for some reason
when i compile my plugin, my changes do not save, how to i fix this?
Make sure your IDE actually saved the file ?
besides that both maven and gradle should invalidate the correct caches if needed
what is your server version ?
and do you reload the plugin using a third party plugin or restart
cause i had this problem in 1.18.1 and i had to restart
are you exporting plugin from IDE to server/plugins folder?
1.12.2
yeye
your IDE?
eclipse
(how are you compiling)
maybe you can not overrite your plugin file because plugin is running in spigot
i do
i never used it but i guess you have to save something
i tried to completly get rif of any traces of my plugin from that server
i havent touched eclipse in many year
good
what do you prefer?
i only used eclipse in the beginning
how neat
-<
average spigot plugin 🤔
ill look at porting my project to this IDE
you sure? it's pretty complicated
meaning you'd probably have to look at tutorials on how to compile using maven
how do i specify
i forgot how eclipse compiles by default
specify what ?
i have no idea how eclipse compiles 😅
both mvn package or gradle build should properly invalidate caches
if you are not using a build tool, may the coding gods have mercy on you
I just copy/paste the files... it's usually easier.
alr
HA
No.
Like IntelliJ is nice and all but I cannot imagine moving 100% to it due to how my workflow behaves - that being said you will have to know how to use two IDEs considering that using kotlin with eclipse is a fool's errand
well tbh the main reasons i dont use eclipse is that the ui is broken on my screen since its so bright and im too used to not saving shit
I spam the save button subconsiously. But eclipse has an auto-save feature (though it only actives after you don't edit something for a given time)
I started coding plugins around a day ago, and was wondering how to spawn a primed tnt at players location?
world.spawnEntity(loction, EntityType.PRIMED_TNT) i presume
use a ide? I typed in world.spawn and it showed me everything
ok
im making kits and i want to get the time the player tried to execute /kit <kitname> - when the player claimed the kit and see if cooldown is >= to the kit delay, how do i get the time?
well you can use System.getMilis i guess
what does that return
dependent on how long the cd is you would need to store the last use too
how many milliseconds since january 1970
ok
after that how would I edit the entity?
But If I wanted to change fuse duration and velocity then what do I do?
cast it to TNTPrimed
Sorry I am new what does that mean, all I have so far is:
Player p = event.getPlayer();
p.getWorld().spawnEntity(p.getLocation(), EntityType.PRIMED_TNT);
it returns the Entity, cast it.
is there a better way of doing this?
I'm loading a world asynchronously then want to unload the world once it's loaded
TNTPrimed tntInstance = (TNTPrimed) p.getWorld().spawnEntity(p.getLocation(), EntityType.PRIMED_TNT);
this creates a TNTPrimed instance, World#spawnEntity returns an entity. That entity is a TNTPrimed entity, but the method returns the parent class Entity, hence why you cast it with (TNTPrimed) to get a tntInstance.
That instance you can modify for example to change how long it takes until it explodes
the loadworld function
Tysm!
nvm my thing doesn't work anyway
I was told yesterday worlds could be created async 🤔
and you've made the mistake of believing everybody here
why would you create a world async?
so it doesn't block main thread
when do you create it?
I'm making minigames
every time a new minigame starts I'll be cloning then loading a world
I think you can only load worlds async with paper. They have some weird stuff going on over there when it comes to optimizing worlds and how they load.
so it could be pretty frequent
I see
maybe those who told me they could be loaded async were thinking of paper
most of the time, doing api stuff async isnt working
no way around the loading times then
paper doesn't have asynchronous world loading either, only chunks
however, if the world has spawn chunks off, it will load very quickly because it doesn't need to load that huge area into memory
hi i have a problem
then what were the people talking to me yesterday thinking >_>
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
in terms of cloning an existing world, you might as well just do the copying of files yourself
that's what I was planning
as long as spawn chunks are off in that world, it should be pretty quick to load
vanilla behavior
Yes
especially with paper it would be beneficial to load them async, not when loading the world
?ask Hello, I'm creating a plugin and right now I'm creating the fly command. I've already created it and I've made it require a permission, but when I put the else to make it send a message to the player, it tells me else without if.
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
lol
Hello, I'm creating a plugin and right now I'm creating the fly command. I've already created it and I've made it require a permission, but when I put the else to make it send a message to the player, it tells me else without if.
?paste your code
man thinking we communicate by command here :kek:
how do I disable spawn chunks?
eciraboner, huh?
'eciraboner'
xd
lmao
i don't create the link
i wouldnt do the registering in the constructor anyways
you have two else statements
no, the other person that just shared their code
and do you think that could be an issue?
ii have this issue
i can't add another else
he tells else without if
any person to help me?
youre allowing the player to fly even when they dont have permission
there's my code
you have two elses
yes
each else needs its own if
i have two
and no clue why youre using p.isFlying() without using the returned value
logic is a bit weird
Firstly. You can’t do that they way you do. If you want to branch even further, you need an if else chain.
Secondly you might want to ?learnjava
if (player.hasPermission()) {
} else if (player.isFlying()) {
} else {
}
absolutely not
ok
fail ahha
any person can send me the corrected code please?
no
🥣
you write your own code
i already did, lol
you might want to send a message to the player if they dont have permission and do an early return true
keep-spawn-loaded in paper.yml, Jet. not sure if it's possible in spigot
I think he meant early exit.
Like exiting of the method
smh
early return
man's got an appointment to return
you haven't changed anything of importance
and yet you still have unbalanced elses
how can i fix it?
think for more than five seconds.
you usually do an early return when a condition isnt met, f.e. no permission
How do I disable the loading of the spawn chunks?
ah
found this which I'll now test
I'm not sure if that will trigger after it's already loaded them in though
the issue there is that it will load them first
which is why i was saying you need to copy the folder of a world that already has spawn chunks off and then load it
hi Elgar, long time no see
gotcha
well this is the intial creation
this is the world which will be edited when making a map
then subsequent worlds will clone that
then yeah, that's fine
exactly how you'd do it; just make sure the world is unloaded when you're copying the directory
this doesn't work
?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.
that's new.
whats new
https://paste.md-5.net/alubabojeq.java please someone point me the error
i've given you the answer, why haven't you implemented it?
The issue is the double else statements
Yes you helped me but I don't know where the error is
???
you don't have this, why do you expect it to work?
i remove the flying is not neccesary
Ah yes because the language can magically detect what you mean when you do two else branches in the same chain.
It’s a really good language. :3
if only discord had some sort of age minimum, like 13
Oh wait…
I assume that's sarcasm
Is the keeping spawn chunks in memory a runtime thing or is it a setting stored as a property of the world?
cause if it was stored as a property of the world I would have expected it not to load the chunks second time
does it make a difference if you load instead of create?
I'm new to the convo, what are you trying to do @feral socket ?
help those beyond help
hmm my cat licking me
I'll check
i implement your answer
Oh so you are trying to help
yo what's good
boo
fr
how do I load rather than create?
not creatin the files?
it shouldn't be creating the files anyway
i guess there's no specific method for it; try setting keep-spawn-loaded to false in paper.yml
I'm on spigot
that would be your first mistake
lmao
Second mistake not using Minestom :)
how hard is it to switch to paper?
just in the server folder?
Yes
no dependency changes?
Nothing needed
backwards compatible
Though Paper has some good api additions
if you're not going to publish the plugin on spigot, use the paper api
that means changing dependencies >_>
Well you don't have to
It's just that Paper's API is superior :3
Although not compatible with Spigot
So basically you'll only ever use it for private projects :p
it's different
God, why do you use the server GUI?
Imagine not using the -nogui flag
Give us some time to hardfork 😭
And then Sergei was ratelimited
lol
for adding reactions?
Well ye, Discord ratelimits reaction spam lol
cause it's there by defualt
But it's awful
and internet explorer is the default browser
Not anymore
not a fan of this
I mean like, it's useable, but nobody uses it because it ends up actually costing additional resources for no benefit
not letting me reload >_>
/reload confirm
Read the rest of the message
microsoft edge 
a
You can't actually open Explorer anymore from the start menu.
You have to track down the exe.
glad i quit windows
same
The lil help button in the top right corner of File Explorer opens Internet Explorer tho lol
Oh nvm
Now it uses Edge
I continue to not understand why anyone would use Edge
it is chromium based 🤔
I like Chromium, for the record
firefox for the win
ya gotta be brave maow
i tried to use chromium but the fonts seem to bug
I just use Ungoogled Chromium bc fuck Google lol
It does require a lil more setup than other browsers tho :p
But I like how it's not bloaty or slow
Note: Do not use Chromium's default password management, it's all plaintext shit iirc
FOR EXAMPLE:
Setting up WidevineCDM so you can watch Netflix is a pain in the ass
There's some instructions on Windows but they actually poorly explain the process
Hello everyone I tray to publish package on github with gradle but it no work
Caused by: java.lang.UnsupportedClassVersionError: com/bannasoftware/bannacore/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
how do i change the compiler to use an older runtime
You need to change your jdk path to the correct version
I created a command to give an explosion wand but whenever I execute this code I get an error message: Caused by: java.lang.IllegalArgumentException: Item cannot be null
my code: https://paste.md-5.net/icanacipoc.java
https://paste.md-5.net/pifosemido.java
https://paste.md-5.net/meviyayiru.java
That means the item you are giving is null you are abusing a static pattern don't abuse static have broomstick return itemstack
?
Bad habits like static abuse makes code buggy and not easy maintainable
Learn how to use static properly
A problem was found with the configuration of task ':publishGprPublicationToGitHubPackagesRepository' (type 'PublishToMavenRepository').
- In plugin 'org.gradle.maven-publish' type 'org.gradle.api.publish.maven.tasks.PublishToMavenRepository' property 'credentials.username' doesn't have a configured value.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
I have this problem
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/zuhowks/asilux-api")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
groupId = 'zuhowks'
artifactId = 'asiluxapi'
version = '1.0-SNAPSHOT'
from(components.java)
}
}
}
This is my publishing methode
and I store my username and my token in gralde.propertie
gpr.user=ZUHOWKS
gpr.key="my_personal_token"
gradle makes some weird errors
no np I use gradle since a moment and I love Kotlin is grate but I use too much gradle for modding
I started programing java around 18 hrs ago. So which object that is static should I change. Tbh I am really confused...
Is there a better way to do what I am doing?
Hey guys, I got a problem with PlaceholderAPI.
I made a custom name maker that shows the name into %identity_name%.
There's a command that kick the player if he want to change his name and clear relative informations from the config... The only one problem is that the PlaceHolder isn't updated after the change... Who can help me?
1.8 🥲
well my rule of thumb is: if its a function that is accessed by other classes, or your class is for some reason not instanticed in any way, make it static, otherwise, dont.
Good examples for static methods are parsers and math functions - they shouldnt be objects.
Something like setPosition should not be static and take in a Entity to modify (and isnt), but rather a function of that object, since it changes that objet. Functions like vector math, that change the vector they're applied to, arent static either.
take note that you almost always call some methods of those objects, but in most cases, you want them to be methods of that object, and not static methods
How can I check if an entity is moving? If the entity is moving, a simple boolean variable is set to true, if not, it's going to be set to false.
If it's a utility function, that doesn't use any instance-specific variables, make it static
Entity#getVelocity likes to return 0 if the entity is not in the air. Best way is to just listen to packets
otherwise you can use bkcommonlib's EntityMoveEvent
Help?
Well, Paper has an EntityMoveEvent
I think I'll take a look into that
How do you check if the entity is moving or not though?
The event only triggers when the entity moves, correct?
is there a tutorial somewhere showing how to make an entity pathfind to a specific location using nms?
i've used this type of notation a lot
ehh things change all the time
with Paper there's a Mob#getPathfinder
with NMS just cast it to EntityInsentient, look for the method that returns NavigationAbstract and call one of the a methods
It makes a lot of sense once you start factoring in multi-dimensional arrays but at first glance it will look odd
a visual example would be helpful lol
im so glad i use remapped bruh
private void makeEntityWalkTo(LivingEntity entity, Location target) {
BlockPosition blockPosition = new BlockPosition(target.getX(), target.getY(), target.getZ());
EntityInsentient insentient = (EntityInsentient) ((CraftEntity) entity).getHandle();
insentient.D().a(blockPosition, 1f);
}
done from memory, correct me if I'm wrong
again im so fucking glad i use remapped. now theres capital letters too bruh
:)
mindfuck
thank you 🙏
why do these method names make no sense
wait whats the import for EntityInsentient
wtf is .D().a()
obfuscated code so we cant 'steal' it
D() returns NavigationAbstract
all the a methods make it move somewhere
so I just call one of them
alright thanks
net.minecraft.world.entity.EntityInsentient
and is there a method to make an entity pathfind to another entity?
or do i just use the location of the other entity
a(EntityLiving)
um
will this make the entity continuously follow the other entity?
is it EntityInsentient#a or EntityInsentient#D.a
can't guarantee it will work for passive mobs but should
like if the other enttiy moves while the entity is pathfinding to it
alright
and uh one more thing
you need to call a() on a NavigationAbstract, to get it just find whatever method on EntityInsentient
how do i cancel the pathfinding
a(null) or something
for what version is that? it tells me it cant resolve the import
i did reload my maven with the spigot import
doing it for 1.18.1
?????
you need to import spigot, not spigot-api
yea
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
it did work with nms code before
something something setting 2 million blocks per tick something something
how do I make a cool down on a command?
- store System.timeMilis() on first call
- compare timing on second call
best thing is to store the uuid and the last millis they used the command
ok
i kinda fucked it up in my code :D
hey fourteen do you know why my nms isnt working?
also how do I make a luckperms permission for my command, instead of using .isOp()
nope havent really worked with nms much
. how
still..
but i do have the maven stuff like its on md_5's post
what the event for an entity picking up an item that isnt depricated
i did
and the shit wont work
its EntityPickupItemEvent
use the luckperms api?
yk what nvm on the questions
im good now
i was using a different method
chill tf out

i wasnt
wait i think luckperms uses the Player#hasPermission stuff too
I accidently used PlayerPickupItemEvent
personally i prefer vault for checking permissions
Unless i need to check something directly from luckperms like groups
tbf desc does say serious
o.O
mye
k... 💀
i find it better than the default hasPermission method(s)
they always broke for me every so often using that method
is that a libary or something
thats an interface that player implements
and there we got conclure
time to add a @HasPermission annotation now
I mean LuckPerms is nice as they have a tri state return compared to the bukkit api and vault api iirc
yeah its just people are weird and a lot might not use luck perms
ill have to look into that
luckperms was nice to get the groups prefix from
That's gotta be bots right?
no
?stash
aight they do
indeed i just woke up and decided to check that and made me think wtf
if cow.hasPermission("bukkit.ban") 🤔
cows need to donate for that permission
thats awesome wym
you too
zacken02.addAttachment(plugin, "eat", false)
now you cant longer eat >->
indeed
minecraft server but you need VIP to eat
oh ew, its cause:
Cow extends Animals
Animals extends Ageable
Ageable extends Creature
Creature extends LivingEntity
LivingEntity extends Entity
Entity extends CommandSender
CommandSender extends Permissible
So yes, a cow can have a permission
class inheritance go brrrrt
Entity implements Permissible smh
does it
okay time to ask.
I:
- Added the dependency & shading plugin https://paste.md-5.net/caturibiji.xml
- Recompiled with the flag
-remapped - Restarted my IDE
and its still not showing me the NMS imports. The only import in the project is something in .m2/repo/com/github/oshi..., and at this point i just want to know how i can get nms to work again...
i thought
Is there any ORM or api that allow to treats (tables and rows from mysql and collections and documents from mongo) into 1 thing so then using the same "parser" you can either use mongo, mysql or sqlite
you could just, write it yourself
actually
not gonna be that difficult
always fun
But i can do a base and then do it open source, so other people get interest and try to help - Maybe
hmmmy
you shouldn't really have to store anything in memory other than whatever object you are trying to put into the db
@echo basalt your import isnt working but every other import is...
renamed?
its probably because EntityInsentient is remapped
its likely under a different name
theres a website to see remapped names
i dont remember it
i know that but i also dont remember the name bruh
if i knew the link to the website, you could search that and it would show the remapped name
I know, but i was making ref that it wouldnt be optimized to use it
Because sometimes you want to use an ORM but its really lazy to every time be changing code to use either sql or Nosql
wait
does -remapped spit out mojang or spigot remappings?
mye, well you probably in code wanna make sure the rest of your database doesn't know about your io device implementation, so make an abstraction for that
mojmaps
Allright thanks for recommendation
wait how do i get the spigot maps then and what's the maven import for those?
take luckperms for instance, they have a StorageImplementation interface offering methods such as saveUser loadUser which does not expose anything about a database at all
I have been reading about orms, and find that commonly used things are Reflections, annotations and java assist
Whats your opinion?
Java assists its for working with bytecode?
and sometimes the java annot process api
yes
its pretty much bytecode manipulation
if you can, avoid it
reflection or reflections?
Because they consume lot of resources
who told you that?
I have been reading
what articles?
Like you cannot abuse over reflections
anyhow back to this
do you mean reflection or reflections
Isnt the same?¡
(first one is the api (from the java standard library), latter is a lib)
Lookups are expensive but if you're caching your reflective lookups, you're fine
Can you add fractions of enchantments
Oh ok i didnt know that
No. Levels are shorts
But i was reading about the one from java that you cannot abuse the usage
anyone how to check if a projectile has touched a block? and check if it is a specific type of block?
cannot abuse?
Also do you have the luckperms thing you mention
Yes because they can cause memory leaks problems
well
Im not sure, i just read
nah not inherently, thats the programmers fault then pretty much
Remember in just 15, so all im doing its experiment
ty
I mean you can say even a hashmap can cause a memory leak, but thats usually due to bad choice of key implementation then
So in fact i will try to make the ORM, also be greathfull if you can provide the part of database abstraction that you make reference on luckperms
sure
Oh ok
Is there a way to change block hardness?
should work on newer vers just that thread is old-ish
Thanks
no worries
I mean LuckPerms isn't perfect, but its amongst the plugins with a clean design
I think that Litebans its from the same author
no?
no
Because their database design looks the same
^ Luck would never go premium... lol
I do admit I like Litebans a lot
however, most clean designs steer towards something like that
to progress
like if it was open source I would 110% be using it fully
where every io device resource has an abstraction over it
Yes me too
it makes the code base testable and more robust
I will admit i have think to pay lot of money for a good man to decompile and deobfuscate
Alright
isnt a geo location api?
its a bytecode manipulation library with an annotation api
In object-oriented programming languages, a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depends on the language. Mixins are sometimes described as being "included" rather than "inherited".
Mixi...
ive heard bout it in forge api
oh not that pattern
but rather
yes its a library
but its heavily used in forge and fabric
Allright thanks
I like this community
Lot of people try to always help and give recommendations
https://en.wikipedia.org/wiki/Software_design_pattern :3, read that
