#help-archived

1 messages Β· Page 198 of 1

crimson sandal
#

Ah I see

#

So location.getWorld().getNearbyEntities(location, Bukkit.getViewDistance()*16, 256, Bukkit.getViewDistance()*16, entity -> entity instanceof Player); look good?

spring arch
#

yep

surreal tapir
#

what is ip

crimson sandal
#

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?

surreal tapir
#

please tell me ip

spring arch
#

it is but not as good as you think

#

it's still garbage

surreal tapir
#

where is ip

#

i need ip

crimson sandal
#

Is entity.getType() == EntityType.PLAYER faster then?

spring arch
#

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

stuck quartz
#

because if so, the signState.update(true) call is entirely unnecessary
@subtle blade that didn't fix the problem

spring arch
#

plus hey @crimson sandal it's a microoptimizations

#

it's better to optimize actual stuff :)

crimson sandal
#

True πŸ˜›

#

Nice to know instance of is faster I guess though

spring arch
#

well it uses bool matrix which is pretty fast I think

crimson sandal
#

Hmm now I'm casting to Player though after

spring arch
#

no problem here?

crimson sandal
#

The tick pct went up from 0.3% to 3-5%

spring arch
#

jit is smart enough to optimize it later

#

when it well collect enough data

#

wait

#

how are you locating nearby entities?

crimson sandal
spring arch
#

the location is?

crimson sandal
spring arch
#

btw how does isLocationChunkLoaded work

crimson sandal
spring arch
#

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

crimson sandal
#

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

spring arch
#

aren't there an event like

crimson sandal
#

Get all online players, check if sign x and z is < 16*viewDist relative to player location

spring arch
#

chunk send event

#

that could be the perfect solution

crimson sandal
#

What do you mean by chunk send?

errant cedar
#

Hello

#

Can someone help me with something?

spring arch
#

well by the idea it would be called when chunk packet is sent to the client

errant cedar
#

I'll send In DM Picture

spring arch
#

I don't know any good solutions beside that

worldly heathBOT
#

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.

spring arch
#

i had to fork paper to remove tons of allocations in these methods

pure canopy
#

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

spring arch
#

the error pretty much explains itself

pure canopy
#

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 ?

spring arch
#

the configuration is invalid

#

that's what error says?

frigid ember
#

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

sinful spire
#

What's the metrics plugin?

pastel nacelle
#

real men use pex

#

real men have always used pex and will always continue to use pex

quick arch
#

you mean GM

subtle blade
#

(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

frigid ember
#

You guys are bugging me what should I download to use the VipZero Plugin ?

subtle blade
#

We don't know what that is

frigid ember
#

As I go on the page Spigot Plugins do not know to go search and nothing appears, Was not Found

subtle blade
#

Neither PermissionsEx nor VipZero are on Spigot

#

They're both on BukkitDev

frigid ember
#

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 ?

quick arch
#

Choco save me

#

🀒

subtle blade
#

where's your syntax highlighting

#

are you trying to kill me?

quick arch
#

That's not mine

#

It's from a newbie

subtle blade
#

there's a lot going on in that

quick arch
#

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

subtle blade
#

any other bombs you want to drop on me?

quick arch
#

uh... yeah

vestal hollow
#

Yo knockoff manhunt is underway

quick arch
#

He's not in this guild

vestal hollow
#

I figured out u had to put the stuff in FTP client

#

wut

quick arch
#

what

frigid ember
#

what

vestal hollow
#

ye I thought I was insane or something

quick arch
#

Aren't we all

vestal hollow
#

I'm gonna record this on obs & the vid is going up tomorrow prob

subtle blade
#

empty onEnable()/onDisable() calls always make me sad

#

or unnecessary calls to their supers

quick arch
#

:)

subtle blade
#

no

#

delete it

frigid ember
#

just have it call itself

#

with no exit condition

