#help-development
1 messages ยท Page 268 of 1
oh so i can make diff players see diff weather and time
if thats easy i could do that
does anyone know how
Yes
Player#
Its in the api for player
?jd-s Player
Player has set time and setweather
Someone should make cafebabe accept stuff like that, ?jd-s Player sends the player jds link ect
so, I need to add this witherSkull as passenger, how can I find the methods? is there some site where I can find out nms methods for 1.19.3?
EntityHorse entityHorse = new EntityHorse(EntityTypes.Q, craftWorld.getHandle());
EntityWitherSkull witherSkull = new EntityWitherSkull(EntityTypes.bh, craftWorld.getHandle());
it need to be nms because Im creating a thing that api does not support I guess
Just because you need nms doesnt mean everything must be nms
ok
got you
I need just to send to client a wither skull riding a horse
that is invisible
but their names visible
Isnt there a set passengers method for entities
there is addPassenger and removePassenger
Why do you those entities invisible?
?nms
Yea
because I'm trying to add a second name below an entity name
some guy told me that this is the way
like in the plugin DungeonRealms
You want an entity to have 2 name things?
which is out of date
yes
๐คฆ
Probably could do this with armor stands lol
I've tried, but does not work
the entity name is gone
it shows only the passenger name
have you tried the custom name/visible?
yes
sir
when an entity has a passenger his name is gone
only the passenger name is what I can see
Take a look at that and from that author packetentityapi
Should give you ideas in how to accomplish what you are wanting
how can that dude have 30+ stars but only 6 followers
I have like 150 positive reviews on spigot and 4 followers
well spigot != github
Because staring and following are two different things
how do i make it so if a player that has a certain attribute (in a hashmap) can get his item enchanted to sharpness 6 in ItemHeldEvent it seems pretty straightforward though i am having trouble with it
If you give it a star it means you recommend it and want to subscribe to updates
Get the item, check the attribute if they havr it change item meta
check hashmap, if good then add an unsafe enchantment to item. what issue do you have with this? provide the code you have tried.
Or notifications i should say
lol I know how github works
Well you seemed genuinely confused
throwback to "i know java!!!~ ๐ค heres my github link showcasing my shitty code that screams to everyone i dont know java to prove to you that i know java!"
"whats a lambda????"
wanna see some shitty code? check out my old open source plugins like ChestSort and you wanna die
Fortunately lambda is not required in java
That's why I don't share my github (it's all public just don't share the link) because my code is all messy most likely hahah
lambdas, streams and functional interfaces in general are the best thing that ever happened to java
streams nah
and try-with-resources
lambdas ye
streams CAN be very nice
I dont use lambda in java
but some people abuse them
I use lambdas all the time
why not?
as long as you dont outrightly have a class whose name is all lowercase and follows no clear formatting rules, then you're at least somewhat ok in my book
Not a fan of hiding what something really does
How does a lambda hide behavior
I cant really show you an example right now how it can
it makes an anonymous class
At work
But in some cases it does. Or it isnt straight forward in what it touches or does
Now that isnt true for all lambdas nor am i advocating to not use them. Just stating why i dont like using them. I have never had a problem or an inherent need for lambdas
do you guys play w/ annotation processing?
You dont need a lambda for futures or concurrent code
yeah im gonna need some sort of an example of what it is you don't like. im betting what you really don't like is shitty code written by noobs
man just creates new classes for everything
A bit
It's one of the things I despise
except for lombok
my bae
I could never see myself writing an annotation parser
When i get home later tomorrow as i have overtime for training. I will show you some examples
lmao alright
Yeah they want to certify me on the forklifts
But that is fine with me. Lover overtime pay
OT is nice
My wage goes from $22/hr to $34 an hour ๐
For overtime lol
Also overtime starts right after my shift since i have 10 hour shifts lmao
hiding?
a lambda doesn't hide anything
At times it can hide implementation specific details.
Which for most isnt a problem until you have a problem with a particular lambda as it doesnt straight forward show the exact process in what is happening
myList.sort(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.compareTo(o2);
}
});
myList.sort((o1, o2) -> o1.compareTo(o2));
myList.sort(String::compareTo);
all these three things do the same
why would anyone use an anonym class instead of the lambda or Method ref
this mf makes more money switching tyres than I do coding

I am so confused as to what exactly you think it would be hiding. I look forward to some concrete examples, because as it currently stands I'm simply not convinced. So we'll see.
whut the heck, how little are you charging
20/hr
to code stuff?!
I too used to undervalue myself. But then I took an arrow to the knee.
Alex be out there charging 75/h
I'll raise myself to 25 next month
Thats just my base pay, that isnt including my night shift pay as well as my upcoming third raise
on the 9th
I went to 105 since I started lawyer stuff again, just forgot to update the bio
if I got paid for night shifts, life would be good

