#help-development
1 messages · Page 169 of 1
But you also need to make sure to not do excessive stuff
You are certainly not allowed to Republish the entire client jar in most places
Even if you have modified it
The main reason spigot does not publish jars is because of a licensing error (if you can call it that - they absolutely knew what they were doing)
Grey area is the best area
that is called a rewrite
They certainly don't care all too much, but you still don't want to risk it
Playing on a companies apathy is a dangerous game
But like
You don't want to get your mod taken down because of some error you did long time ago
someone knows why I have access denied when I try to write into the AppData startup folder?
Also this is not for Spigot plugin
Speaking of those sites, I recently saw someone download paper from such a site.
write with what and write to what exactly?
%appdata%?
Might need to run as admin to access it
Yes, but https://papermc.io is the proper way to download paper
Wtf XD
I'm trying to write an InputStream to %appdata%/Microsoft/Windows/Start Menu/Programs/Startup
Again, PAPER
Paper uses paperclip
And the worst thing is that it was an outdated jar
I too enjoy my server mining crypto
I hate this
Do you guys think it would be best with an Arena variation for duels?
so in skript i do %{variable} ? 50% what'd the code for that be in java?
whats that even supposed to do
in skript it auto checks if the variable ISN"T set, then if it isn't. It'll take the value i put after the ?
in java it's the exact same thing for booleans, but how would i do it in a double or string or int?
You check if it's null
yea ik, but there has to be a faster way.
?learnjava Highly recommended before starting with Spigot
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.
i know java. i was just asking a question lol
Why is checking for null "slow"?
Wat
.
primitives cannot be null lol
not with that attitude
ah he was talking about vars in general
I mean.. Noone is talking about primitives
Well they did ask about double and int
oh no olivo pressed x

