#help-development

1 messages ยท Page 1953 of 1

crimson terrace
#

ok, enum is prettier so ill go with that then, thanks ๐Ÿ™‚

visual tide
#

dynamicpvparea

#

neat

onyx fjord
#

fuck

#

i uploaded broken jar

#

dont give 1 star yet plox lol

#

its 99% fixed

torn shuttle
#

I can't believe c# doesn't have a single line random number generator

#

this is a betrayal of the highest order

mortal hare
#

I'm pretty sure JavaPlugin class just uses its own classloader's getResourceAsStream in this method internally

#

that's just an alias

#

iirc

manic furnace
#

How does sqlite Work? Is it a server like MySQL?

torn shuttle
#

it's very, very similar to mysql

vagrant heath
#

Disagree

#

One is a real database, the other one is filebased

#

@manic furnace i assume the not being a server is what you are asking

manic furnace
#

OK so MySQL is a real database?

quaint mantle
#

Yo

vagrant heath
#

Yes

#

Or rather a real database server

#

They are both databases

quaint mantle
#

I want to make a gui and if the next that is here, there must come a new gui

#

How

manic furnace
#

So which one is better in performance?

vagrant heath
#

Depends on what you need

manic furnace
#

A lot of interactions

vagrant heath
#

In different threads?

ivory sleet
#

CoderTheDuggy, Iโ€™d certainly say that mysql/postgre is much more powerful

manic furnace
#

Ok

vagrant heath
#

^

#

But it may not be the tool for the job

#

Your use case would be good to know

quaint mantle
#

I want to make a gui and if the next that is here, there must come a new gui Guys, how

vale ember
#

if the server is not so big sqlite is the best choice

#

it's far more simple

vagrant heath
#

Sqlite is great for internal storage

#

As you dont occupy any ports and network

#

Just disk read and write bandwidth

#

Lq how about an inventory?

vale ember
vagrant heath
#

A reasonable assumption for sure

manic furnace
#

So it's just like writing to files?

vagrant heath
#

Sqlite is literally you writing to a file

#

Its just abstracted away through some library

#

You could just as well write a txt or json, but sqlite is faster and nicer to work with

manic furnace
#

Ok because in the moment i am using files lol

#

OK i add both options to my plugin so the user can decide

vagrant heath
#

Json and txt are kinda write only, for an edit you read, change and write, right?

manic furnace
#

Yes

vagrant heath
#

Thats ok for settings

#

But not for active data

vagrant heath
#

It really doesnt matter which sql server

#

Let's not devolve into a religious war on sql servers

#

Alltough im on mariadb side as well

#

@quaint mantle have you looked for any libraries? Im sure there is good spigot UI libraries

#

anyway, I didnt even get to ask my question yet:

I am trying to:
interfere with dispenser events and stop it from dropping its item. Not like cancelling the event, but just like empty buckets pick up water without throwing the bucket on the floor

spiral bramble
#

sql.execute("CREATE TABLE IF NOT EXISTS ?fluxcredit (uuid VARCHAR(225),username VARCHAR(225),credits INT) ENGINE=INNODB;", "fluxcore_");

This should replace the ? with fluxcore_ in the string correct?

vagrant heath
#

Im gonna assume JDBC?

#

And no, im pretty sure you can only have lonestanding ?

#

else you are back to funny SQL injection

#

wait no JDBC looks different

gritty urchin
#

what is the best way to freeze a player

#

no player move event

spiral bramble
quaint mantle
#

Wich libarie

vale ember
spiral bramble
gritty urchin
onyx fjord
#

mysql has scary syntax

tender shard
onyx fjord
#

depends on what u do

vagrant heath
#

just cancel the playermove lol

tender shard
onyx fjord
#

uhm

#

thats like

#

the best way to stop movement

#

but i prefer potion effects

#

so players dont get that draggin effect

mortal hare
#

set walkspeed to 0

#

and cancel event

onyx fjord
#

that works too yea

vagrant heath
#

LQ you are trying to make a GUI, have you looked for any libraries that may accomplish that? If not, may I recommend looking into how to open inventories for players and getting info from them?

#

Because "it needs to make new GUI" does not really provide any info whatsoever

onyx fjord
#

alex

#

check dm

#

plox

vagrant heath
vagrant heath
#

string concatenation?

#

if prefix is player controlled its over

tender shard
#

so? if the admin decides to inject sql into their own database, it's their fault

#

the admin literally has 100% control over the DB anyway

vagrant heath
#

the usecase wasnt clear to me there

#

but yes

tender shard
#

seems like prefix is sth like "wp_" used by wordpress by default

#

if an admin decides to use db-prefix: "prefix; DROP DATABASE asd;" it's a bit stupid but not really a security concern because obviously they have the credentials anyway

gritty urchin
vagrant heath
#

Why not just `sql.execute("CREATE TABLE IF NOT EXISTS ? (uuid VARCHAR(225),username VARCHAR(225),credits INT) ENGINE=INNODB;", prefix+"fluxcredit");

gritty urchin
#

literally lags when i turn my head

warped panther
#

use anvil gui to take a string

vagrant heath
#

or would that not work

vale ember
#

well i am using playermoveevent and it don't lag

gritty urchin
#

or try to move

#

infinite lag back

tender shard
gritty urchin
#

when i try and move my head

#

it spazzes out

spiral bramble
vagrant heath
#

I wasnt sure

tender shard
#

well don't blindly cancel the event, but only cancel it if the x,y,z has changed

sharp flare
#

Thats an easy hash map cancellation

tender shard
tender shard
vagrant heath
#

just adding the string outside of the template?

manic furnace
#

When i write a program to use SQL, can I use it in MySQL and PostgreSQL?

vagrant heath
#

generally no

mortal hare
#

Different SQL engine syntax could be different

vagrant heath
#

practically no

spiral bramble
mortal hare
#

but for example MariaDB and MySQL are inter-compatible generally with each other

sharp flare
#

If the player moves, from the last location saved in a hashmap then tp him back or just cancel the event for Christ sake

vagrant heath
#

SQL norms are a mess, and you are going to be using two completely different engines anyway

tender shard
#
    @EventHandler
    public void onMove(PlayerMoveEvent event) {
        if(!isFrozen(event.getPlayer())) return;
        if(!hasMoved(event.getFrom(), event.getTo())) return;
        event.setCancelled(true);
    }
    
    private static boolean hasMoved(Location loc1, Location loc2) {
        return loc1.getX() != loc2.getX()
                || loc1.getY() != loc2.getY()
                || loc1.getZ() != loc2.getZ();
    }
#

no map or anything needed

mortal hare
#

merge them

tender shard
vale ember
sharp flare
tender shard
sharp flare
#

I barely touch player move event

spiral bramble
sharp flare
#

#getFrom?

#

#getTo

tender shard
mortal hare
#

sometimes adding backticks ` helps for column names

