#help-development

1 messages · Page 88 of 1

flint coyote
#

Now I'm even happier with ij 🤷‍♂️

iron glade
#

idk how much it's in your country but putting your os on an m2 ssd is fire, should get one if you find it on sale ngl

flint coyote
crisp steeple
#

get it when they are online?

tardy delta
#

atleast this is working lmfao

#

now handle operators

iron glade
flint coyote
tardy delta
#

my own

ornate patio
#

or not even ban

iron glade
# tardy delta atleast this is working lmfao

One thing bothering me is that e.g. i remove a method in one class, all other classes are not highlighted in red showing an error because that method is now missing, any way to fix that?

ornate patio
#

just add them to some list

grim ice
flint coyote
tardy delta
#

ah fuck "11" gives me 2

ornate patio
#

and that has a rate limit

flint coyote
flint coyote
iron glade
crisp steeple
ornate patio
#

if they havent logged on before the uuid will be incorrect

tardy delta
#

hmm now its 110 instead of 11

flint coyote
iron glade
#

lololo where did u get it

tardy delta
#

now it works but wtf

ornate patio
tardy delta
#

only when neccesary

ornate patio
#

oh

flint coyote
crisp steeple
#

not in the background either though, on the main thread so you can really lag your server if you call it too much

ornate patio
#

is it possible to make it async

hazy parrot
iron glade
tardy delta
#

"11234" became 122340 smh

flint coyote
#

yes I am

iron glade
#

hahah nice, same

ornate patio
#

just run it in an async bukkit task?

crisp steeple
#

run it in a new thread/async bukkit runnable

ornate patio
#

oh k

flint coyote
#

ye idk a lot of people I meet online are german🤷‍♂️

hazy parrot
#

just io from requesting api

ornate patio
#

can I use edit server config in an async task?

#

probably not

hazy parrot
#

why not

ornate patio
#

isnt that a spigot function

hazy parrot
#

its not ?

#

its yaml parser

ornate patio
#

so i can use JavaPlugin#setConfig and JavaPlugin#saveConfig right

#

and getConfig

hazy parrot
#

you shouldn't have problem with that

somber hull
#

Just do savedefaultconfig on startup

#

And then javaplugin.getConfig

tardy delta
#

hmm works

ornate patio
ornate patio
somber hull
#

So like saving a value?

hazy parrot
#

use database for it

somber hull
hazy parrot
#

its configuration for a reason

ornate patio
#

editing config from a mc command

somber hull
#

Yea they have good points

hazy parrot
#

you have no reason to run that async then

ornate patio
#

why

hazy parrot
#

?

ornate patio
#

because I still need to use Bukkit.getOfflinePlayer(name)

somber hull
#

@ornate patio just make a data file in json with gson

#

So you don’t have to deal with yank storage Jane

ornate patio
#

bruh why

hazy parrot
#

thread blocking operations should be ran async, editing config shouldnt cause thread block

ornate patio
#

I'm just trying to change a couple values in the config automatically

hazy parrot
somber hull
ornate patio
ornate patio
somber hull
#

Well it works as data storage so 🤷‍♂️

ornate patio
#

its not scalable

hazy parrot
hazy parrot
somber hull
#

Maybe it’s 5 seconds slow on enable and when I save it. But it works

somber hull
ornate patio
somber hull
ornate patio
#

whatever thats besides the point

ornate patio
#

which causes the thread to block

grim ice
#
int output = 0;
Arrays.stream(input.toCharArray()).filter((c) -> return !Character.isWhitespace(c) && c > '0' && c < '9').forEach((c) -> {
        output+= (Character.getNumericValue(c) / 10);
        output *= 1;
});
return output;```
#

@tardy delta

tardy delta
#

hehe got it to work

grim ice
#

shortened version

#

of what u sent earlier

tardy delta
#

uhh wtf

grim ice
#

lol

tardy delta
#

ye but i need operators too lol

#

current

grim ice
#

o

opal juniper
#

ahahaha

hazy parrot
tardy delta
#

lets now try two operators

#

works too

#

it only doesnt know operator priority yet

#

thats the difficult part

ornate patio
grim ice
#

u makin a calculator?

tardy delta
#

yedterday i was thinking about some valuesstack and a operators stack

flint coyote
tardy delta
#

ye kinda

#

those will suck lol

grim ice
#

use a calculator library

#

ez

hazy parrot
#

something like

callApi(Consumer<UUID> callback){
//calling api
callback.accept(uuid);
}
//and then 
callApi(uuid -> config.save(UUID));
ornate patio
#

yeah but like

#

why

#

I can just save the config in the async task too

hazy parrot
tardy delta
#

"3+2*3" is giving 15 instead of 9 so hmmm

hazy parrot
#

but config is just yaml parser, it should work fine

ornate patio
#

k

grim ice
#

cant u make an AI that solves operations

flint coyote
#

I already wrote a parser that can do +-*/% aswell as == >= <= || && and ^
it took me some time but now I can pretty much solve if expressions from a config file by replacing some variables and then throwing them through multiple expression parser before finally throwing it into a boolean parser

grim ice
#

or is that impossible

tardy delta
#

:))

flint coyote
#

3-4 hour project but it was fun. The brackets were the most annoying part. Especially since 3/((5-(3+1)+1)-1) etc. is a valid expression

grim ice
#

then

#

if u find a * or /

#

do the operation, then edit the input

#

so basically if u get 3 + 2 * 3

#

u make it 3 + 6

tardy delta
#

hmm what if theres no * or /

grim ice
#

basically, simplify it

tardy delta
#

wasted time

grim ice
#

of course u will need to check if theres a * or / before looping

tardy delta
#

thats what seems wasted time in my eyes

#

ill think about it in my bed lol

grim ice
#

lol

#

how is that wasted

#

theres no other way

tardy delta
#

yesterday i was thinking about having two collections; one for the values and one for the operators

#

but that evolves looping twice too

#

and overhead

grim ice
#

thats a pretty bad ideaa

tardy delta
#

i wrote my idea on three pieces of paper yesterday lmfao

quiet ice
#

Just do reverse polish notation - incredibly easy to implement

tardy delta
#

uhh dunno what that is

quiet ice
#

Basically 5 + 2 + 3 would be

5
2
ADD
3
ADD
#

Or

5
2
3
ADD
ADD
reef lagoon
#

This didn't work, but the following code did. thank you tho

                    FileWriter fileWriter = new FileWriter(file);
                    fileWriter.append("i");
                    fileWriter.close();```
quiet ice
#

In programmers terms: The operands are put in a stack and when an opcode is encountered it is executed, where as the result is put in the stack again

tardy delta
#

mye easier to implement

#

but i wanted to make something that can parse readable expressions

flint coyote
#

My expression parser uses a lot of recursion lol

tardy delta
quiet ice
#

Even then that would be invalid due to ordering issues

flint coyote
#

like 5+(2+1)+1 will then call 2+1 recursively and lead to 5+3+1. Which will then recursively call 5+3 which leads to 8+1 and ends with that

quiet ice
#

You have to convert the more standard forumla to RPN anyways

sage dragon
#

What's the easiest way to check if a player is about to hit a cobweb - Or is already stuck in one?

#

Nevermind

onyx fjord
#

Can I somehow add velocity to entity towards a different entity?

long zephyr
onyx fjord
#

na na i have the entity

quaint mantle
onyx fjord
#

W

#

is there place where i can see item pickup velocity minecraft uses?