subtle blade
#
@Override
public void onDisable() {
    this.onDisable();
}```
#

Trust me, it's fine

pastel nacelle
#

whot

quick arch
#

lul

subtle blade
#

im actually genuinely surprised

#

figured it would have S/O'd

pastel nacelle
#

it should've

quick arch
#

it loads fine, yeah

#

Just sends in that long text around 500 times or so

#

What will happen if I call onEnable() πŸ€”

pastel nacelle
#

so that is the last 3 lines of a stack overflow

quick arch
crimson sandal
#

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

frigid ember
#

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

crimson sandal
#

No lol this is 1.16 πŸ˜„

#

πŸ˜„ πŸ˜„ πŸ˜„ I only support 1.14+

#

lol

buoyant path
#

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

subtle blade
#

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

crimson sandal
#

True

#

Reckon it's because it's signs

#

Okay I'll have a look now

frigid ember
#

Calaboca mano se estΓ‘ me tirando cara Lixo

crimson sandal
#

Can't believe I've just told a user they can only have 127 signs in a chunk lmaooo

subtle blade
#

what are they doing with that many signs?

crimson sandal
#

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

ocean root
#

Is there any way to undo a book ban without deleting the entire player.dat file

crimson sandal
#

And my plugin uses Signs on the front of the chest to designate what player and group it belongs too visually

opal adder
#

Does settotalexperiencelevel() not work?

subtle blade
#

and he managed to have 128 chests in a single chunk? jesus christ

#

talk about compact

crimson sandal
#

When I add that last chest it breaks

subtle blade
#

what? 128 blocks?

#

hoppers all have to be ticked lol

crimson sandal
#

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

quick arch
#

rip a small bit of speed cause of stream

crimson sandal
#

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

quick arch
#

o

subtle blade
#

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

quick arch
#

while your at that, make this return AIR instead of Null getCurrentItem() already returns air e_e

crimson sandal
#

Yeah I'll clean it up with those thanks πŸ˜›

subtle blade
#

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

crimson sandal
#

are streams that much worse than just a for loop?

subtle blade
#

They're pretty heavy objects, yeah

crimson sandal
#

Damn, I always thought it was the opposite and they were more optimised

quick arch
#

oh nevermind it does return Air ._.

subtle blade
#
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

quick arch
#

forEach is a simplified for loop? πŸ€”

subtle blade
#

Yes

quick arch
#

oh I should turn my hideous Stream methods to that then

subtle blade
#

If that's not in a code hot spot it's probably fine

quick arch
#

oh it's used everytime the item editor command is made

#

and probably when someone picks up/get a new item

crimson sandal
#

Java 8 streams are my favourite things too 😭

subtle blade
#

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

crimson sandal
#

Fair enough, I get you

subtle blade
#

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

crimson sandal
#

Oh yeah, that makes sense πŸ˜›

quick arch
#

rip .collect()

subtle blade
#

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

quick arch
tough kraken
#

how can i let my nms mob do a Hit animation?

#

how do i send a packet? 😦

#

never used packets

crimson sandal
#

Okay so sending a block change of 256 bedrock every tick is absolutely fine

subtle blade
#

Well, yeah. Bedrock isn't a tile entity and doesn't have any NBT associated with it

quick arch
#

try it with chests >:)

craggy jolt
#

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));
    }
unkempt ridge
#

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?

craggy jolt
#

ok thank you I'll try it out right now!

crimson sandal
#

Okay but in my plugin the signs are already there and I'm just sending an air sendBlockChange

craggy jolt
#

ILikeToCode I tried out the Integer.MAX_VALUE but it did not work

#

could there be something i need to add to the yml?

unkempt ridge
#

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.

craggy jolt
#

umm I don't know java very well how would you do that exactly lol

ocean root
#

How do I make spigot run off multiple cores

craggy jolt
#

Ohhh ok thank you

pastel nacelle
#

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

subtle blade
#

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

unkempt ridge
#

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 .

craggy jolt
#

Do I just print the System.out.println("Example!"); under my code? It does not display an output message

vocal venture
#

does anyone know a plugin similar to CMI

pastel nacelle
#

essentials

vocal venture
#

thank you

pastel nacelle
#

use generics @unkempt ridge

#

List<Map.Entry<UUID, Something>> list = new ArrayList<>(your shit here)

craggy jolt
#

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

pastel nacelle
#

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

craggy jolt
#

wait what lol

#

sorry for being such a noob

pastel nacelle
#

Bukkit.getPluginManager().registerEvents

craggy jolt
#

ok thank you guys so much

unkempt ridge
#

@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()?

pastel nacelle
#

use List<UUID> then, and yes

unkempt ridge
#

so like this? List<UUID> keys = new ArrayList<>(players.keySet());

pastel nacelle
#

not sure wtf you mean by (UUID) object though

#

where are you grabbing this random object from

unkempt ridge
vocal venture
#

can someone here send me a link to essentials

#

please

pastel nacelle
#

google "essentialsx"

unkempt ridge
#

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

pastel nacelle
#

yes. because your list was a raw type

#

List contains and returns Objects

#

List<T> contains and returns things that are T

unkempt ridge
#

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?

pastel nacelle
#

it's fine

#

probably not a very hot piece of code to begin with, so it doesn't really matter

ocean root
#

Is there any way to make the Minecraft server run multi threaded

pastel nacelle
#

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

unkempt ridge
#

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

ocean root
#

Hmm

sage summit
#

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?

pastel nacelle
#

you may have better luck getting an answer in the enginehub discord

sage summit
#

ok thanks

severe garnet
#

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

wheat mirage
#

How do you stop villagers from being nice to players from being cured?

quick arch
#

Turn them back into a Zombie Villager 😐

wheat mirage
#

No I mean they give them ridiculous discounts

#

It's pretty insane

quick arch
#

It seems you'll have to use nms for that

keen compass
#

well I mean that is pretty normal. If someone saved you wouldn't you give them discounts for your wares too?

#

lol

wheat mirage
#

not really helpful

#

There's no API for it sadly

#

I've got a workaround though

keen compass
#

then don't allow there to be zombie villagers πŸ˜›

wheat mirage
#

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

keen compass
#

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

wheat mirage
#

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

keen compass
#

what do you mean prepare?

wheat mirage
#

As in load

grim halo
#

Only on paper

quick arch
#

PaperLib, no?

grim halo
#

Its still loaded sync. Its just a compatability layer.

white oasis
#

Where can I find a plugin that modify piglin bartering? Or is there a such thing?

buoyant path
#

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

grim halo
#

Do you minimize your jar?

buoyant path
#

idk what that is lol

grim halo
buoyant path
#

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>```
grim halo
#