i see
every programmer who's ever lived is crying rn
does anyone know which packet is used for setting the amount of hearts a player has
Probably entity metadata
afaik it's an attribute thing
Yeah, there's a separate packet for updating attributes
If I were to guess the naming, PacketPlayOutUpdateAttributes or ClientboundUpdateAttributesPacket
Trying to save and load json using this:
https://www.spigotmc.org/threads/json-configuration-files.212794/
but theres an issue with line
map = gson.fromJson(new FileReader(configFile), new HashMap<String, Object>().getClass());
Intellij says there is a Unchecked assignment: '? extends java.util.HashMap' to 'java.util.Map<java.lang.String,java.lang.Object>' on part gson.fromJson
it also says Instantiating object to get Class object on part new HashMap<String, Object>().getClass(). Anyone got any idea what these warnings mean?
Unchecked means you have no clue what types your casting too
You are likely fine ignoring it in this case
do someone know how to make a sapling grow into a tree ?
?learnenglish
Bro that's just mean
basically just do @SuppressWarnings("all") and forget about warnings
oki thanks
If I got a dollar for everytime I have written @SuppressWarnings("unchecked") I'd be very very poor
true tho
right so now I have another issue that is more of a maths skill issue, I have this code ```java
class Main {
static int playerMaxHealth = 2000;
static int playerCurrentHealth = 1000;
static float vanillaHealth = 0;
public static void main(String[] args) {
int currentLoopPosition = playerCurrentHealth;
while(currentLoopPosition >= (playerMaxHealth/20)) {
vanillaHealth++;
currentLoopPosition -= (playerMaxHealth/20);
}
System.out.println(vanillaHealth);
}
}``` to have a custom health system, is there a more efficient way of doing what I'm doing right now?
i guess
well basically get the sappling and do setStage(getMaximumStage())
I'm pretty sure there is I just dont know maths đź’€
I did, and nothing after
google then
Basically I just need to display it in the healthbar if the player has 1000/2000 health in my system so for that im just gonna convert it to roughly the vanilla amount that's equivalent but I have the feeling a loop is not the best way of doing it
Gogl3w I ber you I find something gimme a minute
(and no I cant divide it by 100 lmao)
why not just vanilla health = health / multiplier
why
just get the multiplier variable lol
vanillaHealth = currentHealth / (maxHealth / 20);
smth like this
how much hearts player has btw
10?
oh yes that works
I think its 10 hearts but since there's half-hearts I'm using 20
then just this
each 100 would be half heart
yeah that worked lmao
I used such a weird solution
the things I do to not use maths 🙏
tyvm
❤️
Dm nuker fall for free java lessons
always do meth math whenever you can kids
FREE JAVA LESSONS
checkmybio
I love meth math
alright will do lol
I am mathless in the ways of math
~~ around stuff
~x2
~~meth~~ math
@spring vine you scammed me you took my email
Come on discord
θ
No one cares about your personal beef lmao if you have an issue contact support
0
?support
Hm
I just wanna talk
Would you like or not like this becoming a forum channel
tf is a forum channel
wdym?
I forgor how to inject a class, like I wanna inject the zombie class to change the stats
Im developing custom command framework
But I need custom TabCompleter logic
any ideas how to remake the Bukkit one?
Well first you would need a reason to do that, then you would need an idea of how it should look
I have system of main command and subcommands
But some subcommands can be registered as separate commands
But when I tried modifying args I was passing to those subcommands, it didn't work at all
So I thought of custom TabCompletor which would detect if its completing for SubCommand or Separate command and modify those args using that information
so far thought of this
tabcompletor is compliting any array you pass to it
you are returning empty list for some reason
well I tried shortening it by 1
aka removing args[0] but it just put instead of removing the argument
Imma send a snippet
also, you want to use StringUtils class
to check what array to return
returning empty list will not tab complete anything
those fields are static if you didnt know
soo?
af
And i feel like it can get very cluttered if you use too many anonymous functions
does Brigadier use nms?
I haven't ever used it so idk where to find it and use it
oh this one ig
https://github.com/Mojang/brigadier
brigadier allows you to do this stuff?
yes
brig reads the cmd stucture and creates suggestions/completions from it (which nms fetches)
hahahaha funiiiii I fucked up big time
I just spent several hours turning a system into a maplist only to realize that to make it translatable I need to make it keyed
rip bozo
this one really sucks
.
reflections
Wanting to make a ReportGUI system. Is it a good idea to just make IDs? So example:
ID:
Repoter: name
Reported: name
Reason: reason
Also I'm curious is to whether or not add online/offline status. How would I do that if? Just make a something that checks and updates every tick or
Updating something every tick is a very extreme approach to anything.
You always want to use events for that. Like the PlayerJoinEvent and the PlayerQuitEvent to determine if a player is online or not.
And what do you mean by "Is it a good idea to just make IDs?"
For what purpose? What is your reasoning? We need more context.
if you are getting this from a config and you dont want to store it under the players UUID since it can get confusing as to whos UUID that is I thought well maybe I can just make a random ID generator instead
Because a random ID is less confusing than a players UUID?
No, just so every report has an ID
This makes more sense. "Report" can be a data class which also implements ConfigurationSerializable.
This way you could have a Map<UUID, List<Report>> in a manager class to keep track of all reports
corresponding to a certain player.
That was a good idea, thanks! Will definitely look into that
Also one more thing, I have been trying to fork a project from GitHub because I like the API very much but there is this annoy bit where it automatically places an item inside the GUI. I have tried removing the item by setting the slot to air etc etc.
But it doesnt work
(Never done forking before)
Well then understand the code and change it to your liking. Then it wont place anything in that slot.
Yeah but how do I replace the repo? Or would I just compile the jar and use that instead
Also, as I look more into the API I cannot seem to find the part with that specific item. It's really weird
fork it -> change it -> compile it
.
im trying to get the smallest divider and it returns bad values all the time, for example the -85918111 in the terminal output divided by 3 (the supposed smallest divisor ) equals -28,639,370.33333333333333333
you can ignore the bottom im just in a rush
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
a b c d e
Very descriptive... which ones are the divisors?
Do you want to find the smallest common divisor of each number?
by smallest divisor youre probably referring to the smallest prime divisor
since the smallest divisor for any integer is 1
common divisor
i specially defined div as 2
divisors are the a b c d e
wait
sorry
divisor is div
i messed up
its late
only 8pm
so you want to get the smallest prime divisor between two numbers?
timezones are thing as well
between 5 numbers but yes
there is no guaranteed smallest prime divisor for an arbitrary 5 numbers
well thats what i need to do. thats the task
Create code that finds the least and greatest common divisor of 5 random numbers (can also be entered into variables by hand).
create random numbers and output them;
while/do-while loop;
check if divides;
we increase/decrease the number to be checked or divided by.
i google translated it so please dont hurt me if something is translated wrongly
What language
latvian
if you scale the problem down to two numbers, if you grab 2 prime numbers the least common divisor is 1, but your minimum is 2
are you sure its least common divisor and not least common multiple?
oh my god java please
I can only do Map.of 10 times
what is this jank
also @echo basalt rate my lines
This line being like "Am i a joke to you?"
that's called the loser line, if you notice it you're a loser
sorry, it's terminal
bruh its it not a varargs
public static <K, V> HashMap<K, V> mapOf(Object... vals) {
HashMap<K, V> map = new HashMap<>();
K key;
for (Object v : vals) {
if (key == null) {
key = (K) v;
} else {
map.put(key, (V) v);
key = null;
}
}
return map;
}
you can do it manually
using this
go get hired by oracle and then fix this
Type safety goes bye bye
well its K, V, K, V, K, V
yeah i get that
but just do runtime type checks
or smth
or dont at all
and wait for some ClassCastException
I would prefer a builder approach at this point. Let me do a quick mock uo
imo all collections should have a builder pattern
or kotlin 🥲
imagine
new HashMap<>()
.put("a", a)
.put("b", b)
.put("c", c);
way to ruin it conclure
shi mbmb
new HashMap<>() {{
put("key", v);
}}

