#help-development

1 messages · Page 528 of 1

remote swallow
#

null check'd

quaint mantle
#

i know wait

young knoll
#

I mean idk how ass pressure would ever not involve a block

#

But i'm sure you can spare the CPU cycles

worldly ingot
#

muh CPU cycles

remote swallow
worldly ingot
#

bro

#

my ass is phat

remote swallow
#

yeah you cause events while crouching in the air

quaint mantle
#
 @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        Block block = e.getClickedBlock();
        if (e.getAction() == Action.PHYSICAL){
            if (block.getType() == Material.FARMLAND) {
                if (block != null) {
                    e.setCancelled(true);
                }
            }
        }
    }```
young knoll
#

Move it up

worldly ingot
#

Or && it

quaint mantle
#

oh

young knoll
#

Also invest in early returns

quaint mantle
#

alright

remote swallow
#

the exact code i sent

quaint mantle
worldly ingot
#

Not exactly what I meant when I said && it KEKW but yeah that works

quaint mantle
#

😄

#

i wonder

remote swallow
#

method() {
    Block block = e.getClickedBlock();
    if (block == null) return;
    if (e.getAction() == Action.PHYSICAL && block.getType() == Material.FARMLAND) {
        e.setCancelled(true);
    }
}
#

no you cant question the method

young knoll
#

Why stop there

worldly ingot
#

method

quaint mantle
#

if i change Player interact event to entity interact works for player and other mobs ?

young knoll
#
method() {
    if (e.getAction() == Action.PHYSICAL && block != null && block.getType() == Material.FARMLAND) {
        e.setCancelled(true);
    }
}
worldly ingot
#

Yes, it should

remote swallow
#

not enough cpu cycles

young knoll
#

Wait I can do one better

worldly ingot
#

Though I'm not confident that EntityInteractEvent has an action associated with it like the player event does

young knoll
#

method() {
e.setCancelled(e.getAction() == Action.PHYSICAL && block != null && block.getType() == Material.FARMLAND);
}

remote swallow
#

nope

#

straight to jail

young knoll
#

:D

quaint mantle
#

lol

young knoll
#

Also yes you can cancel trampling with the entity event

remote swallow
#

choco ban him

#

quickly

worldly ingot
#

WorldGuard would like a word

quaint mantle
fringe yew
#

and it isn't even wrapped inside a code block

quaint mantle
#

ah i change to entity

#

now clicked block not work

#

What is used instead?

worldly ingot
#

Yeah it has no associated action or other data. Honestly not sure why

remote swallow
#

ill let choco win the javadoc race

quaint mantle
#

getblock ?

young knoll
#
        if (event.getEntityType() != EntityType.PLAYER && event.getBlock().getType() == Material.FARMLAND) {
            event.setCancelled(true);
        }
    }```
#

Tis what I use

remote swallow
#

no @EventHandler

young knoll
#

No because it's executed as a consumer

remote swallow
#

straight to hell

#

9th layer

#

choco is back up on the 1st

fringe yew
#

wait so does the argument array not include the subcommand?

remote swallow
#

it does

#

/cmd arg another even more args

young knoll
#

/command arg0 arg1 arg2

remote swallow
#

arg, another, even, more, args is the array

fringe yew
#

ok good

fringe yew
#

not command

remote swallow
#

yeah

#

arg0 is the sub command

fringe yew
#

/example subcommand a b c

remote swallow
#

/command is still a command

fringe yew
#

yeah

#

kk

#

ty

#

and i'm assuming array.length starts at 1 not 0?

remote swallow
#

yeah

fringe yew
#

okay

#

i'm used to lua where arrays and such start at 1

remote swallow
#

lul

fringe yew
#

confusing mess

young knoll
#

The length can be 0 if there are no args

quaint mantle
#

i would like help for the codes without knowing java, am i ban from this server?

#

this question is weird but i banned from paperdc for this reason

young knoll
#

?learnjava

undone axleBOT
quaint mantle
#

If there is such a rule here, I will not ask questions.

river oracle
#

No but you'll get learn Java

remote swallow
river oracle
#

Wait papermc bans for that? Man they really don't fuck around

quaint mantle
#

what subject should i finish in java to write code like you?

young knoll
#

I would cover all the basic types and such

#

You don't need to cover all the fancy stuff like reflection just to make a plugin

remote swallow
#

arrays, lists, method types, static aboose, class types

quaint mantle
#

i watched this videos 2 times

young knoll
#

I would also look into maps

#

They are pretty important for plugins

quaint mantle
#

road map ?

remote swallow
#

hash maps

young knoll
#

The map data type

#

It's for storing key->value mappings

quaint mantle
#

can u give me video for this

#

i will check and learn

#

oh i found

weak meteor
young knoll
#

Is this your plugin

weak meteor
#

yep

#

theres the code

young knoll
#

You don't have a messages.yml file in your jar

weak meteor
#

there7

young knoll
#

Or it's in the wrong place

weak meteor
young knoll
#

Are you building it properly

#

With either maven/gradle

weak meteor
#

wanna see pom.xml?

visual laurel
young knoll
#

How do you build the jar

#

Alright that should be good

weak meteor
#

lemme rebuild

young knoll
#

Check the exported jar to make sure the file is there

weak meteor
#

it is

#

how do i make to not compile a shaded?

#

its stressing me out

young knoll
#

And then remove the shade plugin

#

Since you aren't actually shading anything

weak meteor
#

okay

#

but the problem

#

what can i do

remote swallow
#

how do you save the file

weak meteor
#

load method

remote swallow
#

im taking a wild guess its loading the jar that doesnt have the file

weak meteor
#

it does save config.yml

#

but doesnt save messages

young knoll
#

It's looking for plugins/Fluorite/messages.yml

#

I'm guessing the path for yours is just messages.yml

weak meteor
young knoll
#

Yeah that's wrong

#

You should just be passing "messages.yml" to saveResource

remote swallow
#

save resource should be saveResource("messages.yml")

weak meteor
#

oh

#

okay

#

thanks

remote swallow
#

and you probably want to cache the file

visual laurel
weak meteor
#

good?

#

i know that shouldnt be like that

#

but i dont wanna

remote swallow
#

better, but you shoud cache the file