Hm maybe try to explicitly shade your dependency with <scope>shade</scope>

bronze acorn
#

if you use intellij

#

just add it into your artifact output root

buoyant path
#

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

grim halo
#

What do you mean by wrong MongoClient? There should only be one

buoyant path
#

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

grim halo
#

Did you try mvn clean?

buoyant path
#

[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.

grim halo
#

... no idea. But update your maven shade plugin version

buoyant path
#

its worked before with this exact version lol

#

I have no idea what changed

fleet crane
#

shade isnt a valid scope lol

grim halo
#

Yes but i dont understand why. Where should the MongoDB classes come from? Ive always shaded the mongo java driver when using it...

grim halo
#

@buoyant path Could you show your whole pom?

tame bough
#

i gots a question

#

anyone know how to remove the [traveler] -> you?

#

Its from citizens 2

cold wharf
#

anyone know how to remove the [traveler] -> you?
@tame bough Try asking in their discord

grim halo
#

Are you using maven?

cold wharf
#

yes

grim halo
#
  <properties>
    <java.version>14</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
#

replace 14 with 1.8

#

in your pom

cold wharf
#

okay wait let me try

grim halo
#

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>
cold wharf
#
  <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

grim halo
#

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>
cold wharf
#

A new error

grim halo
#

Thats just a warning. UTF-8 is fine

cold wharf
#

oh okay

grim halo
#

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

cold wharf
#

oh okay lol

keen compass
#

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 πŸ˜›

grim halo
#

Doesnt java just use utf-16 by now?

keen compass
#

makes no sense to default to UTF-16

#

or even UTF-32

grim halo
#

I think since java 9 default is utf-16...

keen compass
#

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 πŸ˜›

grim halo
keen compass
#

doesn't say that the compiler uses UTF-16 by default

grim halo
#

Its not the default encoding you get on Runtime. Just the internal text representation.

keen compass
#

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

teal hawk
#

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.

keen compass
#

if it isn't explicitly stated otherwise of course

prisma sinew
#

Im getting this issue from MVfWPlaceholderAPI

keen compass
#

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.

grim halo
#

By internal i mean the actual in memory representation of Strings is alway utf-16

frigid ember
#

SirNutty u can just use player.sendBlockChange for that i think

grim halo
#

If not otherwise specified that is

keen compass
#

there is no in memory representation, rather how many bits it takes to hold a certain character

grim halo
#

yes 2 bytes for a char

keen compass
#

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

prisma sinew
#

Im getting this issue from MVdWPlaceholderAPI. Anyone able to help me?
Cannot resolve org.spigotmc:spigot:1.9

keen compass
#

not sure what what you mean getting this issue

#

provide more context in what you are trying to do

prisma sinew
#

Trying ot maven sync

#

But its throwing this error

keen compass
#

did you specify the spigotmc repo?

grim halo
#

He is probably missing the spigot dependency when compiling...

prisma sinew
#

Yeah

#

I have it

keen compass
#

which repo are you using?

#

have you tried to navigating to it to see if it is valid

prisma sinew
#
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>```
keen compass
#

or the dependency you want is even there

prisma sinew
#
            <groupId>be.maximvdw</groupId>
            <artifactId>MVdWPlaceholderAPI</artifactId>
            <version>2.1.1-SNAPSHOT</version>
        </dependency>```
grim halo
#

do you have the api artifact or the actual server?

#

Because it looks like you need the whole server artifact

keen compass
#

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

grim halo
#

yeah. So Lag try running the Buildtools with --rev 1.9.something

prisma sinew
#

Okay

keen compass
#

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

prisma sinew
#

Okay I have the spigot 1.9 what do i do?

keen compass
#

encoding for files is a bit different and UTF-8 and UTF-16 does matter in this instance if file size is a concern πŸ˜›

grim halo
#

@prisma sinew Reimport maven

keen compass
#

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 πŸ˜›

timber thorn
#

Does anybody have the translations from old color codes (&6, &3 etc) to hex values? Can't find anything definitive on google...

keen compass
#

shouldn't be all that hard

#

I mean red is FF0000, or 255,0,0

grim halo
#

literally took me 10 seconds

keen compass
#

interesting that MC uses a lighter shade of red

#

even though they call it dark red XD

grim halo
#

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?

keen compass
#

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

grim halo
#

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.

sage summit
#

What are the rules for bumping a post?

grim halo
#

I think you have to wait for at least 24 hours without a response

sage summit
#

Ok thanks

grim halo
#

What post?

prisma sinew
#

Can someone build for me 1.9 spigot?

keen compass
#

@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

prisma sinew
#

Having issues with buildtools

sage summit
keen compass
#

@prisma sinew what issue are you having?

#

thought you were able to get the 1.9 jar

sage summit
#

Auto correct keeps making words capitalized lol

prisma sinew
#

Yeah Thats what I thought

#

Apparently my jdk is having issues changing back to java 8

sage summit
#

Also enginehub not enchanting

timber thorn
#

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! ❀️

keen compass
#

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

prisma sinew
#

Can you send it to me?

keen compass
#

is it saying you need java 8 to build 1.9?

grim halo
#

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

prisma sinew
#

Yes @keen compass

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 πŸ˜›

grim halo
#

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

keen compass
#

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

blissful verge
#

Guys im making a rpg leveling plugin, but I got no clue how should I show how much total xp u got

grim halo
#

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

blissful verge
#

No cause im already showing how much you get like from doing actions there

grim halo
#

I mean for String (chars) constants it would make sense but the whole .class file encoding?

keen compass
#

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

grim halo
#

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)