I charge flat rates. Hourly just lets the customer abuse you. Sure they balk at first, then go to some stupid kid who says they can code but can't. Then they come crawling back.
"Please."
"They said they could. They couldn't."
Do people pay it
not many do, but people I know since months do
I get paid 10% of my base pay for night shift pay. So anytime i get a raise my night pay goes up too lol
with flat rates you risk undervaluing yourself by underestimating the objective
That's why we do a full requirements gathering session before providing a quote
I mean 105โฌ minus company tax is only like 80โฌ. and then comes income tax, then you're down to 60โฌ
and the 105โฌ includes the 19% german VAT
Fortunately for the industry i am in. I am under DOT
department of transportation?
as lawyer I make more than twice as much per hour and I don't have to pay VAT or company taxes for that
Why does this not get rid of the 9 souls on ground? https://paste.md-5.net/udulayuwet.java
So i cant be forced to work over 14 hours in a single shift or day
Yep
9 souls on ground?
I won't work more than 8 hours a day, and that's made clear to any prospective client before they sign the project contract
Also, it's probably fairly obvious at this point that the majority of my work is not MC related. Because this game is filled with kids using mommy and daddy's money, and they think $5 is decent pay. I don't even entertain them.
I work 10 hour shifts because there is no night shift from friday to sunday
I am guaranteed 40 hours
Only way to give me those is if i work monday thru thursday 10 hour shifts
?paste
I always do it like this:
Someone asks me "how much would XYZ be?"
and I calculate, and think "hm maybe 10 hours, so let's say 1000โฌ". Then I think again because I know they suddenly have additional requirements and want this and that changed because they described it poorly, so I just say 2000โฌ instead of 1000โฌ.
Then 80% of people never reply again. But the remaining people say "alrighty, when would it be done?" and I think "hm probably one week". So I tell them "in 2 weeks". And then in 99% of cases it's done after exactly 2 weeks lmao
is there a nice way to keep my plugin on when the server is shutting down until my LoadingCache stops and all data is removed? Rn getting this error
https://paste.md-5.net/filunacire.bash
Always add extra
The items on the ground don't disapear
Alex seems to know this
No. Stop creating new tasks in onDisable, and do your stuff RIGHT AWAY
Block the main thread in onDisable.
yes
ok
that's no problem
Lol
yea ju8st figured the issue out I'm dumb
you cannot schedule stuff anymore
lmao
it's no problem to now cause TPS drops
Bleed it dry
Add debug statements on the ifs
Well the new item appears
I didn't realize i had a async task in my removal Listener is all lol should've figured from the stacktrace but my brain is clearly broken
"that's easy, like 2 hours, so around 60 bucks"
yeah but then they suddenly want you to make it compatible with GriefPrevention, PlotSquared version 3 and PlotSquared version 5
wrong reply
wanted to reply to Illusion
then I just say like
"That wasn't part of the original request and comes at an additional cost"
and then they don't like you anymore and won't commission you again
then just copypaste like 200 utils and get it done in 30 seconds
you are way better off by telling them in the first place that you are able to do it perfectly, but that it'll cost twice as much
hey, is there a 1.19.3 protocol lib?
idiot customers are idiots
Be back in a few minutes. Got to look like i am doing some work by checking some tires on trailers
Lol
What type of rate is best for commissions on the forums, flat rates for type + extra depending on stuff or hourly
on the spigot forums?
depends on your reputation
Do I need to because the new items drops the old ones just don't go away
Ah
and it depends on how good you are in estimating how long you will actually take
and in estimating on how stupid the customer is
This is where you need to be real familiar and comfortable with your own skills or knowing how much you are able to do.
if they really know exactly what they need, and you need exactly how long it'll take you, then go for a fixed price
otherwise, charge them by the hour
and do time tracking then
It sounds so simple when its put like that
Might learn some new stuff on the api soon
Like scoreboard teams and some other stuff
It is simple. The part that can be hard to learn is not under estimating too much or over estimating
Anyone know why the original items on the ground don't get removed? https://paste.md-5.net/udulayuwet.java
Is there a way to show a player that they have a potion effect without actually having the effect?
Over estimate and you get no customers, under estimate and you are doing too much work for not enough
So its a real skill to learn
As it can be used virtually anywhere other the just coding lol
when I started doing this stuff, I started with "10โฌ / hour" and that's just a waste of time. You can much rather charge 125โฌ per hour and after that, give your customer an exact breakdown of the time you actually worked. and tell them beforehand that it's gonna expensive, but that you're also gonna do it good. I usually don't send any invoices that are less than e.g. this
Also the other thing that can be hard for some to learn. You dont need to chase every customer. If you give a price and the customer wants you to go lower learn to say no
So what your saying is make it insanely cheap so i get everyone that doesnt want to pay more than 20$
I once wrote an invoice about 129kโฌ but that's a few years ago and it was like 2 months of non-stop work. and it wasn't coding, it was a case against the german federal tax authority
Lol
Damn
after taxes that was roughly 50k and minus insurance and other expenses it was 40k
but yeah that was the best thing I ever did
What did thr tax authority actually do
I am not allowed to say too much, but I'll try to summarize it "generally"
so it was about a company that acts nation-wide, and they do stuff like... well, like a restaurant, or bakery. but a franchise, acting over the whole country. and those ofc don't declare every single sale in their taxes.
Yep. You need to factor in other things. In your case you need to factor in maintenance income for your computer if you are dead set on making money from coding. In fact you can even put that in invoices too
they summarize up the sales for the whole months, for all their franchises, and declare that
but then then finance authority came up and said "WAIIIIIT
you deducted like... idk, I'll now make some numbers up, I don't remember it, but they said sth like:
"You deducted purchasing 1 ton of wheat for january, and you claim that you sold 3 tons of bread."
"But from our calculation, you could actually have made 3.5 tons of bread with 1 ton of wheat"
ofc there is no chance to proof how much wheat they actually used
so it went to court
and then the funny stuff happens
the judge asks you "so much wheat is actually needed to make 1kg of bread"
and then they ask some bakery dude and he says "idk, maybe 700 gram"
And thats when the funny stuff came in and the show really began
and the finance authority says "but see, they claim it took them 800 gram"
and then you say "yeah but sometimes a bit falls on the floor, and stuff"
bla bla
in the end we settled with an agreement or sth, I dont remember the sum. but yeah, stuff like that
Sounds annoying
nah it's totally interesting. well if you're into that shit
Question regarding Guava's LoadingCache RemovalListener. Is there a possible way to send a specific context to the RemovalListener in-order to allow me to make logic where the database saves run sync rather than async as they usually would, while the server is running?
I bet its interesting when you get to do research into things not directly involved with your expertise
Makes sense
But anyway i should sleep, its almost 3 am
the finance authority thinks:
- Dude deducted 1000โฌ from taxes for buying meat
- And he says one kebab contains 100 gram of meat
- But he only declared 9500โฌ in income instead of 10,000
- SO HE BETRAYED US FOR 500โฌ
What they don't wanna understand is that you sometimes have to throw meat away because you cannot store it indefinitely. Or because maybe some worker accidentally threw it on the ground, and ofc didn't tell the boss, etc.
And it's my job to tell a judge that that's how life works, and that you just cannot put everything into numbers
well
whut
you'd probably wna use caffeine for that, since iirc Guava's cache framework is very barebone
I'll use caffeine in the future I guess. I'll just dump the map and save everything for now
yeah taking a dump is always a good idea if you're fed up with stuff
oh actually y2k, guava has RemovalNotification::getCause
but idk if thats what u meant
not very helpful as when the server shutdown its technically still explicit eviction as when its removed on player leave
so that would end up player leave eviction being sync as well
I could do some hacky static variable bullshit, but honestly... nah
Does anyone know how to add magicSpell plugin to library?
I tried to do that. but It always tell me "package com.nisovin.magicspells does not exist"
you probably didn't shade it
use maven shade or gradle shadow plugin
if you use neither of those get with the program
your putting all the contents of the library into your final jar
?google moment
Google your question before asking it:
https://www.google.com/
ummm..
Google maven shade if you are using maven
If you use gradle look up gradle shadow plugin
If you dont use either use maven
if you use neither ๐ feels bad
okay let me find about it
as you can see, this code spawns two horses, a Horse and a CraftHorse with nms, the Horse is consumed so I cannot see it for a second, that is ok, but it is a Horse, The CraftHorse turn into invisible but I still can see it for a moment, how can I send this packet horse invisible like the other one? please
@EventHandler
public void show(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
//CraftWorld craftWorld = ((CraftWorld) attacker.getWorld());
//EntityHorse entityHorse = new EntityHorse(EntityTypes.Q, craftWorld.getHandle());
attacker.getWorld().spawn(attacker.getLocation(), Horse.class, horse -> {
horse.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000, 1));
PacketPlayOutSpawnEntity horsePacket = new PacketPlayOutSpawnEntity(((CraftHorse) horse).getHandle(), 1,
((CraftBlock) attacker.getLocation().getBlock()).getPosition());
((CraftPlayer) attacker).getHandle().b.a(horsePacket);
});
}
๐ฅบ
So I'm working on a custom item plugin, and a very simple item is fking me over. No errors or anything, but what it's supposed to do is turn of the players gravity for 3 seconds then turn it back on. All it does is completely stop the server until the time is up. The tps goes super far down and animals don't move until the exact amount of time is up. Which is weird because all I did was turn of gravity for the player. It works with only turning the gravity on or off, so idk what the issue is.
`@EventHandler
public static void onRightClick(PlayerInteractEvent event) throws InterruptedException {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(ItemManager.FallCatcher.getItemMeta())) {
Player player = event.getPlayer();
player.setGravity(false);
Thread.sleep(10000);
player.setGravity(true);
}
}
}
}`
O_O
dont use Thread.sleep
oh no
you are telling the main thread to sleep
No need for nms
?scheduling
ty
I want to send it only for one player
how can I do that without nms?
other players cannot see this mob name
in my program, this is one of the rules
Tbh the link i sent is total shit and very confusing
Iโll write an easier to understand blog post tomorrow
I think I got something working but thanks
fvck off, I realize I'm telling with script kiddies, I've never work with minecraft seems I know more than you, only answers easy things, then pretend is not seeing my question and do blah blah blah I'll check all those nms attributes
Tell me you use scheduler
Didnt multiple people tell you earlier to just use Entity#setVisable
They left lmfao
Someone got a bit angry they didnt get their question answered instantly and other people got help too
I'm trying to use this dependecy: https://jitpack.io/p/TheComputerGeek2/MagicSpells
It doesn't work ๐ฆ
does anyone know that?
this is pom.xml https://paste.md-5.net/erazikewap.xml
?paste
I couldn't find information about maven shading... (I'm not good at English) ๐ข
What doesnt work
https://jitpack.io/p/TheComputerGeek2/MagicSpells
I wanna add this dependency for my plugin
but it doesn't work
So what exactly did you try searching on Google for? Or did you even try?
Yeah I tried it for much time
I exactly wanna use magic spell plugin in my project
what did you try
What part of adding it doesnt work
I wrote dependency and repository of magic spells but it tell me Cannot "Cannot resolve com.github.TheComputerGeek2.MagicSpells:core:7e23bad82"
I wanna explain it in detail and fluently too. but English is so hard sorry ๐
Have you reloaded maven
?img
Not verified? Upload screenshots here: https://prnt.sc/
so did you click the "Clean up the broken artifacts data ..." text?
sorry but what is meaning of clean up?
Look at the bottom of your IDE. It has text right underneath "Cannot resolve ..."
click it...
Not verified? Upload screenshots here: https://prnt.sc/
now errors are gone but It still can't load plugin
here's img https://prnt.sc/CMwO-dnnQGq-
Given an entity type, how do you create a packet for that entity?
Sorry I have to go. Hopefully someone else can keep walking you through this.
thx for your help ๐
An error keeps appearing, dont understand waht for.
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
F
Code block that errors:
ArrayList<Class<?>> regEvs = new ArrayList<>() {{
add(CraftEvent.class);
add(PlayerDamage.class);
add(PlayerChat.class);
add(PlayerJoin.class);
add(InventoryFW.class);
add(PaginatedUI.class);
}};
for(Class<?> cl : regEvs){ //Events
try {
Object cI = cl.newInstance();
getServer().getPluginManager().registerEvents((Listener) cI, this);
} catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException(e);
}
};
Related to this function in public class InventoryFW implements Listener
public InventoryFW(int rows, String name){
inv = Bukkit.createInventory(null, rows * 9, name);
}
Any ideas?
Whats line 47 of Main.java
21.12 05:06:58 [Server] INFO at me.emerald.serverplugin.Main.onEnable(Main.java:47) ~[?:?]
sec
changing, ill lyk if that fixes it
@jagged monolith @remote swallow Error presists:
Line 47:
Object cI = cl.newInstance();
Class<?> cl
I feel like it would be easier if you just pasted the full class.
The Main (now called setup) class or the InventoryFW
Probably both.
any events called when a player gets banned
Not really, but what you could do, is if you're wanting to get the player when they are banned, you'd listen to the PlayerQuitEvent, then do a check for isBanned() on the player.
yeah thanks i kinda new there wasn;t an event like that but just needed to know how to do it it
That would be the best way to do it.
Help.. I tested a bug with my anti-cheat, and found:
- Player's screen is NOT FULL SCREEN/MAXIMIZED
- Player is in air w/ flight on in SURVIVAL mode
- Player turns flight off
- AntiCheat flags for flight as if they are idling in the air, not falling
This is not an AntiCheat issue, as it does not flag when their screen is full screen/maximized..
Any idea why this happens?
The game doesn't care if you're full screened or not when doing movement logic
I'm not sure, the bug runs persistently on 1.19.1 & .2
You're going to have to send your code then
Fixed the issue by the way, I just needed to register the events differently.
Registers on classcreation now
Unsure if that will cause lag tho... registering every time the class is made
It's fine unless you create an instance of them multiple times
Hi a question is possible achieve change the texture of the chest to the Christmas one without changing the texture of all the chest?
maybe if you can somehow add data to the chest and then distribute a texture pack that targets that specific data on the chest? but i wouldnt be able to guide you there
i tried with random entities and cit, cit works just fine but random entites doesn't work for chest but in the wiki said just works fine
i asked on the reddit r/optifine for help but currently not getting one
unfortunately i cant guide you as i havent done it before, sorry
The only way i can think you could do it. Would be to intercept the chunk packet. but probably going to be more involved then you anticipate
hello
incompatible types: org.bukkit.inventory.ItemStack cannot be converted to boolean
if(current = null) return;
what?
the error already explain everything
and what are you trying to do
Can you not
i forget a package?
no you cannot convert a itemstack to a boolean
so how to check if item is null?
i have small info but i think you are trying to check if an item is present in that slot/gui or idk
for this try
if(current.getType() == null) return;
EDIT: the item can be even air this checks only if its totaly empty
no problem
You mean checking if an item exists in slot?
yes
oh no wait i don't have the problem
i helped the dude
if the item is null then getType will throw NullPointerException
and then you can check if the items is null or not as i showed on the bottom part
best way to check if an item is not null I think itโs if (item != null && item.getType() != Material.AIR)
.
good luck with that, jitpack is a joke
you are better off with decompiling your dependencies and "mvn install"ing them yourself instead of using jitpack
No
Your error is made before this
No
Also that has already been solved
They used = instead of ==
Oh thatโs totally my bad just woke up and read it as == @chrome beacon
how can i make spiral projectil trail using BukkitRunable
A runnable cause you want it to move over time?
ye
i want to remove particle when isDead() or if block under projectile is not air
i mean cancel the runable
Hey Guys, I am trying to create a moving spiral using particles and armor stands.Im summoning a moving armor stand to create a sphere around it. Im...
search in this channel for the user post and spiral particle. Both 7smile7 and myself posted code to do it
does anyone have a list of all those "MHF" heads for mobs / entities?
I couldnt find anything proper
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.
?
Thereโs also a list here https://minecraft.fandom.com/wiki/Head
thx but that's older than 1.8
oh yeah that looks better
well also same amount
well I'll just use that, and if something's missing, people shall just PR it themselves
Is it possible to run a command as an offline player?
To set a value of a variable you use =.
To check if a variable is equal to another variable you use ==
?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.
okkkay thanks ๐
You should learn java before you jump into developing plugins
no, OfflinePlayer does not extend CommandSender
Then is it possible to make the server think an OfflinePlayer is a Player?
only if they are online
only thing you could do is to implement the Player interface yourself but that sounds like a very shitty idea
why would you need to run something as a player who's not online?
makes no sense at all
And what if I store the player object, then perform a command after the player logs off
The player object will be set to null when the player logs off
what
I want to make a discord bot that so players can send commands from discord as themselves
that will not work
But I guess that's not possible then
what you could do is this:
You could use NMS to load the player's .dat file, then you get a ServerPlayer object
on that you could call getBukkitEntity() to get a player
but this will fuck everything up because their connection will be null
Make a blank connection?
I mean, what types of commands do you expect players to even run while not online?
Commands that display stuff, such as /balance or /list, and commands like /team invite, /trust
then translate those commands somehow
balance -> balance <playername>
list doesn't even require any player
Basically, players can not always log on, and it'd be nice to have the possibility to run commands on the go
well as said, you COULD load their .dat file but I doubt that this will work fine in any way
e.g. this is how I load an offline player's PDC: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_19_2_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_2_R1/NMSHandler.java#L434
in a similar way, you could get their whole NBT and then toss that into an existing ServerPlayer object that you created from scratch
or you just do new ServerPlayer(...)
I highly doubt it will work though
Configuration config = YamlConfiguration.loadConfiguration(configFile);
config.set("config-version", 1.3);
config.set does absolutely nothing
u need to save it after setting for changes to take affect in the file
if config-version is not in the config.yml, it will add it with value 1.3
but wont update if its already there
it does
Offlineplayer is a thing
it works exactly as expected
OfflinePlayers still do not extend CommandSender
this is what I am doing
what is "config"?
.
show the full code
oh I see
yeah you fucked up
you load the config yourself
then expect the JavaPlugin class to know that you changed your custom object
Offlineplayer extends serveroperator
either save the config yourself, or use getConfig() instead of loading it manually
and Bukkit.dispatchCommand requires a CommandSender
I see.
Which serveroperator is
// if config version is old, update it to current version
File configFile = new File(getDataFolder(), "config.yml");
if (getConfig().getDouble("config-version") != 1.3) {
try {
ConfigUpdater.update(this, "config.yml", configFile, Arrays.asList());
} catch (IOException e) {
e.printStackTrace();
}
// save changes
getConfig().set("config-version", 1.3);
saveConfig();
// reload config
reloadConfig();
getLogger().info("Updated config file to latest version");
}
is this good now?
no
why the heck do you do "new File(...)"
just use getConfig()
getConfig().set("config-version", "1.3");
saveConfig();
that is ALL you need
Serverconsolesender works. Which serveroperator extends
no
they want to allow offline players to run commands
in "their" name
e.g. they want sth like this:
"mfnalex enters /balance on discord while not being online. now the server should execute /balance as if mfnalex would be online and entered it ingame"
what about this method? it accepts a File object
aka the file in plugins/MyPlugin/config.yml
So it is do able, just they need to modify their code and use offlineplayer
nvm figured it out
works fine
they want to make it work with all plugins
That wont really work without a middle plugin to do some translating but ideally better off with some custom plugin
load your config into a file, do your changes, save it again using FileConfiguration#save(), then reload the config in the plugin using JavaPlugin#reloadConfig()
hold on i am confused
what method do I use to load my config file into a File object
YamlConfiguration myYaml = YamlConfiguration.loadConfiguration(myFile)
com.mysql.cj.jdbc.ClientPreparedStatement: INSERT INTO player_data(uuid, name, rank ,money, prestige, blocks-mined, level, plot, last-world, survival-world, location) VALUES ('55123b33-7dcb-4756-a7c2-31eb0691454d', 'Demopro', 0, 0, 0, 0, 0, '0 0 0 0 0 0', 'hub', 'world', '0 0 0 0 0')
why does this not add anything to my table
on sql
connection is made no problem
any errors?
well you should execute it instead of printing it lol
i do
?paste
you got no errors because you ignore the exception
print out the stacktrace in your catch statement
?paste
Use that instead.
use what
The paste service. Instead of filling this channel with the error.
i dont understand what the error is tho
i cant find a syntax error
PreparedStatement statement = connection.prepareStatement("INSERT INTO player_data(uuid, name, rank ,money, prestige, blocks-mined, level, plot, last-world, survival-world, location) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
Iโm updating a plugin from 1.19.2 - 1.19.3 using a little bit of NMS. I got the source code from GitHub of this plugin, when I go into the NMS class for 1.19 theyโre not using obfuscated methods so when I import the code to my IDE it canโt find these methods. How is this possible? Am I being stupid?
?nms
who is "he"?
Right so how do I build the plugin if it has errors
you don't
you didn;t run buildtools with --remapped
"has errors"...
And the methods what arenโt obfuscated show as an error
if it has errors, fix the errors
Clearly not
have you?
ok, end of help
yes I have, and then someone sent you MY blog post, which YOU did not read
then you complained about "it has errors"
Oml Iโm not even continuing speaking to you, clearly you donโt understand.
now it's the time to apologize and then we can look at it again in a nice and more meaningful way
Youโre speaking to me like I donโt have a clue
chill out guys
We know exactly why you have errors. I linked you to a blog that tells you the correct way to do things, you ignored it and became rude.
If they are using no obfs methods and you have errors on those method you have nor run BT with --remapped
I am not at my laptop right now but basically it doesnโt recognise the methods when theyโre not obfuscated
Mate I literally have
noone can help you if you don't send the proper error message
unless you are talking about packets and those names changed (for some)
I have the remapped jar in my BuildTools
yeah and tell us whether just intellij complains or whether it's actually maven that cannot find sth
what is the block data for button and pressureplate
i want to check if a block is a pressure plate or a button
getBlockData instanceof
Honestly I was trying not to be rude, but itโs quite frankly irritating when people say stuff like โjust fix itโ. Like I try not to come to these help discords first like some do, and only use them if absolutely necessary. I am not new to Java at all, and know what I am doing mostly so I just found it a bit insulting. I apologise if I upset anyone there.
And the errors well I can tell you in a minute.!
anyone know whats wrong with this line? syntax wise
missing ;
We need all the errors in your first message to tell you your issue. Including your pom/gradle is also needed for a proper answer. Donโt expect us to help without all the valid information @tawdry cedar
If thats not it, show us the sql error you get
Level might be reserved keyword, you probably have to escape it
Make your query a string instead
but still same error
public void updateConfig() {
YamlConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
getLogger().info(String.valueOf(config.getDouble("config-version")));
if (config.getDouble("config-version") != 1.3) {
try {
ConfigUpdater.update(this, "config.yml", new File(getDataFolder(), "config.yml"), Arrays.asList("null"));
} catch (IOException e) {
e.printStackTrace();
}
config.set("config-version", 1.3);
try {
config.save(new File(getDataFolder(), "config.yml"));
} catch (IOException e) {
e.printStackTrace();
}
reloadConfig();
getLogger().info("Updated config file to latest version");
}
}
ok so config-version gets inserted/updated but any fields that I add to the config.yml when compiling dont get added
previously it was the inverse (new values got inserted, config-version didnt get updated
String query = "querystring";
PreparedStatement statement = connection.prepareStatement(query);
Level is reserved https://en.wikipedia.org/wiki/List_of_SQL_reserved_words
Only for oracle db
yes
It isnt one for mysql
Yeh get that but my first message was asking if something was even possible. Then someone sent me how to do it I was like uh well i did that and got errors... then the reply I got wasn't very pleasant. Anyways not gonna continue it but here are the errors:
https://imgur.com/oATIkP9
Anyways they should try what i suggested
Also I have this in my pom.xml, as required.
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-mojang</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-mojang</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-mojang.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>```
And have ran a remapped version of BuildTools
does auto complete not offer you alternatives?
You can depend on both the server jar and api jar fyi
String sql = "INSERT INTO player_data(uuid, `name`, rank, money, prestige, blocks_mined, `level`, plot, last_world, survival_world, location) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; PreparedStatement statement = connection.prepareStatement(sql);
changed for name and level and same problem
all we did was ask for the error message
@tawdry cedar send the errors as text message pls, imgur never loads for me
it worked when i deleted the whole uuid, name and things listing
yeah I also experienced that
but I didn't find out why
lol
I also tried to rename all your columns, didnt help for me
and looked for invisible characters, but there weren't any
lol
maybe you have a wrong "comma char" somewhere or sth?
but then I also rewrote the whole thing from scratch with the names you used, and it still didnt work
I have absolutely no idea what's wrong
yeah but that doesn't add any benefits
Cannot resolve method 'getOrCreateTag' in 'ItemStack'
is that an IntelliJ/IDE error, or does it come from maven?
IDE
try to run maven anyway, then post the full maven log
just run mvn clean package
?paste the maven log afterwards
String sql = "SELECT * FROM player_data WHERE uuid = " + uuid;
ResultSet result = statement.executeQuery(sql);```
java.sql.SQLSyntaxErrorException: Unknown column '55123b33' in 'where clause'
is WHERE not a thing lmao hellp
public void updateConfig() {
YamlConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
getLogger().info(String.valueOf(config.getDouble("config-version")));
if (config.getDouble("config-version") != 1.3) {
try {
ConfigUpdater.update(this, "config.yml", new File(getDataFolder(), "config.yml"), Arrays.asList("null"));
} catch (IOException e) {
e.printStackTrace();
}
config.set("config-version", 1.3);
try {
config.save(new File(getDataFolder(), "config.yml"));
} catch (IOException e) {
e.printStackTrace();
}
reloadConfig();
getLogger().info("Updated config file to latest version");
}
}
ok so config-version gets inserted/updated but any fields that I add to the config.yml when compiling dont get added
previously it was the inverse (new values got inserted, config-version didnt get updated
maybe your config updater is just fucked up
do you know a good one?
I always use my own but it's basically not documented at all https://github.com/JEFF-Media-GbR/ConfigUpdater
The full log basically just spams this class file has wrong version 61.0, should be 55.0 Please remove or make sure it appears in the correct subdirectory of the classpath.
you either
- use an outdated JDK
or - use an outdated version of the maven-shade-plugin (should be 3.3.0)
[11:34:21] [User Authenticator #16/INFO]: UUID of player Demopro is 55123b33-7dcb-4756-a7c2-31eb0691454d
[11:34:21] [Server thread/WARN]: java.sql.SQLSyntaxErrorException: Unknown column '55123b33' in 'where clause'
it seperates - as columns
how do i prevent this
are you saving uuids as varchars ?
yes
save them as uuid(dk if that exist in your database) or as byte array
do i have to do ````uuid` ```
could you tell me how to use it in short?
no, but use uuid datatype
uuid doesnt exist nah
Send your sql statement
then i would save as byte array
statement
^
- you create a new configupdater object, then call update() on it. it requires the file name as it appears in the plugin folder, and an "instructions" file
- the instructions file tells it which nodes you explicitly want to have quotes
e.g. messages, so that admins don't accidentally add special symbols that wouldn't work without quotes
and stuff
and that's it
WHERE uuid = 'uuidhere' ;
right.
it's pretty basic, I only made it for myself
Okay the version of the maven-shade-plugin was not 3.3.0
I changed it to 3.3.0 and then
Tag name: version Description : The version (or valid range of verisons) of the plugin to be used. Version : 4.0.0 is the error
send the FULL maven log please
do you use intellij?
storing as binary/uuid is more efficient but whatever ig
i do
Use prepared statements
and me apparently
to get the FULL maven log, click the uppermost thing on the left side, and then you see the full log on the right side
1)easier to change/read
2)prevents injection
Also results in faster execution i think
ResultSet result = statement.executeQuery(); ```
like this?
use placeholders
?
โจ SQL Injection โจ
- is for everything
like in permissions plugins
@radiant cedar
`` for strings
please paste your full pom.xml too
? is for placeholders
either you are not using mojang mappings, or the plugin source code does not use mojang mappings @tawdry cedar
so please send your pom and then we know the issue
I meant in the context of @tender shard 's config updater
๐
There some site where you can test sql injection
setting your son's age to string
you didnt add the remapped .jar to your pom
you only added "spigot" as dependency
Wondering how the db impl handles setting parameters
but it should also have <classifier>remapped-mojang</classifier>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
<exclusions>
<exclusion>
<groupId>org.spigotmc</groupId>
<artifactId>minecraft-server</artifactId>
</exclusion>
</exclusions>
</dependency>```
????
oh sorry I didnt see you added both
Yeh I tried with one, and then added both
sourcecode moment
remove the first spigot dependency
@tender shard
True
you must only have one
how's ur calculator tho
When I was researching it I saw some people with two so ๐คทโโ๏ธ
yeah that's just plain wrong though
Implementing functions
and also
do NOT exlude the "minecraft-server" thing
do it exactly as in my blog post
?nms
Time to refactor
only add this one spigot dependency without any exclusions
are you using your priority queue
Im not using a queue
Implemented a char trie
in your old code
Tokenlist?
Im only using those for storage and solving the expression
"SELECT name, money FROM player_data ORDER BY money";
implement GUI
if name is a reserved keyword
it isnt
im asking in general what
should i add
do beginning and end
It's not supposed to be a graphical program
Ok ye that's fixed the issues, Istg I literally have tried it without both of them things before as well
if it was reserved
wait
๐
name is reserved
just wrap it in \"\"
More like a standalone library
usually you should wrap everything in quotes anyway
And it changed nothing, oh well now got to fix these other problems with the code itself lol
so it would be like "name" "level"
do mvn package again, then send the full log again
\"name\", \"level\" because you are already inside of string for statement
alternatively @tawdry cedar : Show line 88 of "NMSHandler"
does it say "WorldServer" or "ServerLevel" there?
can't he just
?
setString
no, "name" and "level" are the column names
you cant have pleaceholders in select afaik
not the values
PreparedStatement statement = connection.prepareStatement("UPDATE player_data SET `name` = ?, rank = ?, money = ?, prestige = ?, blocks_mined = ?, `level` = ?, plot = ?, last_world = ?, survival_world = ?, location = ? WHERE uuid = ?");
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank = 0, money = 0, prestige = 0, blocks_mined = 0, `level` = 0, plot = '0.0 0.' at line 1
so i shouldd just use quotes
instead of `
here
That bit is fine now
Add `
where
go for online SQL tester and select the db provider you use ๐
then send the full maven log again
can u test in java
final Registry<EntityType<?>> entityTypeRegistry = Registry.ENTITY_TYPE;
IDE Error:
Cannot resolve symbol 'ENTITY_TYPE'
it's gonna be faster online ig
yes, that changed in 1.19.3
the whole Registry thing is different now
Do you know where I can find the changes
but do u see anything wrong with the line i sent
you are going from 1.19.2 to 1.19.3 right?
yes
I'll show you an example from my nms library
Just change name to pname
Alright ye how did you find that out though
to find out the name, e.g. for Registry.BIOME_REGISTRY, you gotta decompile the 1.19.2 version. basically like this, I'll send a video in a sec
basically you check how exactly "Registry.BIOME_REGISTRY" was declared in 1.19.2, and then you know the key name that you gotta use in 1.19.3
@tender shard when u had problems with INSERT for specific columns and deleted
how did u fix this case for UPDATE
cus when i specify i get same error
yo wtf
PreparedStatement statement = connection.prepareStatement("UPDATE player_data SET rank = ?, money = ?, prestige = ?, blocks_mined = ?, plot = ?, last_world = ?, survival_world = ?, location = ? WHERE uuid = ?");
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank = 0, money = 0, prestige = 0, blocks_mined = 0, plot = '0.0 0.0 0.0 0.0 0.0' at line 1
how the fuck did you get that lmao
are you using sqlite?
get what?
don't you use IntelliJ?
I do
instanceof what
you can basically just enter any class name, e.g. "CraftPlayer"
then move your cursor over that
there is nothing for button and pressureplate
and press Ctrl+B / Cmd+B
No i get that but like
then it decompiles the CraftPlayer class and shows you the source
It obviously won't work if it's an error
yeah ofc you need the proper import
If you get me
So I will need to downgrade back to 1.19.2
Like you have the whole source code of a lot of NMS versions there is what I am saying
ye
MySQL
this my problem tho
what is the block data for Button
i dotn see a syntax error
basically, you can enter "Registry" into the 1.19.2 thing, then check the spigot class name, then go to 1.19.3, enter the spigot name, and it tells you the new name
just print it out and see. I don't know it by heart
it's probably: Attachable and AnaloguePowerable
@radiant cedar rank is a reserved keyword
wtf
Do `rank`
just put ALL your column names into quotes, you should always do that anyway
Hey guys, I know player.updateInventory exists but is there a specific reason to use it ever.
I'm now setting an item in use to AIR and it's not working and seems like i need to updateInventory for it to update the item in use?
I've changed before inventories with the inventory.setContents and it did not require an updateInventory after it so is there specific reasons this is needed?
and Rotatable
what is Rotatable
what is Attachable
what is AnaloguePowerable
Rotatable can be rotated
yes, I need it quite often in my stackresize plugin, e.g. here
Eg. Stairs
attachable can be attached to sth, e.g. torches or signs
AnalogePowerable is stuff that can emit or transport redstone
e.g. a lever, button, or redstone itself
so how can i check
if a block is a pressure plate
a material.toString contains ?
basically you need to use updateInventory() whenever you update an inventory at the same time where the client thinks they updated it
use tags for that
oh ok that explains it.
what are those
thank you alex
there is no getTag or whatever
@EventHandler
public void onPressurePlate(PlayerInteractEvent event) {
if(Tag.PRESSURE_PLATES.isTagged(event.getClickedBlock().getType())) {
event.getPlayer().sendMessage("You stepped on a pressure plate, or clicked on one!");
}
}
Tag.PRESSURE_PLATES.isTagged ^
tysm
what version are you on though?
many tags are only available in quite recent versions
1.17
it indeed is
I still use Set<Material>s for most stuff because some people are still on 1.14 -.-
I still do it like this
well im not publishing the plugin
use the tags, that's what they were made for
i used it
okkk
Registry hasn't changed tho?
Like the methods have but the package name is the same
Like I don't get how that website tells me new methods
yeah but the field names
hm well yeah you are in a shitty situation since the field names also havent changed
Guess I will just have to do what you are doing?
my tip would be to just use recaf or something, then decompile the 1.19.2 vanilla server.jar, and the 1.19.3 one
How can I create a Custom Entity in 1.19.2?
extend the Entity class
the NMS one
so basically you could clone JeffLib, then just create a Test class in both the 1.19.2 module and the 1.19.3 one
then yuo can just do the Ctrl+B thing lol
anyway I hope you don't still think I'm an idiot, but as you see, it was very important to see the actual error. That I was asking wasn't meant offensively ๐
in case you already cloned jefflib, you must update it, I only just pushed the 1.19.3 module
like 30 seconds ago
?paste
https://paste.md-5.net/uraduzaged.nginx
@tender shard your config updater is annoying
UUUUGH this fucking intelliJ update again installed this shitty "minecraft development plugin" D:
I don't, sorry about that hahaha. and ok i will
alrighty no problem lol :3
I'm sorry
How should EntityTypes be passed to the parent class?
?paste the full config after updating, and the full config before updating
and the included config file
you HAVE to extend an existing entitytype
it's not possible otherwise
e.g. if your mob is hostile and can walk and only do melee, just make it ZOMBIE
if it's passive but can fly, make it a bat
etc etc
just choose something that's close to what you are doing anyway
public class CustomSkeleton extends EntitySkeleton{
like this?
https://paste.md-5.net/ulilunoleq.coffeescript <- before
https://paste.md-5.net/kigavofise.coffeescript <- after
https://paste.md-5.net/ujonewenot.coffeescript <- what it is supposed to update to
@tender shard ^^
whatโs wrong with it?
https://paste.md-5.net/ipehegujes.sql <-- (more of) the error
stringlists:
- "^disabled-worlds$"
- "^dropped-head-lore$"
ignored:
- "^config-version$"
doublequotes:
- "^messages-.+$"
- "^prefix$"
- "^dropped-head-name$"
- "^death-ban-broadcast-message$"
escape-newlines:
- "^messages-.+$"
- "^dropped-head-lore$"
this is my instructions file
i have this issue in my server [ Proxy ] lost connection to server.
all the members kicked evenly for no reason and the server is running normally
so how can i fix this?
it doesn't add anything useful. the only thing it does is cause crashes from time to time
Can anyone recommend a readable Scoreboard API with 1.19 support?
god I hate the scoreboard system so much
@tender shard were you able to make anything of the errors?
same, and now I have to create a big scoreboard without flickering
oh yeah didn't I mention - it's not supposed to work with nested stuff lmao
I always do flat file configs
?paste
@misty ingot I never nest stuff in my configs, they always look like this lmao https://paste.md-5.net/afovoposaj.shell
that's why the config updater cannot do that
I think that admins agree that nested configs suck anyway
the screenshot looks way better than this
playerheads:
drop-heads: false
...
because if you just once forget the indent, the whole config is rekd
I have question
Something happend with -0.34 and it becomes 0.38, than same thing happened with -0.40 and it becomes 0.17
How to find out what happened?
erm whut
looks like you are using some mutable stuff like locations or vectors, right?
wait so
if not, I really have no clue what you talk about
lets assume that in version 1.2 of the plugin (which is downloaded by all users) the config is nested
and in version 1.3 it is not
will your code update it properly?
to being non-nested
no
it can perfectly update a flat-file manipulated old config to a flat-file new totally changed config
I trying to figure out how verical kb caluation works
but not if something is nested
the vanilla one?
Yes
and wdym with "-.34 changed to .38"
what would you recommend I do to make sure that everyone who updates the plugin gets a flat file config?
-0.34 before calculation and 0.38 after
@tender shard ever worked with chunk packets?
If your Y velocity -0.34 and you get hit it set your Y velo to 0.38
And if it -0.40 it set it to 0.17
Only a tiny bit
Aaah ok
Have you tried modifying a chunk before sending it?
Yes
I never understood that website, i always use nms packets
I was reading this and tell me if I'm understanding correctly
Oh
So how did you modify the chunks then?
@tender shard do you know how I could convert the nested config into flatfile if config-version is 1.2?
I use it only for listening packets
My idea was to deserialize the packet, modify the chunk and rewrite my own packet