#help-development

1 messages · Page 1971 of 1

opal juniper
#

what you are joking that you are trolling

#

or that you are actually trolling

turbid shoal
#

just hte instance

opal juniper
#

:breh:

tardy delta
#

LGBTQ RPG haha.. ha. no?

tardy delta
#

youtube moment

turbid shoal
#

:{

delicate lynx
#

I'm glad that didn't embed

waxen plinth
#

clash-royale-clash-royale-emote-gif

tardy delta
#

nobody will understand

#

heeheehaw

turbid shoal
#

hehehehaw

waxen plinth
#

For real though, if you're asking for help it's usually a good idea to show code when you ask your question rather than waiting for someone to ask for it because we basically always will

#

And it's also not a good idea to shout at the people trying to help you

turbid shoal
#

i just exagerate everything i say

waxen plinth
#

Yeah well tone it down

turbid shoal
#

dont ever think im actually mad

#

im not

#

im half trolling

waxen plinth
#

Remember that nobody owes you help and if you rub people the wrong way they will stop helping you

turbid shoal
#

half serious

#

ik

#

i appreciate it

#

:}

#

anyone know bungee and 1.16 optimization on world loading and cpu usage

#

im looking to hire for my netwokr

waxen plinth
#

What does that even mean

turbid shoal
#

idk

#

im stupid

waxen plinth
#

This is not the place to hire people

delicate lynx
#

why are you using 1.16 still?

waxen plinth
#

?services

undone axleBOT
delicate lynx
#

regardless this is for plugin dev

turbid shoal
waxen plinth
#

bruh

turbid shoal
delicate lynx
#

wonder why he doesn't feel like it

turbid shoal
#

ikr

#

stupid idiot

waxen plinth
#

I know you're joking but that's still pretty messed up

tardy delta
#

i used 1.16 a month ago

turbid shoal
#

lmao

waxen plinth
#

That you would call your dev a slave and then rail on them like that after not paying them

turbid shoal
#

chilll we co owners

#

im rich and he is coder epic man

waxen plinth
#

If you're rich then pay him

turbid shoal
#

*programmer

#

sorry

#

WE ARE CO OWNERS

#

we split revenue

#

smh

waxen plinth
#

All $2 of it

turbid shoal
#

EXCUSE ME

#

$3 ACTuALLY

tardy delta
#

it was $4

turbid shoal
#

smh

turbid shoal
waxen plinth
#

I'll donate $1 if you can solve a coding problem

turbid shoal
#

OK BET

waxen plinth
#

Ok

turbid shoal
#

no one else answer

#

i will kill you

#

with my ak

#

irl

#

no joke

waxen plinth
#

Given a java program and its input, determine if the code will run indefinitely or stop after a finite amount of time

turbid shoal
#

ok

delicate lynx
#

lol he just threatened to kill someone

turbid shoal
#

give me the program

tardy delta
#

there should be a channel for this kind of things lol, pretty fun

waxen plinth
#

Let's say it can only be one method to keep things simple

#

The input function will only ever be one method

turbid shoal
#

hmmmmmmmmmmmmmmmmmmmmmmmmmmm

spare prism
#