keen compass
#

there is still other things that get encoded beyond just strings

#

methods, fields and local variables for instance

grim halo
#

Ah right. Still i dont think it should be double the size. But i get your generall idea

keen compass
#

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

grim halo
#

Oh very interesting

frigid ember
#

Guys

#

How do you download Minecraft Java on android

marsh hawk
#
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?
rare prairie
#

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"
marsh hawk
#

oh ez

#

thanks

frigid ember
#

Thx

hollow thorn
#

whats the event for talking

bold anchor
#

AsyncPlayerChatEvent

hollow thorn
#

how do i convet minecraft time to AM time

pastel arrow
#

@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.
grim halo
#

line.split("").length look pretty obsolete as you can just get the size of a String

wraith thicket
#

Why do you split the line? You could simply use the String#length method.

hollow thorn
#

halp Caused by: java.lang.IllegalStateException: Asynchronous getNearbyEntities!

bold anchor
#

Lol

hollow thorn
#

how do i run a getnearbyentities

bold anchor
#

Don't do it async then.

hollow thorn
#

but then i cant get the chat

bold anchor
#

schedule a sync task

hollow thorn
#

thankyou

#

do i just do .runTask

grim halo
#

Yes the BukkitScheduler is thread safe so you can just use runTask()

pastel arrow
#

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.

hollow thorn
#
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?
pastel arrow
#

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"}`
grim halo
#

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
}

spring arch
#

because json object is a hashmap

grim halo
#

Its more of a dictionary than a hashmap but technically right

torn robin
#

anti arrow pattern

hollow thorn
#

isnt dictionary a python hash map

spring arch
#

i'm speaking about an implementation, yes.

pastel arrow
#

because json object is a hashmap
Outputting the hashmap keys are in order.

