#help-development

1 messages · Page 2172 of 1

tardy delta
#

no u

tender shard
#

yes me

#

(always think positive)

trail pilot
#

oh hello

#

dont abuse static!!!!!!

midnight shore
#

?ask please be more descriptive

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

tardy delta
#

what would i do:
i'm having a playerdata class which is supposed to be loaded from a database and has alot of fields so i'd have to make a constructor with all those fields included
so should i just use that constructor or use a builder pattern or some static method fromSql(ResultSet) or something?

tardy delta
#

im sorry i had to

trail pilot
#

oh lol spigot is uwu

tender shard
#

is what I'd do

tender shard
tardy delta
#

hmm ye thats probably the best way

#

but

trail pilot
tardy delta
#

im loading all the player stuff from different tables so i would end up with different resultsets

trail pilot
#

better instances

tardy delta
#

which doesnt make it easier

trail pilot
#

hmm

tardy delta
#

@tender shard

trail pilot
#

remove????

tender shard
#

and then it takes care of laoding stuff from all the different tables

trail pilot
#

nothing nothing

#

well i dont think

tender shard
#

wtf is this code supposed to do

#

that's so weird

trail pilot
tardy delta
#

and what about the playerdata constructor?
just throwing all parameters in or a builder or smth

tender shard
#

no it weirdly subtracts 60 and 3 from the amount

trail pilot
#

if (all.getItemMeta().equals(archaicweal.getItemMeta())) { all.setAmount(all.getAmount()-60); }

whats that gonna do>

tender shard
#

it "removes the item out of every itemstack" what?

trail pilot
#

wow

#

im so confused

tender shard
#

just use this

tardy delta
#

new ItemStack(material, amount)?

trail pilot
#

i dont think

#

we want to remove stack?

#

hell i give up im not an native too

#

lol

tender shard
#

okay I'll try to explain

#

imagine you have 20 dirt and 10 diamonds in your inv

#

now you want to remove 5 dirt, and not more

trail pilot
#

AHHHHH

tender shard
#

so you do it ike this:

ItemStack toRemove = new ItemStack(Material.DIRT, 5);
playerInv.removeItem(toRemove);
trail pilot
#

removeItem

tender shard
#

now you're left with 15 dirt and 10 diamond

trail pilot
#

thanks mfnalex for explain

tender shard
#

then clone that existing itemstack and set the amount to the amount you wanna remove

#

then pass it to the removeItem method

river oracle
#

Why are you giving an item stacks and not having any memory or identifier to remove it with If that's your intention

trail pilot
#

yeeea

#

Array<Object> myObj = Array.of(new Object(param, param));

#

if im right

tardy delta
#

:/

trail pilot
#

whats wrong

ivory sleet
#

Java arrays are not written like that

trail pilot
#

i knoww

#

its an example by my memory

#

remember i had a bad memory xd

tardy delta
#

lmao

trail pilot
#

xd

#

well the example in part its right

#

then are not

chrome nova
#

Is it possible to change the time before server times out? Trying to increaes it so i can debug easier without getting kicked

round finch
#

what is the way to save Entity to Config?
i tried to save the Entity i clicked on but it only gives me CraftCow

#

i wanna save entity data

heady spruce
#

does anybody have an idea to cycle trough every player individually? and no i dont mean for(Player all: Bukkit.getOnlinePlayers()).
so i do something for every player, but not for everyone at the same time

round finch
#

@heady spruce you can use getPlayer(name) or getPlayer(UUID)

#

for one

heady spruce
#

for every player, after one player got cycled trough the other one. i know how to get players, but i wat to do it like that

tardy delta
#

im really wondering how to create an object based from data from different db tables, should i just use multiple prepared statements under the same connection or is there a more efficient way to do smth like that?

#

Hi @round finch 👋

round finch
#

HI @tardy delta 👋

twilit roost
#

How do I package Remapped NMS that is shaded?

tardy delta
#

i guess i have to join tables lol

#

that only works for two iirc

left swift
#

What is better way for nametags via armorstands? I mean should I do it with packets or real entity?

ivory sleet
#

define better

wraith marsh
#

im getting an error: ERROR Could not pass event ProjectileLaunchEvent to DinnerChad v1.0-SNAPSHOT but i dont have a projectilelaunchevent

#

its throwing whenever an arrow is spawned

eternal night
#

can you provide the entire arrow

wraith marsh
#

the entire arrow?

eternal night
#

error

tardy delta
#

the entire error

#

lol

eternal night
#

autocorrect is out there

wraith marsh
#

one sec

#

u dont have much of it tho

faint harbor
#

DinnerChad.java:66

#

that's where your error is

#

and it looks like you're casting an arrow as a living entity

wraith marsh
#

thank you so much

chrome beacon
#

You can use a resource pack and add it to the language file(s)

slate mortar
chrome beacon
#

Probably yes

slate mortar
#

probably by editing the font bitmaps

chrome beacon
#

Legacy color codes might work

slate mortar
#

afaik theyre not just wroten out as V and etc

#

i'm even pretty sure that the colors of tags and stuff are hardcored into the client

#

at least the creative ones for the category-tags are

tardy delta
#

any example on how to make a class that caches things?

#

i mean i could just throw everything in a map but then i'd end up with a class full of maps

green prism
#

Good morning guys! Do you know how to create a sort of "pin selector" inside an anvil? I would use it to do like a real ATM in a nutshell.
Then the operation would be, write in the pin bar (item rename bar), then click on the final item that confirms, if the pin is right opens the atm to withdraw.

green prism
humble tulip
tardy delta
round finch
#

i forgor how to get list inside of list within config

humble tulip
#

U can have a cahceholder class

#

And each cacheholder class has 1 map

#

U can add cache and removefromcache methods

#

As well as get

#

And create a cacheholder object for everything u wanna cache?

