#help-development
1 messages Β· Page 46 of 1
Yes, that is a good refreshing start
Please just show your current code
thanks
okay so you have a command that gives you a backpack, right? and that item should have "I said HES THE GOAT" as lore, right?
but it doesn't have this lore - is this correct?
yes
okay, that is weird, because the code you sent should actually show that lore
Yeah...
sorry to ask this, but have you tried to actually stop your server, install the "new version" of your plugin, and then start it again?
private boolean placedCustomStructure;
@EventHandler
public void onStructureEvent(StructureGrowEvent e)
{
if(e.isFromBonemeal() || placedCustomStructure)
return;
e.setCancelled(true);
StructureManager structureManager = Bukkit.getServer().getStructureManager();
Location location = e.getLocation();
List<Structure> structures = new ArrayList<>(structureManager.getStructures().values());
Structure randomStructure = structures.get(new Random().nextInt(structures.size()));
placedCustomStructure = true;
randomStructure.place(location, true, StructureRotation.NONE, Mirror.NONE, -1, 1, new Random());
placedCustomStructure = false;
}
This let's the server crash with
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Chunk wait task info below:
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] 13,22 in 'world:
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Load Task - none
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Save Task - none
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Chunk Holder - non-null
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Chunk Status - minecraft:empty
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Chunk Ticket Status - minecraft:structure_starts
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Chunk Holder Status - null
[15:16:59] [Paper Watchdog Thread/ERROR]: [com.destroystokyo.paper.io.PaperFileIOThread] Chunk Holder Priority - 44
No, it does update how i'm doijng it but no harm in trying
please try to actually restart it properly
the /reload command can be VERY WEIRD sometimes
Lol yeah, worked aha
love you
one day, I will be made a moderator π