tender shard
#

if you want to use ?

#

preparedStatement.setString(1,prefix+"fluxcredit");

blazing scarab
vagrant heath
#

its not JDBC

blazing scarab
#

Much much cleaner

spiral bramble
blazing scarab
#

pretty sure that uses prepared statements

tender shard
#

oh you're using some lib. if that's an example from its docs, it probobably already uses prepared statements

spiral bramble
#

^^ Its open source, just checked and it does use PreparedStatements

vagrant heath
#

what sql server do you have?

tender shard
#

hm maybe prepared statements don't work at all with table names

spiral bramble
tender shard
#

however I wouldn't worry about it. since the table name cannot be changed by user input, no prepared statements needed

tender shard
#

you can totally just insert the tablename yourself as long as it's not consisting of ANY player input

vagrant heath
#

depends on what weird stuff the library does, if it goes through jdbc you are right

quaint mantle
#

Bro @vagrant heath Wich libarie

#

I need

#

For this ""I want to make a gui and if the next that is here, there must come a new gui""

vagrant heath
midnight shore
#

Hi guys, I have a String which is actually a List of string translated to a string, (Example: I have List that contains A and B, my String will be "Aโ˜‡B" [As "โ˜‡" is the symbol that defines an end of a string and the start of another one]). How can i retranslate this into a List? is there any way to break it into other strings for every "โ˜‡" symbol that it contains?

Hope you understand.

vagrant heath
#

.split

