#help-development
1 messages ยท Page 340 of 1
what kind of math
you can use a function like
/**
* Shapes the current progress.
*/
public double shape(double curr) {
return /* achieve the shape */;
}
in this case I wouldn't need it like a location with the x and z axis, I would really only need the height of the curve
idk what formula youd use
wait do you want to change the shape of the progress
or of the coordinates
progress
just do some math on the progess value, like a square or smth
to achieve the shape
yeah
i have no ideia a formula by can do that
you linearly interpolate between 1 and 0, then pass those progress values through a function which transforms them
i already have that formule
math ๐
try a Math.pow(progress, 1.5) or something
i should be doing tabcompletion for my parser
is it possible to remove this log?
Looks like you want to have a parabolic equation which is constrained to go through A and B, but I didn't understand a single word of your explanation, xDD
Want to show this message with my own logger system
yeah parabole
english is not my main xd
use pow
Then you have to improve your english, if you expect others to understand your explanation of complex topics. I'm sorry, but that's just how it is, xD.
wdym
''improve your english'' bro i using translator
So what? I'm also not a native speaker.
dude tf
@minor garnet
for (float rt = 0f; prog < 1f; prog += step) {
float t = Math.pow(rt, 1.5f);
// use t
}
who cares
if his englishabd
bad
I mean I want to use color code here & I have a method for log. so.....
Well, I didn't understand the description of what they want to achieve, so I actually kinda care... :)
uh oh dont use color codes in the console cuz it looks fancy
if you use a proper terminal, the warnings and errors etc will be in red by default
resuming
they could make a linear interpolation between two values (distance between points), but they want a quadratic interpolation
i intend to create a sound system that when played in a location, its sound decreases based on the distance of the player with the location of the sound
bruh mongodb crashed with 2k lines stacktraces
in this case https://www.spigotmc.org/threads/play-sound-in-range-with-different-volume.556511/ this is linear way
temporary failure in name resolution ๐
but i wanted the sound to be based on a curve so f way
How can I sort Teams?
Like the order they are displayed in Scoreboard
did it wrk
i just wanted to make it specific to this smart
what is prog and step?
progress can be the distance and..
and i just noticed youre just using a function
so i guess you would use
// the distance of complete falloff
private static final int MAX_RANGE = 10;
public static double getVolume(double distance) {
return Math.max(0, 1 - Math.pow(distance / MAX_RANGE, 1.4f));
}
alr
ty u very much bro !
That's actually not that far from a linear interpolation. I'm wondering whether a logarithmic decrease would sound more natural.
you could make the power higher
hm
are you saying instead of pow right?
// the distance of complete falloff
private static final int MAX_RANGE = 10;
public static double getVolume(double distance) {
return Math.max(0, Math.pow(1 - (distance / MAX_RANGE), 1.4f));
}
Not really, go into desmos and try that, it's kinda counter-intuitive
and one doubt if this is from left to right
and about that blue curve
that I would need to do the reverse
I'm gonna try to provide you with a logarithmic version, gonna have to think for a minute myself tho, haha
By accessing the Configuration section?
Hi, I have this little error and I wonder how to fix this ^^ (I use bedwars1058)
what version
Your name is longer than 16 characters, you should be setting your display name, not your actual character name I believe.
I was kinda thinking about something like this. It's a pretty good difference in comparison to a linear interpolation, but it's nothing too crazy. I think this should compensate enough for the logarithmic nature of our ears.
My minecraft nickname?
Yes, a plugin could be interfering with it.
My nickname is currently 14 characters long ^^
how? can i use plugin.getEventsConfig() like the default plugin.getConfig()?
https://paste.md-5.net/ekeqicekih.php
this is my different scoreboard, I do not understand why this is too big ^^ especially with JAVA 8 everything worked well and with java 11 not
On the scoreboard?
For the scoreboard?
Scoreboard prefix and sufix changed on the Minecraft api, not java
I believe you can't type same names on different lines
Try adding a color on those blank rows to make then different
And what exactly is not working?
Ah I saw above
Then you changed Minecraft api version, not java.
U can type 16 max characters. So u use prefix, sufix and name for a total of 48
Using Teams ๐ค
yep
U can only type max 16 characters on each "string"
private static final double MAX_DISTANCE = 10.0;
public static double getVolumeForDistance(double distance) {
distance = Math.abs(distance) / MAX_DISTANCE;
if (distance >= 1)
return 0;
return -1 * Math.log10(distance * .9 + .1);
}
Oh btw, this would be how I'd implement it. It's thus a symmetrical function around the origin and doesn't need any additional calls to min or max. There's also the fast-exit of the distance exceeding the max-distance.
is there a player entering a boat or player entering a minecart event?
Probably this one
optimisation bruh
Is segmenter a valid english word? Or is it segmentator? Or segmentor? Man, what do you call something which segments something? My lord
uh oh
in the same way as the config.yml file, I have to create a new one in the resources folder to save it in the plugin folder but the saved file is empty
any idea why ?
wdym its empty
what would be the event for player trying to trade with a villager?
the .yml file in my resources folder has content, but when creating the file in the plugin folder the content does not paste
but I don't understand how to tell it to copy the file to my resources folder
There is saveResource method in JavaPlugin
I don't think that is a wise choice
Are you using it?
uh i forgot about smth so might not be so wise
If anything it should be .getCodepoints, but null terminating stuff is asking for issues
whats getcodepoints?
Ah, doesn't exist - stupid java devs
.codepoints() exists, but it returns a stream
And it's J9+ only
ok fixed it but looks kinda weird
now let's just hope you don't get non-ascii input
I barely use arrays
Only ever really use arrays if I'm trying to be super memory efficient
How can I display players ping in scoreboard?
The most effective way of it?
actually that null terminating is useless, i was trying to improve performance but it doesnt change
still need to check smth else so it stays the same
hi, is there a way to set a column by column index?
can sql store arrays?
yes
Hello , how can i provide the syntax hint but not make it be an option like the screenshot when typing command with ACF (Annotation Command Framework)?
looks like brigadier
i know they have brigadier support, or its just the paper command manager idk
i tried many examples in the examples in ACF's github page , but they are become an option to use , are not just a hint.
i am storing a lot of data in a sqlite database and i wanna edit the data. It's just a command separate string. An array of booleans pretty much but there a lot of em.
is there a way to edit one character in sqlite?
since this operation may happen a lot as the database is active.
or is there a better way to store arrays in sqlite?
what are you trying to do?
public static final int PLANT_TREES = 0;
public static final int USE_ENDER_CHEST = 1;
public static final int USE_ANVILS = 2;
public static final int USE_LEVERS = 3;
public static final int USE_FURNACES = 4;
public static final int USE_BOATS = 5;
public static final int BREAK_CROPS = 6;
public static final int USE_PRESSURE_PLATES = 7;
public static final int USE_FENCE_GATES = 8;
public static final int USE_BEDS = 9;
public static final int CHOP_TREES = 10;
public static final int USE_BUTTONS = 11;
public static final int OPEN_SHULKERS = 12;
public static final int USE_ENCHANTING_TABLE = 13;
public static final int KILL_FRIENDLY_MOBS = 14;```
if this answers the question.
no
i am just trying to store an array of booleans, that is it.
permissions for each player?
well for the plugin i am currently working on, permissions for each chunk.
this is kinda what it looked like
pretty much just wanna do it O(1) time per element.
instead of having to change the entire array.
what is one element? one bit?
im afraid that is not possible
i mean it also depends on your scheme setup, but if its in bitmask or whatever, you would have to read whole bitmask, do operation with it and write it again
unless im missing some feature of sql
i am using sqlite.
saw this
its still using simple query language
i am just storing array of booleans right now but if i wanted to store more data than this, i may wanna know an efficient way to do it.
are you using a boolean[] in your java code?
n boolean will take n bytes, use a BitSet where each boolean will take 1 bit
but ye just optimisations, doesnt matter too much
I would just update the db in batches
I don't understand the error
isnt it .spigot().broadcast()?
sqlite probably should provide a better way for storing arrays though.
but yeah its best to just use a binary int that is just the amount of bits as you have options, maybe group certain stats together so you can grab it, edit it and send it back
common interpretation of it is if you need array in database, its probably bad relational design
my tuto is a bit outdated ๐
thank you
i would personally do what fourteenbrush suggested, bitmask
hmm anyways which one of the three is the cleanest?
me trying to optimize reading times for each char
the first one
1st
clearly
atleast that one hides the ugly code ๐
yep bitmasking is probably the way to go here.
just googled it though.
well
i knew what it was but was just unfamiliar with the term.
so basically like if i have 32 booleans to store, i can store in a 4 byte int or something and just set the bits of that int individually, right?
I swear gpt was better when it was released
btw, how do i go about manipulating individual bits in java?
| & << >>
How can I check if Team is registered?
what?
sorry, i have not really used this feature before.
Those are bit operations, first is bit or, second and and other two are shifts
my dumbass always though that x ^ y
is equivalent of Math.pow(x,y)
and for example, if you have 2 as bitmask (binary 0010) and want to check if your bitmask have permissions which mask is for example (0100) you would do 2 & 4(as its decimal representation of 0100), if its equal to 0, you dont have that permission, if its anything other (or 4 in this case), that permission will be present
if value & flag != 0 => flag present
๐
#general message
bruh
ij probably wont have my code changes history from 3 hours ago so cant reformat :(
bruh how 2 chars break my code
wait what exactly are you trying to do?
and what exactly is a generator?
so you're trying to have one generator for a bunch of different file types?
and storage is just database/ yml files?
you could provide an abstract method in BaseDataApplication<D> that produces instances of D.
For example,
protected abstract D newBaseData(YamlConfiguration config);
And then you can have the extending class provide the implementation.
hi, how do you create a void world? i want to make a waiting world (kina like hypixels afk world or 2b2t queue) that doesnt take up a lot of memory, how do you do that?
does this take up much memory?
cuz basically i want to make an afk world where ppl get tped to that are afk
and a lot of ppl need to be there so it should not affect memeory
no, i mean when like ppl get tped there
also how does hypixel do it?
do they have multiple worlds?
im pretty sure hypixel uses like 1 of their dedi's around the world to host so many limbo worlds/servers and each world is like millions of blocks big
and its just repeating the same thing
for miles
yeah
bro but that takes up a lot of memory
hypixel dont care
they probably have like 500gb or something like that or more per dedi
they probably give a mode like 5/10gb
wonder if they get to petabytes of ram
They post stats for all that stuff every year iirc
they do?
We're really proud of our network, so we figured we'd release some numbers.
1 Network:
1,723GB of RAM
6,120GB of SSD hard drive
13 Bungeecord instances
16 Minigame lobbies
55 Dedicated servers
725 Minigame instances
360 Adventure instances
1,626,186 unique players
176,340 friendships
6...
6TB lets go
Yeah, 2021 here https://twitter.com/ConnorLinfoot/status/1475584348531347460
i bet thats around 150tb ram
43 to 79
they have to be a registered company so there might be some numbers online
1.2 million dollars a year
2015
That was 2015
imagine now lmao
what if it was like 1.2 million a month now
they dont tell us cpu
sadly
one second
im gonna do some math
im which country is hypixel registered
if we take a guess that hypixel use 2pb of network a week
in a year they use 104 petabytes
top one is hypixel
but i wonder if the 2nd is too
2nd one isnt
not registered to simon
it's the comany created for hytale iirc
not entirely sure - it is likely that the ownership structure is a bit different for the studios one
im guessing its a high up staff member in hypixel that owns it
or its a hypixel partner
trade marks are owned on all of them
Does anyone know anything about playerdata and stats?
I assume someone here know about it
Hypixel Studios, the company registered for hytale and other games
which is now merged with riot
Is not really owned by simon
he has a business partner
what actually is hytale
their own game
they have a game?
working on it
it looks mc esque
ok this feels like a very stupid question...but how i can use a duration for a command argument, such as a ban or mute, there is 1d, 25m, 15m, 2h etc.
i've been doing this for a while and unfortunately have not done this before
i.e. in my case im doing BossBars...so would like to have /bossbar create <color> <style> <duration> <title>
Depends. If it's preset times then you can add a list of them to auto complete and have a HashMap that matches that to minutes or w/e time unit. Otherwise write a parser
alright, thank you.
can I run Bukkit.getWorld(uuid).getPlayers() async? (Made it a one liner to display everything I need there)
how could i explode an ender crystal from a plugin
Using some blocking operations on players
You shouldn't do that async
Alright then
Time for task chain
Yeeee
I just chained two tasks together
var players = getWorld().getPlayers().toArray(Player[]::new); and I run the loop on an async task
should work
(toArray to make sure it doesn't change in iteration)
You shouldn't really use the player object either
smh
Grab what you need sync
var user
think its for the game studio
hytale is developed under it
yeah
What would be the equipvalent for the calling default a rank? Cuz default is a Java keyword
Call the class DefaultRank or smth
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.
there
Defa
?? ๐ค
This is
- rude
- unrelevant, since VERANO probably knows why they can't use "default"
how to retrieve my variables declared in TimeVoterCommand in the VoteUtils file?
Yo should use DI
DI ?
DI - Dependency Injection
So in that case i would pass your command instance directly to VoteUtils, instead of passing your plugin instance
but I need both
defaultRank
Yeah that why, since you already passing plugin instance to command, then via command instance you can access to your plugin one
it's in the case that I have to have two that I don't know how to do
I have no idea how to use DI in this case
how you were doing it
Instead of passing your plugin instance, pass directly the command instance
I need the instance of my main file, how can I make a second instance of another file?
?di send this
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
DI is a designed pattern which allow you to pass instance/s thru constructors
That the simpliest way to explain it
how come this isnt a uuid?
[20:59:32 WARN]: java.lang.IllegalArgumentException: Invalid UUID string: 3a8a6c51b01b4a98b387c693957b21e3
[20:59:32 WARN]: at java.util.UUID.fromString(UUID.java:194)
[20:59:32 WARN]: at me.hyptex.kitpvp.DisguiseHandler.setDisguise(DisguiseHandler.java:51)
[20:59:32 WARN]: at me.hyptex.kitpvp.commands.DisguiseCommand.disguise(DisguiseCommand.java:31)
[20:59:32 WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[20:59:32 WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[20:59:32 WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[20:59:32 WARN]: at java.lang.reflect.Method.invoke(Method.java:498)
[20:59:32 WARN]: at me.vaperion.blade.container.impl.BukkitCommandContainer.lambda$execute$7(BukkitCommandContainer.java:254)
[20:59:32 WARN]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[20:59:32 WARN]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[20:59:32 WARN]: at java.lang.Thread.run(Thread.java:748)```
its cause im getting it from the mojang api but theirs dont have dashes
so if I want to use plugin.getServer() in this situation, I use Bukkit.getServer() directly?
?paste the method
You can do that or get it via your main class
I woudl stragiht forward recommend using access modifiers
how can I use the variables in my main class after doing this?
follow one of the regex solutions on here https://stackoverflow.com/questions/18986712/creating-a-uuid-from-a-string-with-no-dashes#:~:text=The straight forward solution is,UUID%2FfromString .&text=If you want something without,use a ByteBuffer and DatatypeConverter
So what do you expecting to do ? Im confused right now
I have no idea
I am completely lost with DI
Why would you have your utils class as an object
it's already done
that getPlugin method is pointless because you need an instance of the class to call it, you can pass this in instead of plugin, pass the command instance to utils which is just wrong
utils methods should really be static
sorry but I don't understand what I'm supposed to do
what i sent about di?
yes and what you are trying to explain to me
make your utils not need di, utils should never need to be initilized, it should be able to be called anywhere in any situation
so I remove the Utils file and put it directly in TimeVoterCommand?
no
๐
make the utils not need initilizing
how?????
in the tutorial he puts all the variables in the main class so he doesn't have this problem, but I wanted it to be in the command file
that's why I'm totally lost
Utils.doSomething(plugin, "cool info thing");
&
public class Utils {
public static void doSomething(JavaPlugin plugin, String string) {
plugin.getLogger().info(string);
}
}
``` instead off```java
new Utils(plugin).doSomething("cool info thing");
public class Utils {
private JavaPlugin plugin;
public Utils(JavaPlugin plugin) {
this.plugin = plugin;
]
public void doSomething(String string) {
plugin.getLogger().info(string);
}
}
Right, utils classes should mostly have static methods
oh this is what you call static method ?
Yes
static should be used for utility methods and some other things
ok I will try to adapt my code
Logically calling a method with a reference makes it static, just harder.
in fact, class Utils are only there to get data more easily/quickly, not so much to execute?
how to prevent player from closing inventory
i get stuck in a loop when i make it reopen on closeinventory event
it's when players join btw
I feel like the inventory gets naturally closed for some reason
then opens again..
it's weird...
utils classes and methods are such that they don't really fit with the normal program and either just contain some useful methods to do something or in some cases help you get more data. Lets say you wanted some particular thing formatted a certain way, you could easily turn that into a util method or class on its own so that anything could use it.
whether a util method or class needs to be static depends on where or how you want it used
it being static would allow it to easily be used say in Anonymous inner classes without much issue
just note that anything static never gets GC'ed
Open inv 1 tick later
i tried opening it like 60 ticks after they join and still same problem
@humble tulip
Huh
i feel like the inventory automatically closes before it shows up for some reason
idk im not sure
because im opening it for them onJoin
so maybe it closes and opens again
and that would explain the infinite loop
so idk what to do
Hi can someone help I am trying to make the code put in block location a bed but I don't know how to do it
Also take in knowledge that using Player#closeInventory() can bug the cursor when you open it again
@quaint mantle
it should just drop the item if you had an item on the cursor while it's being closed
oh right, but sometimes happen to me that they just disappeared
this seems like such an easy thing to program bruh
how could it be so impossible
even chatgpt cant find a solution to my problem
I think this is about the time you show how you are doing it
there
infinite loop in the console as a result
when player joins
any idea? @wet breach @sterile token
Post your code...?
here
How do you know there is an infinite loop?
it just spams errors in the console
Ok
Yes
first and foremost don't compare inventories using titles
hold a reference to your inventory object and compare the inventory object player has opened with the one you have in memory
reason for this is that inventory titles can be changed client side with a packet
well not changed, but sent
second I need you to elaborate what is the goal with re-opening the inventory
do you not want them to close it?
ok so to prevent the two events from conflicting with each other
set a boolean that both check
so, when they join, the boolean can be false or 0
and then when the inventoryclose event handles it, have it set to 1
then this way anytime the open inventory event fires it can see it doesn't need to do anything
hold an instance of the actual inventory
you have to store it
cant you cancel inv close event?
Alright
no
sad
not sure but even if you could I could see some scenarios where it wouldn't work anyways
if at anypoint there is a time where the inventory does need to be closed you could use a different boolean for that too
this way your inventory doesn't just keep opening indefinitely when it does need to close ๐
and you just make that boolean a global thing that is kept in memory so it doesn't get lost and the events just check it
this should stop your indefinite opening and closing of the inventory lol
didnt work btw
well before you worry about that, lets get your inventory working
e.getInventory().equals(inv) is just true and same stuff happens
and then from there you can fix it to be proper
I'll try the boolean thing
.equals should be used for strings, == for that use case
.equals works but both have to be the exact same content wise with nothing changed
== works if they both point to the same memory instance
or should say they both reference the same memory
btw chatgpt suggested same thing u suggesting@wet breach
lol
tried it didnt work
lemme see again
depends what you need, but essentially what you have going on is two events trying to do the same thing
so the boolean is just to keep one event from doing something if the other has it handled
onjoin oncloseinventory
so, it would be wise to have the onCloseInevntory handle what you are wanting since it contains the most code and checks
so you would in in onJoin check if the boolean is true, if its not do its thing then set it to true
basically the goal is:
player joins, opens inventory
when they try to close it, it opens it again
yes but when they try to close it, the close event should handle that
but not before join event has handled anything
therefore the boolean
and then once the boolean has been set, onJoin shouldn't try to do anything. I would improve on this to make it a per-player boolean
but as I said lets get your thing working first ๐
oh nice, anyways just a simple stall check just prevents multiple events that get fired at once from doing everything at once XD
this should solve your infinite loop of inventory opening
e.getPlayer().openInventory(inv);
players.put(e.getPlayer(), true);
onCloseInventory:
if(e.getInventory().equals(inv)) {
if(players.get(e.getPlayer())){
e.getPlayer().openInventory(inv);
}
}```
what i have
first check the boolean before checking the inventory
nah, endless loop still
it is a faster check to check for the boolean, because if its set for the close event to do nothing, why do we need to check the inventory?
StackOverflowError
you don't have any other plugins?
true
no
@quaint mantle Lol
you forgot to have the onJoin check the boolean
?
Itโs just funny, ignore me
what would i check it for
I know it doesn't make sense, but do have onJoin check if the boolean is set, if it is do nothing. the Close event should only do something if it is set, if not do nothing
alr
multiple join events can be fired when joining, is why that would make sense ๐
so check if map doesnt contain key player
then put player and boolean in there
could be done with a list too when u think about it
Might be fun to use metadata too.
yeah
maybe
we can improve it once the problem has been resolved ๐
i tested and if i just open an inventory when the player joins, it instantly closes and opens again
by puttin sendmessage in oncloseinventory to the player to show when it has been closed
there's something going on where the inventory gets closed automatically
and also we know that whatever we put in events happen before the event is triggered
its probably a new thing possibly when joining servers
true, I'm using spigot 1.18.2
The JoinEvent gets run a lot of times before the client actually loads properly in.
then that's the issue
well, I could see mojang implementing in 1.18 some kind of inventory close thing
it opens the same inventory mutlitple times
in case maybe the player wants to leave?
would explain why it closes
this is why I told you for the onJoin to check the boolean
it will because if the inventory closes the inventory close event will handle it from there
you had 2 events trying to do the same thing
and thus conflicting with each other
just it was automatically happening as opposed to done by user input ๐
adding the boolean check to both events allows both events to escape the indefinite loop ๐
should i change the boolean in the onclose event
So, in onJoin since you are using a map, you should first check if the player is there. If not add them there and the boolean. If they are present in the map, check for the boolean if set, do nothing
if it is set, that means onJoin already fired and did its thing and it should no longer do its thing for that player
And then inventoryCloseEvent should pick up from there
how can I get the keys from eventsMenuGUI (in config.yml) to put them in an array, and then forEach on them?
You don't have to, just one of the events should set the boolean. It Makes sense for onJoin to do it in this case because its being fired multiple times
if(!players.containsKey(e.getPlayer())) {
players.put(e.getPlayer(), true);
e.getPlayer().openInventory(inv);
}
enough like that ?
in onjoin
and then add an else statement
that checks the boolean
and then ?
if its set, return
Loop over FileConfiguration#getConfigurationSection()#getKeys(false)
i dont see how it could change anything ?
i tried without it
it doesn't work: endless loop again
private Set<UUID> assSet = Sets.newHashSet();
public void onJoin(PlayerJoinEvent event){
if (assSet.add(event.getPlayer().getUniqueId())){
// Open inventory.
}
}
you could add some debugging messages to be outputted too
something like that?
just send messages to console or the chat that states where in the code is what is being executed
doesn't seem any different from what we're already doing tbh
but you definitely should check for the boolean in onJoin.
Try waiting a few ticks, that is always great.
have the if statement ran in a scheduler and schedule the task a couple ticks out ๐
Is there a reason why MapPalette (https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/map/MapPalette.html) is so heavily deprecated? What are we supposed to use instead? Did the colors change over time?
declaration: package: org.bukkit.map, class: MapPalette
only thing I can think of is that 1.18 is doing something new
but you should add debug messages
so you know what code pieces are being executed
can even output data too along with it
I don't use lambda mainly cause I don't understand it, but I think you're on the right track.
for (String section : config.getConfigurationSection("path.to.your.sections").getKeys(false)) {
System.out.println(config.getString("eventsMenuGUI." + section + ".worldName"));
}
the problem is i can't even read chat
or console
because it spawms the overflowstack error
you can from the logs
damn you want me to go to logs
and scroll all the way up there til i find my strings in this mess
you can use cat and grep to find what you are looking for
cat will just output the text to console without opening the document, grep to filter
what do you call lambda?
ngl im not doing all that man
such a pain
lol
welcome to plugin development when it hits the fan
I think that's one of those cases that it's been deprecated for a long time, but there is no real intention of removing it. Kinda like how Bukkit#getOfflinePlayer(String name) has been deprecated for a long time, but still has valid usecases.
Lambda is the arrow syntax.
its deprecated for magic values, not that you can't use it. Basically it is warning you of some caveats in using it
deprecated doesn't necessarily mean unusable unless it states as such
Really think there should be a different annotation at that point, but I guess that's just me.
I'm just not at all aware of what the caveats are, as they aren't stated anywhere. That's why I was curious whether they changed the available colors on any update, because I don't see why the use of these magic numbers would be discouraged otherwise. They are centralized and maintained, so...
Deprecation just really tells me "don't use this". And if you tell your users that, you should be providing an alternative. Having all those warnings when compiling and having to suppress them is just not at all ideal.
Exactly, that's what I interpret it to mean as well. I don't get why it isn't annotated differently to represent it as such. We all know that Bukkit#getOfflinePlayer(String name) has legitimate usecases, but because it was misused so much they went and marked it as @Deprecated.
there is no requirement to suppress them
warnings are not errors
magic numbers means hardcoded values
they are generally bad because it enforces a design principle that is highly discouraged
Of course there's no requirement, still I don't know why I have to look at them each time. They shadow real warnings I'm interested in. This way, I have to check the warnings manually each time and cannot just rely on zero warnings.
Like half of bukkit?
no longer the case in the majority of stuff
Mojang has moved away from using things like magic numbers to strings, however not everything is quite like that or can be just yet
the reason that i know for them deprecating that function is because they wanted developers to use UUIDs instead of player names
It was. It's just a little annoying that it's still marked as deprecated. I'm pretty sure most people get that storing uuids instead of names is the way to go now.
its way easier imo, it helps ease comparison checks since UUIDs dont change
you forget that while you may be experienced, we still do get new developers that are not aware of this things or appropriate principles however the reason the method isn't removed is because there is still valid reasons to obtain the name
why don't you just use Cmd/Ctrl+F to find it lol
indeed
every app has
found the issue btw @wet breach ๐
โ
I understand that. I don't doubt that someone new might try to store names, but there's now countless threads and resources showing why that they shouldn't do that. There's still plenty of things that newbies do like comparing inventory names or not using the pdc, but we have ways to guide people in the right direction.
Marking things as deprecated because of misuse just seems like the wrong approach.
guides become outdated and posts/threads loss to the abyss. Javadocs on the other hand, are always attached to the API and hosted in the repo ๐
sure for the experienced it becomes a nuisance I guess about those warnings, but you can always tailor your IDE to ignore such things
especially if you are doing MC development
does your IDE not support profiles?
Lol no. It's just a gripe.
just in case: i made it so player and boolean are always in map since first join, then if player has inventory on --> boolean set to true, if inventory closed --> boolean set to false. then i just made a scheduler that checks every 2 ticks if a player is in the map and has boolean set to false, if so it makes the inventory open again. no infinite loop and we celebrate
I knew you would figure it out ๐
just had to point you in the right direction
thanks for the help
and as for earlier, yes I am aware that I tend to give the same response or similar to that of chatgpt ๐
you are not the first to point that out XD
Can't believe frostalf is actually a bot! ๐คฏ
you also wouldn't be the first to suggest that either lmao
I wish I could be like chatgpt though with all that other knowledge
One day, I want to have like an official class thing to teach programming and some IT related things
just so those who want to get into such things have somewhere to start
or maybe just want to be more informed
ik you'll get there one day man
Is there a way to spawn a firework "from a player", as though they launched it by right-clicking say, on the ground ? (I want to use this for elytra boosting)
alright, thanks
I been providing tech support since I was like 14 ๐
one day I will have my own business that does tech support and also provides classes to teach
I once got paid by a person in India for resolving their DNS issue they had going on. This was when was subcontracting with PhoenixNAP.
anyways that was interesting to do because I couldn't chat them live, so I had to resort to email and they were also not a native english speaker
so I had to resort to google translate at the time, which I made them aware. So I would send my message in both english and their native language, in case google translate didn't translate something properly lol
anyways, they paid me $500 when I charged them $200 for a week long conversation over email
I told them the DNS settings they needed and also explained to them what each of those settings are for and what they do
at first I thought it was a mistake and didn't accept the payment, and messaged them about it. They said it was correct because they felt $200 was too low because no one else could resolve their problem as well as provide explanations.
explaining why their problem was occurring as well as the various config options they needed
Anyways, enough of the rant I suppose ๐
reminds me, one time this friend of my dad's wanted to update his son's tablet, support for which had dropped at like 2012 or smth
i had to dig in old forums to be able to find out how to root it and find the appropriate rom to flash
it took me about a day or two and i got to name my price, but since i didn't do anything of the sort before i went super low at like 10 or 15 because i didn't know what the standard price would be and i didn't wanna scam anyone
Any ideia on how can I call getConfig() outside the JavaPlugin's extended class?
uh whats the usecase
Di or static getter
if its outside of JavaPlugin then you're not doing it right
oh you mean another class?
He wants to access config
thought you meant completely out of plugin
If I understood right
if it's being instantiated in the onEnable i suggest adding a JavaPlugin parameter to the other class's constructor and setting a private field inside that class to it
I'm making a simple fly plugin to study, but I'd like to make fly persist on username, but the FlySpeedCommand class (which makes /fly have an use) is outside the main class (the one that extends JavaPlugin)
apologies if that's worded badly
yeah, just use di
?di is what erdi explained
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
di?
you could also be lazy and have a static getter
yes, that
Meh di is better for beginners
oh ok
Good habbit to reinforce
thank you
Hi can someone help me I am trying to make the code put in block location a bed but I don't know how to do it
When you want the bed to be placed? For example: When you right click a block, when you look at a block?
in a command
you want to change the block you looking at to a bed when you type a command?
hey, I changed the config.yml file manually, added the arguments I'd like. But when I compile to the jar, the config.yml stays the same as before the changes, how can I debug that?
When the server lags, sometimes the InventoryClickEvent is not cancelled properly, and players can get away with stealing items from GUIs that really shouldn't be stolen from. Is there a way to counter this?
i wasn't aware of that. are you positive the player actually gets the item? what if it only exists in the client
It's not a "ghost item" that happens when you quickly shift+close. The player actually gets the item and it is usable. My friend and I are actually testing for an SMP plugin, and when /reloading, you can a short window where all plugin guis stop working, but he says that also happens when the server lags a lot
That "lag" sometimes gets perceived as the InventoryDragEvent. So you might want to cancel that too.
you could try and use InventoryMoveItemEvent
no
oh wrong quote
no InventoryMoveitemEvent
that's for hoppers
Thats for hoppers
oh
kinda weird name
yea a bit unclear
Is that the event that gets fired with touchscreen mode active?
I remember from Hypixel Skyblock there were bugs tht happened when you activated touchscreen mode ( you could take some gui items, such as barriers )
No, it's when you drag a stack of items across multiple slots.
good luck
Its worth doing a collector plugin for just $20 ?
collector?
Collector for items to be specific
dont understand
I honestly think that price is a tremendous offense, for 20 dollars I wouldn't make you any custom plugin. To consider that plugin, you should have at least offered me 50-60 usd.
if it isnt a lot of effort and you need the money i dont see the issue with taking it
Something like that, but it isnt so simple to do it. In my case takes me too much time for the paid i get
oh atleast
the client got mad because he said that i was trying to steal him
๐
lol then tell him to go somewhere else, his problem not urs
yeah i instant blocked him
Hey! Is proxy the same as current mc development? Use velocity or waterfall and build for bungee?
you arent the first to make it
well thats a premium plugin on spigot
What specific method is unusable in async?
Some method work in async but some other method doesn't work.
Right 1m
Bungee was the first, then waterfall is a fork of Bungee (if im not wrong) and Veolocity is a mc proxy recoded from scratch
Yeah but current dev is use paper as base and build for spigot
Is that the same for proxy too?
Which one do I use and which one do I build for
Proxies doesnt care about mc server, just depend the version of the game
Not what I mean. I think I'm explaining it wrong
We build plugins for spigot but most servers are using paper
oh you mean in terms of coding right?
What's the case with the proxy? Do I use bungee jar and build for bungee? Do I use waterfall jar and build for bungee?
Yes, I do
Server base jar + coding for what
If im not wrong bungee plugins, should work on BungeeCord and Waterfall
But they wont work for Velocity, because its recoded from the scratch
And waterfall prob has the same improvement than paper vs spigot
So prob use waterfall and paper for server jars and code for spigot and bungee
Resend soli, i reject sorry
explain him minimum hourly wages in your country, explain him an average time it may take you to complete, then politely ask him to go and look for someone who may do the job for that price even if quality is not decent. if you were polite enough, there's a chance of him getting back to you in case he thinks you deliver the price/quality that he's looking for
just block them
Hi there's this weird thing that happens on my server every now and then where players get kicked like this: https://imgur.com/YRq2iWT
im trying to use the playerkickevent to try n do something when a player gets kicked for that, but it doesn't seem to fire for some reason? my code is:
public void onDisconnect(PlayerKickEvent event) {
System.out.println(ChatColor.GOLD + "Kick message for the disconnect above is " + event.getReason() + ChatColor.RESET);
}```
but it doesnt print anything to console
for regular kicks it works but not for this specific disconnect
if it matters then im using bungeecord
Even if you could churn out that plugin in an hour, that's still $20/hr which is pretty low lol
You just haven't allocated enough memory to your server is all
Or proxy. Wherever that error log is from. Whichever program is running there needs more memory
ik that and rn im saving up for a better host for my server but in the meantime i just wanna restart the server whenever anyone gets kicked for that
Well the PlayerKickEvent is called when they're kicked via /kick. You're not really going to be able to get that kick reason
Is there a way to assign something unique to player proxy? Or know when he joins / left the proxy
bungee doesn't keep track of any playerdata. just create a Map<UUID, YourStuff> ?
Hmn because i was thinking doing some rest api actions but i need to do it via Bungee
Hello guys, i'm new to plugin development and i wonder if there is a way to regenerate chunks right from the plugin. Can you help please?
You should probably have to load the chunk if im not wrong
My plan is to check some parameters of a chunk when it is loaded, and then regenerate it
Like when a player loads it or smth
Regenerate it
The issue is that im wondering to listen when someone connect to a proxy and create their rest api session
ok, 1m please let me search
Thanks so much
There is no reload method, so maybe you will have to unload and load it again
I understand you, but that's not what i want, i want to entirely reset the chunk, as it was loaded for the first time
You mean you wanna delete it and regenerate it?
Yeah
You wanna do this for all chunks?
Or a known set of chunks?
Minimum wage where i live is abt 3usd per hr
A little less actually
Code for spigot and bungee to target the max amount of users. Many people make forks which have changes to the implementation, however, the api methods remain the same
A special set
Are some chunks broken or something?
Kinda
You can use a region manipulator library to delete those chunks
This isn't spigot tho
I wanted
It's just java and nbt
But my dataset is big af
- no work on your server
Since it doesn't run on the server, it just runs once, cleans your stuff up and done
I don't think it will work
Since the chunks r bot corrupted or broken
They contain data
And it is full air
Yeah
That's absolutely what this is for
Oh
Are you proficient in java?
So it is called "region manipulator"?
Not proficient but can write smth
Add that to your pom
You're writing a public static void main program
But it may be frustrating if you don't know java well
Use nbteditor to help you figure out the nbt format
You just gotta check all chunksections are empty
And if they are, you can delete tje chunk
this is cursed, just call it a program 
He's not experienced in java ๐ฆ
Gotta clarify
Im not that bad๐คฃ
Standard procedure should be to first ask ChatGPT now since it can answer most easy-medium difficulty questions
It's useful as a writing tool tho
Used it to help me write some essays
Makes sense since its a natural language model
It can help with easy spigot stuff
thats about 50% of questions here
True
well but many times it answers utter bullshit and if you don't know the answer already, you won't know if the answer is correct or not
I guess? but if nobody asks they wont be able to fix the problems, right ๐
true
for example it suggests to use Main.getInstance() instead of DI. Obviously that's not wrong, but I am sure many people would be outraged now lol. I also don't understand why it waits until onEnable() to set the instance, instead of doing it in the constructor or in onLoad
however it's still an amazing thing
it suggests it because its so common on the internet answers i think. for most people Main.getInstance() is also enough since they are just developing for private servers, etc.
i feel like for most cases setting it on onEnable is sufficient
never done any different
yeah sure, just wanted to say it's still not perfect. I tried to find a plain wrong answer the last 5 minutes, but couldnt find any. A few weeks ago, that was still easy, so it already improved much
i do DI anyway
so it doesnt matter
yeah. people who know DI can just plain ignore the wrong code and pull out the answer they need. also it can nicely explain DI ๐
okay I found a double-wrong answer
it's plain wrong but it took me over 5 minutes to find one
no
this is the example code for di it gives ๐
public class MyPluginClass {
private final Dependency dependency;
public MyPluginClass(Dependency dependency) {
this.dependency = dependency;
}
// ... plugin class code ...
}
public class MainPlugin extends JavaPlugin {
@Override
public void onEnable() {
Dependency dependency = new Dependency();
MyPluginClass pluginClass = new MyPluginClass(dependency);
// ... plugin logic ...
}
}
o lol
this is in fact my di 
no google guava di or whatever the actual library is
okay so it has at least 3 obvious errors
I did ask it for dependency injection in the context of spigot plugins
not "yours". that is DI
our dependency injection
both are "framework DIs"
but there is also "constructor DI" and "setter DI"
not sure if the latter is the actual name
probably parameter injection or something
enchantment?
you mean unbreaking or protection?
thats not something spigot does by default
afaik you will need your own logic to apply potion effects when someone is wearing armor
I dont know that
?paste
?jd-s
the basic ChatGPT response I got: https://paste.md-5.net/moyogurava.py
my Brother in christ
its paste lmao
its the extension
ive clicked plenty of pastes here before though and never got it
same
makes sense
its ok with other extensions
sadge
not .pl either tho
whats .pl? polish?
perl
perl
๐
I think the documentation migrated or smth. Do you have a working link?
https://github.com/PowerNukkit/NBT-Manipulator for nbt documentation
Other than that it's only regionIO. ReadRegion and writeRegion
And the region class has some methods but they're self explanatory
The documntation for the region manipulator is broken
What i sent is a fork with a change to read region frm older and newer mc versions
Ok
Much better
Main branch?
Nvm
is onEnable called after all onLoad methods are called?
Yes
can you explain it more? I am still confuse about this
Just found this today. so I am curious
I mean, the only value there iirc is uft8
back in the day when not all plugins supported that
ยฏ_(ใ)_/ยฏ
Hey, I am trying to use build tool mentioning version 1.9.4. However, impossible to succeed in the build, I have the following error:
[ERROR] Failed to execute goal on project spigot-api: Could not resolve dependencies for project org.spigotmc:spigot-api:jar:1.9.4-R0.1-SNAPSHOT: Could not find artifact net.md-5:bungeecord-chat:jar:1.9-SNAPSHOT -> [Help 1]
Could someone help me?
I have a config.yml file with my items, and a loop to get the items and insert them in my gui menu
but I have a problem with the description, where the lore doesn't accept the \n
Is there any other way than having to explode my description to insert them into an array and then looping back to insert it into the lore?
String#split
^^
just .getString().split("\n") ?
Should do
or you can make the lore a stringlist in the config and move on with your life
Prefer it ^
it's cleaner than my way?
yes
lore:
- 'one'
- 'two'
- 'three'
List<String> lore = config.getStringList("lore");
then you colorize it ofc
then you just set it directly
instead of doing weird splitting
oki awesome i'll try it thank you
how do you make custom worlds load when u start the server? (i dont want to use /reload)
does anyone have the same problem as me?
did you add the spigot repo
no, i mean like when u start up the server u get an exception that the worlds cant load on startup
u have to then do /reload confirm
uh... never had that before
just a guess
bruh goofy ahh chatgpt didnt tell me u have to do that lol
โ ๏ธ
๐
๐chatgpt
no need to loop on the list ?
just lore.toString() ?
you cant just add a list
but I have to loop to take into account the color codes in my list no?
yes
why not just use a stream?
It works anyway, but do you have a better way?
I was very excited when I first used YAML, but some real-world usage showed it's not so great after all
description.stream().map(line -> ChatColor.translateAlternateColorCodes('&', line)).toList();
what does it do
isnt there some stream.filter stuff
so yes or no?
im guessing so
ye but like what?
I am not very comfortable with lambda
load: STARTUP in plugin.yml if you do stuff to worlds on enable
just that?
I'd do it like this, but sure, a for loop works too
List<String> existingLore = new ArrayList<String>();
List<String> loreToAdd = getConfig().getStringList("lore")
.stream()
.map(line -> ChatColor.translateAlternateColorCodes('&', line))
.collect(Collectors.toList());
existingLore.addAll(loreToAdd);
wait actually i already have that
no, you use add instead of addAll