I don't want to insist, there are many who ask for help and few supporters, when someone has a little time, look #1005824446164127745 π
/reload is handy sometimes, but if you actually encounter any "werid bugs", then just restart properly π
but that is probably not today
Now its shows no border at all on the first player that's joins,
WorldBorder wb = Bukkit.getServer().createWorldBorder();
wb.setCenter(new Location(p.getWorld(),(is.chunkX*16)+8,0,(is.chunkZ*16)+8));
wb.setSize(Island.getIslandSize(p));
p.setWorldBorder(wb);
I can make you a moderator on pornhub's discord if you want to
lol
delay it by 1 tick
maybe
yeah I'm staff myself there lmao
Bump
good sugestion
not sure if that would be useful for me lmao
probably not lol
porn is L
I just became staff there to ban homophobic jerks
I just want to be on the spigot staff team so that I can say that I have been both Bukkit and Spigot staff member π
Why are we talking in the help channel 0_0
i will vouch for you frost
currently they don't accept any applications π₯²
I don't need vouching, md_5 knows who I am very well π
I applied for staff on spigot twice but was never accepted
But I nag md5 via email like every week so he probably at least knows me by now, lol
md knows me because I have been following the spigot project for a long time, even when I was a bukkit staff member. In fact, md_5 has helped me on more then one occasion on some things
Lets build it again xD
md_5 is an awesome dude
well depends on the time period
there was a period of time I would say where he didn't have such a great attitude towards some, but in grand scheme it made sense
but choco is cuter
yeah well
sometimes you just can't take it anymore lmao
but he started spigot project while fairly young so I mean a bit of immaturity was bound to get mixed in etc π
how old was he
yeah sure
18 or 19 or sth
if memory serves correctly I think he was like 15 or something
what is your age?
Anyone? Instead of talking about useless stuff
you have to understand that we're also "only humans". Someone will reply to you as soon as they know the answer
Ok I will wait, ping we ASAP
oh yeah, I fear that you cannot change the "own player's skin" that easily
yeah I was almost correct he was older so like 16 or 17 when he started spigot
the client probably simply doesnt query the server "was my own skin changed?"
oh yeah, so we were both wrong lol
you have to resend the playertab packet to everyone
you said 15, I said 18, but it was actually inbetween lol
otherwise the easiest way to change player skin is to re-log
I doubt that this will change the "own player"'s skin
not sure though
yes, because the clients cache that packet since the player tab packet for a particular player is never sent again until they re-log
yeah that's what I figured
maybe teleporting the player to another world would update the skin
anyway, frostalf, where have you been? I haven't seen you here in months
because we live on two different continents
I know but I'm usually online at very weird times lol
indeed, but it hasn't been months since I been here either
I was here last week. Friday-Sunday is my day offs and I work at night
alright, then we just missed each other everytime lol
what's your job again? I forgot
I am a tire technician. I change out tires on semi trucks and trailers as well as dismount and mount them on rims if need be. Most of the time it is super singles I do that with
Would multiple BoundingBox.contains() be less effective than sqrt distance formula?
I am also the one they come to if they have any questions about a tire
oh whut. that's some very interesting, kinda specific thing haha
yes
but
don't worry about it
negligible?
just do it. If you'd ctrl+B into the entity class and then look at the tick() function, you'll see that vanilla does so many useless things, you really don'T have to worry about doing a bit of math yourself
ah sweet
Yep, I don't do much else on the trucks or trailers. Mainly just tires and they pay me $20.50/hr + 10% of pay for working night 40 hours a week to do this.
that sounds good. I'm currently trying to become a flight instructor but it's a hell. Like, Everytime I think "okay, 2 months to go and then I'm done", they come around and tell me "Oh but you also need this weird license as well, you know?!"
and I'm always like "oh, no, I didnt knew that, lol"
I work Monday-Thursday 7:30pm central time to 6am central time. So 10 hour shifts lol
I am guaranteed 40 hours a week as well
how many "paid days" of vacation do you get, if I may ask?
that means even though they have no work for me, I just sit and do nothing π
I earn like 2 days of PTO a week
haha but isn't that totally boring?
I once was an intern in some software / coding company
Yes but I can't just get sent home either otherwise I make no money that day
and "doing nothing" was way worse than actually doing sth
in germany, you basically simply get paid per month, and you get about 30-40 days of "paid time off" per year. And on weekends, you don't work anyways
it comes out to like 96 hours a year if I take no day offs
so I wonder - if you say 2 days per week, is that "additional" to the "you dont gotta work on weekends" thing anyway? or do you basically "use" those 2 days by not working on weekends, every week?
but I don't really need day offs unless something comes up. But my schedule is flexible too, there is 3 other days I can swap my shift with
Isnβt that like 4 days a year
I probably explained it badly but I hope you understand what I tried to say, lol
then it won't change anything
I corrected above. Its 2 hours of PTO a week, and I get that regardless of the fact I only work 4 days out of the week
oh awesome. doesn't that mean that you basically get like 100 days of PTO per year? because that's indeed awesome lol
Yes
here is how flexible my hours are. Lets say I need monday off. I don't actually need to use my PTO for that
I could just switch my Monday shift for a Friday shift
nice
but you also have "employment at will" right?
so they could, in theory, fire you at any time
While they could fire me at any time, it doesn't mean there is no risk to them for doing so either
Caused by: java.lang.NoSuchMethodError: 'java.lang.String org.bukkit.entity.Player.getClientBrandName()'
at aioplugin.aioplugin.events.PlayerJoinEvent.onPlayerJoin(PlayerJoinEvent.java:24) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:577) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19.1-R0.1-SNAPSHOT.jar:?]
... 15 more
``` im getting this error when im doing `String Client = event.getPlayer().getClientBrandName();`
ok alrighty. seems like you got a really good deal with your employer
package aioplugin.aioplugin.events;
import aioplugin.aioplugin.AIOPlugin;
import aioplugin.aioplugin.database.MongoConnect;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.UUID;
public class PlayerJoinEvent implements Listener {
@EventHandler
void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event){
if(event.getPlayer().hasPlayedBefore()){
String PlayerName = event.getPlayer().getName();
UUID uuid = event.getPlayer().getUniqueId();
String IP = event.getPlayer().getAddress().getAddress().toString().split("/")[1];
String Client = event.getPlayer().getClientBrandName();
MongoConnect.NewJoinsData(PlayerName, uuid, IP, Client);
Bukkit.getLogger().info("Player Has Joined for the First time, Name: " + event.getPlayer().getName() + ", UUID: " + event.getPlayer().getUniqueId() + ", Client: " + event.getPlayer().getClientBrandName());
}
}
```this is my playerjoinevent
spigot doesn't have any ".getClientBrandName()" method
Tf why did intellij suggest it bruh
what api are u runnin
are you using Paper API?
Oh yeah
yeah its a paper method
yeah, that explains it
should ask in paper then
Paper has many more methods than spigot has
alright thanks
well you can't use paper API on a spigot server
So, it will work on PaperMC but it will not work on "plain spigot"
what are you using this for, anyway?
I have full benefits with them, 401k and in 2 years they will match half of what is in my 401k at the time. I have dental, vision and health insurance as well as disability insurance and death insurance. And I get discounts at some stores too. I also get business credit with Snap-on and Mac tools as well π
I forgot that i was using paper lol
xd
because the "client brand" can be easily "faked" anyway
there is literally no reason to ever check it
Im trying to log some user data when a person joins for the first time
Β―_(γ)_/Β―
i saw that method and i decided to use it lol
seemed like it might be a bit useful
where does he work
that's awesome. I mean, as a European, we don't say stuff like "I got X, Y and Z insurance", because we got it anyway, but yeah for an american that sounds like a really good deal :3
I'd also love to visit the USA again but I'm too poor to afford the flight haha
Well I don't really need the health insurance since I am a veteran and have that stuff for free through the VA anyways lmao
but the dental insurance through my company costs me $3/month
wtf
what company
JB hunt
3$ per month for dental stuff?!
you'd be stupid to not take that
3$ per months, that's nothing
yes you would. Its partial dental insurance for the first year with the company
and then its full dental coverage after that
the rate doesn't change either
I have to admit - I haven't seen a dentist in like 4 years now lol
I could go there anytime, but I'm just too lazy
I had a profile on indeeds
one of their recruiters emailed me. So I was like, why not. And they gave me a hiring bonus too π
it's an old grandma who's called "Ingrid" which sounds like indeed. and then she's like "I am INDEED called Ingrid, but please don't call me when you're unemployed, duh"
lmao
btw another funny thing: I am now a "supporter" on spigotMC and people always think that I'm staff now
lol
actually it's just a donor rank
anyways what is awesome is that since they hired me and put me on night shift. The location I work at, this is the first time they have ever had a tire tech at night. There is only two of us tire techs too. One works in the day time a normal 8 hour day shift monday-friday.
I think they should change the name because "supporter" obviously suggests that I'm actually staff
Well I could see how someone might confuse it for staff
but, at the same time supporter doesn't actually indicate staff either technically
yeah, people obviously think "supporter" means "this is someone from whom I get support from"
I'll probably suggest to rename this to sth else
Well, if they logically thought about it, generally such people don't have a title of supporter π
they are usually called Customer Support or Tech Support etc
You should go to a dentist because i havent been to the dentist in like 4 years as well and found out that i have holes in my very last teeth recently and have to get them filled in soon
oh shit
yeah I will probably do that soon
implants are a thing just fyi
lol
yeah, at 5k an implant
@tender shard just finished making the Clan, you're right, it's so much easier to do stuff lmao
expensive af
depends who you go through
I mean, my teeth do look totally fine
you never know, my teeth looked perfect
quick question, is there a way to get the JavaPlugin without always having to specifity it with new Clan(plugin) or new Clan(this)?
but the dentist said otherwise
point being is it is annoying having to brush your teeth when you could just invest into some implants and really never worry about it again
hmmm
everyone send teeth pics now haha
heres mine haha
Why would you invest in Implants when you have actual teeth that cost you nothing, just getting checkups at the dentist every 6 months or so
I have horrible teeth, plan on getting some implants within the next few years
you should get gold teeth
π
my father also has one and it's "working fine" since like 40 years now
because you have to maintain them. That costs money and time. Implants you don't really have to worry too much about except some bad breath and occasionally cleaning them to make them white again.
no, fr
cavities won't be an issue again
gold teeth are just awesome
they look a bit weird but they just work and never break
yeah ik
you have to have some good tooth base in order to have a cap
9 out of 10 dentists recommend...
which btw
I wonder what the other dentist recommended instead
can be a small number depending how many dentists we are talking about
usually its more like 4-5 dentists
in germany, every TV ad for toothpaste is exactly like this
"9 out of 10 dentists recommened Oral-B Plus Super Extra-White. Why are you not using it yet?!?!?!?"
yeah its the same in the US
however in the US they actually have to state how many dentists they surveyed
aaaaaand
but they put it in small print at the bottom
I also always think: When 9 out of 10 dentists recommend it, its probably shit. Because if this toothpaste would actually be so awesome, then we wouldnt need dentists anymore, and surely they won't tell you to use something that makes them go bankrupt
what is the best library to use for json in spigot
is gson the recommended option?
isn't there one that's included with the server and is it gson?
ok i just asked three redundant questions
hopefully you can still manage a meaningful answer
Gson
gson
Bukkit.getPlayer only works for online players, correct?
please also ask me about what toothpaste I can recommend
yes
fun fact, you don't need to use toothpaste to brush your teeth. Nor is toothpaste anymore effective at preventing plaque then simply not using it. Some toothpastes are actually harmful to the enamel and you should pay attention to the RDA number on the box. If its 250 or higher probably best to avoid it, anything below that is mostly fine. RDA = relative dentin abrasion.
Thank you
It works well now!
awesome!
people haven't used any toothpaste for thousands of years. Okay, I gotta admit that they are all dead by now, but that probably was not the reason why they died
basically toothpaste is just a waste of money except for some special kinds that help with sensitivity for example if you have that kind of problem. But for the most part toothpaste is just a very fancy mouth freshener.
pog
uwu
:3
you are right about this, most people actually did not die of anything relating to dental hygiene
Sometimes we need help, or 30 hours try & error
that's how it works, lol
however one of the big differences from back then to now though, is that sugar was not a very big thing to consume back then and even they did, the sugar they did consume was mostly natural sugars and not all of this artificial and fake sugar stuff
true, sugar used be some kind of very expensive thing like 100 years ago
well not just expensive but only grew in certain parts of the world as well
so it wasn't like you just go down to your local mart back then and just buy some lmao. You had to wait for some merchant to bring it in from where ever it mostly grew
for somebody thats need it for future her is my code:
Main.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> {
WorldBorder wb = Bukkit.getServer().createWorldBorder();
wb.setCenter(new Location(p.getWorld(),(is.chunkX*16)+8,0,(is.chunkZ*16)+8));
wb.setSize(Island.getIslandSize(p));
p.setWorldBorder(wb);
}, 20);
should probably use DI
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
probably could have saved you a lot of trouble too using di as opposed a static instance. Not saying static can't be used just there are some technical draw backs to statics most are unaware about
it is pefectly valid to use it, and I am not saying it isn't
This works pretty easy for me at this moment
however there is some behind the scenes things that happen in java in regards to statics
that most generally never get taught or bother to research
they do have some drawbacks that are not very straight forward obvious to see
for instance, caching problems
ahh yeah, they saying always there are multiple choices to get something to work
it is always nice to have choices, just it would be nice if developers bothered to take the time to understand why there is different choices and what the actual differences are between them
what can happend with this static instance? if it is my own server
I don't know exactly how all of your code looks
but using static like above could prevent another plugin from working with your plugin
for example
or just make it more difficult
Yes im aware of that
im using less plugins than one big own writen plugin
thats hold Survival and Skyblock
the amount of plugins is generally not an issue
it just depends on the quality of the plugins more so then how many
Java is capable of handling thousands of class files just fine
java has come a long way
I remember the old days where java would crash your computer by eating up all the resources
and needing to force close them java apps before that happened
but then again, this is also in the time where we didn't have systems above 2GB and 4GB
true thats why you can read your heapdump to searching leaks
i use 128GB of memory spread on 8 bungee servers
is there any chance that there's a better way of validating an item is a hoe than checking if the material name ends with "_HOE" or having some enumset with all hoe types? i thought the Tag<> interface was creating to handle such cases but it only contains a Tag.ITEMS_STONE_TOOL_MATERIALS
a Xeon(R) E5645 2.40GHz 12 Core
Thats will handle my bungee network for some time till grow above 500+ online i think
the tag interface is to handle the vanilla tags
I could see it being expanded for most custom stuff but I also really don't see that happening as it can become a mess quite easily and quickly lol
hmm ye reason why not to do a pr
hello
can you make autuload config: https://workupload.com/file/FuBZAd9cbU8 ?
for my plugin
not going to click on that lol
loll
?services ig
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?paste
so the best way to check if a material is a specific tool would be to place all the materials in an enumlist π€
which there currently is
unless that was removed
could be a registry now
in which case just use the namespacedkey I think it is?
Yeah or use nms altho that is better in its own way
mwoa probably wont use nms
Mwoaayea
doesnt seem useful
who would I go about doing a replay system?
who?
?services ig
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
lmfao
joe
whos joe
joe grandma
well their question didn't quite make sense. I don't know if they were asking in where to go or if they were wanting a specific person to go to
they probably meant "how"
that makes too much sense for it to be correct
joe mama will beat you to death
with special source maven should i use the -remapped.jar or the -remapped-obf.jar
Should be a regular jar without the extra stuff you can use
oh the regular jar works too?
Should
i seeeeee
so do they all work except original-
but ill just use the one named regularly
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
why is a jungle button returning Material air on inv click
is there a way I can pass any persistentdatatype to a method?
like ```java
doStuff(PersistentDataType.STRING, "hello");
doStuff(PersistentDataType.INTEGER, 23);
without method overloading because that would sort of break the whole point of passing the PersistentDataType to the method
<T> void smth(PersistentDataType<T, T> type)
or PersistentDataType<?, ?> if you want to support custom ones too
isnt there like tags
material tags
so something like this?
public static <T> T getKeyValue(String keyStr, Player player, PersistentDataType<T, T> dataType, T defaultVal) throws Exception {
PersistentDataContainer pdc = player.getPersistentDataContainer();
NamespacedKey key = NamespacedKeyManager.getKey(keyStr);
if (!pdc.has(key))
pdc.set(key, dataType, defaultVal);
return pdc.get(key, dataType);
}
π
Use a hash set instead for better compatability with future versions
enum set is just a glorified bitset
the ordinal value is the index of the bit to check
^
It's great. Once you exceed 64 bits though it gets a bit clumbsy
hmm
Well you can use an identity hash set otherwise altho thats not gonna be too different from a normal hash set
You're fine to use an EnumSet for materials so long as you're aware that your plugin might not be compatible with a future version
Which isn't the worst thing tbqh
mye
Just means you have to prepare a trivially easy update
or just bet that md_5 never merges that
doing my stuff like this now π
and live a happy life
(on a major ,that is)
hasn't that PR been "pretty read to go" since like 1.17 xD
Mhmm
Whate is the best way to freze someone for a second?
Player move event cancel for a second
player.freeze()
Nah I'm just kidding with ya. Y2K's right lol
Add the Player in a Set, if they're in the Set, cancel the move event
You almost killed me
A Set<Player> is fine, especially if you're holding them only for a second lol
you canβt use external here even with nitro :pain:
Hah lol I have no clue, but I fixed it already
Server boosters only 

I'd argue the rotating arm is far funnier and cooler
could someone give me help on how to convert this into an abstract class or something that i can create classes with?
e.g.
public class SomeBlock extends DynamicBlock {
}```
and then it will have override methods and stuff
Good luck
ye its pretty bad
Abstract classes must be extended
Think of them like interfaceswith some implementation already
Any non-final method you declare can be overridden
If you require that a method be overridden, you can declare it abstract and not give it a body
public abstract class MyAbstractClass {
public abstract void mustOverride();
public void canBeOverridden() { }
public final void cannotBeOverridden() { }
}```
hm ok, its just i still want it to be instantiated e.g.new DynamicBlock(blah), just also able to create a class that will inherit all those values too
I highly reccomwnd not using abstract to enforce constructor arguments these can be enforced via getters and setters in an interface
Yeah so don't mark it abstract, but create methods that can be overridden
Your methods can just have empty bodies if you don't want them to do anything
mk
Again, anything non-final can be overridden π
heh works
well done
I hope it doesn't look like this though

excuse me, but can i ask how to get package version for 1.17+ ?
my old code only correct for 1.16 and below
lets do a quick push to gh rn
The package version? v1_17_R1
yes
btw could someone rate this as a wrapper? I'm pretty new to making them, previously my code was a mess.
https://www.spigotmc.org/wiki/spigot-nms-and-minecraft-versions-1-16/ may be of use to you, Tuan
Everything looks fine but I personally advise returning a clone of your Locations
Keep in mind they're mutable
Nothing stopping me from doing yourBlock.getLocation().add(0, 1, 0); right now
Yeah it would modify the internal Location
Just a call to clone() when you return them is all you need
return location.clone();
uhh its only worth to override equals and hashcode when that class is either used as a key type in a collection or as an entry?
ah me doing stupid stuff again then
myes
Should definitely override hashCode() and equals() in that class too
You can just hash/equals the x/y/z coordinates
ohhh you've just solved one of my problems thanks a bunch :D
I never override hash code because I have no clue what it is
It's what uniquely identifies your object in a hash-based collection
Probably should look into thag
Any time you override equals(), you should be overriding hashCode() too
@tardy delta hashCode is for hash based collections like HashBasedTable, HashMap, HashSet WeakHashMap etc
equals can be useful outside tho
Yea but how would I do that os there some equation
with the other values btw, integers won't get changed internally right? or do i need to clone everything
For hash codes there's generally a pattern for it, yeah. hash += prime number * hash of value
Tho yea whenever you override one of em it goes without saying the other one is smart to override
public int hashCode() {
int hash = 31;
hash += 31 * Integer.hashCode(x);
hash += 31 * Integer.hashCode(y);
hash += 31 * Integer.hashCode(z);
return hash;
}```
How do you hash the code or your custom object though π€ or is Integer.hashCode take in an object param
Objects.hashcode(x, y, z) :(
excuse me, your link is useful for me but I need to get the right server version is running
this code is not work for 1.17+
Bukkit.getServer().getClass().getPackage().getName().substring(Bukkit.getServer().getClass().getPackage().getName().lastIndexOf('.') + 1);
Oh my lol
action bar might look better
if youre cutting wood this will spam chat
ye probably
Anyone know good libraries or APIβs for custom mob AIβs
Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; should get you the version you need
Depends on what you're hashing. That method takes varargs of Objects so that will box then unbox your integers too
If you're hashing a lot of objects, then yeah that's fine
Nms itself is pretty rich
Altho arguably has a steep learning curve
Yeah but then I would have to go about versioning and like you said that learning curve
Mojang mappings make it much more accessible imo
Versioning isn't hard especially with mappings
Also, my implementation was really bad. You should be multiplying the existing hash by the prime then adding the hash value lol
public int hashCode() {
int hash = 7;
hash = hash * 31 + Integer.hashCode(x);
hash = hash * 31 + Integer.hashCode(y);
hash = hash * 31 + Integer.hashCode(z);
return hash;
}```
That one's a lot better
Alright, Iβll look into it then but if there are other options I want to consider them aswell
Not that I'm aware of though I remember seeing something on forums
Iβll look there
only sucks that you still need to use reflection for the version-dependent org.bukkit.craftbukkit packages
otherwise it would be so easy
Yea gross
Reflection π
ok now my head hurts, this is probably one of the most fundamental things but
if i do
x = new SomeObject();
y = new SomeObject();
x = y;
y = new SomeObject();```
does x change or no?
Huh
I'm confused
Anyway for beginners nms ai is just a queue with goals where the queue can have a max of x goals running at the same time, we have two of these queues, one for choosing the target (to attack for instance), and one for choosing physical actions such as movement or direction to look at. To make our entity move we use goal navigators. Look at some of the entities to enhance the understanding of how it works. But yeah thats that, then we have villagers but theyβre a bit more sophisticated and intricate with memory modules and brains.
x = new SomeObject();
y = new SomeObject(); // This is x
x = y;
y = new SomeObject(); // This is y```
@balmy valve(the queues go under the name of goal selectors)
Up until x = y yes they're the same object
Then you re-assigned y to a new instance again
i thought they were only the same one the line x=y
because beforehand theyre both seperate instances right
Correct
i dont really get what u mean then
up until that point as in?
Heh, poor phrasing on my part I guess
dog on the mind
lol
x = new SomeObject(); // Different
y = new SomeObject(); // Different
x = y; // Same
y = new SomeObject(); // Different```
Well technically in your example x and y are different
even when you assigned y to x, what did become the same is the data
Lol don't confuse him!
lol
yeah im just gonna stick with the
the pointer refers to the same thing lmao
no that is incorrect, in the example above the pointers are different because of how it started
in this case java would treat x and y as two different objects but with same values
let me try to be smart π
at some later point if a GC happens, yes the pointers for both could become the same if it doesn't change
everytime
variable = new Type
that variable gets a new object entirely meaning no other variable usually points to it unless you use
otherVariable = variable (somewhere later)
:>
π
It really just depends how it starts out, but yeah you can have two objects with same values. And the pointers never being the same for the objects all because in the beginning you started them both out as two separate objects.
ive got 0 clue about pointers
now if you started with x being one object, then cloned x for y, then they will be both point to same memory space until you assign y its own object
should i know this D:
nah
not until some time later when you got a large project and some optimization techniques are needed
but for the time being you really don't need to worry about it
For the time being a pointer is just a variable (not entirely true, but it should be good enough of an explanation)
i read some book about oses in java and i thought i was smart π€π€
you clearly didnt π
Java OS's used to exist when our technology was not good enough
reference is iirc favored to pointer as terminology when it comes to Java
hehe old shit
its just an object index or ID right
Well cpp pointers are pretty much
pointer literally refers to the exact memory address
Or well they point to a place in memory
nah the gc would need to reassign all the references
But java has sth else because the variables are to some extent pointers, but also the objects themselves
in the jvm its a reference right
an ID which is probably mapped to a memory address
sometimes and other times it is not
depends on the object type
So i'm trying to add itemstack to a players inventory on command, whilst checking for permission & also a second method for target player. No errors in console but it's not returning the command or doing anything since I added the "Target" method... I think it's how i've set it out or the returning true;?
Most Objects in Java are backed by some sort of primitive
the exception being String
which is both a primitive and not a primitive
why is string not primitive
java doesnt store any objects on the stack
it stores references
and any variable is on the stack
it does store objects on the stack, hence why you could technically get a stack out of memory exception if you initialize too many objects at the top of the class
which is why you can assign any object to an Object parameter
Good question
cuz string being a primitive would mean its a fixed size
is it possible to test if a block is solid? like cobbble stone and not water?
Yeah and also object orientability
isnt isliquid a thing
i mean if you have a string with a length of 2 and one with a length of 72262626 chars that would be wasted space
Altho jvm and jit heavily optimized strings
Any help?..
because we need to be able to manipulate strings and we do have a primitive for strings, its called char
references right
no
true
stack variables have a fixed size right? so either primitives or pointers?
so a string is just a concatenated char array at memory level?
not quite
but it is a way you could think of strings
Yeah well all objects in principle lives on the heap
thanks
The stack just stores a reference to it iirc
^^
every single object is stored in the heap
an object variable or field is just a reference to an object
When you create local variables and what not
So i'm trying to add itemstack to a players inventory on command, whilst checking for permission & also a second method for target player. No errors in console but it's not returning the command or doing anything since I added the "Target" method... I think it's how i've set it out or the returning true;?
using heap is subjective. There is differing heaps in Java
True
Some objects do indeed live on the stack
like
π
i mean, your code is in your 'no permission' check
so you're running it if they dont have permission
otherwise you wouldnt be able to assign
Object o1 = new A();
Object o2 = new B();
Object o3 = new C();
``` if A, B and C are different sizes
Primitives can be on stack only iirc
Ignore that bit i fixed that
yeah theres no primitive pointer
like int ptr
Ya
nullpointer hehehehe
It doesn't find the target
don't forget statics, constants, and enums
Oh yeah good point
Via the EntityDamageByEntityEvent, is it possible to get who shot the arrow that damaged a player?
(void*) 0 π’
catch a invocationtargetexception idk i dont think it will be null
i mgiht be wrong
oh ok
It's still giving me the itemstack
but im typing /sword tt - it should return with the message saying thats not a player
You might be able to check if the damager is an instance of a projectile and then do what you need to from there.
try using the p.sendMessage()
not sender.
wont make a difference but idk
i cant find a problem
there is a big difference in what the documentation says and what the actual implementation is. For the most part yes most objects will not live on the stack
Well constants are inlined now when I think of it
Java's documentation hasn't really been updated in like forever well the specs anyways
occasionally something might get updated lol
they may be stored on the stack for optimization or something but as far as i know any variable or field always stores a reference to any object, never the object data itself
does bukkit wait for the runTaskLater to finish before running subsequent code
Depends
if its in a method
But if you declare code after the runTaskLater then no
I can't find anything wrong with it either... It's like it's only getting to the first method then stopping there
Yeah well local variables, primitives and method invocations are the only things that are stored on the stack afaik
this isnt a spigot question but what algorithm begins with $SHA$
because your check is in the else statement of your /sword check
so the code will never reach that point
just read it to yourself and follow it
thats how i do debugging sometimes
actually i dont think it can, the stack frame size has to be determined at compile time
I think you might be getting confused between call stack and stack memory
the call stack stores all the stack frames which contains all the local data right
there is multiple stack frames per class. A class file will generate its own, and every method in a class will generate one as the methods are called, the stack frame goes to the call stack, the references and values go to the stack memory, objects go to the heap.
For the most part that is how everything works, it isn't until you get into the more intricate parts where you encounter the exception rules
like statics for instance
you mean a stack frame for the class initializer?
for the "class file stack frame"
if you want to be more technical yes
anytime a class object is created or a class is accessed other then using reflection, it will create a stack frame for entry method
I might have to start making tutorials or lesson plans for those wanting to learn the intricacies of the JVM
There are some technical stuff that might alter when user mode / virtual threads get implemented since they can switch underlying thread they get executed on when suspended and re continued
something to consider in regards to arrays or array type collections. If you use an unequal sized array, it is more optimal memory wise then one that is say perfectly equal
a lot of people don't think about this
entry method or every method?
and do you mean by entry method the instance initializer?
technically every method gets a stack frame, they just don't get created until the method is called. creating a class object calls the classes entry method automatically or when you access it via static means.
the constructor is a separate method call right
the above exception is when using reflection
as you can bypass the initialization process with reflection
Yeah which well is just a direct call to unsafe, or used to be that iirc
yeah
all the jvm needs to do is allocate enough memory for the local variables and parameters and store some extra data, like the method
and other data too
debug
says the jvm
spec
what is the "entry method"?
the initializer?
initializer, the main method. I just use the term entry method to refer to it as that is what it is technically called.
ok
Paste it
pastebin
?paste
Yaaa
?paste
so the instance initializer is called the entry method?
bae
officially
Yours?
the plugin only works on 1.8 so i cannot test it on the latest versions
not really
its open source
so i compiled it
Do you know anything about Java?
Hmm, might wanna just contact the dev to fix it then, or ask someone to fix it with
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Well, in programming there is always an entry method, this is referred to the very first method that will be encountered regardless of what happens. I just use this term to refer to the constructors in classes because well, it is the first thing that will happen other then what is initialized at the top of the class outside of the constructor which typically don't do anything themselves.
oh alright
but the constructor is a separate method call
and not related to allocating and initializing the instance
although it is called <init> in the stacktrace
which is confusing
account with at least 20 posts
Ah well
thats out the window
my account is old but i dont have 20 posts for sure
or do reviews count as posts
well it is related in a way, but yes you are correct
yeah, but i think you can just allocate and call the instance initializer
class A {
{
// this thing
}
}
using reflection or unsafe or smth
code block fail
the thing relating it is the new keyword
well it depends on how the class is setup
some classes without reflection, the constructor will always get called
anyways, for the most part you really don't have to worry too much about the stack memory
unless you just have a crap ton of statics and object initializations at the top to exceed the 1mb default size XD
or primitives
(I'm damaging the mob for 845659861 damage and he stays as a red boy and goes up and down)
probably an overflow so he dies but then again has positive hp again. Just a wild estimation
I figured out I could just remove the entity
Would it be possible to make a fishing rod get thrown?
like a normal player fishing
Not easily
hey anyone know how to register aliases
to be tab compatible
I know hot to register new aliases
for main part of command
but you can't tab complete them
so for example /potato will work
but not tab complite
What is everyones favorite idea theme
I have material icons rn but for syntax highlighting and stuff
one dark vivid
woah
currently using https://plugins.jetbrains.com/plugin/12100-dark-purple-theme
have used gruvbox in the past
I like the default dracula one
I'm using Material Theme and Icons and some own colors for highlighting
agree, its color makes me feel easy to see
can you not just add command aliases through the Command object spigot gives you?
getServer().getPluginCommand("command).setAliases(...)?
why not just putting it in the plugin.yml
I assume it needs to be done programatically for some reason
otherwise of course just add them to the plugin.yml
there are many command framework in spigot resources, you can use one of it instead
need to be so user can edit it
for subcommands, you'd need to handle this in the tabcompleter as normal?
so im using mojang mappings and the remapped jar to spigot sometimes still gives errors, for example: java.lang.NoSuchMethodError: 'net.minecraft.network.chat.IChatBaseComponent net.minecraft.world.item.ItemStack.G()', should i update the specialsource somehow or?
send your maven or gradle config
its working, for most stuff, only some methods / fields that dont work
if you didn't understand my aliases get registered but you are not able to /tab them
you mean your command aliases now right? I wasn't sure if you were talking about subcommands or that sort of thing
i'm using this command class, include paged help command , looks into it if you're interested
https://github.com/xnaut97/CommandBuilder/tree/main
could it be because you're using the mappings for 1.18.1 but actually using 1.18.2?
oh yeah
not sure how much of NMS gets changed between minor versions
but I guess that would account for only some of methods being erroneous
I believe the gliding effect is handled by the client
and the server just agrees that that's the way they expect the client to move across ice
so packets?
works now
thnx
don't know much about packet manipulation for that sort of stuff but it should be possible if you can fake the client into thinking its on ice whilst rendering another block
If the client thinks he is on ice then it will render ice...
I found js Entity hook = player.getWorld().spawn(player.getEyeLocation(), Fish.class); hook.setVelocity(new Vector(player.getDirection()).multiply(2)); but idk if it works
ok so part of my plugin requires downloading the client jar from mojang so I thought i would use the api to get the client jar link for the current version. i started with this test that just downloads the 1.19.1 version.json but I'm having issues
here's my code
// Stream from the url
getLogger().info("Streaming from url...");
try (InputStream is = new URL("https://piston-meta.mojang.com/v1/packages/92e6f1eba1748a43b8e215d0859a42bce4f999d2/1.19.json").openStream()) {
//System.out.println("Making buffered reader...");
//BufferedReader rd = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
//System.out.println("Reading from file...");
//int readByte;
//while ((readByte = rd.read()) != 1) {
//sb.append((char) readByte);
//}
getLogger().info("Making json object");
JsonObject json = JsonParser.parseReader(new InputStreamReader(is, StandardCharsets.UTF_8)).getAsJsonObject();
getLogger().info(json.getAsJsonObject().getAsJsonObject("downloads").getAsJsonObject("client").getAsJsonPrimitive("client").getAsString());
} catch (IOException e) {
e.printStackTrace();
}
actually
with resource packs there is a way of changing the scaling of an item in a item frame to a full block
but that would probably be glitchy and laggy
so this is the error im getting
maybe i can copy it
[10:46:33 INFO]: [MCPlanes] Enabling MCPlanes v0.0.0
[10:46:33 INFO]: [MCPlanes] Streaming from url...
[10:46:34 INFO]: [MCPlanes] Making json object
[10:46:34 ERROR]: Error occurred while enabling MCPlanes v0.0.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonPrimitive.getAsString()" because the return value of "com.google.gson.JsonObject.getAsJsonPrimitive(String)" is null
at co.tantleffbeef.mcplanes.Plugin.onEnable(Plugin.java:76) ~[mcplanes-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.19.jar:git-Paper-81]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:477) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:634) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:420) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1122) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:303) ~[paper-1.19.jar:git-Paper-81]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[10:46:34 INFO]: [MCPlanes] Disabling MCPlanes v0.0.0
?paste
Player.getLocation().getYaw() returns the rotation of the player's head
Is there a way to get the rotation of a player's body?
Means you json object doesnt have a property under that path
right but the json file im trying to stream from the internet does have that path
so im just wondering where I'm going wrong ehre
I need to listen for any block change. is there a way to listen for like block event or something
ooh maybe ill try loading the json file from my own machine first
alright ill let you guys know how that goes
@crimson scarab I have an idea but I'll get a demo working first
because it's hard to explain
and I'm not wasting my time explaining if it doesn't work
You can check if you can change the slipperiness of the block type
packet events π
Nope
so I know something that will work
but it requires a texture pack
and no, the texture pack doesn't just change the texture of ice
I mean I say it works
it's really less than ideal
Are there better ways to make sequences like this rather than using a runnable and switch statement?
that would be a smart idea
actually I'm not sure I could do that
actually, in this switch, all that needs to be determined is the title message
and then only play the sound if your switch expression >= 140
that should do...
Hey, I can't configure the TAB plugin to show the town names from the Towny plugin, can anyone help?
shut up fucking dog i didn't asked you
guess someone doesn't want help here then
your grandma fell off balcony
you do mad kid
Make your own plugin LMAO
with TownyAPI
your spelling also reflects it
DramaAlert
So basically there's my friend who changed some code in my plugin and i dont know how to fix it. Basically the scoreboard, commands, and everything loads to him
can someone help?
Knock it off. The question should be (and still is?) in #help-server. Wait patiently for an answer. If nobody answers after a while, it's likely no one has one
if it was bumped up because of other chatter, you can always bump it (politely) or create a thread
you gotta explain more, we have no idea what is going on
Ok lemme explain
In my plugin there's a bunch of commands, events and scoreboard. In the PlayerCacheHandler he coded it so it loads the scoreboard only for him
wait lemme send the code so its better
im trying to make a custom crafting table how can i check if a List<Material> matches a .json crafting recipe file in the "pattern" sections or is it even possible
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"# #",
"###"
],
"key": {
"#": {
"tag": "minecraft:planks"
}
},
"result": {
"item": "minecraft:chest"
}
}
private void onPlayerJoin(final PlayerJoinEvent event) {
if (event.getPlayer().getName().equals("TheRealYasuo")) {
final Player player = event.getPlayer();
final Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
player.setScoreboard(board);
final PlayerCache playerCache = new PlayerCache(new Board(board), player);
playerData.put(player, playerCache);
NameTag.setNameTag(player, ChatColor.GRAY + "[1] " + ChatColor.GREEN + "" + ChatColor.BOLD, ChatColor.RED + "" + ChatColor.BOLD + " IS TESTING!", playerCache);
NameTag.displayNameTagsToYou(player, playerData);
playerCache.updateLevelBar();
player.teleport(spawnLocation);
}
}
π someone who uses final π
Well, that's why. It's made to only work with one player.
Hello, So recently I just decided to start using spigot and i was expirementing with something, I am using kotlin and trying to spawn a tnt with a customname that has colors, and now it just wont spawn, how would I use colors and fix the issue?
val tnt : TNTPrimed = e.player.world.spawnEntity(e.player.location, EntityType.PRIMED_TNT) as TNTPrimed
tnt.customName = Color.RED + "a"
tnt.isCustomNameVisible = true
thats what im saying
im a begginer and i dont know how to change it
Just remove that first if statement,
talking to me right?
personally I would map that List<Material> to a List<String> using the json key, and compare that to the pattern
Yes
private void onPlayerJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
final Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
player.setScoreboard(board);
final PlayerCache playerCache = new PlayerCache(new Board(board), player);
playerData.put(player, playerCache);
NameTag.setNameTag(player, ChatColor.GRAY + "[1] " + ChatColor.GREEN + "" + ChatColor.BOLD, ChatColor.RED + "" + ChatColor.BOLD + " IS TESTING!", playerCache);
NameTag.displayNameTagsToYou(player, playerData);
playerCache.updateLevelBar();
player.teleport(spawnLocation);
}
like that?
Yes, like that.
ok but is there a easier way to do that? if there isnt then i can just you what you suggested
any idea why my problem is happening and how I can use colors?
how do i change the syntax highlighting code in discord
btw
use ``
but with 3 `
and then the language
like ```kt
or
Just put the language after your three backticks.
not that I can think of. Also, if you are just checking the material anyway, I don't think each key needs to be a json object, it can just be a string as in
"key": {
"#": "minecraft:planks"
}
shadow are you able to help me?
all other people are helping somebody else
What's the problem?
i think i found a fourm that does exactly what im trying to do thanks for the help! <3
a
Hello I would like to know what is the format to put on mysql I would like to retrieve all items with this line [Lorg.bukkit.inventory.ItemStack;@7a80ba30 in a setContents pls ?
at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:193) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:180) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at me.placek.cakerpg.CakeRPG.onEnable(CakeRPG.java:32) ~[CakeRPG.jar:?]```
public void onEnable() {
plugin = this;
this.saveDefaultConfig();
playerMenuUtilityManager = new PlayerMenuUtilityManager();
rpg = new Rpg();
restoreData();
setCommands();
setListeners();
rpg.getWorldsManager().createWorlds(rpg);
}```
I'm not sure if PrimedTNT can even have a custom name. I know you can spawn holograms above it, but I'm not 100% sure if they can have a custom name.
did anyone know how could i export config.yml together with jar file?
well do u have config.yml in the jar?
it can i litteraly did it but without colors
i have that in src folder in my project
Hello Guys, i have a question...
Heres the code: https://paste.md-5.net/ocusiyifug.cs
Is it possbile so the messages are like "Acacia Planks" like with the pickup event but when i craft acacia wood e.g. to planks i get "WOOD" in chat and all is toUpperCase and with "_". Do you guys have any ideas how i can fix this?
Thx ^^
but even if it wasnt a primedtnt how would I do it
"${ChatColor.RED}a"
what IDE and/or build system (maven/gradle/ide)
ok thanks
Oh, well if it supports it, you need to run it through ChatColor#translateAlternateColorCodes()
intelij maven
i think u need to put it in resources folder
kotlin doesn't like implicitly calling .toString() on things like java does
src/main/resources
so you either have to manually do
ChatColor.RED.toString() + "a"
or ${ChatColor.RED}a
i think this guys way is gonna work
thanks
damnit
that worked thanks
didnt work
are you sure tnt can have custom name?
bruh
What is this syntax? ${ChatColor.RED} I've never seen it used before. At least in the context of ChatColors
that obvius
its kotlin
In java you can just concatenate ChatColor and another string and java will convert the chatcolor to string but kotlin won't make that call automatically. It's how i use chatcolors as it's quicker than calling toString
string interpolation
Ah, I don't use Kotlin so I didn't know. π Weird that it doesn't do that automatically.
well i specifically said I use kotlin in the help message lmao
kotlin is nice tho
yall should look forward to it
very simple
is it possible that the PrimedTNT is detonating before you can see it? Maybe you need to set the fuse ticks?
its there a easy way to do an inv update check?
Well the learnjava help links are some of the better places to learn. I learned the most from the Oracle book itself.
well a couple minutes ago, when I set it to a plain string (without color) it worked completely fine, tnt was spawning and everything was going to usual, but now apparently none of that is happening when im inserting the color with the .toString()
Bothering you again, but I need help. I'm getting an error when try to do my /spawn command:
I didn't have to, but it's nice to have.
I can tell you that macbooks aren't the best choice for software development. Their issues are mostly with overheating, but if they didn't have that issue, they would be a solid choice. You'd likely want to look into the "gaming" laptops since they have higher specs.
The only reason you would need higher specs is for the faster compile times and the larger ram capacity.
13" ipad with intellij code server π
What's line 58 of your BlockRemovalHandler?
private void removeBlocksSync() {
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
for (final RepBlock block : blockRemovalSet) {
world.getBlockAt(block.getLocation()).setType(block.getMaterial());
blockRemovalSet.remove(block);
}
}, 5L, 1L);
}
how could i copy default config form my resource folder?
#saveDefaultConfig()
@kind hatch
doesn't work, i mean it's not written to file but it work
Please elaborate. How can it work, but also not work?
Your list of blocks that you are iterating over likely has a block that no longer exists.
it doesn't give any error but it's not written to file
Do you have a config file that has already been written to disk?
config in my data folder is empty
but in my projest it looks like this
PREFIX: "&6[&eRPG&6]&a "
how can i fix that
public void onEnable() {
plugin = this;
this.saveDefaultConfig();
config = getConfig();
playerMenuUtilityManager = new PlayerMenuUtilityManager();
rpg = new Rpg();
prefix = color(config.getString("PREFIX"));
restoreData();
setCommands();
setListeners();
rpg.getWorldsManager().createWorlds(rpg);
}```
You likely have a config file in your plugin's data folder that was already written. You need to delete it in order for the #saveDefaultConfig() method to write what's in your jar file. That method has a check to see if the file already exists.
it's only on enable
How can I fix that?
lol thanks
it works
What is line 58?
wait
Also, what does your RepBlock class look like?
here it is
private void removeBlocksSync() {
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
for (final RepBlock block : blockRemovalSet) {
world.getBlockAt(block.getLocation()).setType(block.getMaterial());
blockRemovalSet.remove(block);
}
}, 5L, 1L);
}
wait 2 secs
@Getter
public class RepBlock {
private final Material material;
private final Location location;
public RepBlock(final Material material, final Location location) {
this.material = material;
this.location = location;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final RepBlock repBlock = (RepBlock) o;
return location.equals(repBlock.location);
}
@Override
public int hashCode() {
return Objects.hash(location);
}
}
That still doesn't help a whole lot. What is line 58?
world.getBlockAt(block.getLocation()).setType(block.getMaterial());
Where are you populating your blockRemovalSet?
??
Where are you adding the RepBlocks to that list?
private final ConcurrentSet<RepBlock> blockRemovalSet = new ConcurrentSet<>();
That's your declaration. Where are you adding the blocks to the list? In an event, a command, or?
in an event, it removes obsidian in tot seconds
Set<E> β¦ = ConcurrentHashMap.newKeySet();
altho highly doubt u actually need that one
As its much more exhaustive resource-wise
That ConcurrentSet is probably from some crappy 3rd party library
So it would be
private final Set<E> blockRemovalSet = ConcurrentHashMap.newKeySet();
right?
Yes but still why