weak meteor
#

move code

weak meteor
#

on how to cache files

#

i was thinking

#

method like

remote swallow
#

you have a private final File file

weak meteor
#

i doesnt)?

remote swallow
#

you make one

#

and now you have cached the file

weak meteor
#

oh

#

ok

#

thanks

young knoll
#

Local variables aren't in the heap

#

But yeah

quaint mantle
#

can i make this shorter?

pseudo hazel
#

yes but it would almost be pointless

quaint mantle
#

sry i wanna learn coding rules

pseudo hazel
#

wdym

#

well if you dont want to learn coding rules idk why you are making a plugin xD

#

anyways you can just extract it into a function

#

but like I said, its like pointless

#

this is already pretty consise

quaint mantle
visual laurel
pseudo hazel
#

reformat the file

#

youll see

visual laurel
#

ah, yeah thanks

quaint mantle
#

guys i have a question
i will cancel event for cactus growth
and add delay after check cactus up if up is air will add new cactus block
now this methods works all cactus in world?

pseudo hazel
#

yes if you do it right

quaint mantle
#

if i don't add ? check chunk or world ?

pseudo hazel
#

idk

#

idk what a chunk has to do with it

quaint mantle
#

add new cactus if player in the same chunk

pseudo hazel
#

the grow event will be called for all cacti that are loaded if that is what you are asking

quaint mantle
#

yes

ancient plank
neon turret
fringe yew
#

what is the latest version of the spigot api (plugin.yml is complaining)

#

is it 1.19.4-R0.1

eternal oxide
#

1.19

fringe yew
#

ty

quaint mantle
#

why this not work ?

#
    public void cactus(BlockGrowEvent e) {
        Block block = e.getNewState().getBlock();
            if (block.getType() == Material.CACTUS) {
                e.setCancelled(true);
                Player player = (Player) Bukkit.getOnlinePlayers();
                player.sendMessage("test");
            }
        }```
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.

quaint mantle
#

alright but

#

event isnt cancelling

quaint mantle
#

what

#

this is b ot

#

BRO i need sleep

storm isle
#

does this code work?

                player.sendMessage("test");```
#

when u run it does it send the message and not cancel the event or it doesnt do anything?

tall furnace
#

no, not really

#

Bukkit.getOnlinePlayers(); cannot be cast to Player

storm isle
#

ik i was asking him

tall furnace
#

He should have gotten a ClassCastException in his console

storm isle
tall furnace
quaint mantle
#

but didnt work

tall furnace
#

The event has no player to get. If you need a notif, use Bukkit.broadcastMessage or Bukkit.getPlayer("Name")

storm isle
#

yea i just saw that

tall furnace
young knoll
#

Also if you aren’t getting an error it may not be running at all

#

Is the event registered

echo basalt
#

ehh

quaint mantle
echo basalt
#

Not a fan of that naming scheme

#

and yeah I do see the issue

quaint mantle
storm isle
#

thats the only way you can register them but you could do a private void and than just call it on the onEnable method

young knoll
#

There are more advanced ways but I wouldn’t worry about them

storm isle
#

so like this

getServer. blah
}```
echo basalt
#

ehh

quaint mantle
#

alright i understand but

echo basalt
#

just stick to the basics

quaint mantle
#

why my cactus method isnt working ? 😢

#

do i need check if Ageable ?

echo basalt
#

I'm literally too hungry and sleep deprived to write up a proper explanation but

fringe yew
#

when i run my command this shows up in chat.

#

everything else works fine

storm isle
#

return true

fringe yew
#

ok

echo basalt
#

getBlock.getType will return the outdated type because the type hasn't changed internally (usually happens with cancellable events)

#

So get the type from the new blockdata instead of routing through getblock

strange rain
#
for (PotionEffect effect : effectList) effect.apply(plr);

Why this no work

echo basalt
#

your effectList could be empty

strange rain
#

Not empty

#

already tested

echo basalt
#

you sure?

strange rain
#

Yes

#

Things around it work too

echo basalt
#

up to their coding style, brackets are somewhat debatable

#

it literally performs the same

#

just a readability thing

#

I personally use them but there was a long period where I didn't

strange rain
#

Because I am cluesless

#

is there something niche with potion effects?

young knoll
#

Well what’s in effectList

echo basalt
#

I'd just player#addPotionEffect just to be sure

#

other than that add a sout in each iteration just for sanity

strange rain
echo basalt
#

make sure that no other effects of the same type are present

strange rain
#

not the potion tho

strange rain
#

Its on the same line

echo basalt
#

it literally has the same effect as adding an empty line

strange rain
#
void method() {
  for (.. : ..) doSmth();
  doSmthElse();
}

//vs

void method2() {
  for (.. : ..) {
    doSmth();
  }
  doSmthElse();
}
#

They flow the exact same to me

#

ngl

#

Skill issue

strange rain
echo basalt
#
public void doSomething() {
  int[] iterations = {-1, 0, 1};

  for(int number : iterations) {
    printNumber(number);
  }

  String whatever = "Joe mama";
}

vs

public void doSomething() {
  int[] iterations = {-1, 0, 1};

  for(int number : iterations)
    printNumber(number);

  String whatever = "Joe mama";
}
#

is mostly the same

#

what I am against

#

is

#

if(whatever) return; these 1 liners

#

but overall just follow google style and fuck off

strange rain
#

Really not. Dude I have been programming in java not that long. It reads the exact same for me.

It is literally by definition a: Skill Issue

strange rain
#

Bruh search up skill issue

#

tell me what it is

young knoll
#

Wild

strange rain
#

I only came here to ask why it wasn't working. Not to be called a slur

#

So chill out both of ya

young knoll
#

Things getting heated over 2 curly bois

strange rain
#

That is an opinion you're stating like a fact. If you struggle to read stuff like that it is a S K I L L I S S U E

#

Thats what flow is

#

Opinion not a fact again

#

Let people have their opinion. At can someone tell me why these potion effects don't work?

tall saffron
#

I dont get tabcompleters, i want the tabcompleter to set /simples toggle scoreboard but it obiouslly doesnt work

strange rain
#

Then why are you calling me names

tall saffron
# tall saffron I dont get tabcompleters, i want the tabcompleter to set ```/simples toggle scor...
package commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;

