#help-development
1 messages ยท Page 2229 of 1
If I want to update to 3, then I need to shade it right?
you called new HeavyWeapons() somewhere in your plugin
yes
if you want it to work on older versions
alright, thanks
I want something like command whitelist
that seemed to work, thanks!
You can;t disable, but you can remove it from teh command map
okay, so I have custom gui inventory and I need to add items from yml file with custom commands (not calling the commands, but the code inside)
why i have error: Unresolved dependency: 'org.bstats:bstats-bukkit:jar:1.4' when my pom.xml is https://paste.md-5.net/zokukemefu.xml
you have to do this to one of the plufins that uses bstats
<exclusions>
<exclusion>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
</exclusion>
</exclusions>
worldguard
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
do this
bump
Thats not actually a question
that seemd to work, thx!
...how would I go about doing it?
Create your own interpreter or use itme stack serialization not that hard
um, you are pretty much asking how to write a plugin
nothing is hard for java coding
bruh
e
you doesn't seem to understand, I need to assign custom functions to event for each item, without knowing it's position, or what will it be without doing a s***ton of if statements or switches
If you ask specific question we can answer. A general how to code reading from yaml to make items in an inventory is rather broad
yes, I see how you couldn't understand, my bad
you didnt say hi to me :(
i have loading items from custom yml config, I have a gui inventory but i want to have custom function for each item without knowing what item it is, what position it has or how many of them there would be
do you mean you already load them from yaml. You create them and put them in the Inventory. You want to know how to detect when one of them is clicked inside the inventory?
package testgroup.testartifact;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public final class TestArtifact extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getLogger().info("Test");
}
@EventHandler
public void wardenDrops(EntityDeathEvent e) {
getLogger().info("Test");
if (e.getEntityType() == EntityType.WARDEN) {
e.getDrops().clear();
e.getDrops().add(new ItemStack(Material.NETHERITE_SCRAP));
}
}
}
Anyone know why this doesn't trigger on entity death?
no, I have event for that and everything, but I need custom things like teleport player to certain position or something like that
register the Listener
you need to register the listener
how, this is my first plugin
Bukkit.getPluginManager().registerEvents(this, this)
tysm!
nvm i have memory problems
You were correct, just slower ๐
@EventHandler
public void wardenDrops(EntityDeathEvent e) {
Bukkit.getPluginManager().registerEvents(this, this);
getLogger().info("Test");
if (e.getEntityType() == EntityType.WARDEN) {
e.getDrops().clear();
e.getDrops().add(new ItemStack(Material.NETHERITE_SCRAP));
}
}
So this correct?
In that case, I still have no idea what you are asking for. Code to teleport a player?
no, in onEnable
no, I'm making a menu plugin with custom items in it, but I need each item to do something else, some items will open another inventory, some will teleport, some will open party or things like this
you detect clicking on an item, then run code depending on what item was clicked https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html
and I need my code to know what to do after one of the items is clicked without making each item manually and without shitton of if statements
No one will spoonfeed you here
Figure out a way to logically interpret the itmes
are you dumb?
Check out my github
im sorry but you're no way heling saying it's spoonfeeding to a difficult question
why are y-you being rude to me? ๐๐
I have a plug8n called Arctic inventories thags a wip
It has a concept that you want
Dig through my code and figure out how I did it
Because your coding is c#
lmao its for school
#general
Shut
#general
how can I get the localised name of an Itemstack in 1.8.8?
not the display name from meta because that returns null
im talking about the name that gets translated in game if you change the language
go to the shame corner with 1.8
client side
i've seen a getLocalizedName method somewhere
shh 1,8!
watch out saying anything about 1.8 because kids here can't comprehend things made before they have been born
true
in higher api versions yes but i cant seem to find it in 1.8
Well it's also 6 years out dated and not supported by mojang
lmao
you need a complex interpreter which is not something you should be able to do considering the questions you are asking ngl
or you just make like an assigned values for each bukkit functions and stuffs
then switch to another version
I gave him my plugin which contains and interpreter if he can decipher my code he wins
its a plugin request i cant do that
the api is a bit old
or you can do sth like reflection
Then cry a little bit
i wouldnt even work for people who use 1.8 plugins
don't even reply, they will only tell you to do it in newer versions, trust me, they sent me death threats because someone asked 1.8 question and I answered
security through obscurity is bad tho
its not obscure
its very open sourced
and on my github
lmao fr
this community is dogshit
tru
I'm simply infering he won't beable to read it due to the level of complexity
ah yes
This is a lie. No one would ever send deth threats on this server. It would not be tolerated.
They may make a joke about it, but never a death threat
mods never reply, people can swear here anyhow they want and they did, right to DMs
Guys how do I update from 1.8 I've been stuck on this shitty version for 6 and a half years and I can't seem to figure out how to install a plugin
it was like 2-3 months ago
yea I can say fuck
problem?
I've been here years. Mods alwasy reply
bro chill you are targeting him lol
๐ค
well, tell them to reply to these things when they happen
Swearing is also permitted in moderation and in appropriate circumstances
tbf its funny
what are the "appropriate circumstances"?
whenever you want really as long as its not in excess
well, when its not you'll be banned. Its quite easy to tell when its appropriate ๐
guys how do I get unblocked ๐ญ I'm so sorry
I'm sure he's crying now
๐ญ
kiddos go watch spongebob and dont bully other kiddos
okay, but we shouldn't text here, that's for #general
Extremely annoying
And not helping 1.8 users and mocking them
who cares lol
so true ๐ queen
1.8 users are legend
i hate 1.9+ people asking 1.9+ questions
People use 1.8
Understand that
so, bump
Never!
Too old! (Click the link to get the exact time)
1.8 is teh devil and will be purged from society!
Too old
But the pvp is most liked
I kind of answered your question
if you dont want to use interpreter you can use reflection through storing the string of function path
like you specfiy a function path and read it throuhg reflection and invoke it
grow up and play other games than minecraft i'd say
I like 1.8 combat, but I never play 1.8
Well i should say that to 1k players online in my server
time flied by too quickly
It felt like yesterday when 1.8.8 was out
is this some kind of illusion you have?
did you purposefully create your discord account with that name
no im a deleted account apparaently
just spam your left mouse button lmao
and how is that even possible
i got so much kills by just using a tripleclick mouse
how would I go about doing that, and sorry, didn't see your first answer
Sorry i care about performance and the pvp being real and wont use ocr
thats a different story
- read a string from a config
- Interpret its values
- repeat this over a loop
And i hate people that can help about 1.8 but they are total jerks and wont
- how to get an itemstack material in 1.8 api ?
- Switch to 1.19 for some reason and stop caring about the performance, also use ocm so the pvp turns into a piece of junk
so you will have for example an item section that stores a string list of reflection strings right
using reflection is still building an interpreter in a way tho
so item 1:
-library.sth.ex.doStuff(arg)
you will start by getting the first three dot strings library.sth.ex as class c = Class.forname("library.sth.ex);
and then you get the method by c.getDeclaredMethod("doStuff");
and set it as accessible no matter what
and then just invoke it or sth
most people on hypixel just use autoclickers. saves mouse life anyway xd
its a quite a bit of long story so i cant say it given the length
thanks
but you cant avoid the part where you have to build a mini interpreter
with your own kind of syntax
what's ocr
Old combat mechanics ๐ค
note that the c.getDeclaredMethod("doStuff"); you need to pass the variable type after the doStuff
so try sticking to no arguments methods
the fuck did the r come from
1.9+ combat mechanics ๐ค
1.9+ combat mechanics = no skills required
Idk
I don't know who asked the 1.8 question but I can see the war coming up again
oh yes im gonna run for my life
help
incoming rage in t minus 3
I use linux to get fps
Jump into 1.9 ffa and start hitting crits and waiting for the cooldown
Easy killstreaks
Literally no skill
yeah exactly
its just so stupid
i can pvp with one hand
1.8 is a much more exciting way to pvp
ya know what every time i see that cooldown bar my heart aches
its just so damn ugly for aesthetics
And a way to ruin mouses
indeed
is that a good thing...?
I've been using my model o for like 3 years now and it works perfectly fine.
i also ruined my joints with jitter clicks (i bad)
and I regularly butterfly 20+cps
So people
Instead of being jerks and not helping 1.8 users
Help them if you can
minecraft 1.8: destorying your joints for nearly 7 years
Good mouse
indeed
yes 1.8 = the version before shitty microsoft took over
= og version
= best version
1.8 is old
why do you guys hate 1.8 (serious reply only)
because they are new players most likely (Most serious reply ever im so dead serious mate)
oh so they are being java racists
Probably because it's harder to be good at things like pvp, and you need relatively decent hardware (no office mice)
I forked it so it uses 16
java 8 is the best
but tbh for any other things than competitive mc, 1.9+ is better
it doesnt support async chunk loading unless its NMS was altered heavily by some fork iirc
it only uses newer java from 1.16 or 1.17 as far as I know
tbh they are just trying to come up with random features 1.9+
like they just lose the minecraft kind of feelings afterwards
No survival is being runned on it
Pvp stuff with preloaded chunks
btw, there are no replies from players who hate 1.8 because they have no serious reply ๐
oh come on
preloaded chunks does not count as async chunk loading
Because I find it very plain and boring, and the amount of bugs caused by using such old server software and trying to support newer clients deters me as a person who always uses the latest version. I don't care about the PvP, I play both types, and I would rather have newer features. 1.8 also has tons more hackers and glitches. It also hurts my hand...
Minecraft is all about survival and creative game modes, minigames are second part of this game
They are pvp with small maps mostly using swm
says you in a plugin development discord server
its better to open servers with 1.8
1.8 is for more plugin features
good point, but you're not exactly hating it, so there's that (I have the same opinion)]
nms makes it more cooler
its just few lines of codes lol
I disagree on that
Api is outdated and you gotta use nms
Nms = more fun for some reason
Hypixel does a lot of magic to have version-independent features such as glowing. But overall it's so buggy it gets super annoying, and it's absolutely infested with hackers.
doing a simple api call makes it very discouraging
If NMS is more fun, just use plain vanilla minecraft server
oh i will consider doing that dw
but plugin along with nms tampering is the best kind of combination in the world
also I always use newest client, because 1.8 has different horizontal/vertical sensitivities, and I get better FPS on latest
i get 5 fps on latest and 60 on 1.8
Also implementing boss bar in 1.8 is not a few lines of code.
just like you said
you need to move fake entity
afaik it was a few lines of code
oh damn i have memory problems
it is few lines of code on 1.9+
I think for 1.8 you have to spawn a literal wither on the client
1.9 implements bossbar support in API
They should keep competitive minigames on 1.8 and other stuff, like build battle, housing etc. on higher versions. Tbh i wonder if ppl would use a hypixel client thats quickly able to switch between 1.18 and 1.8 to accomodate players
they have a build battle 1.14, for some reason they haven't updated past that. And 1.14 is the worst version for performance lol
How to make gizmos?
This doesnt work for me:
TestCommand:
if(sender.hasPermission("tomkodebug")&& sender instanceof Player p){
Gizmo.createGizmo(p.getLocation(),p.getLocation().getDirection(), Color.BLUE,10);
p.sendMessage(ChatColor.DARK_GRAY + "Created Gizmo");
}
Gizmo:
public static void createGizmo(Location at, Vector dir, Color color,float length){
float r = color.getRed()/255;
float g = color.getGreen()/255;
float b = color.getBlue()/255;
Location curLoc = at;
for (int i = 0; i == length; i++) {
curLoc.getWorld().spawnParticle
(Particle.REDSTONE, curLoc.getX(), curLoc.getY(), curLoc.getZ(), 0, 1, 0, 1, 1);
curLoc.add(dir);
}
}
hello custom sky, grass, and dimensions
I thought cauldron colours were bedrock only
I think the reason why servers keep having multiple-version support is because no one wants to keep switching versions, but a client that automatically does that would be very handy
you can create new sky colors, grass colour, and water colours
on 1.16+
how?
I know, I never knew cauldrons changed colour though.
custom chat RGB support on 1.16
you need to create a new biome inside nms
custom font support, not overriding other fonts
As how the notchian client is currently programmed, a runtime version switch would be bound to bugs or memory leaks probably but yeah thatโd be really nice
Sounds hacky
I did know about that but didnt find any way to use it
As of the time of writing, multiconnect is the only mod which fixes 1.12 swimming mechanics, parkour differences, and re-adds removed features such as command syntax on the client.
since 1.13+ you can add custom model data to items
which allows you to create custom items
with resource packs
easier than ever
there are plenty of reasons why 1.8 should be ditched
the only thing that keeps 1.8 running is pvp
fax
bump
Well Mojang was making combat snapshots but it seems to have died.
what how
wdym of 1.16+
1.16.5 supports that ?
define doesnt work
Yes
have you tried debug statements etc
doesnt spawn anything
Is there a difference between 1.8 and setting attackspeed to instant and implementing some sort of blocking mechanic with plugins ?
yes. lots of properties actually
@mortal hare how is that done the color thing
not shields, the plugin detects when you hold down right click and handles damage and kb acordingly
i tried souting out current location in the for loop
but nothing..
by sending proper packet to player or by implementing biome class and applying it to chunk inside NMS
1.9+ has a tiny but more of jump height, but it's negligeable in pvp
and how will you slow down the client movement?
the trees can also be colored ? @mortal hare
is there a guide for that
grass, vines, water, sky color
oh.... yeah
slimy water
for sky color you can send a packet: https://www.spigotmc.org/threads/sky-fog-color-packet.456700/
for some reason spruce, or was it birch, cant...
in nms remapped BiomeBase is Biome
via : https://nms.screamingsandals.org/1.18.1/net/minecraft/world/level/biome/Biome.html
BiomeSpecialEffects in Mojang's mappings
is the class which you would want to apply to a biome
what about water and trees
in order to change
everything is in BiomeSpecialEffects class
including fiolage colour
you can even set the ambient music through there
Is there some tutorial for custom sky with NMS Remapped? @mortal hare
not sure
by this method
spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra)
so you will be doing
spawnParticle(particle.REDSTONE,curLoc.getX(), curLoc.getY(),curLoc.getZ(),0,r,g,b,1);
yeye ikr
๐คฎ
if you know then why ask
im not sure, google it
you didnt pass the rgb parameters in bro i thought you didnt know what they do
try removing the p in sender instanceof Player p mate
not found
in java 16 this is right
Java 16
It saves some lines of code
auto casting
oh im so off the trend
its same as doing ```java
if(sender instanceof Player)
Player p = (Player) sender;
im still stuck in 6 years ago
people giving their variables a one letter name ๐
holy shet
if (entity instanceof Player player) {
player.sendMessage("Hello!");
}
vs
if (entity instanceof Player) {
((Player)entity).sendMessage("Hello!");
}
i bet you can send message to an entity too
but i dont care
you can also use lambda expression in switch cases
return switch owo
at.spawnParticle(Particle.REDSTONE, curLoc.getX(), curLoc.getY(), curLoc.getZ(), 0, 0.001, 1, 0, 1);
give it data
damn bro u are as usefull as bean in middle of the ocean
ik
lol
why havent i thought of that yet
hire me google
loc2.getWorld().spawnParticle(Particle.REDSTONE, loc2, 1, new Particle.DustOptions(Color.fromBGR(red, green, blue), 1));
i was just looking at same post ๐
thjx
I am as useful as water in sea
thank me
oh thx for thanking me be oxygen in air
dw
Guys call 911 i just murdered the chat
pls its bleeding
so I have particle spawning ( finnaly )
But can't get it to make a line
Location curLoc = at.getLocation();
at.spawnParticle(Particle.REDSTONE, curLoc, 5, new Particle.DustOptions(Color.fromRGB(r, g, b), 1));
for (int i = 0; i == length; i++) {
at.spawnParticle(Particle.REDSTONE, curLoc, 5, new Particle.DustOptions(Color.fromRGB(r, g, b), 1));
curLoc.add(dir.multiply(3));
}
It just spawns a few particles on same position
nope
what is dir?
a vector
I can see that, where is it from
from the server
Be obtuse. but that code will not work as you are modifying the curLoc and the dir vector every loop
two particles and its out of range
im quite obtuse after some brain burning by cpp
yep cpp will do that
that is the only meaning of it
since i want to create a line from particles
where are you getting dir from?
player.getLocation().getDirection();
so what should i do instead?
curLoc.add(dir.multiply(3)) is adding the vector to curloc and multiplying it every loop
curloc.add(dir)
will only update curLoc
if dir is a Player Location#getdirection it is a unit vector so no need to normalize
nor multiply as its a length of 1, so one block in teh direction the player is facing
Location curLoc = at.getLocation();
for (int i = 0; i <= length; i++) {
at.spawnParticle(Particle.REDSTONE, curLoc, 5, new Particle.DustOptions(Color.fromRGB(r, g, b), 1));
curLoc.add(dir);
}```
thats what i made rn
and still doesnt make a line
i think you need more complex stuffs than that
do you get a single particle?
5 at one loc
ok
to test it if its in pixels
a Vector of 1 in any axis is 1 block
how?
try googling
not near PC rn
same
maybe ngrok for debugging
try making the connect values modify-able using config
And try setting it to ngrok?
that's my idea
I want to make something like command whitelist, not visible commands for players without permission
just add a permission to a command and it will show up as red when they try to type it?
what method do I need to have for reload a file.yml?
load it back to the fileconfig?
But when they write / and press tab they will still see the commands
commands:
test:
permission: salut
permission-message: No permission``` you can put this into plugin.yml
I want to disable access for minecraft: and other plugins commands
so no /version, /plugins etc
I have a custom configuration like not config.yml, it is created and loaded successfully, but i want to reload it when I type a command, my class is: https://paste.md-5.net/yumewuzoqa.java
do u use a custom plugin for scoreboard?
what plugin do you use for ranks?
i guess YamlConfiguration.loadConfiguration which loads the file
I tried:
public void reloadFiles() {
settingsC = YamlConfiguration.loadConfiguration(settings);
}``` but it does not work
wdym custom
uhh
what kind of ranks do you have
if you use luckperms, you need to load PlaceholderApi plugin to your server: https://www.spigotmc.org/resources/placeholderapi.6245/ and you can add a placeholder into your scoreboard plugin's configution file like: %luckperms_prefix%, also you need to download the placeholder with /papi ecloud download LuckPerms.
@viral hazel
Scanner city = new Scanner(System.in);
String cityResult = city.next().trim();```
Is that the best/most efficient way of getting user input?
i hope you know that only works for console and in the worst way imaginable
well im only using console for now
i started like 3 days ago
whats a better way of doing it then
declaration: package: org.bukkit.conversations, interface: Conversable
if you want to use in game, you can use AsyncPlayerChatEvent listener
actually it is
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
+mess
whats the difference between nextLine and next
coz i just used next
pretty sure next returns a char or escape code
next just gets the next one character i believe
or it collects until a \0 aka null char is reached
oh ye it shows only the 1st word of the string
you use .next().trim
i removed the trim and it still just shows the 1st word
i think trimming removes the space at the start if i decided to put like 10 spaces
my plugin config doesn't seem to be reloading, what's the cause of this?
if(cmd.getName().equalsIgnoreCase("hvwreload")) {
this.reloadConfig();
sender.sendMessage(ChatColor.GREEN + "HeavyWeapons reloaded successfully");
return true;
}
return false;
}```
i have the same problem
try calling saveConfig(). right after reloading
like this?
if(cmd.getName().equalsIgnoreCase("hvwreload")) {
this.reloadConfig();
this.saveConfig();
sender.sendMessage(ChatColor.GREEN + "HeavyWeapons reloaded successfully");
return true;
}
return false;
}```
yep
aight lemme try
i got an error where i get a stackoverflow: null error but i cant seem to find the problem, i tried debugging and its somewhere in the class im gonna send, not outside of it
error:
just ask away
?paste the full error
when i try to use a library in my plugin, i get noclassdeffounderror exception
shade it i guess
SpawnEntity.java:63
yea pretty sure
You are spawning an Entity, which is triggering yoru onSpawn event, which is spawning an entity
kotlin has like toJava stuff
ooh damn im dumb
thank u
lemme try to shade again
aight i got it
i had to enable java parameters in kotlin compiler
is there a list of everything that you can do outside of the main thread (ie utilizing the like 30 extra cores modern cpus have) to reduce performance impact?
list?
like everything you can do off the main thread
oh nope
I mean there are designs where methods are annotated with sth that denotes thread safety
but those arent perfect
i see
what im trying to do is to have as little load as possible on the actual server
but offloading stuff to other threads especially data stuff is hard
what are you making?
it's actually not
depends
what are you after, concurrency or parallelism?
okay so you want high throughput in other words?
Whatโs the difference?
think parallelism uses other cores, concurrency does not
generally concurrency means when two tasks are done seemingly concurrent, but in reality not
parellelism denotes where two tasks are actually done at the same time
when we talk about concurrency the measurement is throughput
when we talk about parallelism latecy is the measurement
Ah. Gotcha.
essentially yes. Ideally I'd find some way to split the server into three and have one dimension per thread, but iirc thats not really possible unless you do some serious black magic with nms
u can with minestom
java kinda sucks when it comes to high throughput as we only have platform threads (since cheap virtual threads are gonna release with java 19)
wait then how do threads get distributed over cores?
implementation detail
java threads being mapped to os threads?
my crapppy computer has four cores and my server fourty, one at ninety percent and all others at zero
still pretty top level but, gets you the basic mapping between carrier and virtual thread
hence the question
anyway moterius, as of now the best "way" to handle throughput is through an executor service such as ForkJoinPool
can you guys tell me how to add a rank to my scoreboard so they can see what rank they have
does concurrency really just happen on one core?
๐ค
just google how to create a scoreboard
imagine...
well, when two tasks run concurrently we usually mean they run on the same core, its just that the code does not run linearly, which often means the program will execute a little bit of task A, then task B then back to task A etc, seemingly at the same time but in reality not
your 16th chrome tab ?
aha cpu gone ๐
RIP
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes?
not you
and u can use PlaceholderApi to use Luckperms's placeholders
hm i didnt know that, it makes sense now thinking abt it
yeah
wait a moment, is concurrency happening on the same core? Do pools work around this issue?
also on that note, does new Runnable get ran by a different core in the first place?
as opposed to when to two tasks run in parallel, it means they might actually be running at the same time
no
how do u tell java which to do?
java's thread pools and threads abstract away the need to even manage the coordination of execution
is that java skript?
like two threads might be running on different cores, or they might not
just java
wait what I'm confused
so creating a new thread can sometimes lead to you getting parallelism and sometimes concurrency?
and Moterius, runnable is just an interface for a single abstract method
it doesnt know about where it might run
that is chosen by the jvm
or well, to some extent yourself
yup
wouldn't it be chosen by the OS ๐ค
so do you really have a choice over parallelism or concurrency?
doesnt the jvm distribute it at all?
jvm wrestles with the os, winner picks the thread
i once read a book about the inner workings of an os and i got halfway ๐ค ๐ฅบ ๐
NERDS
Could you get full control over the execution order? Or at least some level of control over it?
yes
I mean JVM doesn't schedule anything threads rn
that is the point of loom
so I'd expect all thread scheduling to be done by the OS
ah okay
yes, but with loom we'll get a structured concurrency api so you'll have even better control :3
Noice
so it schedules stuff as it thinks best, but I know that thread-zero and thread-one are the most heavy loads. Can i somehow guarantee that it wont be ran on the core those two run?
altho as of now, joining tasks is the big thing right
if I wanted to 'throw' a player into a random location, I would just set his velocity right?
and then we have stuff like semaphores and other concurrent utility classes
If it fits your needs you can always use thread safe events when needed and ensure order execution on the main thread
yup sadly
@smoky oak might wanna look at that ^^
yea
what i need to do as well is run some tests if using extra threads costs more time on initialization than it saves in performance
performance as in speed, or just being able to handle high throughput?
wondering this because applying xyz 0.1 velocity is apparently shooting the player like 100 blocks into the sky
?paste ur code
first one. I'd like to have as fast performance as possible. In my experience most software always goes up against the clock speed, not the core number. Like, my server has fourty cores, only one being used
yes setting velocity can throw a player
yeah, just remember thread safety
luckily the stuff i work on really doesnt comes much into contact with that
think about rust which doesnt allow passing non thread safe stuff to another thread ๐
well thread un-safety becomes apparent when applications use multiple cores
well im not exactly using spigot im using an api thats based off bukkit but my code is more or less java Player player = ... Vector vec = new Vector(player.getLocation().getBlockX() + 0.1, player.getLocation().getBlockY()+0.1, player.getLocation().getBlockZ()+0.1); player.setVelocity(vec);
its more so the memory that gets compromised with threads
cuz ur using their location
dont use their location
๐ค so just 0.1?
yes
simultanous read / write operations are the main issue
if they're at 1000, 100, 1000
oh shit lol that probably explains it ty
pfff 1000.1 velocity i see the mistake now ๐
yeah
I assumed if I set it to anything lower than their location it would shoot them down but I guess thats just negative velocity
well, dealing with thread safety efficiently is, I mean if you really wanna be cheap just use some re entrant locks for everything that might be shared across threads
I'm aware of that. I thought along the lines of passing slow computations to extra cores, then pass the result back into the the main thread using some kind of pool or interface.
where are u trying to shoot them?
direction they're looking?
copy explosion kb code
u can do this with completablefutures
got a blog or example?
what ๐
damn this is a lot of maths
urgh generics
yh
here I was gonna just pick any random 3 numbers lol
well completable futures are at most an abstraction Id say
like it depends on the executor you supply given instance with
- callbacks
and the locks?
synchronized technically
hmy yea
public class TwoSums {
private int sum1 = 0;
private int sum2 = 0;
private Integer sum1Lock = new Integer(1);
private Integer sum2Lock = new Integer(2);
public void add(int val1, int val2){
synchronized(this.sum1Lock){
this.sum1 += val1;
}
synchronized(this.sum2Lock){
this.sum2 += val2;
}
}
}
Incredible
pls no
i should learn that stuff
since 2 diff locks are being used, does that mean that if add is called, and sum1 is locked, can sum2 be executed?
AtomicInteger
i'm reading up on concurrency
oh
and this was an example
they did say to use atomic integer but to explain the concept
public class TwoSums {
private int sum1 = 0;
private int sum2 = 0;
public void add(int val1, int val2){
synchronized(this){
this.sum1 += val1;
this.sum2 += val2;
}
}
}
yes that makes more sense
altho thats also to some extent an anti pattern
usually wanna do
Object lock = this;
//then
synchronized (lock)
(since it becomes more apparent what the intent is)
my question is if add is called, and the first sum is locked, does it do sum2 and then wait for sum1?
or is the order of the method preserved?
well the first sum nor the second sum are locked
the instance itself is being locked
in this ex?
kotlin
what if i had code inbetween the 2 synchronised blocks
when does it execute sum1
and the code between blocks
the question is very vague
like are we talking about when you invoke this method concurrently on 2 different threads?
yes u invoke add() with 2 synchronised blocks on 2 diff threads
okay, so only one thread can run
this.sum1 += val1;
at the time
same goes for
this.sum2 += val2;
but code in between might run concurrently
ahh ok i understand
I'm still not sure why you would synchronize those. The memory is private so each instance of your function makes its own memory space then tosses it to the garbage collector. That function will never be unsafe. It would if the memory was public and another thread tried to fiddle with one of the variables
wat
like I get that you made it thread safe, but it probably already was
the sum2 and sum1 variable can be manipulated concurrently
it's modifying a class variable?
its a get add update
+= is literally one instruction
literally not
i always thought it was
it has to get the value from var has to add val to it again, and store the sum back to var
more than one instruction
thought all operators got condensed to one instruction...
nah
doesnt work like that
thats just for faster typing
a += 5;
//a = a + 5;
loadconst 5
load a
add
storevar a
it still has to load it into a register, add, and put it back
sugar
so it wouldnt matter
what assembler language is that
bytecode but readable
its from my vm
yooooo
it on github
huh
i want to make vm too but makefiles are a pain
i dont know rust
i havent even added an add instruction
use rust
K
but rust is good
/**
* Combines the given arrays into a new array
*/
public static <T> T[] combine(final T[]... array) {
int totalSize = 0;
for(T[] part : array) {
totalSize += part.length;
}
T[] combined = (T[]) Array.newInstance(array.getClass().getComponentType(), totalSize);
int index = 0;
for(T[] part : array) {
for(T element : part) {
combined[index++] = element;
}
}
return combined;
}
can anyone think of an easier way to do this?
what does it do
combines different arrays
you could use System.arraycopy(...)for speed
^
e.g. [1,2] and [2,3] will become [1,2,2,3]
yes but that'd require math and I'm not in the mood to do math right now lol
but yeah
i'd just stream, turn into list, then collect as one?
nah then I'd rather do it like this
look up the langlands program and what built the first bridge
lol
hm not sure whether this would work
public static <T> T[] combine(final T[]... array) {
int totalSize = 0;
for(T[] part : array) {
totalSize += part.length;
}
T[] combined = (T[]) Array.newInstance(array.getClass().getComponentType(), totalSize);
int index = 0;
for(T[] part : array) {
System.arraycopy(part,0,combined,index,part.length);
index += part.length;
}
return combined;
}
let's see
public static <T> T[] combine(final T[]... arrs) {
int size = 0;
for (T[] arr : arrs)
size += arr.length;
T[] out = Array.newInstance(array.getClass().getComponentType(), size);
int i = 0;
for (T[] arr : arrs) {
System.arraycopy(arr, 0, out, i, arr.length);
i += arr.length;
}
return out;
}
why not use my method?
also
that is pretty damn slow
System.arraycopy is way faster than streams
yeah
ik but time complexity
native stuff kek
i dont think you can get it any faster than looping for the arrays and then doing arraycopy
yeah
kk
that's basically the same as the second code I sent, right?
ok then I'll try it out
i think
it;s the same
works perfectly lmao
?
idk
it looks like youre trying to combine a String[] with a String[][]
im pretty sure [L; means array of objs
Canu pastethose arrays
@tender shard your reflected array instance is usign the type of the input array of arrays to create a new one
its included in the spigot jar..
Array.newInstance(array.getClass().getComponentType(), size);
it was announced that it's going to be removed though
Why the fuck
you need to get the component type of the component type
oh yeah and array is T[][]
yeah
lmao
Does anyone know how to create custom Biomes in NMS Remapped?
My Current Code:
Server server = Bukkit.getServer();
CraftServer craftserver = (CraftServer)server;
DedicatedServer dedicatedserver = craftserver.getServer();
ResourceKey<Biome> newKey = ResourceKey.create(Registry.BIOME, new ResourceLocation("pirates", "darkwaters"));
Error:
yep that works
replacing getComponentType() with getCOmponentType().getComponentType() fixes it
aight
thx everyone
you need to provide a resource key as first parameter too
idk why
but thats the error
man i hate myself
I spent 8 hours trying to find a bug
why my itemstacks are gone
after closing down inventory
to find out the problem wasnt in NMS but in my Inventory debug code
i created new Inventory everytime
i opened
Maybe fixed it
I was using bukkit Registry instead of Mojang Registry
You are walking down into the heart of a mountain. In it, you are told, is the one you've come to see. Welcome to
the hall...of the Mountain King.
(Please...Don't mention the Nightmare Before Christmas.)
Is there any event that is called when effect is applied to the player?
How to get WritableRegistry from dedicated server?
@mortal hare you mentioned before custom biomes
Have you tried making one yourself?
If so, could I ask some questions?
I actually tried once but I moved on to another project so I haven't finished it
but as I already told you there is a class BiomeSpecialEffects
are you using mojang's mappings?
yep
otherwise I would be using this tutorial:
https://www.spigotmc.org/threads/how-to-create-custom-biomes.512105/
BiomeSpecialEffects class represents all the colors for your biome
BiomeSpecialEffects.Builder class allows you to easily build your own BiomeSpecialEffects class
so I can change colors of everything using that
yes
but you need to apply to the biome
you can build your own biome using Biome.builder class too
in which you can specify your built BiomeSpecialEffects class
BiomeSpecialEffect.Builder#fogColor requires int
should it be hex?
oh right
for example 0xFFFFFF
btw how did you did that black overlay over that?
ik about 3x` but that puts it into seperate line
I mean this
i have a question about nms, i want to start working with it but obviously it's normally obfuscated and harder to work with. i now have the mojang mappings, but they don't seem to match what is commonly used online. like where someone is saying to use CraftPlayer#getHandle().playerConnection.networkManager.channel.pipeline() i instead have to use CraftPlayer#getHandle().connection.connection.channel.pipeline() which is the only thing it recognizes
how can i get it to use the more common mappings
and instead of PacketPlayIn.. and PacketPlayOut.. i get Clientbound.. and Serverbound..
i can't find any methods usable under Biome
how do you check if a block if waterlogged in NMS
get blockdata
or `one`
how do I get blockdata
declaration: package: org.bukkit.block.data, interface: Waterlogged
do you mean blockstate?
Block.getBlockData
he's asking in nms
why do you want to use nms for this anyway
why are u using nms for waterlogged?
Biome contains only #getKey() which isn't helpfull for appying BiomeSpecialEffects
it's in my horse's custom pathfinding goal
get the bukkit block
i dont want to convert every nms blockpos to a spigot block though
it isn't resource efficient
thx ๐
are you sure you're using Biome class from NMS
Biome bukkit class and NMS classes are two distinct things
oh there is also NMS Biome ๐
Nah I wasn't
where to set permissions for event not command? ik about plugin.yml but i dont know where to put it
i made it working, when i set the permission but for example luckperms doesnt show it
wait is this how to convert an nms block to a spigot block
this is detecting waterlogged in NMS?
it how spigot gets blockdata internally
NMS Biome has only #getSpecialEffects nothing for setting it
Do I need to use Precipitation?
thanks
i want to start working with nms but obviously it's normally obfuscated and harder to work with. i now have the mojang mappings, but they don't seem to match what is commonly used online. like where someone is saying to use CraftPlayer#getHandle().playerConnection.networkManager.channel.pipeline() i instead have to use CraftPlayer#getHandle().connection.connection.channel.pipeline() which is the only thing it recognizes, and instead of PacketPlayOut and PacketPlayIn i got Clientbound and Serverbound packet class names
https://nms.screamingsandals.org/
This side is pretty usefull for work with NMS
how do I add a custom item ingredient to a ShapedRecipe?
exactchoice
do u use maven?
new Biome.Builder()
new BiomeSpecialEffects.Builder()
check for maven or gradle and shade it
https://github.com/brettwooldridge/HikariCP
u should
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.0.1</version>
</dependency>
its as easy as that with maven^^
and shade it
that shades automatically
doesnt
why when I use this method:
public void saveWarpsC() {
try {
warpsC.save(warps);
settingsC.save(settings);
} catch (IOException e) {
Bukkit.getConsoleSender().sendMessage("Couldn't save files");
}
}``` all my comments disappears?
Because that's how Bukkit Configuration API works in older versions of minecraft server's spigot
if ur using 1.18 or less
comments disappear
sadly, that;s just how it is
data files shouldt be configurable anyway
and I can somehow prevent that?
i guess you should print the stacktrace too
so it shouldnt need comments
oh, sadly ok
I need a schedule plugin, so that I can set it up to do a console command every () amount of time, does anybody know of a plugin like this?
u need one or u wanna code one?
ty
Im prob. being dumb buut
uhh
are you using a nms biome in a spigot method?
yeah?
how do u expect that to work?
yeah nms chunk.setbiome
Is this bukkit
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ Im reading through this wiki an done of the lines says 'Create a file dbsetup.sql in your resources.' Where does it mean by my resources?
no its NMS
that you have to put such a file in your resources folder
Mojang mapping?
although i'd just write the query myself in the code
yea probably
public void setBiome(int x, int y, int z, Biome biome) {
Preconditions.checkArgument(biome != Biome.CUSTOM, "Cannot set the biome to %s", biome);
Holder<BiomeBase> biomeBase = CraftBlock.biomeToBiomeBase(this.getHandle().s().d(IRegistry.aP), biome);
this.setBiome(x, y, z, biomeBase);
}
that looks like it's hell to do
did this work?
nah error
didnt assign those things:
i have all my resources located in my src, does it matter if i have a separate folder?
Can i make custom biomespecialeffects with custom water and leaf color ?
(What should i change so leaves color will change(
resources is located in /src/main
he's not using maven
i dont have a /main
I just did that so imma help u
create BiomeSpecialEffects.Builds which creates new it selves
then just set fogColor or something you need
is there an onEntityMove event or something
I need to make all horses take no fall damage
nms
how would i do that with nms
what about entity damage event?
check if the entity is a horse and it the type of damage is fall
that may actually work
if it is cancel event
Thanks. Can i modify a world like end's biome to have special effects?
spigot documentation has me spoiled, nms is a bitch to work with
Like not making custom biomes
honestly
Modifying an existing biome
ye sure
i hate nms so much but itโs kinda hot at times
u just set BiomeSpecialEffects to the biome
how do people even figure out how to use it when there is no documentation literally anywhere
look at the source code
pretty much it
before mappings and these kinda things, it was just figure for yourself
?paste
a few years back, so many things nowadays were missing frm the api
it worked thanks
I still said I would doc and tutorial this https://www.spigotmc.org/resources/discord-chat-merge.82981/
im still on the hunt to find the villager's finding workstation ai
like im just trying to figure out when a player is left clicking, how do you even begin to look that up
i need that
Anyone know what may cause this error https://paste.md-5.net/utekilekog.css
This is my line 45 in the Database class InputStream in = getClassLoader().getResourceAsStream("dbsetup.sql")
im looking at the source code but like most of it is private so i cant even access it
reflection
and before you say to use spigot api for that, it doesnt work the way i need it to due to a bug
you can make it public
isnt reflection bad for performance
method handles ๐

ok so now I have f'up biomes
any clues?
int x = p.getLocation().getBlockX();
int y = p.getLocation().getBlockY();
int z = p.getLocation().getBlockZ();
Biome cur = ((CraftWorld)p.getWorld()).getHandle().getBiome(new BlockPos(x,y,z));
BiomeSpecialEffects eff = IBiomeFactory.getDarkWaterEffects();
Biome biome = new Biome.BiomeBuilder().specialEffects(eff).precipitation(cur.getPrecipitation()).biomeCategory(cur.getBiomeCategory())
.temperature(cur.getBaseTemperature()).temperatureAdjustment(Biome.TemperatureModifier.NONE).downfall(cur.getDownfall()).
mobSpawnSettings(cur.getMobSettings()).generationSettings(cur.getGenerationSettings()).build();
((CraftWorld)p.getWorld()).getHandle().getChunkAt(new BlockPos(x,y,z)).setBiome(x,y,z,biome);
i think Player has joined time or smthing
in ticks so u can /20 and get seconds
nvm
zak what are you trying to do
Any idea why gradle is so stupid and looks for the 20220615.101427-27 version instead of the latest one?
idk lol
idk but time for switch onto Maven
probably gotta register it
wdym register
oh I switched from maven to gradle because maven was even slower with more random errors
like Method?
"unknown registry element"
MethodHandle.class
has nothing to do with gradle. what repo are you using?
well I always try to learn new stuff about the jdk
by looking at jeps and classes through javadoc
i see
use https://hub.spigotmc.org/nexus/content/repositories/snapshots/
so methodhandle is speed?