tender shard
#
"CREATE TABLE IF NOT EXISTS `" + prefix + "pluginname`;"```  is 100% fine to use
vale ember
#

"I want to make a gui and if the next that is here, there must come a new gui" huh?

midnight shore
quaint mantle
vagrant heath
#

as a player can only have one inventory open

quaint mantle
#

Nooo

vagrant heath
#

and spigot UI is mostly implemented as inventory

#

spigot can not run code on the client

vale ember
#

and chest as first

vagrant heath
tender shard
#

I guess they just want to have a paginated GUI

vagrant heath
#

(also then you could just split the chest in half lol)

vale ember
spiral bramble
#
if (date == 15-02-222) {add stone}
if (date == 16-02-222) {add cobblestone}

Thats my only guess to what you want?

quaint mantle
#

But the gui must change, they dont need to open 2 inventory's but if the command is ./shop and they use ./shop 15-02-2022 23:59 She wil get GUI 1. And if they run 1 time more round 16-02-2022 00:00 She will get Gui2

vagrant heath
#

then just check the date?

quaint mantle
#

๐Ÿ˜‚

vagrant heath
#

I dont get your usecase

#

you want to show different things at different dates

#

is my only guess

#

then get todays date and show different things

spiral bramble
# quaint mantle But how

LocalDateTime now = LocalDateTime.now();
EDIT - This will return the date-time of the local machine the server is hosted on

tender shard
#

get current date, check if it's date X, show item X, if it's date Y, show item Y, where's the problem?

vale ember
#

you should have something like map with date as key, and item as value, and depending on the commands argument get right item, create inventory, put item in it, open inv for player

#

nothing hard

vale ember
#

if you know basics

vagrant heath
quaint mantle
vagrant heath
#

something is either a string or a list

vale ember
vagrant heath
#

ohhhh

tender shard
spiral bramble
vagrant heath
#

will0 gimme a sec

quaint mantle
tender shard
#

?learnjava

undone axleBOT
spiral bramble
quaint mantle
vale ember
spiral bramble
quaint mantle
#

I have a gui system

midnight shore
# vagrant heath ohhhh

I can only save a STRING type. But i want to save a List of strings! The only way i can think of is by adding them into one single string using some symbol to define a string end end a string start. (I'm saving this to a PDC so i cannot even modify it to use the Array)

spiral bramble
ivory sleet
#

Custom PDC type?

vale ember
# quaint mantle Yes

you create a map Map<Date, ItemStack>, in command, you create inventory, get right item from that map, put it in inventory, open it for player

quaint mantle
vale ember
#

if you use plain inv

vagrant heath
#

ok lemme check again: you want to turn a List<String> into a String?

vale ember
#

if you have gui system it depends

vagrant heath
#

I understood it vice versa first

blazing scarab
vagrant heath
#

anti pollution

midnight shore
vagrant heath
#

will0 come thread

vagrant heath
#

there are 2 discussions

quaint mantle
#

But how guys

spiral bramble
quaint mantle
#

Can you guys send a example

tender shard
quaint mantle
vale ember
blazing scarab
quaint mantle
vagrant heath
#

no because your usecase is not clear at all

blazing scarab
#

The split method has a problem: it breaks when you have a string which contains the separator

vale ember
spiral bramble
# quaint mantle ?

Seeing you're editing a 'ShopPlugin' project, I'm assuming you want different items to appear in the shop on different days?

blazing scarab
#

The lib i sent avoids that problem by storing string array efficiently as bytes

vale ember
ivory sleet
#

Or stick with a custom pdc type like gepron1x suggested

quaint mantle
#

I Have a tread

tender shard
#

guys we already have a thread for the string list pdc thing

vagrant heath
vale ember
#

I'd use nbt, I just hate PDC

blazing scarab
#

Why lol

vagrant heath
#

because nbt is a good format lol

tender shard
#

PDC is just the API way to use NBT

quaint mantle
#

How can i check the time

tender shard
#

gnoogle it

quaint mantle
#

No help

#

Its a help discord

#

๐Ÿ˜‚

tender shard
mortal cedar
#

Particle.BARRIER was removed in 1.18. How do I spawn the particle now?

vagrant heath
#

yes but you arent willing to do your own research

tender shard
mortal cedar
#

BLOCK_MARKER?

vale ember
#

/Lqrss no offence, that's just super basic java, not spigot

tender shard
mortal cedar
#

and this has a BlockData to determine whether it is barrier or light effect?

tender shard
#

IIRC Particle has a method getDataType

mortal cedar
#

okay I'll try to figure it out

#

thats enough info for me ^^

tender shard
#
    @EventHandler
    public void onMove(PlayerMoveEvent event) {
        //System.out.println(Particle.BLOCK_MARKER.getDataType());
        event.getTo().getWorld().spawnParticle(Particle.BLOCK_MARKER,event.getTo(),5, Bukkit.createBlockData(Material.GOLD_BLOCK));
    }
mortal hare
#

that's vanilla?

tender shard
quaint mantle
#

block marker?

#

cool

#

1.18 exclusive feature or when

tender shard
#

yeah

mortal hare
#

COOL

#

you're a god

#

im gonna use this

#

on my server

#

thanks โค๏ธ

tender shard
#

np ๐Ÿ˜„

#

it's a bit annoying that the particle javadocs don't show the actual particle data class

#

so you always have to print out Particle.WHAT_EVER:getDataType() to know what it actually needs

mortal cedar
worldly ingot
#

Could PR that ๐Ÿ‘€

mortal cedar
#

this is soo cool

tender shard
worldly ingot
#

It's a simple JD change so ye

mortal cedar
#

you can do so much stuff with this

mortal hare
#

text

tender shard
mortal hare
#

icons

#

paint minigames

vagrant heath
#

How would I avoid an event going through to vanilla without cancelling it? I want to handle it and suppress the default action

quaint mantle
mortal hare
#

what did 1.18 added

#

more

quaint mantle
#

was about to use it on my 1.17.2 server

mortal hare
#

in technical depth

#

apart from woldgen

vale ember
tender shard
#

"go through to vanilla"? vanilla doesn't care about events

#

events are ONLY for plugins

mortal hare
#

illageralt font was added

#

to minecraft 1.18

#

can we use this

hard lion
#

Paper staff chat plugin issue

quaint mantle
#

sir this is spigot

vagrant heath
#

Ok so my usecase: custom dropper behaviour, I want to not drop a bucket when there is a cauldron in front and instead get the water into the bucket

#

I already have the water level in the cauldron and all that, but the event does not differ between dropped and not dropped items

vale ember
#

what if you cancel the event and dispatch a new one with same data? i think it won't affect vanilla

vagrant heath
#

yeah cancelling is probably the way to go then

#

just means I need to implement the noise and smoke custom

#

but that clears up my understanding of events, thx

tender shard
# worldly ingot It's a simple JD change so ye

any idea on how to do this? I doubt that md_5 will consider this to be good enough for merging

    FLAME,
    LAVA,
    CLOUD,
    /**
     * Uses {@link Particle.DustOptions} as DataType
     */
    REDSTONE(DustOptions.class),
    SNOWBALL,
    SNOW_SHOVEL,
worldly ingot
#

Yeah that's just fine PES_BlankieThumbsUp

tender shard
#

alrighty

spiral light
#

oh nice some fancy changes i can see there

vagrant heath
#

ok yikes

#

when a bucket is dropped the velocity is the items velocity.
when a bucket is not dropped but it collects water the velocity is the block position

#

thx mojang or MS or whoever

sleek pond
#

What

vagrant heath
#

depending on if there is water in front of the dispenser or not, it either drops the bucket item or just fills it, yes?

sleek pond
#

Right

vagrant heath
#

and if it fills it, then the event information on the dispensed item velocity is instead the coordinates of the block it picks up

sleek pond
#

And so what's the problem

vagrant heath
#

it cursed

#

and doesnt make any sense at all

sleek pond
#

Picking something up shouldn't even have a velocity

spiral light
#

probably

sleek pond
#

And I can't think of a usecase where you'd want to use that velocity

vagrant heath
#

yes, so why microsoft

#

but I figured out how to do my stuff

spiral light
#

the api is not microsoft O.o

vagrant heath
#

i mean i dont know when stuff was written

#

oh wait team is still mojang, right?

#

my bad

spiral light
#

what ?

vagrant heath
#

turns out the smoke and sound doesnt disappear when I cancel the event (?)

#

i dont understand dispensers in spigot

#

if anyone ever figures out how dispensers work please message me

spiral light
#

the stuff written in the api is not mojang or microsoft... its mostly md_5 or the army of helping developers behind him ?

if someone who made the event thought its a good idea to set the velocity to the blocks location when its a bucketfill-event it wasn't microsoft or the nms code at all

spiral light
vagrant heath
#

but I guess I gotta decompile and look whats going on if I really want to find out

finite inlet
#

HI! Have never gotten this issue before but tried setting up a server to test a plugin im working on, anyone knows why I get this error when running my bat file?

\Servers\1.18.1 Bungeecord\Servers\Lobby>java -Xmx1024M -Xms4024M -jar server.jar nogui
Error occurred during initialization of VM
Initial heap size set to a larger value than the maximum heap size
tender shard
#

and the min ram to like 4GB

#

obviously 4 is more than 1

#

you probably confused Xmx and Xms

#

(although tbh the error message is quite obvious on what the problem is ๐Ÿ˜› )

finite inlet
#

Wait what, I thought I changed that well thanks

wet breach
#

not sure why you would need to decompile it lol

#

also items are a type of entity and thus can have velocity

vagrant heath
#

im complaining about the case where no item is dropped

#

like when a bucket picks up water

#

then instead of the velocity it is somehow the coordinates

#

not that it matters for my usecase, its just really really weird

#

Ok another question, I just noticed that Dispenser doesnt extend Block, so my casting approach obviously wont work. How do I go about getting a container from a Block?

vagrant heath
#

yeah just arrived at that as well

tender shard
#

Dispenser dispenser = (Dispenser) block.getState()

vagrant heath
#

thx

neon nymph
#

Does bungee use offline or online UUIDs?

spiral light
#

depends on settings i guess

neon nymph
#

What settings?

dusk flicker
#

If bungee is online or offline

#

That setting

spiral light
#

online_mode: true or false

neon nymph
#

Oh, bungee also has that option huh

dusk flicker
#

Yep

wet breach
neon nymph
#

Never knew. Thought online mode should always be false

#

I'd assume that's for the actual servers now

dusk flicker
#

On the spigot servers it has to be off for using bungee

#

For online mode tho it has to be the default of on in bungee

wet breach
#

yeah a bit of a pain to proxy encrypted stuff

neon nymph
#

I see, yeah true. Thanks guys

tender shard
tardy delta
#

lol

tender shard
#

solitaire

#

thanks lol

#

I thought about it for 5 minutes

wet breach
#

For some it just shows my age ๐Ÿ˜‚

finite inlet
#

Is there a way to automatically update a server resource pack when a push has been made to a github? (The github repo is the texture pack)

tender shard
tardy delta
#

texturepack on github lol

finite inlet
#

yeah, but how would I get the server download the github repo, zip it and then replace the old one? ๐Ÿ‘€ Any tips on what I should read for this?

vagrant heath
#

there is 2 routes in front of you

#

1 is git clone shell script of death

wet breach
tender shard
#

github has a download zip function

#

it automatically zips the whole repo

wet breach
#

there is that too

tender shard
finite inlet
#

alright! Thanks!

tender shard
#

so you can basically just provide that link as resource pack url

vagrant heath
#

if teh whole repo zipped is what you want then http get for that zip it is

#

otherwise im sure there are some git wrapper libraries

tender shard
finite inlet
#

yep! That will work ๐Ÿ˜„

tender shard
#
String repoUrl = "https://github.com/onecompiler/tutorials.git";
String cloneDirectoryPath = "/path/to/directory/"; // Ex.in windows c:\\gitProjects\SpringBootMongoDbCRUD\
try {
    System.out.println("Cloning "+repoUrl+" into "+repoUrl);
    Git.cloneRepository()
        .setURI(repoUrl)
        .setDirectory(Paths.get(cloneDirectoryPath).toFile())
        .call();
    System.out.println("Completed Cloning");
} catch (GitAPIException e) {
    System.out.println("Exception occurred while cloning repo");
    e.printStackTrace();
}
vagrant heath
#

I have a question for which I sadly think I know the answer. When canceling a BlockDispenseEvent the inventory im accessing is already missing the correct items (this is what I want). However due to me canceling the event the item is added back after my event handling is done. is there any way to prevent this?

tender shard
#

you could manually remove the item after the event

vernal parcel
#

Hello, I'm not sure I'm in the right place, despite hours of research, I can't find a solution, so here's my problem; the server can't find my main class when I use Cauldron API, while with a Bukkit server, the plugin works perfectly. What should I do?

vernal parcel
#

Cauldron server to load Forge mods and Plugins

tender shard
#

then ask at Cauldron's discord

vernal parcel
#

I can't find it

tender shard
#

does it even support spigot plugins?

#

doesn't really look like it

vernal parcel
#

When i put Essential, it works

tender shard
#

tbh I don't find anything about this cauldron thing

#

when gnoogling it

vagrant heath
#

looks abandoned

vocal cloud
#

Personally my server uses magma a way better bridge

vernal parcel
#

What would you use if you wanted to make a modded server that supports plugins?

vocal cloud
#

Magma

chrome beacon
#

Don't use Forge and Spigot hybrids

#

They are all bad

vocal cloud
#

Don't listen to Olivo do whatever you want to do

chrome beacon
#

;/

#

Get ready for bugs

vernal parcel
# vocal cloud Magma

It's not for my server, but the only problem is that it's in a very old version (1.7.10) and so it's complicated to find something that is reliable and so old

gritty urchin
#

How to compile project with additional dependencies maven?

#

yet it does not seem to compile with the proejct

vagrant heath
#

I mean there is a reason most of those forge + bukkit projects die, but if thats what you want then oof

vocal cloud
blazing scarab
#

Can spigot hide stack traces?

vagrant heath
#

the console? Why would you want that (genuinely curious)

blazing scarab
#

Very useful

vagrant heath
#

does it maybe have a -v flag?

#

i need to check

vernal parcel
vocal cloud
#

Because sometimes the bridge messed with something on the backend and didn't fix it on their custom version of Bukkit as well

vagrant heath
#

did you try looking at essential maven/gradle file if thats available?

blazing scarab
#

Essentials will not work on hybrid trash

#

They're in beef lol

vagrant heath
#

it seems to work for OP here

#

so im guessing you are doing something different from essential, id try to find out where

vernal parcel
vocal cloud
#

Nope

#

Unless you fix the bridge

#

Or you know move to a newer one

gritty urchin
#

How to compile project with additional dependencies maven? I have tried adding <scope>compile</scope> yet it doesn't seem to work

blazing scarab
#

it had 1.16.5 builds recently

vernal parcel
vagrant heath
gritty urchin
#

how do I shade the dependency

vagrant heath
#

which in turn there is also maven plugins for

gritty urchin
#

in my final jar

lavish hemlock
#

maven-shade-plugin

blazing scarab
#

well, there's Sponge on 1.7.10..

lavish hemlock
#

Don't know how to use it? Apache's got documentation, look it up.

gritty urchin
severe folio
gritty urchin
lavish hemlock
#

?learnmaven

gritty urchin
#
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>```
lavish hemlock
#

