#help-development
1 messages · Page 2061 of 1
Good manhwa
Is that a challenge?
im using php lmfao
im out
because I really have an idea of making enchanted foods that has special effects like enchanted chicken that gives you strength for 5 minutes
Idk js
if you want to make it then ig
how to do it in js tho
i can give ideas just cant do them XD
🤣
Minecraft enchantmented chicken
yessss
inter tubes say:
$dirname = "media/images/iconized/";
$images = glob($dirname."*.png");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
you can make an item glow by giving it an enchantment it doesnt supposed to have right?
i remember someone saying to put lucky or something on it?
i forgor
Enchanted cooked chicken
If I assign xrandom above, and then re-assign in here, and then I access xrandom outside of the while loop, will it use the re-assigned value?
and hide the enchants
thats what it shows
guessing thats whats in that folder taht are png
;-;
oh how?
oh my god how do you people read this
or its smaller than that and you didnt use the proper open-closwe tags
i replaced png with jpg
i mean its for computers but what even is that 😭
cuz images are jpg
uh what
dunno what u mean
ur getting into access modifiers on lesson 32???
like html, php has open and close tags so the server knows how to parse it
Trying to make a player housing system which moves a player to a void world which only holds that players house. Any idea if there is a forum which explains this as I'm struggling to find anything. For example something like hypixel housing or how jailbreakmc(RIP) had cells
whats lesson one, the semicolon?
yeah
like this
<?php
$dirname = "images/";
$images = glob($dirname."*.jpg");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
?>
right?
yeah
idk seems so
its correct
first learning variable types and such i guess
fair
Pain
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS)
although that specifically generated poor html, servers still allow it
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Title</title>
</head>
<body>
<?php
$dirname = "images/";
$images = glob($dirname."*.jpg");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
?>
</body>
</html>
thats what i have
literally
lmao
thats better
Random in between max and min?
ahh i see
I figured it out
so uh
uh but i have this problem XD
its still not working lol
You could generate the perfect number in case..
what version of php?
i would say dont do such complicated things if you dont know that much java
start with something more simple
why do you have the dots ? your not gluing anything together
Wait..
yeah i see, i am pretty rusty it seems. try to avoid webstuff
idk js
its easier than php for sure
tbh according to ur code its easy to rewrite that in node js
Random r = new Random();
int low = 10;
int high = 100;
int result = r.nextInt(high-low) + low;
~and i cant find any code to copy paste in js in google~
are you sure that you are using real google
class MyClass {
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
public void setExecutorService(ScheduledExecutorService executorService) {
this.executorService = executorService;
executorService.schedule(MyClass::new, 10, TimeUnit.SECONDS);
}
static void sayHello(String name) {
System.out.println("Hello " + name);
}
public static void main(String[] args) {
sayHello("Ray");
sayHello("Lukas");
}
}
``` ok so I kind of fixed it but also not but uh it didnt really delay it
im not good at this clearly lol
uhm
u dont know what web server are u using
that will create new instance of the current class after 10 seconds
also instead of the set method use a constructor
scheduleWithFixedDelay
iirc
he only wants to run it once if im understanding it correctly
ah
which ::schedule does?
yeah
yea
correct
sadge
i just want to make the second name delayed to 10 seconds
so like Ray and then 10 seconds and Lukas
you could just Thread.sleep(10_000) between the two method calls
oh
print("Ray")
schedule.schedule(() -> print("Lukas"), 10, SECONDS);
@grim ice
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$dirname = "";
$images = glob($dirname."*.jpg");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
?>
</body>
</html>
Works fine, did you save your file as index.php ?
fuk php
class MyClass {
static ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
public void setExecutorService(ScheduledExecutorService executorService) {
this.executorService = executorService;
}
static void sayHello(String name) {
System.out.println("Hello " + name);
}
public static void main(String[] args) {
sayHello("Ray");
executorService.schedule(() -> sayHello("Lukas"), 10, TimeUnit.SECONDS);
sayHello("Lukas");
}
}
``` good now?
Will this continue to run the code below it after the while loop is finished?
myes
oh wait i didnt remove the other lukas lol
but it works now omg
thank you
i would cry rn if i was good at crying
but ig i can just give you a virtual hug
sends virtual hug

pushes FourteenBrush in front to block it