quaint mantle
#

well

#

in their code

#

lol

#

idk

reef lagoon
grim ice
#

is there a library

#

that i can draw images with

meager trout
#

Hello, how can I set a placeholder?
For the lobby server, I want to show players from other servers (PlaceHolderAPI)

waxen plinth
#

LivingEntity#getLastDamageCause

#

What do you mean

quaint mantle
waxen plinth
#

No but you can check if it's an EntityDamageByEntityEvent

#

If it is, cast to it and see if the damager is an end crystal

waxen plinth
quaint mantle
#

No

#

just help

waxen plinth
#

There are tons of online resources and tutorials to get started with making plugins

quaint mantle
#

I didn't say u have to make it

waxen plinth
#

Go find one

quaint mantle
#

I know how to make a plugin

#

No idea how to make that Lootbox plugin

waxen plinth
#

Then ask a more specific question

#

What's your confusion

quaint mantle
#

ur not gonna help lemme find someone else bye

waxen plinth
#

Bruh

#

Entitled people smh

granite burrow
#

Is it possible to make a castable player?

Example:
CustomPlayer player = (CustomPlayer) e.getPlayer();

I have a class that implements player, however, I get an error saying that I cannot cast to player

waxen plinth
#

That's not how Java works

#

Player is an interface

#

CraftPlayer is the implementation

#

It's a different class

#

Casting doesn't actually change the type of the object

#

It can for primitives, but for objects it only lets you treat something as a type it already is, but wasn't stored as before

round finch
waxen plinth
#

If so, how does that do order of operations?

agile anvil
golden turret
#

if the event is a custom event

#

he can do it anytime he want

golden turret
quiet ice
golden turret
#

only if the plugin uses craftbukkit

#

otherwise he is safe to use things within the api

quiet ice
#

If you pass that player object to any bukkit methods everything would get screwed

golden turret
#

?????

#

he can safely use a custom player in the api

waxen plinth
#

Make a Player wrapper

#

Don't implement Player

golden turret
#

because the api methods uses the Player interface

quiet ice
#

Yes, and cb casts those instances to craftplayer

waxen plinth
#

But internally they often represent it as CraftPlayer

quiet ice
#

?stash

undone axleBOT
tawny otter
#

(im just going to barge in here)
how can I change an Items Durability (setDurability has been deprecated and I cant find another way to change it)

quiet ice
#

Here one method that would instantly break other plugins

#

Unless you extends CraftPlayer - at which point fair play I guess

#

Granted that is the only example I can find - but they exist

hazy parrot
#

I don't know what is he trying to do, but its 100% better to just use some utility class

quiet ice
tawny otter
#

someone said something about setDamage in ItemMeta, my IDE says its not a thing

hazy parrot
#

then its probably this

#

cast to this and try

tawny otter
#

Bingo, this might work

hazy parrot
#
Damageable dmg = (Damageable) item.getItemMeta();
dmg.setDamage(...);
item.setItemMeta(dmg);
#

try it

hazy parrot
#

?

tawny otter
#

what about midi?

snow lava
#

for( : ){

}

i have seen people using the ":" in a for. How that works

quiet ice
#

If the thing on the right is an Iterable or Array it loops over that iterable or array

#

for arrays it will basically generate code similar to