round finch
#

i saved a list of lists

tardy delta
#

lmao

humble tulip
#

Config#getList

#

Then cast it yourself

humble tulip
#

To List<List<Whatever>>

round finch
#

maybe i could loop all lists

#

in my list

humble tulip
#

Store all the cacheholders is a map<DataType, CacheHolder>

round finch
#

and then save it back

humble tulip
tardy delta
#

i guess ill write classes like usermanager, kingdomsmanager etc

humble tulip
#

That's what i do

humble tulip
round finch
#

brb gonna check for errors one sec

humble tulip
#

If u have multiple types of data tho

#

U can have one listener that handles loading of all

kindred valley
#

can someone explaing me the logic of custom model data

kind hatch
kindred valley
vocal cloud
#

Yes if the user has the texture pack to support it

kindred valley
kind hatch
#

You could just add another model to the pack and just give it another number.

kind hatch
#

You have the integer limit to work with for every single material in the game.

round finch
#

but thanks alot!

kindred valley
crisp steeple
kind hatch
#

Not really. My knowledge of resource packs is a little limited since I only worked with them about a year ago. Things have probably changed a little, but it is a process. I’d recommend looking at the Minecraft wiki for the resource pack. It covers a lot about packs and how to get one setup. It’d then be up to you to add the models and make sure they all point to the right place.

#

If you are familiar with how pointers work, then you should be fine. Resource packs do a lot of that.

knotty gale
#

ok so weird question but how would you get the block of a target?

#

because Material.TARGET doesnt work

worldly ingot
#

wot

knotty gale
#

like

kind hatch
#

Player#getTargetBlock()?

knotty gale
#

I want to check if a projectile hits a target block

kind hatch
#

Oh the actual target block?

knotty gale
#

yes

kind hatch
#

Is it not Material.TARGET_BLOCK?