import java.util.ArrayList;
import java.util.List;

public class MainCommandTAB implements TabCompleter {

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias,  String[] args) {
        if(args.length == 1){

            List<String> arguments = new ArrayList<>();
            arguments.add("reload");
            arguments.add("version");
            arguments.add("support");
            arguments.add("toggle");

            return arguments;

        }
        if(args.length == 2 && args[1].equalsIgnoreCase("toggle")){

            List<String> arguments = new ArrayList<>();
            arguments.add("scoreboard");

            return arguments;

        }
        return null;
    }
}
``` this is mi code
undone axleBOT
strange rain
#

Quote from where?

tall saffron
strange rain
#

It is you're acting like it ruins all of java.

#

{} <-- theese dudes

tall furnace
tall furnace
#

Lambdas are debatable themselves.

strange rain
#
plr.setSaturation(clamp(plr.getSaturation() + saturation,0, 20));
plr.setFoodLevel((int) clamp(plr.getFoodLevel() + hunger,0, 20));
plr.setWalkSpeed(0.2f);
plr.setCooldown(mainHandItem.getType(), 0);
plr.getInventory().setItemInMainHand(finalUpdateItem);
plr.playSound(eyeLoc, Sound.ENTITY_PLAYER_BURP, 2, 1);
for (PotionEffect effect : effectList) effect.apply(plr);

To me this just seems more slik ngl

#

oop tab moment

undone axleBOT
strange rain
#

Wouldn't take float

tall furnace
#

I personally dislike that bracket format. I put my opening bracket at the end of a line, never the beginning.

young knoll
#

That’s how java does it

tall furnace
#

Java is life

strange rain
tall furnace
strange rain
#

Yes

tall furnace
#

I've never used effect#apply

strange rain
#

It letter

#

I show code

tall furnace
#

One thing though is if the player already has speed 1 and you add potioneffect speed 1, it will give them speed 2.

strange rain
strange rain
tall furnace
young knoll
#

We need more than 2 lines

strange rain
tall furnace
#

oof

#

Feel free to show your own code, where it is called from, etc.

strange rain
agile anvil
#

No

#

What's "this"

#

What is the context?

strange rain
#

Thats not my code thats spigot

#

I was just showing what it did

agile anvil
#

Oh

strange rain
#

any ideas @agile anvil ?

agile anvil
#

Well that has to be something outside these few lines that interferes

strange rain
tall furnace
#

Where is effectList instantiated?

strange rain
#

effectList is in the scope

#

effectList does have contents that are potion effects

tall furnace
#

Have you printed out the contents to be certain of that?

strange rain
#

Yes

tall saffron
#

how can i make this updatechecker work even if the version is GREATER than the plugin one, cause rn it sends you are on the latest plugin version, only when you are on same one that on the spigot one, ```java
//UpdateChecker

    new UpdateChecker(this, 109934).getVersion(version -> {
        if (this.getDescription().getVersion().equals(version)) {
            System.out.println("You are on the latest plugin version!!");
        } else {
            System.out.println(ChatColor.RED+"There is a new update available!");
            System.out.println(ChatColor.GREEN+"We highly recommend you to update to the newest one here: https://www.spigotmc.org/resources/"+"109934");
        }
    });```
strange rain
#

There are the potion effects.

hazy parrot
opal juniper
#

^

hazy parrot
#

depends on what your version looks like

tall furnace
young knoll
#

Are they instant effects perhaps

strange rain
strange rain
#

Its not a command

tall furnace
#

After applying the effects to the player, print out the list of effects the player has. That will determine whether they are being set in that instant but being immediately changed via some other software.

tall furnace
#

The method potionEffect#apply returns either true or false, based on whether it could apply.

strange rain
#

Oh

#

Hmm

#

Alright Ill test that

#

I mean I know its not applying

tall furnace
#

If it returns false, it is because something was preventing it. If it returns true, it means something changed it immediately after.

#

Gotta know

strange rain
#

Hmm alr

#

worth a shot

#

Dude thats over.

#

Nvm

tall furnace
#

One of the things it took me a while to get used to when learning C# was that friggin format. I do it to remind myself it's not Java.

#

Keeps me from tryna use Java methods

#

CPP... I have opinions on that language XD

#

Biggest issue is they limited variable name lengths because back in the day that mattered

#

So now all their libraries have garbage naming

#

I wanna learn Rust

strange rain
#

From what he has made with it I can agree with him.

#

No comment

tall furnace
#

Well... thing is I wanna make an OS. Not really a Go project.

strange rain
#

FUUUUN

#

I feel so dumb

#

Alr turns out can't set potion effect async

#

so

agile anvil
#

But yeah

strange rain
#

shoulda said async tho

young knoll
#

You should have gotten an error

agile anvil
#

You should consider that you can't impact the game async

tall furnace
# tardy delta gl

ty, ty. Fundamental projects are fun to me. I made a web language once with a friend, that was pretty great. Interpreted, not compiled... there are downsides but for web it's fine.

strange rain
tall furnace
strange rain
#

imma try

tall furnace
#

Chat can be async but anything that can physically affect others should always be sync, keeps from screwing with the server

strange rain
#

Ty

#

I learned something new! (new skill acquired sound effect)

tall furnace
#

bliiingg

strange rain
#

Now imma go do /reload 🤭

#

IT workS!

#

TITISadgsdf

#

YES!

#

I am not kidding that is the dumbest issue I have had in a while

#

Like first shot everything worked beside that

young knoll
#

There’s actually a fair amount that can be done async

tall furnace
strange rain
#

Now I can eat an axolotl!

young knoll
#

But if you don’t know whether it’s safe it’s best to just avoid it

young knoll
#

Things that should be done async is mostly just IO and web requests

strange rain
#

Rn I am eating nametags

#

Wait wtf is async anway

tall furnace
#

Some things used to be async by default and they've updated them due to lag issues.

young knoll
#

Off the main thread

strange rain
tall furnace
young knoll
#

It runs several side threads

#

But yeah

tall furnace
#

fair

strange rain
tall furnace
tall furnace
#

"for each" loops can be slow

strange rain
#

cool boi stuff

tall furnace
#

When you can, I advise for(int i) style

#

can't remember names of things

#

Got alzheimers or smth idk

#

Worst memory

strange rain
#

my life was complete

tall furnace
#

Called a colon

strange rain
young knoll
#

For each vs regular for loops is a micro optimization

tall furnace
#

If you're going to loop through every block in X area, I'd recommend it

hazy parrot
#

foreach is using iterator internaly, so there is overhead

tall furnace
#

Can easily hit tens of millions

young knoll
#

The overhead is incredibly small

#

It’s not worth the sacrifice in readability unless you are writing at an enterprise level or something

strange rain
#

I want IDE that knows micro optimizations so I can code the way that makes me happy

young knoll
#

The compiler knows micro optimizations

strange rain
#

heh

strange rain
tall furnace
young knoll
#

Pretty much

chrome beacon
strange rain
young knoll
#

Don’t worry yourself too much until people start throwing spark reports at you saying your plugin cuts their tps in half

#

:p

strange rain
#

I just need the gratification

#

Nots like my plugins are paid

#

Shoot imma bout to get dissed

bronze notch
#

Hi, for my vote listener, I'm fixing an issue where on a bungee network with voteforwarder to all subservers, a vote is queued, even though the player is online on one of the servers.
I found the onlySendToJoinedServer setting in NuVotifier on the proxy. That's nice, but if the player is not online, this will of course not work.
What fix would be best: ignoring a new queue request if the one was already made within x amount of milliseconds? Or making the queued vote unique to a server, so the rewards are not processed multiple times on one subserver (which was the initial issue)?

Thanks for thinking with me!

young knoll
#

Pretty much anything your plugin is doing is going to be a small fraction of what the server is doing anyway

chrome beacon
young knoll
#

💀

chrome beacon
#

See CMI for example

#

That's some real bad code

strange rain
young knoll
#

Yes

strange rain
#

OML
!

#

Scammer time!

#

less goo

young knoll
#

Paid plugin code does get reviewed but I imagine it would have to be pretty bad to get denied

strange rain
young knoll
#

Plus it only gets reviewed on the initial posting, not on updates

tall furnace
#

I never had mine declined and tbh given when I made those plugins... pretty inefficient. I was new.

strange rain
#

Server Owners: its paid so it must be good

tall furnace
#

Now I just make everything free.

young knoll
#

Yes paid = better

#

Facts

#

||/s||

strange rain
young knoll
#

You can do the same with spigot forks

tall furnace
#

McMMO is worth paying for, I will say. So is featherboard. I don't pay for plugins often but I own both of those.

young knoll
#

Except instead of $20 it’s $200

strange rain
#

Check my bio and don't quote me.

strange rain
tall furnace
tall furnace
#

You should look at the like 9 config files it makes sometime XD

#

everything is adjustable

strange rain
#

So basically make your plugin as dumbed down as you can well still making it as customizable as possible for a good plugin?

tall furnace
#

Customization is key. It prevents having to make little adjustments to please your users. Let them adjust it.

#

Eventually your plugins will be 90% just making complex inner code to handle a variety of config options so your users can essentially write your plugin for themselves.

strange rain
tall furnace
strange rain
#

Ahh

#

right

#

@tall furnace can i just switch dependency in pom.xml from spigot to paper and it work?

tall furnace
#

I never use xml, don't ask me XD

strange rain
#

😢

tall furnace
#

I don't use maven or gradle

strange rain
#

U compile urself?

tall furnace
#

I use Eclipse, it compiles for me

young knoll
#

Wait there’s a quote for this

tall furnace
#

Compiling through cmd prompt sucks

mellow pebble
#

i came across a problem in my UHC plugin when i want to create .yml file for scoreboards it works great it really has been made and everything is written inside and it is saved properly but i also wanted to set in config.yml Scoreboards-set to true and save it so next time plugin is ran it wont wipe out the scoreboard user has configured and when i change it to be true that works but when i save it it wipes out whole config.yml content from before and just has Scoreboards-set set to true

chrome beacon
#

?configs

undone axleBOT
strange rain
#

?bebe

mellow pebble
tall saffron
#

How can i create multiple configuration files with different names, and acces to them

young knoll
#

Found it

tall furnace
strange rain
#

Or not

chrome beacon
strange rain
#

upto you

tall furnace
chrome beacon
#

What if you have to share the project

mellow pebble
#
        Vexaris.plugin.saveDefaultConfig();
        File configFile = new File(Vexaris.plugin.getDataFolder(), "config.yml");
        Vexaris.plugin.getConfig().set("Messages-Set", true);
        try {
            Vexaris.plugin.getConfig().save(configFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
#

i know it is weird

#

wasnt like this at first

#

but yeah

tall furnace
chrome beacon
#

Github won't make it automagically get all the dependencies and set everything up

young knoll
#

See if you go with a paid open source plugin

tall furnace
young knoll
#

You need to make sure it’s nearly impossible to self compile so you get more sales

mellow pebble
# tall furnace ` that one?
        Vexaris.plugin.saveDefaultConfig();
        File configFile = new File(Vexaris.plugin.getDataFolder(), "config.yml");
        Vexaris.plugin.getConfig().set("Messages-Set", true);
        try {
            Vexaris.plugin.getConfig().save(configFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
chrome beacon
#

^^

young knoll
#

True

tall furnace
young knoll
#

Remind me to manually upload any premium plugins I ever make to ShadySpigot with silly annoying stuff thrown in to annoy people

#

Lol

tall furnace
#

big brain

young knoll
#

Every 10 minutes the plugin sends a link to download Raid: Shadow Legends

tall furnace
#

Just specify in latin

young knoll
#

I think one dev purposefully uploads outdated versions to NoirSpigot

#

Might be the McMMO dev iirc

tall furnace
#

blancoSpigoto

livid hearth
#

hello

desert tinsel
#

what s the difference between Player#updateInventory() and Player#openInventory(sameInventory) ?

tall furnace
mellow pebble
livid hearth
#

i just got the app for dev can someone help me a bit

undone axleBOT
young knoll
#

I imagine opening the same inventory will reset the cursor

tall furnace
young knoll
#

Updating it shouldn’t

#

Or you can even just setContents the inventory, you generally rarely need to use updateInventory

#

Pretty much

desert tinsel
#

ok, thanks

young knoll
#

But we have api for that now

#

Woo

#

Iirc yes

#

It’s fairly recent, one sec

#

Ah dang I thought it was

tall furnace
#

1.20 maybe?

vast ledge
#

Just quick question if anybody knows a better way to cache player ranks from a MongoDatabase, then to create a abstract class which gets extenden by looping throught all ranks in the database?

young knoll
#

It is merged

#

May 4th

#

InventoryView#setTitle

tall furnace
young knoll
#

That’s the cb commit, which is where all the interesting stuff is anyway

#

Bukkit has some code

tall furnace
young knoll
#

But most of it is the the api abstraction

tall furnace
#

ye

#

Can't remember names of things so I gotta describe instead

#

I understand them, just always prefer a proper if/else

#

Is it faster to use ternary?

#

Eh I'll just stick to if else then

young knoll
#

It’s just shorter

tall furnace
#

Same reason I don't use lambdas

#

gross things

vast ledge
#

#lamdaisgood

tall furnace
#

lambda is gross af tho, hides so much good stuff

#

Hides the curlies yknow?

vast ledge
#

Why you like the curlies...

tall furnace
#

I like to see
Runnable{ run(){} }

vast ledge
#

It jsut looks cleaner

#

WWithout em curlies

tall furnace
#

I wanna see THE CURLIEZZZZ

vast ledge
#

I also like curliez BUT NOT TERE

tall furnace
#

Gimme dem squigglez

#

They're gorgeous little creations

mellow pebble
#

@tall furnace it is the same thing still

tall furnace
tall saffron
#

Where can i learn about configs cause iw ant to create a message.yml and dont know how 😦 ```java
//Config

    //Load message.yml

    messages = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "messages.yml"));```
mellow pebble
#

but it still just wipes out everything from config.yml

#

and just sets that to true

vast ledge
#

Its butifull

vast ledge
#

look at ma curliez

#

They nice

#

but clean

tall furnace
vast ledge
tall furnace
tall furnace
tall furnace
vast ledge
#

Thats why i wrote my own config handler cus i cant deal with yml xD

#

Im probably jsut to stupid, but somehow its easier to write my own than to understand it

tall furnace
#

yml is byootiful

vast ledge
#

DO YOU DARE

#

UPOSE

#

MY

#

JSON

tall furnace
#

To be fair, binary is faster and I have used wait JSON?

#

whyyy

mellow pebble
# tall furnace Can you show your updated code?
public void setup(File scenariosFile, FileConfiguration scenariosFileConfig) throws IOException {
        scenariosFileConfig.set("Timber", false);
        scenariosFileConfig.set("CutClean", false);
        scenariosFileConfig.set("NoClean", false);
        scenariosFileConfig.set("TimeBomb", false);
        scenariosFileConfig.set("SafeLoot", false);
        scenariosFileConfig.set("TripleOres", false);
        scenariosFileConfig.set("DoubleOres", false);
        scenariosFileConfig.set("TripleExp", false);
        scenariosFileConfig.set("LuckyLeaves", false);
        scenariosFileConfig.set("Fireless", false);
        scenariosFileConfig.set("NoFallDamage", false);
        scenariosFileConfig.set("Goldless", false);
        scenariosFileConfig.set("Diamondless", false);
        scenariosFileConfig.save(scenariosFile);
        Vexaris.plugin.getConfig().set("Scenarios-Set", true);
        Vexaris.plugin.saveConfig();
    }
tall furnace
#

Vexaris.plugin.getConfig() != scenariosFileConfig

tall furnace
#

Basically you are creating an EMPTY yaml, setting some values, then overwriting the file with it.

#

So create your YamlConfiguration, load it in, THEN set values and save.

young knoll
#

Json isn’t good for configs

#

Sure yaml is picky about spaces but with json you have all those wacky {}

#

Spigot toml support when

quiet ice
#

All valid json is valid yaml

young knoll
#

Other way around iirc

quiet ice
#

HOCON would be the only config format I'd use besides JSON or YAML (though I'm not a fan of latter for there not being any nice implementations that I know)

young knoll
#

Forge uses toml now

vast ledge
#

Look at it, my beatufil JSON

young knoll
#

Toml looks nice

quiet ice
young knoll
#

Fuck it

#

Python configs

mellow pebble
young knoll
#

Don’t ask how or why

vast ledge
#

Python

#

no

#

NO

#

NONOOOOO

tall furnace
quiet ice
#

Want to do arrays of random objects? No - not possible. Because fuck you, that's why.

tall furnace
mellow pebble
vast ledge
#

At that point, just encrypt your files into data.enc

tall furnace
vast ledge
mellow pebble
#

dont know why but is easier to me

vast ledge
#

HA

#

I SAID IT

#

JSON IS EASIER

#

MUAHAHAHAH

mellow pebble
#

well it is not easier i mean both is like simple since you have key and value right

vast ledge
#

yes

#

The "Key" is the main identifier, for which you can search Lists/HashMaps, the "Value" is a value...

tall furnace
#

To get the yamlConfiguration for the config.yml file, just use Vexaris.plugin.getConfig() like you did. To save it, just use Vexaris.plugin.saveConfig().

mellow pebble
tall furnace
#

If you are using the config.yml, you never need to load it. It is loaded when the plugin is loaded, and it is referenced only via plugin.getConfig().

mellow pebble
tall furnace
mellow pebble
tall furnace
vast ledge
#

Is there not a tutorial on this in the spigot wiki?

tall furnace
tall furnace
vast ledge
#

ye

mellow pebble
eternal oxide
#

getConfig().options().copyDefaults(); does nothing

eternal oxide
#

it returns a boolean

#

it changes no settings

eternal oxide
#

Notice the difference getConfig().options().copyDefaults(true);

mellow pebble
eternal oxide
#

comments have to be reset if you use set on a section

sullen marlin
#

comments are kept by default in recent versions

#

in old versions, good luck lol

mellow pebble
#

well this is 1.8.8 because who makes UHC in 1.19.4 right ?

eternal oxide
#

lol

#

no comments for you

mellow pebble
#

WHY

eternal oxide
#

because 1.8

mellow pebble
#

legacy

#

i know

#

shit

#

but

#

yes

quaint mantle
#

how can i get the player count

sullen marlin
#

.size()

quaint mantle
#

thx

tall saffron
#

?paste

undone axleBOT
tall saffron
chrome beacon
tall saffron
#

Oh yeah, thanks i checked it was wrong i dont know why, but like it was grey, i created it again and now it works

#

i forgot a this.

quaint mantle
#

can i add hover to this ?

young knoll
#

No

#

Not with a plugin

quaint mantle
#

i need help with logic. I want to limit a area with water. When the player touches the water i want them to somehow be blocked, moved back or what ever

young knoll
#

Keep track of the last land location

#

And when they enter the water tp them back to said location

quaint mantle
#

but if they jump, it would just keep tp them above the water

young knoll
#

Hence why I said keep track of the last land location

#

The last location with a solid block below

quaint mantle
#

can you check for that?

#

if a block is solid

young knoll
#

Sure

#

There are several methods to check if a block has collision, is a full cube, etc

quaint mantle
#

okay thx

#

what would you sugest to keep track of the players last on land location

young knoll
#

Just a map is fine

storm scaffold
#

How do I get the coordinates of an advancement in the advancement gui from a Packet with the PacketType PacketType.Play.Server.ADVANCEMENTS
Using ProtocolLib

sullen marlin
#

Wat

worldly ingot
#

AdvancementDisplay has an x and y coordinate. Not sure why you'd need to do this with packets

desert tinsel
#

Hi, I have this piece of code: java ItemStack from = e.getWhoClicked().getInventory().getItemInMainHand(); System.out.println(from.getItemMeta().getCustomModelData()); ItemMeta meta = item.getItemMeta(); meta.setCustomModelData(rodType.getCustomModelDataID()); item.setItemMeta(meta); System.out.println(item.getItemMeta().getCustomModelData()); System.out.println(from.getItemMeta().getCustomModelData()); ,but from first sout I get 101, then 102 and 102, why? Where from.getItemMeta().getCustomModelData() is changed?

#

rodType.getCustomModelDataID() returns 102

worldly ingot
#

?

#

You're changing it though

#
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(rodType.getCustomModelDataID());
item.setItemMeta(meta);```
#

So yeah, 101, 102, 102, 102 makes sense

desert tinsel
#

Im changing the item's meta, not the from's meta

worldly ingot
#

Oh. What's item defined as?

desert tinsel
#

the same item from main hand as from

worldly ingot
#

getItemInMainHand() returns a mirror

#

So if you make a change to one of the items, the other will be updated as well because it's backed by the NMS stack

#

If you want to update the stack without updating another, you'll want to clone it

desert tinsel
#

but if I update just item, not the item from main hand

young knoll
#

It’s the same item

worldly ingot
#
ItemStack first = player.getInventory().getItemInMainHand();
ItemStack second = player.getInventory().getItemInMainHand();```
#

They're different Bukkit instances but backed by the same NMS instance

#

Changes to first will be reflected in second

desert tinsel
#

so how can I make them different

worldly ingot
#

Clone them

#

.clone()

desert tinsel
#

thanks you

quaint mantle
#

can i control world datapacks with plugin ?
example /change plains grass biome color) -> we can do this with datapacks

