#help-development
1 messages · Page 663 of 1
wdym with "miss 1 uuid"?
imagine i have 10 UUIDs in policeList
and each page can contain 12 uuids
the first page has 9 UUIDs instead of 10
i know, but where i did that wrong?
0 to 9 is 10
my guess would be to move the index++; after the if
maybe that you index++ before actually using index?
^^^
that is also explained in my blog post
that index is only for counting
if (index >= 12 || index >= tempPoliceList.size())
well a list size for 0-9 should be 10
so it should be fine
e.g. group id for me is com.jeff-media because my domain is jeff-media.com
if you don't have any domain you can use com.github.yourgithubusername or me.yourusername @hybrid turret
just try it at least ?
Otherwise I have no idea what it could be
Hi, is there a onTick() event? or something similar that occurs every server tick? or am I forced to use the scheduler?
sure lemme try
print out some debug values, e.g. current value of index, pageIndex, the list's size, etc
oh ic thanks
?scheduling
runTaskTimer(..., 1, 1) runs every tick
oke
i read that, when using github. you're supposed to use io.github....
does that have a reason?
@Override
public void onEnable() {
getServer().getScheduler().runTaskTimer(this, () -> {
// this runs every tick
System.out.println("tick");
}, 1, 1);
no. in fact com.github.yourname makes more sense
oh lol alright thanks
in the end it doesn't really matter
i tried so hard and got so far
it's just an "identifier" - and it should be unique ofc
ic thanks
I'd use com.github.mfnalex because my profile is https://github.com/mfnalex
Owner of @JEFF-Media-GbR - all my repositories can be found there.
Discord: https://discord.jeff-media.com - mfnalex
Yeah, if you have domain though, it's preferred
yeah at least if it's not a throwaway domain that you got for free for one year and then don't plan to renew lol
like almost everyone with their .dev domains
Ain't no way I'm throwing away my .wtf domain
i still got mfnalex.gay lol
oh yeah 1 more thing just for testing purposes. can you differenciate between linux and windows in the pom.xml <outputDirectory>-tag?
yes, with profiles
I'm writing a mod for a friend of mine and she's a family friendly streamer. Little does she know that the code she's running has a swear word in it

- read this blog post and use option #2 https://blog.jeff-media.com/how-to-make-maven-automatically-put-your-plugins-jar-into-your-test-servers-plugins-folder/
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
- add an activation that's os specific, one sec
<profiles>
<profile>
<id>export-to-test-server-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>C:\mctest\plugins\</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>export-to-test-server-linux</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>/opt/mctest/plugins</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
ohh that's super interesting, maven is really convenient
I mean depends on how horizontally scalable you want it to be
But its probably gonna be fine for you
yeah! I also just checked it, works fine - the windows profile is automatically enabled and can't be disabled (when running windows ofc lol)
how do you make profiles?
basically you just create a <project><profiles> section
oof, i should've read a bit earlier haha
nice :D
Hey, can someone help me, I wrote a sumo plugin, the command of which does not work, if anyone can help me, write to me privately
Or just ask here so way more people can help you? (:
?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.
yes they don't 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.
kek
apparently you haven't understood that ?notworking is a bot command and you should read what the bot replies with ^
the commands of the plugins themselves don't work either, I don't even know if I wrote them correctly
you keep saying "don't work"
I'm not English and I don't speak English very well
split it up
try (Response response = client.newCall(request);
ResponseBody body = response.body()) {
...
}
what happens if you run your command?
no, it's one block
nothing
try(
Response response = ...;
ReponseBody body = ...;
) {
...
}
You declare each AutoClosable its own scoped variable within the try
it does not say "unknown command"? it does not print "/command"? It does not show any error message?
yeah correct
but I'd use one line per variable
no not say "unknown command" but 1 error message
I don#t got a crystal ball so it would be very handy if you could show us the error message
';' expected
Expression expected
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
java.lang.RuntimeException: java.sql.SQLException: Statement.executeQuery() cannot issue statements that do not produce result sets.
at me.vasir.manacore.commands.FriendCommand.execute(FriendCommand.java:97)
at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:208)
at net.md_5.bungee.api.plugin.PluginManager.dispatchCommand(PluginManager.java:158)
at net.md_5.bungee.connection.UpstreamBridge.handleChat(UpstreamBridge.java:203)
at net.md_5.bungee.connection.UpstreamBridge.handle(UpstreamBridge.java:165)
at net.md_5.bungee.protocol.packet.Chat.handle(Chat.java:71)
at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:114)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)```
what is this ?
you are using UPDATE or INSERT or DELETE or sth
you can not execute query on an insert/update
which is not a query statement
string
String sql3 = "SELECT * FROM friendrequests WHERE receiver = ?";
try (Connection connection = HikariCP.getConnection(); PreparedStatement statement1 = connection.prepareStatement(sql3)) {
statement1.setString(1, sender.getName());
ResultSet resultSet = statement1.executeQuery();
while (resultSet.next()) {
String receiverDb = resultSet.getString("receiver");
String senderDb = resultSet.getString("sender");
if (sender.getName().equals(receiverDb) && receiver.getName().equals(senderDb)) {
PreparedStatement addFriend = connection.prepareStatement("INSERT INTO friend(friend1, friend2) VALUES(?,?)");
addFriend.setString(1, receiver.getName());
addFriend.setString(2, sender.getName());
addFriend.executeQuery();
addFriend.close();
sender.sendMessage(handler.correctMessage("Arkadaşlık isteği kabul edildi!"));
return;
}
}```
you call executeQuery on an INSERT statement
INSERT does not yield a resultset
you have to use executeUpdate
not executeQuery
btw googling the error message would have instantly told you that
I fidn SQL... whateveryoucallit funny
Just yelling in the middle of sentence :D
aight ty
wait
am i check two column for delete ? with sql code ?
What?
can you? yes
yes
but this not working
DELETE FROM table WHERE val1 = ? AND val2 = ?
aigt i will try
DELETE FROM 'settings.friendrequests' WHERE exists (SELECT 1 from 'settings.friendrequests' WHERE 'sender' = 'testname1' and 'sender' = 'testname2');
why so complicated
but they only have one table
yep
why not just DELETE FROM table WHERE col1 = ? AND col2 = ?
oh ok 😄 I already thought I was missing something
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
you are declaring a method inside a method
that's not possible and it also makes no sense
Well just make sure your indentation looks somewhat sane and it should be more obvious 😛
anyone know why this glitch happens with varargs?
it can be simplified
your first ternary is broken
isn't that wrong way around?
Yeah
ah
are args booleans?
it will always be false
if it's greater than 0 length true, else args[0], which will not exist
yeah
ah yes
D: What even are boolean operators
boolean replace = args.length > 0 && args[0];
pls I beg you
my code fcng my brain
someone check my code and fix my issues ?
https://paste.md-5.net/awiyijatis.js
also I hate the way that is indented
right i forgot its sequential, thanks choco
Describe the "issues" instead, no one wants to read through your entire code and fix it
split that up into multiple methods
Honestly shocked your IDE didn't yell at you for that
I thought IJ would have caught that simplification
Yeah you've just gotta abstract out some of that SQL code
hello @worldly ingot
how can i understand the complex ways 3 ints can be encoded to a long with bit shifting magic
i know how mc does it
i have the code
hello @lunar wigeon
but i have no clue how to understand it
my brain'S broken rn do u know how to do this for false?
or produce something myself
You can't encode 3 ints into a long. At least not full width integers
Ints are 32 bits, longs are 64
Which folders are advisable to add to your .gitignore?
SonarLint is the slightly more experienced cousing to InteliJ's in-house IDE boi lol
*cousin
Anything that isn't required to build the project, and any files containing secrets
what I recommend to do with SQL:
- create seperate class that manages database
- create manager class that will keep users in memory map
- update SQL database by memory map every x minutes
you can only fit 2 ints into a long
well it works
whatever magic mc is doing
not with integers
You lucky son of a bitch. I know the answer
yes with integers
where?
Me and my team worked with the anvil files extensively
no
maybe since the y is a smaller range
not with ints
It's because Minecraft doesn't pack more than 30 million. They drop a few bits
yea
for all feature i use try-with-resources for connection and statements
can i do one try for connection and split statements for features ?
Correct
8 / 4 = 2
"Containing secrets"?
return (((long) x & 0x3FFFFFF) << 38) | (((long) z & 0x3FFFFFF) << 12) | ((long) y & 0xFFF);
API tokens, passwords, encryptions keys
if you use that in your project
Ah icic
now explain that code
Thanks
what
they just explained it earlier
that is just a normal bitmask
Minecraft's anvil file format does has a list of binary longs that represent the position of blocks. The issue is the bits are represented by an X bit binary within that long, and that binary value is determined by the palette for that chunk section
You're truncating the x and z values to 0x3FFFFFF, truncating the y values to no more than 0xFFF, then oring them together
It's not overly complicated
x z are pushed furter and then y comes and mask the remaining bits
0x3FFFFFF, or 67108863, or 2^26 - 1