maybe Conclure soaked it all up
ayee dont use me
could someone explain what Clojure is and what does it have to do with ajva
It compiles to jvm bytecode
Similarly to how kotlin can run on the jvm
wow you know a lot about it, i wonder why
Not a wholesome experience
Nested functions
Since immutability and everything must be declarative
wait so i can make plugins in it?
in conclure... i mean clojure?
Ye
can u link it
Let’s see if I can find it
i hate oop
Why 😦
wat
then go to rust lol
no
its .html
sounds like someone doesn't like writing boiler plate 😆
So you like clojure, Haskell and f#? That’s kinda sadge
because it looks like complicating shit for no reason
change your file extension
oh ok
For instance you should never reference old values when creating new objects in functional, which makes the design a bit, well… questionable sometimes (due to garbage collection)
pff who uses GC, i write my own memory management
Functional and memory management? Sounds like pain 😔
now i need to somehow
dont you pay your servants to take out the garbage?
make a way to access the website folder
https://github.com/knightzmc/minehraft @onyx fjord
with some ui
lmao i know this guy
yeah he’s a functional one
oh god what the fuck is that syntax
🥲
pretty colors
idk where how am i supposed to know
eye filter, its less intensive for me
gogo forms!
not knowing wtf ur doing is surely a bad feeling
it wouldve been awesome if this was java 😭
then do it in java
you could use SAPI ...
i mean u can make sites with it but how i have no idea
How can I access azrandom outside of this while loop?
not
start something else and access it?
or put it outside the loop with a starting value
seems like a great way to have bad things happen
what does java do when your read and write something at the same time? or write multiple things?
I tried that, but I dont think that the variable changed. If I try to access it outside of the while loop, will it use the updated one?
eRush
So if I access a after the loop like this:
int a = 0;
while (a > 1 && a < 92) {
a++;
}
System.out.println(a);
It will give me "92"
yes
aight
thanks
while (xrandom > 108 && xrandom < 196){
xrandom = (int) Math.floor(Math.random() * (xmax - xmin + 1) + xmin);
}
while (zrandom > 1 && zrandom < 92){
zrandom = (int)Math.floor(Math.random()*(zmax-zmin+1)+zmin);
}
So just to make sure, this will run until zrandom is between those two numbers right?
spaghetti
blocking
but yes?
loudbook r u trying to get a random number between two numbers?
@tardy delta can you find a java based dc server and invite me there
I want to make sure my random number is every number except a number between those two
Here’s one (this one) but I got several amxyar
int xmax = 229;
int xmin = 97;
int zmax = 130;
int zmin = -50;
im tryna ask java based questions there because this is based on spigot not java particulaparticularly
discord . gg / code
send me but in dm
just go to the java channel
This is for java also
i cant sent invites here :(
dm
I can invite you to Together Java
the coding den 😎
just dm me any java server xD
im only in the coding then but there are a lot of programming languages there
i made myself a list of my friends XD
scary
Hello, i have done the way to create a world:
String worldName = args[1];
WorldCreator wc = new WorldCreator(worldName);
wc.environment(World.Environment.NORMAL);
wc.type(WorldType.FLAT);
wc.generatorSettings("2;0;1");
wc.createWorld();```
and now I would like to save that world or delete it if the player doesn't want to apply its changes
how can i do that?
and store those world would be with the name of the world, or the other method?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#unloadWorld(java.lang.String,boolean)
Then use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getWorldContainer() to get the worlds folder and find the world folder and delete it
declaration: package: org.bukkit, class: Bukkit
why unloadworld?
okay
and to save the world do i made a copy of it and delete the copy if i run a command that is made for not saving changes?
btw
when i have a domain
eg
that forwards for another website lolol.com
lolol.com has a few files
like
and lolol.com/y.html
how would i access x and y thru x.com
You have to reference them
Any idea why skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(player.getUniqueId())); works, but skullMeta.setOwningPlayer(player); not, when setting PLAYER_HEAD owner? When I not get OfflinePlayer, PLAYER_HEAD does not have right skin.
hey,question
if i cancel a message event from a bungeee plugin will it just cancel on the server aswell right ?
how does spigot load libraries from maven central? i see their library loader, they have their createLoader function, but how do i actually load in libraries?
i'm trying to use their system for something else
ugh i feel like this is a stupid question but its confusing me still
and i can't figure out how to actually load the library
Hello, can someone help me with a small problem?
you should prob say what the problem is first
is that I don't know how I can create my complement so before I improvised with what I had
It's just that I improvised and now I only have my plugin and I don't know if it works in any version of minecraft and I don't know how to do it either
sending or receiving?
I leave you with a link to my plugin so you can see it for yourself
https://www.spigotmc.org/resources/help-report.101053/
Yep that floor is made out of floor
what does that mean?
I don't understand your problem
this discord seems to be made by discord.
Is it possible to create multiple borders in a single world?
world borders?
Yes, these blue borders
Because I want to create a world where each player has an island with a border. That one moves, but to create a world for each player would be killing the server
packets would probably be the best bet in that situation
might be difficult though
Can you create something with packets that the player can't pass somewhere?
seems like a daunting task as a whole
I have a PR in the works for client-sided world borders
Just waiting on a bit more feedback, will probably refine tomorrow, hopefully merged within the coming days

Could you please send that to me as soon as it is finished?
I probably won't remember to do that ;p
haha no problem, I'll message you in a few days
👍
i don’t know
its possible to cancel a message from bungee right ? just like on spigot
this is what i want to do, just cancel the event
like a chat event or a plug-in message event?
like no one receives the message
no chat event
normal chat event
like saying hi in the chat
just cancel the chat event
You tell me?
on bungee ?
Uh no you tell me. I can't tell you your issue there
what do you mean by complement?
yes
I don't know if it works with the servers and I don't know if it works
whats the event please i looked for a while all i found is PluginMessageEvent and i dont think thats the one
just chatevent?
np
Connection is server ?
so you want to know if your plugin works on multiple versions ?
public static UUID getNest(String name) {
//how do i do this?
for (String nestID : Objects.requireNonNull(CustomConfig.get().getConfigurationSection("nests")).getKeys(false)) {
if (Objects.equals(CustomConfig.get().getConfigurationSection(nestID + ".name"), name)) {
if (name != null) {
return UUID.fromString(name);
}
System.out.println(nestID);
}
}
return null;
}```
||`/* config file
nests:
(NestUUID):
name:
level:
members:
(MemberUUID):
role:
last-use:
respawn:
X:
Y:
Z:
*/`||
trying to search through YAML entries
how is this done?
the code does not work
?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.
stop, it's pretty self explanatory
🤷
it returns null every time
okay, so debug it out, what is causing it to be null, you have two if statements, one printout, are you getting the printout? Add more, see what you are actually getting, etc
I just figured people here might know how to properly search through yaml files
so am i doing it correctly from the looks of it?
or don't you know
but i'll continue to debug
Im no expert in configuration sections, all I know is they can be a pain, I know others here know more but just running through basic debugging atm is the best
yeah
yes and hopefully it works as it should because since I use pages instead of downloading I don't know if it could work well in conclusion that I know it in vscode which is the only thing I have at my disposal to do it well I believe it in that system
i'll get back once i have more details
Just off a quick search some threads like this may be helpful https://www.spigotmc.org/threads/configuration-section.373459/
i've already got the writing methods down
it's the breadth search that i don't know how to implement
and normal search for that matter:
public static UUID getNest(UUID nestId) {
for (String nestID : Objects.requireNonNull(CustomConfig.get().getConfigurationSection("nests")).getKeys(false)) {
if (Objects.equals(CustomConfig.get().getConfigurationSection(nestID), nestId)) {
return UUID.fromString(nestID);
}
}
return null;
}```
hey isnt a chat message can only be sent by a Proxiedplayer ?
why do i have to cast it
and why is it Connection
cant console send chat messages too?
or am i thinking about a different chat
am thinking about when you send a chat message like a normal message
console cant send that right ?
oh yeah
java.lang.OutOfMemoryError: Java heap space
LMFAO what did i do wrong
wait question please,
i killed the server
is yaml really that mystical that i can't find a breadth search algorithm anywhere??
well, i thinks its obvious what it is, and theres docs on it, but i am wondering how u can get the player that sent the message
Shakiz i think u want PlayerChatEvent
or not?
YES
instead of ChatEvent
nvm thats not a thing
use that, that should work as expected and sender will be player
not?
what version u using
ah oh
well then just cast it to proxiedplayer
check instanceof first tho!
or does one even need to? not sure xD
yeah its confusing
That might be because of an infinite loop in the code
just do it idk
if (event.getSender() instanceof ProxiedPlayer) {
ProxiedPlayer player = (ProxiedPlayer) event.getSender();
}
yeah i will try that tbh
and see if it does something
sure
yeah found it
ok does anyone here know how to use yaml decently??
cause i sure don't
and it looks like nobody does
Yaml is quite easy tbf
kinda
ok please, how do i do a breadth search through a yaml file
breadth?
Whats the word mean lmao
you'll see
here it is
the wall of text
Compared to Mongo and MySQL, its a lot easier
Okay first off
do not use requireNonNull
null check it
oh what's the difference
yeah definitely. If your not used to it then it is slightly harder
just if(!null) ?
if (thatSection == null) {
// log
return;
}
is it possible to add to spigot's library loader on runtime
ok
or load extra libraries on runtime
Can you resend that chunk of code so i dont gotta keep scrollig up and jumping back and forth (After you add the null check)
yeah sure
Not sure, typically you compile/shade those in with your jar
was gonna but didn't wanna flood chat again
i wish you could make dropdowns with discord smh
indeed, just takes practice with for loops
Typically its a lot harder for people just learning java/spigot api
public static UUID getNest(UUID nestId) {
if ((CustomConfig.get().getConfigurationSection("nests")).getKeys(false) == null) {
System.out.println("Null causeed fail 1");
}
for (String nestID : (CustomConfig.get().getConfigurationSection("nests")).getKeys(false)) {
if (Objects.equals(CustomConfig.get().getConfigurationSection(nestID), nestId)) {
return UUID.fromString(nestID);
}
}
return null;
}
`/* conifg file
nests:
(NestUUID):
name:
level:
members:
(MemberUUID):
role:
last-use:
respawn:
X:
Y:
Z:
*/`
only use getKeys() in for loops
ok that was my null check solution
so what do i do instead? 🤷
getConfigurationSection() == null
getKeys returns an iterable and will still throw a NPE if getConfigurationSection was null
sorta, yes
just lmk where i messed up
oke
i appreciate that
my stuff's still in the github i gave you if you need more code context
i'll push this rn
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
i added comments explaining everything i did
omg thank you
alright awesome
i'll test this in a moment tho on something else
🙏
@noble lantern sorry to ping you. but do you happen to know a thing or 2 about syncing data accross servers?
since ive been struggling to find a good reliable way to have cross server data storage.
since players can easily change server in about a second, how do i make sure my data will be up to date on there :/
or maybe @quaint mantle :D
just dont allow the client to connect until their data has been retrieved
^
hmm wont that be rlly annoying for the user?
Basically
it will be a millisecond or two for them
no
Redis allkeys lru cache + pub sub sync
its just like the loading process for literally any other data store
youtube isnt instant
yea im using redis.
This ^ redis is godsend
Tho should be said redis isn’t reliable in pub sub/mq, sth like rabbitmq is superior and much more reliable in terms of data loss
wish i could figure redis out
An in memory database
hmm, but how do you disallow a client untill you are ready?
The general idea when dealing with multiple cache factors is to be integrally disciplined
i didnt even know that was possible without just not allowing the login.
I mean AsyncPlayerPreLoginEvent is blocking
Also in reguards to pinging me, feel free to i dont mind but seems like conclure and imajin got this one 🙂
wdym with redis lru cache btw
yea. a fancy one
but i yet still have the issue that another server does not know whether the data on redis is up to date.
Lru is a way to configure it to automatically remove entries based on when an entry was last used
myes
So the idea is to have sth like
Local cache
Redis cache
Persistent database
and then whenever you want to perform a data fetch
If the value isn’t in the local cache, get it from the redis cache and put it in the local cache
If the value isn’t in the redis cache, get it from the persistent database and put it in the local cache and the redis cache
Then whenever you send an update through pub sub, all servers must clear (local caches) any data related to the given node that pub sub informs about
And then of course re-fetch from redis and potentially your persistence database
Of course in certain cases you might be able to take shortcuts (aka not having to entirely clear an entry from a local cache)
caching hurt brain
But this also comes with how much you prioritize up-to-date data
yea my brain is very much hurting right now.
data has to be up to date 100 % if possible.
Okay then do what I mentioned here and below
But yes in your design
so when a player joins a server. it bassicaly has to inform all other servers to send its local information about that player to redis.?
which could only be one other server
It might be reasonable to split up the user object into different objects such as EconomyUser, FightingUser etc to avoid entire user reloads
yea i have that
Wait what you mean?
is that not what you mean here ?
Well
Let me clarify
Whenever a spigot server manipulates the data of a player, it must then publish a message to the pub sub
Subscribers (other spigot servers) will then hear the update and let’s say you manipulated money, then all the other spigot servers would have to fetch the money from the user from the redis cache (or the persistence database if no data is found in the redis cache) this implies the other spigot servers would have to invalidate certain data in their local caches
Will this prevent xrandom and zrandom from being within an area?
hmm okay, but other servers are not really using that data.
Yes but in case you get to that point
You just want to make sure redis is your primary cache, it should take precedence over local caches
sooo bassically ur saying to have player data cached in all servers locally?
Well yes
I mean you almost always want that
As it’s a reliable way to quickly grab data (like a normal concurrent hashmap could be the local cache)
ah
so to sum it up, whenever a players data gets modified by a server -> sends update to all servers to "refetch" that piece of data
Yeah well this of course depends exactly on what you’re doing
Let me perhaps ask you that first
well i have a lobby and 3 "game servers" those 3 servers have a local lobby as well where people can choose a team. its a game called Annihilation.
Oh right
I believe hypixel used to use redis
Or well they still do
But they used it to send data mainly between servers
Not so much for caching, which is actually what redis is mostly about
but this is why i am sceptical about having local data about all players on all servers.
since when a player is playing somewhere hes not going to change suddenly
but like maybe when a game has ended
he could.
Yeah
Might not be necessary for you
Redis' pub/sub was a God-send. It effectively mimics inter-server packets
Yeah that’s on another dimension
redis pub/sub is great
I believe they might use some sort of redis master slave thing
@worldly ingot any suggestions on how i could handle it? :D
I mean that’s alright
if a player quits a server i could send an update but idk if its fast enoughj
like it could happen to be not fast enough
Just save necessary data on quit from game server #1 which then game server #2 picks up once the player joins
yea that was my plan. but will it save quick enough
Hm
Mye well then redis would be fitting
I mean one way would be to catch it through the proxy
Where you could block the login until the data save from the previous quit has completed
Basically
how do u make somethng like that tho. thats done with a bungeecord plugin then?
Yeah truly intricate
would it be an idea to "invalidate" data on redis?
whenever a server updates some data locally
so other servers know the data is not yet saved
and can then wait for an update
hey conclure- do you know how spigot's library loader works
like the actual code itself
?stash
Just so that whenever Conclure leaves, other servers just blocks it until they receive a message from pubsub telling them whether Conclure is allowed to join or not maybe?
Pretty much just downloads jars from maven central
And then loads them
yeah! i got the downloading part, im trying to load them in now
im trying to replicate it and add the system to a module system i designed
Oh
downloading works, but i don't know how to load them in
yea like if a player joins it can allow them in the server. but if the data was invalidated it will wait for an update and load the data after that. since i can disallow users to join a team anyway. so i can allow them in the server.
URLClassLoader basically
Take a look at how for instance LuckPerms does it ig or spigot for that part
It uses url
i meant where haha
this ?
Nope
think im gonna attempt this. or do you see any major flaws?
Yeah epic I was more thinking like
it seems they have a main class string in their jar file
Yes
Nope
Peek at the stash which Elgar linked ya
Believe it might elucidate things
onQuit(e){
saveData(e.player).future().get();
redis.publish(e.player+"S");
}
Map<player,lock> allowed
onRedisSub(msg) {
allowed.get(msg.player).unlock()
}
onAsyncLogin(e){
allowed.get(e.player).lock()
}
@tall dragon
Sorry I am kinda tired so heading to sleep for now
But basically that’s that
hmm
And ye probably don’t wanna use lock there
But uhm, for instance a CountDownLatch
I can rewrite it a bit better tomorrow if you remind me by then :3 gn
i would really appreciate that.
good night :) thanks for any help you've provided already
How can I prevent an entity from walking into an area?
Use RedLock
How can I make a leaderboard in a yml file,idk how to explain it that well
basically I store player data in a yml file, and I need to get the highest ints
You can store it as a list
will this cause memory leak? method gets called on Player interact event and other events
No
thats a great relief, thanks
hey md, what did u do to load the maven artifacts into the classpath from maven central
tried taking a look at the code for it but got lost
used maven pom
just used a class loader
i tried that and it would say classnotfoundexception
java has api's for such things
yeah, i yoinked the library loader class but it would still say classnotfoundexception for the libraries downloaded
for example i used it for springboot and then used another jar i loaded on the same classpath to use the springboot api
and it gave a classnotfound
how do I check if a chorus fruit is dead given the Block I'm assuming it might be something with Ageable, but not sure
eh guess we'lll figure it out lmao yea its ageable I'm just stupid
well you still have to ensure the jar you are attempting to load is in the same directory as your jar or have a way to know where its location is at to load it
it goes to the libraries folder
that's the "local maven repository" set apparently
however, loading a jar via class loader isn't the way you use dependencies though
this cant possibly be the best way to paste schematics right? https://www.spigotmc.org/threads/1-13-load-paste-schematics-with-the-worldedit-api-simplified.357335/
A heavily simplified version of how to load and paste schematics into a world using the worldedit api. Includes recommended pre-requisites, step-by-step tutorial, final example code and relevant links to the official docs.
feels kinda complex
i just want to paste a schematic on world generation
on the quartz block
Is anyone able to help me compile my gradle project? I use maven and am compiling someone else's code after I optimized it. Don't feel like actually learning gradle either :/
Just run gradle build
It says something about dependencies n stuff
Well how can we help you if you don't show us the errors
I thought it did, although like I said I really don't know what I'm doing with gradle
heyo anyone got an idea how I could see how many chorus fruit blocks are attached to the base block broken. I have tried crying, slamming my head against a wall and doing a few google searches.
Done
Check all surrounding blocks except the one u just checked from below and keep counting until there is no more blocks found
ok i've tried this, but I'm stupid Ig I'll just take another crack at this tommorow nothing a little sleep can't fix
huh
recursion
what if its on a different tree then
One moment @river oracle
recursion is how i've been doing all similar algorithms
I've spent too long on this lmao 30 minutes tryna figure out how to count chorus fruit stalks
Which can be implemented either iteratively or recursively
Lol
There’s nothing wrong with a recursive solution if that’s easier for them to write
private static BlockFace[] FACES = new BlockFace[] {BlockFace.UP, BlockFace.NORTH, BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH};
public static Set<Block> getChorusTree(Block base) {
Set<Block> seen = new LinkedHashSet<>();
Queue<Block> frontier = new ArrayDeque<>();
frontier.add(base);
Material type = base.getType();
while (!frontier.isEmpty()) {
Block block = frontier.poll();
if (!seen.add(block)) {
continue;
}
for (BlockFace face : FACES) {
Block rel = block.getRelative(face);
if (rel.getType() != type) {
continue;
}
frontier.add(block.getRelative(face));
}
}
return seen;
}```
There you go
That should get the entire chorus tree from the root iteratively
You should avoid recursion where possible since it can be expensive
hmmm never used a queue before should probably look into that
Sometimes it's the best solution but I generally prefer iterative approaches
It’s really not that expensive lol
It can cause a stack overflow for deep trees
It’s a micro-optimization, especially in this tiny tiny case
Yeah it won't make a huge difference
Yeah but that’s a whole different scale of data
I still prefer iterative though
In this case it's likely not to make a difference at all
Right
?
What is NMS support
looking at this reminds me even with around 11 months of experience I still have no clue wtf is going on ahaha
That would appear to be the problem
This isn't my plugin so I'm not entirely sure what's going on, still getting errors importing which I don't understand
I don't use gradle but I only get errors here
Did you set up the dependencies properly?
You'll get there
It takes practice
But eventually this stuff will become like second nature
You have to do more than just clone it
I'm usually pretty decent at solving stuff I'm just tired as f right now lol looking for an excuse not to sleep
11 months is still rather fresh
Like what?
Is it gradle?
yup
I know maven I just don't know gradle that's why I'm here haha
Does the gradle have the spigot dependency in there properly?
yeah Its not even really 11 months either I take super long breaks lol most inconsistent mf on planet earth
Have you run build tools?
Project is split up like this. The files under "plugin" work fine, however, the files under "api" don't.
I believe I just ran BuildTools, yes.
Let’s see the build.gradle for plugin then
Should be called "JACP" for "Just Another Crate Plugin"
lol
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}
repositories {
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven {
url = uri("https://repo.codemc.org/repository/maven-public/")
content {
includeGroup("de.tr7zw")
includeGroup("com.gmail.filoghost.holographicdisplays")
}
}
maven {
url = uri("https://jitpack.io")
content {
includeGroup("com.github.decentsoftware-eu")
}
}
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
content {
includeGroup("io.papermc")
}
}
maven {
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
content {
includeGroup("me.clip")
}
}
maven {
url = uri("https://repo.mvdw-software.com/content/groups/public/")
content {
includeGroup("be.maximvdw")
}
}
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.1") {
exclude(group = "org.spigotmc", module = "spigot")
}
compileOnly("com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.9")
compileOnly("be.maximvdw:MVdWPlaceholderAPI:3.1.1-SNAPSHOT") {
exclude(group = "org.spigotmc", module = "spigot")
exclude(group = "be.maximvdw", module = "MVdWUpdater")
}
compileOnly("com.github.decentsoftware-eu:decentholograms:2.2.5")
implementation("de.tr7zw:item-nbt-api:2.9.2")
implementation("io.papermc:paperlib:1.0.7")
implementation("org.bstats:bstats-bukkit:3.0.0")
// Api Module
implementation(project(":api"))
}
tasks {
shadowJar {
archiveFileName.set("Crazy-Crates-[v${rootProject.version}].jar")
val path = "com.badbones69.crazycrates.libs"
relocate("de.tr7zw", path)
relocate("io.papermc.lib", path)
relocate("org.bstats", path)
}
processResources {
filesMatching("plugin.yml") {
expand(
"version" to rootProject.version
)
}
}
}```
Yeah so plugin is using the spigot repo but api is using your maven local
Is spigot in your maven local?
That would be my suggestion
Alright I'll find some tutorials on it thank you ❤️
Yw
How and where should I store Player Data
yml, database. Depends on how much and how often
ok thanks, I will use yml bc its only a learn Plugin. And where should I save the yml?
in your plugins config file
Have jdk 17 installed but can't choose it as a compiler version?
really in the config file? I thought its for settings stuff like EnableNoFood: true or smth like that
you make a file such as playerdata.yml
and it works the same way as a config file
ok thats nice thanks
I personally prefer using mongodb for storing player data but not always practical
hm and how can I save smth on the file? I cant get the yml file with getConfig()
I have a custom FileHandler
then you can just create a new file with
public FileHandler config;
public FileHandler enabledpvp;
//in OnEnable
try {
config = new FileHandler(this, "config.yml", true);
enabledpvp = new FileHandler(this, "enabledpvp.yml", true);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
true copys the defaults you type in the file
false makes it a blank file
oh thanks
java: pattern matching in instanceof is not supported in -source 15
(use -source 16 or higher to enable pattern matching in instanceof)
Anyone know this error?
Can you show your line pls ?
its a compiler error
Don't think it's related to the line, it's related to the compiler
I can't seem to get java 17 as an option to compile with
a instanceof b aCastToB
``` doesnt work with your source version for some reason
you need Java 16+ to use a instanceof b name
That's what I thought
do you use any build system?
Don't even know, I'm using gradle for the first time and I hate it. I usually use maven.
for gradle try
sourceCompatablity = 16
targetCompatability = 16
i dont remeber exactly how
maybe put that in the compileJava task settings idk
You can manually install it?
Does anyone have the code for an island grid system?
Wanting to do something like https://kodirati-is.not-an.engineer/f7j1Vsih.
google outward spiral matrix java or something
Okay okay, appreciate it :)
I don't understand the utility of this system... Isn't it the same thing finally ? 🤐
Yeah but it's weird to start in the very corner of a world than the center.
is this a good guard to lock commands to admin usage?
if (sender instanceof Player)
{
Player p = (Player) sender;
if (!p.isOp())
{
p.sendMessage(StandardMessages.getMsgByString("CMD_PERMISSION"));
return true;
}
}
StandardMessages.getMsgByString("CMD_PERMISSION") is my method to use the same standard messages across all plugins*
or is there a simpler one?
you need to have a newer version of intellij
I had the same issue
2021.3.3 surely has it
I wouldn'T check for OPs but for specific permissions
oh im not using the permission file, ive boundled the permissions onto scoreboard teams because they allow direct usage of prefixes xD
and if u delete the team all permissions get auto deleted alongside it
and if i need new scoreboards ill serialize them myself
Hi, can i do this better?
List<Location> glassLocations = new ArrayList<>();
glassLocations.add(loc.clone().add(0, 4, 0));
glassLocations.add(loc.clone().add(0, 5, 1));
glassLocations.add(loc.clone().add(0, 5, -1));
glassLocations.add(loc.clone().add(1, 5, 0));
glassLocations.add(loc.clone().add(-1, 5, 0));
glassLocations.add(loc.clone().add(0, 6, 1));
glassLocations.add(loc.clone().add(0, 6, -1));
glassLocations.add(loc.clone().add(1, 6, 0));
glassLocations.add(loc.clone().add(-1, 6, 0));
glassLocations.add(loc.clone().add(0, 7, 0));
for (Location glassLoc : glassLocations) {
glassLoc.getBlock().setType(Material.GLASS);
}
Arrays.asList
why do you clone all locations
you can probably also achieve that with some math & loop
okay, thx
how often does Bungee Messaging channel refreshes for new data?
however fast your nic is
prbably it works thru socket
if I am correct and there is whiled loop
which is checking if there is data to read
well message channels use the connection the player has to the server.
some thing like this
I use sockets for custom information transfering over multiple bungees
ok?
and thing is if you run while(true){if(!in.ready())continue;}
for example
it just kills cpu
so what I did I made runnable which checks every 10 ticks
if some data is ready to be read
if you have a while loop killing your cpu for listening on a socket, then you are doing something wrong
I only had this
while(true){if(!in.ready())continue;}
however, for custom sockets and what not I recommend using a daemon thread
probably shouldn't be messing with sockets if you don't know how to do threading
what is the resource pack format for 1.18.1? (the one we write in the pack.mcmeta)
anyone wanna help me I'm so confused
so basically
I store a uuid and a int inside a yml file for player data
and now I'm trying to make a leaderboard sort of thing and find out which uuids have the highest ints
and idk how to do that because all the data is in the yml file
I didnt store it to a hashmap
is there a way I can loop through every uuid saved and check the highest ints?
Location playerLoc = ...;
final Vector[] glassOffsets = new Vector[] {
new Vector(0, 4, 0),
new Vector(0, 5, 1),
/* etc */
};
for (Vector go : glassOffsets) {
Location glassLoc = playerLoc.add(go);
world.getBlock(glassLoc).setType(Material.GLASS);
}
thanks
anyone wanna help me
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
read up
load everything to a map, sort it
so ur saving ur data directly to a file?
yes
would not recommend that tbh
yeah I learned that just now lol
because 1, in cases like this you will need to load everything into a map.
- its just bad for performance
i would cache ur data yea
alr
then just save to file on shutdown & regular intervals
alr
i guess the thing that you are saying breaks srp, the storage is not the piece of code that interacts with the database
i took a look at it again lol
message doesnt load
what did i say
then a class called SQLStorage implements Database, Storage
you were suggesting to create two interfaces: a storage one and a database one
i dont think its the responsability of the sqlstorage to also store the data in a type of cache
it is imo
it provides your storage using sql
then a MongoStorage that provides storage with mongodb
maybe
i dont see how that breaks srp
if it had some another functionality like for example killing a player if they exist in a database
then that breaks srp
since it doesnt produce storage
and killing has no relationship to SQL or Storage
I have a custom texture file in my resource pack which loads depending on the customModelData, but the texture doesn't work correctly It just shows a purple black block. But if a use a built-in texture suppose diamond, it works correctly. how can I fix this ?
something is wrong with your texture pack
anyways what methods should i put in the storage interface?
well
you said to put the methods like loadUser in the storage interface which doesnt make sense
load the user from the database as it says
if so put it in storage
if it doesnt give info about the user
in database
e.g getPoints()
will be in Storage
interface
some things doesnt make sense to me, the storage should be responsable for keeping the loaded objects in some sort of cache no?
it uses it but it doesnt define it in that place?
i dont think the database should interact with the storage itself 🤔
it isnt
the storage is interacting with the database
or u can do
Storage(Database db)
mmye
but keep that interface
SimpleStorage(Database db) implements Storage
SQLDatabase implements Database
lol i named the thing thats responsable for the database "storage"
and the storage "remotedatacache"
What could be wrong?
do you have a json file referring to that custom png?
Yes
and a json file with the name of the item you want to replace + .json in the models/items directory?
yea, I added it now it works 😄 tysm
don't ?learnjava me but how do I sort it lmao
I want to get the next number dividable by 9 (for example I have 23 and I want to get 27), how to do so?
for loop
Ok the only option?
while loop
if(size % 9 != 0) is existing, I know
😄
int i = 23;
while (i % 9 != 0) {
i++;
}
sout(i);```
imagine the storage would have a getUser(uuid) method, which interacts with the db if the user isnt present, the database has its response time so i worked with futures for my database methods so the getUser method would also need to return a future which makes t more complex
👉👈🥺
anyone wanna not ?learnjava me and answer this, how do I sort a hashmap by values lmao, everything on google and youtube don't make sense to me
well how do I sort the values
You can grab the values
what are you even trying to achieve?
I have a hashmap with player uuid and an int, I'm trying to sort the thingy from highest to lowest ints
Yeah but how lmao
Grab the entry set
new ArrayList<>(map.entrySet())
Then sort that list
Or stream the entry set
Really up to you
are there sorted maps?
Hey,
final Listener listener = new Listener() {
@EventHandler
public void onClose(InventoryCloseEvent e) {
if(Objects.equals(e.getInventory(), menu))
HandlerList.unregisterAll(listener);
}
@EventHandler
public void onClick(InventoryClickEvent e) {
if(Objects.equals(e.getClickedInventory(), menu))
e.setCancelled(true);
}
};
Is there any way to fix this problem:
'Variable 'listener' might not have been initialized'
you said the error urself
ye
String enable = plugin.getConfig().getString("Class-Enable"); Here getConfig gives me a nullpointerexception But why tho?
plugin is null?
mc 1.8?
ye
can you go to the shame corner please
best thing i heard today
Shame on you!
Shame on your cow!
April fools on a new level
if you claim 1.9+ is good your in denial

public void onCraft(CraftItemEvent event) {
...
event.getRecipe().getResult().setAmount(1);
}
Why it doesnt work?
no @eventhandler
public class CraftItemListener implements Listener {
@EventHandler(priority = EventPriority.LOW)
public void onCraft(CraftItemEvent event) {
Player player = (Player) event.getWhoClicked();
if(!(event.getRecipe().getResult().getType().equals(Material.TNT)) && event.getRecipe().getResult().hasItemMeta()) return;
for(int i = 1; i <= 9; i++) {
if(event.getInventory().getItem(i) != null && event.getInventory().getItem(i).getAmount() < 64)
event.setCancelled(true);
}
event.getRecipe().getResult().setAmount(1);
}
}
event.getInventory.setResult
You’re trying to change the recipe itself
Which is almost certainly immutable
.equals kek
it is for the test
Hii , I have a problem with the libraries in the project structure of the open source plugins that I edit, can someone help me?
is this how to check an object type ?
yup
ay ty
how can i store in a efficient way an item stack in something like a list or something?
because, if i do that by just storing the object, when the item changes, the .contains method won't recognize it anymore
oh that's actually a good way
i guess i'm stupid cuz i already knew about that but i just didn't think i could've use it xD
thanks
np
Hey,
I'm pasting structures via WorldEdit in chunks.
They are spaced correctly, but for some reason they only go in a single diagonal line, as you can see here:
https://imgur.com/a/4Qekguf
This is my current code:
https://paste.md-5.net/azayucirof.java
Does anyone see something wrong here?
What's it supposed to do? Your min and max locations you're adding/subtracting 4 on both the x and z so that would make a diagonal.
trying to check for if any players enter a certain radius of an entity, what’s the best way to go about that?
and exist that radius i guess
?jd-s
I want to paste the schematic everywhere.
As long as the distance to the other ones is correct
yeah but what type of file should it be
like should it be a continual task
or is there some event type that i should use?
declaration: package: org.bukkit.entity, interface: Entity