young knoll
#

No

#

Not with the api anyway

quaint mantle
#

but i see some worldgen plugins

young knoll
#

✨ NMS ✨

quaint mantle
#

this biome makes custom biomes

quaint mantle
young knoll
#

net.minecraft.server

quaint mantle
#

so this client side ?

young knoll
#

It’s basically just server internals

#

?nms

signal kettle
#

Any idea why event run two times?

    @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void FruitTreeBoneMeal(final OraxenFurnitureInteractEvent event) {
        Block block = event.getBlock();
        Player player = event.getPlayer();
        ItemStack item = event.getPlayer().getInventory().getItemInMainHand();

        FurnitureMechanic furnitureMechanic = event.getMechanic();

        ArrayList<String> RedAppleTree = new ArrayList<String>();
        RedAppleTree.add("red_apple_tree_stage_1");
        RedAppleTree.add("red_apple_tree_stage_2");
        RedAppleTree.add("red_apple_tree_stage_3");
        RedAppleTree.add("red_apple_tree_stage_4");
        RedAppleTree.add("red_apple_tree_stage_5");
        RedAppleTree.add("red_apple_tree_stage_6");
        RedAppleTree.add("red_apple_tree_stage_7");

        if (block == null || block.getType() != Material.BARRIER) return;
        if (event.getHand() != EquipmentSlot.HAND || event.getItemInHand().getType() != Material.BONE_MEAL) return;
        if (!RedAppleTree.contains(furnitureMechanic.getItemID())) return;

        Location location = block.getLocation();
        if (player.getGameMode() != GameMode.CREATIVE)
            reduceItem(item);
        player.playSound(location, Sound.ITEM_BONE_MEAL_USE, 100, 1.0F);
        OraxenFurniture.remove(location, event.getPlayer());
        player.sendMessage("elo");

        switch (furnitureMechanic.getItemID()) {
            case "red_apple_tree_stage_1" -> OraxenFurniture.place(event.getBaseEntity().getLocation(), "red_apple_tree_stage_2");
            case "red_apple_tree_stage_2" -> OraxenFurniture.place(event.getBaseEntity().getLocation(), "red_apple_tree_stage_3");
            case "red_apple_tree_stage_3" -> OraxenFurniture.place(event.getBaseEntity().getLocation(), "red_apple_tree_stage_4");
            case "red_apple_tree_stage_4" -> OraxenFurniture.place(event.getBaseEntity().getLocation(), "red_apple_tree_stage_5");
            case "red_apple_tree_stage_5" -> OraxenFurniture.place(event.getBaseEntity().getLocation(), "red_apple_tree_stage_6");
            case "red_apple_tree_stage_6" -> OraxenFurniture.place(event.getBaseEntity().getLocation(), "red_apple_tree_stage_7");
        }
young knoll
#

The interact event is fired for both hands

#

I imagine the same applies to the Oraxen interact event

signal kettle
#

yes but I speciefie Hand

young knoll
#

No idea then

#

Ask Oraxen

signal kettle
#
       if (event.getHand() != EquipmentSlot.HAND || event.getItemInHand().getType() != Material.BONE_MEAL) return;
quaint mantle
#

does this method have for two arms?

#

wait i'll check docs

wary topaz
#

anyone wanna make a plugin together? lol

signal kettle
#

isn't there for eq just getItemInMaindHand() or getItemInOffHand?

quaint mantle
#

getHeldItemslot gets offhand?

young knoll
#

getItemInOffHand

quaint mantle
#

but i want to make for two arms

young knoll
#

getItemInMainHand is the main hand

#

getItemInOffHand is the offhand

quaint mantle
#

yes

young knoll
#

And if you’re in the interact event getItem is whichever hand is currently being used in the event

quaint mantle
#

take both?

young knoll
#

At least I think it’s getItem

quaint mantle
#

alright i will try

quaint mantle
#

don't be a mad but i can't use getitem

#

i do something for use ?

signal kettle
#

I will try with this one

ItemStack item = event.getItemInHand();
        if (block == null || item == null || item.getType() != Material.BONE_MEAL || block.getType() != Material.BARRIER) return;
        if (event.getHand() != EquipmentSlot.HAND) return;
young knoll
undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

signal kettle
#

okay still same isue💀

young knoll
#

Like I said you’re best off asking Oraxen

#

Most of us know nothing about their events

quaint mantle
#

ahh i need check two hand now

#

thats boring

signal kettle
#

try this:
ItemStack item = event.getItemInHand();

young knoll
#

It’s just PlayerInteractEvent#getItem

#

Like I sent

quaint mantle
#

im confused

#

😄

quaint mantle
#

ah

#

wait

signal kettle
#

it get whatever hand you are using

quaint mantle
#

deprecated

#

maybe docs tell me how to use this

young knoll
#

Again

#

It’s PlayerInteractEvent#getItem

#

Not player.getItem

signal kettle
quaint mantle
#

omg

#

sry

quaint mantle
#

I'm so careless

young knoll
#

Javadocs are your friend

#

Gotta use em

quaint mantle
#

how can i cast e.getitem ?
get item gets two hand but my second hand may be empty

topaz atlas
#
[ERROR] /C:/Users/DuttR/eclipse-workspace/onutillities/src/main/java/com/onutillities/SignEvents.java:[197,51] no suitable method found for getPlayer(org.bukkit.entity.Player)```
#

One sec

young knoll
topaz atlas
#
            PlayerInteractEvent[] events = { PlayerUno, PlayerDos };
            if (PlayerUno.getClickedBlock().getState() instanceof Sign && PlayerDos.getClickedBlock().getState() instanceof Sign) {
                pastSign = (Sign) PlayerUno.getClickedBlock().getState();
                Sign sign =(Sign) PlayerDos.getClickedBlock().getState();
                firstPlayer = (Player) PlayerUno.getPlayer();
                SecondPlayer =(UUID) PlayerUno.getPlayer().getUniqueId();
                
                ClickedEvent phc = new ClickedEvent(config, logger, this.instance, sign, firstPlayer,
                        SecondPlayer, pastSign);```
^ the error happens here
quaint mantle
#

oh

#

yh i realized

#

why doesnt it just say plugin yml ttho

young knoll
#

You need to specify a command

topaz atlas
# topaz atlas ``` public void StartEvent(PlayerInteractEvent PlayerUno, PlayerInteractE...
        if (e.getClickedBlock() != null) {
            if (e.getClickedBlock().getState() instanceof Sign) {
                Sign sign = (Sign) e.getClickedBlock().getState();
                logger.log(Level.INFO, sign.getLine(0));
                if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Player1 Click]")
                        || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Player2 Click]")) {
                    eventSet.add(e);
                }
            }
        }
        this.logger.log(Level.INFO, Integer.toString(eventSet.size()));
        if (eventSet.size() == 2) {
            logger.log(Level.INFO, "duel started");
            PlayerInteractEvent[] events = eventSet.toArray(new PlayerInteractEvent[0]);
            eventSet.clear();

            // Player player1 = events[0].getPlayer();
            // Player player2 = events[1].getPlayer();

            // Create a new Duel instance
            Duels duel = new Duels(config, logger, instance);

            // Add the duel to the active duels set
            activeDuels.add(duel);

            // Call the StartEvent method within the Duel class
            duel.StartEvent(events[0], events[1]);
        }```
storm scaffold
quaint mantle
#

i made custom textures for leaves with distance
thats work like this
its distance is determined by how far the leaves from the wood
can i prevent to change distance ?

#

with any event ?

young knoll
#

Afaik, no

#

Maybe the physics event

quaint mantle
#

i see this method at one server

young knoll
#

Doesn’t mean there’s an event for it

quaint mantle
#

i'll try physics event

quaint mantle
#

how ?

#

can i do something without events in minecraft ?

young knoll
#

I imagine the easiest way would be using ProtocolLib to cancel the outbound packets

quaint mantle
#

oke

#

thanks for idea

wary mountain
#

does anyone have the dependency values for maven? (1.19.4)

young knoll
signal kettle
#

it's called HMCLeaves

young knoll
#

Reviews say high cpu usage during worldgen

#

Oh no please don’t tell me they are doing what I think they are

#

Oh dear they are

signal kettle
#

idk actually I didin't use it, just saying that I saw the plugin for that

river oracle
#

What did you find xD

young knoll
#

They poop ever single block in a chunk when it generates

#

Loop*

#

Heh, poop

signal kettle
#

could you say what's the problem btw in their plugin? Im curious

vocal cloud
#

Sounds about right

young knoll
#

They are looking to replace natural leaves

#

I get why they do it but it’s really not ideal

signal kettle
#

I mean it's okay for me bcs anyway I just pregen world before even server start so it should not be a problem I think?

#

or did this still be a thing after even world is pregened?

#

🤔

young knoll
#

Should be fine if you pregen

signal kettle
#

Also I wonder, sorry if its stupid question but im newbie in plugins coding

#

oh nvm actually

#

it was stupid question that I got an answer when trying to ask😅

wary mountain
#

is it possible to cancel packets like how it works in fabric

young knoll
#

Yes but not with the spigot api

#

Use ProtocolLib or PacketEvents

vocal cloud
#

Check if you can cancel by event first. I believe that ProtocolLib allows for packet cancelling.

young knoll
#

Yes

#

A lot of stuff is cancellable by event

wary mountain
young knoll
#

Did you add the repo

wary mountain
#

yeah

young knoll
#

Not sure

#

I’ve used it before just fine, but not with maven

wary mountain
#

hm

wary mountain
#

if so i might as well just ditch protocollib for now

#

im just making this for a friend.

young knoll
#

I only see one cancel thing, which is fire damage

#

Which you can do with the EntityDamageEvent

wary mountain
#

1.8 sword for him is basicalyl cancel packet

#

or cancel cooldown rather

young knoll
#

Just give it a really high attack speed attribute

wary mountain
#

oh yeah

wary mountain
#

i think i went overboard with this backend but is there a way to connect this to the actual event with the Cancellable object availible

#

im talking about doAction in specific*

young knoll
#

What?

wary mountain
#

and since im using my own interface i cant target it to any specific event

compact haven
#

it is an interface

#

what’s the end goal

#

like write some pseudo code of the api that you would like to achieve or something

wary mountain
#

the backend is for myself not an api

young knoll
#

You can just pass a generic Event

#

And then do instanceOf checks on that

#

Or you can get fancy with actual generics

river oracle
young knoll
#

Probably, but they are a bit more advanced if that’s an issue

compact haven
#

<T extends Event & Cancellable>

young knoll
#

I’m not sure there’s anything that is cancellable that doesn’t extend event

#

But yeah

compact haven
#

unsure where he would want that because I don’t understand the goal but 🤷‍♂️

compact haven
river oracle
compact haven
#

no he means there’s no class that extends Cancellable that doesn’t extend Event

#

(in the spigot API natively)

young knoll
#

Me on my way to make player cancellable

compact haven
#

😏 that’s what your Mom does

#

takes you in and takes you out

young knoll
#

Spigot 1.20: you can now cancel players (on twitter)

river oracle
#

player.setCancelled(true);

compact haven
#

all the tweeter birds are going to complain it took so long, after all twitter could cancel users forever now and we’re just getting the update

young knoll
#

We’ll use the twitter api to send a tweet cancelling them for something silly

#

Like using Kotlin

#

Or using gradle

compact haven
#

using gradle 😳

young knoll
#

Hey man some people have strong opinions on their jvm language

#

Or build tool

wary mountain
wary mountain
compact haven
#

look at the generic constraints I sent and let me know if that helps or if I misunderstood

wary mountain
#

as for do action most of those are either messing with cancellations or events in other ways

wary mountain
#

again this may not be the best backend and there is probably a better way to do this but i cant think of anything so 🤷‍♂️

#

so only when callOnCancel is true would that work with the constraints you sent

#

when its false it would just be any event

#

thats the reason i have the CancellableItems class

compact haven
#

then just check instanceof Cancellable at runtime or whatever

#

ngl I don’t understand what you’re doing still

#

but it sounds like you need different containers based on the return of a method?

#

in that case then yes you can just check instanceof at runtime

wary mountain
#

basically making a backend for this type of thing if you want me to be as broad as possible about it

compact haven
#

an ItemBuilder?

wary mountain
#

doAction or whatever it was

compact haven
#

yep 👍

wary mountain
#

though wouldnt that be ugly with a bunch of casts forced

compact haven
#

and the parameter type would be Event instead of Cancellable

wary mountain
#

yea

compact haven
wary topaz
#

omg I just used gradle for the first time, its so much better than maven

compact haven
#

not even latest, probs like j 14

wary mountain
#

oh thats nice

young knoll
#

Instanceof pattern matching is beautiful

wary topaz
compact haven
#

Hey Sir I think your folders are empty

wary topaz
#

lol

#

it was the template for this build

young knoll
#

Gotta censor the name

#

We might steal it

compact haven
#

next Hypixel as a GUI

#

when I was younger I tried to make an anime in PowerPoint

young knoll
#

Hypixel but it’s a website

#

Hypixel cookie clicker

compact haven
#

a java 6 website

young knoll
#

Naturally the best tool for websites

compact haven
#

with .html at the end of the location href

wary mountain
young knoll
#

PowerPoint anime sounds amazing

compact haven
#

www3.hypixel.art/cookie%20clicker.html

wary mountain
#

manga readers on bad wifi = powerpoint anime

compact haven
#

needs Flash to run

#

and Internet Explorer

#

but who doesn’t already use IE

young knoll
#

My grandpas deck has no pathetic cards Kaiba, but it does have this. The unstoppable Bill Gates!

compact haven
#

any chance I get @Dominick as my unique discord username

young knoll
#

2016

#

Hmmm

compact haven
#

kekw

young knoll
#

It’s a regular name so I doubt it

#

But maybe

compact haven
#

hopes will be held

#

Wait wtf

wary mountain
#

which one is it to remove fire damage only?

compact haven
#

December 2015

wary mountain
#

Fire or FIRE_TICK

compact haven
#

I swear to god Coll

young knoll
#

You’ll want both

wary mountain
compact haven
#

if you take it out of spite

young knoll
#

One is damage from standing in fire, one is damage from being on fire

worldly ingot
#

Yeah, the ticks after you're out of the fire

#

Hence, fire tick

young knoll
#

Out of the fire and into the still fire

worldly ingot
#

Into the fire and the flames

#

we carry on

compact haven
#

Choco how’s the dog

worldly ingot
#

Hold on I'm busy playing a wicked guitar solo in my head

young knoll
#

If you learned to play it with a real guitar maybe you wouldn’t be stuck as a computer programmer NERD

worldly ingot
#

:(

compact haven
#

stop bullying Choco >:(

hollow grotto
#

How can I add more worlds in my minecraft server, not just the default one? programming side, not adding more plugins to the server. Thank you

young knoll
#

WorldCreator

#

It’s fairly simple to use

hollow grotto
#

I mean, I have my world created already, I just want to add them to my server in addition to the current ones on my server, like the worlds would all be: world, world_nether, world_the_end, and my_custom_world... how can I make it so the server would recognize the my_custom_world?

tall saffron
#

How could i change the server-propeties with my plugin?

young knoll