yep lul
thats what were talking abt
mmh
builder then
so they should use a varargs or builder pattern
oh
Lemme buy an ultrawide monitor first this is unreadable
pretty sure you can just create an entry
new Map.Entry<>(k, v) wont work right
ye
?paste
its an interface
I hate that this doesnt work for anon classes
https://paste.md-5.net/evitemegey.coffeescript there, an elegant solution
public abstract class MapBuilder<K, V, M extends Map<K, V>> {
public static <K, V> MapBuilder<K, V, HashMap<K, V>> hashed() {
return new HashMapBuilder<>();
}
private final M map = construct();
protected abstract M construct();
public MapBuilder<K, V, M> append(K key, V value) {
map.put(key, value);
return this;
}
public M build() {
return map;
}
}
public class HashMapBuilder<K, V> extends MapBuilder<K, V, HashMap<K, V>> {
@Override
protected HashMap<K, V> construct() {
return new HashMap<>();
}
}
you have Map::entry
the elegant part of this is that it can be done in seconds using middle click
yeah or implement into the collection itself
when its mutable
just replace the put method to return Map<K, V>
whenever 7smile7 enters this chat, some fancy things happen
it would be epic if the compiler just had some syntax sugar to do that automatically
so you dont have to return anything
it just acts like it does
HashMap<String, Integer> map = MapBuilder.<String, Integer>hashed().append("One", 1).append("Two", 2).build();
owo
yes
no
you said yes before
super.customObjectives.put("Objective13", Map.of("objectiveType", "DIALOG", "filename", "unbinder.yml", "npcName", "Ulfric:", "location", "under the main building", "dialog", List.of("&8[&aUlfric&8]&f If you bring me a very special and rare item, I can unbind your Elite items.", "You don't yet look prepared to take this challenge on, but you can make killing the Binder of Worlds your ultimate goal, if you dare.")));
finally some good fucking code
to the builder pattern
but this ofc works >.<
not to the "owo" - quoted from FourteenBrush
XD
why is there no way to reference the class of an anonymous class from within itself
it's very anonymous
yeah well obviously now it's not anymore
sometimes I forget who I am when I turn on my vpn
Its just "this", no?
I have to declare a type for this
Oh you mean the class
Of an anonymous class
yeah but I wonder, why do I even have to declare a type for a receiver parameter?
if you name the parameter "this", it HAS to be receiver parameter so it MUST refer to the same class
otherwise it wouldnt compile anyway
so javac knows what class I'm talking about even without name
Wait now i see the "this" param
looks like python
ayy lmao I nuked it
this is what I mean
there should be a "placeholder" or keyword to refer to the anon class in this case
but there is none
why do you need the receiver param in the first place if I may ask
In this case, I ofc don't need it, I was just trying to see whether it's possible
Amusing
ah okay yeah it doesnt work sadly
one of these days I will craft a line so long it goes over the discord character limit
is that (HashMap<String, String> this even valid?
ez fix lmao
new HashMap<String,String>() {
{
this.getClass().getMethods().add(new Method("put", this.getClass(), String.class, String.class));
}
};
I mean the receiver param is a thing
never heard of it tho
by the specs of java
That's easy for u
yeah its uncommon because it is rarely needed
You need a real challenge
depends
but essentially, methods are fake
that would be only valid in the declaration of HashMap<String,String>
they are just static functions where the caller object is just the first parameter
PS: If you want to still use the brute force approach that has to use a while loop then here is a working example for orientation:
public static int smallestCommonDiv(int... numbers) {
boolean allEven = true;
for(int i : numbers) {
if(i % 2 != 0) {
allEven = false;
break;
}
}
if(allEven) {
return 2;
}
int largest = IntStream.of(numbers).max().orElseThrow();
int smallestCommon = 2;
div_loop:
while (smallestCommon <= largest) {
smallestCommon++;
for(int i : numbers) {
if(i % smallestCommon != 0) {
continue div_loop;
}
}
break;
}
if(smallestCommon > largest) {
throw new IllegalArgumentException("No common divisor possible for " + Arrays.toString(numbers));
}
return smallestCommon;
}
with a null check ofc
hmm
I feel like this is a poopy java feature... receiver type params shouldnt be a thing.
yeah that's also the only reason I see for them to exist
ain't it a beaut
great thanks. now i have to remake it in php since thats what we learn in school
shouldnt be too hard i think
đź’€
Its a beaut
$
this puppy can fit so many objectives
yeah i know
As beautiful as it gets
and some method names will change but thats mostly it
way better than the old crummy format
this is also weird
Jesus fucking christ
Mister magma..
đź’€
wait, that's illegal
Your code is so bad
it only complains about "might be null" when the first annotation is Nullable, not if it's the second one
you have a typo on "amazing"
Thinking your value, comes out from that

what's wrong with that lol
I came here to see some beautiful code and MagmaGuy ain't disappointing me
so the new code automatically converts the hundreds of quest formats that already existed and selects only the translatable elements to be dumped into the translation file, and automatically reads from those entries for the selected language
👌
this is a coding technique I've invented which I call the gigachad technique
Agreed
Do more
👍
Magma
If you continue like that, Illusion will be forever sleep deprived one day
Because of his nightmares
Just so you know
Hi, how can I wait a bit before continuing a for loop?
like every element it waits 2 ticks
imillusion is evil and I will know my code shone brightly upon this wretched world the day he has a stroke reading my 1-line a* pathfinding algorithm
Sheesh
alright time to dump hundreds of quests on the system and see it work flawlessly first try
14ms
hm
Main thread :)
?scheduling
19 hours to trace damn
stated 19:48:50
that's 0ms babyyyyy
because I am not logging anything under seconds
Thats 0 seconds
#winning
my only regret is not being able to have it take 10 minutes and have a compilation of messages explaining how cool my code is while it does it for everyone online to read
class cast exception? on my code? java must be bugged
Instant complaint straight to oracle
I'm not even reading these logs, just sending them to oracle via priority mail
memory section can't be cast to map
I love how copilot instantly realizes when I'm bored and just plays along
Does anyone know how I could roll back the variables from mysql back to a .csv file in a script? And what are the variables in mysql to be in the .csv file?
what "variables"?
I sent you a link earlier that exports your tables / db into a csv file
baby mfnalex
mysql does not save "variables" in tables but values
I don't know why working with configuration sections gives me a headache
u got a gui api for me? :P
grrrrrrr
I feel like I always end up getting stuck doing configuration section conversions to maps all the time
factoryfactory brrrrrt
Yes mfnalex, but the skript plugin doesn't read it
Me too lol
/**
* Turns a ConfigurationSection into a Map<String,Object> (just like SnakeYAML)
*/
public static Map<String, Object> asMap(@Nonnull final ConfigurationSection section) {
final Map<String, Object> map = new HashMap<>();
section.getKeys(false).forEach(key -> map.put(key, section.get(key)));
return map;
}
what skript plugin? and what does it not read?
Plugin: Skript
and what does it not read?
look
alright it's working now
finally
lmao
the translation file is now a mere 11655 lines, and I don't have all of the content on here
why does TextComponent not work?
it does work
Look, The default variables in script look like this
java.awt?
And after converting
And the server doesn't load them
@tender shard
wdym with "doesnt work"? what are you trying to do?
i searched up how to make hoverable text and saw this:
message.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg XY "));
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(“send private message“)));
p.spigot().sendMessage(message);```
@tender shard ?
no idea what that is or what's it supposed to do. we only do java stuff here, and maybe kotlin. noone here uses skript
and I also don't understand what this file has to do with mysql
what dependencies did you add?
boys, call me todd howard because it just works
if you don'T see the bungee chat classes, then you'Re probably using bukkit instead of spigot
ye, i am i think
how to do it in bukkit?
i have this spigot-api-1.19-R0.1-20220710.051022-43.jar
spigot-api does include the bungee chat classes
?paste your pom.xml
true
dont hav
are you using gradle?
i dont use gradle
then I cannot help you
i just added the file as module
DispatcherConfigurationMethodModelFilter
Actual class name
manually adding dependencies is so 90's
lol
you should definitely look into switching to maven or gradle instead
it's annoying for 5 hours and after that you'll love it
yea but its the same thing...
well I just add spigot-api as dependency to my pom and then everything works
I dont even need to have spigot-api.jar on my PC anywhere, maven handles all of this
true, i tried it once and it was so annoying that i just used the regular
it just works automatically
ik
well it does
the class is just missing
it doesnt work for you because you're using the wrong dependency
somehow
you are using the spigot-api jar instead of the shaded one
only the shaded api .jar includes all the dependencies you need
you wouldnt have this problem if you'D just use maven or gradle
can u send the link plz :3
it's in spigot's maven repo
i dont really want to open another gradle project :3
there is no other official source, except if you build it yourself using buildtools
that's why I suggested maven to you three times lol
?bt
if you run buildtools, you should have some "spigot-api-1.19.2-R0.1-SNAPSHOT-shaded.jar"
that's the one you need
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
lmao
when you run buildtools, it is in YourBuildToolsDir/Spigot/Spigot-API/target/
and it should be around 4.5 MB
NMS without Gradle or Maven is a pain to work with
True
my photoshop skills are so good
There are a few circumstances where not using Gradle or Maven is a better choice, but in 99% of cases that is not the case
Nah, that is the 0%
When you need to have rather fine control over something and when it is simply not worth to learn the gradle API
If you have the jar you can just use that
(On 1.12)
The maven API is nice and all, but the IDE integration is lackluster once you start writing your own plugins
that's what i said
?
Gradle API takes ages to understand
You can use the jar with maven or gradle
mvn install is a thing btw
as a dependency
oh true
Yeah
local dependency
And if you feel lazy, <scope>system</scope> and file://-repositories are a thing
Yeah but that's a bad way to do it
Scope is deprecated, file shouldnt be
Hard-depends on log4j and modlauncher JPMS modules even though it technically does not need to
Just exclude that dependency then?
Then JPMS would complain about missing modules
Super weird question - Is it possible to make a spigot plugin in C/C++, but when compiled it gets compiled into a .jar?
I'm not that good with java
I know its possible to compile C/C++ code into a jar but im not sure if it works with spigot
wdym
if its compiled into a JAR
its already as slow as a regular java program
If anything you'd pack it into a .dll/.so within the jar
But yes it is possible, but you really wouldn't want to do it
I would wait for project panama to complete before working with natives though
NestedVM provides binary translation for Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes.
(quote from stackoverflow)
Well I planned on compiling the code for the java virtual machine. and not as a native app
Correct which means it'd be more intuitive to write it in java and reap the benefits of having access to all the tutorials and help written in java
Which uhm, could take a few years - although iirc preview features start being available from J20
so you mean you want to write it in C/C++ and then compile it down to LLVM bytecode to then translate it to JVM Bytecode?
I know a plugin that uses JNI
Tho i don’t know if thats what u want
well just something that gets compiled for the JVM
You can just use natives you know
Being able to use cpp code, or you mean transpile cpp to java or compile cpp to jvm bytecode?
Although interop with java code is a bit cumbersome
compile cpp to jvm bytecode
?paste
If you can find a cpp compiler for jvm sure, but I’d say that it at best produces a decent result
Instead Id advocate JNI
Or panama
Ye
I mean going from cpp to java is generally not a time consuming process
hey guys, sorry to interrupt anything here but I have on question
I took the source code from the CourierNew plugin (https://www.spigotmc.org/resources/couriernew-a-unique-mail-system.68099/) and I am editing it in a way so that when the player logs in the server, delete the letter in the hand (the code I've done https://paste.md-5.net/nikujefute.cs) but when I log in, the letter it's not delete, it's still on hand
Assuming you’re proficient in cpp
I though it could be easier to make it in C++ since I didn't feel like opening IntelliJ idea
You can also not use an IDE at all, but that is very painful for beginners
Hi, is there a way to tell the server that a player is at position xyz without the player beiing there? Need it for a packet based plugin because chunks will not load otherwise.
wouldn't that trigger some anti cheat plugins? :D
fair enough
why not load the chunks properly through chunk tickets?
Becaus the server still thinks that the player is still at the position where he entered (in my case a packed based car)
The player gets mounted via packets
then you most likely need to use NMS
And set the internal X/Y/Z variables of the player manually.
However in what way chunks can be loaded - idk
Worst case scenario you'll dispatch the chunk tickets yourself
Is there a way to find the correct nms class quickly?
Recaf ig
Why would you
Why would you even use C lmao except for speed
Its what I understand
Lack of experience with java
isnt cpp really similar to java
No
no its not
but java has some small differences
Some things are some things are not
which makes me not want to use it
no its way too different
C++ is C but with all the needed things implemented
APIs are insanely different, syntax and everything else is near-identical
I haven't used C in a while
Different in what circumstance?
C isnt object oriented
- java is oop c is not
We are talking about the programming language
no
tho Obj-C and cpp is
C++ is though
C itself is not platform dependent
it isn't hard to make a C/C++ program cross-platform
C requires manual memory management
atleast what with I've done
Oh wow, such a difference
yes well its a pain
to some extent
Yes
i dont know what to tell you if you think C is similar to Java, of course they have similarities because they're of the same family, but that's all theres to it
memory management is nothing compared to the fact that linking is absolutely cumbersome in C/C++ world
comparing them is dumb on itself
And therefore programs made in C and C++ allow you to manage memory better
better
Java has a garbage collector
maybe more efficiently
they give you more control, that's all
if you suck, you'll suck in both languages
but java has neat garbage collectors, jvm impls and jit compiler
I don't see any reason to learn C honestly
and the new vector, foreign mem, foreing function api
anyone here have experience with buildtools?
yeah, we have much more ram to use compared to back then
It actually teaches you very well how the computer works
and what you are doing
so only that puts C at a disadvantage since you rarely need super optimized mem man
thats true
in which way does it teach you very well how the computer works
its more machine near def
Except for embedded
matter of fact if C didn't exist java wouldn't be there either
mye
embedded goes brr
that's not what we're talking about
but thats not an argument why you should learn C (or use it)
from where did that come from lol
🤦‍♂️
that's like saying kotlin is worse than java because java came first
that's not a valid argument
Maybe because you've never learned C
then explain to me, as you seem like you're pretty good at C?
You're right, maybe the argument before was more fit
this??
No it's not
that's the most pointless argument I've seen about C, I'm sorry
but anyway I do agree learning C would enhance your understandings of how to program closer to the computer
Over why I've learned C
tho Idk if its that needed in today's industry
For any sort of low level development you will probably use C
its fast
You can learn how a computer works regardless of the language
its nice with pointer arithmetic
If you don't know C, then you wouldn't get it
C is still used
well
C++
myeah, altho tbf Id say cpp is still favored even to c
I do know how a computer works for the most part, you should be able to explain it fairly easily
The main reason I personally would use C is sscanf
value -> string in C++ is a pain
std::string or just char pointer
but at a software level?
i mean to stringing like an object
or something
theres no common toString method on C++ objects
or shit like that
of course there are
its fast
there are a few, wouldn't say many
just not for the casual developer
idk how it went from me asking if its possible to compile C++ for the JVM for spigot to a kid angry at me because I've learned C
I'm not trying to offend you, rather, your argument
ok
hey, everyone has their opinions
🤷🏻‍♂️
yeah
Casual developer is a very general term
Replied to the wrong message
that reply is supposed to be to my message right?
would pointer arithmetic work when compiling C++ for the jvm
yeah
Well yes it is a general term, but what I'm trying to say is that, the cases where you really need C are very few
oof C
If done good enough yes
who even uses it
C is used a lot
OS developers
Well, the entire linux kernel is made in C
cries in not object oriented
of course it is, that;s not the topic
Many many projects are made in C
No longer true
Huh?
Yeah, rust
the thing is, maybe if I've learned java first, I wouldn't start with asking the question, but I've been coding C and C++ for so much that It's easy for me
Linus Torvalds is very against the idea of rust in the kernel
it was an idea but it hasn't happened yet
they tested an NVMe driver written in rust
Eh kernel - drivers - same thing
havent heard of rust in the kernel
Without drivers the kernel wouldn't function anyways
yes its part of the kernel
well it runs in the kernel right
its modular
its just a program
or does linux have them compiled in the kernel
Ive never found linux taht interesting tbh
is there really a reason to switch to it
only reasons why I use linux is because of the shitty backdoors placed into windows by the NSA
nah i dont see a reason
just for servers
and the GNU tools
It's not a full fact but there is alot of proof
For development linux is pretty good
fucking pain to get gcc on windows
wow i seriously care about a backdoor made by the NSA
why would they care about me actually
im pretty much a random, the backdoor has no use
Especially sudo alternatives --config java is such a lifesaver on linux
and windows is proprietary
so
Alternatives is the only reason I'd recommend linux for java tbh
I guess I'm just used to using linux and programming in C++
then?
idk why people care so much that shit is propietary
c++ isnt platform dependent right?
idk why, it was funny
yes it is
it is
C++ itself is not
it is platform dependent
well
The syscalls are
depends, most of the time it is platform dependent
so the compiled stuff is platform dependent?
you often need to change code to support different oses
just look at the jvm
code
Talking about JIT?
no
hotspot source
the jvm
it has like 16 quadrillion different files per platform
https://github.com/SerenityOS/serenity/tree/master/Ports/OpenJDK shows that it is pretty OS independent if needed
Only thing lacking is JIT due to reasons
they arent done yet right
It is only compatible with mostly POSIX-compliant systems, but that isn't part of the C++ standard
and im pretty sure serenity os is on the same standard as like unix oses
oh ye posix
but if you want to take advantage of low level features or build anything with OS API code you will have to change some shit around, especially when working with windows
Windows is fucking stupid
why
Implements POSIX syscalls as NOPs
yeah its api sucks
idk if this would matter
dont think it would be too hard to implement posix tho
they couldve implemented it into NT kernel though
If they don't implement POSIX syscalls then don't implement them
There is just no excuse to have execlp be implemented as a NOP
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
void _tmain(int argc, TCHAR* argv[])
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
if (argc < 2)
{
argv = new TCHAR*[]{ argv[0], "javaw -jar starloader.jar" };
}
// Start the child process.
if (!CreateProcess(NULL, argv[1], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
printf("CreateProcess failed (%d).\n", GetLastError());
return;
}
if (argc > 2 && !_tccmp(argv[2], "--console"))
{
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
}
vs
#include <unistd.h>
int main(int argc, char *argv[]) {
if (argc > 1) {
char *args[3];
args[0] = "java";
args[1] = "-jar";
args[2] = argv[1];
execvp("java", args);
}
return execlp("java", "java", "-jar", "starloader.jar");
}
so unnecessary
c syntax weird sometimes
it's syntax is identical to javas syntax for the most part
At least to traditional java, it has changed quite a lot in the last years I have to admit
maybe i should've said the lack of convention
Well that is what naturally happens if everyone believes that they are the authority on everything
🥲
what it does
Nice cli for changing java binary to different ver
change out what java version is used
You can also couple it to a few commands to change the java home env dir to have even more control
export JAVA_HOME=`alternatives --display java | grep "link currently points to" | tr ' ' '\n' | grep -o -P "[\\/].+" | sed -e "s/bin\/java//"`
being exactly such a command
So I'm making a player run a command, however, I don't know if the player is online or offline so I am using OfflinePlayer to be safe. Would errors occur if the player was online?
No, in that case the Player instance would be used
Player extends OfflinePlayer so no worries to be had here
Thanks :)
I'm not
Probably within the command itself
Online player is a staff member that is running a command with the target being an offline player
oh ok so your command takes something like
public void doSomething(CommandSender sender, OfflinePlayer target);
yeah that's no problem ofc
private void punish(Player staff, UUID target, String punishmentType)
yeah that's no problem
Thanks
(but you want to allow the console to also punish players, so dont use Player staff but CommandSender staff 🙂 )
does entity.getName() change when I do entity.setCustomName()? it doesn't seem to add to a team but it might be because of the custom name changing often
It's gui based
xD
getDisplayName() would change I believe
alright so that's
My fault I read it wrong
yes
ok well
that means i would have to remove and add them to the team whenever i change name?
it returns ZOMBIE or similar for unnamed mobs, and "MyCustomName" for named zombies
what are you trying to do?
getName() returns the type name, or, if set, the custon name
can entities even be part of a team? I dont know
apparently
hm no idea
I fucking hate this whole scoreboard / team system lmao
can you not use entity IDs or UUIDs to manage teams and stuff?
i could try lol
people suggested to use the UUID as string
then md_5 asked "what did you try"
and then the conversation ended without any solution lol
hm it looks like NMS teams can only have "Players", no entities?
You can 100% put entities on teams
yeah but how?
well entities can be added
the api docs for Team are pretty shitty
can confirm
and how?
isn't putting entities in teams the way some plugins do the health bars?
not addPlayer
oh okay, someone should PR this to the javadocs
i believe you can use entity name too
wait no
because there is often more than 1 entity with that name
i think names are for players
and uuids are for players and entities?
I believe so
all entities have their own UUID, yes
The scoreboard system is kinda wack, even in vanilla
why doesn't mojang just fix the scoreboards and create it based on the way people actually use it
so in the same way it feels when you shot my dog?
bro what the fuck is this conversation
why dont they stop obfuscating MC when they release the obf maps anyway, or add the mod api they promised to add like 100 years ago
alex infamously shot my dog after I asked for support
he's a menace, a dentist, an oral hygienist
you're a dentist's secretary who gets high on laughing gas in your break time
and shoots dogs
maybe that's why he became a dentist
maybe I watch too much The Office
btw wtf is the impementation of bukkit's Team?
There is no CraftTeam
or my intellij is weird
don't look at the teams code
if you look at it too hard it will crumble away into nothing
probably for the best
there are a few things I will NEVER touch
- custom entities (annoying and enough plugins that do that already)
- scoreboard / teams (vanilla's system is already stupid enough)
- sweet popcorn. just get salty one, like wtf
is it a concern that i've been using java for 2 years and have only just touched completable futures
what about sweet and salty
no
I prefer a kilogram of salt, and no sugar
sweet popcorn is based and I'll hate you if you say otherwise
that's fine, I've been on here for 5 years and I don't even know what that is
just satl
salted caramel
CompletableFutures are great lol
salt > sugar. my kidney stones agree
does the spigot api use them anywhere?
Not sure
i dont think so
Yes
But also spigot api doesn't mass with databases n all
or maybe the PlayerProfile API
PlayerProfile has one iirc
poor coll
yeah what a fucking noob, ikr
ChunkStatus API
shouldn't WorldCreator#createWorld() have one
ChunkSaveTask, some color code
coll isnt noob
or something
should, yes
I’d like to see the ability to load OfflinePlayer’s data via a future
And some more
or is it pretty much instant
how would you explan vector math
There are 2 ways to think of a vector
One is an offset point
The other is an absolute value (offset to 0,0,0)
instead of doing x * y, you do x1|x2|x3 * y which is the same as x1*y|x2*y|x3*y
A vector is basically an offset that applies to a 3D point useful for stuff like animations and all
rotating the vector just means that you're rotating the offset relative to your origin points
vector math is just doing math with more than one number lol
zoom in, enhance
so its not as brain exploding as i thought
Vector1 - vector2 just pulls vector1 towards vector2
Vector1 + vector2 distances them apart
and x1,x2,x3 * y1,y2,y3 is the same as x1*y1, x2*y2, x3*y3
Dot product is just an intersection value, lower the better iirc
and yeah then there's stuff like dot/cross product etc
but the general idea is simple
adding vectors is also extremely simple
(1,2) + (2,3) is just (1+2, 2+3)
Normalizing a vector means that it keeps its original proportions, but the length is set to 1
It internally just divides all values by length
It's useful to scale a vector to a certain length, where you just normalize and multiply by whatever length you want