spring arch
#

oh wait no

grim halo
#

Its >95% similar yes.

spring arch
#

it's LinkedTreeMap

#

btw according to your code

hollow thorn
#
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

spring arch
#

you need JsonArray

#

don't you

grim halo
#

@hollow thorn Rewrite your code to use early escapes and i will be glad to help you.

#

I wont read that through

hollow thorn
#

wait can non players use chat

torn robin
#

that looks so unnecessary

#

why are you running it in a task

#

why are you checking like

hollow thorn
#

because it is in async

torn robin
#

4 different words in different sections

#

why is it async

hollow thorn
#

im making alexa in minecraft

grim halo
#

AsyncPlayerChatEvent

hollow thorn
#

because its chat

torn robin
#

literally nothing of it should be async

#

ah

#

gotcha

#

you should be running all the string content checks all at once

pastel arrow
#

you need JsonArray
Was just making the point about objects being in a different order that code is no where near useable.

torn robin
#

rather than check one word, run some code, check another word, run more code

spring arch
#

@pastel arrow Why o you need ordering?

hollow thorn
#

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

pastel arrow
#

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.

torn robin
#

well you surely aren't planning on having all the logic in one class/function

#

right?

hollow thorn
#

well you surely aren't planning on having all the logic in one class/function
@torn robin yes because im lazy

torn robin
#

k

#

don't

hollow thorn
#

@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

grim halo
#

@hollow thorn Early escape just means that you dont nest those if statements.
Just check one and return

hollow thorn
#

because although all alexas are lanterns not all lanterns are alexas

grim halo
#

Ill rewrite the code yous sent as an example

hollow thorn
#

yeah ive made the code work

grim halo
#

@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.

spring arch
#

wtf

grim halo
#

I used the new BukkitRunnable() stuff because lambdas would confuse him

torn robin
#

pretty sure that last return in isAlexaNearby is wrong

spring arch
#

yeah

#

you have to continue

#

not return

grim halo
#

ah right the first check should not return false but continue

spring arch
#

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;
  }
torn robin
#

im assuming these are armorstands?

grim halo
#

right right. Didnt read this through. Needed too many brain cells for detangling his code

velvet jasper
#

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?

dry horizon
#

Is it possible to detect when a player presses a key

tiny dagger
#

not really

dry horizon
#

Wdym

fathom shard
#

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(", "))) }

tiny dagger
#

those are different player instances πŸ‘Œ

bold anchor
#

that's java.

strange echo
#

no its not

bold anchor
#

Also, map returns a list.

#

he isusing the stream function

#

Stream is a java thing

#

Kotlin has sequence

strange echo
#

ah

grim halo
#

This looks like a mix from kotlin adn java

bold anchor
#

Use toSet()

#

set.map(Player::getName).toSet()

fathom shard
#

#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?

bold anchor
#

It's not a set.

#

Oh that

open girder
#

you can write plugins in kotlin?

fathom shard
#

yes

open girder
#

oh mad

bold anchor
#

Yes it's a jvm language.

tiny dagger
#

what about storing the names instead in the set

#

πŸ‘Œ

open girder
#

i know its jvm but i didn't know it could work like that

bold anchor
#

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.

fathom shard
#

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

bold anchor
#

Kotlin methods usually has less overhead than the stream variant, if you do want the lazy type eval use asSequence

sick mica
#

Does anyone know a good plugin to add luckperms prefixes and suffixes to the tab menu?

#

ok thanks i will try it out

velvet jasper
#

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

naive goblet
#

Kotlin is nice

bold anchor
#

Yes

naive goblet
#

Will probably replace java

bold anchor
#

No.

naive goblet
#

Yes.

grim halo
#

For sure not...

naive goblet
#

Why not?

bold anchor
#

Cause java is java and kotlin is kotlin

naive goblet
#

That’s not an argument

bold anchor
#

It is.

sick mica
#

how can you say something so brave yet controversial

naive goblet
#

Doesn’t make any sense

bold anchor
#
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
grim halo
#

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...

naive goblet
#

Well it’s more null safe

sturdy oar
#

companion object is technically static

naive goblet
#

Don’t really need static

bold anchor
#

It's a singleton viper.

grim halo
#

how about primitives?

bold anchor
#

Kotlin box and unbox' them as it sees fit.

grim halo
#

A lot of performance in hot code handling big data is lost due to autoboxing or the object primitive overhead

naive goblet
#

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.

bold anchor
#