oh nvm

#

It's under configuration I believe one sec

buoyant viper
#

?maven

undone axleBOT
lavish hemlock
#

yeah

buoyant viper
#

woa

vernal parcel
lavish hemlock
#

Or actually no, @gritty urchin

#

Shade will automatically find deps of the compile scope

#

And those will be shaded

#

provided deps aren't.

#

You should relocate dependency classes though

gritty urchin
#

yeah I tried the compile scope

#

still is not shaded

golden turret
lavish hemlock
#

As of 1.18, apparently it is.

blazing scarab
lavish hemlock
#

Yeah 1.7 is like more unsupported than the very unsupported 1.8 lol

lavish hemlock
#

No the fuck it ain't lol

#

We don't offer support for 1.8 anymore

vernal parcel
lavish hemlock
#

Pretty sure md_5 is eventually planning on removing 1.8 from BuildTools because of all the idiotic server owners who think they have to use it for PVP.

tardy delta
#

mew

lavish hemlock
#

mrow

tardy delta
#

๐Ÿ˜Š

lavish hemlock
#

There are no performance gains from 1.8.

#

Well latest happens to be compiled with modern Java :p

severe folio
#

well no shit it'd perform better, theres way less stuff on 1.8

buoyant viper
#

thats a pretty unfair comparison considering the feature difference