is rather straight forward
Lmao I get where the guys coming from though.
The anvil format is erm
interesting
Genius
But interesting
I do have this method in VeinMiner if you want 😄 https://github.com/2008Choco/VeinMiner/blob/master/veinminer-common/src/main/java/wtf/choco/veinminer/util/BlockPosition.java#L119
Among a few others
actually @worldly ingot wouldnt that need to be length > 0 && args[0] || true; to get the default value properly
There's some weird unsignededness magic
|| true does nothing
You ever used the raw anvil format? haha
yikes that wasnt done yet
i mean if its length 0 then it'd not return true but false
They manage to fit chunk sections into 64 bit binary longs as a list (Usually you'll get 10-16 ish blocks per 64 bits)
Which also by design allow you to determine the coordinates
of each block
Its an absoloute mind melter first time you dabble with it
understanding what the bit operations do is simple, but i’m struggling to understand when to “truncate” or “or”
But it is reallyh clever
or why it works
I mean
the | is just there to join them back
you take the 32 bits of x, trunace the first 6 ones
you have 26 bits of x value
you shift it by 38 to the left, so now you have them in the "front" part of your 64 bits of the long
*or you could use the Anvil method and have up to 16 of them, coordinates and all, in 64 bits
so you have a long that is 26 bits of "x" information and then 38 bits of 0
what is trunace mean

?.....
referring to this
what
?
yea you do that by creating a number that looks like this 000000111111111111111
so when you have this "bit pattern"
and you number & pattern
then obviously the first 6 bits in this case will be 0
first number is 7, second number is 20.
assume 16 bits per number.
7 in binary is 0000000000000111
20 in binary is 0000000000010100
now bitshift one of those numbers by 8 bits (move the actual number to the left)
20 << 8 is 0000011100000000
7 OR 20 << 8:
0000000000000111
| 0001010000000000
= 0001010000000111
because the pattern has 0s there
Truncate just means chop off
When you put 69.420 into an int, it's truncated to 69 :p
in the back, it has 1s, meaning that if the number has a 1 at a specific bit, the result would have a one there, if the number has a 0, there is a 0
😏

It's 1s and 0s! :D
i always hated bit shit in subnetting class
Maybe this graphic will help a little, @alpine urchin?
I hope you appreciate my graphical skills
its too long
Getting rid of 6 bits from x and z (because they're unnecessary - worlds only go to 30 million), and getting rid of 20 bits from y (because the y vallue only goes so high/low), and pack it all together
someone not understanding how bits work?
retrooper didn't understand how 3 coordinate ints were packed into a single long
just squish them together
Big squish
were they not understanding like where they all go?
btw, I have a question for this.
How do you get the Z bits or Y bits?
Cause I see that you get X with long >> 38; But the others?
Shifting by less and &ing the result by the maximum value
So z would be (long >> 12) & 0x3FFFFFFF
ahh
you don't necessarily need to shift bits to obtain the bits you want
Right. You could in theory also just & mask a 64 bit value lol
What are other options
Choco said it
value & 0b111111111111111111111111110000000000000000000000000000000000000000000000

lol
One may be a liiiiittle bit more readable is all
Would that be more like:
long &= 0x3FFFFFF000 for Z?
So a bitmask of 0000000000000000000000000011111111111111111111111111000000000000
26x0 26x1 12x0 ?
oh so 0b is for binary and 0x is for hex?
I never knew there was an option to write in binary, always thaught you had to do hex for binary manipulation.
Yeah
neat
do amplifiers count from 0 or 1? the doc doesnt say and i dont have my server rn
lright thanks
different topic, can i directly copy over another method's javadoc with annotations? i dont think @inheritdoc works
Yes, it does. If you just omit the Javadoc entirely it copes everything, if you omit part of it, it copies that part
You only need inheritDoc if you want to add stuff to a section but also include stuff from a super method
Are you actually building the Javadoc to see if it works?
its building automatically
but i mean methods in the same class
i meant it as 'i dont think it works here'
Oh, well no. Two methods in the same class have to have their own annotation. I thought you meant from a method you override
@link it is
If they are related like they are overloads, @ see is better
whats the syntaxx
i tried #signature and package.path#signature but neither worked
it just got eaten as plain text
alright, makes sense. now the operations necessary to do this i dont get
<< = go left, >> = go right
nice graphic
ty am graphic artist
probably png idk lol
It's a small resolution too
because I was too lazy to change it
ok
lets say we have these coordinates
xyz: 3, 3, 3
the long is 0 for now
how do we know how much to shift it by again?
im starting to understand
its shifting to the left
so its all together
in a long
i dont understand the & operation
inside the code
return (((long) x & 0x3FFFFFF) << 38) | (((long) z & 0x3FFFFFF) << 12) | ((long) y & 0xFFF);
does the & limit x to 67108863
& means only copy bits which are set in both args
why would we do that
to limit which bits can be copied and which are ignored
i dont understand
X & 0x0F says only copy the last 8 bits, if set in both X and the mask.
that hex number is a bunch of zeroes then a bunch of ones. the '&' makes all bits of the input 0, except where the mask has 'one' bits.
So, simplified:
0b01101101
& 0b00001111
= 0b00001101
which you then move to the left, to process and add the next bunch of bits
since 0x3FFFFFF is just bits filled with 1s
Yes
ok thx
No, it can be 1s or 0s, but it's the amount of bits that that number represents that matters
Actually, I lied, they are all 1s lol
0x3FFFFFFF in binary is 111111111111111111111111111111
Which happens to be 26 bits 🙂
how did they decide to limit it to 26 bits
yes i know it all has to add up to 64
but how'd they come up with 26
Because 30 million is just their upper limit for world size which can fit in 26 bits
it coulda been
what about the in-block coordinates tho?
whats the link between 67108863 and 30 million
Right, first bit is a negative
The sign bit, then 25 additional bits for the number which sum to a maximum of 33,554,431
Then they left about 2k for the y value (with one sign bit)

last thing i dont understand is how they knew they gotta limit x and z to 67108863
i see no link in the 30 million
and 67108863
show me an equation
you need 60 million points to mark 30 million points positive and negative
there's 100 points from 0 to 100
theres 200 poins from -100 to 100
yes
according to what you said
they should be limiting it to 30 million
and not "67108863"
that's the AMOUNT of data points
the first bit of that marks if it's positive or negative
btw, fot this, I wouldn't do ((long) x & 0x3FFFFFF) << 38), instead shift them to the right by 38 to get the x location
the RANGE on that is -33 mil to +33 mil
?
26 bits have 67 million combinations
if you use the first to say 'we're negative' that leaves half
oh makes sense
ok
limiting it to 25 bits
if you were an idiot like me, you could replace the code with
You're not an idiot, just a new topic; Don't beat yourself up about it :)
if (x > 33554432) {
x = 33554432;
}
///...same with z
long encoded = (((long) x & 0x3FFFFFF) << 38) | (((long) z & 0x3FFFFFF) << 12) | ((long) y & 0xFFF);
obv
dont do that
but does it have the same behavior
yes right
minecraft just blocks things from existing in that area, so that's not a limitation they need to do
oh ok
yeah i didnt account for negatives
but okay
thanks guys
the code looks less scarier now
XD
Got a design question of what is better:
I have a plugin in the works with a ability with cooldowns that actively update and change for the player. If a player uses the ability I want to display a cooldown bar and notify them of their cooldown if they try to use it. I wrote code to do this but want to know what is the better solution.
Should I run a constant running thread that checks to see who is in cooldown and update each player that needs to update or should I spawn an individual thread per player when they enter cooldown and cancel it when they are no longer in cooldown?
Not the most expierences dev so any advice is appreciated for approaching this.
i can't ping but i need ur help guys
ElgarL, frostalf, mfalex, EpicEbic, ImIllusion
to split my method into methods
wdym?
in some cases, that's not an easy question to answer. For something like this, where you want to display it to the players, both would work.
Personally, I'd use the individual threads, because they would be simpler to write. 90% of cases simpler is better
100 players with 3 in cooldown = 1 thread with increasing load.
1 thread for each in cool down player = 3 threads doing 1 players worth of checks.
Seems like an easy choice to me imo
well do remember that having a hashset has O(1) check time
That's what I assumed. Thanks.
Tis true, but O(1) just means even check time, not neasicarily speed
the extra runnables' overhead might get absorbed into that one. keeping code complexity low is more important here imo
A process that takes 1000 seconds regardless of number of things to check is still O(1)
just create a runnable task timer
u meant splitting into threads?
and be done with it
I assume that's what they mean when they mention threads
I didn't know if Java thread count was a concern on machines since I assumed threads were not virtual.
Use BukkitRunnables
dont worry about threads
Sorry that's what I meant.
is there a way to run spigot server with debugger so I can debug and hot reload part of my plugin?
you dont have to think about that when you just use bukkit runnables
Then ur fine my g
I would personally keep a map of all players and update all cooldowns in a single loop in 1 runnable
*map of UUIDs
well yes
i mean, both of those would work, but itd be really hard to say which one would be faster. I really doubt you need that kind of performance in a discussion of '100 player loop' or '100 simple runnables'
Always good to sanity check lol. Assumijg withiut elaboration is how singleton managers disappeared lol
you cant have that many players on a server at once
I was going to do something like that but not all players have access to the same abilities and some abilities may have multiple cooldowns compared to others. Right now I have a hashmap of uuids and an extended abstract class containing any and all cooldowns.
Then from a GC perspective, separate is the way
ah true
Well I'm glad to hear that it sounds like I'm going relatively the right direction. Thanks everyone!
what am i needed for
i have a command
i wanna split my command features to methods
brb i will upload to paste md5
Might just have to do so later. This is my first spigot project and it definetly feels messy.
Are you okay if I add you for future reference?
i do this for line 28
public void checkIfFriends(ProxiedPlayer friend1, ProxiedPlayer friend2) {
String sql1 = "SELECT * FROM friends WHERE friend1 = ? OR friend2 = ?";
try (Connection connection = HikariCP.getConnection(); PreparedStatement statement1 = connection.prepareStatement(sql1)) {
statement1.setString(1, friend1.getName());
statement1.setString(2, friend1.getName());
ResultSet resultSet = statement1.executeQuery();
while (resultSet.next()) {
String senderDb = resultSet.getString("friend1");
String receiverDb = resultSet.getString("friend2");
if ((senderDb.equals(friend1.getName()) && receiverDb.equals(friend2.getName()) || (senderDb.equals(friend2.getName()) && receiverDb.equals(friend1.getName())))) {
friend1.sendMessage(errorMessage("Bu kişiyle zaten arkadaşsın!"));
return;
}
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}```
is it right ?
What does private final InstanceAccess instanceAccess; do? I'm confused on why there are two instanceaccesses
the first is the type, the second is the name
private final String name = "mfnalex";
String is the type
"I have a field called 'name' which is a String"
but InstanceAccess is a class
yeah
yes
so does it call that class and name it as instanceAccess?
no
Also that mega check might be worth it's own method to make the base code less messy
it says "There's a field called instanceAccess and it holds a reference to an object that's of the type InstanceAccess" (whatever that is)
.
Missed that lol
so that is making a final InstaceAccess and you have called it instanceAccess
if i set custom model data to 0 will that show no texture?
I am still very confused
imagine this:
public class Person {
private final String name;
private int age;
}
ok
do you understand what this means?
yes, it is creating a class named Person which contains a name and age with their types
yeah and the same is true for your InstanceAccess field
yeah, String is another class elsewhere
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
isn't a field a variable in a class?
yes
And fields can be classes
Or rather
An instance of a class
ohh
So when you make a string, you are actually making an object of the class "String"
learn basic programming please, it would be impossible to help you with your actual problems if you dont know what a class is
ok
I'll do one better one min. There is a perfect video for this that has the "ooooohhhhhhhh" moment so many java tutorials miss
Learn all the essential basics of Java in one video in just 15 minutes. No programming experience required.
Complete Java Course: https://codingwithjohn.thinkific.com/courses/java-for-beginners
Variables, loops, methods, classes, objects, and more!
This is a Java beginner's lesson for the ultimate Java beginner, or just someone curious to know...
Ok ty
Imo this guy has the best "this is the point of OOP" reveal in any tutorial
Watch it fully without skipping and it'll be like a door opening
ok
And you'll be like "Oohhhh shit that's what the point of all this is"
there is no point wdym 💀
Is it possible to check using PlayerMoveEvent if the player has moved forward? I found only get from location and get to location but not to get direction
I mean u can calculate the direction with those 2 locations
no need to apologize :)
:)
you can use the difference between both positions to get the vector in the direction of the movement
^
but "moving forward" would be decently hard to detect since you have to compare that to their camera angle, i.e. whwt way are they looking
look into the basics of vector math to understand the basic operations you can do
Is there a way to control the invasions of pillagers?
Depends on what you want to do, if you want to e.g. cancel a raid you can probably use the RaidTriggerEvent
@EventHandler
public void onPillagerInvasion(RaidTriggerEvent e) {
e.setCancelled(true);
}
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/raid/package-summary.html
and can i trigger a raid?
Ok the video explains a lot but I'm confused on why we can't do:
private final InstanceAccess instanceAccess = new InstanceAccess();
and have to a use a constructor.
Not sure, probably with some tricky workaround. I believe the server will stop raids that are "invalid" e.g. a player is not in a village and stuff like that.
Why do we have to create a constructor to set it?
Keep in mind that this is probably not the best place to learn basic Java, and it's impossible to do so by watching a single 15-minute video.
because you want a specific InstanceAccess and not a random new one
This code randomly freezes the server. It appears to freeze at player.getWorld().getChunkAt() The goal of this code is to get a square of loaded chunks around the player, and return it in a list. Why is this happening and how can I get around this?
Code:
Chunk center = player.getChunk();
loadedChunks.add(center);
int radius = radiusRaw; //don't ask
int centerX = center.getX();
int centerZ = center.getZ();
for (int x = (centerX - radius); x <= (centerX + radius); x++) { //going - x to + x to get full radius of chunks
for (int z = (centerZ - radius); z <= (centerZ + radius); z++) {
Chunk currentChunk = player.getWorld().getChunkAt(x * 16, z * 16); //converting chunk coordinates to block coordinates to access chunk
if (currentChunk.isLoaded()) { //checks that the chunk is loaded
loadedChunks.add(currentChunk);
}
}
}
return loadedChunks;
send the full code
Sure 1 sec
getChunkAt(...) will force-load the chunk
to check if a chunk is loaded without loading it yourself do NOT use getCHunkAt but World#isChunkLoaded(...)
You're probably loading a lot of chunks during that loop, which would lag the server
I see. Would this freeze the server until it’s restarted?
Total code: ```public class ChunkUtils {
public static ArrayList<Chunk> getLoadedChunks(Player player, int radiusRaw) {
ArrayList<Chunk> loadedChunks = new ArrayList<>(); //the returned list of chunks
Chunk center = player.getChunk();
loadedChunks.add(center);
int radius = radiusRaw; //don't ask
int centerX = center.getX();
int centerZ = center.getZ();
for (int x = (centerX - radius); x <= (centerX + radius); x++) { //going - x to + x to get full radius of chunks
for (int z = (centerZ - radius); z <= (centerZ + radius); z++) {
Chunk currentChunk = player.getWorld().getChunkAt(x * 16, z * 16); //converting chunk coordinates to block coordinates to access chunk
if (currentChunk.isLoaded()) { //checks that the chunk is loaded
loadedChunks.add(currentChunk);
}
}
}
return loadedChunks;
}
}
I edited the indents so it would appear correct on discord, but it still doesn’t
you still force load the chunk
you still do getChunkAt
do NOT use getCHunkAt
use World#isChunkLoaded before you do getChunkAt
This is not the updated code. It’s just the total code from before. I understand this is causing issues, but is there anything else in my previous code that is as well?
I will switch to World#isChunkLoaded
I’m just wondering if there is something else wrong, as loading the chunks should just cause severe lag, not a freeze that lasts several minutes
well which radius did you call it with?
2
private final InstanceAccess instanceAccess;
```This makes an instance of InstanceAccess called instanceAccess
public DeathListener(InstanceAccess instanceAccess) {
this.instanceAccess = instanceAccess;
}```This makes an instance of InstanceAccess called instanceAccess and sets this.instanceAccess which was made from the first line equal to instanceAccess which is the InstanceAccess they just made.
Is that correct?
no
It’s called in a player interact event. If the player is right clicking while sneaking with no items in the offhand or mainHand, the utility function I made (this) gets called. The total design of the code is to allow you to call a nearby horse you own. It checks loaded chunks around the player, and sees if a horse you own is in one of these loaded chunks. (This code is currently disabled for debug)
bruh I don't understand
The first line does not make an instance of InstanceAccess, it simply defines a variable that can be an instance of InstanceAccess.
there is not a single instance creation in that code at all
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
idk my vocabulary
Which is why you need to learn basic Java before making a plugin
I know it sounds dumb, but dont use the official nomen clature with them.
Honestly? Bullshit. You can learn through spigot and I think anyone we send away to learn how to make public class Cat is a diservice kek
Easiest way to get off programming
You can learn through actual useful examples
Thank you! That’s how I learned Java.
that mean something to you personally
Basic modding and plugin dev
I made a plugin which shared hearts of two players and I'm trying to clean it up by "passing the instance" and creating listeners on seperate files instead one big file but I don't understand what the tutorial is telling me to do.
what else should I do?
You can, but it doesn't mean you should. You can learn to draw by painting the mona lisa, but it will take you much longer and you will miss out on a lot of the basic understanding required to progress.
i don't think so. imagine trying to write a plugin if you don't even know the difference betwen classes and instances of classes
Idc what you think about java learning everyone learns differently
just read a book about java, it'll take like a few days and it's much better than watching stupid youtube videos or copy/pasting from somebody
// Plugin startup logic
The best way is to learn something from a passion you have for something. Best to learn is making something with a real use case for you.
The thing is, no one here will be able to help you if you don't have a basic understanding of the language you are using
So long story short every class you make is like a box. The box contains shit.
But computers are dumb as all hell.
You need to define what is in the box.
Thats what constructors are for.
You are filling up the box
in my opinion, get familiar with java, at least the very basic syntax, and then you can code plugins and learn everything else by doing
private final InstanceAccess instanceAccess declares a field. YOu should know what declare means.
public DeathListener(InstanceAccess instanceAccess) declares the signature of the constructor for DeathListener. and this.instanceAccess = instanceAcces is a normal assignment
you need to know the very very basics at the very least
if you don't understand what any of this means, you should read a book about java
to actually write something coherent
You have a point as well. I already knew python so transferring over to Java was fairly simple. You should have basic knowledge of programming, but even with the very basics, you can begin to learn Spigot
From my experience when I was teaching people Java + Spigot, going off spigot and just practice Java basics on its own with my students helped a lot. Sure in the long run it can work, but you should learn a concept in Java on its own, then apply it. That’s at least what’ve worked best as a teaching method.
Imo the hardest thing we have all gotten over but forgotten is the the actual first time we all went "OHHHHH THATS WHY" when it comes to OOP. We take it for granted now but it is very hard to get over that hump
Its what i believe leads to tutorial hell
Its like learning how to use a screw driver on a plank of wood and then being told to assemble a 7 set cabinet
true
Think of it like writing a book or an essay in a foreign language, if you don't learn the basic grammar and phrases of that language it's very likely you'll just write some nonsense.
You need to see the screw do something you understand first
Think about it like you learn what each letter sounds like, and then get told to write a book...
How do you learn a langauge? With phrases that mean something to you
Whats the first word you always learn when learning a new verbal langauge?
Is it a coincidence its the first bit of code you always write in an ew language
yeah you start by writing sentences
a plugin is quite a big undertaking if you are a very beginner
you'll need to rely on your programming instincts (if you have programming experience but java is new to you) or on other people's help
Context is king bois
which is why we need to start creating plugins in javascript 🤔
public class House {
private Person ownerOfTheHouse;
public House(Owner owner) {
this.ownerOfTheHouse = owner;
}
}
public class MyPlugin {
public static void main(String... args) {
Person mfnalex = new Person("mfnalex"); // We create a new person
House mfnalexHouse = new House(mfnalex); // We simply pass a reference to an existing perosn
}
}
idk maybe this explains it. you should still check out a basic java tutorial or book
And then again, this is the help channel for spigot, not basic Java
Source: The Sweater (NFB, Roch Carrier) https://www.youtube.com/watch?v=ZZyDsF-Gp3o
yes this is that one part from skooks but unedited, that's where i saw it first too
are we declaring a new field in
public DeathListener(InstanceAccess instanceAccess) ?
or are we using the field from above
no
there is no field access in that line whatsoever
these lines slightly contradict each other but you can basically get help with all things coding ig
lmao
Okay money where my mouth is. This sounds like a Spigot Thread article time ❤️
My goal is to make it into the java command on this discord ❤️
xD
Does World#isLoaded(x, z) take World or chunk coordinates?
Though tbh java is a troll when u first learn it, there is just a ton of shit you won’t understand, like just in the classic hello world example you need to understand static, classes, objects, access modifiers, fields and variables, methods, types, strings, arrays, inheritance and polymorphism etc
instanceAccess in that scope is a local variable / method parameter
The first line gives enough context for the second line to be "(spigot)-development-related questions"
chunk
many people are still ready to help with general coding questions 😄
its why i love the video from earlier.
They teach primitives and intentionally teach the student char....
BECAUSE its a pain i nthe ass
and then introduces String as their first Class
Boom
instant "oh shit yeah that makes sense"
Let me ask you, is this correct? I want this "NamePack" folder to be in the same directory (for example in the rightmost image).
IMO Java is taking the idea of "I made a String class as Chars are a pain in the ass to use" and running with it
And taught like that
yes
is instantly beautiful and easier to grasp the language as a whoel
And that's the thing, some people try to understand absolutely everything at the start which will just cause confusion and pain. It's better to just accept things as they are and eventually you'll get those "aha"-moments and look back.
Yeah definitely
Like learning music, you don't need to know exactly why those notes sound good together, they just do, play them.
offtopic but i just spent like 40 minutes debugging an error because kotlin only logs some exceptions
lol
i didn't know an exception was being thrown this whole time
Oof
You sure its kotlins fault?
don't you start with music theory lol
well im pretty sure that kotlin does not log some exceptions
it does with some and doesn't with some
i don't like kotlin but I doubt that it randomly suppresses some exceptions
Imagine spending 3 hours because a number was 0 instead of 1 😅
Are you doing multithreading?
nah music theory is for nerds-
kinda, coroutines are there yes
To be fair, I was dealing with a huge amount of code tho
Then that might be it
perhaps it is
though it's the second time that i'm getting a suppressed stack trace when working with mysql
maybe it's mysql doing something funny?
oof
declaration: package: org.bukkit.entity, interface: Creeper
For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.
anyone knows how to setup command autocompletion for jda?
override fun onCommandAutoCompleteInteraction(event: CommandAutoCompleteInteractionEvent) {
println("HERE!!!!")
println(event.focusedOption.name)
println(event.name.lowercase())
if (event.focusedOption.name != "reason") return
// ...
}
this code does not send any debug when trying to autocomplete as shown in the screenshot. the listener is registered
Are u sure u can autocomplete that?
i hope so?
oh I have not, one sec
check the wiki I sent, there's also example code in java and kotlin
you want this right?
yup
yeah
alright let me test it now
i completely missed it in the wiki haha
oh yeah it works just fine now
thanks alex 🙂
np!
I would like to ask for help, I wrote a sumo plugin with which there is one major problem, mom, that it does not recognize the command I wrote in it
?paste your whole main class and plugin.yml
name: sumo
version: 1.2
main: hu.sumo.Sumo
api-version: 1.18
commands:
startsumo:
description: Sumo játék elindítása
usage: /startsumo
why do you have two classes that extend JavaPlugin?
the whole main class is flawed
you have a class called "sumo" and an inner class called "SumoPlugin"??
remove your outer class and rename your main to SumoPlugin
there is no need for this sumo class you have
bytebenders how i can get world in schematic
the "main" thing in plugin.yml isn't even correct
also the plugin shouldn't even be able to launch, main class is "hu.sumo.Sumo" and in reality it's completely different
shit i got sniped
yeah it wouldnt even enable
What
you wouldn't schematics aren't bound to worlds
i need get all blocks in shematic but for create location need world
o
what do you need a location for?
eheh
this makes no sense whatsoever
If somehow the server crashes, will onDisable pass?
it's not directly like that, but the intel puts it together like crap
i see
you place schematics in a world
why do you have an inner class?
not teh other way around
wdym by the intel even
intel? NSA?
try it, put something in onDisable like a file creation and crash your server (or force stop the console)
the CPU company?
intellij perhaps?
TRUE the intel as a company is sabotaging your code
I've had this thought for years and im not schizophrenic
oh that makes sense actually, thats why my code never works
the intel is manipulating my code, why CPU company is sabotaging my plugin D:
yes
that is true
ESPECIALLY minecraft plugins
they dont give a shit about anything else
i knew it, they are the ones that make my plugins not work on the first attempt and then somehow work after recompiling
those sick bastards
motherfuckers
sisterbreeders
i'd too but money is not really easy
Amidst your code's harmony, Intel's mischievous bit-dance emerges. Binary secrets sway, hinting at their digital meddling.
right since apple uses your info without letting you know so it feels like ur in control
lmao
ty do that?
they*
what does this website do?
it's just a pastebin
these mothertruckers, I knew something was wrong
hey when did you ever make plugins for custom structures and their spawning in biomes? Can you tell me the best way to do it?
ok
but how would this help me with my problem?
it would allow us to read your code better
why did you assume that i ever did that
i think all do this sometime
uhh pretty much nobody does this
@pseudo hazel
really?
either way do not ping me without a valid reason
stop aguing xD, just use the paste link to show your code
thats the easiest way for us to see your code and talk with you at the same time
hah without traslate "pingount"
k
if its only a few lines its fine to just put it in chat but for bigger files putting in the file itself is just a bit annoying
I already told you what your problem is. YOu have two classes, one is called "sumo" and doesn't do anything. This is the one that spigot instantiates. Then yo uhave another calss called SumoPlugin that has your actual logic, but it never gets instantiated
I wonder how you'd even come up with that
this is what happens when people use IDEs not knowing what they do
chatgpt probably
thats probably it
can I say something so people just quote me? or is that not possible in modern time
wdym
ofc its possible
it would just have to be something everyone will hate you for
they will hat you
u saw nothing
i see everything
no, I want to be loved for making good quotes, not hated for saying shit
well that'd be way harder considering the current state of social media
probably not automatically
I mean if you get the Player object that means they are online
in which case its fine
people don't respect us, great physophs anymore :(
so for checking a permission its fine, thanks
I dont see why you need a permission of a player that is not there
Vault supports offline player permissions
what about just getting the player from offlineplayer?
you can't?
It'll always be null if the player isn't online.
so the only way is Vault? (how?)
thanks
basically you just get the registered service provider for Permission.class and then use playerHas(String world, OfflinePlayer player, String permission) http://milkbowl.github.io/VaultAPI/
why it needs a world name? weird
for per world permissions?
hmm
anyone know which NMS class handles sending chunk data to the client, i'm asking as I want to rewrite it to send data from my custom world save format
use the maven-shade-plugin instead
https://blog.jeff-media.com/common-maven-questions/ second headline
People just getting started with maven always ask me the same 3 questions, so here’s a a short FAQ! How to change the output directory? Read this. How to shade dependencies and what it means Sometimes you are using certain libraries (for example, my CustomBlockData class, or similar stuff) that is not already present at...
you don't need the maven-assembly-plugin
tysm got it working^^
np
how to make plugin where u write /rp it adds prefix in tab and if write again it removes it
Good day,
These links are from a page to format the code nicer. Serves to see better.
I have an error with Netty (https://hastebin.com/share/jovotoxoku.css).
This is unfortunately executed in my PacketDecoder (https://hastebin.com/share/imahovahax.java).
I have already asked ChatGBT, however the AI has only given me code examples which either don't work or give more errors.
I hope someone can help me with this!
hey, this isn't spigot related, but does anybody know where rustfmt.toml happens to be located on linux?
is it project-based or global, even?
tyty 🙂
somehow you're writing past where you're allowed to write. Unfortunately, you're not showing the code that's causing this, just the code that prints the error out to console. please post the code calling 'exceptionCaught'.
by the way, there is a paste website with a quick link in this server
?paste
This is the code of this error (second link)
with the output, it shows that it's where it prints 'Protocol1'
and the function aint called
this just prints the exception far as i can see
this not plain java?
ok wait a moment
this is the full error: https://paste.md-5.net/poquwoceku.bash
https://paste.md-5.net/kamogipida.java this is the full class
what's PacketBuffer lines 616 and 52?
Whats the best plugin to prevent xray
wrong channel
Bro i just need a name
wrong channel
🤓🤓
also that's for paper only
du you have already seen this paste?
are you sure that strings even are prefixed with their length?
Mir ist grad aufgefallen das du aus Deutschland kommst also können wir auch deutsch schreiben
Ja aber müsste
its in the rules i think
no?
it's english only
also why isnt this image loading
see youre lazy and not reading em
even if it's only in the channel description of #general , it applies to the whole server
he?
the rules link to this
i dont think md_5 means the #general channel saying 'General rules'
can we switch pls to dm?
anyone using intelliJ that understands something about themes and stuff XD
its not really coding, but i cant think of any better place to ask so idk what else
if anyone wants to help, then i will make a thread to show the problem
Sure
Is it possible to ignite a moving tnt block? this behaviour isn't enabled by default but it plagues my server.
Current code:
@EventHandler
private fun onListenArrowGroundHit(event: ProjectileHitEvent) {
val entity = event.entity
if (entity !is Arrow) return
if (event.hitBlock?.type == Material.MOVING_PISTON) {
val data = event.hitBlock!!.state as MovingPiston
val movingBlock = data.movingBlock
if (movingBlock !is TNT) return
movingBlock.isUnstable = true
}
entity.remove()
}
It does reach the movingBlock.isUnstable = true part, but it doesn't ignire
got it fixed
Hello guys, i would like to setup spigot and maven for Minecraft 1.7.10 but I don't know how to write the dependencies, can someone know how to do it ? Thanks for your answers
Too old! (Click the link to get the exact time)
Can I use Bukkit?
i mean
maybe
buildtools should still support bukkit but i dont know if modern versions still build to it
I actually couldn't find anything
--compile-craftbukkit ?
--compile CRAFTBUKKIT
yeah
hey guys! Is there a efficient way to check if a block is a valid block where an item frame can be placed on?
i have shaded an api and relocated it inside my own api, how do i make javadocs with the relocated packages?
hmm, i think i found something
i'll try it
normally you will just add the other libs docs to yours with the link stuff, and not include their docs inside yours
well, in my case this other api is mine also, it's the game engine api, so it's best to shade it/relocate in
does it also have javadocs hosted
not yet
i can't keep the engine in the root as it would clash with other minigames of mine
so relocating it is the best
you can reloacate it fine, just link javadocs for it to attach the variables from
I can't figure out how to check if a person is going right or left using the PlayerMoveEvent, I know that this can be calculated somehow, but I can't figure out how
I mean to the right or left of the direction
player movement depends on the camera. Find the vector the player moves in, and remove the y value, then calculate the angle using a (0,1,0) vector as planar identificator (dont know the actual name), to the equally flattened vector given by the player's sight. AFAIK can take on 8 values like that for the cardinal and diagonal directions as viewed by the player
vector math is dumb
that's basic trigonometry.
- get the vector between old and new location, let's call the old location A, the new one B, and the difference AB
- get the yaw as radians, I think it should be yawRad = yaw * pi / 180. we'll turn that into a vector called yawVec with the three values cos(yawRad), 0, -sin(yawRad)
- get the dot product of AB and yawVector.
and then comes step 4 but I don't remember how that works lol
maybe ask chatgpt
actually i realize its probably much simpler than that
is it?
i mean, the rotation is available, so you have that
do you mean yaw with rotation?
ye
you should be able to calculate the rotation of the movement direction too
then its just some numbers
also the 'to' location in the playermoveevent may have the yaw of the direction youre moving into
I want to make plugin that allows player only move forward or backward if he is in flight
:/
people could be pressing W+D without moving the camera - they are going right. but what if they only move the mouse to the right and press W? Does this count as straight-forward, or as going right? what if they are going straightforward but in a diagonal direction, etc
oh well then just check if the new yaw is greater or lesser the old one
you can just do
Location old = event.getFrom();
Location to = event.getTo();
to.setYaw(old.getYaw());
event.setTo(to);
or sth
id really recommend doing a check on that if you do that tho, setting it without checking if needed will be more glitchy
Oh no, I wanted player to only move forward or backward from the camera like pressing w or s
good luck on that matjh
yeah you could check if he turned left enough by comparing the old and new
and if he passed a threshold in a period of time you could consider it a left turn
chat gpt wrote that
public void onPlayerFly(PlayerMoveEvent event) {
Player player = event.getPlayer();
Vector from = event.getFrom().toVector();
Vector to = event.getTo().toVector();
Vector movementVector = to.clone().subtract(from);
Vector cameraDirection = new Vector(
Math.cos(player.getLocation().getYaw() * Math.PI / 180),
0,
Math.sin(player.getLocation().getYaw() * Math.PI / 180)
);
double dotProduct = movementVector.normalize().dot(cameraDirection);
if (dotProduct > 0.5) {
player.chat("Right");
} else if (dotProduct < -0.5) {
player.chat("Left");
}
}```
and it's really working
yes but it's easier with the way i said it
yaw being in degrees is awesome
you don't need to complicate movements with sin and cos 😄
oh nvm, i forgot to take in the account the player movement
yeah but how's that going to help you
also shouldn't it -Math.sin
Maybe because of that right is left and left is right
:/
wait
honestly i wouldve just taken the numbers and tested where what side is lol
Whats a valid reason?
a justifiable explanation for pinging him, instead of doing it randomly
ok it's really useless to make something like that but i'm too stubborn
that's why i understood this only after doing that
sorry for bothering you
the idea was good to make something like hoverboard that can't move right or left but using this way it's really lagging that's why it became useless
how to set a players skin to offline player's skin?
You can use SkinsRestorer
Or you can override the GameProfile texture property after sending a texture http request and refreshing that skin by sending the player info (remove), OutRespawn, and player info (add) packets
Wait, how do you send a texture http request?
Hello. Im trying to add animation on usage of custom item with resourcepack and this code doesn't seem to be working:
ItemMeta hand = p.getInventory().getItemInMainHand().getItemMeta();
hand.setCustomModelData(22813372);
Bukkit.getScheduler().runTaskLater(Alcotester.getPlugin(Alcotester.class), () -> {
hand.setCustomModelData(2281337);
tester.setItemMeta(hand);
}, 20L);
``` (it's intended to change modeldata to a different picture and then back)
Can you help me a little please?
I have custom npca and sometimes when the sertver starts they lack the skin
I mean like getting the player info, from like a mojang api, and then only getting the texture parameter
Ohh
You can do that using Gson
And spigot also uses it so no need to compile it with the plugin
wouldn't OfflinePlayer.getPlayerProfile().getTextures() work?
What is that?
OfflinePlayer#getPlayerProfile is a thing?
Player p = Bukkit.getPlayer(args[0]);
OfflinePlayer offlineP = Bukkit.getOfflinePlayer(args[1]);
p.getPlayerProfile().setTextures(offlineP.getPlayerProfile().getTextures());
ye
maybe bec im using Paper
Must be new
thats in spigot
Oh ye that explains it
it was added in 1.18.1
declaration: package: org.bukkit, interface: OfflinePlayer
Ye test it
You still probably need to refresh the textures
ok
how to do that?
.
ohh ok
ok
There may be other ways now
maybe hide player from all players and show him back?
Ye that should send the remove and add packets
Now just throw a respawn packet in that
You can either teleport the player into another world
get the player's channel and use Channel#writeAndFlush
i will use ProtcolLib
Or use the sendPacket method in I think the Entity Player class
I guess that also works
ok thank you you helped a lot
Is there a clean method of taking a world in the servers root folder (ie, "duel_map"), creating an instance of it and teleporting people to it? Then deleting the instance when it's done. I'd want to create multiple instances, and I'd like to avoid plugins designed for this (for learning purposes) unless the code required is grotesquely long/complicated
Bukkit.createWorld(WorldCreator)
Or do you want to use an existing world?
I want a template that I can make multiple instances of
I don't get what you're saying
you would need to clone the folder then load it
So copying worlds?
is that industry standard?
no clue
I want "duel_map" world that I build (same as "world", "world_nether") and I want to load an instance of it for each duel that players start, then I want to remove the instance when they leave
you shouldnt load a world for each duel
that's not a great idea
How is it usually done?
would be pretty laggy, creating worlds is an expensive operation
1 world and just spreading them appart
Copy the blocks
So just modify the player list and chat so it only shows people in current match?
you could async paste the arena in different regions as needed, that is what I did for a practice pvp server
Yeah that would work
so im using intellij idea for plugin development and when i added my other plugin's jar as an external library file and used it, there was no errors in the IDE but when i packaged it using maven, there was this error:
package com.amirparsa.hypixelcustomitems does not exist
this is the code where i used my other plugin's code:
private static HypixelSkillCore plugin;
private static HypixelCustomItems customItemsLib;
@Override
public void onEnable() {
plugin = this;
customItemsLib = (HypixelCustomItems) getServer().getPluginManager().getPlugin("HypixelCustomItems");
how can i fix this and no i dont wanna use interfaces for api
I think I once had a similar issue. Make sure the pathway is correct, reload maven, it will fail once and should work correct afterwards
and also, do i have to add anyhing to the pom.xml?
Uggh I haven't been using maven for so long I don't actually remember.
why? maven is way better than gradle
🤮
I mean gradle is faster
is it tho
its easier to use
imo its not
But builds 2 minutes
bazel better
IntelliJ compiler better
oh maven is older...
and also, do i have to use the RUN button for getting a build for plugins or the BUILD buttton? when using maven and the minecraft dev extension
In maven I think it was the build button in the maven section
the green play button with a mvn package run config
this code changes model data to 22813372 and then back to 2281337 which have different textures
but the texture in game doesn't change
Why is the number so high?
Why does setItemMeta remove all nbttags that I previously added to my item?
because funny number
Makes sense
it overwrites all
because you're replacing meta lmao
to prevent conflicts with other resourcepacks maybe