Kotlin is getting better, but it still depends on java.

grim halo
#

Thats why goldman sachs wrote their collections

bold anchor
#

And java is still getting better

grim halo
#

Or FastUtils

bold anchor
#

Implementing a lot of syntax sugar to make you feel better.

sturdy oar
#

Scala > Kotlin 🀣

grim halo
#

Kotlin has its place but it will not replace java

sick mica
#

i second that

bold anchor
#

For some it will πŸ™‚

grim halo
#

I mean its nice if you want to write code with less biolerplate code.

naive goblet
#

Hmm yeah. Though I bet it will grow bigger than java...

bold anchor
#

Probably not.

#

Java is a fucking huge lang widely fucking used for decades.

naive goblet
#

Lol and?

bold anchor
#

Kotlin is a baby

sick mica
#

the all time best game uses java

naive goblet
#

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

grim halo
#

Kotlin is the little script kiddy brother of java. No way its going to replace it for at least 5 years.

naive goblet
#

5 years probably not

#

Why not?

#

Already answered that.

grim halo
#

You cant make predictions about programing languages beyond 5 years.

naive goblet
#

That’s true

#

It’s kind of increasing so Idk Β―_(ツ)_/Β―

#

And as I mentioned before it does java better than java

grim halo
#

What do you mean by that. Thats so vague.

naive goblet
#

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

grim halo
#

Not an argument. Reducing boilerplate is not always wanted.
Thats why C is the most used language in the world right now.

naive goblet
#

You’d most likely get less lines with kotlin code compared to java code that has the same functionality

grim halo
#

Reducing boilerplate comes with drawbacks. Less performance and less control.

naive goblet
#

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.

grim halo
#

null safety again. Is neat if you want it. Otherwise it just reduces control over it.

naive goblet
#

Yeah true

grim halo
#

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.

naive goblet
#

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

grim halo
#

Its not bad at all. It just is not java. They have different audiences (not totally)

naive goblet
#

Yeah fair enough

#

Though it’s not too different from java

arctic hound
#

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

sturdy oar
#

compare heads?

grim halo
#
  1. either item is null
  2. or player is null
arctic hound
#

compare texture heads

#

i have to create a new ItemStack with Head but this is zero

sturdy oar
#

I see lot of unsafe calls in that code

open girder
#

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

chrome lark
#

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

arctic hound
#

item2 is working but item not

open girder
#
if(item2.getItemMeta().hasLore() == true) {

becomes

if(item2.getItemMeta().hasLore())
#

i feel like i'm reading code made by yanderedev

grim halo
#

lol i got that reference

open girder
#
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)
woeful shore
#

Just to be sure, these are the only things we're able to modify when it comes to advancement toasts, correct?

bold anchor
#

Collections.singletonList

open girder
#
List<String> list2 = item2.getLore();

this should really be

List<String> list2 = item.getItemMeta().getLore();
arctic hound
#

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.

tough harness
#

ik im probabbly late, but I just wanted to say Java > Kotlin (even though I never tried Kotlin before)

woeful shore
#

Tough talk for a fella within crusading distance

open girder
#

you shouldn't pass String url, pass URL url

woeful shore
#

Even if he has tried it, that statement is still incorrect.

tough harness
#

xD

open girder
#
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

arctic hound
#

Why won't it return true? It's the same thing, isn't it?
@frigid ember

slim hemlock
#

if your inner classes don't have inner classes are you even alive

#

woops wrong room

arctic hound
#

My server works much better on paper because I have better performance.

open girder
#
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

graceful vigil
#

My eyes

chrome edge
#

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?

bold anchor
#

Why does paper have anything to do with this ILikeToCode lol.

#

He is only using the spigot api atm.

graceful vigil
#

oh god

#

not a craftmetaskull discussion again

open girder
#

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

graceful vigil
#

F

