#help-development
1 messages ยท Page 1419 of 1
Show some code as it works here just fine
ScoreboardManager sm = Bukkit.getScoreboardManager();
Scoreboard board = sm.getMainScoreboard();
team = board.registerNewTeam(team_name);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
team.addEntry(player.getName());
And i add both players
Sorry for another question, but is there a way to change block properties from plugin like using the debug stick?
Looks fine. You should never collide with any team
But it doesn't work and idk why
Do spigot needs something on true maybe?
1.16.5?
How do i add a item to an inventory?
Inventory inv = Bukkit.getServer().createInventory(null, 27, "ยง9Links").addItem(DiscordItem.Discord)
inv.addItem
ok ty
addItem doesn;t return an Inventory
alr
anybody knows
whats wrong
i tried also
when i open the inv
the items arent there
yeah, COMMAND isn;t a possible ItemStack
Those are legacy materials
COMMAND is the old material name for the command block yeah
but i want it like this
no i literally have a scoreboard system for this
Objective h2;
if (board.getObjective("showhealth2") == null) {
h2 = board.registerNewObjective("showhealth2", "health");
h2.setDisplaySlot(DisplaySlot.PLAYER_LIST);
h2.setDisplayName("" + ChatColor.YELLOW);
} else {
h2 = board.getObjective("showhealth2");
}```
this is my code
i have one above name
and in playerlist
reflection time big boy
Or update
i am not updating
It's time to move on
what dependency do u use?
do u use maven?
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
yes
thatss it
if thats what u mean
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
add this as a new one
and try
if it works
do what
add this to ur pom.xml
under the dependencies
try using the thing that didn't work for u
well it doesnt even exist
even in the spigot-api?
yes
so... rip
how do i do it
I've multiples identical ItemStack (same name, same lore, same Material, ..) so they have the same hashCode. Is there an hidden tag i can used to get differents hashcode between my items stack please (to be able to use .removeItem to delete the specific item) ?
You might have to do some reflection. We don't know since we don't use ancient versions
Decompile some classes and look around
no, not without making the items unstackable
if unstackable items are fine, add a UUID into the persistent data container of the ItemMeta of that item
and that will make the stack unique
it won't stack, but you can target it specifically with removeItem and similar
that's what i was thinking yep
but where can I add something into data container of ItemMeta ?
Was there a recent update/change to Scoreboards? It seems registering teams to the Main scoreboard now throws an already registered error
wasn;t happening a couple of days ago
How can you abuse?
Nope, no changes in months if not years
odd but ok
even with the code you gave me i cannot deactivate collisions between players x)
Odd. You saw it working on the demo server I ran up
enable?
I see no entry in spigot yml for collisons
that's on paper
which does it through teams as well
because player collisions are client side
and the only way to disable them is to set the players in teams with the collision rule off
So default with Spigot collisions are default on
With teams i can achieve no collisions between me and other entities (but not others players)
like me and a villager
Well I'm afraid I can;t test for you at the moment. I seem to have broken team registration on the Main scoreboard somehow
Do you have same bug?
No
I'm having an issue registering any team on the Main scoreboard. It complains that the team name is already registered
Which has me stumped as I've changed no code I can think of
very odd. It was working when I tested collisions now no scoreboard team registration works
well, no registration on the Main board
Honestly these teams systems are fucked
yep, they persist through server starts
Hey, I'm working on a custom plot system and I cannot wrap my head around how to figure this out
Basically, I want to have a method that takes in an X, Y coordinate and finds the next coordinate in this sequence https://prnt.sc/12jlk2b
anyone can help me
java.lang.UnsupportedClassVersionError: me/TheWood/org/Main has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 52.0
idk how repair this
that's a rather complex algorithm
Yeah I know lol
logarithms and shit
side length 1 spans index 0, side length 2 spans indices 1 through 4, side length 3 spans indices 5 through 8, side length 4 spans indices 9 through 16, etc
or actually looking at it that's totally wrong
could just find it iteratively i guess
find the floor of the square root of the index and you'll get the side length, then check whether you're past halfway to the square of the next integer
then xor with side length % 2
and throw a few more xors and %2's at it and you'll probably get there
The real question should be, Why do you want to trace this pattern?
it looks kewl i guess
The class was compiled in a higher version of Java. Solution update Java
or compile for a lower version
the version
?
JAVA version
no, this I already repair
Hello guys !
I'm trying to create more complete configuration files than usual to me, and I'm having a problem.
How can I get all the sections back?
In my example, it will be all "whiteGlassPlane", "lightBlueGlassPane" etc ...
I want these sections to have a user configurable name, and this is where my problem lies: /
other than brute force and testing for all characters ... xD
Thank you for your time
get the section and call getKeys on it
in the chat say spawneando un whiter skeleton no spawn any
it'll return a list of all the sub-sections and keys in it
f.e if you get the decoration section, and then call getKeys on it, you'd get the elements you listed in your example
Ah !
Keys !!
That's what i was looking for, but i didn't know these were called "keys"
Thank you dude โฅ
Last question: the method is getKeys(boolean arg) ... What is this boolean ?
whether for the get operation to be shallow or deep
getKeys(true) will return every key and every key of every sub section and so on
so it'd give you whiteGlassPane, whiteGlassPane.material, whiteGlassPane.name, and so on
getKeys(false) only gets the keys in the level immediately below
OH Well, i'll use getKeys(false) so xD
Thank you again ๐ โฅ
Hi all
Completely that: https://www.spigotmc.org/resources/angelchest-free.60383/
But it only works for those who are OP, how can I get it to work in survival mode? Very thankful
how would i do something like this:
(this is not correct code it just is an example of what im looking for)
if (inv.getItem().equals(ItemStack.item).isLeftClicked()) {
p.closeInventory();
}
Did you make that plugin?
because you might want to ask this in #help-server @stable stone
#help-server, and permissions
you call the spawnCreature1/2 methods but they don't have anything in them, lol
also your brackets are fucked up
reminds me of cpp
how what don't have any inside
?paste holy shit
you call spawnCreature1 but it doesn't do anything
there is a pattern there
what I need to put inside
you need to put english inside your head
trying to help someone who can't understand anything you say is the most annoying thing ever
how would i do something like this:
(this is not correct code it just is an example of what im looking for)
if (inv.getItem().equals(ItemStack.item).isLeftClicked()) {
p.closeInventory();
}
ok ty
how do i show the damge i dealt to an enemy when i hit them with a sword like if i hit a zombie it shows the damage. idk where is shows it could be in chat,console or whatever?
if you want to be fancy, show it in a hologram like in old school rpgs
EventPriority.MONITOR and getFinalDamage or whatever it is
that will remove test and everything keyed under test
thank you very much ๐
It's actually not removing
the thing
the path stays there
but the data is gone tho
I am selling a MC server, DM me if you are interested
not the right channel
any1 can help?
show what the config looks like afterwards
and what path did you set to null
if (e.getClickedInventory().getItem(1).equals(Discord)) {
e.getWhoClicked().sendMessage(Links.getInstance().getConfig().getString("discord-message"));
}
in the getItem() method what is that value? the slot the item is in?
e.getSlot()
you aren't setting it to null
?
you are setting everything under it to null
you are setting spawn.x to null; set spawn to null
setting everything in a section null results in an empty section
setting the section to null results in it being removed altogether
thank you ๐
iik thats the method but what goes inside of it? its an int but what does that int mean? is it the slot?
?jd
package index
thx
google is your friend
Inventory inv = Bukkit.getServer().createInventory(null, 10, "ยง9Links");
if (e.getClickedInventory().getItem().equals(Discord)) {
e.getWhoClicked().sendMessage(Links.getInstance().getConfig().getString("discord-message"));
e.getWhoClicked().closeInventory();
}
i have a custom item called "Discord" and i have it in the inv variable. I'm trying to get it so if the Discord item is clicked inside the inv, it will send a message and close the inv
get the slot that was clicked from the event
use that slot number to get the item that was clicked from the inventory
hey so i'm a little conflicted on what to do here. i want to create custom quests but can't decide on using some file containing quest data, or to make a separate class for each quest (so that way i can heavily customize it and make quests more unique, trigger some animation, do something to the player etc. which i wouldn't be able to do with just loading in a quest form a config file) so would creating a separate class for each quest be the best option here?
this would eventually also translate to custom npc's who do different things on interaction/death, custom mobs, custom items etc.
i just don't know if ending up with 60+~ quest class files would be good practice
Hard coding is easier short term, but allowing configuration through files is going to please whoever you do that for much more and will cost you less work later on.
You could allow different actions like BREAK, KILL, etc. and load the quests through that.
IMO, configurable is always better. You could still hard code the extremely complex quests and abstract generic quests down to aforementioned actions.
?paste
yeah my approach with quest classes would be to make the process of making a new quest as easy as possible through code, most methods being in the main Quest class already so you can use already existing functionality like killing 5 types of a mob. i think i'll try and give classes for each quest a shot because i love the freedom in that approach. im also making the plugin just for myself as a learning opportunity to slowly make a big rpg plugin (kinda like wynncraft in the end) thanks for the advice!
How would I call an event if someone gets an advancement, and how check if a specific advancement is gained? I can't find the enum in the JavaDoc, if it even is in it.
declaration: package: org.bukkit.event.player, class: PlayerAdvancementDoneEvent
well an event already exists for that @stoic iris
you wouldn't have to call it, it's already called
so how would I figure out what specific advancement was achieved in an event handler?
is sending titles thread-safe? means that i can run it in an async task
try it and see
if(event.getAdvancement() == x) what do I put for x?
probably an enum
yeah I can't find where the list of enums are
it looks like Advancement extends Keyed, so you can get the name of the advancement with Advancement#getKey().getKey()
struggling a little bit with some logic im trying to get figured out. im essentially trying to create an additional bar similar to the food bar in vanilla minecraft using custom icons via a resourcepack put into the player's actionbar with some negative space trickery to place it in the right spot.
showing it to the player I got down but the problem I am having is a way to take a percentage of how full the bar should be and create the string full of the icons (full, half full, and empty) in order to create the full bar. I got pretty far but 1. I feel I am severely over complicating it and 2. its not working as intended. it is always showing at least 1 half-full icon even when it doesnt need to (ex. half of the bar being full and the other half being empty bars)
heres my code so far:
so the //create bar part is where the issue lies
im essentially running a loop that runs 10 times (one for each bar) and checking whether that bar should be full, half full, or empty depending on the percent fullness of the entire bar
once I get to the part of the bar that is half full or entirely empty, I set the rest of the slots to empty icons and end the loop
the thing is I dont think it is reaching a point where it detects the slot is entirely empty for some reason
something must be wrong with my math
ok, I just need a bit of help, I need to copy a world, but whenever I copy it, it just creates a super flat world. here is my code
WorldCreator wc = new WorldCreator("" + id);
World copy = Bukkit.getWorld("island-template");
wc.copy(copy);
w = wc.createWorld();
anyone know how I can fix this?
OHHHHH I just relized, WorldCreator.copy() only copies the settings, not the world, how can I accomplish this?
is the event triggering?
are you getting an error?
also wait.. are you casting event to player?
oh ok
yeah ok
Still an unsafe cast
not weird, u were casting event to player, that would never would
^^^
Also should probably use <= 0
whyyy is custom RecipeChoice not supported .-.
What
if you make a class which implements RecipeChoice, it can't actually be used when registering recipes
Why are you making a class that implements recipeChoice
because I have custom items that can be smelted
that will not work
Why not
because my custom items are not simple and their recipes may not be either
Doesn't matter?
yes
It matches any custom item
it would not work for a scenario like:
an iron ingot with PDC tag "type" = "ingotSilver" and tag "quality" >= 0.8
Well the type part would work
yes but that is the easy type
You aren't supposed to implement bukkit interfaces, but it should work in theory
I already have custom crafting system, just gotta hook into the furnace
it unfortunately doesnt work
gives an error
and is labelled as illegal to implement in the docs
it doesnt make anything impossible but I gotta do workarounds to check if the furnace recipe is doing a vanilla recipe or one of my custom ones
because also you can't get the recipe's NamespacedKey from FurnaceSmeltEvent
okay I see why its unsupported
if either that or the key thing worked it would be okay but unfortunately neither do so workarounds it is
hey! i just switched to maven and while building the plugin i get this error [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project GPractice: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 7 or later. [ERROR] Target option 5 is no longer supported. Use 7 or later.
do anyone know how to fix that by any chance?
same error
show pom
<modelVersion>4.0.0</modelVersion>
<groupId>me.iiAhmedYT.Practice</groupId>
<artifactId>GPractice</artifactId>
<version>1.0</version>
<name>GPractice</name>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.javacord</groupId>
<artifactId>javacord</artifactId>
<version>3.3.0</version>
<type>pom</type>
</dependency>
</dependencies>
</project>
i really still didnt figure out how im going to include plugin.yml too but im looking into it
add this
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
it says ```Description Resource Path Location Type
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. pom.xml /GPractice line 9 Language Servers
is that normal?
oh
add version, sec.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
no problem
any1 wanna come help me test my plugin ?
i need another player to test it with
its a one in the chamber plugin
@quaint mantle ip and version?
hey my server crashes for this error cuz of 1 plugin
do we support outdated versions?
no unless you want too
its not the version problem...
bruh
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>```
its this thing
Anyways stop supporting evil
you need to remove the signature.ds from your shaded depends
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.SF</exclude>
<exclude>**/*.DSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>```
oh thanks md_5!
would hard drive speed affect server preformance
ye
by how much
idk
if your drive is slower then worlds load slower
plugins that use custom configs would be slower
i have to transfer my server to another hard drive
cuz my ssd ran out of space
0 bytes left
Configs are stored in memory
i was pregenerating a world
So they probably wonโt be impacted much
loading configs in a folder
not specific ones
is there an entity move event?
can i cancel out the movement of a zombie
without messing with packets?
does anyone have a good hard drive that is under $100
link
for like 60 bucks
okay lemme try to find it
oh lol
heres the link
You can with a runnable, but there isnโt an event
You could also give them no AI, or high slowness
Oh my you are a genius
Or set their movement speed attribute to 0
oh how can i do that?
zombie.setspeed?
4gb for 50 bucks @torn oyster
getAttribute
thx
if (player.getWorld() != "world") {
how can I do this
says Operator '!=' cannot be applied to 'org.bukkit.@org.jetbrains.annotations.NotNull World', 'java.lang.String'
um
try .equals?
Yes
nice tysm
- World.getName
- Compare strings with .equals
Mhm
Thats Paper not Spigot
Umm okay
how can I make my plugin use java 11?
Gradle, Maven or JDT/Whatever IntelliJ's Build system is called?
Maven
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
There is another way, but I don't know it since I usually always move over to the compiler plugin
tehre is this?
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
oh ye
I think changing that to 11 will work
since htis uses that
<source>${java.version}</source>
<target>${java.version}</target>
why do that
idk its just the default pom
The other way is
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
Not really given that you appear to already explicitly use the compiler plugin
YES!
how much better
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html#readAllBytes() is my fav new method, it's less work for me and it is like 100x faster than a while-loop on https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/InputStream.html#read()
I recommend to, especially when dealing with (N-)IO
You get a better compiler, I heard they improved on string concentration quite a lot
It will lead to better performance if you compile it natively at newer versions, even if it will be minimal
Performance is performance ok
It all depends on who uses your plugin
I was wondering how bungeecord works, are there any services that have more functions?
You don;t really know what Bungee does, yet you are already looking for something that does more?
More functions, elaborate
I havent looked yet. But I know what it does
Java 11 has useful annotations and Pairs ๐ฅด
Java 16 have sealed classes and records
What I mean is. How bungee is able to redirect a player to another server?
Does it exists something that does the samething but better? I saw that several networks use something called waterfall
Thats its job, its a proxy.
idk, why some network prefer not to usee bungee
What
I use Eclipse, Conclue uses InteliJ
Yes I mean some servers consist of just one server
Then using a proxy is quite pointless
Most networks use bungeecord or some fork of it assuming you want to have a proxy server for your backend servers
Waterfall has more patches than bungee
Means nothing. Perhaps they made hundreds of typos they had to fix. At least list something constructive to show one is better than the other.
I'd still choose waterfall if they only had typo fixes
Your choice
I need to know how that works... Can you guys link me some website?
How what works?
A proxy
and DON'T stop reading after its up and running.
soo. bunge is the same thing as a proxy?
If you fail to read the Post-Installation section you will be exposed to every hacker in the universe.
ok, i'm going to read
if that is the case, why isn't that the default?
makes sense
Guys, i read something but I've questions.. For instance, if the proxy does an intermediary job how can the final server knows the user ip?
And, if I host something and all the user traffic goes through the proxy server and that server is a low performance server this will cause lag, right?
I don't think bungee allows multiple proxies
wait no i lied it does
i would say one powerful proxy
not necessary to have multiple until you reach the tens of thousands of players
nutil?
all the proxy does it forward packets, it doesn't require a super beefy server anyway
what can it be the security issues? That a user can access directly the server without using the proxy?
well a proxy is more safe
you only have to expose the proxy's port
rather than exposing all the servers' ports
no what I mean is, what are the security issues if I use a proxy
theres none really
oh
mh..
but theres not much you can do anyway, would happen with a regular server
The hosting should take care of it, right?
With multiple proxies I can mitigate that, right?
to a degree yes
but still it's not super necessary
even networks with 10k concurrent players use 1 proxy
they are super robust
so they have a powerful ddos protection
yeah
most dedi hosts like OVH, SYS, hertzinger etc have ddos protection
cloudflare, if you use a domain
Mh, I need to make a school project about that. What should I use? One proxy or many?
I don't really need to take care of it. I just need to design an architecture
many proxies also mean your client is going to have to connect from one of many ports
unless you have a loadbalancer
which is another type of proxy
not minecraft related
I think hypixel make uses of a "loadbalancer", right?
mh, interesting.
This is my final exam of secondary school. I need to make something good
whats the exam exactly
It is of my choice
I'm creating a minecraft server
XD
All my classmates have done websites, but I wanted to do something else
so I'm here
ahahah
fair call
I don't really need to setup a system like the hypixel one. I need only to design it. Do you think that it would more appreciated a system like the hypixel one or a single proxy?
hypixel will 100% have way more than 10 proxies btw
also for using MC through cloudflare, you'd have to pay for spectrum.
spectrum?
premium cf
Mhm. Their services for websites are free, but for other services it's paid
ooh
Unless ur a big server, ovh ddos prot is enough.
I can't remember what Hetzner's ddos prot is like but off the top of my head, it's not great
what do you think about that?
Having more proxies is always gonna be better if you have say more than 500 people. It gives you redundancy, better performance and also means you hopefully designed your system out of the box to be scalable.
And if you can horizontally scale, that's a huge benefit over vertically scaling.
And in this modern day, having the skills to develop horizontally scaled systems is important to so many things.
??
Horizontal scaling = being able to add more systems
Vertical scaling = just making the existing system more powerful
oh
ok
any suggestion to gets started with that. I need to know what a load balancer is and after that what?
E.g google won't just have 1 big really powerful computer. They've designed their systems to use tens of thousands or hundreds of thousands of systems that can all coordinate with each other.
Mhmh
same as hypixel I assume. They'll have their proxies spread over many servers
Your loadbalancer will likely depend on what other softwares you use. I've only done it within kubernetes, so I have no idea about loadbalancers that are good outside of that
Just know when you're doing stuff with multiple proxies, loadbalancers, etc.. you're going to be using a lot of APIs to make everything communicate, so the structure of it can be quite big. If it's too much, just abandon one part of it.
do you mean abandon the project?
Nah just like, abandon a part of the structure. If it's too complex, maybe use a less advanced loadbalancing system that doesn't account for player counts. Or maybe don't bother having the multi-proxy system.
Oh k
stuff like this when doing it for the first time will take a while to find good structures, good loadbalancers, etc..
Hi, I want to ask a question about RAM usage on minecraft server, I have 75 Active player and around 60+ Plugins, and I want to use 12gigs of ram for the server, do you think it will be enough? (my Server is a Survival SMP Server, so there's a chunk load, etc)
I've read something about "Minecraft Custom Startup" with Aikar Flags, do you think it helps for a minecraft server like mine?
Probably
unless you are doing some strange things, correct startup flags always help
Sadly the flags are often used as an example to why java is bad, which note it is not
thanks for all the help โค๏ธ
np. It's a long road ahead
How can I change mob's facing?
example: mob is looking north. i want change it to south
rotate it
setDirection(BlockFace.SOUTH.getDirection()) on the location
Thanks, but setDirection in Entity not exists
on Location
you'll probably have to get the location, set the location's direction, and then set the location
ah ty
Should I use world edit or fawe? I know that fawe make use of async thread but some people told me that in the past fawe has caused world currption.
Or any other plugin
Not anymore
FAWE was pretty good back in 1.12
Not sure how it is now
If you arenโt changing massive amounts of blocks regular worldedit is probably fine
fawe is short for fast async world exception
lol
i'm a citizen of paper
access to their memes is my birthright
supposedly fawe isn't as batshit unstable now as it was at some point, but the only guy i've seen defending it in recent memory is its author, so I'd take it with a grain of salt
Hey spigot! I'm setting mob's facing. here's my code:
entity.getLocation().setDirection(new Vector(?, ?, ?));
Where should yaw or pitch go in '?'.
read the documentation
i'm pretty sure there's a method somewhere that shits out a vector from a given yaw and pitch
ya, i already read the doc. hmm
do you absolutely need pitch and yaw?
lmao what
?
you don't put it in the vector
hmm?
what are you talking about
a vector represents a direction with 3 values
please make coherent sentences
here
distance towards X
distance towards Y
distance towards Z
directly up would be 0,1,0
directly south would be 0,0,-1
or would that be 0,0,1
i don't fucking remember
positive is usually up, right and forward
hmm, how can I set like that? It says it needs a vector.
jesus fuck
you instantiate the vector
new Vector(distance towards X, 0, 0);
with the fucking constructor
yap
if there's no method to actually shit out a corresponding vector for you, you could always rotate an unit vector around the corresponding axes with the pitch and yaw you need
but you probably don't actually need pitch and yaw
i understood ty
im sorry, but why it's 0,0,1?
south's yaw is 0
and pitch is 0
What distance
of the direction
0,0,1 -> 1 block to the south
do you know the coordinate plane?
shut
0,1,1 -> 1 block to the south, 1 block up
ya
sorry, but what do you mean?
yaw, pitch, and what
lmao
ah
coordinates
but it's direction
it's a 3D direction, yes; that is why there are 3 components
1 component for each dimension
X,Y and Z
Vectors are location, direction & force
or your mom
Color?
well
wait i'll draw a picture
that it has 3 numbers is an arbitrary distinction
usually it is an arrow ferom 0, 0, 0 connecting your point
A Java.utils.Vector vector is a list that is synchronized (i. e. thread safe but not really)
the vector list is ancient trash
it's a good way to understand
thinking of a vector as just one thing is very limiting
has anyone brought in the actual definition yet
direction and magnitude and that shit
Yeah, the vector list should be deprecated; I know someone that is overusing it
who is that
so this
is it right?
yes
well it has the word direction in it so
A game developer of some java game noone knows of
imagine that the entity's head is at the center of the world
at X Y Z coordinates of 0 0 0
Ahh
now, imagine that the entity is looking at a block
if this block is at X Y Z 0, 1, 0
I mean you can set the pitch and yaw directly too, if you wanted to
it will be looking directly upwards
only location
because the block is one block above it, directly above it
not vector
if the block is at 0,0,1, the entity will be looking directly south
Ahh
because the block is 1 block to the south from the entity's head
Make a location, set pitch and yaw, tp to location
yaa
hes trying to make an entity look somewhere
if the block is at 0,1,1, the entity will be looking directly south and 45 degrees up
because the block is 1 block to the south and 1 block up
^^^
this would represent a yaw of 0 and pitch of 45, if I remember my numbers correctly
myeah
and .setPitch
ah
you'll have to set it back afterwards
like I said at the very beginning of this conversation
Pretty sure those are void methods
that'd be quite annoying
so that's probably the case
although I do remember Locations being super fucking arbitrary when it comes to returning itself or a clone
They are
in what world would you want a clone
every fucking time I work with them I have to go look at the source to check whether I need to defensive clone or not
some of the methods return a clone
others don't
and it's not fucking documented
I have this so far m.addEnchant(Enchantment.DAMAGE_ALL, 20); what else am i missing from it?
i have defined the meta in previous code
okay, thanks you all ๐ so,
I want to randomly choose yaw from -180 to 180 on hand. Can we do it like this?
entity.getLocation().setYaw(new Random().nextInt(180 + 180) - 180);
Did you set the meta back
no, is there another argument that the code needs?
i think so
no
do item.setMeta(m)
it might blow up because of the unsafe enchantment
Yeah, thatโs what the Boolean does
isn't there like a method somewhere with an extra bool that you need to use for overleveled enchants
ok thanks
I'm looking for the translation plugin for my Minecraft server
cool
?
Ok
not the right channel for looking for plugins
this is the channel for writing plugins
I'm looking for a volunteer plugin writer.
yeah, not the right channel
go on some marketplace or something
this channel is for cool kids only
lol
Is it ok to call PlayerMoveEvent, or should I just make a BukkitRunnable every tick?
you probably mean listen to move event rather than call it
depends
the player can move multiple times a tick
so if you need super high precision, use the event
if the code is lightweight, the listener is fine
It's adding a Location to an ArrayList in a HashMap if the block there isn't air, and if the list doesn't contain the Location.
sounds like a kind of poor implementation for what you're doing, but it's lightweight
well, cpu wise, anyway
why world edit doesn't maintain state of the blocks????
are you on the right version
Poor implementation?
it'll yeet the actual block data if there's a version mismatch
What would be a better implementation?
Oh, ok thanks
something that doesn't involve storing potentially tens of thousands or millions of block locations in contiguous arrays in memory forever
Nah, I don't mean that
it resets on death
it's a thing that encourages players in an ffa pvp game to move around more
a class upgrade called Traveller
mmmmaybe then but there are still some issues
for example, you probably don't want to add more travelled distance if the player is standing still
which would mean making sure the block has changed since
you probably also don't want to accumulate distance if the player moves between the same 2 blocks repeatedly
that is, each block should probably only count once, or maybe once per some timespan
this would be better represented by a Set than a List
@wraith rapids Do you know why when a player join into the server and I send a playerInfo packet and a playerSpawnPacket to him right when he has joined or within 20ticks the skin of the fake player isn't shown?
dunno, i don't do skins
if the skinsrestorer discord has a dev channel you could ask there
thanks for the tip
That's why I'm using a list of locations instead of just an integer map
to check if the player has already been there
yes, well, see, the contains check of a List isn't very fast
if you have 1000 locations in the list, you'll have to go through every last one of them with every .contains check
in comparison, a Set ideally only does one or two comparisons regardless of its size
you speak of a "unique blocks travelled" metric
therefore the data set that you use should emphasize on that "unique" aspect
multiverse-core should really implement tab-completation...
Lists can contain the same element multiple times
the elements of a list aren't necessarily unique
the elements of a Set, however, are unique in that set
an element either is in the set, or it is not in the set
this represents what you are doing much better
Yeah, I was gonna change it to a set
to further minmax things you could create an immutable blocklocation class that caches its hashcode for better hashset performance and smaller memory footprint
but that could be deemed premature optimization
Also, should I be using a HashMap<UUID, Set<Location>> to store it uniquely for each player or is there a better option?
which is apparently a massive fucking sin
nested collections and maps are sort of a code smell, generally it'd be prefered to have a Map<UUID, PlayerData> map, and have the PlayerData class hold onto the Set<Location> and whatever other data you might store for your players
how do i allow unsafe enchantments from item meta
we told you when we last talked about it
read what we said
ok
Hello, spigot! i want make mob to it doesn't get pushed back. livingEntity.setCollidable(false); not working
how to do that?
thanks u ๐
collisions are two-way
for 2 entities to not collide, both of them have to have collisions set to false
Will adding a duplicate to a HashSet throw an exception, or just not add it?
Nvm
@wraith rapids can't find the right version in which the schem was saved... If I use MCEDIT is the state mantained?
Any better way to do this? (checks set size for player attribute modifier, resets on death)
public static final HashMap<UUID, Set<Block>> travelled = new HashMap<>();
@EventHandler
public void blockGet(PlayerMoveEvent e){
UUID pUUID = e.getPlayer().getUniqueId();
try{
Set<Block> locSet = travelled.get(pUUID);
Block block = e.getTo().getBlock();
locSet.add(block);
}catch(NullPointerException addToMap){
travelled.put(pUUID, new HashSet<>());
}
}```
don't catch nullpointerexception
What should I do instead?
make sure you don't cause a nullpointerexception to be thrown
does catching exceptions slow it down?
yes
.
significantly
and it is bad practice to catch instead of check
you should stop it from exploding before it explodes
Map also defines a method that computes a value for the key if it isn't present yet
ItemStack sharpXX = new ItemStack(Material.DIAMOND_SWORD, 1);
ShapelessRecipe sharpXXr = new ShapelessRecipe(sharpXX);
sharpXXr.addIngredient(9, Material.DIAMOND_SWORD);
ItemMeta m = sharpXX.getItemMeta();
m.setDisplayName("Sharpness XX(20) Book");
m.setLore(Arrays.asList(ChatColor.GREEN + "Gives you sharpness 20"));
sharpXX.setItemMeta(m);
sharpXX.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
Bukkit.addRecipe(sharpXXr);``` what am i doing wrong
travelled
.computeIfAbsent(uuid, (k) -> new HashSet<>())
.add(block);
anyone?
sharpXX.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20,true);
or
sharpXX.addEnchantment(Enchantment.DAMAGE_ALL, 20,true);
@thorny bridge
ok thanks
What's wrong with this?
if(!travelled.containsKey(pUUID)){
travelled.put(pUUID, new HashSet<>());
}```
it's extra boilerplate to achieve the same result
that is basically what computeIfAbsent does
depends on your definition of better
to further minmax things you could create an immutable blocklocation class that caches its hashcode for better hashset performance and smaller memory footprint
hello, spigot i'm changing mobs' facing
entity.getLocation().setDirection(BlockFace.NORTH.getDirection()); Doesn't work on entitymagmacube
are you setting the location back onto the entity like we told you to
hey, wildcard permissions need to be coded by the plugin itself, right?
depends on your definition of plugin and wildcard permissions
are you writing a permission plugin?
non-permission plugin
the permission plugin handles wildcard permissions if it supports them
that is, your plugin can check for myplugin.x
i expect the server owner to use something like luckperms etc.
and if a player has myplugin.*
then the permission plugin, if it supports wildcard permissions, will return true for the myplugin.x query
didnt work
if that's what you mean by wildcard permissions, no, you don't need to handle them yourself
they're handled by the perms plugin
but if they're not, they wont work, right?
myes
k, thx
if you want to support people who don't use wildcard compatible perms plugins, define a root permission in your plugin.yml
and set all of the other permissions as children of that node
oh that makes sense
then, giving that root node, like myplugin.all will give the player all of its children, giving them access to all of the things
it's usually also nice if you provide group nodes like myplugin.admin and myplugin.player to group together different permissions that are probably used by different groups of users, like admins and regular users
that way the end user only has to give those nodes instead of going through a list of 3000 permission nodes and adding them individually
did you add the enchantment to the item meta and then added the meta to the item?
i didnt add any meta
this is the code //Sharp XX Sword ItemStack sharpXX = new ItemStack(Material.DIAMOND_SWORD, 1); ShapelessRecipe sharpXXr = new ShapelessRecipe(sharpXX); sharpXXr.addIngredient(9, Material.DIAMOND_SWORD); sharpXX.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20); Bukkit.addRecipe(sharpXXr);
you gotta add the enchantment to the item meta
how should i do that?
ok,
here is what i have now
ItemStack sharpXX = new ItemStack(Material.DIAMOND_SWORD, 1);
ShapelessRecipe sharpXXr = new ShapelessRecipe(sharpXX);
sharpXXr.addIngredient(9, Material.DIAMOND_SWORD);
ItemMeta meta = sharpXX.getItemMeta();
meta.setDisplayName(ChatColor.BLUE + "Sharpness XX");
meta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
sharpXX.setItemMeta(meta);
Bukkit.addRecipe(sharpXXr);
nope
doesnt add the enchant
the crafting recipe works but doesnt craft it with an enchnatment
uh if you give me a sec i think i can find a custom craft i did once
ok
nope none
but the ddisplay name works?
but the craft does
yes
did you try to debug it?
using testNUM on every line
seeing if it stops working for some reason
and sout the result of every action
wdym by testNUM?
what am I even looking at
yea like test1 test2 test3
construct the recipe after setting the meta
the constructor clones the result stack
oh ok i will try that
so changes made to it afterward don't take effect
imagine being unverified
yes
except for nny he's an honorary verified
lmao
we like nny around here
i'm a pretty liked guy
who wouldn't like what i assume is hitler santa
now the code looks like this ItemMeta meta = sharpXX.getItemMeta(); meta.setDisplayName(ChatColor.BLUE + "Sharpness XX"); meta.addEnchant(Enchantment.DAMAGE_ALL, 20, true); sharpXX.setItemMeta(meta); ItemStack sharpXX = new ItemStack(Material.DIAMOND_SWORD, 1); ShapelessRecipe sharpXXr = new ShapelessRecipe(sharpXX); sharpXXr.addIngredient(9, Material.DIAMOND_SWORD); Bukkit.addRecipe(sharpXXr); is this right?
it's right-er
what did i do incorrect
i don't know
ok
see if it works and we'll find out
i will try
nope
it cant even build it
bc it cant find the sharpXX before the recipe
pog
i'm wondering your IDE didn't even showed you errors with that
why did you asked if it's right then? if it shows errors, it's in 99% of cases not right
idk