for (int i = 0; i < array.length; i++) {
    Element element = array[i];
    // [...]

if you use

for (Element element : array) {
    // [...]
#

For Iterables (which includes Collection, List, Set, etc.) it will go from

for (Element element : list) {
    // [...]

to

Iterator<Element> it = list.iterator();
while (it.hasNext()) {
    Element element = it.next();
    // [...]
#

It's all syntactic sugar, so if you feel like not using them - you don't need to!

#

Although it is MUCH faster to use foreach (the name of this syntax) statements

#

Hello gradle nerds! How do I use

compileJava {
    doFirst {
        options.compilerArgs = [
            "--add-exports", "org.spongepowered.mixin/org.spongepowered.asm.mixin.transformer=de.geolykt.starloader.launcher"
        ]
    }
}

for the javadoc task?

#

I'm soo close to using Method handles just resolve Mixin's JPMS bullshit

crimson scarab
#
    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    
    @EventHandler
    public void onThrowEgg(PlayerInteractEvent event) {
        PlayerInventory inventory = event.getPlayer().getInventory();
        Player player = event.getPlayer();
        player.sendMessage("test");

        if (inventory.getItemInMainHand().getType() == null || !event.getPlayer().getInventory().getItemInMainHand().getType().toString().endsWith("Spawn Egg") || (event.getAction() != Action.RIGHT_CLICK_AIR) || (event.getAction() != Action.RIGHT_CLICK_BLOCK)) return;

        event.getPlayer().launchProjectile(Egg.class);
    }
}
#

i think i messed up somewhere

#

well i did probably

eternal oxide
#

it will never be Spawn Egg

crimson scarab
#

?

#

also this is the thinki preventing it from loading
[21:00:21 ERROR]: Could not load 'plugins/throwable-spawn-eggs-1.0-SNAPSHOT.jar' in folder 'plugins': uses the space-character (0x20) in its name

eternal oxide
#

its an enum so .getType().name().endsWith("SPAWN_EGG")

crimson scarab
#

ah yes i meant to check based on custom name your way is better

eternal oxide
#

That too, you can;t have spaces in your plugin name (in plugin.yml)

crimson scarab
#

there are no spaces

#

do dashes count?

eternal oxide
#

no

#

that error says you have a space

crimson scarab
eternal oxide
#

plugin.yml

crimson scarab
#

there we go thanks

craggy elbow
#

I am writing a plugin (trying) to light up a given area with torches.
I am checking light levels prior to placing each torch to ensure they are only placed at or below a given light level, however... they are being placed fast enough I think, that they are only getting the pre-existing light levels, and not updating as they place.

Is there a way to force light updates before checking a block?

eternal oxide
#

No simple way

craggy elbow
#

is nms the only way?

eternal oxide
#

Lighting updates are a pain

#

yes

craggy elbow
#

if I were to slow down the placements to let the light updates happen naturally... what kind of speed would I be looking at?

eternal oxide
#

No clue

craggy elbow
#

yeah, same here. :\

eternal oxide
#

you could always set a minimum distance

#

you know a torch will go X blocks

#

so don;t place any within that distance of another

craggy elbow
#

currently, I am using that method, but, some corridors don't get lit because they fall between the min distance

agile anvil
#

You should compute the light level yourself I guess. It will be the simpler way to go

craggy elbow
#

I figured this would be the answer based on everything I could find... but... was holding out for some secret call that could do it... xD

#

block.getState().update() is boolean, is it used to update a block and return success?
based on conversation, I'll assume that if it does an update, that it's only physics?

eternal oxide
#

it will apply the BlockState back to teh Block

crimson scarab
#

how can i launch a projectile with a data container

eternal oxide
#

with physics, if there was a change

eternal oxide
#

you mean a PDC?

#

use the launchProjectile method which accepts a Consumer

#

apply the PDC to the Entity in the Consumer

young knoll
#

You can also add it after to the returned entity

eternal oxide
#

you can, if it doesn't matter that it spawned without the PDC

crimson scarab
#

what does the consumer look like

young knoll
#

A consumer is a method that takes one argument and returns void

#

In this case the argument type is the entity you are spawning iirc

crimson scarab
#

how can i make an egg entity

eternal oxide
#

Depends on what you want to do with it

crimson scarab
#

I have an interesting problem
I am making spawn eggs throwable
how can i store the data of the entity inside the pdc so that when it hits it spawns the right entity

eternal oxide
#

I did this a couple of years ago with Meta

#

PDC is better. It doesn;t leak

crimson scarab
#

so should i use an enum or something to store the entity

eternal oxide
#

no

crimson scarab
#

becuase i cant have an entity as a pdc unit i dont think

eternal oxide
#

you throw the egg via the PlayerInteractEvent

#

its also better to use snowballs, from what I remember

crimson scarab
#

how do you store the entity

#

like integer?

eternal oxide
#
    public void onSpawnEgg(PlayerInteractEvent event){

        ItemStack item = event.getItem();
        if (item == null) return;

        if (item.getType().name().contains("SPAWN_EGG")) {
            Snowball snowball = event.getPlayer().launchProjectile(Snowball.class);
            snowball... PDC stuff
            snowball.setItem(item);
            item.setAmount(item.getAmount() - 1);
        }
    }```
#

you don;t store it

#

then in your ProjectileHitEvent Listener you check if it has teh PDC data

#

the PDC contains the hatching type

#

using a snowball is best as you don;t risk accidentally spawning any chickens

#

?pdc

crimson scarab
#

can entity type be put in a pdc

#
event.setHatchingType(EntityType.ALLAY);
#

nvm

eternal oxide
#

you just store a string

#

EntityType hatchingType = EntityType.valueOf(type);

#

to get it back

lime bane
#

Are there any resources for ways to get the Terralith biome a player is in using a spigot plugin? (Kunfury)
This is for adding compatibility with Terralith for a fishing plugin.

#

It just returns "CUSTOM" they said.

eternal oxide
#

yes but it requires a little NMS

#

I don;t think its available in CraftBukkit

lime bane
#

That's all good, Spigot though right?

#

I'm not a plugin developer, but do you know of any other information I give them to help them?

eternal oxide
#

one sec I'll see if I can find the post again

lime bane
#

Thank you :D

lime bane
#

Kudos! Thank you very much :D

young knoll
#

Surprising we don’t have something for that yet

#

Even just a way to get a NamespacedKey of the custom biome

eternal oxide
#

yeah teh Bukkit Namespaced keys are quite useless

#

This is a CUSTOM biome, that is a CUSTOM biome

north mural
#

Where can I find the source code of bukkit 1.12.2 ?

eternal oxide
#

?stash

undone axleBOT
eternal oxide
#

oh 1.12

north mural
#

yea

north mural
#

but i cant find 1.12.2

eternal oxide
#

build it with BuildTools and use teh flag for javadocs/source

north mural
#

okay
I will try

eternal oxide
#

--generate-source --generate-docs

#

in a clean buildtools

young knoll
#

I guess it would require a complete overhaul of the Bukkit biome system

#

But that sounds like it would break backwards compat

eternal oxide
#

just needs a getCustomName() method to pull the NMS Registry name

young knoll
#

True

eternal oxide
#

Its about all its ever going to be used for

young knoll
#

But I don’t think the biome enum has any way to get that

#

So it would have to be on Block or World

eternal oxide
#

Not in CB no

crimson scarab
#
    @EventHandler
    public void onEggHitEvent(PlayerEggThrowEvent event) {
        if (event.getEgg().getPersistentDataContainer().has(EntityKey, PersistentDataType.STRING)) {
            event.setHatchingType(EntityType.valueOf(event.getEgg().getPersistentDataContainer().get(EntityKey, PersistentDataType.STRING)));
        }
        event.getPlayer().sendMessage("Test");
        event.setHatching(true);
    }

any ideas the egg isn't hatching every time

eternal oxide
#

there is a hatch chance

#

use setNumHatches(1)

arctic moth
#

what would be the best approach to making custom mobs/bosses

#

similar to the way hypixel does it ig

#

with the fake players

eternal oxide
#

Fake players or armorstands

arctic moth
#

it seems like it requires a lot of nms

eternal oxide
#

it is

arctic moth
#

or custom attacks

#

well custom attacks is easy

eternal oxide
#

if you use FakePlayers you have to code all the AI

arctic moth
#

:(

#

couldn't i just use something else's ai?

#

like zombie

#

or steal pathfinding

#

i would expect someone to have made some kind of api for this stuff

#

does nms at least have a method to set the ai's block to pathfind to

eternal oxide
#

not for fake players

crimson scarab
#

how to change the entity model in spigot

eternal oxide
#

you mean for the thrown Egg? setItem()

quaint mantle
#

does anyone know how to get the direction a player is looking at

#

im trying to slowly move a particle in a certain direction

eternal oxide
#

Player#getEyeLocation().getDirection()

quaint mantle
#

I have used that but it does not work in my scenario

eternal oxide
#

Then your code is wrong

quaint mantle
#

It does not get me the intended outcome

eternal oxide
#

that give you a unit Vector in teh direction the player is looking

charred pollen
#

why does it remove the spaces

eternal oxide
#

Why does what remove spaces?

quaint mantle
charred pollen
eternal oxide
#

I only write plugins. I don;t use MC commands so no clue what ^ does

eternal oxide
#

only data and comments count

hazy parrot
#

Not sure if spigot parser parse comments

eternal oxide
#

it doesn;t read them but it will preserve them now

quaint mantle
#

or if you are looking straight forward, five blocks above you

eternal oxide
#

then .getDirection().multiply(5)

#

or -5

quaint mantle
#

can I set the direction it is going in though?

crimson scarab
#
    @EventHandler
    public void onEntitySpawn(EntitySpawnEvent event) {
        if (!(event.getEntity() instanceof LivingEntity) || (!(event.getEntity() instanceof Ageable))) return;

        Ageable ageable = (Ageable) event.getEntity();
        ageable.setAdult();
    }

    @EventHandler
    public void onEggHitEvent(PlayerEggThrowEvent event) {
        if (event.getEgg().getPersistentDataContainer().has(EntityKey, PersistentDataType.STRING)) {
            String entityString = event.getEgg().getPersistentDataContainer().get(EntityKey, PersistentDataType.STRING);
            entityString = (Objects.equals(entityString, "MOOSHROOM") ? entityString = "MUSHROOM_COW" : entityString);

            event.setHatchingType(EntityType.valueOf(entityString));
            event.setHatching(true);
            event.setNumHatches((byte) 1);
        }

    }


    @EventHandler
    public void onThrowEgg(PlayerInteractEvent event) {
        PlayerInventory inventory = event.getPlayer().getInventory();

        if ((!event.getPlayer().getInventory().getItemInMainHand().getType().toString().endsWith("SPAWN_EGG"))) return;
        if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) return;
        if (inventory.getItemInMainHand().getType() == null) return;


        Entity entity = event.getPlayer().launchProjectile(Egg.class);
        Egg egg = (Egg) entity;
        egg.setItem(inventory.getItemInMainHand());
        entity.getPersistentDataContainer().set(EntityKey, PersistentDataType.STRING, inventory.getItemInMainHand().getType().toString().substring(0, inventory.getItemInMainHand().getType().toString().length()-10));

    }

I have my plugin working but I would like to only make entites full size or adults if they were spawned from an egg

quaint mantle
#

Like x or y

#

or just straight forward

eternal oxide
#

that would magnify the Vector to a length of 5, you can then add that to a Location to move it

quaint mantle
#

ok

#

thank you

eternal oxide
#

the direction you are looking

quaint mantle
#

sorry for all the questions but im getting errors and im not sure how to solve them

eternal oxide
quaint mantle
#

p.spawnParticle(Particle.SPELL_WITCH, location.getDirection().multiply(5).add(location.getDirection()), 50); is my current code

eternal oxide
#

other way around, add the vector to the location

#

location.add(location.getDirection().multiply(5))

quaint mantle
#

did it, thanks

#

im going to put it in a for loop and multiply it by i

eternal oxide
#

they will all appear at once

quaint mantle
#

yeah i know

eternal oxide
#

if thats what you want

#

k

quaint mantle
#

going to try to find a work around

#

wait

#

wont they all appear in the same place

#

nvm

#

im dumb

eternal oxide
#

not if you increase the location each time

quaint mantle
#

yeah

eternal oxide
#

to have it look like a moving particle you need to use a runTaskTimer

quaint mantle
#

nothing is even showing up when I run my command

#

how far is multiply

eternal oxide
#

its a unit vector so a length of 1 = a block

#

multiplied by 5 = 5 blocks

quaint mantle
#

yeah I am not getting anything

eternal oxide
#

use a simple particle to test, like redstone

quaint mantle
#

nothing

quaint mantle
eternal oxide
#

this I know works player.spawnParticle(Particle.FLAME, finalLoc, 1, 0, 0, 0, 0);

#

plug in yoru loc and see if it works. If not theres something else wrong with yoru code

quaint mantle
#

in the for loop?

eternal oxide
#

just get it to display first

quaint mantle
#

what is finalLoc supposed to be

eternal oxide
#

the location you calculate

quaint mantle
#

what do I define it as

eternal oxide
#

a Location

#

your player location.add the vector

quaint mantle
#

i just set it as my eye location

eternal oxide
#
Location  finalLoc = player.getLocation().add(player.getEyeLocation().getDirection().multiply(5));
player.spawnParticle(Particle.FLAME, finalLoc, 1, 0, 0, 0, 0);```
quaint mantle
#

ohhhhh

#

so what i used to put in there for location

heady patio
#

I need some help with NBT data. I'm not really sure how, but is there a way for the game to scan an item and add an CustomModelData tag to it?
for example im using a chest gui plugin so i can put in a regular pickaxe on one side of the chest and output a cooler looking pickaxe on the other side with all the same data already on it
is this possible?

eternal oxide
#

?pdc

quaint mantle
#

cant see the particle

eternal oxide
#

to store data on a chest

heady patio
#

thank you i love you

eternal oxide
quaint mantle
#

ohhhh

#

yeah

#

its not getting there because I did this

#

im not using the check for string thing

#

should i use that instead

eternal oxide
#

you never start teh runnable

quaint mantle
#

oh

#

so i put the run() in a command executor

eternal oxide
#

or schedule it

young knoll
quaint mantle
#

its not like a normal method

eternal oxide
#

?scheduling

undone axleBOT
eternal oxide
#

or just call its run() method to execute it now

quaint mantle
#

i try to do run() inside this if statement if(cmd.getName().equalsIgnoreCase("shoot")) and it doesnt recognize it

eternal oxide
#

its a method of the runnable

quaint mantle
#

So I have to call it in there?

eternal oxide
#

it depends what you are aiming for

quaint mantle
#

trying to make a command run the run()

eternal oxide
#

what exactly do you want this particle to do?

quaint mantle
#

move forward and damage things

eternal oxide
#

ok you are going to need more code then

#

you need a counter (lifeSpan) inside the Runnable (outside the run() method)

quaint mantle
#

I can do the damage thing, i just cant figure out the particles

eternal oxide
#

set to a value, of the number of times you want it to run.

#

you decrease teh value each loop

quaint mantle
#

so a for loop?

arctic moth
#

how would i make an evoker with certain pdc spawn different mobs? the spell event doesn't provide mobs spawned, and the creaturespawnevent doesn't provide the evoker that spawned it

quaint mantle
quaint mantle
#

Particles

eternal oxide
#

one sec

tranquil stump
#

startup like luckperms

ornate patio
#

i've seen a ton of plugins that give server owners the option to use sqlite or mysql

#

is there some common library all of these plugins are using that im missing

#

if not what do you guys recommend i use

young knoll
#

I’m sure there are libraries for it

#

Or you can just make two separate implementations of your storage handler

ornate patio
#

yeah but like

#

that takes effort to do

#

ive never even used mysql before i usually use postgres

waxen plinth
#

Likely all you'll need to do is change a few queries

ornate patio
#

What do you guys recommend for databases with plugins

#

JDBC?

willow widget
#

is there a way to get the permissions from an OfflinePlayer object??

#

please tell me that's for my question lol

#

oh yeah

#

LP api is weird, it scares me with the future thingy :C

#

ugh

#

any workaround?

#

:c

#

it uses vault tho? or what?

#

alr, will check it up, thanks

boreal python
#

Okay, final question for this stupid .java file

        final var player = event.getPlayer().as(Player.class);
        final var game = Main.getInstance().getGameOfPlayer(player);
        final var typeName = item.getMaterial().platformName();
        final var runningTeam = game.getTeamOfPlayer(player);

        var prices = event.getInfo().getOriginal().getPrices();
        if (!prices.isEmpty()) {

            ArrayList<Component> lore = new ArrayList<>(item.getLore());

            lore.add(
                    (LanguageService
                            .getInstance()
                            .get(MessageKeys.CLICK_TO_PURCHASE)
                            .toComponent()));
            item = item.withItemLore(lore);
        }

        var maybeStorage = SBA.getInstance()
                .getGameStorage(game);
        if (maybeStorage.isPresent()) {
            var gameStorage = maybeStorage.get();
            final var afterUnderscore = typeName.substring(typeName.contains("_") ? typeName.indexOf("_") + 1 : 0);
            switch (afterUnderscore.toLowerCase()) {
                case "chestplate":
                case "boots":
                    int protection = gameStorage.getProtectionLevel(runningTeam).orElseThrow();
                    item = clampOrApplyEnchants(item, protection, Enchantment.PROTECTION_ENVIRONMENTAL, type,
                            SBAConfig.getInstance().node("upgrades", "limit", "Protection").getInt(4));
                    break;
                case "axe":
                    final int efficiency = gameStorage.getEfficiencyLevel(runningTeam).orElseThrow();
                    item = clampOrApplyEnchants(item, efficiency, Enchantment.DIG_SPEED, type,
                            SBAConfig.getInstance().node("upgrades", "limit", "Efficiency").getInt(2));
                    break;
                case "pickaxe":
                    final int pickefficiency = gameStorage.getEfficiencyLevel(runningTeam).orElseThrow();
                    item = clampOrApplyEnchants(item, pickefficiency, Enchantment.DIG_SPEED, type,
                            SBAConfig.getInstance().node("upgrades", "limit", "Efficiency").getInt(2));
                    break;
                case "stick":
                    int sharpness = gameStorage.getSharpnessLevel(runningTeam).orElseThrow();
                    item = clampOrApplyEnchants(item, sharpness + WHATDOIPUTHERE.getEnchantmentLevel(Enchantment.KNOCKBACK), Enchantment.KNOCKBACK, type,
                            SBAConfig.getInstance().node("upgrades", "limit", "Sharpness").getInt(1));
                    break;
            }


        }
        return item;
    }```
Based on the code above, what do I have to put at "WHATDOIPUTHERE" to get the enchantmentlevel of the selected item. I tried item and Item and they haven't worked
#

when i put "item" getEnchantmentlevel gives this error:
Cannot resolve method 'getEnchantmentLevel' in 'Item'

#
            int maxLevel) {
        if (type == StoreType.UPGRADES) {
            level = level + 1;
        }
        if (level > maxLevel) {

            item = item.withItemLore(LanguageService
                    .getInstance()
                    .get(MessageKeys.SHOP_MAX_ENCHANT)
                    .toComponentList());

            if (item.getEnchantments() != null) {
                item.getEnchantments().clear();
            }
        } else if (level > 0) {
            item = item.withEnchantment(EnchantmentMapping.resolve(enchantment).orElseThrow().withLevel(level));
        }
        return item;
    }```
#

actually

#

theres more of those

#

lemme see if I can find the original

#

yeah

#

trying to find it

#

hang on

#

this is my guess as to where the item variable comes from

        var enabled = itemInfo.getFirstPropertyByName("generateLore")
                .map(property -> property.getPropertyData().getBoolean())
                .orElseGet(() -> Main.getConfigurator().config.getBoolean("lore.generate-automatically", true));

        if (enabled) {
            final var originalList = item.getLore();

            final var isSharp = itemInfo.getFirstPropertyByName("sharpness").isPresent();
            final var isProt = itemInfo.getFirstPropertyByName("protection").isPresent();
            final var isEfficiency = itemInfo.getFirstPropertyByName("efficiency").isPresent();

            final var game = Main.getInstance().getGameOfPlayer(player);
            final var arena = ArenaManager
                    .getInstance()
                    .get(game.getName())
                    .orElseThrow();

            if (isSharp) {
                final var currentLevel = arena.getStorage().getSharpnessLevel(game.getTeamOfPlayer(player))
                        .orElseThrow() + 1;
                final var limit = SBAConfig.getInstance().node("upgrades", "limit", "Sharpness").getInt(2);
                if (currentLevel <= limit) {
                    price = String.valueOf(SBAUpgradeStoreInventory.sharpnessPrices
                            .get(arena.getStorage().getSharpnessLevel(game.getTeamOfPlayer(player)).orElseThrow() + 1));
                }
            }

            if (isProt) {
                final var currentLevel = arena.getStorage().getProtectionLevel(game.getTeamOfPlayer(player))
                        .orElseThrow() + 1;
                final var limit = SBAConfig.getInstance().node("upgrades", "limit", "Protection").getInt(4);
                if (currentLevel <= limit) {
                    price = String.valueOf(SBAUpgradeStoreInventory.protectionPrices.get(
                            arena.getStorage().getProtectionLevel(game.getTeamOfPlayer(player)).orElseThrow() + 1));
                }
            }

            if (isEfficiency) {
                final var currentLevel = arena.getStorage().getEfficiencyLevel(game.getTeamOfPlayer(player))
                        .orElseThrow() + 1;
                final var limit = SBAConfig.getInstance().node("upgrades", "limit", "Efficiency").getInt(4);
                if (currentLevel <= limit) {
                    price = String.valueOf(SBAUpgradeStoreInventory.efficiencyPrices.get(
                            arena.getStorage().getEfficiencyLevel(game.getTeamOfPlayer(player)).orElseThrow() + 1));
                }
            }

            String finalPrice = price;
            final var newList = itemInfo.getFirstPropertyByName("generatedLoreText")
                    .map(property -> property.getPropertyData().childrenList().stream()
                            .map(ConfigurationNode::getString))
                    .orElseGet(() -> Main.getConfigurator().config.getStringList("lore.text").stream())
                    .map(s -> s
                            .replaceAll("%price%", finalPrice)
                            .replaceAll("%resource%", type.getItemName())
                            .replaceAll("%amount%", Integer.toString(itemInfo.getStack().getAmount())))
                    .map(s -> ChatColor.translateAlternateColorCodes('&', s))
                    .map(AdventureHelper::toComponent)
                    .collect(Collectors.toCollection((Supplier<ArrayList<Component>>) ArrayList::new));
            newList.addAll(originalList);

            return item.withItemLore(newList);
        }
        return item;
    }```
#

I have no idea 🤷‍♂️
I didn't make the plugin, I'm just editing it to suit my needs

#

😆

#

it works

#

no idea how

#

🤷‍♂️

#

nope

#

i'll keep guessing

#

same thing
Cannot resolve method 'getEnchantmentLevel' in 'Item'

#

for some reason it says its capital even though it isnt

#

its that line too

#

line 421 baby!

scarlet creek
#

Hello, I've been trying to solve this for awhile now. I'm trying to register multiple enchantments but it keeps saying that the TNTSHOOTER enchanment is already registred even though it is not in the list of registred enchanments.

Code: ```public class ModEnchants {

public static final Enchantment TNTSHOOTER = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
public static final Enchantment FORCE = new EnchantmentWrapper("vortex", "Vortex", 1);

public static void registerEnchantment(Enchantment enchantment){
    System.out.println(Arrays.stream(Enchantment.values()).collect(Collectors.toList()));
    boolean registered = Arrays.stream(Enchantment.values()).anyMatch(alreadyRegisterd -> alreadyRegisterd.getKey().equals(enchantment.getKey()));
    if(!registered) {
        try {
            Field f = Enchantment.class.getDeclaredField("acceptingNew");
            f.setAccessible(true);
            f.set(null, true);
            Enchantment.registerEnchantment(enchantment);
            System.out.println("Successfully registered " + enchantment.getKey());
        } catch (Exception e) {
            System.out.println("No need to register " + enchantment.getKey() + " as it's already registered from before reload");
        }
    }
}

}```

#

Enchantment wrapper class:


    private final String name;
    private final int maxLvl;

    public EnchantmentWrapper(String namespace, String name, int lvl) {
        super(NamespacedKey.minecraft(namespace));
        this.name = name;
        this.maxLvl = lvl;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), name, maxLvl);
    }

   ... rest of the overrides
}```
#

Main plugin class:


    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Plugin started!");
        ModEnchants.registerEnchantment(ModEnchants.FORCE);
        ModEnchants.registerEnchantment(ModEnchants.TNTSHOOTER);

    }
}```
#

The list of registered enchantments printed out only says that the vortex enchant is registred but the tnt enchantment is not

scarlet creek
scarlet creek
#

I don't understand, I'm calling the registerEnchantment method 2 times for each enchantment on my main plugin class but I'm not sure which part you are referring to in my ModEnchants class where I am registering the enchants again

#

Ohhhh

#

Sorry I'm blind

#

Found it

#

Hang on, the name of the registerenchantment method is different from the one inside

#

    public static final Enchantment TNTSHOOTER = new EnchantmentWrapper("tntshooter", "TNT Shooter", 1);
    public static final Enchantment FORCE = new EnchantmentWrapper("force", "Force", 1);

    public static void registeringEnchantments(Enchantment enchantment){
        System.out.println(Arrays.stream(Enchantment.values()).collect(Collectors.toList()));
        boolean registered = Arrays.stream(Enchantment.values()).anyMatch(alreadyRegisterd -> alreadyRegisterd.getKey().equals(enchantment.getKey()));
        if(!registered) {
            try {
                Field f = Enchantment.class.getDeclaredField("acceptingNew");
                f.setAccessible(true);
                f.set(null, true);
                Enchantment.registerEnchantment(enchantment);
                System.out.println("Successfully registered " + enchantment.getKey());
            } catch (Exception e) {
                System.out.println("No need to register " + enchantment.getKey() + " as it's already registered from before reload");
            }
        }
    }
}``` Perhaps this is clearer, I got confused with my own code 😅
#