open girder
#
public class baskListener implements Listener {

wrong naming convention:

public class BaskListener implements Listener 
woeful shore
#

Or ya know just only support paper :fingerguns:

hoary parcel
#

use paper to run your server, sure, but don't make your plugin depend on paper
@open girder wat

open girder
#
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?

woeful shore
#

Yo Mini, ever worked with advancement toasts?

hoary parcel
#

if you use paper, write your plugins against paper

bold anchor
#

No lol

open girder
#

why would you do that

#

that makes no sense

bold anchor
#

Regarding the field change

hoary parcel
#

why would you not want to use the better api?

open girder
#

hmm ok

woeful shore
#

None of y'all make sense

#

:fingerguns:

open girder
#

^ based and grillpilled

arctic hound
#

ok

graceful vigil
#

None of y'all make sense
@woeful shore this is the spigot help channel, what do you expect

hoary parcel
#

this community really has went down the drain

woeful shore
#

Nothing better than this to be honest, since none of y'all know an answer to my question, Imma just skiddadle

graceful vigil
#

this community really has went down the drain
@hoary parcel can't go down the drain if it was never good

open girder
#

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

bold anchor
#

Lol

#

Paper provides a lot more shit

#

Than just "chunks"

open girder
#

i know

#

i am aware of that

hoary parcel
#

@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

chrome lark
#

Don't modify the profile field directly, use the setter method, otherwise you're gonna desync something

graceful vigil
#

that's fair

open girder
#

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

chrome lark
#

That's what stuff like PaperLib is to help with

hoary parcel
#

so you make your product potentially worse to cater some minority

#

nice

open girder
#

the functionality remains the same

hoary parcel
#

the performance isnt tho

open girder
#

just use NMS for the things that spigot doesn't have in its API

hoary parcel
#

the maintainability isnt tho

open girder
#

99 times out of 100 it doesn't make a noticeable difference

hoary parcel
#

it will in the long run

chrome lark
#

if you're still maintaining support for spigot, using API elsewhere is iffy if you're having tomaintain it for spigot

rustic socket
#

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 πŸ€·β€β™€οΈ

open girder
#

tbh i haven't heard of paperlib so my entire argument may have just gone down the shitter

bold anchor
rustic socket
#

it did indeed

bold anchor
#

Paper does not just change the class of fields already there if it could cause breaking changes.

rustic socket
#

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

woeful shore
#

Not the question...

rustic socket
#

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

bold anchor
#

I mean regarding this a lot of people use it so it shouldn't be changed.

open girder
#

yeah i gotta use paperlib that's amazing

bold anchor
#

They use their "reflection" to set the field, so changing it will break a lot of compat with plugins that doesn't use paper.

rustic socket
#

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

bold anchor
#

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.

chrome lark
#

(Don't modify that field anyways, use the setProfile method, otherwise you'll desync the data and break stuff)

rustic socket
#

the "legacy" support is called api :p

bold anchor
#

True

chrome lark
#

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

sturdy oar
#

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

subtle blade
#

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

arctic hound
#

How do you get the item in a string with me it doesn't work.
@frigid ember

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?

vernal spruce
#

viaversion/viabackwards

#

but i doubt it has a stable version yet

frigid ember
#

where can i get viabackwards?

vernal spruce
#

from mr google

frigid ember
#

okay thanks

rare prairie
#

where you joined to this discord

vernal spruce
#

i like the last review on it

#

the guy literally threw the error in the review lol

frigid ember
#

Yes but how can i downlaoding it only with gifthub?

subtle blade
#

don't support 5 major versions, please

#

you might as well be running 1.12

#

that is not the purpose of viaversion

vernal spruce
#

i have a better ideea,just use 1.16 Pepega

#

like whats the point on using 1.12 instead of 1.16 lol

rare prairie
#

don't make server

#

its better

vernal spruce
#

also dont expect to be able to use all the new features from 1.16 on 1.12

frigid ember
#

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

#

:/

vernal spruce
#

whats the point just play with 1.16

frigid ember
#

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

vernal spruce
#

also you know you have to be the server owner

#

to add that right

frigid ember
#

okay optifine i have

vernal spruce
#

?

upper river
#

LabyMod is decent, also has it's own API which is very user friendly

vernal spruce
#

you have the wrong/incomplete dependencies

sturdy oar
#

CraftEntity is NMS

#

I suppose

vernal spruce
#

yes it is..

frigid ember
#
        <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>```
sturdy oar
#

Yeah that's spigot

#

Not NMS

vernal spruce
#

you also need to add

#

CraftBukkit

sturdy oar
#

Just build a server jar and import it

subtle blade
#

not "also"

#

one or the other

frigid ember
#

then which one :p

vernal spruce
#

well you want nms so craftbukkit it is

upper river
vernal spruce
#

@sturdy oar yeah i just slap that jar in and i have everything

upper river
#

I use paper 1.16

sturdy oar
#

I install it as local maven repository

upper river
#

paper*

frigid ember
#
            <artifactId>spigot</artifactId>```
#

so instead of spigot-api

#

spigot

vernal spruce
#

so you come to ask for help in spigots discord

#

rather than papers one??

upper river
#

Is there even a paper discord?

vernal spruce
#

Google

frigid ember
#

jes

#

salt is weid

#

i dont like it

#

only tasty with caramel

#

omg sorry wrong channel

#

lmao

crimson sandal
#

@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

subtle blade
#

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

crimson sandal
#

I make the sign.update() call to make the sign reappear again

subtle blade
#

Then update(true, false)

wise flame
crimson sandal
#

Yeah probably, it's definitely interesting though, because if you split them between two chunks it doesn't happen

subtle blade
#

Actually, the force probably still isn't necessary. false, false would suffice

wise flame
#

Question is in paste kek

subtle blade
#

Assign the value to registerNewTeam()

#
Team team = getteam()
if (team == null) {
    team = scoreboard.registerteam()
}

// continue```
#

pseudocode, you get the gist of it

wise flame
#

oh wait I can just do that?

#

that's neat

#

wait

crimson sandal
#

Still happens with update(false, false)! I wonder if it's a client bug?

subtle blade
#

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

wise flame
#

It just occurred to me that my if() wasn't even checking my variable

#

lmfao

chrome edge
#

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);

