#help-development
1 messages Β· Page 237 of 1
his GF is in Germany
and like that one guy that asks for help once in a while
Youtuber actually
I do work for youtubers sometimes but still
idk it's weird
I already have my life planned out to be like
single and lonely
thats the spirit
just get a bunch of cats
Yee, we met on a YTer's discord server lol
game plan
become an old cat lady
pretty much
A friend of mine brought me dinner the other day and I thought about it all night
:o
homemade chicken that her mom made
oh it was a her
my man I'm on the move for like 21 hours a day
the other 3 are for sleep
then what is the issue lol
regardless gtg
well cya later then
no bitches
can always ask your friend out π
tiny problem I'm a minor and she's like 6 years older
oh then wait a few more years I guess lol
few more months 
there you go
kissing isn't illegal ironically
people younger than me writing better code than me π
Ur just bad
section.set("facing", String.valueOf(bmeta.getFacing()));``` ```Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftRotatable cannot be cast to class org.bukkit.block.data.Directional``` how can i get the direction a block is facing
Im 17
Been making plugins for 6 years
Coding for 11
I been coding since I was like 10
I wouldn't judge you
dedication
ive been coding like uhh 3years lol
21 years I been coding π
and doing some informatics stuff the year before
ive been coding like 6 months lmfao
Boomer
I thought I was starting young at 15 lol
lol
how do people have the patience for coding in elementary school π
my mom was learning coding when she was going to college
was for me when I first started
Had no friends
Idk
Most in this community started at a bit younger age
man I'd forgotten how much javascript sucks
man I'd forgotten how much you suck
cuties
keep dreaming, you ain't got that kind of cash
I didn't get a computer until 2017 and didn't even think about coding until covid started lol when I did learn tho I skipped school to
Don't care
every time I try to look something up the answer is in an 11 year old jquery format
I'm living life with what I got
wow I am sorry for your disability
that must really suck
can't relate
ffs
I learned how to code due to my parents kindof forcing me to. In the end I ended up programming as an excuse to play minecraft ^^
I'm learning javascript because I hate myself
These days I cannot play minecraft anymore, which is just sad
well tbf at this point it's not really learning but still
I didn't really get started with Java until after 6 months of scripting in python
I mean the start of any programming life is to dick around a bit
jit be like: i got a 30Β΅s for you the 2nd run
huh? why is that
I just can't believe I used python properly to start instead of being a dumbass and tryna make a game or something
No motivation or something. I don't know either
fair enough
I need to make money doing this shit tho. My code sucks so I never wanna post a plugin on spigot lmao
I'm surprised a server had hired me during the summer
mc got really boring at some point, development is basically the only way I can play now
I always end up depending on paper or doing some cursed shit like working with ASM and sun.misc.Unsafe which is why I rarely upload to spigot
What Is ASM
Bytecode editing lib
Is that just another memory management thing like unsafe
Nothing you would want to use unless you hate yourself
Ahhh
anyone?
Is unsafe a huge security vulnerability
unsafe is a way of life
depends
I wouldn't say so
for the most part no
but you can do a lot with unsafe however
that isn't normally allowed lol
I tbh want to change a private static final field for something in nms xD was curious
Allocing objects without running the constructor is nice
Yeah unsafe is the only way for that
some people say it's unsafe to do 100mph in a school crossing, I say life is full of small speedbumps and that's never stopped me before
Unsafe::allocateInstance 
When would you use that?
unsafe is cool
but jdk 16 killed it
cant use it now
You still can
Like always?
there are other ways to do things other then just using unsafe
unsafe best and fastest and coolest
you could for example do quite a bit that is unsafe by using JNI
What's JNI
jni calls are slow though and unsafe is built in so no weird dll loading
got so much jvm crashes whilst using unsafe
Hacks, mostly if some library does something you wouldn't want to do in the constructor but you need to have that object anyways
Ahh interesting
I'm about to get up and do some stupid shit with unsafe
field offset
Yes
ye
sick
never used it tho
Time to return to my nms adventures and get to do some stuff I previously couldn't
they are not that slow as you are trying to make it seem
What is JNI vs unsafe Is JNI a byte code editor or sum
Java native interface
and extreme bricking!
there is also JNA as well

then you have JNR
Life is hard and we will die
speak for yourself, life is easy and I have thus far not died and I don't plan to change that ever
JNA uses reflection to call native methods, JNR creates bytecode in runtime only once, so JNR is faster then JNA but they both have their uses
starting with Java 18
we finally got FFI
FFI = Foreign Function Interface
@river oracle yeah you got plenty to research on π
section.set("facing", String.valueOf(bmeta.getFacing()));```
```Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftRotatable cannot be cast to class org.bukkit.block.data.Directional``` how can i get the direction a block is facing
what's that for, calling functions that don't exist?
Interacting with legacy apps
Accessing features not available in the language
Using native libraries
Accessing functions or programs on the host OS
Multi-precision arithmetic, Matrix multiplications
GPU and CPU offloading (Cuda, OpenCL, OpenGL, Vulcan, DirectX, and so on)
Deep learning (Tensorflow, cuDNN, Blas, and so on)
OpenSSL, V8, and many more
Interesting read
Hello, does anyone know how the player.sendMap() function is used, what its purpose is?
https://paste.md-5.net/imakekazem.coffeescript I'm trying to get the selection of a player using WorldEdit API why, it stills throw the EmptyClipboardException?
"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.
Its posible to do a instanceof while working with generics params?
how do i create a wait in beetwen here ```java
creeper.setPowered(true);
creeper.explode();```
no
Answering to me right?
yes
?scheduling
thats why people usually pass in a class as constructor param
#runTaskLater
but i want it to wait in a event
Okay, so i will have to see how i can do that tho, because of how my command api will works you will have:
- An
abstract class Command<C extends Node>- Where i need to have a method to get the node provider - Node contains common getters for each command node
getName(), getAliases(), etc - Finally 2 implementations for the node class
BukkitCommand and BukkitArgument
and whats a node provider
you can still use scheduler
can you give an example on my code
The node provider will be either BukkitCommand or BukkitArgument, that why i asked if generics works with instanceof
But i realize it was a stupid question
i guess a command holds a node field
creeper.setPowered(true);
Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
just check instanceof on that
Hmnn
creeper::explode
and where do i change the delay
ahh nice thanks
yes
Fourten this is node class
isi t still bukkit if i use paper
Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
this
yes
but
in a way
after
this
Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
all code after this
paper is a fork of spigot, spigot is a fork of bukkit
Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
but paper is far removed though from being bukkit in my opinion since they change quite a bit
will it run after the explode
the delayInTick is the delay before it runs
yeah but
runTaskTimer takes both a delay and repeat ticks as it's a repeating task
all code after Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
will the code run after this has ran Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
proves how much my brain is working
do you ubderstand
runTaskLater is what you want
^^
ok
and how do i use that
but does this still work
Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, delayInTicks);
Bukkit.getScheulder().runTaskLater(pluginInstance, () -> {
creeper.explode();
// THIS CODE WILL RUN AFTER THE DelayInTicks
}, delayInTicks);
ohh
i under stand
understand*
symbol: variable pluginInstance
location: class me.zittexx.coolessentails.events.eventthing```
i get this
and this
symbol: variable Bukkit
location: class me.zittexx.coolessentails.events.eventthing```
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
when i build
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Build using Maven?
yes
Then move your imported jars to your pom, don;t import jars to your project
add dependencies to pom
yeah but why does it give me that
because maven knows nothign about manually imported jars
it doesn't undrestand "bukkit"
this
Creeper creeper = (Creeper) event.getEntity();
creeper.setPowered(true);
creeper.setVelocity(new Vector(0, 1, 0));
Bukkit.getScheulder().runTaskTimer(pluginInstance, () -> { creeper.explode(); }, 10);```
does it have the imports too
imports?
obviously someone doesn't like reading
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
hover over Bukkit does it have a import classes or something like that
click it
k
know it cant understand getchudler and plugin intance
getshuelder
cant spell it lmao
change runTaskTimer to runTaskLater
plugininstance?
one sec
public class MyClassName implements Listener {
private final MainClassName plugin;
public MyClassName(MainClassNme plugin) {
this.plugin = plugin;
}
}
and on the constructer change it to new MyClassName(this)
what
?paste ur class
might aswell learn some basic java
thats what im tryna do
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
public class eventthing implements Listener {
private final YourMainClassName plugin;
public eventthing(YourMainClassName plugin) {
this.plugin = plugin;
}
@EventHandler
public void creaturespawn(CreatureSpawnEvent event) {
if(event.getEntityType() == EntityType.CREEPER) {
Creeper creeper = (Creeper) event.getEntity();
creeper.setPowered(true);
creeper.setVelocity(new Vector(0, 1, 0));
Bukkit.getScheduler().runTaskLater(plugin, () -> { creeper.explode(); }, 10);
}
}
}
on ur main class change the constructer to eventthing(this)
so in full getServer().getPluginManager().registerEvents(new eventthing(this), this);
that too
Fourten, Im doing all this shity and dirty things cuz how i want to implement the execution system, im wondering to command executor or argument, contain the same method for creation. Something like the followed example
// Basic command creation
public class TestCommand extends Command<BukkitCommand> {
public TestCommand() {
super(name, aliases, permission, usage, description):
}
public boolean execute(CommandSender sender, String[] args) {
return true;
}
}
public class FactionList extends Command<BukkitArgument> {
public TestCommand() {
super(name, aliases, permission, usage, description):
}
public boolean execute(CommandSender sender, String[] args) {
getHandler().
return true;
}
}
// Command library initialization
CommandLibrary command = new CommandLibrary(plugin);
// Basic command registration
command.register(new TestCommand());
// Command executor registration
CommandNode faction = command.register("faction").permission("faction.command").description("Faction command");
faction.getArguments().register(new FactionList());
so in plugin = plugin it gives me red
Sorry for being rude, but have you learnt java before starting to work with api?
i typed 0 instead of )
you need the main class instance
not really
^^
i know a little bit
So then you have the consequences, if you leant first java and then startng to work with api, you woundt be having this simple things
you can copy and paste this changing YourMainClassName for your main class name
got it
Ofc to clarify im not being rude nor what you thinking just to say, because you mustnt be coding using an api or library withut having the language knowledge
love how you are just sitting here explaining java
Agree
i know need to learn it and you definitely not rude
If i had to do that i would clarify ignore him
lmfao
writting with java not knowing java hehe
I would just ignore him because i definitly not patient
who
Also its stupid to code something without learning the lang where you are coding π€‘ π
you pass your main class cause it extends the JavaPlugin
you havent copied what i sent then
ohh
copy all but the imports chaning YourMainClassName for your main class name
Now yes!!!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Lmao my patient went to flor and i dont want to swear
Yeah just ignore him or block him
that is a bit hash lol
I think spigot must ban every user asking for support which they dont even know java
true
Or atleast make a fkg rule with that because there lot of that type guys which are really ass--hole
π€£
true
i guess i gotta ban myself for not knowing the whole java api
joking ofc
you or him?
Because i dont seeing he his msgs anymore since 5m ago
failing to know basic java is a big oof
yeah they must be bannedβ
Extreme >:) <3
also not that fast though
which is usually the reason why you would use unsafe
then they tell you to pass a java class
or an alternative
Well you have JNA, then JNR which is faster then JNA, then you have JNI which is faster then JNA or JNR and now we have FFI which I think is going to turn out to be better then JNI
yes
ahats the i
interface
ah
common mistake i see people do
- being lazy
- not listening to help
- can't be bothered anyway
- not knowing what they're trying to do
but unsafe is directly implemented into the vm i think
as a primitive
you can't do everything from unsafe either
its in hotspot/shared/prims/
nah thats true
but things like quickly getting fields
whats the generic param for
went eating
might be useful for things like fast serialization
depends at what point in time you are trying to obtain them really
if you have one time get but a lot of querying
like a serialization thing
where you cache the fields in a map
their offsets at least
and then get with unsafe
what I mean is, like if you have the ability to obtain the fields before it enters the JVM then that is going to be quicker then waiting on it to be loaded first
if the class hasn't been loaded yet, then accessing the jar outside of the JVM is going to be faster
no reading the class file will be way slower
and this is for setting fields
has to be loades
if you have to wait for it to be semi loaded but not initialized, then using unsafe is faster
it isn't slower if you are directly reading bytecode before the class has even entered the JVM. Not sure what makes you think the JVM magically is faster then anything else that can read a file
what would you want to do on a thingthat doesnt have the thing already loaded
Hey guys can someone help me?
Why player with nick "MCSTORM_IO" can join?
@EventHandler
public void onPlayerJoin(PlayerLoginEvent e) {
String p = e.getPlayer().getName();
if (p.startsWith("MCSTORM")) {
log.warning("Attack Detected.Blocking...");
e.setKickMessage("Connection Refused.Attack Detected.");
}
}
you can do plenty, but that isn't the point
the point is, it depends at what point in time you are needing to do something
which dictates what you should use
cuz you arent kicking the player
username or a nick with another plugin
oh yeah
isnt there a PlayerPreLoginEvent
yes
theres no player object available there
only uuid
asyncprelogin tho, sync is deprecated iirc
Using PlayerPreLoginEvent the error is the same
for example, runtime serialization of an object
all the fields
the object class is loaded anyways
add a p.kickPlayer(kickmessagehere)
I already did that
But its same
It dont give me an error
.
try this
I try to get the x cordinate the player is standing on.
I'm using this code to achieve it:
Math.floor(player.getLocation().getX()))
But it somehow acts as Math.round().
All numbers between .1 and .5 round down and all numbers betwwen .5 and .0 round up.
Math.floor shoul always round down.
What is the problem here?
Im already tried this
offline mode?
.
But my code was like this:
PLayer p = e.getPlayer
if(p.getName.startswith("MCSTORM")) {
p.kickPlayer(msg)
}
?
depends on what it needs to be serialized for
im so confused why your doing that
for example, if the object doesn't need to be Java serialized, you can make use of anything else that isn't JDK and it most likely be more efficient
Player p = event.getPlayer();
if (p.getName().startsWith("STRING") p.kickPlayer(msg);
e.getName returns the event name irrc
iirc
for when was pattern matching with null a thing again?
Sorry, I wrote the code on memory and made a mistake
Not e.getName
It was p.getName
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
bruh
"overrides": [
{"predicate": {"custom_model_data":9801001}, "model": "btscrolls:item/teleport_new"},
{"predicate": {"custom_model_data":9801002}, "model": "btscrolls:item/teleport_used"},
{"predicate": {"custom_model_data":9801003}, "model": "btscrolls:item/instant_teleport_new"},
{"predicate": {"custom_model_data":9801004}, "model": "btscrolls:item/instant_teleport_used"}
]```
just setTexturepack
dude I don't think you even know what I'm talking about
I'm trying to figure out the same thing
Custom model json is part of the texturepack lmao
Dumb me thought its equivalent of Math.pow but it seems it just adds up
Is there some equivalent of Math.pow?
Which is short?
https://www.spigotmc.org/threads/custom-model-data.415216/ this thread is pleanty of an example
puts the json out nice
public void onPlayerJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (p.getName().contains("MCSTORM")) {
log.warning("Attack Detected.Blocking...");
e.getPlayer().setHealth(1);
e.getPlayer().kickPlayer(ChatColor.RED + "ΠΡ Π±ΡΠ»ΠΈ Π·Π°Π±Π»ΠΎΠΊΠΈΡΠΎΠ²Π°Π½Ρ Π·Π° ΠΏΠΎΠΏΡΡΠΊΡ Π°ΡΠ°ΠΊΠΈ ΡΠ΅ΡΠ²Π΅ΡΠ°." + ChatColor.BLUE + "ΠΡΠ»ΠΈ Π²Ρ ΡΡΠΈΡΠ°Π΅ΡΠ΅ ΡΡΠΎ ΡΡΠΎ ΠΎΡΠΈΠ±ΠΊΠ°, ΡΠΎ ΠΎΠ±ΡΠ°ΡΠΈΡΠ΅ΡΡ Π² Π½Π°Ρ Π΄ΠΈΡΠΊΠΎΡΠ΄ ΡΠ΅ΡΠ²Π΅Ρ: " + ChatColor.DARK_AQUA + "
");
}
}
So?Why player can enter?
I tried to replace "startswith" with "contains"
im pretty sure you need to delay the kick by 1 tick if you're doing it from a join event
How i can do it?
?scheduling
#runTaskLater
public void onPlayerJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (p.getName().contains("MCSTORM")) {
log.warning("Attack Detected.Blocking...");
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTask(mainfixer.getInstance(), () -> {
e.getPlayer().setHealth(1);
e.getPlayer().kickPlayer(msg);
});
}
}```
Now its right?
yeah
wait nah
runTaskLater
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(mainfixer.getInstance(), () -> {
e.getPlayer().setHealth(1);
e.getPlayer().kickPlayer(msg);
}, 1);
?
that
Oh, thx
hmm i think i'll do smth like this to handle parentheses
pretty sure runtask will also do it 1 tick later but yea fair
It dont work(
[21:39:03 INFO]: UUID of player MCSTORM_IO is a631968e-f991-3021-abc0-029527e906bd
[21:39:04 INFO]: MCSTORM_IO[/127.0.0.1:49611] logged in with entity id 261 at ([world]-175.2017668330055, 69.0, -134.6030753048176)
try using PlayerLoginEvent instead
using
private void playerJoin(PlayerLoginEvent e) {
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Kick Message");
}
hmm didnt know IntPredicate s = i -> i != ')' was possible
looks a lot cleaner
It dont work
did you even register your event then
huh xd
If u don't want a player to join, block it from the asyncplayerpreloginevent
fuck
should just use Crunch :d
@tardy delta whay are you doing?
Are you making your own?
yes
AHAHA it works
had to directly modify the newly created expressions reader
optimisation of 20 lines
is it fast tho
wdym it doesnt need to be java serialized
better
mans want to see speed
sout calls take relatively long lmao
if you benchmark it
its very jit dependant too
To be expected though
thats why i turn of debug usually
@tardy delta now try 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4
Well they usually aren't that slow
this is it basically https://paste.md-5.net/icaqaxelus.cs
well uh still gotta change my old algorithmn to support operator priority
and lemme see if my new impl fixed the parentheses issue
looks like its back on track
wasnt workin before
nice
?paste
ima rewrite my expression parser and interpreter
Does anyone know whether the JVM (I'm talking about the generic Java 17 hotspot JVM) allows to extend final classes?
its so slow 15 ns per execution
im tried to edit code and got error:
https://paste.md-5.net/owesojodiy.cs
there are 1000Β΅s in a nanosecond right?
?paste the class
public void onPlayerJoin(PlayerLoginEvent e) {
Player p = e.getPlayer();
String msg = "";
if (p.getName().startsWith("MCSTORM")) {
log.warning("Attack Detected.Blocking...");
getServer().setWhitelist(true);
log.warning("Whitelist was enabled!");
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(mainfixer.getInstance(), () -> {
getServer().setWhitelist(false);
log.warning("Whitelist was disabled!");
}, 60);
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, msg);
}
}```
tf are you even trying
the compiler might optimize method calls to final classes to not use a vtable so it might still not work
Make it easy on yourself and use JavaPlugin.getPlugin(MyPlugin.class) instead of passing the plugin instance around
wrong event
yes
depends on what expression ig
hm, then I gotta figure out a way to make it forget the final flag
thats only exec tho no parsing
use the AsyncPlayerPreLoginEvent and put the e.disallow in the scheduler
when its already a tree
@lavish wing ^^
so yeah its expected to be fast
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
Player p = (Player) commandSender;
p.setDisplayName("Β§c" + p.getName());
return false;
}
}```
But when I execute the command nothing happens, and the name over my head is still white?
but not fast enough and i completely fucked function call performance
my first 1+1 expression takes 11685Β΅s and after jit optimizes it's 68Β΅s
my solving algorithmn is slow asf tho
jit is epic
is the command registered
Yes
solving algorithm?
When I add a sendMessage, then it sends a message
i basically loop thro the string, transform it into tokens and later on solve that token chain
Alternatively I'll just inject into Material's switchmap which should allow me to register new materials on the fly
like 5 = x + 7
thats why its slow
do you mean evaluate or solve for x
oh yeah so evaluate
its very static now, whenever i want to add method calls it will go brr
solving algorithm would be epic
im not smart enough to write that
that you enter 5 = x + 7 and it returns x = -2
shouldnt be too hard if you have an ast
but still a pain
You still gotta redo what's basically over 10 years of maths you learned at school
people might just directly instantiate one ig
you're right
or Expression.parse(String)
learning about differentials rn
or whatever theyre called
?? Command is registered, but nothing happens, when I add a sendMessage, it sends the message, but the name over my head is still white
im learning about Math.log in college lmao
log is nice and all, but ln is the real deal
were using some program on our pc to do all the stuff
logBASE is epic
im pretty sure displayname is not the name over your head
pretty sure that will be ur name in chat not sure
imagine being able to make this
How can I change the name above my head then?
did u know logBASE(x) = logE(x) / logE(BASE) or something like that
yes
as when I google it, it says that I must use setDisplayName
logE being ln?
last time i did it. it had to be done though scoreboard teams
Ok thx
then ln
normal log is 10log but Math.log is e log right
could prolly also be done with packets
its confusing
There is no normal log
how?
well i mean log as you would write it somewhere
log is always suffixed by a base, base 10 log is lg
It's something a lot of people neglect
still wondering where ill need logs for anyways
Yeah you can do ln for everything
depends on ur mc version
1.19
its written like log[subscript BASE](x) right
the base is in subscript suffixed
log a (b) is what it should be iirc
2log(4) would explicitly mean 2 * lg (4) generally
Thought so
Hey all! gettin into development via code and im following guides and when adding protocol lib as a dependency its showing as not found. is there a reason for this?
maven/ gradle?
Or Eclipse JDT or IntelliJ artifacts?
man already outta here
they think we'll tag them
uh my math is bad dont question me
For b^a = c you can do ln(b) * ln(a) = c
ah
uhhh pretty sure you will need to send
PacketPlayOutPlayerInfo to remove the player
another PacketPlayOutPlayerInfo to add the player with a different name
then a PacketPlayOutDestroyEntity to all players except the player that's changing his name
then lastly a PacketPlayOutNamedEntitySpawn to all players exept the player changing his name.
though im not sure if it still works like this in 1.19
did reload?
Check lowercase/uppercase stuff
its copy pasted from protocol lib site
Artifact ids should be lowercased generally
ok thx
https://mvnrepository.com let's hope it's on there
reload maven
how
as shown here
For codemc it should be right according to https://mvnrepository.com/artifact/com.comphenix.protocol/ProtocolLib/4.8.0, no idea how other repositories behave there
seems to have done it!
for example, if you need to serialize to XML
thank you so much!
it has to get the fields somehow
Im quite new to using code for making plugins to be honest.
Is this a good place to get general help with getting stuck?
it's the best place to get help yeah
Is Async World Generation possible somehow?
had another server and average response was "fix ur sh**** code or learn java
Only paper, the forums and the irc (okay that one not really) can rival it
Well you'll get these answers too
No matter where you are
ye well that was the only answer you got xD
do i need to check if a key exists before doing config.getString or something?
after aboutttt 8 hours of wait
not sure why you believe everything has to be done in Java
should i develop on spigot as opposed to paper? if i make a plugin on paper does it limit users to use paper/forks only?
Okay actually, you will very unlikely get the answer in the spigot irc channel
yo idk but it has to get the data from objects somehow
that will return null when it isnt found iirc
?jd-s
was that to me?
Given that only phoenix and I are active on there and neither of us are particularly keen on shutting down people
does it just boom write the raw data from memory with pointers?
yeah
oh ok thanks lol
anyone on this?
with new memory api probably could not entirely sure
how do you know the data type
In cratesplus I don't know what to do or what permission to give so that users can open chests with the keys, it doesn't let them
not everything needs to be known, just depends on what you are doing
also Unsafe has access to jvm internals while JNI probably has also been 'made safe'
JNI can never be safe
anytime you use JNI, you are stepping outside of the JVM
therefore the JVM has not a clue what is going on
yeah but it probably has some more security code behind the JNI methods
which then eventually calls jvm internals
if it uses anything that isnt in spigot, it will only work on teh forks i would guess
verifying access or addresses and whatever
without the and whatever
does none of that
Thanks
that is on you and your native calls to ensure
if you want to step outside of the JVM, the JVM stops caring about what you are doing outside of it
What's yalls Go-to guides? i have this really long playlist on YT by Kody Simpson seems to be good idk if theres anything else that wont put a hole in my wallet
looking at github
this really depends on who you ask
i have basic understanding of like how to structure plugins etc and logic behind it its more understanding how to format code and write it out
anyone knows a way to clean this up? https://paste.md-5.net/uqixaxipux.cs
some of us don't require guides per-say and are more then happy with working with Documentation as well as just looking at the implementation code
?paste
is this for division with floats?
I have a texture pack for my plugin, but the texture is not displaying it is just displaying the custom texture
i ensured it has the material data
this.item = ItemBuilder.builder()
.material(Material.DIAMOND)
.modelData(1)
.name(ChatUtil.style("<gradient:ff0000:ff7f00>Crystal of Lava</gradient>"))
.build().make();
I also ensured it was being applied correctly changes I make that break textures do indeed go through and display so that is also out of the question.
I doubled checked and my ItemBuilder does apply it
https://paste.md-5.net/boyonubopu.coffeescript
the png file is in assets/meliorate/textures/items/lava_crystal.png
Not quite sure why it wouldn't be applying correctly. Not quite sure if its with my code or Json I tried changing the json which I think is right, and nothing happened so I'm a tad confused
could always use the code I showed earlier to determine a number
weird question, can i have ur chat util
just use IridiumChatColorAPI there API is better
Hi, how can i make a point on a line (in my case a raycast) go down until it finds an edge of a block? so that then i can use it as kind of a path? (i tried to show in the photo what i wanted to do)
in this case a point is a location
oh a switch is still more effecient
and you essentially only had the x >= '0' and x <= '0' check
im constructing the read integer tho
how can i find P2?
new TokenReader("123ahdha").readInt() would give 123
which is p2
errr just raytace, get the block x and z and then use the like getHighestAt thingy
ig
well just depends how it is constructed really. Switch is just a form of loop unrolling. But I don't know your program well enough to determine which is best lol
so i get the lowest block and then i use getHighestAt?
its basically a simple Integer.parseInt
ohh i get
section.set("facing", String.valueOf(bmeta.getFacing()));``` ```Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftRotatable cannot be cast to class org.bukkit.block.data.Directional``` im trying to get the rotation of a block
Rotatable and Directional are two different interfaces
that don't interact with each other
so im casting to the wrong thing?
the exception should have made that obvious
instanceof is your friend
you can't cast to something that doesn't have a relation to one another
wait i found the method but it does only work with integers so basically no offset just the corner of the block
well blocks are only 1meter by 1meter
so you could just create your own
0-1
0.5 being in the middle lol
brr im always confused between arr[i++] and arr[++i]
can u just add your offset back to it?
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftRotatable cannot be cast to class org.bukkit.block.data.Rotatable Rotatable bmeta = (Rotatable) block.getState().getBlockData(); section.set("facing", String.valueOf(bmeta.getRotation()));
how can i do this?
well u have x, z right
yes
how can i get the decimals
wait
if i make it a string
and then split from ,
will it work?
you do know you could just use double
what do you mean
an integer is a double without the decimal
yes i know
so....add your new integer to the double that has your offset? and return a double
integers and doubles can be added together without anything fancy being needed
won't this get me double the coordinates?
but you do need to return a double to retain the decimal stuff and what not π
Any real reason/use cases for me to use something like postgres over MySQL or SQLite? π€
when you want to store objects themselves without transforming them
Postgres is ORDBMS
wait i'm not sure i understood your method... So for example i have coordinates 3.43 then how can i get just the .43?
why do you need that
for the offset
u have x, z so just the Y of the highest block and add them together
and u got the location
Ah, so like for discord it would be images/uploaded files and instead of to disk it would be stored in postgres?
.getX() - .getBlockX()
(not that they use postgres, they use cassandra from the one thing I could find on their backend lmao)
yes but this just gets me the corner
no it doesnt?
not sure, but lets use Java as an example. Instead of serializing say the Player object, it will store the object as it is so you can pull it back out later
there is no transforming or translating the object to something else
as long as your original x, z is not in the corner
ohh i see
Ah, makes sense then.
I still however can't think of use cases off the top of my head lmao
i never know when to use what database either
lol
something like this i guess?
I just use SQLite for everything lmao
add a +1 to be at the surface
One of the jobs I'm looking at has PostgreSQL as one of the Experiences/Skills, but I can't think of any actual use case so I can learn it π
SQLite is nice, only problem with it is its only good for small to maybe medium sized stuff
only point between SQLite and others is if you need to access the same data from multiple apps/locations
since I tend to need MySQL anyways, it is my preferred DB format
Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers robust support for clusters spanning multiple datacenters, with asynchronous masterless replication allowing low latency operations for all clients.
that should work
size as well
oh ok
once the sqlite db hits a certain point you are better off with something like MySQL
me with sql 
would i do smth like this?
me, making my own format because I don't like well-established solutions
including a static method in its own class
or just using S3 because my customers are crypto millionaires 
I have to re-look to see what discord uses Cassandra for exactly, if they even said what lmao
discord switched from mongo to cassandra
guess you could make your own storage data base system
mongo??
π€
Yea, but I don't remember why @echo basalt lol
Vishnevskiy, Stanislav (March 29, 2018). "How Discord Stores Billions of Messages". Medium. Archived from the original on June 30, 2020. Retrieved March 28, 2021. Quotes:
"We decided early on to store all chat history forever so users can come back at any time and have their data available on any device.""We setup our code to double read/write to MongoDB and Cassandra." "Since Cassandra is eventually consistent it cannot just delete data immediately."
Ig if I were to re-do the old ChatRoom project, I might as well convert it to that & microservices lmao
wouldn't make sense
whats the point
Well, even if I didn't do anything with it, still gives me experience for something I don't already use like MySQL or SQLite lmao
you change/scale the project as required. You don't start with things that are only optimal under extreme loads first
just because something can handle stuff at the extreme
doesn't mean they are optimal at the other end of the spectrum
well I am just pointing out is all
Also doesn't handle retrieving old messages for when you join a server either lmao
whats the point in persisting the messages then
tbf it was a half-assed project just to learn sockets
lol
At least point doing it any real serious manner's dumb, so any updates would be for a specific thing, e.g. microservices
although i did impl my own QR code generation algorithm
For retrieving old messages I can just grab all of them for the specific server lmao
one of the major differences between UDP and TCP is that UDP doesn't wait for a response to come back
also UDP packets can arrive out of order, but for retrieving old messages this isn't really an issue
it's downside is it has no guaranteed order or delivery with no error checking
It's a packet based approach using sockets, no idea if it's UDP or TCP lol
odds are then it was tcp
Udp can also suffer from packet loss
so can TCP
if tcp loses a packet it resends
Exactly
which can be bad if you don't implement a check to stop it
So you don't need to worry abt packet loss with TCP
you do actually
and this is for client side https://github.com/ChatRoomOrg/Client/blob/master/src/main/java/optic_fusion1/client/network/SocketClient.java
you don't want something to constantly keep sending something it isn't getting a reply for
If a packet isn't received, it just gets retransmitted until it does
And if all else fails, and no response is recieves it just disconnects
If you are not getting a response with TCP it's yoru code at fault not TCP
depends how it is setup
not necessarily true
(trust me, I manage an anticheat which is entirely packet based)
TCP is fully error corrected. Worst case is it drops the connection
+1
yes, and again depends how it is coded
There is no real way to fail with TCP
yes there is
I've coded both TCP and UDP client/server
But yea, I'm sure there's a lot I could do in general to improve it @wet breach but there's just a general lack of caring and no real reason lmao
Unless you have sabotaged your tcp driver implementation and are trying to make it fail, it won't
are hypervisers only for servers?
alright then you should know there is cases where you don't get a response back that has nothing to do with your code because you know routes do go down
i'm thinking of having one as to switch beteewn os on my Main home pc
if a route goes down a packet is lost and TCP automatically resends the lost packet
packet is lost with no response and yes after a bit of time the packet is re-transmitted
It is literally impossible to lose a packet if the connection is still up
it isn't impossible
ok
it is a virutal os?
that what i'm wondering
kinda don't wanna do server stuff
just directly running on my pc
I actually can't tell if you're trolling or just don't know what you're talking about
there is plenty of ways packets can get lost with no response even if a connection is up
No there is not
No, not really
go look up internet black holes
a black hole will take yoru connection down
lost packets is a real thing
error correction only works if the other side actually got the packet
as said, If the connection is still up no packet will ever be lost
packets can get lost but the confirmation signal will ensure that they are re-sent i think
this is false
no it's not]
you never heard of failing lines? Or faulty lines?
It's weird
You use TCP when you want to guarantee that data will arrive and will arrive correctly, with the drawback of potentially higher latency
And UDP for when latency is most important and every packet doesn't need to be received
I.e. video calls etc
error correction wouldn't be a thing if you couldn't lose packets at all
I've been studying TCP packets for my upcoming NMS tutorial
Exactly the TCP socket would just disconnect
TCP error correction requires a confirmation is sent. if no confirmation is received the packet is resent. it will timeout eventually and drop the connection
no it wouldn't
You wouldn't just loose some data then keep continuing on
Each packet contains a numerical index on its header
And an index of the last received packet
yes you can
Ok you're obv just trolling
Oh so you run a hyperviser then you connect directly to itself
100% not
Have fun ig
I guess if I were to re-do the ChatRoom project, move it to MySQL, microservices, and some half-assed React based UI, yea?
TCP resends missing packets, UDP doesn't care and skips all that overhead
have you ever messed with networking beyond just your home router?
like have you ever messed with switches and border gateways at all?
or setup the actual connections
Yes I wrote teh Horatius authenticator for Dowty Information Systems back in 1990
hello is there any way possible to get what face of the block the player is looking at?
That why its recommend to learn Netty instead of swearing with shity raw sockets
I was a satellite communications specialist in the Army
No wonder you had to use the keyword "was" lol
Clearly aren't too knowledgeable about this lol
I have a very dumbed down explanation of how TCP works
I'm not even sure it would be worth learning netty or google protobuf for something like the ChatRoom project lol
You didn;t learn enough about protocols then
go error correct something you haven't received
I mean i prefer using Netty alll life, i still remember all that shity momments swearing with shity java raw sockets
according to you error correction means you can correct the data without actually getting the data
Modems, protocols and security authenticators was part of my job at Dowty
Not what I said
I have no problems with sockets personally :p
Does anyone have a good resource that explains pdc?
?pdc
anyone?
google it, the solution has been there for years
then you should know there is ways for the other side to just not get the data you sent or you just never seen what faulty lines do
or how about when someones cable line runs next to powerlines
Hi, i'm trying to use an external source using maven but whenever something calls that class it says this weird error ClassNotFoundException... How can i fix this?
ok ...
bing it 
?bing
Bing your question before asking it:
https://www.bing.com/
lol it is real omg XD
shade it?
Of course there is and thats why lost data is re-requested. If none is received the connection drops thats why it's a connection based protocol
Oh this is beautiful.
Shade it or use the library loader (if you're on a modern version)
sorry i don't know how
Yahoo your question before asking it:
https://search.yahoo.com/
how can i do this
PDC like
nbt wrapper or smth
you mean, it sends it again if it doesn't get a response back
Which one
the other side isn't going to re-request anything unless it has at minimum received 1 packet
shading
oh man. loved it
actually no, all packets are indexed. if the receiver gets a packet out of order it will request the missing packet.
but the point I was stating is that, you can lose packets without a response
you said it is impossible
imagine storing a whole server in a nbt tag
yes, but the receiver still needs 1 packet to know this at minimum
What I said is it's impossible to lose data as TCP is an error corrected connection protocol
I mean
Google your question before asking it:
https://www.google.com/
it is possible to lose data
technically the connection can drop / timeout
hmm anyone who knows what the dif is between ByteBuffer.allocate(int) and ByteBuffer.allocateDirect(int)?
while the data is being sent
if the connection goes down in the middle of transmission the other side will never get the data
NO it's not, not if the connection is still live
but you can't just... not receive a couple packets and go by unnoticed
The only way to lose data is by dropping the connection
there is a bunch of tutorials out there
obviously
even if the connection is still live it is still possible because you don't control all the servers in the middle
Y'all 2 are just talking on different wavelengths
you never know what might change
That's a connection chain
Also open a thread for this :)
Sorry frost you are plainly and 100% wrong in this. I've been writing code for TCP/UDP for 40+ years.
please let me know you can transmit data through a firewall that suddenly decides to filter your packet out
you control all the transmission points correct?
Yeah, discussion is over, you will not listen
i tried , .equals , same code not work
If the packet got filtered out
The sending computer would not recoece an ack for that packet
Then the sending computer would retransmit
If it still doesn't get a response, it'll disconnect