But yea it still gives the error that the FORCE enchantment was already registered even though it is not in the list of enchantments

scarlet creek
# scarlet creek ```public class ModEnchants { public static final Enchantment TNTSHOOTER = ...

So from the main plugin class I’m putting the 2 public static final enchantments at the top into the parameters for the registering enchantments method which then checks if there are any conflicts or errors. However, the part that makes no sense is that the namespace id and name of the public static final enchantments are all different yet it still gives an exception error because it is already registered?

onyx fjord
#

is there a method to check if block is a container?

#

or i need to create a list of them

#

Resolved

drowsy helm
#

anyone know what the name of the mojmap packet for sending a toast is

#

none of the ones with Advancement in the name looks like the right one

onyx fjord
#

can i implement interface with the same name as original?

#

or it must be different

flint coyote
# onyx fjord can i implement interface with the same name as original?

If it's in the same package it won't work with the same name. But even in a different package - if you use both in one class you will have the complete path for one inside your code to specify which one you need.

In short: Technically yes but don't do it.

Instead name the Interface the name of the original class and name the class <Interfacename>Impl (if there's only one implementation rn) or just add an I in front of the classes name for your Interfaces name

onyx fjord
#

gotcha thanks

onyx fjord
river oracle
#

C# (Cringe) does an i infront of interfaces so you got shit like IThing
and then in that case you could implement IThing into Thing

reef lagoon
#

Cringe sharp

hybrid spoke
#

C# more like microsoft java

quaint mantle
#

Is there a way to make a placeholder in maven?
Something like {pluginServerFolder}
So I can work on my project from multiple places, where the server folder is different

#

and not have to go replace everything that uses the path with the current one

reef lagoon
#

${plugin.basedir} i think but you must add the path after

quaint mantle
#

plugin.basedir?

#

that is never defined

#

I want a custom one

#

which I can set myself

#

in maven pom

desert frigate
#

Does 0.22 affect player speed in player#setWalkSpeed or just 0.2 or 0.3

still spindle
#

Can someon please explain why it can't find my lybrary while packaging while the code itself can...?

tender shard
#

does anyone know what they mean with "development profile"?

tender shard
still spindle
#

My god.

tender shard
#

well you did it the other way around

#

adding it to the pom is the only thing you need to do

#

NEVER EVER should you add any .jar files manually to your classpath

#

you simply need to add the worldedit repo and worldedit dependency to your pom.xml and that's it

still spindle
#

Think I did it now 🙂

still spindle
#

So you would say using systempath is bad practise?

tender shard
#

yeah

#

it destroys the purpose of maven

#

it's supposed to automatically get your dependencies

#

also systemPath will be removed from future maven versions

#

or at least systemPath inside your project root

cobalt thorn
#

Hi a question im using Bozar for obfuscating my plugin and it can't find org.bukkit net.md5.bungee etc i need to input the Server jar or Some spigot Api jar?

tender shard
#

that obfuscator isnt allowed on spigotmc anyway

#

but yeah, you can either ignore that it cannot find that, or add spigot as library to your obfuscator

cobalt thorn
tender shard
#

I haven't used it yet but every decent obfuscator lets you add libraries to the classpath

cobalt thorn
#

yes that i know but i mean he needs spigot library what i need to put in there Spigot Jar or something else because he can't find org.bukkit and spigot classes

tender shard
#

what MC version are you running?

cobalt thorn
#

1.8.9

tender shard
#

then just add the spigot.jar as library in this section

cobalt thorn
tender shard
#

yes

#

and be sure to exclude your main class from being name-changed

cobalt thorn
#

yes i already done that

tender shard
#

it must keep the original name and all the overriding names (onEnable, onLoad, onDisable, onCommand, ...)

#

oki

cobalt thorn
tender shard
#

?paste the full log pls

undone axleBOT
tender shard
#

you said you use 1.8.9 right?

#

because the classes it cannot find are 1.13+ classes

#

e.g. NamespacedKey

cobalt thorn
#

and works from 1.8 to 1.19.2

#

i need to add the 1.13 jar?

tender shard
#

well normally, the obfuscator should just ignore the missing classes

#

but yeah I'd also add the 1.19.2 spigot-api.jar

#

the api.jar, not the normal spigot.jar

cobalt thorn
#

oh where i can find it

#

i added for 1.8 the spigot jar

tender shard
#

build it using buildtools

cobalt thorn
#

not the api jar

cobalt thorn
tender shard
#

but tbh I'd just use a better obfsucator. although I still wonder why you need to obfuscate it at all if you're not going to release it

cobalt thorn
#

and some of them are leakers

#

as i found out

tender shard
#

lol maybe get rid of those staff then 😛

cobalt thorn
#

im a dev

cobalt thorn
tender shard
#

well this obfuscator is pretty stupid and needs to have ALL classes in the classpath. so you will basically have to add all your libraries that you don't shade, as well

#

e.g. worldguard, worldedit, ...

#

(if you use those)

#

seems very tedious

#

i'd just use the demo version of allatori tbh

#

it has no problems with missing libraries

compact cape
#

does sending packets (like inventory ones) need to be sync? Or async works?

tender shard
cobalt thorn
tender shard
compact cape
tender shard
compact cape
#

I think I should do that 🙂

tender shard
#
Bukkit.runAsync(() -> {
  int myNumber = calculateSomethingAsync();
  sendPacket();
  // If sendPackets() doesnt work async:
  Bukkit.runSync(() -> {
    sendPacket();
  }
}

sth like this ^

tender shard
tardy delta
#

I haven't implemented the order of operations yet

iron glade
#

$290 for one license?

tender shard
#

i got a license for 190$

#

but they can just use the demo version

#

since they don't even plan on publishing it

#

the demo version does the same as the licensed one, it only adds ALLATORI_DEMO to some method names, and it's not for commercial use

iron glade
#

yeah so not usable for premium plugins?

tender shard
#

exactly

iron glade
#

that's all I need it for

tender shard
#

for paid plugins you'd have to buy the single developer license for 190$

#

it's not on their website, you'd have to email them IIRC

#

i'm currently running a custom version they made for me, 8.2.1 lol

#

on the website there's only 8.2

iron glade
#

in EUR it's 381,43

tender shard
#

whut?! no

#

190 USD in euro is 190.85 €

iron glade
#

it's 290

tender shard
#

oh right, I forgot that they give you a discount to 190$ if you ask them too

#

but yeah, taxes come on top

iron glade
#

Imma just ask if they can go down to 5 bucks

tender shard
kindred valley
#

I can not see the event listener and i always have to write it my own
do you know why

tender shard
iron glade
#

reasonable price

#

but 380 damn

kindred valley
iron glade
#

btw @tender shard I found your plugin on several leaking sites while searching for mine on them

#

idk if you're aware of that

tender shard
#

people regularly join my discord trying to verify their purchase, then leave again after 5 minutes

iron glade
#

do you have a licensing system or smth like that?

tender shard
#

this dude only lasted a minute

tender shard
iron glade
#

ah got you

#

idk why someone would need to "crack" a like $10 plugin

#

weird people

glossy basin
#

Hey, I'm trying to check whether there is still text after a second ", so as to exclude the first case, which is not allowed.
Wrong: //mask "stone,dirt,sand 0"blablabla (detect the blablabla and delete it)
Wrong: //mask "stone,dirt,sand 0" blablabla
Right: //mask "stone,dirt,sand 0"

Does anyone know a quick way to do this?
My first idea was to split the string after the ", but for that I would have to somehow make it split after the second ".

tender shard
iron glade
#

find last occurence of "

#

and delete everything after that index

tender shard
#

or to get money from selling "premium accounts" on their shitty leaking website

shadow zinc
#

help with this please

#

java.lang.ClassNotFoundException: com.neomechanical.neoutils.version.items.WrapperLEGACY

#

and this is the code getting the class

#
Class.forName(getClass().getPackage().getName() + ".items.Wrapper" + serverVersion).getDeclaredConstructor().newInstance();```
#

which is my class VersionMatcher

#

So my question is how do I get the class in a different maven module during runtime?

tender shard
#

your .jar probably doesn't include that class

#

open it with winrar / 7zip / whatever and check if the class is actually there

shadow zinc
#

which?

#

neoutils or my project using it?

shadow zinc
tender shard
#

in your parent pom, you don't. you normally want to have a separate "distribution" module

#

the structure is like this:

  • parent
    • dist
    • core
    • 1.19
    • 1.18
    • ...
#

the "dist" module depends on all other modules and shades them into one .jar

#

so yeah you wanna create a "dist" module or whatever, make it have all your other modules as dependency, then add the maven-shade-plugin to that one and then use the dist .jar file as your final plugin

torn shuttle
#

man I wish there was an easy way of doing guardian rays

tender shard
shadow zinc
#

its really only for old versions that have different item names

tender shard
#

sure

shadow zinc
#

I haven't got into nms yet

torn shuttle
shadow zinc
#

Yeah, I'm in no rush to learn about it lol

scarlet creek
#

Hello, I was hoping if I could ask one last time for help with registering my custom enchantments.

I keep getting the java.lang.IllegalArgumentException: Cannot set already-set enchantment error.

torn shuttle
#

?paste

undone axleBOT
torn shuttle
#

don't flood the channel

scarlet creek
shadow zinc
#

😱

shadow zinc
scarlet creek
shadow zinc
#

you need check if x item has y enchantment, if so then return

#

example for you

#
    public static final Enchantment Psychokinesis = new EnchantmentWrapper("pyschokinesis", "Pyschokinesis", 1);

// making sure it loads
    public static void register() {
    if (!(Arrays.stream(Enchantment.values()).toList().contains(Unsellable))) {
        registerEnchantment(Unsellable);
    }
        if (!(Arrays.stream(Enchantment.values()).toList().contains(Psychokinesis))) {
            registerEnchantment(Psychokinesis);
        }
    }```
#

sorry for the bad code and format, I wrote this a long time ago

scarlet creek
#

and was the beginning of hours of testing and getting the error

#

Yea, here it is

scarlet creek
shadow zinc
#

yeah give it a go and see what happens

onyx fjord
#

Are interfaces always objects?

scarlet creek
onyx fjord
#

so look i have an interace called MagnetGroup, which defines a configuration section, can i somehow define it as such?

#

first time trying the oop stuff

old cloud
#

Is it possible to register commands dynamically instead of having to put it into the plugin.yml file?

scarlet creek
ivory sleet
#

Yes

#

You can reflect the command map

old cloud
#

Ok so that is the only way?

ivory sleet
#

I mean you could do it at packet level also

#

But the cmd map is the easiest way

old cloud
#

Alright ty 👍

scarlet creek
shadow zinc
scarlet creek
shadow zinc
scarlet creek
shadow zinc
#

thats the general layout

#

you cant register it without checking

scarlet creek
ivory sleet
#

You cannot register two enchantments under the same namespaced key

#

That results in that particular error precisely

scarlet creek
#

namespace for the two are different

ivory sleet
#

you cant use it like that

#

getByKey requires the enchant to be already registered

#

Basically

shadow zinc
# scarlet creek

why aren't you checking if it exists inside the register method, its more efficient and easier to maintain

ivory sleet
#

Else indeterminacy is gonna happen

scarlet creek
ivory sleet
#

just use Enchantment.registerEnchantment(enchantment);

scarlet creek
ivory sleet
#

May I inquire how ur implementation class looks

scarlet creek
#

I didn't implement anything though, just extended the enchantment class

ivory sleet
#

That is not how it should be done

#

First of all

#

you need to return name for the getName method

#

And you probably wanna use NamespacedKey.fromString(namespace+":"+name);

#

Instead of NamespacedKey.minecraft(namespace);

reef lagoon
#

how do I iterate thru all files in my plugin's folder

ivory sleet
#

You have getDataFolder().listFiles() or sth

#

Which returns a File[]

#

But that one sucks

reef lagoon
#

Oh I tried with .length() xD

#

ty

ivory sleet
#

Ah

#

Nice

shadow zinc
#

Is there a version manager?

ivory sleet
#

Whats that

shadow zinc
#

to easily create classes for different nms versions etc

ivory sleet
#

Gradle/maven

shadow zinc
#

but easier

#

like Versioner.registerClass(Wrapper1.8)

ivory sleet
#

They are pretty easy to use

#

Oh

#

Nah

#

Maybe

#

Dk of any tho

shadow zinc
#

because I'm making one now and I wanted some inspiration

#

lol this seems too simple to work

#
public class Versioning {
    private final Map<String, Class<?>> classMap = new HashMap<>();
    private final String versioningName;

    public Versioning(String versioningName) {
        this.versioningName = versioningName;
    }
    public Versioning addClass(String classVersionIdentifier, Class<?> clazz) {
        classMap.put(classVersionIdentifier, clazz);
        return this;
    }
    public void build() {
        NeoUtils.getManagers().getVersionManager().addVersioningClass(versioningName, this);
    }
}```
ivory sleet
#

Ye

shadow zinc
#

I mean its just a builder

#

I don't need to be anything complicated

#

What else does it need?

ivory sleet
#

Doesnt look like a builder

shadow zinc
ivory sleet
buoyant viper
#

gotta give it an inner class called Builder 😎

eternal night
#

🙏

shadow zinc
#

ffs ik, but it functions the same

ivory sleet
#

No?

shadow zinc
#

end result, I think so?

ivory sleet
#

Nah

buoyant viper
ivory sleet
#

You’re just registering that instance to some manager facade class in that build method

shadow zinc
buoyant viper
#

be like thanos

#

be the mad titan

shadow zinc
#

I am

#

I vaporized all my friends, can't find them anywhere

buoyant viper
#

who cares about conventions, u have a goal and ur going to achieve it

#

one way or another

shadow zinc
scarlet creek
ivory sleet
#

Nw <:

scarlet creek
buoyant viper
#

well i reckon this.key is null

ivory sleet
#

Hm

#

Yep

#

Thing is, the minecraft(name) method is a little bit reserved for minecraft’s stuff

shadow zinc
scarlet creek
ivory sleet
#

Almost

shadow zinc
#

its not

buoyant viper
#

nah

shadow zinc
#

yyep build not working

ivory sleet
#

Some adaptation of it

shadow zinc
#

needs to return ssiz

still spindle
#

The code is placing the schematic accordingly, but now I am trying to get it to place it block by block, does someone have experience with the WorldEdit API into being able to do this?

                File file = new File("plugins/WorldEdit/schematics/"+getDisplayName);
                ClipboardFormat format = ClipboardFormats.findByFile(file);
                BukkitWorld world = new BukkitWorld(p.getLocation().getWorld());

                System.out.println(file);

                try (ClipboardReader reader = format.getReader(new FileInputStream(file))) {

                    Clipboard clipboard = reader.read();

                    try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world,
                            -1)) {

                        Operation operation = new ClipboardHolder(clipboard).createPaste(editSession)
                                .to(BlockVector3.at(p.getLocation().getX(), p.getLocation().getY(),     p.getLocation().getZ())).ignoreAirBlocks(true).build();

                        try {
                            Operations.complete(operation);
                            editSession.flushSession();

                        } catch (WorldEditException ex) {
                            p.sendMessage(ChatColor.RED + "OOPS! Something went wrong, please contact an administrator");
                            ex.printStackTrace();
                        }
                    }```
ivory sleet
#

KyTDK’s builder design pattern Ig

reef lagoon
#

does fun stand for function

ivory sleet
#

Yes

buoyant viper
#

yeah

ivory sleet
#

In kotlin

reef lagoon
#

yeah that's what i was talking about

buoyant viper
#

scala >

def method: Unit = {}```
ivory sleet
#

I believe kotlin was created because both scala and java lacked some things

#

But ye scala is quite nice

ivory sleet
shadow zinc
#

they call me bob the builder

reef lagoon
#

they should add optional params to java

ivory sleet
#

method overloading

reef lagoon
#

easy to recreate but still

ivory sleet
#

And null

reef lagoon
#

yeah I know

buoyant viper
#

what can kotlin do (on the jvm) that scala cant?

ivory sleet
#

Idk I think its about compile time features

boreal seal
#

is Warren Loo is dead?

#

just wondering

#

did find an answer on it

#

but the guy dissapeared many years ago

#

from all his socials

manic furnace
#

How can you remove a Score from a scoreboard

twilit roost
#

Im randomly placing campfires ( programitacally )
But I don't want them to be on Trees
I tried nested For Loops and checking Type of Highest Block but didn't work

Any ideas?

old cloud
twilit roost
#
        int radius = 8;
        if(spawnpointLL.getBlock().getType().equals(Material.OAK_LEAVES)||spawnpointLL.getBlock().getType().equals(Material.OAK_LOG)) {
            for (int x = spawnpointLL.getBlockX(); x < radius; x++) {
                for (int z = spawnpointLL.getBlockZ(); z < radius; z++) {
                    Block highest = world.getHighestBlockAt(x, z);
                    System.out.println(WatchUtil.locationToString(highest.getLocation()));
                    if(!spawnpointLL.getBlock().getType().equals(Material.OAK_LEAVES)&&!spawnpointLL.getBlock().getType().equals(Material.OAK_LOG)) {
                        spawnpointLL = highest.getLocation();
                        break;
                    }
                }
            }
        }

this is what I tried
spawnpointLL is location

old cloud
#

to actually know where the campfire will stand on

twilit roost
#

oooh
dumb me

grim ice
next stratus
#

How do people make guis what refresh? 🤨

flint coyote
#

what refresh?💀

iron glade
next stratus
#

Like you know when you have menus so if you click on something it'll update the lore with a new integer etc?

reef lagoon
#

just open the menu again

iron glade
reef lagoon
#

then set the slot again wahtever

flint coyote
#

doesn't it automatically update when you change the content of a custom inventory?

next stratus
#

No?

next stratus
#

Not as I know of

flint coyote
#

I think it does. Has been a while since I made one

next stratus
#

hm

#

I must be doing something really wrong then lol

iron glade
#

should check if material ends on LEAVES or smth

flint coyote
#

doesn't work for the players inventory tho. There you have the updateInventory method

next stratus
#

I mean, I'm trying to edit the top inv

tardy delta
#

Tag.LEAVES.isTagged(material)

next stratus
#

It's hard to find examples of how to do it 😅

flint coyote
#

if it really doesn't work you can open the inventory again

iron glade
next stratus
iron glade
#

which one?

next stratus
#

RedLib

iron glade
#

Never heard of sorry

next stratus
#

it has a basic wrapper for guis and such

iron glade
#

Personally, I'm using Triumph, easy to use and I try to just update the lore whenever possible

#

to not reopen the whole inventory

next stratus
#

triumph is a cool one, my friend made it

iron glade
#

props to him, using it in every plugin since I discovered it

reef lagoon
#

bruh this is bullshit why is NONE of that deleting the file

next stratus
#

I might look into trying to use it

iron glade
iron glade
reef lagoon
iron glade
#

can't you like copy the config, delete everything and replace the config

next stratus
#

I'm ashamed to ask for help normally I got it in my head that I know it all 😦

reef lagoon
#

how do I delete everything tho

grim ice
next stratus
#

I know that sounds like a ego thing etc but that's how I legit feel.

buoyant viper
#

have u tried just file.delete()

iron glade
# grim ice Why?

The == operator checks the type and makes a null-safe comparison of the same type of enum constants.

grim ice
#

that's a bad argument

#

compare constants from the left

#

and you wont throw NPEs

iron glade
#

imagine writing .equals() every time instead of just ==

next stratus
#

@iron glade Sorry for ping, but is any projects of yours using triumph open source at all?

twilit roost
next stratus
#

All g!

iron glade
next stratus
#

I mean it normally helps ye

#

oh it has a docs page 🤦‍♂️

grim ice
#

using .equals() for enums is preffered imo

iron glade
grim ice
#

prove me wrong

iron glade
#

you can use both

grim ice
#

.equals() is the standard for all java objects

next stratus
iron glade
#

just saying I don't know why I would write .equals() every time instead of just ==

grim ice
#

making exceptions for a certain type gets dangerous

grim ice
next stratus
#

I didn't know that

grim ice
#

and there is no valid reason

#

for using == instead

next stratus
grim ice
#

since java 1.0

iron glade
#

well == is null safe so no need to reverse check

grim ice
#

"reverse check"

#

no

iron glade
#

but other than that it's really up to your preference

grim ice
#

you should compare constants

#

from the left

#

eitherway

iron glade
#

yeah that's true

#

just keep using equals if you love it so much

#

I won't

buoyant viper
grim ice
#

java even adds Objects.equals on version 7

buoyant viper
#

no sane man does a .equals on enums

grim ice
buoyant viper
#

just against the constitution or somethin

#

idk

grim ice
#

ah yes

#

lmao

#

if you dont know then dont bother opposing

flint coyote
#

I haven't seen anyone do .equals() on an enum either

grim ice
#

Mhm

#

but most people that dont use it, dont know why they dont

#

lol

flint coyote
#

Because it isn't necessary?

grim ice
#

if you dont know why youre doing something, then revise

grim ice
flint coyote
#

That's all the reason you need lol

buoyant viper
grim ice
#

How is it not necessary?

buoyant viper
#

sometimes u gotta do it because it just works

flint coyote
#

I know about null safety etc but "not necessary" is more than enough

grim ice
#

No

buoyant viper
#

and if it aint broke

#

dont fix it

grim ice
#

that's the definition of not learning

#

i bet 100$ u use snake case on class names just because it works

flint coyote
grim ice
buoyant viper
flint coyote
#

that's like asking "why you do 1+2 instead of 1+1+1"

grim ice
#

Not really

#

answer my question though

flint coyote
#

it results in the same but with extra steps

grim ice
#

why would you not use equals()