#help-archived
1 messages Β· Page 198 of 1
So location.getWorld().getNearbyEntities(location, Bukkit.getViewDistance()*16, 256, Bukkit.getViewDistance()*16, entity -> entity instanceof Player); look good?
yep
what is ip
I remember learning Java 7-8 years ago and instance of was always seen to have bad performance from what I read, but from what I've looked at now the JVM nowadays is way more efficient?
please tell me ip
Is entity.getType() == EntityType.PLAYER faster then?
no
instanceof is faster
I was just talking in general
getType will require you to make invokeinterface call which is not so fast, push entity type on the stack, compare it and only then do jump
with instanceof there are much less stuff to do
because if so, the
signState.update(true)call is entirely unnecessary
@subtle blade that didn't fix the problem
plus hey @crimson sandal it's a microoptimizations
it's better to optimize actual stuff :)
well it uses bool matrix which is pretty fast I think
Hmm now I'm casting to Player though after
no problem here?
The tick pct went up from 0.3% to 3-5%
jit is smart enough to optimize it later
when it well collect enough data
wait
how are you locating nearby entities?
the location is?
btw how does isLocationChunkLoaded work
yeah ok that's fine
the only thing I could think of is that how get nearby entities work
it performs a lot of allocations actually
So maybe getting the player location and checking if the sign location is within 16*viewDist for X and Z?
Wait yeah, that'd avoid casts and instance of too
aren't there an event like
Get all online players, check if sign x and z is < 16*viewDist relative to player location
What do you mean by chunk send?
well by the idea it would be called when chunk packet is sent to the client
I'll send In DM Picture
I don't know any good solutions beside that
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
i had to fork paper to remove tons of allocations in these methods
does anyone know why I get this mistake?
23:19:28 [SEVERE] Exception in thread "main"
23:19:28 [SEVERE] java.lang.RuntimeException: Invalid configuration encountered - this is a configuration error and NOT a bug! Please attempt to fix the error or see https://www.spigotmc.org/ for help.
23:19:28 [SEVERE] at net.md_5.bungee.conf.YamlConfig.load(YamlConfig.java:73)
23:19:28 [SEVERE] at net.md_5.bungee.conf.Configuration.load(Configuration.java:71)
23:19:28 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:272)
23:19:28 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
23:19:28 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
23:19:28 [SEVERE] Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
etc etc
the error pretty much explains itself
23:19:28 [SEVERE] at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218)
23:19:28 [SEVERE] at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176)
23:19:28 [SEVERE] at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:136)
23:19:28 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.scanFlowScalarSpaces(ScannerImpl.java:1921)
23:19:28 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.scanFlowScalar(ScannerImpl.java:1843)
23:19:28 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.fetchFlowScalar(ScannerImpl.java:1027)
23:19:28 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.fetchSingle(ScannerImpl.java:1002)
23:19:28 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:390)
23:19:28 [SEVERE] at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227)
23:19:28 [SEVERE] at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:586)
the error pretty much explains itself
@spring arch hmmm what ?
Oops, can someone help me download the PermissionEx Plugin, Metrics Plugin and an Economy for me to use the VipZero Plugin
Because I do not know how to download when I search spigot does not appear anything can someone help me ?
pls
What's the metrics plugin?
real men use pex
real men have always used pex and will always continue to use pex
you mean GM
(1) Is PermissionsEx still functional on modern versions? Thought it wasn't maintained
(2) PermissionsEx is not on Spigot, only BukkitDev, so you'd be able to download it from there and use it on a Spigot server
Economy plugins are entirely up to you. Do some research on which ones you want. They all serve the same purpose but do so slightly differently
You guys are bugging me what should I download to use the VipZero Plugin ?
We don't know what that is
As I go on the page Spigot Plugins do not know to go search and nothing appears, Was not Found
People apologize for the translation because I'm Brazilian and I'm using Google Translate
i understood i'll research more about
If someone can send me the Link plugins just for me to search ?
there's a lot going on in that
yes
The guy watched 6 hours of a Java video
and didn't understand instances
oh yeah forgot to mention
It's 1.8.8 too
any other bombs you want to drop on me?
uh... yeah
He doesn't know how to make and use getters, https://i.imgur.com/tFRjg4b.png
Yo knockoff manhunt is underway
He's not in this guild
what
what
ye I thought I was insane or something
Aren't we all
I'm gonna record this on obs & the vid is going up tomorrow prob
empty onEnable()/onDisable() calls always make me sad
or unnecessary calls to their supers
whot
it should've
it loads fine, yeah
Just sends in that long text around 500 times or so
What will happen if I call onEnable() π€
so that is the last 3 lines of a stack overflow
ah there we go. https://i.imgur.com/iDFtEtW.png
Wait we just figured out this issue is chunk dependant and occurs when 128 signs are within a chunk
Is there a limit on block updates in a chunk? π€
128 is too significant for that not to be a coincidence
Wow I can reproduce it on my dev server
I'm mindblown
128 signs in one chunk and it glitches out
Delete one sign and it's perfectly fine
Spigot bug?
Drops my FPS from 120 to 10 fps too π
I'm going to try and isolate it in a test plugin
I'll do some tests
What's that?
In PlayerChunkMap yeh?
there's nothing with flagDirty() in that class for me?
O.o
Aaah will give up trying to make a Server that fucks also do not think the PermissionsEx and neither Metrics is will give up
Bye
Could anyone help me? IntelliJ is not allowing me to import the class I want from maven, I have the dependencies, and used to have the same thing, but its importing from the wrong maven then sending loads of errors
Wait we just figured out this issue is chunk dependant and occurs when 128 signs are within a chunk
sounds like an overflow issue
though i'd put the blame on vanilla for that. i mean, realistically, 128 signs are not going to be updating in a chunk in a vanilla game
Calaboca mano se estΓ‘ me tirando cara Lixo
Can't believe I've just told a user they can only have 127 signs in a chunk lmaooo
what are they doing with that many signs?
Well my plugin links chests together, and you can filter hoppers with item frames etc. So he managed to have a whole sorting system in one chunk
oh
Is there any way to undo a book ban without deleting the entire player.dat file
And my plugin uses Signs on the front of the chest to designate what player and group it belongs too visually
Does settotalexperiencelevel() not work?
and he managed to have 128 chests in a single chunk? jesus christ
talk about compact
I mean vanilla handles a huge amount of hoppers relatively well right?
32 hoppers π€·ββοΈ
I ended up having to simulate hopper behaviour too, so it just listens to the hopper move event and then I move to the custom bukkit invs etc
I'm going to see if I can isolate the issue in a test plugin though
Ignore how messy it looks https://paste.md-5.net/yuwetotezo.cs
view distance method https://paste.md-5.net/kebipogeti.java
rip a small bit of speed cause of stream
I mean that method is like 5x faster than the previous one
And
I thought it would be worth filtering out by world first? I didn't really continue optimising I just wanted to see if it worked
o
would make a utility method for LocationInfo. isInWorld(World)
just to clean up locationInfo.getSignLocation().getWorld() != null && locationInfo.getSignLocation().getWorld().equals(player.getWorld())
though that is a lot of streams
while your at that, make this return AIR instead of Null getCurrentItem() already returns air e_e
Yeah I'll clean it up with those thanks π
I'd definitely opt to avoid the stream in the online player's forEach()
The more players online, the more streams you're making for seemingly 0 benefit
are streams that much worse than just a for loop?
They're pretty heavy objects, yeah
Damn, I always thought it was the opposite and they were more optimised
oh nevermind it does return Air ._.
private void updateSigns() {
if (displayItem == null) {
locationInfoList.forEach(locationInfo -> {
if (Utils.isLocationChunkLoaded(locationInfo.getSignLocation())) {
locationInfo.getSignLocation().getBlock().getState().update();
}
});
}
else {
Bukkit.getOnlinePlayers().forEach(player -> {
List<LocationInfo> locationInfos = locationInfoList.getLocations(player.getWorld()); // Create a utility method for this
locationInfos.forEach(locationInfo -> {
if (Utils.isLocationInViewDistance(player, locationInfo.getSignLocation())) {
player.sendBlockChange(locationInfo.getSignLocation, air);
}
});
});
}
}```
That's probably how I'd handle it
You could also opt for for-each loops instead of forEach() calls, but either works
forEach is a simplified for loop? π€
Yes
oh I should turn my hideous Stream methods to that then
Hideous indeed, https://i.imgur.com/SH23Obx.png
If that's not in a code hot spot it's probably fine
oh it's used everytime the item editor command is made
and probably when someone picks up/get a new item
Java 8 streams are my favourite things too π
There's nothing wrong with them, though in this case you're potentially creating a lot of them when all you're really using them for is a call to filter
So a for-each and condition is going to be a bit better
Fair enough, I get you
Not only are you ditching the Stream object, you're also not iterating across the list twice over
filter() iterates across all objects, then you forEach() it
Oh yeah, that makes sense π
rip .collect()
In some situations they're nice (especially in code that doesn't often get called) but if it's done often or in higher frequency, it can get pricey
Have to kind of think about where and how you use streams. Order of operations is super important there
How are we/am I suppose to know, it ain't math https://cdn.discordapp.com/emojis/406609477165514762.png?v=1
how can i let my nms mob do a Hit animation?
how do i send a packet? π¦
never used packets
Okay so sending a block change of 256 bedrock every tick is absolutely fine
Well, yeah. Bedrock isn't a tile entity and doesn't have any NBT associated with it
try it with chests >:)
Hey guys
I just started making a plugin and I have no idea how to apply potion effects to mobs. I tried many different things and none of them seem to work. Can someone help me with this
ok give me a sec
@EventHandler
public void creatureSpawn(CreatureSpawnEvent event) {
if (event.getEntityType() == EntityType.ZOMBIE) {
Zombie zombie = (Zombie) event.getEntity();
zombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 2));
}
I have a hashmap of players whats the best way of shuffling that list and splitting it into 2 teams so it's not the same every time?
ok thank you I'll try it out right now!
Okay but in my plugin the signs are already there and I'm just sending an air sendBlockChange
ILikeToCode I tried out the Integer.MAX_VALUE but it did not work
could there be something i need to add to the yml?
public Map<UUID, PlayerManager> players = new HashMap<>(); thats what I have and I was going to shuffle it then do players.size()/2; add the first half to one team the other have to another. The teams would be in a new list so I wouldn't have to ever clear that hashmap that stores their current kit, points earned, etc. So since I'm not clearing that hashmap (unless the player logs off) I need to shuffle it so that when I do player.size()/2; it's not the same teams every time.
umm I don't know java very well how would you do that exactly lol
How do I make spigot run off multiple cores
Ohhh ok thank you
A hashmap is not an ordered collection, there is no meaninglful operation for sorting or shuffling it
You could take the entry set, put it in a list, and shuffle that list, though
isn't the maximum value of a potion effect a short?
or is that just the amplifier?
oh, wait, no. shorts are the maximum it will display on the client
I looked into that and I ended up finding this List keys = new ArrayList(map.keySet()); and Collections.shuffle(keys); however then the keys are Objects and I don't know how to get them back to a UUID object to restore @pastel nacelle .
Do I just print the System.out.println("Example!"); under my code? It does not display an output message
does anyone know a plugin similar to CMI
essentials
thank you
use generics @unkempt ridge
List<Map.Entry<UUID, Something>> list = new ArrayList<>(your shit here)
NNYaKNpGms0eUVpiSdHx dude do you know how to apply potion effects to mobs?
it does not have any errors but the zombies do not move any faster
Thanks for putting so much effort in helping me dude
Yeah I imported all of them
No red at all
that's not what he asked
did you register your event handlers on plugin load
if you don't register them, they won't be fired
Bukkit.getPluginManager().registerEvents
ok thank you guys so much
@pastel nacelle If I used what I said above, would UUID playerUUID = (UUID) object; work in the for loop? Since the list is the keySet()?
use List<UUID> then, and yes
so like this? List<UUID> keys = new ArrayList<>(players.keySet());
not sure wtf you mean by (UUID) object though
where are you grabbing this random object from
google "essentialsx"
oh wait okay when I switched it to List<UUID> it allowed me to for each using UUID. Before it was only allowing me to use Object thats why I was confused
yes. because your list was a raw type
List contains and returns Objects
List<T> contains and returns things that are T
got it, thanks guys! and just wondering is what I'm doing the most efficient way to create/randomize teams or is there a better way?
it's fine
probably not a very hot piece of code to begin with, so it doesn't really matter
Is there any way to make the Minecraft server run multi threaded
it already does
most of the resource expensive shit contributing to tps just happens on 1 thread
for better multi core performance, use something like paper
It's just a small minigame that'll run on one server so I didn't think it was a big deal. What is the most efficient way to create a randomized team of players
Hmm
Using the worldEdit api how would I select and area then fill that area with a pattern? example, 50% stone, 10% diamond, 20% gold and 20% iron?
you may have better luck getting an answer in the enginehub discord
ok thanks
Hey bychance if anyone would be kind enough to help me out π I am looking to make my hub in my main survival world ; TLDR No separate world, just a region, but gives access to both survival areas + minigames portals
Noooo
I dont know how to go about making a region in my survival world no-damage / no mobs etc
but once u leave an area its just the main survival game
but id also put portals in for minigame worlds
Ok - would u know about leveling per minigame too? I'd like to let players earn levels / ranks and win cosmetic rewards
Eg. If they earned level 10 in build battles, they would win a name title
How do you stop villagers from being nice to players from being cured?
Turn them back into a Zombie Villager π
It seems you'll have to use nms for that
well I mean that is pretty normal. If someone saved you wouldn't you give them discounts for your wares too?
lol
then don't allow there to be zombie villagers π
Yeah that's my workaround basically
no curing z. villagers
Anyways, another huge bug now
I don't have any plugins that modify end teleportation
But my players are experiencing a horrible glitch where their client bugs out when trying to leave the end
Is this a known spigot bug
I am not aware of any glitches in regards to that. Most people I see here who experience the most glitches is when they want to support old clients or all clients for who knows why
I know there was a bug with enderpearls etc going through portals in earlier 1.16 builds
strange
Another question, is it possible to prepare chunks on an async thread
what do you mean prepare?
As in load
Only on paper
PaperLib, no?
Its still loaded sync. Its just a compatability layer.
Where can I find a plugin that modify piglin bartering? Or is there a such thing?
https://stackoverflow.com/questions/63084426/nosuchmethoderror-when-initializing-mongoclient
I have a very specific problem, if anyone could take a look at my thread that would be great! I would type it out here but its too much for a discord message and people dont always read it all on discord lol
Do you minimize your jar?
idk what that is lol
maven shade plugin
nope
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<include>dev.morphia</include>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>```
earlier today I had an issue with it giving me the wrong MongoClient and not letting me import the one I used to use, Ive fixed that now, but when I look in the jar that it builds, it still has the wrong MongoClient
still an error
with the scop
scope
What do you mean by wrong MongoClient? There should only be one
theres one in the legacy driver
amongst others
but it used to not show me the java driver when importing MongoClient
now it does, but it still builds with the old driver
Did you try mvn clean?
[WARNING] Some problems were encountered while building the effective model for vulcanprisons.iron:VulcanCore:jar:3.0-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for com.github.SSNevera:helper:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 145, column 22
[WARNING] 'dependencies.dependency.scope' for org.mongodb:mongo-java-driver:jar must be one of [provided, compile, runtime, test, system] but is 'shade'. @ line 134, column 20
[WARNING] 'dependencies.dependency.scope' for dev.morphia.morphia:core:jar must be one of [provided, compile, runtime, test, system] but is 'shade'. @ line 140, column 20
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
... no idea. But update your maven shade plugin version
shade isnt a valid scope lol
Yes but i dont understand why. Where should the MongoDB classes come from? Ive always shaded the mongo java driver when using it...
@buoyant path Could you show your whole pom?
i gots a question
t
anyone know how to remove the [traveler] -> you?
Its from citizens 2
https://discordapp.com/channels/690411863766466590/690470011382267904/736269099101061122
Someone help me with this small issue please
anyone know how to remove the [traveler] -> you?
@tame bough Try asking in their discord
Are you using maven?
yes
<properties>
<java.version>14</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
replace 14 with 1.8
in your pom
okay wait let me try
Wait. Do you use the mcdev plugin?
If not just add a configuration for your maven compiler plugin
Or even simpler:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<properties>
<java.version>14</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@grim halo Uhmm I don't have this thing in my pom
Yeah then just add this in your pom:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Thats just a warning. UTF-8 is fine
oh okay
You can manually set it in your pom to UTF-8 if you want so you dont get the warning
just add <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
to your properties in the pom
Thats the encoding of your pom not your project
oh okay lol
weird that warning hasn't been updated
must have been an over sight on Oracles part when they changed it to UTF-8 by default lol
used to be that the compiler would use the OS's encoding instead
hence it stating it is platform dependent π
Doesnt java just use utf-16 by now?
I think since java 9 default is utf-16...
it is still UTF-8
I use java 14 and I sometimes get the warning about encoding not set and it defaults to utf-8
anyways, it isn't a big deal that it defaults to utf-8 anyways
it used to be a big deal when it did default to the OS encoding though which was a long time ago π
From docs.oracle. Internal encoding is utf-16
doesn't say that the compiler uses UTF-16 by default
Its not the default encoding you get on Runtime. Just the internal text representation.
but that the implementation backing Char and other things is backed by a 16bit integer
not sure what you mean internal text representation. Anyways, the default for the compiler is to use UTF-8
Would anyone happen to know what block works for sending the barrel open animation (Texture change)? PacketPlayOutBlockAction(position, Blocks.BARREL, 1, openClose) does not work, nor does Block.Chest.
if it isn't explicitly stated otherwise of course
the main difference between utf-8 and utf-16 is that utf-8 uses 1 bit for encoding where as utf-16 uses 2 bits for encoding minimum.
By internal i mean the actual in memory representation of Strings is alway utf-16
SirNutty u can just use player.sendBlockChange for that i think
If not otherwise specified that is
there is no in memory representation, rather how many bits it takes to hold a certain character
yes 2 bytes for a char
UTF-16 uses 2 bits per character minimum even if it takes 1 bit to describe it. Char has a 16bit integer that backs it so that you can use UTF-16
but it doesn't mean you can't use something smaller
Im getting this issue from MVdWPlaceholderAPI. Anyone able to help me?
Cannot resolve org.spigotmc:spigot:1.9
not sure what what you mean getting this issue
provide more context in what you are trying to do
did you specify the spigotmc repo?
He is probably missing the spigot dependency when compiling...
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>```
or the dependency you want is even there
<groupId>be.maximvdw</groupId>
<artifactId>MVdWPlaceholderAPI</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>```
do you have the api artifact or the actual server?
Because it looks like you need the whole server artifact
should have the api if they ran buildtools well technically both
but it is complaining about not having the server jar
not the api jar
so use buildtools to get the 1.9 server jar
yeah. So Lag try running the Buildtools with --rev 1.9.something
Okay
if it was the api, it would say spigot-api the server artifact is just simply called spigot
in either case though @grim halo its not going to really matter in which is used. That is whether UTF-8 is used or UTF-16 both will use 1 byte minimum regardless.
only one where this isn't the case is UTF-32
which will use 2 bytes minimum regardless
so even though UTF-8 will use 1 bit, in memory it will still use 1 byte
Okay I have the spigot 1.9 what do i do?
encoding for files is a bit different and UTF-8 and UTF-16 does matter in this instance if file size is a concern π
@prisma sinew Reimport maven
but I mean, in most cases it really isn't going to make that much of a difference file size wise unless you already have a large file to begin with XD
so like encoding maybe the minecraft server jar as UTF-16 might increase it to double its size vs utf-8 which is what is used now.
So just use which ever you prefer or need π
Does anybody have the translations from old color codes (&6, &3 etc) to hex values? Can't find anything definitive on google...
interesting that MC uses a lighter shade of red
even though they call it dark red XD
so like encoding maybe the minecraft server jar as UTF-16 might increase it to double its size vs utf-8 which is what is used now.
@keen compass Where do you get this from?
Well depends specifically how the encoding is done. If the encoding is throughout the file, which it can be then it will increase the file size since every character now has 2 bits minimum to describe it vs just 1
Sure makes sense. I just dont know where the information that minecraft uses 8 bit char based class files (which would be ISO 88... something) instead of the default 16 bit ones.
What are the rules for bumping a post?
I think you have to wait for at least 24 hours without a response
Ok thanks
What post?
Can someone build for me 1.9 spigot?
@grim halo the information you posted earlier had nothing to do with encoding other then that the char primitive is backed by 16bit integer due to UTF-16 not that what you create is automatically encoded for UTF-16
Having issues with buildtools
I put out this post https://www.spigotmc.org/threads/worldedit-api-select-area-then-fill-it-with-a-pattern.453810/
Then just remembered I got an answer in the enginehub discord that I still need to try lol
Auto correct keeps making words capitalized lol
Yeah Thats what I thought
Apparently my jdk is having issues changing back to java 8
Also enginehub not enchanting
literally took me 10 seconds
@grim halo I googled the completely wrong things and ended up on forums and shit. I knew it existed but could not for the life of me find the table. Thank you! β€οΈ
lmao
google is your friend up until you don't know what you are googling for
@grim halo really file encoding these days isn't really an issue unless you are using characters where you absolutely need a specific encoding minimum to represent it properly lol
For instance, all my project files are encoded use windows encoding, however at compile time they are changed to utf-8
but, even if it didn't do that, I don't make use of characters that would require UTF-16 to display properly or UTF-8 lol
But, its nice to know that char primitive is automatically 16bits
even if what you are using character wise doesn't require that
Can you send it to me?
is it saying you need java 8 to build 1.9?
I was speaking of the minecraft jar encoding. But nvm. At compile time they are either utf 16 or some ISO 8 bit if you use compressed strings.
Since Java 9 class files have a custom compression so you dont need to compress them (which is more of a java 6 thing anyways)
So i was just wondering what you meant by minecraft uses utf-8
Yes @keen compass
@grim halo At compile time it is UTF-8 unless specified otherwise, that is the compilers default =/
that isn't the same as when the application is running how large of a register is used to back strings or characters
at runtime, if it isn't specified, it is UTF-16 regardless.
That is if I create a char object
it will be backed by a 16bit integer
strings are backed by a 32bit integer if I recall
but file encoding is different because it tells the OS how to load the file and how much resources it needs to do so or the JVM. It is similar to how endianess works. A bit different but same concept
endianess just tells the OS in which order the bytes need to be read or written
encoding tells the OS how many bits it needs to read for every character
fortunately, if you use UTF-16 to encode at compile time, if you told the runtime JVM to use UTF-8 instead, odds are it will still read it properly as long as you didn't specifically use characters in the UTF-16 range
because the code points for certain characters are in both UTF-8 and UTF-16. Which means representing them is the same regardless which encoding was chosen π
Ok thats all trivial. Im talking about the actual .class files. You stated that "using utf-16 vs utf-8" would "double the jar size".
And i do not understand what you mean by that
Because it would save the encoding in the file
there is 2 ways to do it
either it is a header info stating how the characters must be read
at the top of the file, and therefore it won't increase its size, or it encodes the entire file, which means extra info being saved
whether it needs it or not
so for instance the A character. in UTF-8 it only needs 1 bit, but if you use UTF-16 instead, it still only requires 1 bit, but it will save an extra bit along side it since UTF-16 uses 2bits minimum. So instead of it just being like 01 for example for A, it would be 0001 instead
those extra 0's add to the size
I am not entirely certain how the compiler does it. If its just a header info or if it really does encode the entire file
haven't really done a test on that lol
Guys im making a rpg leveling plugin, but I got no clue how should I show how much total xp u got
So you are saying that you can determine the .class file encoding with the compiler? Let me think about if this even makes sense since the jvm is the only one that actually has to read them...
@blissful verge In the Action bar for example
No cause im already showing how much you get like from doing actions there
I mean for String (chars) constants it would make sense but the whole .class file encoding?
no I am saying the compiler makes no assumptions at all, and defaults to UTF-8 if it isn't explicitly stated in which encoding to use. However, what I haven't tested is how the compiler goes about encoding class files. That is, does it truly encode the entire file or does it just use a header info on the class file instead. If it uses the former, then using UTF-16 would double the size of a jar.
or increase it to some extent
if its just a header info at the top of the class file, then it won't increase the file size at all
or it could do both
Yes but .class files are not written per char but per byte. Only Strings are actually readable because they use the defined encoding. So only the chars/String should get bigger/smaller when using different encodings.
And java defaults to utf-16 for representation if you dont explicitly compress the strings (in java 9+ this get obsolete)
there is still other things that get encoded beyond just strings
methods, fields and local variables for instance
Ah right. Still i dont think it should be double the size. But i get your generall idea
ok so I did a bit more research
so string literals are always saved as UTF-8, and Strings are always UTF-16. However neither matters, because when it comes to printing something it will default to system encoding, and specifying encoding at runtime the JVM will ignore it depending on the JVM you are using and therefore can't change the encoding at runtime unless you change the encoding of the platform before running the application.
So it doesn't matter what you specify for the compiler or at runtime it is ignored either way XD
actually not completely ignored by the compiler
So specifying the encoding allows the compiler to read source files properly
that is about the only place where encoding matters as far as Java is concerned XD
@grim halo
didn't know the default JVM ignored user specified encoding
Oh very interesting
25.07 08:26:13 [Server] Server thread/ERROR Cannot load plugins/DeepCrates/crates.yml
25.07 08:26:13 [Server] INFO org.bukkit.configuration.InvalidConfigurationException: while scanning an anchor
25.07 08:26:13 [Server] INFO in 'string', line 8, column 5:
25.07 08:26:13 [Server] INFO - &7FΓ₯ en Vote nyckel
25.07 08:26:13 [Server] INFO ^
25.07 08:26:13 [Server] INFO expected alphabetic or numeric character, but found Γ₯(229)
25.07 08:26:13 [Server] INFO in 'string', line 8, column 8:
25.07 08:26:13 [Server] INFO - &7FΓ₯ en Vote nyckel
25.07 08:26:13 [Server] INFO ^```
How do i support these chars in YamlConfiguration?
How do you download Minecraft Java on android
on google play
25.07 08:26:13 [Server] Server thread/ERROR Cannot load plugins/DeepCrates/crates.yml
25.07 08:26:13 [Server] INFO org.bukkit.configuration.InvalidConfigurationException: while scanning an anchor
25.07 08:26:13 [Server] INFO in 'string', line 8, column 5:
25.07 08:26:13 [Server] INFO - &7FΓ₯ en Vote nyckel
25.07 08:26:13 [Server] INFO ^
25.07 08:26:13 [Server] INFO expected alphabetic or numeric character, but found Γ₯(229)
25.07 08:26:13 [Server] INFO in 'string', line 8, column 8:
25.07 08:26:13 [Server] INFO - &7FΓ₯ en Vote nyckel
25.07 08:26:13 [Server] INFO ^```
How do i support these chars in YamlConfiguration?
put '' or ""
list:
- "&cyah"
Thx
whats the event for talking
AsyncPlayerChatEvent
how do i convet minecraft time to AM time
@frigid ember remember a few days ago my issue with a string containing | or even # adding a new line to the yaml?
Well made a fix for it and it works lol
if(line.split("").length > 1 || !line.startsWith(" ")) {
loreData = loreData+line;
}
```If the "line" contains more then 1 character or if it doesn't start with a space it will add the line to the data.
line.split("").length look pretty obsolete as you can just get the size of a String
Why do you split the line? You could simply use the String#length method.
halp Caused by: java.lang.IllegalStateException: Asynchronous getNearbyEntities!
Lol
how do i run a getnearbyentities
Don't do it async then.
but then i cant get the chat
schedule a sync task
Yes the BukkitScheduler is thread safe so you can just use runTask()
line.split("").length look pretty obsolete as you can just get the size of a String
Why do you split the line? You could simply use the String#length method.
Modified.
public void onSpeak(AsyncPlayerChatEvent event){
if(event.getMessage().contains(("alexa"))){
new BukkitRunnable(){
@Override
public void run(){
Player me = event.getPlayer();
Location loc = me.getLocation();
for(Entity ent: me.getNearbyEntities(5, 5, 5)){
if(ent.getCustomName().contains("alexa")){
if(ent.getLocation().getBlock().getType()==Material.LANTERN){
ent.getLocation().getBlock().setType(Material.SOUL_LANTERN);
if(event.getMessage().contains("what")){
if(event.getMessage().contains("time")){
long time = loc.getWorld().getTime();
Bukkit.getServer().broadcastMessage("[Alexa] the time is"+time);
}
}
}
}
}}}.runTask(this);
}
}
}``` why isnt this working?
Trying to work with json again. (I remember why I stopped using it) Why does it not put objects in the order they are set in?
JsonObject =
put(OBJ1)
put(OBJ2)
put(OBJ3)
output(JsonObject)
````{"OBJ2","OBJ1","OBJ3"}`
I say this at least 3 times per week. Guys. Use early escapes so your code gets readable.
For example: If you want to rule out console as comandsender you write
if(!(sender instanceof Player)) {
return; <- this is the early escape
}
because json object is a hashmap
Its more of a dictionary than a hashmap but technically right
anti arrow pattern
isnt dictionary a python hash map
i'm speaking about an implementation, yes.
because json object is a hashmap
Outputting the hashmap keys are in order.
oh wait no
Its >95% similar yes.
public void onSpeak(AsyncPlayerChatEvent event){ if(event.getMessage().contains(("alexa"))){ new BukkitRunnable(){ @Override public void run(){ Player me = event.getPlayer(); Location loc = me.getLocation(); for(Entity ent: me.getNearbyEntities(5, 5, 5)){ if(ent.getCustomName().contains("alexa")){ if(ent.getLocation().getBlock().getType()==Material.LANTERN){ ent.getLocation().getBlock().setType(Material.SOUL_LANTERN); if(event.getMessage().contains("what")){ if(event.getMessage().contains("time")){ long time = loc.getWorld().getTime(); Bukkit.getServer().broadcastMessage("[Alexa] the time is"+time); } } } } }}}.runTask(this); } } }``` why isnt this working?
@hollow thorn
@hollow thorn Rewrite your code to use early escapes and i will be glad to help you.
I wont read that through
wait can non players use chat
that looks so unnecessary
why are you running it in a task
why are you checking like
because it is in async
im making alexa in minecraft
AsyncPlayerChatEvent
because its chat
literally nothing of it should be async
ah
gotcha
you should be running all the string content checks all at once
you need JsonArray
Was just making the point about objects being in a different order that code is no where near useable.
rather than check one word, run some code, check another word, run more code
@pastel arrow Why o you need ordering?
you should be running all the string content checks all at once
@torn robin because im making it a sort of selctor thing with different branches
Why o you need ordering?
Need and want are different. I can't stand if the order is different from what I made it as.
well you surely aren't planning on having all the logic in one class/function
@torn robin yes because im lazy
@hollow thorn Not sure why you'd checking if there's a lantern at the players location either.
@frigid ember ment to be an alexa thingy
@hollow thorn Early escape just means that you dont nest those if statements.
Just check one and return
because although all alexas are lanterns not all lanterns are alexas
Ill rewrite the code yous sent as an example
yeah ive made the code work
@hollow thorn Thats what i mean by readable:
@EventHandler
public void onSpeak(final AsyncPlayerChatEvent event) {
if (!event.getMessage().contains(("alexa"))) {
return;
}
final Player me = event.getPlayer();
if (!this.isAlexaNearby(me)) {
return;
}
new BukkitRunnable() {
@Override
public void run() {
// Do Alexa stuff
}
}.runTask(this);
}
private boolean isAlexaNearby(final Player player) {
for (final Entity ent : player.getNearbyEntities(5, 5, 5)) {
if (ent.getLocation().getBlock().getType() != Material.LANTERN) {
continue;
}
return ent.getCustomName().contains("alexa");
}
}
You should also split your code functionality in method so its more clear what you actually want to do.
wtf
I used the new BukkitRunnable() stuff because lambdas would confuse him
pretty sure that last return in isAlexaNearby is wrong
ah right the first check should not return false but continue
and also only return in case the name is right
private boolean isAlexaNearby(final Player player) {
for (final Entity ent : player.getNearbyEntities(5, 5, 5)) {
if (ent.getLocation().getBlock().getType() != Material.LANTERN) {
continue;
}
if (ent.getCustomName().contains("alexa")) return true;
}
return false;
}
im assuming these are armorstands?
right right. Didnt read this through. Needed too many brain cells for detangling his code
can i got help withthat watchdog thread repport?
i cant manage to realy know whats the issus exept mysql waithing to save and the server thread himself
usualy my thread dump is more accurate but this one is... realy shaddy
mmm ok
i know why
so now ill need to complain to worldborder dev for a unloading fonctionality fix XD
surprise by the fact is the chunk not saving
i mean i did optimisation like usual but never this issus about chunk not saving
any suggestion?
Is it possible to detect when a player presses a key
not really
Wdym
So since when did kotlin introduce Sets allowing duplicates?
[11:58:05] [Server thread/INFO]: __Desire, __Desire this is a set i logged.kotlin val set: MutableSet<Player> = mutableSetOf() @EventHandler fun PlayerJoinEvent.onJoin() { println(set.stream().map(Player::getName).collect(Collectors.joining(", "))) }
those are different player instances π
that's java.
no its not
Also, map returns a list.
he isusing the stream function
Stream is a java thing
Kotlin has sequence
ah
This looks like a mix from kotlin adn java
#stream() isnt necessarily a java thing, u can use stream in kotlin too. However that is not my point, why can a mutable set contain duplicates?
you can write plugins in kotlin?
yes
oh mad
Yes it's a jvm language.
i know its jvm but i didn't know it could work like that
It should not allow duplicate, but a player object is never the same and you are strongly referencing it.
So you probably rejoined twice.
Understand?
4eh why would you use the java streams when kotlin has api that works properly without it.
Kotlin api also has less overhead most of the time.
Because this was a general test to see as to why im in the set twice. And you've answered my question, so its the Player object.
And also im used to java a lot and that fact kotlin offers up the java methods with the kotlins i just go to whats habit
Kotlin methods usually has less overhead than the stream variant, if you do want the lazy type eval use asSequence
Does anyone know a good plugin to add luckperms prefixes and suffixes to the tab menu?
ok thanks i will try it out
for my part i use bungeetablist plus
and for spigot only i could usggest titlemanager
but idk if they both updated with hex color from 1.16
Kotlin is nice
Yes
Will probably replace java
No.
Yes.
For sure not...
Why not?
Cause java is java and kotlin is kotlin
Thatβs not an argument
It is.
how can you say something so brave yet controversial
Doesnβt make any sense
Will Kotlin replace Java? Is Java dead? No, Java is here to stay since itβs the main open source language for developing enterprise applications across all major industries; has a huge userbase and codebase. Kotlin compiles to byte code which runs on the JVM; it depends on the Java Class Library. Their interoperability implies Java is not going to be replaced. Furthermore, the announcement at Google I/O indicated that Kotlin is being added to the Android ecosystem, and not replacing Java.
@sick mica https://www.spigotmc.org/resources/tab-1-5-x-1-16-1-rgb-support.57806/
@frigid ember this plugin worked without me even needing to set anything up tysm
For example kotlin has no checked exceptions. Or widening of implicit conversions. Or non-private fields...
It also has no NPEs
And no static members...
Well itβs more null safe
companion object is technically static
Donβt really need static
It's a singleton viper.
how about primitives?
Kotlin box and unbox' them as it sees fit.
A lot of performance in hot code handling big data is lost due to autoboxing or the object primitive overhead
Jantuck thatβs true. But maybe replace was the wrong word albeit I do think that the majority of java devs will now or later switch over to kotlin because of its features as a language.
Kotlin is getting better, but it still depends on java.
Thats why goldman sachs wrote their collections
And java is still getting better
Or FastUtils
Implementing a lot of syntax sugar to make you feel better.
Scala > Kotlin π€£
Kotlin has its place but it will not replace java
i second that
For some it will π
I mean its nice if you want to write code with less biolerplate code.
Hmm yeah. Though I bet it will grow bigger than java...
Lol and?
Kotlin is a baby
the all time best game uses java
Wherever java runs, kotlin can run as well.
And as a matter of fact the kotlin lib isnβt that big compared to javas
So itβs not a huge deal to shade in the kotlin lib.
Kotlin reduces java boilerplate and has other useful features like first class functions for instance.
Iβd say koltin in itβs current state does java better than java.
But yes still dependent on java if itβs running in the jvm
Kotlin is the little script kiddy brother of java. No way its going to replace it for at least 5 years.
You cant make predictions about programing languages beyond 5 years.
Thatβs true
Itβs kind of increasing so Idk Β―_(γ)_/Β―
And as I mentioned before it does java better than java
What do you mean by that. Thats so vague.
Well, boilerplate isnβt everything but kotlin does for a fact reduce Javas boilerplate as of one reason.
Not saying thatβs necessary good but most likely yes
Well itβs mainly made for making it easier for the developers who uses it
Not an argument. Reducing boilerplate is not always wanted.
Thats why C is the most used language in the world right now.
Youβd most likely get less lines with kotlin code compared to java code that has the same functionality
Reducing boilerplate comes with drawbacks. Less performance and less control.
Itβs more null safe
And it has first functions as well. Not saying that is always wanted although it can be very nice for the developer.
null safety again. Is neat if you want it. Otherwise it just reduces control over it.
Yeah true
The only time i have seen Kotlin in the industry is when i developed android apps.
Everything from back end to data management is done in java.
Yeah, I feel like not all have explored kotlin yet.
Itβs not as bad as everyone first thinks
Or I mean some people atleast
Its not bad at all. It just is not java. They have different audiences (not totally)
Hello I need help in 1.15.2 and I want to compare heads but it doesn't work. When I use player.sendMessage (item.toString());Then I get a zero pointer, but why?
https://hasteb.in/ixegimoq.cs
compare heads?
- either item is null
- or player is null
I see lot of unsafe calls in that code
that entire codebase is pretty shit i hate to say it
ItemStack item2 = new ItemStack(event.getItemInHand());
can become
ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
if(item.equals(item2)) {
event.setCancelled(true);
}
why isn't it indented
at net.minecraft.server.v1_15_R1.NBTTagCompound.a(NBTTagCompound.java:427) ~[patched_1.15.2.jar:git-Paper-378]
at net.minecraft.server.v1_15_R1.NBTTagCompound.write(NBTTagCompound.java:81) ~[patched_1.15.2.jar:git-Paper-378]
That screams that something mangled the NBT on the item
item2 is working but item not
if(item2.getItemMeta().hasLore() == true) {
becomes
if(item2.getItemMeta().hasLore())
i feel like i'm reading code made by yanderedev
lol i got that reference
ArrayList<String> list = new ArrayList<String>();
should be
List<String> list = new ArrayList<>();
and if you're doing this:
ArrayList<String> list = new ArrayList<String>();
list.add("Β§7Linksklick um den Ball zu werfen.");
meta.setLore(list);
then turn it to
List<String> list = new ArrayList<>("Β§7Linksklick um den Ball zu werfen.");
meta.setLore(list)
Just to be sure, these are the only things we're able to modify when it comes to advancement toasts, correct?
Collections.singletonList
List<String> list2 = item2.getLore();
this should really be
List<String> list2 = item.getItemMeta().getLore();
But I want to compare 2 objects with the same head. The head you hold in the inventory and when it is placed something should happen.
ik im probabbly late, but I just wanted to say Java > Kotlin (even though I never tried Kotlin before)
Tough talk for a fella within crusading distance
space out your code because this isn't very readable
you shouldn't pass String url, pass URL url
Even if he has tried it, that statement is still incorrect.
xD
byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
should be separated into more than just 2 lines
Why won't it return true? It's the same thing, isn't it?
@frigid ember
My server works much better on paper because I have better performance.
try {
profileField = skullMeta.getClass().getDeclaredField("profile");
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
profileField.setAccessible(true);
try {
profileField.set(skullMeta, profile);
} catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
can become
try {
profileField = skullMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(skullMeta, profile);
} catch(NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
if i were you i'd read up on program flow, code style and java basics before you get into touching reflection
My eyes
I'm trying to use scoreboard team's entry for more long text on scoreboard. Basically, if you want to update scoreboard without flick, you have to use team for that. The problem is if you add new entry to team, you have to delete old one but if you do that, the line/score will not delete from the scoreboard. If you reset score(delete line), it looks like flick for the players. What should I do for that?
Why does paper have anything to do with this ILikeToCode lol.
He is only using the spigot api atm.
don't use the paper API unless it's absolutely necessary
use paper to run your server, sure, but don't make your plugin depend on paper
F
public class baskListener implements Listener {
wrong naming convention:
public class BaskListener implements Listener
Or ya know just only support paper :fingerguns:
use paper to run your server, sure, but don't make your plugin depend on paper
@open girder wat
public void rightclickBlock(BlockPlaceEvent event) {
again here:
public void rightClickBlock(BlockPlaceEvent event)
in general it's better to write your plugin against the spigot API instead of the paper API
no?
Yo Mini, ever worked with advancement toasts?
if you use paper, write your plugins against paper
No lol
Regarding the field change
why would you not want to use the better api?
hmm ok
^ based and grillpilled
ok
None of y'all make sense
@woeful shore this is the spigot help channel, what do you expect
this community really has went down the drain
Nothing better than this to be honest, since none of y'all know an answer to my question, Imma just skiddadle
this community really has went down the drain
@hoary parcel can't go down the drain if it was never good
i know minidigger knows his shit but unless you dealing with chunks or things like that then you don't need to write against paper
@hoary parcel can't go down the drain if it was never good
@graceful vigil I have been here since 2013. it once was good
Don't modify the profile field directly, use the setter method, otherwise you're gonna desync something
that's fair
idk, i prefer writing against spigot because a minority of people use spigot over paper and if i write against paper then they can't use it
That's what stuff like PaperLib is to help with
the functionality remains the same
the performance isnt tho
just use NMS for the things that spigot doesn't have in its API
the maintainability isnt tho
99 times out of 100 it doesn't make a noticeable difference
it will in the long run
if you're still maintaining support for spigot, using API elsewhere is iffy if you're having tomaintain it for spigot
for shit like teleports, you can use paperlib and have a message pop up saying "hey, these teleports can be sonic-like if you use paper" to provide same functionality, just better for those who choose to have it fast π€·ββοΈ
tbh i haven't heard of paperlib so my entire argument may have just gone down the shitter
@frigid ember See this? This is the paper class https://i.imgur.com/Z9NOLGX.png
it did indeed
Paper does not just change the class of fields already there if it could cause breaking changes.
paperlib is there to provide safe and often faster solutions to the same thing as on spigot, while also working on spigot in a slower or worse way
Not the question...
Paper does not just change the class of fields already there if it could cause breaking changes.
@bold anchor False. If it's internal (i.e. not the API), anything is free-for-all
I mean regarding this a lot of people use it so it shouldn't be changed.
yeah i gotta use paperlib that's amazing
They use their "reflection" to set the field, so changing it will break a lot of compat with plugins that doesn't use paper.
nobody should use it, and it's still free-for-all in terms of being changed
if changing the type is necessary to make it faster, safer, or any other kind of improvement, that will happen as only hacky plugins should touch it
Ah, but oh well in this case it wasn't changed, and i would still argue against not changing it or provide a way to offer "legacy" support to the plugins that use it since a lot does.
(Don't modify that field anyways, use the setProfile method, otherwise you'll desync the data and break stuff)
the "legacy" support is called api :p
True
The general advice is to target your lowest common demoninator unless you wanna deal with "use X stuff when X stuff is available"
PaperLib is an example of that, lets you use async chunk loading where available, or falls back to sync if not available
general gist is that your common stuff would just use whatever you need to to support it
Why does spigot 1.16.1 feel so slow when closing the server compared to 1.15
Like it takes 4-5 seconds to save all stuff and close the server
And I have high end hardware
And this with no plugins
because vanilla 1.16.1 feels so slow when closing the server
why would you not want to use the better api?
so you make your product potentially worse to cater some minority
And Mini it's shit like this that makes me want to kick you as frequently as I do
You KNOW you shouldn't be saying it because I call you out on it every single time, yet you continue to do so
How do you get the item in a string with me it doesn't work.
@frigid ember
I need help because I want to play with the mc version 1.12.2 on a 1.16 server but don't know how this works?
Can anyone help me?
where can i get viabackwards?
from mr google
okay thanks
where you joined to this discord
Yes but how can i downlaoding it only with gifthub?
don't support 5 major versions, please
you might as well be running 1.12
that is not the purpose of viaversion
i have a better ideea,just use 1.16 Pepega
like whats the point on using 1.12 instead of 1.16 lol
also dont expect to be able to use all the new features from 1.16 on 1.12
so some1 told me yesterday to use this
((CraftEntity) vehicle).getHandle().setInvisible(true);```
to make a vehicle invisible
but CraftEntity cant be imported
I only will jion a server how is on the 1.16 but i want to play with the 1.12
:/
whats the point just play with 1.16
I want ro play with labymod
labymod is not that good
okay
just make a mods folder and add optifine
and voxelmap
thats what labymod is basically if im right
okay optifine i have
?
LabyMod is decent, also has it's own API which is very user friendly
you have the wrong/incomplete dependencies
yes it is..
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>```
Just build a server jar and import it
then which one :p
well you want nms so craftbukkit it is
Can anyone help me? https://gyazo.com/230e01071f452f42302f16df48744105
It's a default help message, disabled all the plugins to check and there isn't a plugin that does that.
@sturdy oar yeah i just slap that jar in and i have everything
I use paper 1.16
I install it as local maven repository
paper*
Is there even a paper discord?
Google
jes
salt is weid
i dont like it
only tasty with caramel
omg sorry wrong channel
lmao
@subtle blade you know we were trying to find out what was happening with those flashing signs. I've managed to reproduce it. If there are 64 sign.update() calls in a chunk it causes all other player.sendBlockChange() calls to result in the flashing behaviour
If there is more than 64 sign.update() calls the client starts to lag like crazy
Yeah because not only does a call to update() have to send the sign's NBT to the client, it also triggers physics updates
I guarantee that you don't need physics updates so a call to update(false, false) may be better here
I make the sign.update() call to make the sign reappear again
Then update(true, false)
Yeah probably, it's definitely interesting though, because if you split them between two chunks it doesn't happen
Actually, the force probably still isn't necessary. false, false would suffice
Question is in paste kek
Assign the value to registerNewTeam()
Team team = getteam()
if (team == null) {
team = scoreboard.registerteam()
}
// continue```
pseudocode, you get the gist of it
Still happens with update(false, false)! I wonder if it's a client bug?
Yeah, registerNewTeam() returns the Team object it registered
Well I didn't say it would fix the issue, james, but you definitely shouldn't be triggering physics updates on the update calls lol
Is there any solution for flicking scoreboard? I'm trying to use longer length for each line. Therefore, I use team entry but resetting team entry make scoreboard flick.
this.scoreboard.resetScores(text);
I mean I've got around it by only calling sign.update() once when the item is updated. Still causes the signs to flash once though
Because that just makes the signs blank?
Unless the player relogs
Oh just with the block data
There is a sendSignChange() method too
Don't know if that's what you've been using but it's lighter than a whole block change
albeit there also has to be a sign there already, but yeah
Hey! I could use some help coding, I'd like to make sure that if we wear diamond boots with the name "Β§8Speed Boots", that it gives us the speed effect.
Essentials
player.sendBlockChange(block.getLocation(), sign.getBlockData());
player.sendSignChange(block.getLocation(), sign.getLines());``` Works wonders
Could not find artifact org.spigotmc:spigot:pom:1.8.8-R0.1-SNAPSHOT in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
since I changed spigot-api -> spigot
why'd you change it lmao
Do you use spigot-api as your dependency? If yeah, remove the -api part of it, run BuildTools for your version, and then reimport
I've done that :/
The server jar is not hosted on the Nexus. It can't be. We can't distribute the server jar. BuildTools will local install it
I ran buildtools
do I have to move folders/jar files?
im using maven for dependencies btw
@subtle blade ?
and where would that be xd
Should be at, C:\Users\<user>\.m2\repository\org\spigotmc\spigot by default
okk ty
You should have one for 1.8.8-R0.1-SNAPSHOT. Open it and check to see if you've got a .jar in there
yes theres a folder with that name in there
in the folder, there is a jar file
same name
and 2 more but those are files not jar files, with .pom
Yeah so it's installed. Meaning it's your IDE's fault
Refresh your Maven pom
(you can also remove the <repository> for Spigot as it's not hosted there, it's not in use)
π
Btw, is there anything similar to player.sendBlockChange() for entities? Like an ItemFrame
you mean have the entity believe there is a block in the doorway like?
Okay, I was just wondering whether I could spawn an item frame for a certain player with an item in
Not without packets
Wait... you can place item frames behind signs......
Oh no
I must have spent so many hours getting armour stands working
Eh, armour stands look better any way π
Although they're a pain in the arse trying with the different angles that items can have
in 1.16.1, you can make item frames invisible
Yeah, I know, I just mean the placement of the items on the chest looks better with an armour stand
Howdy, I have what I think is a simple question, how can I make it so zombie villagers cannot spawn naturally, but can still spawn when a zombie kills a villager?
Plugin developer or server owner?
Both, I'm willing to code a plugin if someone points me in the right direction
CreatureSpawnEvent, check if spawned entity is ZombieVillager and if reason is natural
ok thanks
@EventHandler
public void onMobSpawn(EntitySpawnEvent event) {
if (event.getEntityType() == EntityType.ZOMBIE_VILLAGER) {
event.setCancelled(true);
}
}
@neon epoch
Not terribly difficult to do
That will cancel all of them
Check if the cause is not spawnreason.infection
CreatureSpawnEvent for a more specific event and yes, check the reason
afaik, EntityTransformEvent (or whatever it's named) is called for villager transformations and deaths and whatnot
Aha, wow I tried to help and got helped myself :p
sick
Thanks guys!
@EventHandler
public void onZombieVillagerNaturalSpawn(CreatureSpawnEvent e) {
boolean spawn;
if(e.getEntityType() == EntityType.ZOMBIE_VILLAGER) {
if(e.getSpawnReason() == SpawnReason.INFECTION) {
spawn = true;
}else {
spawn = false;
}
if(!spawn)
e.setCancelled(true);
}
}
Someone check my work please!
Can go much simpler than that
I figured i could, but i wasnt sure if zombie villagers could spawn of more than one cause
@EventHandler
public void onZombieVillagerNaturalSpawn(CreatureSpawnEvent e) {
if(e.getEntityType() == EntityType.ZOMBIE_VILLAGER && e.getSpawnReason() == SpawnReason.NATURAL) {
e.setCancelled(true);
}
}```
Just cancelling a natural cause should be the only situation aside from villagers in which they will spawn
public void onZombieVillagerNaturalSpawn(CreatureSpawnEvent e) {
if(e.getEntityType() == EntityType.ZOMBIE_VILLAGER && e.getSpawnReason() != SpawnReason.INFECTION) {
e.setCancelled(true);
}
}```
Just in case you don't want to break spawn eggs/spawners
Suppose that's also another option, sure
Arguably probably the more encompassing option
I think they can also spawn with CHUNK_GEN in zombie villages
To my knowledge, chunk gen is deprecated
That's all handled in ChunkLoadEvent or whatever it's called
Ok
Ah, interesting
Yeah, so I suppose if you really want to be certain about that, you should also listen for a ChunkLoadEvent, check if isNewChunk(), get the Chunk and remove any zombie villagers
@EventHandler
public void onGenerateNewChunk(ChunkLoadEvent event) {
if (!event.isNewChunk()) {
return;
}
for (Entity entity : event.getChunk().getEntities()) {
if (entity.getType() == EntityType.ZOMBIE_VILLAGER) {
entity.remove();
}
}
}```