crimson sandal
#

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

subtle blade
#

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

worn mango
#

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.

copper star
#

Essentials

crimson sandal
#
player.sendBlockChange(block.getLocation(), sign.getBlockData());   
player.sendSignChange(block.getLocation(), sign.getLines());``` Works wonders
frigid ember
#
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

graceful vigil
#

why'd you change it lmao

frigid ember
#

Do you use spigot-api as your dependency? If yeah, remove the -api part of it, run BuildTools for your version, and then reimport

subtle blade
#

Run BuildTools

#

(for that version, obviously)

frigid ember
#

I've done that :/

subtle blade
#

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

frigid ember
#

I ran buildtools

#

do I have to move folders/jar files?

#

im using maven for dependencies btw

#

@subtle blade ?

subtle blade
#

Don't have to move anything

#

Check your .m2 cache

frigid ember
#

and where would that be xd

subtle blade
#

Should be at, C:\Users\<user>\.m2\repository\org\spigotmc\spigot by default

frigid ember
#

okk ty

subtle blade
#

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

frigid ember
#

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

subtle blade
#

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)

frigid ember
#

ohh its working now

#

ly ❀️

subtle blade
#

πŸ™‚

crimson sandal
#

Btw, is there anything similar to player.sendBlockChange() for entities? Like an ItemFrame

vernal spruce
#

you mean have the entity believe there is a block in the doorway like?

crimson sandal
#

Okay, I was just wondering whether I could spawn an item frame for a certain player with an item in

lone fog
#

Not without packets

crimson sandal
#

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

subtle blade
#

in 1.16.1, you can make item frames invisible

crimson sandal
#

Yeah, I know, I just mean the placement of the items on the chest looks better with an armour stand

neon epoch
#

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?

subtle blade
#

Plugin developer or server owner?

neon epoch
#

Both, I'm willing to code a plugin if someone points me in the right direction

subtle blade
#

CreatureSpawnEvent, check if spawned entity is ZombieVillager and if reason is natural

neon epoch
#

ok thanks

river cradle
#
@EventHandler
public void onMobSpawn(EntitySpawnEvent event) {
    if (event.getEntityType() == EntityType.ZOMBIE_VILLAGER) {
      event.setCancelled(true);
    }
}

@neon epoch

subtle blade
#

Not terribly difficult to do

lone fog
#

That will cancel all of them

neon epoch
#

@river cradle wouldnt that cancel if a zombie kills a villager?

#

yeah

lone fog
#

Check if the cause is not spawnreason.infection

subtle blade
#

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

river cradle
#

Aha, wow I tried to help and got helped myself :p

neon epoch
#

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!

subtle blade
#

Can go much simpler than that

neon epoch
#

I figured i could, but i wasnt sure if zombie villagers could spawn of more than one cause

subtle blade
#
    @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

neon epoch
#

aka a cause other than natural

#

ok

lone fog
#
    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

subtle blade
#

Suppose that's also another option, sure

#

Arguably probably the more encompassing option

lone fog
#

I think they can also spawn with CHUNK_GEN in zombie villages

subtle blade
#

To my knowledge, chunk gen is deprecated

#

That's all handled in ChunkLoadEvent or whatever it's called

neon epoch
#

Ok

lone fog
#

Ah, interesting

subtle blade
#

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();
        }
    }
}```