lavish hemlock
#

Modern iterations of the JVM have improved bytecode, probably new JIT optimizations, and a bunch of different, more optimized GCs than the basic CMS.

spiral light
#

xD

lavish hemlock
#

I'd argue it's not too different for servers :p

#

Wellll if you knew how the game was written you would know why that's not so simple.

buoyant viper
lavish hemlock
#

Either way

buoyant viper
#

1.8 starts quicker but chunk management is still as dogpoo as ever on all the versions

blazing scarab
#

1.8 is not performant at all

#

It just has no features at all

#

DOS works better than Windows

buoyant viper
#

everything works better than windows :lul:

golden turret
#

hm

#

1.17 here

#

loads faster than 1.8

#

like

blazing scarab
#

(Linux cool)

golden turret
#

1.8 loads in 30~40 seconds

#

1.17 loads in 10

lavish hemlock
#

Oh yeah also 1.8 vs 1.18 is a terrible comparison.

#

1.18's world generation is very complex.

vocal cloud
#

The issue arises with whether features are the focus or PvP. Sadly, clowns over in 1.8 land circle about the PvP all the time and it keeps them in the dark ages

lavish hemlock
#

1.8 vs 1.17 probably not so much.

buoyant viper
#

oh yeah for sure

#

1.17 vs 1.18 alone is crazy

golden turret
lavish hemlock
#

Yeah

gritty urchin
#

not fully

lavish hemlock
#

You can.

#

There're plugins.

blazing scarab
#

Just keep pvp 1.9+

#

๐Ÿ˜Ž

golden turret
#

you will have an attack cooldown of 0.000000000000000000000000001s

quaint mantle
#

๐Ÿ˜Ž

vocal cloud
#

I mean 1.8 PvP is so boring.. No counterplay at all

severe folio
buoyant viper
#

my pre-1.18 servers loaded in about 10 seconds max, my 1.18 world? 25-30 seconds avg, 20 absolute minimum

lavish hemlock
golden turret
blazing scarab
#

Fast clicking almost always kills your aim

#

i have no clue how people play with jitterclick

lavish hemlock
#

Yeah but it's the only way you can actually PvP in Minecraft 1.8 since it's that shit.

buoyant viper
#

but muh blockhitting

lavish hemlock
#

I got angry when 1.9 dropped initially but nowadays I kinda realized how 1.8 PVP is just sorta meh.

severe folio
#

1.8 pvp is awful

lavish hemlock
#

It's one of those things where it doesn't feel very satisfying to get good at? :/

buoyant viper
#

the only annoying thing about 1.9+ combat is the regen

lavish hemlock
#

And there's not really

golden turret
#

i make that my scroll works as the left click button ๐Ÿ˜Ž

lavish hemlock
#

skill

hexed hatch
#

1.9 combat still isnโ€™t great, but at least itโ€™s not spam clicking bullshit

lavish hemlock
#

more so muscle memory

vocal cloud
lavish hemlock
#

Yeah

golden turret
#

i like 1.9 pvp

#

it is more real

lavish hemlock
#

Like I don't fuckin' know how most PvP encounters work lol

buoyant viper
#

u could have like half a heart and then u eat some food and instantly back to full health

blazing scarab
#

There's still an underground 1.9 pvp community filled with toxic kids

lavish hemlock
#

There's still a Minecraft community filled with toxic kids

buoyant viper
#

theres still kids

blazing scarab
sleek pond
#

It's so nice to land like 5 cross in a row an out manuever your opponent

lavish hemlock
golden turret
#

1.9 regen is faster than 1.8

#

imagine golden apples still being craftable

lavish hemlock
#

Nah you can still craft golden apples, just not god apples.

golden turret
#

yes

blazing scarab
#

i hate waiting 5 minutes to go back fighting

#

pvp is impossible without gapples on 1.8

lavish hemlock
#

lmao

#

idk why but I've always enjoyed being that one guy on SkyWars who just hides the entire time

#

it's tense

#

and also slightly comedic

#

I just like stealth more tbh ๐Ÿคทโ€โ™‚๏ธ

vagrant heath
#

1.9 PvP is also kinda meh once you figure it out

vocal cloud
#

I liked Hunger Games when kitpvp stuff was around and you could build huge tower bases

blazing scarab
#

i wonder how often we discuss pvp here

vagrant heath
#

it just standing in front of each other with shields

lavish hemlock
vagrant heath
#

the first person to try and hit loses in 1.9

blazing scarab
lavish hemlock
#

Just that it's better than 1.8.

vocal cloud
vagrant heath
#

1.8 UHC is hell

severe folio
vagrant heath
#

Axes are great, but dont change the issue

#

lemme draw a thingo

#

whats it called

lavish hemlock
#

A thingo

blazing scarab
#

Uhh, Shields are for noobs

vagrant heath
#

one of those diagrams with the squares and arrows

lavish hemlock
#

Yeah I think that's a thingo

blazing scarab
#

Axe pvp community suxxxx

lavish hemlock
#

:)

vagrant heath
#

flowchart

blazing scarab
#

lemme fuck some shield n axe normies on a record

vagrant heath
#

if you hit with axe, you get hit back with axe and you dont have a recharged hit

#

only real way is to run around people which is pretty fun

lavish hemlock
#

Oh so you mean you're not supposed to rush directly into your enemy where it is obvious that they can perform a counter-play due to them having a range of attack on you?

vocal cloud
#

Damn beat me to it

lavish hemlock
#

Like, 1.9 actually requires strategy and not just Zerg Rush maneuvers? :)

young knoll
#

Clearly a PvP match should just be unga bunga bonking each other until someone falls over

buoyant viper
#

one could argue the fundamental approach to pvp in minecraft has not actually changed

#

no i will not elaborate

young knoll
#

Unga bunga bonk

lavish hemlock
#

Look at my status Coll

vocal cloud
#

When enough new games come out where the mechanics of it are more fun than 1.8 unga bunga we'll see a shift

