#help-development
1 messages · Page 233 of 1
ofc i did
He is saying if the teleport also caused the damage synchronously a boolean before and after would have worked. But in this case teleport simply moves them
yeah
gimme the whole location adapter lol
the same one i sent to you in dm
man if you keep sending snippets imma have a mental breakdown
does that extend TypeAdapter<T> tho or what does it extend?
dunno about that method
ok so i changed my whole methods to Location
How do I even start anything lol
I switched from Eclipse today ;-;
but now for some reason , it stop registering the gson ..
this worked thank you
Theres a an IJ plugin called minecraft dev or smth that’ll help you
no errors tho or anything
man if you keep sending snippets imma have a mental breakdown
is this snippets to yyou xd?
it is
He’s hiding his code so u won’t steal it obviously /s
im just seeing random code
i will sue you if you steal my code
what code do you want exactly?
@twin venture Usually anything related to the issue is needed to diagnose the issue.
i did send everything related to the problem ,-,
just send me the damn code to serialize and deserialize
Np
Emotional damages
Sometimes what you think is everything isn’t everything
iam using this one ,-,
when i use this , and do registerTypeAdapter(Location.class,new LocationAdapter())
gson seems to be stop working ,-,
The other day some guy excluded a class where he looped over a set, somehow the set wasn’t present when he accessed it on the bukkit thread. He didn’t tell us he had another class, everything looked fine.
for some reason , no errors tho
i understand ..
And don’t worry the guys who’ll steal ur code in here is probably some skript kiddies.
and where do you call the gson::toJson
Yes
what do you mean by creating to files
only call file::mkdirs and file::mkdirs when necessary
no need to call parent::mkdirs
It’s fine
He should probably move it to somewhere else tho
That only gets run on plugin start
i dont think its the reason why its not saving the location to the json file
flush and createNewFile most likely does the same thing. Thought he meant that
so from what i understand , Location is an Object , and i need to serlize it so gson can read it correctly right ?
gn
Good night .
uh ig yes?
dunno why your gson instance isnt throwing an exception when coming accross a location object anyway
must be smth with that @Expose
whats the point when you could just not use it and remove the method in your builder
just use transient whenever you dont want anything to be serialized
i will try it thanks
like this
i know .
p.spigot().sendMessage
pls
whats ((Player)sender).getPlayer() supposed to do lol
Player#getPlayer#getPlayer#getPlayer
thats a thing? LOL
so SpigotAPI includes BukkitAPI, right?
<insert IDE name here> moment
netbeans
Intelij
if I'd ever write an IDE, it'd be called JuicyJ and it'd have a grape as logo
New idea
Troll java ide
Write a code to start the ide
Write it as an IDE within an IDE
java -jar java.jar -jar spigot.jar
that would be funny, a JRE packaged as .jar file
in disguise
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
i was gonna ask but i'm just making sure it's not maven
if you have a pom.xml file, it's maven 😄
if you have a build.gradle file, it's gradle.
if you have neither, it's neither lol
lol
i mean if it's maven causing my problem
ok i'm not sure what's causing my problem but i dont think it's maven
cancel-item:
type: 'BARRIER'
name: '&cClose Backpack'
left-arrow-1:
type: 'PLAYER_HEAD'
url: 'http://textures.minecraft.net/texture/3866a889e51ca79c5d200ea6b5cfd0a655f32fea38b8138598c72fb200b97b9'
name: '&aPrevious Page'
lore:
- ''
- '&7Go to the previous page'
- ''
- '&7<page>/<num-pages>'
right-arrow-1:
type: 'PLAYER_HEAD'
url: 'http://textures.minecraft.net/texture/dfbf1402a04064cebaa96b77d5455ee93b685332e264c80ca36415df992fb46c'
name: '&aNext Page'
lore:
- ''
- '&7Go to the next page'
- ''
- '&7<page>/<num-pages>'
white-glass-decor:
type: 'WHITE_STAINED_GLASS_PANE'
name: '&a'
unbought:
type: 'RED_STAINED_GLASS_PANE'
name: '&aSlot <slot>'
lore:
- ''
- '&aYou must purchase all slots before this one in order to purchase this.'
- ''
first-unbought:
type: 'YELLOW_STAINED_GLASS_PANE'
name: '&aSlot <slot>'
lore:
- ''
- '&7Price: $<price>'
- ''
- '&aClick on this to purchase this slot.'
unobtainable:
type: 'IRON_BARS'
name: '&cYou cannot purchase this slot.'
this is a file in my ide
did you open the .jar file with notepad? o0
hm how did you create the .jar?
that's fine
that also looks good
?
in your IDE; does it say "UTF-8" as encoding when you open the yaml file?
One sec
sorry stepped away
it does
can you send your .jar file here?
uhh can i dm?
^^
btw it used to build just fine and all of a sudden it doesnt
I hate Java...
} else if (!users().get("Players." + event.getPlayer().getUniqueId().toString() + ".Name").equals(event.getPlayer().getName())) {
users().get("Players." + event.getPlayer().getUniqueId().toString() + ".Name") is probably null lol
that's why I want to check it if its null or not lmao
because if not player's name execute reset method lmao
u should learn kotlin
phew
nein
Java and C# is enough stress for me with school combined
no thanks
😹
and project is set to be java c.c
ah wait I got how to fix
just check if it's null beforehand?
k
ya thats what I realised to do lol
a simple boolean will do
HOPEFULLY
Yup, time to fuck Java :)
java is perfectly fine
I can't believe this doesn't works...
public boolean exists(Player player) {
if (users().get("Players." + player.getUniqueId().toString() + ".Name").equals(player.getName())) {
return true;
}
return false;
}
check the ones in 1.13
let's break it down
also the ones in 1.8 are incomplete
String something = null;
String somethingUppercase = something.toUppercase();
this ofc won't work
what you want to do is sth like this:
String something = null;
String somethingUppercase = null;
if(something != null) {
somethingUpperCase = something.toUpperCase();
}
the main problem starts at the point of where I need to check if the player already has been on the server, and if not, then give them their stats, or if yes, but their stats are missing, give it back to them from the default.
show a screenshot of your whole project structure
ok
Which looks something like this
if (event.getPlayer().hasPlayedBefore() == false) {
setupPlayer(event.getPlayer());
} else if (exists(event.getPlayer())) {
setupPlayer(event.getPlayer());
}
and the file in resources/1.8/*.yml looks fine in the IDE?
um you call exactly the same code no matter your condition
your exists() method makes no sense
well not exactly
yes I realised lol
it's an else if
both call setupPlayer(event.getPlayer());
lmao 🤣
oh actually I was wrong, the only problem is the NULL thing
if(a) doSomething();
else if(b) doSomething();
if neither is true, it does not do anything
it's the same as ```java
if(a || b) doSomething();
I shoudl use this lol
yeah but in the jar you sent me, 1.8/default.yml is also just nulls
the 1.8/default is nulls
no idea why it ends up with only nulls
im gonna copy the file, delete it and recreate it
@tender shard that fixed it
who tf knows what went wrong
no idea lol
intellij did crash on me once so idk if it got curropted or something
their file looked like this lol
nah
falsefalsefalsefalse falsefalsefalsefalse falsefalsefalsefalse falsefalsefalsefalse falsefalsefalsefalse falsefalsefalsefalse
this is better lmao
I love how it changes the colors depending on what language you choose
I still don't get why can't we get nulls. It would be MUCH easier if we could detect them lmao
== null?
public class Player {
String getName() { return "mfnalex"; }
}
now you can call getName() on every player and it returns mfnalex
but if you do not have any player, because your object is null, then on what object should it call getName() on?
you cannot call methods or fields on "null" objects
it makes no sense
imagine I ask you "yo can you tell me the name of this person?" while you point into the void with your finger
you cannot tell me the name of that person since there is no person
imagine this:
people:
mfnalex:
name: "Alexander"
NeonOwlGery:
name: "Gery (idk)"
Now you can do
String mfnalexName = yaml.getString("people.mfnalex.name"); // this will be "mfnalex"
String neonName = yaml.getString("people.NeonOwlGery.name"); // this will be "Gery (idk)"
String nonExisting = yaml.getString("people.nonexisting.name"); // this will be null
isn't that straightforward?
And this won't cause an error
yes but I need to make new data if it doesn't exists lol
what will throw an error is if you now try to do nonExisting.someMetho()
like adding a third one
yaml.set("people.nonExisting.name", "Someone");
people:
mfnalex:
name: "Alexander"
NeonOwlGery:
name: "Gergely"
Yaml_User_NEMTUDOMKIVAGYOKLOL:
name: "IstilldontknowmynameXD"
I really have no clue what you're trying to do tbh
to set a value in a yaml, you just do myYamlConfiguration.set(node, value)
This ist users file
this file needs users
but if they don't exists
they need to be created
yes but I need to check if the player does not exists in the yaml
otherwise the plugin would not make any sense at all lol
then you do it like this:
only new joining players would have data, and all others would just spam the console
if(yaml.isSet("people.nonExistingUser") {
// The user exists in the yaml
}
alternatively you could just do it like this:
String name = yaml.getString("people.nonExistingUser.name");
if(name == null) {
// They do not exist yet
} else {
// They do exist
}
the last one actually gets stuck where it gets the player name lol
no, it would simply set name to null
and throws.. the f*cking... null error
no
it does lol
it only throws the error if you do name.someMethod() before checking whether name == null
if name is null, you must not use name.someMethod()
🤔
so I need to check it in the join method, eh?
kind of makes sense
but actually no
onJoin:
String name = event.getPlayer().getName();
boolean existsInConfig = getConfig().isSet("people." + name);
if(existsInConfig) {
// load date from config
} else {
// create default data
}
btw, all the get methods also have a default option
for example:
double balance = getConfig().getDouble("mfnalex.balance", 100D);
if mfnalex.balance is set in the config, it returns that, if it's not set, it returns 100
that's basically the same as this:
boolean doesMfnalexHaveABalance = getConfig().isSet("mfnalex.balance");
double balance = 100D; // default balance for non-existing players
if(doesMfnalexHaveABalance) {
balance = getConfig().getDouble("mfnalex.balance"); // This player has a balance set, so let's load that instead
}
there's also the question mark operator for stuff like this:
double balanceOfMfnalex = getConfig().isSet("mfnalex.balance") ? getConfig().getDouble("mfnalex.balance") : 100D;
these three things basically all do the same thing
boolean user = users().isSet("Players." + event.getPlayer().getUniqueId().toString() + ".Name"); still returns a null...
imagine that users UUID is 1-2-3-4
then your yaml does NOT look like this:
Players:
1-2-3-4:
Name: <whatever>
if 1-2-3-4 doesn't exist inside Players, then it returns null, as expected
it should look like that... afaik...
then take a look at your config
config is empty
then obviously everything returns null
that's why they use the UUID
what
no clue
anyway, if your config is empty, then of course every config.get(...) will return null
what else would it return?
welll xd
this is what I want to prevent lmao
and to add them
to not to be null
so next time their stats won't reset
🤔
again, let's make it easy. imagine you want to get their money when they join. or 0 when they haven't joined yet
double balance = getConfig().getDouble(playerName + ".balance", 0.0D);
mfnalex:
balance: 20
now it returns 20
if the config is empty, or it doesnt include "mfnalex", then it returns 0
-braincrash-
tbh it's extremely straightforward in my eyes
i bet you have 100 years of Java experience
lmao
or if not 100
over 5
well I need to say I don't
so I can't imagine the code
😫
and I am tired af
but what exactly don'T you understand?
maybe you should go to sleep and think about it again tomorrow 😄
the whole thing 😹
do you know what a hashmap is?
well then you didnt understand it
and stats has to be permanent
e.g. in a phone book, the key is the name, and the value is the phone number
no sense
mfnalex: 12345
someoneElse: 23456
mfnalex is the key, 12345 is the value
now you can do
String numberOfMfnalex = myPhoneBook.get("mfnalex");
now numberOfMfnalex is "12345"
this makes sense, right?
(I changed it to String, otherwise I have to explain what auto unboxing is)
habááááááááár.... I could set the UUID and the stats as well...
Use getOrDefault then you'll never have nulls
Now imagine you do this
String numberOfNobody = myPhoneBook.get("person that does not exist");
numberOfNobody is now null, since the phone book doesnt have a number for this person
yeah I explained this above three times with the example of YamlConfiguration's get(String path, Object defaultValue)
it simply.. does not exists
and now I feel complete shit ;-;
what does not exist? getOrDefault on your config?
meow
yes, it's just called get(...)
getOrDefault is a HashMap method
boolean user = users().get("...", false);
that would return nulla as well
this returns the stored boolean, or false if it's not set
booleans can never be null because of auto unboxing
I didn't know it can have a false lol
I explained this here
I simply didn't understand ;-;
Something something = getConfig().getSomething("mfnalex.something", defaultValue);
and that's why I feel complete shit ;-;
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.
no offense
and now it hurts me what an idiot I am ;-;
we all started somewhere, but it's really important that you read one of those tutorials
otherwise you'll always feel like an idiot
But they explain it perfectly
only if you understand it ;-;
my stupid brain doesn't even understands how to use the docs lol
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
a good opportunity to learn the spigot javadocs then?
is all good but as said, I don't get how to use them
like ok
abnd constructors
it explains what they do
you should have enough programming fundamental knowledge on how to apply that though
if you need use examples specifically look for that
Gets the requested Object by path, returning a default value if not found.
this is what get says
yes
meanwhile the plugin still returns null 😹
even tho I added false ;-;
the path is e.g. "mfnalex.name"
if you do
String name = getConfig().getString("mfnalex.name", "Alexander");
then name is "Alexander" if the config looks like this:
mfnalex:
name: Alexander
if "mfnalex.name" is not part of the config, it also returns "Alexander" because you defined that as default value
okay bad example
boolean user = (boolean) users().get("Players." + event.getPlayer().getUniqueId().toString() + ".Name", false);
I probably f*cked up here
I think I should not use booleans
but that makes no sense
you do not store a boolean in the "Name" field in your config
you would use getString
somehow booleans sticked to me c.c
a boolean is always only true/false
booleans also can never be null, because they are "primitives"
eeeh
String user = users().get("Players." + event.getPlayer().getUniqueId().toString() + ".Name", event.getPlayer().getName()).toString(); - that should be it... doesn't it...?
(.toString() was forced btw xd)
both toString()s are useless unless maybe you use paper api
but they also don't hurt
oh you mean the last toString
yes
yeah that's because you still use get() instead of getString()
UUID.toString is needed
get() returns an Object
because I don't want stupid looking stings xd
lol
String userName = users().getString("Players." + event.getPlayer().getUniqueId() + ".Name", event.getPlayer().getName());
this returns their stored name, or their actual ingame name
yeeeeah but IDE detects this as an error
but only if your config looks like this:
Players:
1-2-3-4:
Name: "mfnalex"
show a screenshot of the whole line including the error
you should really read a java tutorial if you don't know why you cannot store an Object as a String
turns out to be still glitched... -.-
String name = "mfnalex"; // Okay
String name = new Object(); // Not okay, an Object is not a String
getString() returns a String, get() returns an Object (could be anything)
eh
so um
String user = users().getString("Players." + event.getPlayer().getUniqueId() + ".Name", event.getPlayer().getName()); - this sets the default string if not found
well it sets your "user" variable to either the saved name, or the actual name
but it will never change your actual config.yml file
seems a bit redundant
why?
wont the user be the name anywa
not if they have a different name in the config
ik, but after that, the plugin would check if users exists or not with a method if the name is the same or not - which probably is a very bad idea lol
but the line still returns a null 😔
even tho its set 😫
it's not set. what does your users() method even do?
public FileConfiguration users() {
return usersFile;
}
yeah okay
and where do you set what usersFile is?
then reloads just to load it
when loading the plugin
inside DataManager
its the same as Settings
which works
so its not the problem of the users method or file
if one works, and the other doesn't, then it cannot be the same
its the problem of detecting non-existent players
atm I kind of started questioning if I even loaded the file lol
-.-
file is null
I have this code I try to use to kill all of the entities that are an instanceof PiglinBrute in the world "nether" but it does not work:
for (Entity entity : Bukkit.getWorld("nether").getEntities()) {
if (!(entity instanceof PiglinBrute)) {
return;
}
((PiglinBrute) entity).setHealth(0.0d);
}
Things I know because I tested: The method does run, the world is named nether, and the entities I want to kill are piglinbrutes. No piglin brutes are killed even though I want to kill all of them. Does anyone know why this does not work or another way I can do this to kill all mobs in a specific world?
(TRIGGERED)
getEntities() only returns entities in loaded chunks
ohhh
if the chunks aren't loaded, you cannot kill them that easily
hm
the server simply has no knowledge about entities in unloaded chunks
does the mc cmd /forceload keep them loaded or not?
i don't know about that command but you can use chunk tickets to force chunks keeping loaded
declaration: package: org.bukkit, interface: Chunk
I guess keeping an entire world loaded is not a good idea...
myChunk.addPluginChunkTicket(myPlugin);
they are in like a 20x20 area
this makes myChunk keep loaded until you remove that "ticket" again
from normal X,Y,Z coordinates or from chunk coordinates?
Location loc = new Location(myWorld, x, y, z);
Chunk chunk = loc.getChunk();
this however will force-load the chunk right now, blocking the main thread
I have no idea what that means
it means that when you do this, the chunk gets loaded RIGHT NOW and the server "hangs" until it actually loaded that chunk
this is no problem if you do this during startup, but you should do this while the server is actually running
good news:
setupFiles();
String user = users().getString("Players." + event.getPlayer().getUniqueId() + ".Name", event.getPlayer().getName());
if (!user.equals(event.getPlayer().getName())) {
setupPlayer(event.getPlayer());
}
this makes the nulls go away
bad news: file is still empty 😢
but I guess I will just struggle thour this
oh wait I did a big mistake I guess
yea, im standing in the chunks, like 10 blocks away from the only spots mobs can spawn and are and its still not killing them
Also users() should either be getUsers() or getUserFile(), Chapter 3, article 1, "name conventions" - Advanced Programming and Java Fundamentals Book
oh I see
you return inside the for loop
while you should continue
ohh im stupid xd
you basically quit your whole method as soon as getEntities() returns a non piglin
that makes sense
just use continue instead of return, then it should work
very yey no matter what I name it it will return NULL
Guess I am gonna hit Java
in its stomacs
so liek this
for (Entity entity : Bukkit.getWorld("nether").getEntities()) {
if (entity instanceof PiglinBrute) {
((PiglinBrute) entity).setHealth(0.0d);
}
}
that works too, sure
k
thx
good night
btw
your patience is strong
so
at the time I wanna thank you and sorry at the same time 😅
what is null?
Cya mfalex
Same question tho
either the file
I dont know if his file object is null or what he is getting from config
or me
or idk
so
temp data is set
with getString(izé, defaultdata)
but when getting
still returns null
even tho a default non-found data is set
Chapter 4, article 4, "Primary Debug" - Advanced Programming and Java Basics Book
That is how you should do when something is null
I ain't advanced guy
I shall recommend reading about primary debug its really important
can you show some more code/your config?
it returns null then it can't find it
mfnalex literally told me four times
until for the last time
I finally udnerstood
that adding a second argument
I dont know why people dont first learn the lang and things were they are coding, to finally learn apis 🤔
Temp data is not saved to file
ik
That why its temp data
🤔
So if you are not saving that temp data to file, when sever goes down dow, data goes down tho
but I am just able to check if temp data is same as something else, don't I? .-.
Share full code bruh
You are making me getting stressed
💀
You just chill bro
just chill
I am more stressed atm
and not because of my code
?paste
I mean i really get stressed with new ones, because they dont first learn the java lang itself and then do apis stufff 🤦♂️ 🤦♂️ 🤦♂️
Of course talking in general, not saying it for you
Okay some recommendations its really important when you are coding
I woudl straightly suggest not mixing logic
did you remember to set your values before getting it...
in the Config?
Yeah i asked that tho
I think he never saves them to file, before trying to get them
this is what getString(string, missingStringReplacer) is used for
null cannot be saved
new players need be saved
Édes faszom 😫
Must speak english BRUh
Why is the onJoin using "Players." as the start of the key, but in the setupPlayer it's using "User."?
👍
or wrong path
maybe that's the issue.
Indeed
ohfuck
If you don't notify me I won't notice it
fr
xd
WÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Logic should be divided/splited in different class to have better coding and easier self understanding
Cursed code
I usually do that only to menus lol
I wouldnt learnt good practices without the actual i have
I either hate statics, or referencing so nothing makes sense imo 🤪
Also the book its not new, it has like 6y so imagine hahaha
Code splitting != statics?
Seriously have you learnt basis java?
idk
also, for things like
getUsersFile().set("Users." + player.getUniqueId().toString() + ".Name", player.getName());
getUsersFile().set("Users." + player.getUniqueId().toString() + ".ActiveParticle", "NONE");
getUsersFile().set("Users." + player.getUniqueId().toString() + ".ActiveGadget", "NONE");
getUsersFile().set("Users." + player.getUniqueId().toString() + ".ActiveHat", "NONE");
you should prefer using a ConfigurationSection to not repeat yourself and it's less error prone.
Yeah, Chapter 1, Article 8, "Good practices" Advanced Programming and Java Basics Book
The book specified it tho in the main chapter tho
I know, but internet has thousans of things
principles
I think that this society is full of lazy people who really think they are programmers, but who have never in their lives spent hours and hours studying the language in which they program. I consider that a programmer is the one who really understands what he does and how he does it.
many skip the learning part too
Depends on everyone's mind. Also: LAW decides who is a programmer, and who is not.
yeah that why, all this problem happens
There you are wrong
LAW doesnt say who is programmer or not
It does. 🤷♂️
people who have no ide how the languages work or how the code computes
You can tell how you can programme, unless law didn't verify you, you are not a programmer.
you mean degrees?
Yeah but he is wrong
there is freelancers
He doesnt really understand the programmer concept
A programmer can be anyone
<"A programmer is a professional who is in charge of writing, debugging and reviewing all the source code of a computer software to make it perform certain tasks, or even to improve it, incorporating new functions to make it a more complete and efficient tool"
- Taken from the bootcap im taking part
there is jr devs etc
Yeah but the concept of programmer is that
Tell this to my mum... 😆
Programmer is anyone who can write, debug and review code
varies and skills
BRUH first get personal opinions and then you can argue
I argued
She "won" because she knows it better
-while she does not even do code anymore lol-
and like
"many" of her friends told her
which you know what does returns?
"Life is a piece of shit"
🤡
I dont know what means that argument but okay
He must me a child which have lot of things to learn in life
how much different is it really from writting like being an authers?
you can't be author because you're not verified
Do you think I don't know? 😆
sounds restricting
bruh anyway if you two want to break my soul do it in another way
ok easy
?learnjava
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.
-altough its almost broken but you still can break it lmao-
That's just rude instead of soul braking lol
*spaghetti
that's what we are talking about
bruh
...
Studying at a school does not really define you as what you study.
What defines you is the knowledge you actually acquired.
You may have finished your degree but you didn't take it seriously so you don't know anything.
- From our bootcamp programming instructor
Spaghetti code is a pejorative phrase for unstructured and difficult-to-maintain source code. Spaghetti code can be caused by several factors, such as volatile project requirements, lack of programming style rules, and software engineers with insufficient ability or experience.
that is actually I agree to
and yes english mine is good very
lmao
most stuff learned is school is probably unused in life
depends what studies and what you need it for
Math is very good!
why tf would I calculate my sleeping? xd
how tf can I even do that lol
what is sleep
it is, unless your teacher becomes a crazy bitch, and tells you sleeping requires math
Programmer doesnt mean what sleep means, i agree with that
what
i guess you could skip all that and become a labor worker
bad english sorry
"Programmer doesnt mean what sleep means" - I kinda need to figure out what you wanna say lmao
If I only was interested in chemystry...
yeah what i said "Programmer doesnt mean what sleep means"
but not anymore
to have a good schedule
I simply don't have motivation for anything anymore
so you mainly wont be any in life
yes
In these life only money people have preferences
nice try
Bot? xd
did GodChiper change itself it a bot?
That's what my parents tell me, "If you don't study you're not going to be anybody in life, just another one of the crowd. That's why you have to be educated or have money to be somebody in this world of lazy people and planeros".
By adding a new recipe can i get from the recepie the water bottles empty back when yes how can i do that?
what I tell is that we are the only fucking creatures to pay to live
he confuses me with a bot because i am superhuman
Please... don't f*ck their brain...
MINE WAS ENOUGH
STOP IT
NOW
😠
kid go to sleep
yea
by giving them manually back
i'm here to help people
I wasn't meaning to stop helping them...
root@GodCipher/$ shutdown -s
RIP
MEME
This actually felt good for some reason 🤣🤣
thats what she said
WHYYYYYYYYYYYYYYYYYY?! XDDDDDDD
Custom Crafting
yes
fhú baszd ki instead of fucking my brain here I am gonna fuck my brain with my code 😆😆
setResult
declaration: package: org.bukkit.inventory, interface: CraftingInventory
i gotta dip
late on sleep
work and stuff
why is it a interface? is there a difference to do then?
yeah, saying that programmers doesnt know what means sleeping
nvm
that what happens then you're too stuck up in a project
who said I am tired? 😐
How should i add this bcs it is an inteface and never worked with them
say that to the working people
Ok u
in 1.19, swords when they hit mobs hit multiple mobs if u have cooldown all the way gone, is there a way to stop this?
btw I fixed my error lmao
Essentials support
private void spawnEntity(Player player, Location location) {
//https://wiki.vg/Protocol#Spawn_Entity
PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SPAWN_ENTITY);
packet.getIntegers().write(0, Integer.MAX_VALUE);
packet.getUUIDs().write(0, UUID.randomUUID());
packet.getIntegers().write(1, 51); // magma cube 1.19 id | https://wiki.vg/Entity_metadata#Mobs
packet.getDoubles()
.write(0, location.getX() + 0.5)
.write(1, location.getY() + 0.5)
.write(2, location.getZ() + 0.5);
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
Am I missing something why is that code spawning a allay?
instead of a magma cube
because u don't google stuff
Pretty ironic because I explicitly linked 2 references in my code that shows me following the documentation for the packets
bro you're literally dumb it's going in in alphanumeric order
"Magma cube 1.19" If you googled for 1 second you would understand it changed in 1.19
You are making yourself look like an idiot right now
no i'm not
LOOOOL
bro just stop typing
you have no idea what you are talking about
You randomly called me out when your obviously wrong
but i'm not
@buoyant viper
let me help you out again because you don't like to listen to your own advice and "google stuff"
i actually did google it but didnt get the right results
i was also at work so :P didnt have time to look look
packet.getEntityTypeModifier().write(0, EntityType.MAGMA_CUBE); fixed the issue
You're welcome
you didn't do shit lol
🧌
Can anyone help me with this postgresql error? https://paste.md-5.net/upijudenoz.nginx I dont know where I reference "abc" as a column
INSTERT INTO stats (ID, COINS, XP, LEVEL, KILLS, DEATHS, TOP_KS, PRESTIGE, REBIRTH, PLAYTIME, TALENTS, ACHIEVEMENTS) VALUES ('UUID', 0, 0, 0, 0, 0, 0, 0, 0, 0, "abc", "def");
that's what I want
try using 'abc'
Kk
since double quotes shouldnt be used for values
'' will do a TEXT value right?
does anyone know of a good way of de/serializing class subtypes onto an item's persistent data container
i have multiple subtypes for one custom item class and, for now, i have to register each subtype in gson for it to recognize all types it should be searching for, but i feel like there's a better way to do it
i've looked into type hierarchy and factory adapter's but they don't seem to fix my issue
np
i do everything bitch
I have a combat system made by my plugin on my server with named entities that you kill. When you kill them, it spams the heck out of the console. Anyone know how to fix this?
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
at net.tazpvp.tazpvp.utils.data.PlayerData.getInt(PlayerData.java:64) ~[Tazpvp.jar:?]
at net.tazpvp.tazpvp.utils.data.PlayerData.getInt(PlayerData.java:55) ~[Tazpvp.jar:?]
at net.tazpvp.tazpvp.utils.functions.ScoreboardFunctions.newLine(ScoreboardFunctions.java:75) ~[Tazpvp.jar:?]
at net.tazpvp.tazpvp.utils.functions.ScoreboardFunctions.initScoreboard(ScoreboardFunctions.java:56) ~[Tazpvp.jar:?]``` im so confused on what this means?
theres a setting in the server's spigot.yml
ah ok
its called log-named-deaths
thx, I found it!
Integer cannot be cast to String
That's not casting
Try String.valueOf(integer) + "" 🤷
yus my savior
then make it castable
You're castable
Your casteble
people.get("adele").setPartner((Girlfriend) people.get("hannah"))
Friend friend = (Friend) person;
inb4 cannot cast 'TestClass.Person' to 'TestClass.Friend'
im not sure why it dosent work the log is clear
else if (
(action == Action.PHYSICAL) || (event.getItem().getType() == Material.GOLDEN_APPLE)
&& (event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + "~Angel's Apple~"))
) {
ItemStack item = new ItemStack(Material.GOLDEN_APPLE, 1);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.GOLD + "~Angels Apple~");
itemMeta.setLore(Collections.singletonList(ChatColor.GRAY + "A Golden Apple that has been blessed by the Angels"));
item.setItemMeta(itemMeta);
player.getInventory().addItem(item);
Should work
Also show me that you’ve tried debugging it yourself and how you’ve tried for more help
oh.
Person is not always a friend
wait
i copied inspired my code from some forum post, and dint use Action.Right_Click oops
Well there is an “or” there so it didn’t matter much
@pine island Tell me is this the same
“Angel’s apple” and “Angels apple”
😉
Here u go, always liked this blamechain
its concerning if it works first time
i tend to check my spelling before i blame myself
How do I get the day number from Date? Like fot example, today is 25/11/2022, and I only want to get the 25, how can I do that?
Do you mean like "25/11/2022.split("/")[0]?
Ah I already solved it, thanks anyway.
No problem
wrong. its always the ide or environment
hi there - anyone have a suggestion for loading a treasure chest in a random location? trying to revive an old plugin of mine, and running into some perf issues. looking for some inspiration 🙂 previously opted for a super naive approach of grabbing a location within a set of X/Y/Z ranges and checking the block above and below (essentially: above = air, below = not air), but this is too slow. wondering about better approaches, maybe someone has an idea
just generate a random XZ and get the highest Y at
then add 1
or you can use your approach but make chunksnapshots n all
oh, TIL about that method. super rusty, been out of the game for over a decade 😅 . this seems good, but then it would always spawn on the surface. would be cool if it can spawn underground too. perhaps I can adopt the approach and just start at 0 and add one from there, should be fast enough I suppose
not familiar with this, but will go snooping in docs, thanks!
if it is a treasure chest, why is y essential?
if anything, I would clamp the y value to an arbitrary range that most times doesn't contain air
i just figured air above the target would be something more natural, so ideally landing it on surface or somewhere in a cave
otherwise it could be lodged in random block that would have to be mined at random
well it is your plugin, but to me if it is a treasure chest I don't see this a problem
except people not finding it, however this is where I would probably introduce treasure maps that help lead to it
ah, yeah I see your perspective. but as you have identified, yes I am trying to make it a treasure hunt, and so I think it would be easier to try to target areas that are more open
but if you really want to just spawn them in caves, I think caves are structures now in the game If I remember correctly
if that is true, could just use the structure api and thus will provide the y clamping range 🙂
ah okay thanks I will look into this as well 🙂 between that and the idea of using chunksnapshots, i think one of them will work out nicely. thanks!
caves are not structures
ancient cities, mineshafts, strongholds etc are structures. but normal caves are just created from the normal noise generators and stuff
why not just grab a random X/Z pair, then go from y = world.minHeight <= 64 (or world.getHighestBlockAt), then save all blocks in a list that you think are suitable, then get a random one from that
and if you don't find any, try another X/Z pair
I'd do it like this
private static final int MIN_X = -1024;
private static final int MAX_X = 1024;
private static final int MIN_Z = -1024;
private static final int MAX_Z = 1024;
private static final int MAX_TRIES = 10000; // After this many tries, give up
public static Block getRandomPossibleChestLocation(World world) {
List<Block> possibleLocations = new ArrayList<>();
int tries = 0;
while(possibleLocations.isEmpty() && tries < MAX_TRIES) {
int randomX = ThreadLocalRandom.current().nextInt(MIN_X, MAX_X);
int randomZ = ThreadLocalRandom.current().nextInt(MIN_Z, MAX_Z);
int highestBlockYAt = world.getHighestBlockYAt(randomX, randomZ);
int lowestBlock = world.getMinHeight();
for(int y = lowestBlock; y <= highestBlockYAt; y++) {
if(isPosibleLocation(world.getBlockAt(randomX, y, randomZ))) {
possibleLocations.add(world.getBlockAt(randomX, y, randomZ)));
}
}
tries++;
}
return possibleLocations.isEmpty() ? null : possibleLocations.get(ThreadLocalRandom.current().nextInt(0, possibleLocations.size()));
}
private static boolean isPosibleLocation(Block block) {
if(!block.getType().isAir()) return false; // Block above must be air
if(!block.getRelative(BlockFace.UP).getType().isAir()) return false; // Chest block must be air too
if(!block.getRelative(BlockFace.DOWN).getType().isSolid()) return false; // Block below must be solid
return true; // All good
}
except that I'd also fix the typo
do you even need the list
yes
otherwise the chest would always be at the lowest or highest free space
but I guess it should be random
I just wasn't sure if some of the caves were or not
thanks for clarifying they are still not, but mineshafts however though could work
I just checked the wiki, I thought maybe those crystal caves were structures
that is what I was thinking
but it seems like those also are not structures
https://minecraft.fandom.com/wiki/Generated_structures I just took a look at this
funny that buried treasures are structures lol
I mean, they are only one block lol
that is....interesting
the reason is probably so that the maps can "locate" them using the structure finding thing
yeah, but the structure finding thing is so horribly coded
idk I havent looked at it lol
I don't remember who it was but we were looking into how the game finds structures
and its very horrible and a source of lag
it does a search in a very inefficient manner
it has to do with how the game stores structures
it does look a bit creative
see the iterating is the part that is actually pointless
and where it causes it to bottleneck, and if they had just stored in the chunks the positions of the structure in that chunk, you wouldn't need to iterate
game knows ahead of time at generation where a structure is or is not, and can save it appropriately in the chunk file lol
who wrote this horrible mess?
The eye cancer I got from the first look at this code just increases the longer I'm looking at it
I mean, it is decompiled tho
I ran buildtools, how can I import NMS using maven?
don;t unless there is no alternative
Why would I use NMS if I didn't need to?
then depend on spigot not spigot-api
Oh does it automatically install on my local maven repo?
jeff comes in clutch
The requested profiles [remapped] could not be activated or deactivated because they do not exist.
How do I even deal with that
That error comes up when running buildtools
java -jar BuildTools.jar --rev latest --remapped
?
what if you try it with setting a version
same error
does BT continue to run?
if so, ignore the error
Elgar you are aware that I would've not posted the error if it continued?
I put my --remapped before the version
crash?
mine %cmd% -jar BuildTools.jar --generate-source --generate-docs --remapped --output-dir .. --rev %Input%
simplified java -jar BuildTools.jar --remapped --rev 1.19.2
works fine
doesn't work
your BT old?
just downloaded it
I just downloaded latest BT and ran it, runs fine
jdk-17.0.1.12-hotspot
java 19.0.1 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
I don't use 19 so can;t test with it
downloaded it rn
running it
maybe I can try with an admin cmd
still doesn't work
delete everything and start from scratch
did
restart
my pc?
throw PC out window
^ that if restart doesnt work
Nah I just bought it lmfao (well a year ago)
instructions unclear, jumped out of the window
so buy a new one. already too old
?paste your bt log
Hey, so I'm creating a playtime rewards system, and in the config you can define on what hour the player will receive the reward, and I'm struggling on how to get the next hour reward that the player can achieve, how can I do that?
<time of the player> + 1h?
or what exactly do you mean
Well, there is a possibility that the reward will not be per hour.
for time tracking you would need a timer for every second or so anyways
rewards:
1:
rewards...
4:
rewards...
and so on..
This is the example of the config.
Let's say the player just joined the server, how can I get the next available reward for playtime?
In this case I want to get the rewards from hour 1.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
md-5.net paste wasn't pasting
Do I need to increment player's playtime by 1 hour till I found the next available reward?
get the stuff from the list?
if you want to frequently look if the player has reached X amount of playhours, you will want to cache the stuff anyways
so you probably will store it in a map with the hour as the key
I just installed 19, runs fine
then you simply sort the map
then you know where the player with his current playtime is and what would be his next
TreeMap
Okay, that make sense.
bad performing
if stuff only gets inserted when loading the file it doesnt matter anyways
it does
you will probably have to iterate multiple times over it
in most cases negligible but still
would rather use a linkedmap and sort them in
lol
does somebody know what this means? class file has wrong version 61.0, should be 52.0
easier way to do this
use the statistic of time played
it keeps track of how long they have been playing on the server overall 🙂
no need to store it or do anything fancy other then converting it from ticks
@summer scroll
since this is also relevant to you
You're compiling with the wrong version of java. The server and your plugin are using different versions.
it means you are trying to run a plugin that was compiled for a higher version then the java version being used to run the server
thanks works now
i make a plugin with Custom minecraft recipes and i have a crafting recipe where i put a water bottle in and then other stuff the water bottle should be after the crafting be empty
Smh
Hello, as my project is growing I started to suffer from the big constructors annoyance. I do use the builder pattern and adhere to SRP, but sometimes it's impossible as demonstrated by this command: https://pastebin.com/nvtZESCp
Should I use a DI framework to get rid of constructors that need boilerplate dependencies?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