knotty gale
#
if(event.getHitBlock().getType() == Material.TARGET) {
``` this is not a thing
#

target block doesnt work either

worldly ingot
#

That's certainly how you would go about doing it. So either the code you're checking isn't being called or getHitBlock() isn't what you think it is. Printing things out is the best way to check

knotty gale
#

I have used this method with other blocks

#

so i know it is the right one

#

but the target block isnt an available block for some reason

quiet ice
#

What order do you want to have them?

#

?jd-s

undone axleBOT
quiet ice
#

?stash

undone axleBOT
quiet ice
#

Then just sort the map (by removing all enchantments and adding them back in in the order you wish)

#

That being said depending on the circumstances that may not always do what you want to

#

And the client might choose to display the enchantments differently

quaint mantle
#

Anyone have any custom item ideas for pvp and dungeon crawler gamemodes?

steel swan
#

hey so i cant seem to understand how to do it so i m just gonna ask here:
If i am using a random host like idk minehut or a paid server so that i have access to the files, HOW can i creating multiple servers inside of my main? like each server has its own like plugin folder etc.
Also, in my code, do i need to implement, in my spigot prject, bungeecord like i would implement a library?
I m VERY lost here so any help would be cool

steel swan
quaint mantle
#

Pretty sure bungee just connects multiple server

#

So if you buy like 10 servers you use bungee

steel swan
#

ooooh

#

thx man

quaint mantle
#

If you want a cheap not as great option

#

You go multiworld

#

Np

steel swan
#

and

#

just a question

#

would u recommand to add the plugin to the server and make my code send commands to send the player to a world and create wome, or is there an existing api that i can use

quaint mantle
#

does it matter if I build a plugin with spigot and will it work on a paper server

chrome beacon
#

Spigot plugins generally work on Paper

quaint mantle
#

oh ok

fallow violet
steel swan
#

?paste

undone axleBOT
steel swan
#

here is my pom :
https://paste.md-5.net/zefuqileri.xml
but when i run it, (i mean reload the maven) i have this error :

Blocked mirror for repositories: [onarandombox (http://repo.onarandombox.com/content/groups/public, default, releases+snapshots), vault-repo (http://nexus.theyeticave.net/content/repositories/pub_releases, default, releases+snapshots), elmakers-repo (http://maven.elmakers.com/repository/, default, releases+snapshots), Official Bukkit (http://repo.bukkit.org/content/repositories/public, default, releases+snapshots)]

Since Maven 3.8.1 http repositories are blocked.

Possible solutions:
- Check that Maven pom files not contain http repository http://repo.onarandombox.com/content/groups/public
- Check that Maven pom files not contain http repository http://nexus.theyeticave.net/content/repositories/pub_releases
- Check that Maven pom files not contain http repository http://maven.elmakers.com/repository/
- Check that Maven pom files not contain http repository http://repo.bukkit.org/content/repositories/public
- Add a mirror(s) for http://repo.onarandombox.com/content/groups/public, http://nexus.theyeticave.net/content/repositories/pub_releases, http://maven.elmakers.com/repository/, http://repo.bukkit.org/content/repositories/public that allows http url in the Maven settings.xml
- Downgrade Maven to version before 3.8.1 in settings

#

here is the wiki for the api i wanna use

crude cobalt
#

How can I get the player's motion vector?

eternal night
#

oh

crude cobalt
# eternal night oh

There is nothing about the motion vector. I tried to use getDirection but it gives a view of where the player is looking

lost matrix
knotty gale
#

any reason this wouldn't work?

@EventHandler
    public void EntityPickupItem(EntityPickupItemEvent e) {
        if(ArrowPickup == true) {
        if(e.getEntity() instanceof Player) {
        if (e.getItem().getItemStack().getType() == Material.SPECTRAL_ARROW) {
          Bukkit.broadcastMessage(ChatColor.WHITE + "<" + ChatColor.AQUA + "BlockyRef" + ChatColor.WHITE + "> " + ChatColor.RED + e.getEntity().getName() + " picked up the arrow");
          e.getEntity().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 300, 0));
        }
    }
    }else {
        return;
    }
    }
lost matrix
knotty gale
#

uhmmm

#

how do I check lmfao?

lost matrix
#

Eclipse, Intellij, Visual Studio, Atom, Netbeans etc

knotty gale
#

oh

#

eclipse

lost matrix
#

Then click into the class and press ctrl + shift + F

crude cobalt
lost matrix
knotty gale
#

oh there

#

it works

lost matrix
#

Now post the formatted code again pls

knotty gale
#
@EventHandler
    public void EntityPickupItem(EntityPickupItemEvent e) {
        if (ArrowPickup == true) {
            if (e.getEntity() instanceof Player) {
                if (e.getItem().getItemStack().getType() == Material.SPECTRAL_ARROW) {
                    Bukkit.broadcastMessage(ChatColor.WHITE + "<" + ChatColor.AQUA + "BlockyRef" + ChatColor.WHITE
                            + "> " + ChatColor.RED + e.getEntity().getName() + " picked up the Arrow");
                    e.getEntity().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 300, 0));
                }
            }
        } else {
            return;
        }
    }
lost matrix
#
        } else {
            return;
        }

Is obsolete

knotty gale
#

what should I use instead

lost matrix
#

ArrowPickup should be arrowPickup
Only classes have first capital letters

lost matrix
knotty gale
#

oh

uneven fiber
#

if (e.getItem().getItemStack().getType() == Material.SPECTRAL_ARROW)

#

i reccomend you use .equals instead of ==

ivory sleet
#

I mean they’re comparing singletons

knotty gale
ivory sleet
#

No wouldn’t do a difference at most

uneven fiber
#

Wouldn't be incorrect, just depends on the person really

lost matrix
uneven fiber
#

i always use .equals

knotty gale
#

but I wont do it anymore

crude cobalt
lost matrix
knotty gale
#

I know for a fact the command I am using to turn the thing on works

crude cobalt
lost matrix
lost matrix
lost matrix
steel swan
knotty gale
#

I am and the only thing hat isnt working is the listener

crude cobalt
# lost matrix Means you are standing still

@EventHandler
public void OnPlayerMove(PlayerMoveEvent e){
e.getPlayer().sendMessage(String.valueOf(e.getPlayer().getVelocity()));
if(number_of_squats==2){
e.getPlayer().sendMessage("Dodge");
number_of_squats=0;
Player player = e.getPlayer();
Vector vector = player.getVelocity().multiply(10);
player.setVelocity(vector);

    }

}
vocal cloud
#

now that is a dangerous event to play with kek

green prism
#

hi! i’m doing something to select a text via a gui sign so the idea was to do:

Text:
Example

How can I make the first line uneditable? Can I?

(answer = xmas cookie :))

lost matrix
lost matrix
rough drift
#

viiiiiiiiiiiiiiiiiiiiiiiiiiiiim

#

vvvvvvvvvvvvvvvvvvvvim

#

vimmmmmmmmmmmmmmmm

#

iiiiiiiiiii

green prism
#

vimmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

rough drift
#

vvvvvvv

#

mmmmmm

green prism
#

ivm

rough drift
#

miv

#

vim

#

neovim

green prism
#

milf

rough drift
#

mivoen

dusk flicker
#

yall on crack?

green prism
#

miov

rough drift
#

no

#

vim

knotty gale
lost matrix
#

vim is nothing but a soft-lock tool. If i want to protect my pc from unauthorised access i just open vim.

green prism
rough drift
#

:q or :q!

uneven fiber
#

🧐

rough drift
#

that's how you exit vim

crude cobalt
uneven fiber
#

whats all this then 🧐

rough drift
#

if you type :q exit, :q! exit without saving

lost matrix
rough drift
#

check when a player crafts an item

#

totally

#

checking when a player toggles sneak

crude cobalt
undone axleBOT
lost matrix
quaint mantle
#

Okay so I wanna make it so there is a chance that an enchant procs, and the chance is 0.3% per level that you've got.
How would I approach that ?

I though of using random number generator, but I don't know how to exactly do it.

// If the player's enchant is level 1
if (randomnumber < enchantLevel / 0.3) {
  // do stuff here
}
// Would this work ?```
humble tulip
#

what is proc?

lost matrix
#
if(ThreadLocalRandom.current().nextDouble() <= enchantLevel * 0.003) {
  trigger();
}
quaint mantle
humble tulip
#

ohh like the chance of effect?

quaint mantle
#

Yes

humble tulip
#

7smile's answer is correct

lost matrix
#

1.0 == 100%
0.5 == 50%
0.01 == 1%
0.003 == 0.3%

green prism
#

Guys a question, I wanted to open the player a sign with the following text in their respective lines:

Text:
Example

Can you tell me if there is a possibility to block the modification of the 1, 3 and 4 line by the player?

vocal cloud
#

Yes

green prism
#

thanks

#

no wait

#

how can I block it?

lost matrix
green prism
vocal cloud
#

You basically have no option besides overwriting any changes they do

green prism
#

cool

#

just another question, if I set the first line text, is it possible to make that the player when you open them the sign, is already editing on the second line?

#

I mean, with the second line selected

#

98 you're my hope

steel swan
vocal cloud
#

I mean did you read what the error says?

#

Also you shouldn't need the bukkit api if you have spigot since it's included

harsh totem
#

Is there a way to create custom enchantments without creating a lore of an enchantment and then make an event for the item?
I mean like make an actual enchantment

vocal cloud
#

No

patent horizon
#

is there a special way i can correlate a value in a yamlconfig with a value stored in an enum?

#

or do i just have to run a switcher on it to get the value as in the enum

trail pilot
#

hello

crude cobalt
#

When is PlayerVelocityEvent called?

patent horizon
#

when the player experiences velocity...

desert tinsel
#

can i create a mysql database but not with localhost with jdbc?

crude cobalt
patent horizon
#

good quetion

desert tinsel
#

what is Vector

patent horizon
#

what is the error

#

Vector vector1

desert tinsel
#

remove it

patent horizon
#

^

#

get the vector inside the curly brackets

#

the params for that method only pass the event

crude cobalt
#

All the time, when I change the vector of my movement, a message should be displayed. Did I understand correctly?

patent horizon
#

not the point

#

you cant put Vector vector1 in your method arguments

#

instead, get the vector afterwards

#

there's probably a method like e.getVector

crude cobalt
#

Okay, i removed that part, but still nothing.

patent horizon
#

did you register the event?

crude cobalt
#

Yes, because other events from the file work

patent horizon
#

are you getting an error in console?

crude cobalt
#

No

desert tinsel
#

what do you want to do?

#

when a player move?

#

or what

crude cobalt
#

Get his velocity

desert tinsel
#

that event is triggered when a velocity of a player is changed

patent horizon
#

ezpz

#
    @EventHandler
    public void playerMove(PlayerMoveEvent e) {
        e.getPlayer().sendMessage(e.getPlayer().getLocation().getDirection().toString());
    }```
desert tinsel
#

that is playerMoveEvent

patent horizon
#

hm

#

wel shoot

desert tinsel
#

he wants PlayerVelocityEvent

crude cobalt
desert tinsel
#

you use another event

#

PlayerVelocityEvent

round finch
#

i place a hashmap inside of hashmap within my config?
how do i get it from my config? 🤨 🤔

patent horizon
trail pilot
#

what you trying to make?

patent horizon
#

still got it to work

#
    @EventHandler
    public void playerMove(PlayerVelocityEvent e) {
        e.getPlayer().sendMessage(e.getVelocity().toString());
    }```
#

maybe you forgot the .toString()

patent horizon
#

you can't send a velocity in chat

desert tinsel
patent horizon
#

what

#

u just want to send "1" in chat when u take velocity?

desert tinsel
#

it was for a test i think

round finch
patent horizon
#

then just..

    @EventHandler
    public void playerMove(PlayerVelocityEvent e) {
        e.getPlayer().sendMessage("1");
    }```
round finch
#

hell

desert tinsel
#

iad

trail pilot
#

yes but well its seem more friendly

desert tinsel
#

iad is more

patent horizon
#

then you didnt register the event correctly

desert tinsel
#

PlayerVelocityEvent is differently than PlayerMoveEvent

#

yk?

crude cobalt
patent horizon
#

look, man, i just tried it out in game

#

i got the event to run correctly

crude cobalt
#

That is, you received a unit in the chat when changing velocity?

patent horizon
#

can you send you class and the class that registers the event

#

?paste

undone axleBOT
round finch
patent horizon
desert tinsel
#

for all entities

crude cobalt
patent horizon
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
round finch
#

i just need to return my hashmap with hashmaps

crude cobalt
#
getServer().getPluginManager().registerEvents(new EventListener(), this);
}```
desert tinsel
#

why a hashmap?

patent horizon
crude cobalt
desert tinsel
#

you can use class named Entities, save it in your config.yml, then when you enable the plugin, create again all Objects

sterile token
#

I think that the equivalent of hashmaps in cofig are ConfiguractioNSection

patent horizon
sterile token
#

And if you are saving custom data models, use ConfigurationSerializable

#

Fuck mongo db

ivory sleet
#

Lol

sterile token
#

Doesnt know the object enum

#

Its amazing

sterile token
#

😡

patent horizon
#

in game

#

what are you DOING

ivory sleet
#

I mean it’s easy to provide a strategy for serialization of enums tho

sterile token
ivory sleet
#

Yes

crude cobalt
sterile token
#

Doesnt it allow to add support for custom object?

ivory sleet
#

Idk

desert tinsel
patent horizon
round finch
#

i feel something isn't right..

sterile token
patent horizon
#

PlayerMoveEvent

ivory sleet
#

But it shouldn’t be too hard to circumvent the Enum issue

patent horizon
#

velocity event will only go off when you take VELOCITY

desert tinsel
#

like push of tnt

patent horizon
#

cus i also have a similar issue

ivory sleet
#

Verano

sterile token
sterile token
crude cobalt
dire marsh
ivory sleet
#

WallyTube mind elaborating further a bit?

sterile token
# patent horizon here.

Dont ask it everytime, if you dont want to get your mesage lost - open a thread on this channel

ivory sleet
#

do you mean like directly getting the Enum constant from a string or am I mistaking myself now?

patent horizon
desert tinsel
# crude cobalt This code
@EventHandler
public void onPlayerMove(PlayerMoveEvent e){
  e.getPlayer.sendMessage(e.getPlayer().getLocation().getDirection().toString());
}```
patent horizon
#

thats a vector

#

not velocity

#

he wants to get the velocity of someone while theyre walking

sterile token
ivory sleet
patent horizon
#

oh neat

#

ty

ivory sleet
#

Keep in mind

patent horizon
#

nulls?

ivory sleet
#

It throws an exception if given a mismatched input

crude cobalt
ivory sleet
#

IllegalArgumentException iirc

patent horizon
#

yeh i'll just tell my staffers not to be stupid ig

ivory sleet
#

Lol

sterile token
desert tinsel
#

e.getFrom() and e.getTo()

patent horizon
#

are enum values supposed to be variables or just generic "values"?

patent horizon
#

conclure

ivory sleet
#

They’re singletons

patent horizon
#

ohhhh

#

k

sterile token
#

Conclure sorry for asking this noob question, but im not secure how track a list of enum values

patent horizon
#

whats the method for getting a material from string?

ivory sleet
#

You could turn it into a list of strings and save it to Mongo? Then fetch it and use EnumClass.valueOf(str) for each string retrieved in the list and turn it into a list of Enum constants?

#

Material::getMaterial

#

or matchMaterial

#

or valueOf Ig

crude cobalt
sterile token
desert tinsel
sterile token
#

Because mongo has:

List<String> list = getBlaBlaBla().getList("field-name", String.class)

patent horizon
#

bambus

desert tinsel
#

better?

crude cobalt
#

Plz write code

ivory sleet
#

Write the code yourself, it’ll be of good practice for you

sterile token
#

But he doesnt still explain what need

#

Its impossible to explain something in 1 world

desert tinsel
crude cobalt
dire marsh
#

getvelocity doesnt return ground velocity

sterile token
dire marsh
#

@crude cobalt just subtract the from/to locations

sterile token
dire marsh
#

same

#

but they dont seem to understand

sterile token
#

I think its simply

#

But idk

sterile token
#

I already told you

crude cobalt
ivory sleet
#

Latmi what have you done so far?

#

Any code you could show us?

crude cobalt
#

I‘m really not understand

desert tinsel
ivory sleet
#

Start by using google translate then

desert tinsel
#

or deepl

dire marsh
#

to.getX() - from.getX()

sterile token
dire marsh
#

there is something to get you started

crude cobalt
sterile token
#

Maybe using vector? (What you other people think?)

Vector vector = new Vector(event.getTo()).substract(event.getFrom()).normalize();

vector.getVelocity()

quiet ice
#

I do not believe that this does what you mean

ivory sleet
#

@crude cobalt literally what do you have as of now?

desert tinsel
#

lore 🙂

quiet ice
#

Alongside the HIDE_ENCHANTMENTS flag

sterile token
#

How would you calculate if player pressing WASD, which will be the form?

quiet ice
#

(that being said, syncing lore and enchantments is pain)

desert tinsel
worldly ingot
#

Client/server communications in a game should contain intent and be keybind agnostic

sterile token
safe notch
#

Probably player move event

quiet ice
sterile token
safe notch
golden kelp
#

Anybody got a plugin idea?

safe notch
#

For conversation options in a quest

safe notch
quiet ice
#

But that would require the player to actually move (or have really strange behaviour when the ping is high)

safe notch
#

Cancel event ?

#

Yeah high ping is a problem

#

Wait I realise

#

Bento quests put the player on an armor stand

#

So they can’t rly move

sterile token
quiet ice
#

I personally prefer my ClickEvent

sterile token
safe notch
#

I like the way bento did it but it’s quite a lot of work tbh

quiet ice
#

?jd

safe notch
sterile token
#

Okay?

#

Nothing to do but me

sterile token
#

Is he trolling?

quiet ice
#

Frick not that

safe notch
#

Ohh

#

Wait I see

#

Text components

safe notch
#

Like the hower event

quiet ice
#

Why the hell does this site not update the URL

sterile token
safe notch
#

It is in bungee

quiet ice
#

Because that is the latest bungee chat version

safe notch
#

Api*

quiet ice
#

But you can use adventure if you wish, it's the same thing

safe notch
#

yeah

sterile token
#

but bungeecord.jar last versions is 1.18 something

quiet ice
#

That is bungee chat

sterile token
#

But in fact dont worry

quiet ice
#

Not bungeecord itself (i.e. the proxy)

sterile token
#

but ungeecord contains bungee api 🤔

quiet ice
#

Yes, and spigot contains the bungeecord chat

sterile token
#

So?

#

I just realized you are trolling

safe notch
#

He isn’t lmao

sterile token
#

I dont know why he mentioned his click event

#

And the urls he sent

#

Looks really weird

safe notch
#

He said as an alternative

#

Instead of making all these move event etc

sterile token
#

Okay?

#

Ahh you can get keys by click event?

quiet ice
#

As far as I know worldguard uses it to configure permissions in a more user-friendly way these days

quiet ice
#

It probably does not use bungee directly, but at the core - yes

safe notch
#

No he means a totally different approach like leave keys but clicks

#

Instead of wasd using mouse 1 and mouse 2

sterile token
#

I dont know if he is either more drunk or me

quiet ice
#

Yeah, you basically click a piece of text and then the client runs a command

safe notch
#

💀

#

yea ^

sterile token
safe notch
#

Bungee chat has the api for it

#

For making click event

sterile token
#

Yes so what he is saying

#

I dont catch it

safe notch
#

he said he would prefer using bungee chat api to make clickable text instead of doing inventory move event

sterile token
safe notch
#

:/

#

He just suggested an alternative ?

sterile token
#

But it doesnt allow to know pressed keys

#

Or yes?

quiet ice
#

For navigating GUIs it is a more optimal approach imo

sterile token
#

Lmao too much drunk for today

#

I will drink water, give me 1sec

quiet ice
#

No, not individual key presses

safe notch
#

Also iirc adventure has some methods for keybinds maybe look into them not sure what they do tho

quiet ice
#

Nah, that is clientside

safe notch
#

ahh I see

quiet ice
#

As adventure was originally written for sponge iirc

sterile token
#

Im either drunked or java its weird today. I dont know why the event its not being cancelled if the condition its okay

quiet ice
#

You need to cancel the event via evt.setCancelled(true) if you did not already

sterile token
#

But return doesnt stop code execution?

quiet ice
#

What is your issue? That it cancels or that it does not cancels?

patent horizon
#

how do i generate a random number from 1 to 100 (inclusive)

quiet ice
#

Return only jumps to the end of the method so to say

sterile token
safe notch
quiet ice
ivory sleet
sterile token
patent horizon
#

tyty

quiet ice
safe notch
#

Nono use 101

sterile token
#

Okay?

#

Ima be drunked

quiet ice
sterile token
quiet ice
#

return only "stops" the method from running, but does not actually cancel the event

patent horizon
ivory sleet
#

It does stop the code execution for the current iteration verano

#

Like within the method

safe notch
#

NextInt

patent horizon
#

awesome

sterile token
#

and them return goes return?

quiet ice
#

wha?

sterile token
quiet ice
#

Yeah, cancel and return

sterile token
#

Allright

quiet ice
#

You need to do both depending on the case

sterile token
#

Sorry for stupid questions!!

#

Lol keyboard get into a loop

wet breach
#

return exits the method early, not to be mistaken for it cancelling anything. That means everything before the return will still run. Also the event is a different method that your method has been given access to. So returning exits your method early not the event itself if that makes sense.

quiet ice
sterile token
#

Ohhh ok

#

Thanks i didnt know that events works in diff way

#

Like does normal java methods

patent horizon
#

awh :(

#

would i just do regular if conditionals here

quiet ice
#

Yeah

patent horizon
#

or is there some fancier way to approach this

quiet ice
#

Though the && rand <= 100 is a bit pointless

patent horizon
#

tru

quiet ice
#

(Same as the rand <= 0 &&)

patent horizon
#

mhm

quiet ice
#

If you want the performance of a switch statement, just use an array with the size of 100 (though I'd trim it to 20 looking at the numbers)

sterile token
#

Why he is nnot either using ">=" or "<="

#

That symbol he sent doesnt exists on java sintaxis

patent horizon
#

its an intellij thing

#

squishes >= and <= together

#

same with !=

thorny dawn
#

its an extension in the marketplace its not enabled by default

patent horizon
quiet ice
#

Many coding fonts use a special technique that combine two or more chars together

#

I forgot how that is called, but it has a name

chrome nova
#

for a ProjectileHitEvent

how do I check if a block or entity has been hit without spamming nulls

thorny dawn
#

@patent horizon do u have the font name anyways?

#

it looks really cool

patent horizon
#

no

thorny dawn
#

oh

#

?

patent horizon
#

i use atom icons + material theme

#

^ github dark theme

thorny dawn
#

uh what ab the extension for the equal icons

patent horizon
#

i dont have an extention for that one

#

it's always been that way

thorny dawn
#

really?

quiet ice
#

ligatures, that is what they are called

thorny dawn
#

kk

sterile token
patent horizon
#

it always has

#

ram consumer

sterile token
#

I know but when adding plugin its consumes more

#

Imagine i add github copilot and it consume a 5% more than without the plugin

patent horizon
#

i average pretty good fps on mc anyways

#

with it open

sterile token
#

what your pcs?

patent horizon
#

uh lemme find

quiet ice
#

mc is a pretty bad benchmark

#

At least for benchmarking other applications

sterile token
#

Its like lmao i dont wanna play anymore

patent horizon
#

this one i believe

#

it surprisingly only has 8gb ram

quiet ice
#

I wouldn't play mc even on a C++ version these days

thorny dawn
#

yikes

quiet ice
#

The joy of playing minecraft is simply ... gone

thorny dawn
#

sometimes i use intellij to debug mc code if i can

#

unless i need to be in my test server

patent horizon
#

i tried playing some hypixel games yesterday

#

i felt... nothing :)

#

it's all just overly competitive

sterile token
#

geol do u intellij for how many years?

#

I want to ask something related to it

quiet ice
#

I really need to start understanding IJ's debugging toolset, hopefully they are better than eclipse's one

quiet ice
thorny dawn
#

eclipse chad

sterile token
#

Is it possible to setup global runs configuration for every proyect?

thorny dawn
#

im not sure

quiet ice
#

Eclipse and recaf are the only two IDEs that I main

sterile token
#

Its so annoying to link the spigot.jar and configure the params on all plugins projects

thorny dawn
#

i just add the configs manually in each project

sterile token
thorny dawn
#

well i only have my server start jar app in the run config

#

and add a plugin in pom to compile my plugin directly to the plugins directory

#

and edit some shit for java to convert to kotlin

thorny dawn
quiet ice
#

What else are you going to compile?

sterile token
#

Configure the output file like me (i add the name of jar, because its using shaded plugin to built)

<outputFile>C:\Users\Usuario\Desktop\Server\plugins\Claims.jar</outputFile>

midnight shore
#

how can i create a circle shaped region?

sterile token
midnight shore
#

no

#

a sphere

sterile token
#

A circle right?

midnight shore
#

yeah a circle isn't cuboid ig

sterile token
#

Oh i have taken a long time to figure cuboid regions

#

When working with cuboids regions, you take in care 2 corners "Esquina superior izquierda" and "Esquina inferior derecha" (i dont know how call it in English) which forms a square

midnight shore
#

because i'd liked to make a shockwave

#

i guess i'll just use boundingboxes

sterile token
midnight shore
#

even if they are cuboids

sterile token
#

Bounding box is for doing cuboids

midnight shore
#

also everything is cuboids in minecraft

sterile token
#

Will

#

What are you trying do?

midnight shore
#

i thought of making spheres in a cube game 😪

sterile token
#

Generate a sphere of blocks?

midnight shore
#

like a nuclear bomb shockwave

sterile token
#

i dont know the meaning sorry im spanish speaker

midnight shore
#

ehm

#

onda d'urto

sterile token
#

But yeah i understand

midnight shore
#

onda de choque if google is right

sterile token
#

You want to break a circle of blocks around a centered block

sterile token
midnight shore
#

ty anyways

sterile token
# midnight shore kind of

Im doing that, but instead of breaking im protecting and its a square based a centered block (the protection block)

midnight shore
#

kind of like WorldGuard

sterile token
#

Yes

#

But without world edit and world guard

#

I wish be able to use world guard without world edit :(

midnight shore
#

😦

sterile token
#

@ivory sleet how would i do a circle based on a cuboid class?

#

Sorry for ping, dont ban me!

quiet ice
#

You would need to have multiple cuboids depending on the resolution

midnight shore
#

that's like this right?

#

y is up

#

x is right

#

or left

#

and z is depth

quiet ice
#

To be honest, I'd rather not use a cuboid class at all

fallow violet
quiet ice
#

Using distSq or the manhattan distance

sterile token
#

For doing what?

midnight shore
#

would this code get the corners?

sterile token
#

Custom inventory or normal inv?

#

InventoryClickEvent so

quiet ice
# fallow violet instead?

I.e. having something like

int centerX;
int centerY;
int radius;

public boolean isWithin(int x, int y) {
    int deltaX = centerX - x;
    int deltaY = centerY - y;
    return (deltaX * deltaX + deltaY * deltaY) <= radius * radius;
}
midnight shore
sterile token
quiet ice
#

You cannot fit a circle in a rectangle

#

Or at least not without compromises

sterile token
#

So how spheres are done?

#

🤔

#

Doesnt make sense your argument

quiet ice
#

Fancy maths, I cannot recall the name of the algorithm however

sterile token
#

allright

#

Spheres are generated knowing 2 things: a centered location and a radius

quiet ice
#

See the difference? If you think choosing between either one of the two is fine, then go with it - otherwise no

midnight shore
#

aren't spheres just circles rotated on the z axis?

fallow violet
midnight shore
quiet ice
#

Apply pythagoras theorem

#

Come on, this is 9th grade maths

#

Perhaps even 8th grade

#

And if pythagoras is too complicated, use manhattan

#

(pythagoras also applies on a 3d space at which point it is a^3 + b^3 + c^3 = d^3)

sterile token
#

I dont know why all here when something is diff they indirectly telling dont do it

quiet ice
#

Whatever, you get the gist

sterile token
#

pitagoras is:

high^2 = side^2 + side^2

quiet ice
sterile token
quiet ice
#

Yeah, but spheres becomes only a little bit more complicated, though I think really it is the same thing

sterile token
#

geol how old are you?

#

You know a lot

#

I ask because im just doing on math "teoria de conjuntos" on math

#

And its really tired, becaue it takes more time to copy the act than doing it

rough drift
#

Can I check if a player is going in the nether in a specific world even if the nether hasn't generated yet?

sterile token
midnight shore
#

If a string is “” is it null?

rough drift
#

its blank/empty

sterile token
rough drift
sterile token
#

bot is weird today

undone axleBOT
sterile token
#

?jd-s Events

undone axleBOT
rough drift
#

PlayerPortalEvent is a thing

midnight shore
#

Google says “” is null

rough drift
#

I don't know if I can differentiate nether and end

rough drift
quiet ice
rough drift
#

any text within "" will be threated as a literal from the google search engine

patent horizon
#

is there away i can tell if a string is an integer in string form?

sterile token
sterile token
rough drift
patent horizon
#

ok

sterile token
#

It will throw exception without catching it too

rough drift
#

you want to catch it

#

to determine if its a number or not

#

you don't want a random crash

sterile token
#

In my case when i dont want to catch it i just return if not nubmer

rough drift
midnight shore
#

public boolean isNumber(String string){
Try( pass)
Catch (Exception)
Return false
}

#

Sorry for bad format

rough drift
#

ye

midnight shore
#

I’m on cellphone

sterile token
#

return true or false, is when its a boolean

rough drift
#

we know that

midnight shore
rough drift
#

that's why he made it return a boolean

sterile token
quiet ice
# sterile token Ah that why

The fact that I know of these algorithms is because I wanted to create stellaris-style map rendering for a game I Mod - so really it is Just a coincidence here

midnight shore
#

iPhone text bad

sterile token
#

Oh sorry

#

I didnt read that

midnight shore
#

Don’t worry

sterile token
#

i have fixed the break block event on my claim plugin, but i cannot fix my block place

#

It really hurt my heart

crude cobalt
#

Can you please tell me if I can get velocity using from, to in PlayerMoveEvent? Just getting the velocity is not an option, because when we get it here, it's always 0;

sterile token
#

Why also you need to know the velocity?

sterile token
crude cobalt
crude cobalt
undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
sterile token
#

Okay?

#

I think you pasted the wrong code

#

Is it that your code?

crude cobalt
#
private int number_of_squats = 0;
    @EventHandler
    public void PlayerToggleSneakEvent(PlayerToggleSneakEvent e){
        if(e.isSneaking()){
            number_of_squats += 1;
            Bukkit.getScheduler().scheduleSyncDelayedTask(ParkourV1.instance, () -> {
                number_of_squats = 0;
            },10);

        }
    }
    @EventHandler
    public void  OnPlayerMove(PlayerMoveEvent e){
        if(number_of_squats==2){
            number_of_squats=0;
            Player player = e.getPlayer();
            Vector vector = player.getVelocity().multiply(2);
            player.setVelocity(vector);
        }

    }
#

The problem is that the PlayerMoveEvent fires before the player gets the velocity.

sterile token
#

A delay wouldnt actually work?

delicate lynx
#

why is number_of_squats global to all players

crude cobalt
chrome beacon
#

Also those naming conventions

crude cobalt
sterile token
chrome beacon
#

oh and you could just move:

        if(number_of_squats==2){
            number_of_squats=0;
            Player player = e.getPlayer();
            Vector vector = player.getVelocity().multiply(2);
            player.setVelocity(vector);
        }

to the sneak event

delicate lynx
#

I was about to say that too

sterile token
#

Because why doing it in PlayerMoveEvent if you dont use it

#

And also doing it in that event will cause memory leaking on the server

chrome beacon
#

Not really

crude cobalt
sterile token
#

Also another dude

#

Let say i have this code:

public void onPlace(BlockPlaceEvent event) {
  Block block = event.getBlockPlaced();
  Claim claim = this.plugin.getClaims().getClaimAt(block.getLocation());
  if (claim == null) {
    bla bla
  }
  if (event.getItemInHand().isSimilar(this.plugin.getItem())) {
    return;
  }
  event.setCancelled(true);
}
#

In the case the item is similar, will endup calling the event right?

#

Thanks and sorry for noob questions

chrome beacon
#

You mean cancel?

sterile token
#

Sometimes i right too fast that i dont right what i think

chrome beacon
#

Then the awnser is no

#

It will return if item is simillar

sterile token
#

Hmn

#

Okay?=

#

Im like a 🤡 know

#

I dont know if java its weird or intellij

#

Its telling me that something can be null when im checking up if (object == null) return;

lethal python
#

guys u know that cooldown animation which plays when u have used an item like the white overlay which slowly moves down the item? is it possible to trigger that for any item with spigot?

chrome beacon
#

Show your code

sterile token
#

ok

sterile token
#

And thanks olivo

kind hatch
#

Keep in mind that it only takes Materials so if you have multiple itemstacks of the same material, they will all get the cooldown.

humble tulip
#

when opening a gui is it okay to remake it every time?

#

i feel like it's ineffcient

kind hatch
#

As long as you store the instance of it somewhere, you can reopen it at anytime. All items should still be in the inventory if no changes have been made elsewhere.

sterile token
#

Where builds set the items into the inv, and them i just have an update method

#

Where i can call it on a runnable or when i need it

chrome beacon
crisp steeple
humble tulip
#

how expensive is it to create an inventory?

sterile token
#

I dont find the cause

humble tulip
#

i mean computing wise

crude cobalt
#

Fuck, 3 days of agony and I created a damn plugin

chrome beacon
#

It will get easier with time

#

Keep it up 🙂

sterile token
chrome beacon
#

Hover over and it will tell you

sterile token
#

Its you told me that can be null

#

Its doesnt say noithing else

crude cobalt
#

Thanks to everyone who helped guys

chrome beacon
#

Use
Objects.equals(current.getOwner(), player.getUniqueId())

sterile token
#

If its impossible to be null

chrome beacon
#

Then mark your method as always not null or ignore the warning

sterile token
#

Im already checking

if (code == null) {
running code here if null
}

So here its suppoused not to be null nothing

#

So java its clown today

chrome beacon
#

It's because you have code == null && <-- and something

sterile token
#

Hmn?

chrome beacon
#

If second condition is false it will skip the return and continue

sterile token
chrome beacon
#

No return

sterile token
#

He?

#

the one on isSimilar?

chrome beacon
sterile token
#

Allr

#

Okay

#

Was really clown that

#

It fixed

#

Sorry i know im a noob

#

🤙

chrome beacon
#

I missed a bit of that too at first so no worries

sterile token
#

olivo?

#

Are u till alive?

chrome beacon
sterile token
#

Im really noob lmao

#

im still annoyed with the return key

kind hatch
#

The return keyword has two major uses.

  1. Exit the method immediately. Any code beneath it will not run.
  2. It "returns" the value of the method so long as the method is not void.

Guard clauses are a great example of how they work.

int value = -1;

// This is a void method so no value will be returned.
// However, this method could do something like set a value.
// In this case, it will set a value if all of the checks pass.
public void myMethod(boolean isValid) {
  if (!isValid) { // This is the guard clause.
    return; // We return here because the condition isn't met. The return keyword breaks the method right here.
  }
  
  this.value = 1;
}
sterile token
#

Because im checking if player is owner and return, but the code still running for some reason

#

Im on an event

#
public void onPlace(BlockPlaceEvent event) {
  Player player = event.getPlayer();
  Block block = event.getBlock();
  Claim claim = this.plugin.getClaims().getClaimAt(block.getLocation());
  if (claim == null) {
    // creation code
    return;
  }
  if (claim.getOwner().equals(player.getUniqueId())) return;
  if (!claim.getFlags().contains(Flag.Build)) {
    event.setCancelled(true);
    return;
  }
}
#

I dont know why the heck is no stopping the execution

#

Im really annoyed

kind hatch
#

Well if code is continuing to be executed, it means that your checks aren't passing.

sterile token
#

Hmn

#

I have debug and the owner uuid of claim equals player uuid

#

And i did sout(claim.getOwner().equals(player.getUniqueId())) and shown true

#

That my reason of being annoyed

#

Lmfao this is definitly trolling

chrome beacon
#

That can mess with other plugins

sterile token
#

Yeah

#

Just for test

#

But it must be trolling

#

I cannot find the reason

ivory sleet
#

Yeah a lot of trolls all the time troll

sterile token
#

Conclure

#

But im doing wrong?

sterile token
lethal python
#

guys i have an inventoryclickevent listener and i'm doing setcancelled(true) on it but players can still spam click and put an item in the inventory

#

how to fix

kind hatch
#

Listen to the InventoryDragEvent as well.

lethal python
#

:v

kind hatch
#

If you spam click, it can be considered an InventoryDrag

lethal python
#

thank you shadow master g 23

sterile token
kind hatch
sterile token
#

Its wrong the result

#

It should allow me to breaks blocks being owner

ivory sleet
#

Could try to put the event handler method at monitor in terms of prioritization

sterile token
#

But for some reason the code cotninues executing

ivory sleet
#

in case some other event handler method is overriding whatever you’re doing

sterile token
ivory sleet
#

It makes sure your event handler method runs lastly

kind hatch
#

It fires last in the execution order.

sterile token
#

But i will try it

ivory sleet
#

Mye

sterile token
#

Oh also

#

Im really dumb

#

I have find the solution

#

The Flag should be apply to claim members

ivory sleet
#

Perhaps you were the troll /s

sterile token
#

So check if its a member and apply the flag

#

No

#

I just realized

#

🥰

#

I love you my boy

ivory sleet