young knoll
wicked remnant
#

theres a reason minecraft isn't actually known for pvp

young knoll
#

Remember the combat snapshots

lavish hemlock
quiet ice
#

If shields are an issue in 1.9 pvp, why not just ban them?

#

I myself never use them, so it's not like it's any relevant to gameplay or anything

chrome beacon
#

I've never had any issues with shields. To be fair I usually play on Cube not sure if they've nerfed them

ivory sleet
quiet ice
#

Oh yeah, never used blockhit either

humble heath
young knoll
#

Just disable the shield with an axe

#

Problem solved

humble heath
#

how do i fix that

quiet ice
#

Despite me playing 1.8 pvp for what ... 8 years?

chrome beacon
humble heath
#

how

chrome beacon
#

?learnjava ;/

undone axleBOT
quiet ice
#

Clicking air

ivory sleet
#

I mean blockhitting has become a crucial component of 1.8 pvp now apparently, when even servers take those into account especially geol

tardy delta
#

if (e.getClickedBlock != null) {// your code}

quiet ice
#

No, that is the wrong way to do it, you IDE will scream at you if you do that

tardy delta
#

smh

#

early return

quiet ice
#

Abstract it out to a variable and do a null check on that var

chrome beacon
#

Early return ftw

tardy delta
#

damn

ivory sleet
humble heath
#

thank you

ivory sleet
#

oh

#

I replied to wrong person

#

oops

quiet ice
#

The IDE will otherwise not know that getClickBlock is not null after the null check

hollow bluff
#

if (e.getClickedBlock == Material.DIRT) {}

tardy delta
#

unnessecary variables but then conclure will say "the jvm handles that relatively good"

ivory sleet
#

not unnecessary tho

quiet ice
#

Yes, but a pedantric IDE will be able to handle these cases better

shy wedge
#

What is the most efficient way of storing list of player's UUIDs? On every player join I want to check if his UUID is on the list

ivory sleet
#

Use a HashSet

young knoll
#

Use a set

ivory sleet
#

or maybe even a CHM keyset if its in AsyncPlayerPreLoginEvent

tardy delta
#

sometimes i doubt if i should use a variable or not

quiet ice
#

Or linkedHashSet if iteration order is important

shy wedge
#

Sorry I mean storing on the disk

lavish hemlock
#

JSON

quiet ice
#

DataOutputStream

lavish hemlock
#

Read the list once at plugin start, then check it

#

Save the list again at plugin shutdown

ivory sleet
shy wedge
#

Alright thanks for the tips

quiet ice
#
try (DataOutputStream dos = new DataOutputStream(out)) {
    for (UUID uid : uidlist) {
       dos.write(1); // If you want to save concurrently while not cloning any collections, do this
       dos.writeLong(uid.getMostSigBits());
       dos.writeLong(uid.getLeastSigBits());
    }
    dos.write(0);
}
lavish hemlock
#

I mean that is the fastest way.

quiet ice
#

For reading

try (DataInputStream dis = new DataInputStream(in)) {
   while (dis.read() == 1) {
      uidlist.add(new UUID(dis.readLong(), dis.readLong()));
   }
}
spare marsh
#

Quick question here, I'm trying to modify a block from a certain world onEnabled. World is not loaded so I went to world load event. It still appears as if the world is null even tho it is on the WorldLoadEvent and it is that exact world. How do I wait for the world to finish loading or I just schedule the task? If I do, how long should it be or that changes?

blazing scarab
quiet ice
#

Concurrency and not relying on EOT

humble heath
#

i am still getting if you left click midair it is erroring

quiet ice
#

You cannot write the size because the underlying collection may change, so that is the second-best guess
Idk, you probably could do better things, I know

lavish hemlock
quiet ice
#

Fine, EOF

#

Was using the wrong word

lavish hemlock
#

I get the idea behind the whole byte separator thing

#

but I personally think saving the size is safer

blazing scarab
tardy delta
#

fileconfig ๐Ÿ˜Œ

#

stringlist

lavish hemlock
#

(and also likely more efficient since it allows you to create a collection with an initial size)

humble heath
#

when i left click in mid air it still erros and only right click errors when it is not the right line

quiet ice
#

I guess you could add a expected size value before any other value

undone axleBOT
tardy delta
#

makes it a little easier

#

the block is null again

midnight shore
#

Hi guys is there any way to get a random stone block in ChunkLoadEvent?

glossy venture
#

iterate over all blocks in the chunk below y=59 and check if they are stone, if one is stone select a random number using Math.random() and check it to a certain value, if its below the value return the stone block

#

sounds a lot more complicated than it is

wet breach
midnight shore
#

yeah but how do i get all the blocks

#

to iterate over it

quiet ice
#

You'd always have a certain bias

tardy delta
#

i'd do it async

wet breach
quiet ice
#

The only unbiased way is to just spam the method with fully random values, which means that 80% of attempts will yield air.

vale ember
#

does entityspawnevent called when player is spawned?

midnight shore
young knoll
#

PlayerRespawnEvent

granite heart
#

hi guys , i'm having problems with serialization in gson , its spam my console so much , idk what is this error about, can someone help?

glossy venture
#
for (int x = 0; x < 16; x++) {
  for (int z = 0; z < 16; z++) {
    for (int y = 0; y < 60; y++) {
      Block b = chunk.getBlock(x, y, z);
      if (b.getType() == Material.STONE && Math.random() < 0.01) // 1/100 chance
        return b;
    }
  }
}
#

oh wait

quiet ice
#

That is severely biased however

#

And ignores the fact that there can be stone below y = 0

#

even if rarely

glossy venture
#

yeah but its simple

quiet ice
#

That is still biased

vale ember
quiet ice
vale ember
#

if you're using bukkit's Location that's the problem

#

you need custom adapter for it

granite heart
#

i don't use bukkit location , just around uuid and enum and boolean

mortal cedar
#

How can I get the Direction from one location to another?

quiet ice
#

maths. Should've paid attention to school because I did not

vale ember
granite heart
vale ember
humble heath
vale ember
#

i personally use strings

granite heart
quiet ice
#

Or if you are certain you will never change the enums, use it's ordinals

neon minnow
#

what is the difference between

#

PlayerInteractAtEntityEvent

#

and

#

PlayerInteractEntityEvent

vale ember
#

public class PlayerInteractAtEntityEvent
extends PlayerInteractEntityEvent
Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.
Note that the client may sometimes spuriously send this packet in addition to PlayerInteractEntityEvent. Users are advised to listen to this (parent) class unless specifically required.

tardy delta
vocal cloud
#

Read the docs to find out

#

?jd

vale ember
humble heath
#

what checks

neon minnow
#

how can i get e.action from that event, i need to know if the player is right clicking thanks

low temple
vale ember
#

interact is always rightclick (IN CASE OF ENTITY)

#

the leftclick is damage

tardy delta
#

you're casting the block state to a sign before even knowing if the player clicked a block or just air and then you aren't checking if the block is a sign

low temple
vocal cloud
#

Man yall need to stop spoonfeeding doc info to people and make them actually read the docs reeeeee

neon minnow
#

ssshhh

tardy delta
#

we should make a faq page about programming things

#

like how to make command, listener etc

#

fun

hollow bluff
#

shouldnt all that be something everyone already knows?

tardy delta
#

ye.. not newbies

vocal cloud
vale ember
#

and a small java guide page

brave sparrow
#

Iโ€™d argue for a lot of that if you need a step by step tutorial then you donโ€™t know enough Java to be doing it in the first place

tardy delta
#

some of the resources are just bs

kind hatch
#

Well to be fair, there are things like NMS that you kinda need them for.

tardy delta
#

cant give one now but i saw really weird code

young knoll
#

Then update it

brave sparrow
#

Lol

kind hatch
#

Fair

vale ember
#

but people still will be asking it here, you can't just force them to read docs or guide

#

just like with java

brave sparrow
#

You arenโ€™t going to make them a self sufficient programmer by spoon feeding them

#

Youโ€™re doing them a disservice in the long run

vale ember
#

but how would you force them to read docs?

brave sparrow
#

By not giving them the answer

vocal cloud
brave sparrow
#

If they donโ€™t read it then they canโ€™t move forward with what they want to do

#

Simple as that

#

Itโ€™s not a matter of me โ€œforcingโ€ them to read the docs

#

If they donโ€™t read them I wonโ€™t be devastated or anything

#

But Iโ€™m not going to be the replacement for the docs because theyโ€™re too lazy to read

kind hatch
#

Some of the docs suck though. Docs become pretty much worthless if they arenโ€™t written well.

kind hatch
#

The only thing to go off then is the method names

hollow bluff
#

the spigot docs are well written tho

brave sparrow
#

Spigot and Java have very explanatory and robust documentation

kind hatch
#

Java does, spigot could use some work in some departments.

hasty prawn
#

I've never had an issue with Spigot's docs, if you want documentation problems go make a Forge mod

brave sparrow
#

Spigot could use some work but it is far from poorly written

vocal cloud
#

We're bringing red herrings into this to distract from the point that learning to read documentation > asking a question where the documentation could or does already contain the answer

brave sparrow
#

^

vale ember
#

a random question: why is Enchantment enum enchant names not same as their real name? why ARROW_DAMAGE not POWER, why DAMAGE_ALL not SHARPNESS?

young knoll
#

Because 2011

vale ember
young knoll
#

That enum was made way back in 2011

tender shard
ivory sleet
#

^

vale ember
wheat compass
#

stuff has been unchanged since the beginning of the game when thats all it was. Since its a descriptive name it fits better

ivory sleet
#

Some of the names changed now iirc

#

Or (later)

wheat compass
#

code takes awhile to change if the name is good enough, thats the main thing

humble heath
#

what checks because it is spamming my console

vale ember
young knoll
#

Those were probably the old internal names

tender shard
#

but it's the names that mojang used iirc

young knoll
#

If you want to use minecraft names use getByKey

humble heath
#

any ideas

vocal cloud
#

Simple null checks

humble heath
#

i realy need to fix the issue

#

like

vocal cloud
#

Like a simple null check?

tardy delta
#

like simple instanceof

vocal cloud
#

That too. I forgot this is the sign thing

humble heath
tardy delta
#

smh

vocal cloud
#

Oh my

lapis widget
#

if(e.getAction() != Action.RIGHT_CLICK_BLOCK){
return;
}

tardy delta
#

first check if the .. yeah that ^^

vocal cloud
#

So much wrong

tardy delta
#

early return would be useful in this case

chrome beacon
#

^^

humble heath
chrome beacon
#

Intellij is already warning you

lapis widget
#

what the f are you doing lol

humble heath
#

i dont know some one plz

chrome beacon
#

?learnjava Please

undone axleBOT
chrome beacon
#

We can't just spoon feed you everything

vocal cloud
#

Inb4 Objects.requiresnonnull

delicate lynx
#

every single right click is on a sign

lapis widget
#

I'll sign for that xd

tender shard
vocal cloud
#

Hue

tardy delta
#

three times setCancelled(true) lol

visual tide
tardy delta
#

even a return

#

gg

lost matrix
# humble heath

Casting to Playe there does nothing because getPlayer already returns a player.

Your first condition reads as "if getState returns not not null" which can be simplified to just "if getState reurns null"
and would therefor always throw a NullpointerException. getClickedBlock() will also sometimes be null leading to another
NullpointerException.

Dont use deprecated methods. They are deprecated for a reason and have a replacement.

Your e.setCancelled() calls make no sense. Also your intendation is abysmal and makes this really hard to read. Use ctrl + alt + L to auto format your code.

tender shard
#

also they are casting the block to sign

#

and then 10 lines later check if it's actually a sign

lost matrix
#

lul

quaint mantle
lost matrix
quaint mantle
#

PlaceholderExpansion

lost matrix
#

Are you asking if onRequest is called async? What exactly is the question ^^

blazing scarab
#

He want to run sql queries in placeholder expansion

#

As i said before, cache the values on player join

quaint mantle
blazing scarab
#

update the cache...

quaint mantle
blazing scarab
#

Keep cached online players only lol

lost matrix
quaint mantle
#

Any suggestions?

blazing scarab
#

Cache. Values.

lost matrix
#

Use a cache

quaint mantle
#

Wouldn't cache of 4mil players take much memory? I've noticed it take alot

blazing scarab
#

You will never get 4 millions of players online

quaint mantle
blazing scarab
#

I mean at the same time, on the server

lost matrix
#

You only keep those regularly used. Worst case a couple hundred.

quaint mantle
#

A leaderboard that can hold 4mil unique players

lost matrix
quaint mantle
#

I have idea

#

Grab the first 100 players

blazing scarab
#

Exactly

lost matrix
#

Not rly. A simple select query should be enough.

quaint mantle
#

I don't believe that a player on the top 101 would reach 10th place easily

quaint mantle
spare marsh
#

to use UUID.fromString() I just pass in the UUID in string format. Like if get a player's UUID as a string?

spare marsh
#

Thank you

woeful crescent
#

if i cancel a bukkitrunnable twice will it throw an exception?

lost matrix
tardy delta
#

iirc ye

quaint mantle
neon minnow
#

how do i use

#

armorstandinteractevent

#

it says

#

Parameter is not a subclass of org.bukkit.event.Event Compiling and running this listener may result in a runtime exception

quaint mantle
#

I used left join in it

woeful crescent
quaint mantle
#

something like minigame

midnight shore
#

Is there a way to make a charged creeper invisible and the aura visible?

quaint mantle
#

start with something simple

lost matrix
quaint mantle
#

You know, i believe in you

#

make spleef

neon minnow
quaint mantle
#

Spleef is a minigame

#

make tntrun?

#

then go big, skywars

blazing scarab
#

mhz take a rest

vocal cloud
#

I want a dollar for everytime someone comes in here making skywars/bedwars. I could retire soon

quaint mantle
#

You just said you don't know how to develop dude..

blazing scarab
#

Do a clans plugin with clan wars

quaint mantle
#

WHOLE PRISON CORE??

lost matrix
quaint mantle
#

VIP Features, cosmetics, particles, bla bla

tardy delta
woeful crescent
#

just stuff that happens

quiet ice
#

Really stupid question, but does anyone know of a MIT-licensed (or similar) replacement of ConcurrentHashMap?

blazing scarab
#

Wtf

woeful crescent
#

I don't want to map everything around having it coded perfectly

tardy delta
#

maybe check if BukkitTask#isCancelled

quiet ice
#

(I want to fork the map and use it inside my own repo, which is why I can't just copy & paste the OpenJDK ConcurrentHashMap)

lost matrix
quaint mantle
quiet ice
#

OpenJDK is GPL (even if it has a linker exception)

desert tinsel
#

how to use a custom .yml file? i set the file in main in onEnable section, but in another class with plugin.... is not working. why?

lost matrix
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

desert tinsel
#

to use

quaint mantle
desert tinsel
lost matrix
vocal cloud
#

o.0

young knoll
#

?di

undone axleBOT
tardy delta
#

youre returning a class?

blazing scarab
#

๐Ÿ†˜ static ๐Ÿ†˜

quiet ice
#

probably. Guess It's worth trying it.

tardy delta
#

not even that

tender shard
#

whut?

#

what is that supposed to do

blazing scarab
#

you know constructors exist

desert tinsel
#

in main class?

tardy delta
#

im telling how it looks now what it does, it does nothing

#

:C

lost matrix
tardy delta
#

return FileConfiguration;

desert tinsel
#

i have the file set with

        FileConfiguration lan = YamlConfiguration.loadConfiguration(lang);```
tardy delta
#

replace the / with File.separator

#

ah shit

#

๐Ÿ˜Œ

quiet ice
#

Hashtables are compilcated, but I think it is worth at least attempting to understand them

young knoll
#

/ is fine to use in the file constructor

blazing scarab
tardy delta
blazing scarab
#

๐Ÿ†˜ code in constructor ๐Ÿ†˜

lost matrix
#

Hm the lock map might have to be a java.ConcurrentMap itself...

young knoll
ivory sleet
#

Locks are quite slow but yeah

#

I believe chm uses parallelism and conlevel to determine lock amount btw

lost matrix
ivory sleet
#

ye

#

well I dont blame you, atomicity is excruciating to test

quiet ice
#

I mean honestly I probably could use a Concurrent map as a backend, I just want to minimize object allocations that are the result of me currently having to combine a UUID Int and another Int into a single object for the key.

mortal hare
#

why would you implement concurrent hashmap

#

gl solving thread locks

#

and other headaches

ivory sleet
#

I mean

#

as long as you adhere to the interface its fine?

quiet ice
#

You might be thinking that it is premature optimisation, but I don't quite enjoy having a GC intervall of 14 secs on an empty server after it runs for an hour

ivory sleet
#

cant you adjust that with a jvm arg presupposing one exists

mortal hare
#

wtf are you doing that there's so much to clean up to

manic crater
#

I have an issue,

My scoreboard doesn't wanna update and its in a bukkit runnable and set for the on join method, So im just curious, how can i fix this?

#

This is my code

neon minnow
#

How to cancel Villager interact event so inventory wouldnt show

quiet ice
#
    @Nullable
    public PlayerAttachedScore getOwner(@NotNull UUID world, int x, int y) {
        return leaders.get(new WorldPosition(world, hashPositions(x, y)));
    }

Once for every chunk every 5 seconds is (for a reason I cannot understand) fast but (for a reason I understand) taxing on GC

tender shard
neon minnow
young knoll
#

PlayerInteractEntityEvent

manic crater
tender shard
manic crater
neon minnow
manic crater
#

And no it doesnt have to do with guis

manic crater
tender shard
manic crater
young knoll
#

That is not the default eclipse font

manic crater
#

well i never touched it so idk

#

anyway

quiet ice
#

That is just the absence of antialias

tender shard
#

well what do you expect your code to do

manic crater
#

moving past that, do you know why the bukkit runnable wont refresh the scoreboard?

manic crater
tender shard
#

your runnable doesn't do anything useful besides setting the same scoreboard to the player all the time

tender shard
manic crater
#

....

tender shard
#

all you do is "player x uses scoreboard y" every time

manic crater
#

i thought resetting it refreshes it?

tender shard
#

what do you mean with "refresh"?

manic crater
#

like okay

tender shard
#

you never change any values on the scoreboard

quaint mantle
tender shard
#

so I have no idea what you want to be "refreshed"