Why does my file clear when I restart my server?

    private static File deletedPunishmentsFile;
    public static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("[dd/MM/yyyy] [HH:mm:ss]");

    public static void initialize() {
        try {
            deletedPunishmentsFile = new File(Main.getInstance().getDataFolder(), "deleted_logs.log");

            if(!deletedPunishmentsFile.exists()) {
                deletedPunishmentsFile.createNewFile();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void log(String message) {
        try {
            FileWriter fileWriter = new FileWriter(deletedPunishmentsFile);
            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
            bufferedWriter.write(LocalDateTime.now().format(DATE_TIME_FORMAT) + " " + message);
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
waxen plinth
#

Do you want something easier

turbid shoal
#

if i fail es

#

yes

waxen plinth
spare prism
waxen plinth
#

When you write to a file

#

It doesn't append by default

#

It puts it at the beginning

turbid shoal
#

im witeitng

#

writeing

#

wrting

waxen plinth
#

You should be writing to the end of the file

turbid shoal
#

writing

waxen plinth
#

Also you should just use a logging library for this

spare prism
waxen plinth
#

Look up "java append to file"

#

I'm sure you'll find something

turbid shoal
#

nvmnd it didint work

#

i want easier pls :}

waxen plinth
#

Ok

arctic moth
young knoll
#

Did you shade it

waxen plinth
#

Given a board of conway's game of life as input, determine if it will run forever or eventually stop changing

arctic moth
spare prism
young knoll
#

Well that's why

arctic moth
#

normally i dont need to

#

how

fierce salmon
#

I am currently making a Utility plugin and am working on a glow command. So far, everything works except when I try to set a specific player to glow. It sends no message to me or the player and there is no error message in console. Here is my code:
https://pastebin.com/8YShkNg5

waxen plinth
#

Conway's game of life, look it up

#

This is an easy problem I'm sure you can get it in a few hours

waxen plinth
fierce salmon
turbid shoal
#

it will stop

#

not infinate

#

final answer

tardy delta
#

hmm not checking instanceof, thats an expensive one

turbid shoal
#

gimme dollar

waxen plinth
#

args[0]

fierce salmon
#

OHH

#

its args[1]

waxen plinth
#

Yes

#

Do you want a better solution by the way

#

I have a library that makes commands waaaay easier to write

fierce salmon
#

Oh sure

#

I'd be down to learn something new

waxen plinth
#

Cool

arctic moth
#

still happens even after shading

waxen plinth
#

Look into the output jar and double check that it has everything from the library you're trying to shade

arctic moth
#

yes

waxen plinth
#

If not, you did something wrong

arctic moth
#

it is building suspriciously fast...

waxen plinth
#

That's not what you should be looking at

arctic moth
#

ik lol

waxen plinth
#

You should be inspecting the built jar and making sure it has all the classes from the library you're trying to shade

arctic moth
#

ok so one of them is shaded but the other one refuses to

tardy delta
#

do you have multiple output jars too?

arctic moth
#

no

#

multiple libraries lol

tardy delta
#

ah then thats just me

#

👉👈👈

arctic moth
#

customblockdata and morepdc

#

customblockdata is working but morepdc doesnt

delicate lynx
#

are you using maven or gradle

arctic moth
#

ok apparently i added the fork as a dependency oops

olive lance
#

ItemInUse vs ItemInCursor?

arctic moth
#

i think iteminuse is the mainhand one

#

but idk

olive lance
#

right now im using getItemInHand

#

im assuming that is just main hand only

#

which is what i would want i think

#

although its deprecated

tardy delta
#

its player.getInventory().getItemInMainHand() the non deprecated one

turbid shoal
#

wheres my dollar

quaint mantle
#

Someone got any idea why I'm unable to reconnect to the database? Tried pretty much anything but to no avail.

turbid shoal
#

ok i made 81 locations https://pastebin.com/m4gbx69V

how do i set each of those sections to one of these without writing 100000 lines

List<Material> jigBlocks = Arrays.asList(Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.BRICK, Material.GOLD_BLOCK, Material.NETHERRACK, Material.ENDER_STONE);
#

damn all the helper people left sadge

#

guess ill do it the long way

opal juniper
#

oh no

#

thats, a uh, very interesting way to go about making all the locations

#

what i would do is just put them in a list or a set, loop through each of the locations and pick a random one from the jigBlocks

turbid shoal
#

too late

#

i already did it the wrong way

hybrid spoke
#

helper people arrived

#

aka god

opal juniper
#

oh no

#

not him

#

dont listen to him

turbid shoal
#

500 lines

hybrid spoke
#

totally him

turbid shoal
#

god how do i write plugin

opal juniper
#

god take a look at that paste

turbid shoal
#

EXACTLY

#

im just jesus to my god

opal juniper
#

so how come you piss on my code which is fucking FINE! and then you turn around and tell me that is okay

#

cannot believe you smh

turbid shoal
#

shaking my head irl rn on

#

g

opal juniper
#

ill warn you chapster

main dew
#

how get hitbox watter block?

turbid shoal
opal juniper
#

god has like code OCD

hybrid spoke
#

you can't say thats bad

turbid shoal
#

hey god you wanna see my code it is 4000 lines+ for one class

opal juniper
hybrid spoke
turbid shoal
#

ok

hybrid spoke
#

its "okay"

#

we've made it much better with my advices

#

but @turbid shoal whats the case now

turbid shoal
#

what

#

i just made 81 locations then induvidually changed each block in a new timer method for each one seperately ez

opal juniper
#

can we see please

hybrid spoke
turbid shoal
#

naw

#

yu would steal my code and release it to the public smh

hybrid spoke
#

believe me, nobody would wanna see that

quaint mantle
#

im sure nobody would want to be associated with your code

opal juniper
#

no imagine would do that tho

quaint mantle
turbid shoal
#

wtf is that

opal juniper
hybrid spoke
#

duke

opal juniper
#

thats duke

#

the java mascot

turbid shoal
#

who is duke

opal juniper
turbid shoal
#

imagine being verified EW

opal juniper
#

imagine nitro boosting...

#

oh yeah

#

shit

hybrid spoke
turbid shoal
#

MY THING DOESNT EVEN WORK

#

WTF

#

I SPENT SO LONG

opal juniper
#

show code

#

we can fix it

hybrid spoke
#

oli would like to refactor it for you

turbid shoal
#

hold on i can figure it out
if i cant figure it out ill show

main dew
turbid shoal
#

also i might have overexagerating how much code

opal juniper
#

why... this seems like an xy moment

turbid shoal
#

but there is still a lot

hybrid spoke
main dew
opal juniper
#

ignore him

#

why do you need the hitbox

hybrid spoke
hybrid spoke
# main dew ?

there is no block hitbox. you would have to go over the location. each blocks offsets are 0.0~1.0

main dew
opal juniper
#

uh well it helps us a bit yeah

hybrid spoke
#

"us" --- "ignore him"

hybrid spoke
#

🤢

tardy delta
#

💀

hybrid spoke
opal juniper
hybrid spoke
turbid shoal
#

here is some of the code

tardy delta
#

👉👈

turbid shoal
#

just ones that dont work

#

how do i make it work

main dew
delicate lynx
#

"don't work"

opal juniper
turbid shoal
#

its not setting the blocks

opal juniper
turbid shoal
#

oh yeah alsop List<Material> jigBlocks = Arrays.asList(Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.BRICK, Material.GOLD_BLOCK, Material.NETHERRACK, Material.ENDER_STONE);

#
List<Material> jigBlocks = Arrays.asList(Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.BRICK, Material.GOLD_BLOCK, Material.NETHERRACK, Material.ENDER_STONE);```
delicate lynx
#

why not just put the locations into a set or something an iterate through each location and get a random material from the list?

main dew
opal juniper
#

he doesnt know loops

turbid shoal
#

yeah wtf is a for loop

#

they are for losers

#

only losers use for loops

delicate lynx
#

or make 1 location and add offsets instead of making a new location

main dew
turbid shoal
#

ITDOESNT MATTER THAT THE WAY I DID IT IS UNEFFIECNET

#

why isnt it changing the cblocks

delicate lynx
#

you're doing it the wrong way, which is why it's not working...

#

it's not the "efficient way..."

turbid shoal
#

but it should still work right?

turbid shoal
#

like ik its not efficent, but idk why it isnt working thought

#

there are no errors

opal juniper
turbid shoal
#

why

#

itsnt

#

it

#

please

main dew
turbid shoal
#

i have to gho to work

#

ok byue

opal juniper
#

i doubt its overworld

#

its probs "world"

waxen plinth
#

Jeez

waxen plinth
quaint mantle
# waxen plinth Jeez
def a():
    a()

does rescursion or nested functions in general cause memory increase

#

im guessing so because it would be storing a bunch of memory locations

hybrid spoke
#

no

quaint mantle
#

Well, it fill up the stack

waxen plinth
#

Whenever you call a function from another function, it has to push a new function context onto the stack

hybrid spoke
#

since it will land on the stack

waxen plinth
#

So it will take up more stack memory

quaint mantle
#

kk

waxen plinth
#

But not all that much

#

Generally stack is much much much smaller than heap

#

So it's usually not something to worry about unless you actually have unbounded recursion, in which case you'll get a stack overflow

#

Stack is memory

#

Heap is a different part of memory

ivory sleet
#

imaginedev yeah in functional programming languages this can actually become an issue, in which trampolines usually must be used as a workaround

waxen plinth
#

Many compilers will try to use tail recursion

#

Tail recursion is when the last call of a function is the recursive one

#

And it allows the compiler to convert it into a loop, essentially

#

It's more efficient

quaint mantle
#

ok i understood a little bit

inland siren
#

anyone by chance know what playerkickevent#setleavemessage was deprecated for

#

tryna null out kick messages

young knoll
#

You are using paper

inland siren
#

oh that's just deprecated by paper

#

wtf

#

wack

#

mb

delicate lynx
#

it's now leaveMessage() to answer your question at least

young knoll
#

Paper deprecated all string message stuff

waxen plinth
#

Which is very annoying

brave sparrow
#

Realistically it doesn’t matter

#

They can’t remove support for it unless spigot does

#

So all it can be is a warning

onyx fjord
#

Paper sometimes breaks API stuff

#

I just stopped using their API even for my own projects

#

I can just get external APIs from spigot site

turbid shoal
#

it’s not like i think that is the best way

turbid shoal
#

so that’s not it

waxen plinth
wet breach
lost matrix
ancient jackal
#

is there a shorter way to write this? wondering because hashmap's #replace(K,V) doesn't put it if it doesn't exist which I guess is a blessing but also sucky in some cases unless I don't know something, no other hashmap methods caught my eye. basically a replace that puts if it doesn't exist, kind of like merge but not for merge and instead for replacing

HashMap<K, V> hm = ...
if(hm.replace(K, newValue) == null) {
  hm.put(K, newValue);
}```
young knoll
#

Why not just use put

lost matrix
#

Sounds like just put

young knoll
#

Put replaces by default

lost matrix
#

lul

ancient jackal
#

that's so damn smart

lost matrix
#

No joke. I didnt even know the replace method existed...

#

The javadocs make me think that replace is just the disabled brother of put... cant think of a good scenario where i would consider using it.

ancient jackal
#

same…

#

Unless you’re trying to put without adding anything if it doesn’t already exist

young knoll
#

I think that’s pretty much the use case

ancient jackal
#

oh yeah, true

lost matrix
#

I just gravitate towards computeIfPresent(K , BiFunction<K,V,V>) when something like that comes up...

wet breach
sturdy ivy
#

Do you guys know why I get this error that is crashing my entire IDEA?

wet breach
#

where as put will still update regardles

ancient jackal
#

Replace is basically put if it already exists

#

but even I do not understand why I typed what I did and asked for something shorter

#

I am very tired though

lost matrix
waxen plinth
#

RAM memory

young knoll
#

NBT tag

waxen plinth
#

ATM machine

young knoll
#

RIP in peace

sturdy ivy
#

missclick

#

autocorrect

lost matrix
young knoll
#

Eclipse doesn’t like decompiling that either

desert loom
#

My eclipse would freeze whenever I used autocomplete with the material enum.

young knoll
#

Yeah mine does that too sometimes

#

I have no idea why

turbid shoal
lost matrix
turbid shoal
#

nope

lost matrix
#

Where does that code live? Do you actually call the method its in?

turbid shoal
#

yes

#

everything else in the method happens

#

but that doesnt

lost matrix
#

?paste

undone axleBOT
turbid shoal
#

its a command

lost matrix
#

dump it in there pls

turbid shoal
#

BRUH

#

but you arte going to tell me to change a bunch of ohter shit to make it better

#

done

#

dont

#

ok?

#

just how to fix this current problem

lost matrix
turbid shoal
#

EXACTLY

#

ok?

lost matrix
#

sure...

young knoll
#

Brace for impact

turbid shoal
#

lol

lost matrix
#

Ok so you are getting teleported?

turbid shoal
#

yes

#

everything happens

#

accept for the mass block replacement

#

even the

            jig1pos1.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos2.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos3.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos4.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos5.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos6.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos7.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos8.getBlock().setType(Material.SNOW_BLOCK);
            jig1pos9.getBlock().setType(Material.SNOW_BLOCK);```
#

that happens

lost matrix
#

Is "GO" being sent to you?

turbid shoal
#

yes

lost matrix
#

Double check your coordinates

turbid shoal
#

i did

#

thats why i am so confused

lost matrix
#

Make a screenshot from your F3 screen

turbid shoal
#

what?

#

you want me to prove to you that its at the right coords?

#

i dotn have minecraft home atm

#

on*

#

i just got home but i double checked earlier

lost matrix
#

You either did not compile and upload or you are simply at the wrong coords.

delicate lynx
#

maybe you gotta reload the chunks?

lost matrix
turbid shoal
#

ok ill recompile it later and test again but i cant rn

#

thx for loooking

waxen plinth
#

You have to understand that the larger your code gets, the harder it is to maintain and the easier it is to miss bugs

turbid shoal
#

that is awesome

#

then the more in depth i will understand the epuic code i right

#

write

sterile token
#

Bedrock plugins are developed on Php?

delicate lynx
#

wtf

#

day ruined from hearing that

sterile token
#

idk a friend tell me

delicate lynx
#

just looking at some random ones on github, they are made in php...

sterile token
#

wft

young knoll
#

Altay is php

sterile token
#

but isnt php designed for websites?

young knoll
#

There are others in java, go, and C#

sterile token
#

i cannot understand how they orks

delicate lynx
#

why php?

sterile token
young knoll
#

Idk ask them

sterile token
#

But isnt support it from Spigot?

young knoll
#

What

ancient jackal
#

Can the bukkit object output and input stream also deal with non-bukkit types?

sterile token
#

I thought spigot was inside Java development and Bedrock

sullen marlin
#

objectoutputstream is cancer dont use it

#

but yes

young knoll
#

Spigot has nothing to do with bedrock

sterile token
#

Oh

ancient jackal
sullen marlin
#

for starters its impossible to edit the resulting file

sterile token
#

Isnt the object stream serialized into bytes?

#

Like for sending and receive serialize the object using Serializable

#

Please confirm someone

ancient jackal
#

The object io stream requires another io stream

sterile token
ancient jackal
#

I just watched a tutorial for the object streams and output it to a file, it came out almost readable with a simple person object using things like a string for name, int for age, etc

quasi patrol
#

player.sendMessage() is only letting me use strings, and not TextComponents?

ancient jackal
#

You could get the byte array with a byte stream though

hybrid spoke
sterile token
sterile token
hybrid spoke
quasi patrol
#

Um.

#

player.spigot() isn't an option either.

young knoll
#

Pretty sure it’s just spigot

#

It’s not a method

quasi patrol
young knoll
#

Are you using spigot

quasi patrol
hybrid spoke
quasi patrol
young knoll
#

API

#

Okay so it is spigot()

#

Shh

quasi patrol
young knoll
#

Are you sure you aren’t using craftbukkit

#

It does work

hybrid spoke
#

are you using the Player interface?

quasi patrol
sterile token
quasi patrol
sterile token
#

Oh

#

player.sendMessage() doesnt allow sending component?

#

Did you try that

quasi patrol
#

It does not allow it.

sterile token
#

Oh

#

Sorry i dont know so

sharp flare
quasi patrol
sharp flare
#

can u try to invalidate your intellij cache

golden turret
quasi patrol
quasi patrol
#

I found the problem.

#

For some reason Vault removes it, which is a problem cause I need both the Vault API and player.spigot().

young knoll
#

That

#

Doesn’t make sense

#

Unless you are using the wrong player import or something

quasi patrol
quasi patrol
#

Changed the dependency from what Vault API has on their page to <dependency> <groupId>com.github.MilkBowl</groupId> <artifactId>VaultAPI</artifactId> <version>1.7</version> <scope>provided</scope> <exclusions> <exclusion> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> </exclusion> </exclusions> </dependency>

young knoll
#

Why does vault include Bukkit

quasi patrol
#

Idk.

young knoll
#

I guess it depends on Bukkit and then your project ends up depending on that

#

I don’t really know how dependencies of dependencies work

sharp flare
#

thats weird

quasi patrol
#

Now, final thing. How do I have 1 part of 1 message be clickable but other part be normal cause textcomponent + textcomponenet doesn't work. .-.

sharp flare
#

forgot to tell you to rebuild your project too

young knoll
#

Use component builder

#

And .append

sharp flare
#

or send them separately

#

but do what col said

tranquil viper
#

is it possible to add aliases for a command through a config?

young knoll
#

Possibly

#

Command has a setAliases method

sharp flare
#

just gotta retrieve it then setAliases

young knoll
#

However I think you would have to register the command yourself to use it

#

Otherwise it’ll be too late

#

“Sets the list of aliases to request on registration for this command. This is not effective outside of defining aliases in the PluginDescriptionFile.getCommands() (under the `aliases' node) is equivalent to this method.”

sharp flare
#

it gets registered in the plugin.yml right?

#

under the main command and as alias

sterile token
#

This is my MenuEvent i want to ask how i would get the HandlerList on MenuOpenEvent

wet breach
young knoll
#

I don’t actually know when spigot registers commands from your plugin.yml

wet breach
#

should be done when the plugin is enabling

young knoll
#

That’s not very specific

#

It could be when the class is instantiated, around onLoad, or around onEnable

sharp flare
#

I see, I onced used aliases by setting them in the plugin.yml

sterile token
#

It would be easier because you dont need to register them on plugin.yml

tranquil viper
#

neither worked

#

aliases is not empty

young knoll
#

Yeah like I said it probably doesn’t work after the command has been registered

tranquil viper
#

I tried it before I registered the command

young knoll
#

You don’t register the command

#

Unless you are using a framework

sterile token
tranquil viper
#

ah ok

sterile token
tranquil viper
#

so what is the point of that method?

young knoll
#

It’s used internally

tranquil viper
#

alr

young knoll
#

And can be used if you are using some kind of framework

#

Or making your own framework

tranquil viper
#

ok thanks

sterile token
#

I make my own

#

based on PluginCommand.class and CommandMap.clas

tranquil viper
#

I liked your FileHandler, if you have a command framework send me it aswell xD

wet breach
quasi patrol
#

I'm trying to use ChatColor.translateAlternativeColorCodes() in a ComponentBuilder, and the color code is &x&1&6&8&2&d&b&l, but for some reason it is returning the text as &b&l.

sterile token
young knoll
#

Legacy color codes do not work in components

#

(Unless you use TextComponent.fromLegacyText)

worldly ingot
#

Well, their behaviour is undefined

young knoll
#

Well, ur undefined

sterile token
worldly ingot
#

Though yeah general rule of thumb is to avoid them entirely when using components

quasi patrol
#

.-.

kind hatch
#

They do if you use ComponentBuilder#appendLegacy()

young knoll
#

Spigot uses bungee components

sterile token
#

Ah lol

#

didnt know

#

How would be sub event done?

#

I have done a custom abstract Event that extend Event clas

#

And i done an OpenEvent that extend custom event (the abstract one)

young knoll
#

I still haven’t managed to figure out how to loop this until a condition is met :p

#

Futures be kinda weird

sterile token
simple anvil
#
public class testingListener implements Listener {
    @EventHandler
    public void onXPBottleBrake(ExpBottleEvent e){
        Block b = e.getHitBlock();
        b.breakNaturally();
    }
}
#

says block is null

young knoll
sterile token
#

I thought the player get teleported

simple anvil
#

does anyone know whats wrong?

young knoll
#

I mean I would assume it didn’t hit a block

#

Did you hit an entity instead

simple anvil
#

no

#

it hits a grass block

ancient jackal
#

maybe it's like the playershearentity event where, instead of returning a copy of the held shears, it returns a copy of the block

#

which still needs to be updated in the docs

simple anvil
#

im trying to break a block when a xp bottle hits a block

ancient jackal
#

Yes

young knoll
#

Even if it was a copy

#

A copy is not null

simple anvil
#

so why is it saying null

ancient jackal
#

oh I did not see that

simple anvil
#

do u want the exact error in the console

#

any ideas?

unkempt peak
simple anvil
#

im trying to break a block when a xp bottle hits a block

#

when i try b.isLiquid()

#

it still says block is null

worldly ingot
#

because it can be null

#

What if it lands on an entity?

ancient jackal
#

try doing a projectile hit event and, after including some guard clauses, do your thing

#

or a pyramid, whichever you prefer

worldly ingot
#

Well, no, just check if the block isn't null lol

simple anvil
#

its always null

ancient jackal
#

I did my google research and it happens to others

simple anvil
#

i directly hit a block and null

worldly ingot
#

Then that's a bug

#

And should probably be reported on the JIRA

#

?jira

undone axleBOT
simple anvil
#
public class testingListener implements Listener {
    @EventHandler
    public void onXPBottleBrake(ProjectileHitEvent e){
        Block b = e.getHitBlock();
        b.breakNaturally();
    }
}
#

this works

ancient jackal
#

very nice

simple anvil
#

dakie

ancient jackal
#

otherwise any projectile will break any block

quasi patrol
#

So uh. I have this in my Component Builder, but it won't become bold.
.append(ChatColor.translateAlternateColorCodes('&', " &fTo get your code")).reset().bold(true) there is a reset because the previous one has a click event and I don't want this one to have a click event too.

simple anvil
#
public class testingListener implements Listener {
    @EventHandler
    public void onXPBottleBrake(ProjectileHitEvent e){
        Block b = e.getHitBlock();
        b.setType(Material);
    }
}
#

what do i put in set type?

ancient jackal
#

Material.<the material>

simple anvil
#

Material DIAMOND_BLOCK

#

?

ancient jackal
#

.

delicate lynx
#

well you set it to a valid block

#

whatever block you want

simple anvil
#

b.setType(Material DIAMOND_BLOCK);

#

like this?

#

oh

#

b.setType(Material.DIAMOND_BLOCK);

delicate lynx
#

I don't think components take color codes

#

wait I cannot read ignore me

ancient jackal
#

unless youre not using stringbuilder then idk, you should show the whole thing

#

I also cannot read

quasi patrol
#

Lol.

delicate lynx
#

maybe the reset cancels out the bold?

ancient jackal
#

try setting the event to null instead of reset

sharp flare
#

always do null checks for those

#

check if block is null

valid solstice
#

is there a way to check if EntityDamageByEntityEvent is a critical hit?

waxen plinth
#

I think you could use damage modifiers for that

#

Oh, maybe you can't

#

You can check the conditions that would cause a crit though

valid solstice
#

isn't there a method to check it?

waxen plinth
#

If the following conditions are met, it should be a crit:

  • The attacking player is falling (velocity has a negative Y component)
  • The attacking player is not in water, gliding, or flying
  • The attacking player is not on the ground
  • The attacking player is not sprinting
#

I believe these are the conditions for a crit

#

I could be wrong

valid solstice
#

yea i think so

valid solstice
wet breach
#

no

#

not sure why people think that because there is an API means they don't have to create code o.O

#

not hard to check all those conditions

valid solstice
#

well it would be convenient

wet breach
#

yes everything would be convenient if someone else does it for you

waxen plinth
#

I mean

valid solstice
#

oh god

waxen plinth
#

I mean it's kinda annoying but it's not that hard to implement

hexed hatch
#

Wait, there’s no api way of checking if an attack is a crit?

sharp flare
#

I think none exist even in DamageCause

fierce swan
#

So I'm trying to make a custom item with spigot, and every tutorial I've seen makes one static instance of the item and gives it to many players, then when used, they compare it with the original item. The problem is I'm trying to make it so the Material is changeable, and obviously that's not possible with this method.
In an attempt to fix it I did a weird attempt to use NBT to store a tag that says it's one of this custom item, and inherit ItemStack to make a custom item type, but I've run into another problem and that is I'm not sure how to change an ItemStack's nbt data when the ItemStack is this.

valid solstice
fierce swan
#

Forgot to mention I'm on 1.12

#

(No I can't update the server for many reasons)

sharp flare
#

well create an object of the item and save it in a map

#

everytime you register your items onEnable

#

I haven't used nbt so imma head out

desert loom
hexed hatch
valid solstice
fierce swan
valid solstice
desert loom
#

I believe you have to use getItem() on the NBTItem object to get back your item with the modifications made.

desert loom
#

np

granite burrow
#

how can I change the default max enchant amount, I think by default is 40, but I wanna set it to 60

EDIT:
I used AnvilInventory#setMaximumRepairCost(60); so now if the player is in survival mode and has 60 levels they can get the item, however the test "Too Expensive! still shows up, is there any way to remove this?

Image showing this is below: ⬇️

granite burrow
worldly ingot
#

The client displays that, unfortunately

#

As far as I'm aware, that should still let you click it, but the client is always going to show that when above level 40. That's not something the server can control

granite burrow
#

is there a way I can send a packet to the player changing that text?

hexed hatch
#

Doubtful, almost certain it’s client controlled

#

However I’ve noticed in certain situations, the text disappears altogether

hardy swan
#

bruh

granite burrow
#

I found a solution

hexed hatch
hardy swan
#

since when version 1.10 is the equivalent to 1.1

granite burrow
#

wait crap I was in gamemode nvm

hexed hatch
granite burrow
#

I did find a way to remove it all together tho,
to do it you run this:

AnvilInventory#setRepairCost(0);
AnvilInventory#setMaximumRepairCost(99999999);
hardy swan
#

although it correctly shows 1.10 during maven build processes

#

guess plugin.yml takes the blame

granite burrow
# hexed hatch Tell tell tell

a quick and dirty fix is doing something like this:

public void prepAnvil(PrepareAnvilEvent e) {
        AnvilInventory anvilInv = e.getInventory();

        anvilInv.setRepairCost(0);
        anvilInv.setMaximumRepairCost(99999999);
}

that will remove it, and then you can setup a on click event to look for when the collect the item and make it so that the plugin takes the xp, other than that idk how to do it rn

hexed hatch
#

In my current project that deals with anvils, currently no price displays

#

And the price is set to 1

#

Which I don’t really understand

granite burrow
#

yeah that doesnt make too much sense lmao

hexed hatch
#

Might be because the items I made combinable aren’t normally combineable

worldly ingot
hexed hatch
#

Now that I think about it, that’s probably what’s up

worldly ingot
#

You can hack around it by forcing it to be a string, version: '${project.version}'

#

Assuming that's what you're doing

hardy swan
#

yea

granite burrow
hexed hatch
granite burrow
hexed hatch
#

If you work up some black magic that works, you better tell me

sullen marlin
hexed hatch
#

You’re a hack

granite burrow
#

oof

olive lance
#

What other uses are there for reflection than sending a packet for multiple versions

#

Relating to spigot plugins specifically

hardy swan
worldly ingot
#

I meant hacking around the "interpreted as double first" lol

ancient jackal
#

this is how you send commands through console as console right? Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "condump");

#

if so, are you able to send them onDisable? because this doesn't work for me java public void onDisable() { // Plugin shutdown logic // Always dumps console to repo on shutdown, just because Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "condump"); }

#

if not, no big deal I'll figure something else out

granite burrow
worldly ingot
#

No, the server won't accept commands on disable

#

Nor should you really have any reason to be executing commands at all through the console in your code

#

If condump is one of your commands, you should export that command's functionality in a method and invoke said method

ancient jackal
#

I see, I will improve it in those ways then

#

thank you

neon nymph
#

Hello guys, I need help with some java logic. Say I got an abstract class foo, a class bar that extends foo, and an interface baz. Is it possible to check in the foo's constructor if its child class bar implements baz? If so, how would I do that?

wet breach
#

not sure what exactly you are asking or trying to do o.O

lost matrix
#
public abstract class Foo {

  private final int x;

  public Foo() {
    if (this instanceof Baz) {
      x = 10;
    } else {
      x = 5;
    }
  }

}
neon nymph
#

Yea true. I've been pondering that as well. Just wanted to see if I could somehow let a parent class know that its child class has an interface implemented. I'll experiment other ways then, thanks!

#

Yea that's what I've also done, mine's getting an error. Not sure if it's related to it though

lost matrix
#

Im not even sure if this works because the identity chain is build top to bottom. I have literally never seen this.

#

Whats the error?

neon nymph
#

Lol yea, I'm not certain myself as I've just begun learning about things I could do with abstracts and interfaces

#

Incompatible conditional operand types Foo and Baz

terse panther
#

Maven or Gladle? Serious question

lost matrix
lost matrix
# terse panther Maven or Gladle? Serious question

I think the overall concept of a dependency manager is better grasped when using Maven as it has a more configuration style approach while Gradle is more execution driven.
The community of Maven is still considerably bigger that the one of Gradle. So if you are not really experienced then i would gravitate towards suggesting Maven.

#

But eventually you should learn both

lost matrix
#

Or runtime

neon nymph
#

Nvm, found the problem. Forgot to change my Baz from class to interface lol

terse panther
median widget
#

how do i add spawners into shopgui+

neon nymph
median widget
#

cause i dont know

lost matrix
neon nymph
#

Yea, thanks a bunch!

median widget
#

well no ones helping

lost matrix
#

Then ask the developer

wet breach
# neon nymph `Incompatible conditional operand types Foo and Baz`
as specified for Type comparison operator instanceof:

    RelationalExpression:
           RelationalExpression instanceof ReferenceType

    If a cast of the RelationalExpression to the ReferenceType would be rejected as a compile-time error, then the instanceof relational expression likewise produces a compile-time error. In such a situation, the result of the instanceof expression could never be true.
neon nymph
#

Yep, I realized the error too lol. Thanks for letting me know 😄

wet breach
#

the specs if you want to further read

maiden thicket
#

hello, do y'all regularly clear out ur m2 cache

#

mines is like 6gb and i havent cleaned it for 2-3 years

lost matrix
#

I dont unless i got a problem with some repos.

maiden thicket
#

my disk space is my problem xD

sullen marlin
#

no

#

I've had mine for 6+ years and its only 20gb

#

probably a lot of goodness buried in it

maiden thicket
#

wat the heck xD

opal juniper
#

just about every version of everything

opal juniper
#

you must be doing a lot of projects ig

lost matrix
#

looks fine to me.
Suggestion: Get WinDirStat and see what cloggs up your system

opal juniper
#

with loads of depends

maiden thicket
#

my projects are on my other ssd

#

i can technically move my m2 repo right

#

like the location

opal juniper
#

uh

maiden thicket
#

isnt the m2 repo location an env variable

#

or no

opal juniper
#

you can look

#

idk

#

i thought you literally just meant move the folder

lost matrix
maiden thicket
#

i have these really large files

opal juniper
#

wut

#

don’t delete that

maiden thicket
#

okay xD

#

wizard101 takes 14gb wtf

#

bru

opal juniper
#

the page file is for extending your memory using virtual memory

maiden thicket
#

ah

opal juniper
#

so it stores anything that doesn’t fit in your memory

maiden thicket
#

ahhh alright

#

for my game problem actually

#

someone said this on their forums

#

they said cut and paste- meaning it's okay to delete the folder i assume?

#

i just realized this is the wrong channel

#

my bad

quaint mantle
#

Rip

fierce swan
#

I got what I was working on earlier figured out, now my only problem is how to prevent an ItemStack from being able to be moved in creative mode. I read somewhere that Creative mode is handled client-side (which would be dumb if that's the case) but this doesn't cut it:

@EventHandler
public void onMove(InventoryClickEvent e) {
    ArrayList<ItemStack> items = new ArrayList<>();
    if (e.getClick() == ClickType.NUMBER_KEY) {
        items.add(e.getWhoClicked().getInventory().getItem(e.getHotbarButton()));
    }
    items.add(e.getCurrentItem());

    items = items.stream().filter(Objects::nonNull).collect(Collectors.toCollection(ArrayList::new));

    if (items.size() == 0 || items.stream().allMatch(itemStack -> itemStack.getType() == Material.AIR)) return;
    if (items.stream().noneMatch(itemStack -> new NBTItem(itemStack).hasKey("HotbarItem"))) return;

    e.setCancelled(true);
}

If I use number keys or click then every other click picks up the item (maybe smth to do with DOUBLE_CLICK?) If I shift-click it works, number keys work, etc.
The only thing I could find is ClickType.CREATIVE but I'm not sure how to use that

lost matrix
#

There is an InventoryCreativeEvent iirc

fierce swan
#

Welp, thank you
Idk how I missed that lol

lost matrix
#

Wait... wtf is that stream even for?
Why do you stream a list that will always only have a single element in it?

fierce swan
#

True

lost matrix
#

Oh wait it has 2 sometimes

#

I dont... what is that code?

fierce swan
#

I need to get the two items that could appear

#

Remove nulls for items that don't exist

#

Check if any have the nbt tag and then cancel if it does

#

I'm assuming for InventoryCreativeEvent I have to use InventoryAction?

lost matrix
#
  @EventHandler
  public void onMove(InventoryClickEvent event) {
    ArrayList<ItemStack> items = new ArrayList<>();
    if (event.getClick() == ClickType.NUMBER_KEY) {
      items.add(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
    }
    items.add(event.getCurrentItem());

    items.removeIf(Objects::isNull);

    if (items.stream().map(ItemStack::getType).allMatch(Material::isAir)) {
      return;
    }

    if (items.stream().noneMatch(itemStack -> new NBTItem(itemStack).hasKey("HotbarItem"))) {
      return;
    }

    event.setCancelled(true);
  }

My first iteration. But i see some more stuff that can be simplified.

#

There is more than one AIR material btw

fierce swan
#

In 1.12 I don't think so

#

Unless I'm misremembering smth

lost matrix
#

Oh you are using 1.12 -.-

fierce swan
#

Yeah

#

For the purposes of this server we cannot go above 1.12

#

Or it would break a lot of the fundamental concepts behind it

lost matrix
#

Like what? What can you do in 1.12 that you cant in 1.18?

wet breach
fierce swan
#

As in

#

It's a parkour server

#

And everything changes in 1.13

wet breach
#

parkour exists in 1.18

fierce swan
#

Most parkour players prefer 1.12

#

Not saying it's not possible but when you get to really complex jumps 1.13+ breaks everything

wet breach
#

basically it isn't that you can't update, you just don't want to update and fix stuff is all

lost matrix
#

Interesting. At least its not "mah pvp"

fierce swan
#

X- and Z-facing jumps are no longer a thing, water jumps do not exist, etc.

fierce swan
#

There is no "fixing it" it's entirely removed

#

Half the physics things that the parkour jumps use do not exist anymore

wet breach
#

yes means you have to adapt

fierce swan
#

There are servers that have tried

#

They failed because no one wanted to play them

#

The parkour community is a lot bigger than you think lol

wet breach
#

obviously not that big

lost matrix
#

Im fine with it as long as its not 1.8

fierce swan
#

If you think it's under a hundred you're wrong but I'm not here to have this argument. We're sticking to 1.12
Hell most parkour players don't want to move from 1.8 so this is already outside their comfort zone

wet breach
fierce swan
#

Trust me I wish I could use things like PDCs and stuff

wet breach
#

you can

fierce swan
#

In 1.12?

wet breach
#

nope

fierce swan
#

Exactly.

#

I'm done with this discussion

wet breach
#

but you can still allow old clients on new versions

#

and you can still bring back old mechanics if you really wanted to

fierce swan
#

For more difficult courses it would either be impossible or buggy as hell

#

Again, trust me

#

Servers have tried

#

And failed

wet breach
#

doubt it

#

but ok

fierce swan
#

Look I've consulted people who have done this for years ok

#

I'm not having this discussion, seriously.

wet breach
#

I don't know of these servers you claim of and supposedly failed, servers fail all the time and not because of using updated versions lol

fierce swan
#

And you're saying I'm lying why?
Literally why would I want to stay with 1.12 if I don't have to

#

What would I gain by lying here

#

Literally nothing

wet breach
#

I don't know you so I can't answer that

#

I don't trust people on the internet sorry

fierce swan
#

And clearly you don't know parkour

wet breach
#

I also don't automatically believe everything someone says either

#

not sorry for that either. If you can't specify which servers you speak of, then I assume they don't exist

fierce swan
#

Cool, then do your own research or zip it. If you're not gonna believe anything I say then why bring it up at all

#

Again I gain absolutely nothing from lying about not being able to use 1.13+

wet breach
#

people are liars sometimes

fierce swan
#

And I'm asking you why I would lie here lmao

wet breach
#

and I am telling you people don't need reasons to lie

fierce swan
#

I'm sorry you're paranoid but I joined this server to ask for help not be shat on for seemingly nothing

fierce swan
wet breach
#

ever heard of pathological liars? they don't need a reason to lie they just do. I didn't say you were one, just stating people can lie without needing a reason

#

even if its to win an argument

fierce swan
#

Cool, I'm not doing that lmao

#

I have no reason to do that
This argument is stupid

#

I've tried to end it multiple times

fierce swan
#

I figured from the code snippet I got, didn't know that before, hence the check if it's empty

hybrid spoke
#

wait, not false. its true then. removeIf will be false

#

since it technically matched everything

fierce swan
#

Oop

#

I mean I guess for this case it doesn't really matter?
Cause if you're moving two null items then it's not like cancelling it would do anything

#

But it's good to know for the future

pulsar path
#

Is there a way to kill an entity with the drops just like a player killed it?

lost matrix
#

Unless he has a looting sword ofc

pulsar path
#

I guess so, yes

lost matrix
#

What is your concern?

pulsar path
#

I want to kill an entity using my plugin but make the entity drop it's drops like it was killed by a player

lost matrix
pulsar path
#

how do I do that?

lapis lark
#

Hi! Anyone know how to use brackets < and > in maven and not trigger a module. I mean Java have \\ for \ char, maybe there is something \< (not working) for maven?

lost matrix
lapis lark
#

Yes

lost matrix
#

Those are the replacements

lapis lark
wet breach
#

this is where reading the spec helps

wet breach
sacred mountain
#

say i want to temporarily delete a class in intellij

#

how would i do it

#

other than commenting every file in the package

#

is there a simple way to just ignore that package/file

wet breach
#

structure you see in the IDE is also the structure for the directory of the project

sacred mountain
#

hm ok

sullen dome
#

not directly related to spigot, but i need some math help.
i have this:

if (client.options.getPerspective() == Perspective.THIRD_PERSON_FRONT) { // double f5
  // set opposite yaw
}```

as the comment says, in there i want to set the camera yaw (field called `cameraYaw`) to the straight opposite (so 180 degrees i guess? idk)
how would i calculate that exactly? as yaw goes from -180 to +180
lost matrix
#

What language and do you use a game engine? Depending on that there is probably a simpler way.

sullen dome
#

its just a mc mod

#

fabricmc to be clear

#

but fabricmc's discord is trash, so i ask here :/

lost matrix
#

I see

sullen dome
#

what i basically want to do is set the camera yaw to the exact position that double f5 corresponds to

sullen dome
#

modular arithmetic
i have no idea what that even is ahaha

#

my brain starts exploding

lost matrix
#

My approach would be -> add 180 (so you have a range from 0 - 360) -> add your flip -> subtract 180 again. Something like that.

sullen dome
#

how much do i even have to add to get the the "half rotation" huh my braiiiin

#

is it 90?

eternal oxide
#

180

lost matrix
#

180

sullen dome
#

there it begins lol

#

thx

#

aight the yaw seems to work. but the pitch is still behaving kinda weird

lost matrix
#

The pitch does not have to be mirrored

#

You only have half a circle there

sullen dome
#

yea ik but i mean

#

wait

#

as soon as i change the yaw/pitch, it goes from the first image to the second image

#

yaw works fine now

minor garnet
#

why the armor stand head is dont rotating to my direction

lost matrix
#

Hm could also be a full circle depending on the relative anchor of the camera

sullen dome
#

uhhhhhhhhhhh

#

that is too much for me

#

ngl

#

i mean, i can't do the same for the pitch as for the yaw apparently...

#

i actually did it?

#
if (client.options.getPerspective() == Perspective.THIRD_PERSON_FRONT) { // double f5
  this.cameraYaw = ((180 + this.client.player.getYaw() + 180) % 360) - 180;
  this.cameraPitch = -this.client.player.getPitch();
}```
this seems to work fine
sacred mountain
#

:(org.bukkit.plugin.InvalidPluginException: Abnormal plugin type

#

sad

lost matrix
sacred mountain
#

i fuxed it tho

#

i must have accidentally added it in at some point idk how

sharp flare
#

does high ping affect code execution

lost matrix
sharp flare
#

like it rekts the tick execution

#

Some of the events I have from my plugin doesn't execute well on a 200 ping server

lost matrix
#

The server always has a ping of 0.000ms to itslef

sharp flare
#

whilst in a local host its fine

#

I mean if the player has high ping

#

mb on that

lost matrix
#

The server doesnt care about the connected clients... Your TPS is the only value that is relevant for code execution.

sharp flare
#

I'm thinking of the reason might be the ping but you proved it wrong ig, and the other one which is what the server software is being used

#

I'm on an airplaine server rn with 200 ping some stuffs aren't executing well due to the delay

#

but the tps is fine though weird

lost matrix
#

If you have a ping of 200ms then you also see your actions 200ms later.
The packets travels to the server in 100ms. Then the server computes it in some milliseconds. Then the server sends back a packet which takes 100ms

tardy delta
#

Airplane server?

sharp flare
#

fork

tardy delta
#

Oh i was thinking of a plane

sharp flare
#

xD

lost matrix
#

The server is probably fine. You just see everything delayed because your data is sent later and received later

sharp flare
#

it doesn't cancel the events though which is supposed to be cancelled

lost matrix
#

The ping does not affect code logic in any way

sharp flare
#

kinda weird though, might be because of the server software but not sure untill tested for which I have no control of unfortunately, thanks though

lost matrix
#

Then dont. Good code is self documenting.
The only place where it makes sense is on exposed APIs.

#

Make it short but be precise.
Cover one or two common edge cases.
Notify about possible exceptions.
Thats pretty much it.

#

And use annotations like JetbrainsAnnotations to define contracts and nullability

minor garnet
#

how i set a nbt on entity?

lost matrix
#

Difficult. By using nms

minor garnet
#

about my problem 7smile

#

those values are updating but

#

this works once and never updates armor head position again

chilly haven
#

Is it possible to take away 10 durability on shoot with a bow?
Because this code doesnt work.
bow.setDurability((short) (durability - 10));

lost matrix
chilly haven
#

1.8

lost matrix
# chilly haven 1.8

Well... This version is ancient and support was dropped years ago. If you have an issue you should just
search in old forum posts from half a decade ago.

chilly haven
#

ahh okay.

lost matrix
#

*Or you update to the latest spigot version

chilly haven
lost matrix
chilly haven
#

il try that

tardy delta
#

does the use of backticks in sql statements only works in mysql?

tender shard
#

I'm using a HttpUrlConnection in java to get a http response, using an url like https://api.jeff-media.com - can I also add the IP address to the HTTPURLConnection so it'll also work without DNS?

quaint mantle
tender shard
shrewd sentinel
#

How would I get the max health attribute on a custom mob?

tardy delta
#

because they were talking all the time about mysql

shrewd sentinel
#
AttributeInstance attribute = this.getAttribute(Attribute.);```

Tried this but only Max name length exist
blazing scarab
#

no

tender shard
#

in vanilla vanilla?

young knoll
#

No

tender shard
#

why don't you just use a plugin if you run spigot anyway

lost matrix
#

You need a command for that

proud basin
#

When opening a gui does it open your inventory too I forgot?