#help-development

1 messages ยท Page 2150 of 1

ivory sleet
#

it helps in you in the future if you suddenly need to scale your project

humble tulip
#

I do use it because its easier modify your pom.xml than it is to download a new version of a dependency and import

ivory sleet
#

that too

humble tulip
#

but its not "bad" to not use maven

ivory sleet
#

there's no benefit not using maven or gradle

wind tulip
#

ik u can add dependencies from local jars as well but I feel like it's harder to set up

ivory sleet
#

I mean thats pretty simple still

shadow pulsar
#

It works well. Thank you very much.

humble tulip
#

What I'm saying is the use case matters

#

Exactly but there is veey little benefit when using it for simple plugins

ivory sleet
#

^

#

general maintainability and scalability

ancient plank
#

Maven is like so fucking simple to use and set up and anyone who says otherwise is either dumb as fuck or trolling and their opinion doesn't matter

humble tulip
#

lmao

#

๐Ÿ˜‚

ivory sleet
#

Ig thats one way to look at it

ancient plank
#

Literally you click a button in intellij and you can type like 2 lines into pom.xml and something works

humble tulip
#

It is ismple to use and i do use it but I didnt always use it so i can understand why some projects wont benefit from it

silver reef
#

hello, I got a question about some blockdata. Is it possible to power a block, other than a redstone related one, through code.

If you power a block using a repeater that is facing to the block, then placing a redstone wire behind it will power that too.
Can you replicate that without the initial repeater? By powering that block or something?
I want to illustrate it but cant post images here.

My goal is to power all the redstone that is touching a diamond block.

What I tried is checking all directions of the given block and then power all redstone blocks/wires/repeaters that are touching the block.
Although if I power a repeater or a redstone wire, it will instantly turn off because the block gets updated if it touches another redstonewire.

humble tulip
#

maybe listen to this even and cancel it if the block is next to the diamond block?

#

or set the current to the old current

#

because i dont think its cancellable

eternal needle
#

hi i have added Vault api to my plugin but i don't get economy....

humble tulip
#

do you have an economy plugin like essentials installed?

eternal needle
#

yes

humble tulip
#

Did you do depend: [Vault]

#

In your plugin.yml

eternal needle
#

do you mean in pom.xml?

humble tulip
#

Nope plugin.yml

#

So that the server knows to load ypur plugin after vault

tardy delta
#

depending on that plugin will make that it loads before your plugin loads

eternal needle
#

did not now that you needed somthing in there to

tardy delta
#

so if you wanted to use classes of it, that they are loaded

compact cape
#

Can you update a GUI inventory with an async task?

humble tulip
#

No

tardy delta
#

doing api stuff async breaks it

compact cape
#

Dang it ๐Ÿ˜‚

humble tulip
#

Why do you want to?

eternal needle
tardy delta
tardy delta
#

check their github page too

compact cape
humble tulip
#

Nah just do it sync

eternal needle
#

if i want to take money i need to type in my code economy.takemoney or somthing but econo don't show up

tardy delta
#

you will have to use another sync task

#

or go back to the main thread in the already existing async task but idk if thats a good practice

humble tulip
#

If you're getting the data to uodate it from the async task you can do Scheduler#runTask() inside the async task

tardy delta
#

like with maven or gradle

humble tulip
#

? paste

#

?paste

undone axleBOT
tardy delta
humble tulip
#

Paste your pom.xml and plugin.yml

tardy delta
#

then it should add the packages to your project

eternal needle
tardy delta
#

and you clicked the reload button so all errors are gone?

eternal needle
#

yes

tardy delta
#

show what completions you get when you type Economy then

eternal needle
#

nothing show up

#

found the probelm i did have a smal e

humble tulip
#

Lol

tardy delta
#

it shows up now?

eternal needle
#

with big e yes but Economy.withdraw... don't work

tardy delta
#

its not a static method

#

did you take a look at the guide a sent?

humble tulip
#

can you just paste all your code so we can have a look?

tardy delta
#

also ${project.version} doesnt work in plugin.yml afaik

eternal needle
#

}else if(e.getView().getTitle().equalsIgnoreCase("Ban This Noob")){
switch(e.getCurrentItem().getType()){
case BARRIER:
sandtak2.openMenu(player);
break;
case WOODEN_AXE:
//Get name
String name = e.getClickedInventory().getItem(4).getItemMeta().getDisplayName();
Economy.
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "eco take " + name + " 1000");
//player.getServer().getBanList(BanList.Type.NAME).addBan(ChatColor.stripColor(name), "I said so", null, "The code god");
player.sendMessage(ChatColor.GREEN + "Tatt penger fra:" + ChatColor.YELLOW + name);
break;

tardy delta
#

wat

#

i should do that too

humble tulip
#

i use it as well

#

yep you should

#

blobsky you need to have the economy instance

eternal needle
#

oh

tardy delta
#

look at the guide

humble tulip
#

you have an economy variable in your main class right?

eternal needle
tardy delta
#

i wouldnt make it static

humble tulip
#

you shouldnt use static

#

but it'll work

tardy delta
#

lol everything with static will work

eternal needle
#

but i have that in main file

humble tulip
#
public class YourCommand implements CommandExecutor {
    private YourPlugin plugin;
    private Economy economy;

    public YourCommand(YourPlugin plugin) {
        this.plugin = plugin;
        this.economy = plugin.getEconomy();
    }

//your onconmmand method here
}

tardy delta
#

uhm plugin.getEco?

humble tulip
#

when registering your command you do setExecutor(YourCommand(this));

#

"this" refers to an instance of the Main class / plugin

#

that will pass your plugin instance to the command class so that you can access methods in your plugin class from the command

#

remove static from the economy variable in your main class as well as the getEconomy method

eternal needle
#

so i can't have one line code?

humble tulip
#

what do you mean one line code?

eternal needle
#

i only need to take 100 from a player

humble tulip
#

yes but to do that you need to access the econonmy in your plugin class

#

to access the econonmy in your plugin class, you have to get it from your main class

#

I showed you above how you pass the econonmy from your main class to your command class

#

then you can do eco.deposit() and eco.withdraw() in one line

eternal needle
#

ok

#

thx

eternal needle
quaint mantle
#

statement.executeUpdate();

#

is used to update the db when it's running async, right ?

#

I need some help explaining on how to run a db in async mode, I already have it set up, the problem is I'm not getting any data back.

#

It's returning null.

#

This is the code I use, and I have it when a player join, it loads his data and it doesn't work for some reason, I need your guys help.

terse raven
#

how do i get the saturation amount of a food item?

humble tulip
quaint mantle
#
java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.HashMap.get(Object)" is null
        at org.andrej.utils.Economy$2.run(Economy.java:83) ~[?:?]
        at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3488-Spigot-b6d12d1-d48f2d1]
        at org.bukkit.craftbukkit.v1_18_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) [spigot-1.18.2-R0.1-SNAPSHOT.jar:3488-Spigot-b6d12d1-d48f2d1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:833) [?:?]```
#

this is the error i get

mighty bane
#

So I'm trying to stop the player from dealing damage when they have a specific tag applied however it does not seem to be registering the event, did I do this code right?

    public void onPlayerDamage(EntityDamageByEntityEvent damage) {
        Player player = (Player) damage.getDamager();
        if (player != null && player.getScoreboardTags().contains("Sprint")) {
            damage.setCancelled(true);
        }
    }
mighty bane
#

Oh wait... I forgot to register the event.

quaint mantle
#

Sorry ?

#

This is how the table looks like.

quaint mantle
#

does it ?

mighty bane
#

@quaint mantle Thanks for the help.

quaint mantle
humble tulip
#

Well?

quaint mantle
#

it worked..

#

im just dumb

#

forgot that indexing and .setString is different

humble tulip
#

Is uuid a primary key?

#

It doesn't seem so from that pic

#

Uuid should be a primary key and not null

#

I'm seeing null entries below the first

quaint mantle
#

it is.

#
CREATE TABLE player_data(

    uuid VARCHAR(32) PRIMARY KEY,
    money bigint,
    chips bigint,
    teams VARCHAR(16)

)```
#

@humble tulip This, right ?

wind tulip
#

Isn't maven useless if the dependencies aren't in the maven repository

#

because then if the API/dependency gets updated you still have to download the new version

kind coral
#

afaik running build tools gives you the spigot sourcecode right?

kind coral
quaint mantle
#

What's the difference ?

kind coral
#

Char is a fixed length

#

while VarChar can be variable

#

UUID are all 36 char long

quaint mantle
#

oh okay

ivory sleet
wind tulip
#

oh

#

well if that is true for every dependency why do you need maven

quaint mantle
#
Caused by: java.net.ConnectException: Connection timed out: connect
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at java.base/sun.nio.ch.Net.connect0(Native Method)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at java.base/sun.nio.ch.Net.connect(Net.java:579)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at java.base/sun.nio.ch.Net.connect(Net.java:568)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at java.base/java.net.Socket.connect(Socket.java:633)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:156)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
[19:58:15] [Craft Scheduler Thread - 555/WARN]:         ... 14 more```
#

Now I get this shit..

ivory sleet
#

as said modularity, transitive dependencies and it becomes way easier when we work together with for instance git/mercurial

#

it is also easy to update dependencies when they need to be updated

#

in other words if they present an api breaking update where eventual, deprecated methods might be removed and so on

grim ice
#

uh

#

why is a double 64 bits

#

and a float is 32 bts

ivory sleet
#

think thats mostly by convention?

echo basalt
#

the extra bits on the double allows for decimal precision

steel swan
wary harness
#

Anyone tell is this some exploit

#

all gui plugins are throwing

#

that error

#

like some one is trying to click slot 8114

#

litterly same error in all plugins which have gui

#

like someone is sending some falls packets

dusk flicker
#
  • 1.16.5
  • not spigot
  • contact the author
    something is going on there but only really the author could verify exactly
vocal cloud
#

Git airplane

echo basalt
#

it wouldn't be clicking on slot 8114

#

because the index length isn't even the inventory size

vocal cloud
#

Why the heck would a plugin be trying to get an item in slot 8114 thonk

echo basalt
#

mathemathically calculated slots

tardy delta
#

smh

quaint mantle
#

HEllo!
Im working on a Bungeecord plugin and im wonder how to get health from a ProxiedPlayer?

dusk flicker
#

Doubt you can

echo basalt
#

ask the player's spigot server

#

or do packet hackery

dusk flicker
#

Considering, it's a proxy

quaint mantle
dusk flicker
#

its a proxy, legit none of those exist

#

you need to get it from the spigot server, and if you want it on the proxy then get the data there from the server somehow

#

if thats plugin messaging channels, redis, etc

echo basalt
#

there are some proxy actions you can do from the spigot side

wary harness
#

log file is huge

quaint mantle
#

Good idea

echo basalt
vocal cloud
quaint mantle
#

How do I get a player by UUID in bungee cord

wary harness
vocal cloud
#

Try it with regular spigot and not that really ugly custom fork shrug1

dusk flicker
#

Doubt it, considering f3 is clientsided; also why would you want too

vocal cloud
mighty bane
dusk flicker
#

that happens a lot lol

ivory flume
#

How can i opena signed book with custom text

crisp steeple
#

right click

ivory flume
#

โ€ฆ

crisp steeple
#

believe packetcustompayload has something with it

#

im not exactly sure why its even possible, since it seems like something that should be controlled by the client

ivory flume
#

ยฏ_(ใƒ„)_/ยฏ

#

its sometimes better than an inventory

fossil mural
#

how can i check if a falling block is at roughly the same location as the player head or feet

ivory flume
#

or actually i dont need to do that

crisp steeple
#

well yeah, but idk why its even possible for the server to make the client open a book

#

but ik that it is possible

ivory flume
#

all right ty

#

how fows book nbt work

#

is there ajy guides on that

crisp steeple
ivory flume
#

ty

twilit roost
#

Im trying to add skin onto NPC
I tried using Mojang session server website to get "Texture" and "signature" and also mineskin.org

Neither of those worked
Now Im trying to print those values, and looks like my Config cannot read the value ??

Config For Textures:

public default String getSkinURL(String inConfigName){
        return ConfigManager.getNPCSkinConfig.getString(inConfigName);
    }

Texture Getter:

String texture = getSkinURL("goldHoarder");

In Config:
IMAGE VVV
(yes I do end " at the end of the line)

warm trout
#

How can I make a boat move faster, I've tried PlayerMoveEvent and VehicleMoveEvent, but they get triggered by me setting the velocity within them, so I have no way of telling when the player has actually stopped moving

#

Is there a better way?

twilit roost
quaint mantle
#

How do I make a PluginMessageListener in Bungee

midnight shore
#

has anyone got a good minecraft skin editor? i'll need it for making custom heads

twilit roost
#

skindex

shut field
#

how do I use Maven to fix it?

midnight shore
# twilit roost skindex

ty but how could i make sure that my skin is rotated to north? because if i use the head and its not rightly oriented in the skin it wouldn't show up correctly in-game

twilit roost
#

not sure 'bout that

undone axleBOT
dusk flicker
#

?pmc

dusk flicker
dusk flicker
quaint mantle
#

Can someone tell me how to put getConfig()... in a seperate file (e.g. command)

chrome beacon
#

Have a reference to your plugin instance

#

You can use dependency injection for this

#

?di

undone axleBOT
quaint mantle
#

thx

daring lark
#

        if(!hasShop(shopOwner))
            return;
        if(isShop(chest))
            return;

        String playerId = shopOwner.getUniqueId().toString();

        allShops.remove(shops.get(playerId).get(shopId));
        shops.get(playerId).remove(shopId);

        NamespacedKey key = new NamespacedKey(BlockEconomy.getPlugin(BlockEconomy.class), "id");
        chest.getPersistentDataContainer().remove(key);
        chest.update();
    }```

how could i remove key from persistent data container? I have code like this.
paper mulch
#

Just invert condition on if(isShop(chest)) to if(!isShop(chest))

#

@daring lark

short harbor
#

Anyone know of a plugin that will send an afk player back to spawn?

dry forum
#

if i have a directory in my plugins folder called "kits" for example and i want to use

        f.createNewFile();``` how would that work since test/demo isnt a directory? i tried this and it says the directory doesn't exist but ive used this EXACT code before and it created the directories automatically (its in a method which is why theres no try catch)
daring lark
#

mkdir?

wind tulip
#

How do you convert Bukkit.getOnlinePlayers() to a player array? Simply casting it gives you a ClassCastException

ivory sleet
#

.toArray

dry forum
rare thicket
#

Im having trouble with my server. When I quit the server in a world, the inventory doesent save. But if i switch worlds before quitting the server, the inventory saves. What could it be?

ivory sleet
daring lark
ivory sleet
#

yml is valid json tho

#

or well

#

to some extent

#

but json is valid yml

daring lark
#

yes

rare thicket
#

Hello?

dusk flicker
#

no

ivory sleet
#

so if they wanted to, they could put a json structure and itd be yaml still

daring lark
ivory sleet
#

mye or just use what bukkit alr offers

daring lark
#

but anyway

wind tulip
#

im asking how to cast it to a player array

ivory sleet
#

IntFunction<T[]>

daring lark
#

i have a qustion, how could i check if player right click at chest?

river oracle
#

player interact event than check if right click then block check

ivory sleet
#

perhaps the interact event, if there arent any better ones

daring lark
river oracle
daring lark
river oracle
#

Represents an event that is called when a player interacts with an object or air, potentially fired once for each hand. The hand can be determined using getHand().

#

if you only want it to be fired once make sure you filter it properly

daring lark
#

how could i chech if it's right hand?

glossy venture
#

check getHand()

#

i assume you mean main hand

daring lark
#

if(e.getHand().equals(EquipmentSlot.HAND))

#

like this?

glossy venture
#

yeah think so

ivory sleet
#

thats correct

#

?services

undone axleBOT
slate spruce
#

boutta jus spam grejfgagljy on posts.

ivory sleet
#

nah dont

slate spruce
#

like why i need 20 ๐Ÿ’€

ivory sleet
#

Idk, make serious posts at least

slate spruce
#

i can't

ivory sleet
#

I mean thats how the system works

slate spruce
#

lmao

#

I'm trying to hire a developer.

ivory sleet
#

ye

slate spruce
#

Yeah I'm spamming in the comments.

ivory sleet
#

well Im just a discord moderator here, but I strongly discourage you from going to other unsuitable places to spam there nonetheless

river oracle
#

because spigot isn't supposed to be a market place

slate spruce
#

Should make a channel "Development Request"

river oracle
#

?services

undone axleBOT
river oracle
#

๐Ÿ’€ cope

slate spruce
#

yeah ive been told 6 times

#

still aint got 20 posts

#

and this discord mod will get mad if i spam

river oracle
#

no most people would get mad if you spammed

#

not just the discord mod

#

because its annoying and unhelpful

slate spruce
#

so how tf i comment.

like I said imma jus say they got nice hair and eyes

river oracle
#

to get 20 posts why don't you contribute something if you have a problem with the policy go elsewhere use that brain of yours and figure it out

ivory sleet
#

but well, we havent gotten that far yet altho theres just a proposal that we are debating

daring lark
#

how could i check if player has item in hand?

tall dragon
#

Player#getInventory().getItemInMainHand() gets you the itemstack in his hand i believe

#

then just compare to whatever u need it to be

wind tulip
#

Anyone know how to set a custom tab list? (Header & Footer)

dry forum
wind tulip
#

This takes in a string though? What about multiple lines?

dry forum
#

yeah go to my reply message

#

i need to create the folders and the file

tall dragon
wind tulip
#

alright

ivory sleet
dry forum
#

it worked ty

ivory sleet
#

yuh google coding style be poppin /s

daring lark
#

if(!(player.getInventory().getItemInMainHand() instanceof ItemStack)) how could i check if item in hand is null? i have code like this.

tall dragon
#

you dont need to check if its an itemstack

daring lark
#

if (p.getItemInHand().getType() != null) shpuld i do stuff like this

tall dragon
#

i ussually do if(player.getItemInHand() == null || player.getItemInHand().getType().equals(Material.AIR)) // item is air.

#

not sure if hes using a sufficient version for that

#

since he also does not call getInventory

#

for the player hand

crisp steeple
compact haven
#

Unless the API has changed since then, Material is an enum so use == and no it canโ€™t be null

crisp steeple
#

.isAir() should probably be used, although i donโ€™t see how someone could ever be holding cave air

quaint mantle
echo basalt
#

you're looking at the wrong class

#

net.devcowsoftware.networkcore.core.spigot.commands.spawn.SpawnCommand

is not

net.devcowsoftware.networkcore.core.spigot.storage.database.db.core.tables.SpawnTable

quaint mantle
#

Iโ€™ll take a look

#

Itโ€™s the vet last one for getting x thatโ€™s causing it for a null player when it get yo yaw and pitch with the same player

torn shuttle
#

hey completely unrelated to spigot but does anyone know off the top of their heads if there's a way to make an html link (<a>) that doesn't lead anywhere but also doesn't make the browser go to the top of the existing page?

#

maybe I should just be using buttons

#

yeah I'll just do buttons, whatever

quaint mantle
#

YO

tall dragon
#

yo

quaint mantle
#

yk how locations have exact locations like it's 5.0, 5.0, 5.0 not 5.4545, 5.6576, 5.24?

tall dragon
#

yes

#

i know

eternal night
#

some would argue 5.45 is more exact that 5.0

quaint mantle
#

yes but since the block is one whole thing it takes up the whole location

#

right?

#

what if i want player.getLocation() to be like that too

#

round it or decimalformat

tall dragon
#

then use player.getLocation().getBlock().getLocation()

quaint mantle
#

ohh

#

forgot about that

#

ty

tall dragon
#

or

#

pretty sure location has like getBlockX() and stuff

tender shard
tall dragon
#

i hate myself

#

for not paying attention in math & physics

quaint mantle
#

fuck geometry

#

fuck physics too

#

but physics is interesting

#

and the history of it

tender shard
#

orbital mechanics are interesting

#

KSP teached me more about physics than school did in 12 years

#

taught*

quaint mantle
#

wtf is KSP

tender shard
#

kerbal space program

tall dragon
#

tbh i would personally deliver a medal to someone that makes me understand vector math

tender shard
tall dragon
#

yea

#

if you know

#

:()

tender shard
#

a vector is basically a "direction". let's imagine you have two points: x0 z0 and x2 z3. let's call the first point "spawn" and the second point "destination". to get the direction from "spawn" to "destination", so simply calculate "destination minus spawn".

so:
spawn = 0|0
destination = 2|3

now you wanna calculate 2|3 - 0|0

You simply now calculate 2-0 = 2 and 3-0 = 3

So the direction from 0|0 to 2|3 is 2|3

#

if now "spawn" is at 1|2, you instead do
2|3 - 1|2
so 2-1 = 1
and 3-2 = 1
so from 1|2 to 2|3, the direction is 1|1

#

basically 1 step in the x direction and 1 step in the z direction

tall dragon
#

ye im sorta familiar with this part. but what does stuff like normalizing rlly mean

tender shard
#

normaling is easy too

#

you know the pythagoras "law" right?

#

a^2 + b^2 = c^2

tall dragon
#

yea

tender shard
#

a and b are the length of your vector

#

imagine your vector is 2|3 as above

eternal oxide
#

complex way to explain it

tender shard
#

so c would be sqrt(2*2 + 3*2)

#

normalizing means you turn that vector so that c equals 1

#

hm if only I could draw something rn

tall dragon
#

i dont rlly understand that yet

tender shard
#

okay I will get a pen and paper in a minute or 5

eternal oxide
#

Simple explanation. A vector has a length, which is a sum of all its values. Normalizing shrinks all those values so they total 1 or less

olive lance
#
  17176:       <modelName>primoard</modelName>
  17177        <txdName>primoard</txdName>

  17297      <Item>
  17298:       <modelName>hellion6str</modelName>
  17299        <txdName>hellion6str</txdName>

  17404      <Item>
  17405:       <modelName>npwheelchair</modelName>
  17406        <txdName>npwheelchair</txdName>``` Anybody know some regex to get everything EXCEPT whats inside <modelName> tags
quaint mantle
#

what's the best way to track an item like i'm making a duels plugin and i want all items in duels to have like a tracker so if u have an item from duels outside of a duel it removes it

quaint mantle
#

ive never seen anything stored in .xml in spigot

olive lance
#

its neither it is a more general question about regex

tender shard
earnest forum
tender shard
quaint mantle
#

or just 2*2 + 3*3 is what i think he meant

#

but squaring it is the correct way of showing it

earnest forum
#

yea

wispy bridge
eternal night
#

I mean to understand normalisation you need the length 5Head

earnest forum
#

normalization makes the vector a length of 1, used for direction vectors

wispy bridge
#

Yes...? But this doesnt really showcase the normalization part

tall dragon
#

well he aint done yet

eternal night
#

that is the boring part tho

wispy bridge
#

ยฏ_(ใƒ„)_/ยฏ

tall dragon
#

@tender shard how bout we take this to a thread

#

else i dont know what to make of it soon

earnest forum
#

vector named "v" length 4

---->

v.normalized()

->

eternal oxide
#

Vector(10,20,70) normalized becomes (0.1, 0.2, 0.7)

river oracle
#

I was about to type out some elaborate config issue only to realize I had my config name wrong ASfacepalm

tender shard
# tender shard Iโ€˜ll reply to this message in a few minutes

so we have two vectors: x1 at 2|2 and x2 at 6|4. The "difference" between these two is 6|4 minus 2|2 which results in 4|2.

The length of our vector now is sqrt(4*4 + 2*2), which means it's roughly 4.47. So, to normalize this vector, we have to turn this into a length of one. So, simply divide both the height and the length by 4.47 and we end up with a vector that has a length of one:

4 / 4.47 | 2 / 4.47 = (roughly) 0.9|0.5
(because 0.9*0.9 + 0.5*0.5 is ROUGHLY 1)

#

there's probably some youtube videos that explain it in a nice way

tall dragon
#

so if i understand correctly normalizing just makes the length roughly 1 but lets you keep the direction.

tender shard
#

basically a vector is just "calculating with more than dimension" lol

earnest forum
#

yes

tender shard
#

and the direction stays the same

#

yes

tall dragon
#

ah okay

fervent robin
#

?paste

undone axleBOT
earnest forum
#

length of 1 is good because you can multiply it with a length if you want to go a certain direction x amount of times and it will be accurate

eternal oxide
#

You can think of the length as a speed indicator

earnest forum
#

yes

tall dragon
#

imma need to experiment with this a bit to see if i really understand when i get home.

#

thanks a bunch alrdy guys

tender shard
#

if someone says something like "direction", in 99% of cases they mean a "normalized version" of the difference between "destination" and "origin" vector

#

because obviously if you stand at 0|0 and you look at 10|10, it's the same direction as if you stand at 0|0 and look at 455|455

#

the direction is the same, the only difference is the distance

#

a direction is like the "angle" at which you are looking

#

while the "difference" is the "angle" + "distance"

earnest forum
#

for example:

forward direction vector (0,0,1)

when you multiply this vector by x, you go x far in that direction

vector = new Vector3(0,0,1);

player.position += vector * 50; //will go 50 units forward
tender shard
#

I don't think they are looking for code examples but more like what it actually does / what it's for

earnest forum
#

yea ig

#

codes a good way to show how it works tho

tall dragon
#

okay. but u guys know jump pads right

#

they shoot you in the direction you look

#

but if you look down for example most plugins will still shoot you upward

#

hows that done then

eternal oxide
#

Player#getEyeLocation().getDirection()

earnest forum
#

that still points down

#

tho right?

#

you probably need to use some trigonometry

tall dragon
earnest forum
#

get the Y rotation of the player and then convert it to direction vector

eternal oxide
#

if the Y component is negative, invert it

earnest forum
#

i think he just wants the straight/back left/right

#

nothing up or down

tender shard
#

to ignore the "height" (looking up/down), simply set the Y value of the vector to 0

eternal oxide
#

if you don;t want up or down, you just setY(0)

tall dragon
#

i dont want to ignore height tho

earnest forum
#

its a direction, not position

eternal oxide
#

then invert Y if its negative

earnest forum
#

remember

tall dragon
tender shard
tall dragon
#

depends on the plugin i guess

tender shard
#

they simply get your X/Z direction, and then boost you up with a Y velocity of 1 or sth

eternal oxide
#

I thought jump pads had a specific Y

tall dragon
#

most i experienced did not.

tender shard
#

probably depends on the game(mode) and plugin etc

earnest forum
#

the jump pads usually add their own upward force and ignore how high the players looking right?

tender shard
#

anyway, vectors per se are extremely simple. it's just calculating with 2 or 3 or N dimensions instead of 1

tall dragon
#

ye i think i kinda get it.

tender shard
#

in "normal" math, the difference between B and A is "A - B".
In a two dimension vector (x and y) it's just: the difference between B and A is "(Ax|Ay) - (Bx|By)"
And a normalized vector is where sqrt(x^2 + y^2) is exactly 1
Lol hard to explain but easy to understand if your math teacher isn't total shit

earnest forum
#

if you cut the y value from the direction vector, you would need to normalize again right?

tall dragon
#

the math i got at school never rlly got this advanced tbh

tender shard
eternal oxide
earnest forum
#

no lmao

#

im in year 9 and i havent learnt this

tender shard
#

hm well idk, I finished school 10 years ago lol

tall dragon
#

idk what 7th grade rlly means for me

earnest forum
#

sebastian lague has some good tutorials on this i think

river oracle
#

was 7th grade for me ASakashrug I guess every school is differnet

earnest forum
#

he uses unity as his platform but the explanations are good

humble tulip
#

@tall dragon LOL

tender shard
humble tulip
#

Hello

tender shard
#

if you start school with 6 years old, then 7th grade would be classes for 13 year olds

tall dragon
earnest forum
#

I think since im in australia 9th grade is 8th grade in the us

humble tulip
#

Coincidence seeing you here

quaint mantle
tall dragon
tender shard
#

I just checked, in germany vector stuff is like 9th/10th grade so for 15-16 year olds

humble tulip
#

Do you have your own servee now?

tall dragon
#

no

tender shard
#

so I learnt it about 12 years ago lol

humble tulip
#

Ur a dev?

tall dragon
#

just hobby dev

humble tulip
#

Nice :D

tall dragon
#

doin some work for acentra

#

but that bout it

humble tulip
#

Oh wow

tender shard
#

this is basically all one has to know about vectors

humble tulip
#

Vectors

#

AO+OB=AB

#

@tall dragon ur working with vectors?

tall dragon
#

not exactly. but i was interested in learning how it works.

#

and i think i got the hang of it

tender shard
tall dragon
#

guess they didnt think vectors would be important

tender shard
#

that's reasonable, it'd be very hard to come up with a real life scenario where a carpenter would ever need vector math lol

tall dragon
#

especially in these times

#

my workstation is a pc with 2 screens

#

and the machine does the work

river oracle
tender shard
river oracle
#

the value that is assigned from addExperience

#

it should go into setExperience and add values accordingly the debug statements confirmed that the values are being added but not fully saved

#

I'm wondering if it could be where I placed my save statements?

tender shard
#

hard to imagine what all those things do in the first place

#

e.g. this "configUtils" things

river oracle
#

how I manage configs

#

I can send full class if you need but it works as intended

river oracle
#

time to figure out where the fuck this 100 is coming from

river oracle
golden kelp
#

Hello guys, how can I input data from user WHILE being able to print stuff? I want to make smthing like the spigot server console (when u simply run the jar)

tender shard
golden kelp
#

Ohh

#

Ty

torn shuttle
#

html is the language of the devil

vocal cloud
#

That's JavaScript. HTML is a lot nicer

torn shuttle
#

no it isn't

#

have you ever tried to make a webapp with html, it sucks

tender shard
#

HTML itself isn't so weird

#

what sucks is that every browser renders it slightly different

torn shuttle
#

either I dump everything on the same html page or I rely on ajax requests to get html fragments to load content from other "pages"

#

it's super messy structure-wise if you are trying to do something even a little complex in a single page

#

it's not hard to write but until I just gave up and started collapsing everything I was spending more time scrolling than doing anything else combined

#

but I guess I got it to work in the end, gaze upon my magnificent webpage and despair mortals!

quaint mantle
#

hbo max

torn shuttle
#

they copied it from me

quaint mantle
#

๐Ÿ‘๐Ÿฟ ๐Ÿ‘๐Ÿฟ ๐Ÿ‘๐Ÿฟ

tender shard
#

sue them

#

and insult them on twitter

torn shuttle
#

nah man I'm a charitable person

tender shard
#

then only insult them on twitter

torn shuttle
#

I think of the poor multibillion dollar industries that just need that extra boost

#

I did write it off as 3 billion dollars donated to charities in my tax forms though, still waiting to see if that gets approved

tender shard
#

in all countries that I know of, you can only deduct donations from your taxes if the "company" you donated to is a non-profit organization

torn shuttle
#

they barely make billions of dollars, it's basically charity

tender shard
#

fun fact: my father runs a charity too (for molested children) and sometimes people apply to get funds from them because for example they lost all their money at gambling and now they ask the organization to at least buy them a new tv or sth lol

torn shuttle
#

is this the grindset I keep hearing about?

tender shard
#

wtf does grindset mean lol

torn shuttle
#

oh boy

tender shard
#

so how am I supposed to know it

torn shuttle
tender shard
#

no "3d sound" = no listen :<

torn shuttle
#

yeah you're clearly not a sigma male

tender shard
#

I'm an alpha femboi

dusk flicker
#

lol

torn shuttle
#

you're a ligma male

tender shard
quaint mantle
#
name: Rust

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Build
      run: cargo build --verbose

    - name: Run tests
      run: cargo test --verbose
torn shuttle
#

at least I have a 10/10 grindset

tender shard
#

I will have to look at urban dictionary now

quaint mantle
#

Oh, so you're also uneducated in the rare fish market.

tender shard
quaint mantle
#

Us rare fish enthusiasts are seemingly rare these days.

tender shard
#

oh

#

asterisk is a wrong translation

#

I meant zodiac sign

quaint mantle
#

lol

torn shuttle
#

sorry I can barely hear you losers from the top of my grindset superiority

tender shard
#

english is weird

#

for real, english is one of the worst languages. they always invent new words when they could just use existing words lol

quaint mantle
quaint mantle
#

is that a word

tender shard
#

why the fuck do they say "nostril". every other language I know just calls it a "nose hole" or "hole in the nose"

quaint mantle
#

Douchenozzle.

torn shuttle
quaint mantle
#

^

tender shard
torn shuttle
#

man can you imagine someone invented the word nose when you could say face triangle

quaint mantle
#
//! A module for error handling.
use std::io;

pub trait Panics<T> {
    /// Consumes `self`, then returns the stored value, else panics with the given message.
    /// # Examples
    /// ~~~
    /// use cnsl::error::Panics;
    /// use cnsl::stdin;
    ///
    /// let name = stdin::preadln("Enter your name: ").panics();
    /// ~~~
    fn panics(self) -> T;
}

impl<T> Panics<T> for io::Result<T> {
    /// Consumes `self`, then returns the stored value, else the error message.
    /// # Examples
    /// ~~~
    /// use cnsl::error::Panics;
    /// use cnsl::stdin;
    ///
    /// let name = stdin::preadln_raw(b"Enter your name").panics();
    /// ~~~
    fn panics(self) -> T {
        self.unwrap_or_else(|err| panic!("{}", err))
    }
}
#

so shmexy,

dusk flicker
#

so many fucking comments

quaint mantle
dusk flicker
#

lol

#

fair

quaint mantle
#

so i pledged to make mine incredible

dusk flicker
#

thats fair

#

can I bring it up how fucking stupid the event priority enum is

quaint mantle
#

elaborate

torn shuttle
#

took me 3 years to start remembering how they are ordered

#

lol

dusk flicker
#

YEAH

quaint mantle
torn shuttle
#

highest priority runs last

tender shard
tall dragon
#

actually kinda makes sense

dusk flicker
#

yeah the highest priority runs fucking last for some fucking reason

tall dragon
#

highest priority is last so it has the most impact

dusk flicker
#

once you get it, it does make sense but like

torn shuttle
dusk flicker
#

at least how I deal with stuff the highest priority is always done first

quaint mantle
tender shard
dusk flicker
#

I understand it once it makes sense, but like; how its described is just shit

#

the lowest one is the only one that actually describes it, saying being the low importance and should be ran first

tall dragon
torn shuttle
dusk flicker
#

and with the actual Enum description that is Represents an event's priority in execution sounds to me like the highest would have the first execution, rather than the other way around

tender shard
tender shard
#

in latin there are like so many words that mean the same thing and still people didn't die because of them. "agere" means "to do", "to trade", "to happen", "to act", "to play" and still people seemed to be fine for a few hundred of years lol

torn shuttle
#

that's because it took them a few hundred years to slowly develop improvements

tender shard
#

huh? they were like 1000 years ahead of their time

torn shuttle
#

no, they were exactly where they were in their time lol

#

so are we, thousands of years later

tender shard
#

after rome died, everything went to shit in europe and west asia for like 1000 years

torn shuttle
#

only if weren't royalty babyyyyy

#

or the catholic church

#

or christian actually

tender shard
#

the church of the flying spaghettimonster is the only religion that wasn't at least indirectly responsible for people getting killed

torn shuttle
#

if you want to count religions that have been around for less than 15 years and have basically no following I'm sure you'll finds lots of cults that haven't killed anyone (yet)

golden kelp
#

#general ig

ivory flume
#

is there any way to get the player yaw

#

getEyeLocation?

#

okay got that working

#

but

#

how do I set the player's yaw

#

ew, packets and protocol lib

torn shuttle
#

that forces the yaw

#

man I am finding myself having to generate IDs in html, I think I'm in too deep

ivory flume
torn shuttle
#

forcing player vision absolutely sucks anyway

raw sky
#

What would the packet name be for a player trying to use wasd on a mount?
1.16.4 to be exact

wet breach
#

entity move packet

#

that packet would contain if there is passengers for said entity

raw sky
#

would it be client bound or server bound? since the entity does not move by itself

ivory flume
#

its always client bound

#

this is server dev

#

or could it be server bound o.o

#

oh wait im dumb

raw sky
#

actually wouldnt that only show when the entity moves not when a player tries to move?

#

wait

#

which could it be!?

ivory flume
#

afaik the entity copies the movement from the player

#

so checking if the player has a vehicle while it moves is probably what you want?...

raw sky
#

ok so

#

im trying to fly a phantom

#

but I want to know when the player presses w

#

and s

wet breach
#

the client never sends those key presses

raw sky
#

but a phantom does not move by default

wet breach
#

it instead sends a move packet

raw sky
#

whats the name of the move packet?

wet breach
#

that packet contains the previous location and the to location that the player moved to

#

Player move packet for players

wet breach
#

if it is on an entity they technically still do

raw sky
#

it just isnt visible?

#

man packets are just

#

Ok ty I have enough information for now!

#

have a good day

echo granite
#

Priority = I come first, no "I come last"

drowsy helm
#

highest is last as it has most precedence and last say over the event

earnest forum
#

so do the event listeners before that still run?

drowsy helm
#

yes

#

having it at the highest priority means it just gets the last "decision" on the event

buoyant viper
#

v confusing when other event buses ive used consider high prio to be "i run before other handlers"

#

and not "i have the final say over other handlers"

kindred valley
#

Can someone please explain the parameters of arrayCopy() method

buoyant viper
#

if its java.lang.System#arraycopy its p simple

src is ur input array, dest is ur output array, srcPos is the position u want to start copying from the src array, destPos is the position u want to start copying into in the dest array, and length is how many objects u want to copy

kindred valley
torn shuttle
#

javascript is the only language where things work on the first try and I feel like complaining that they did

torn shuttle
#

idk about that one

onyx fjord
#

I mean you can do anything with it rly

hybrid spoke
#

javascript is just java in bad

onyx fjord
#

JavaScript is java without stupid oop

torn shuttle
#

I just spent 20 minutes trying to figure out how to get a div, remove one of its children, add another child and add a new parent between the two childs and the overarching child and god it's all so dumb

onyx fjord
#

Bruh

hybrid spoke
tardy delta
#

Smh

hybrid spoke
#

well, "without"

onyx fjord
#

And well intellisense also helps

torn shuttle
#

I know it exists, I have 20 tabs of it open right now

native nexus
#

IntelliSense is ๐Ÿ‘‰๐Ÿ‘ˆ

onyx fjord
#

Intellicode ๐Ÿฅต ๐Ÿฅต ๐Ÿฅต

torn shuttle
#

I sort of got it working but the main issue is that the thing I'm trying to do is dumb to start with

#

I was just trying to be clever about it so I could go to bed faster

native nexus
#

๐Ÿฅต๐Ÿ˜ฉ๐Ÿฅบ

onyx fjord
#

Tabnine ๐Ÿ˜ป

hybrid spoke
#

IntelliJ

onyx fjord
#

Intellisense

#

The smart auto complete

torn shuttle
#

"smart"

dark arrow
#
if(args.length>0){
                 StringBuilder message = new StringBuilder();
                 for(String arg:args){
                     message.append(arg+" ");
                 }
                 ItemStack item =  player.getInventory().getItemInMainHand();
                 ItemMeta meta = item.getItemMeta();
                 PersistentDataContainer data = meta.getPersistentDataContainer();
                 if(data.has(new NamespacedKey(PDS.getPlugin(),"message"), PersistentDataType.STRING)){
                     player.sendMessage(ChatColor.RED+"The Message is already stored");
                     player.sendMessage(ChatColor.BLUE+"Message: "+data.get(new NamespacedKey(PDS.getPlugin(),"message"),PersistentDataType.STRING));

                 }else{
                     data.set(new NamespacedKey(PDS.getPlugin(),"message"),PersistentDataType.STRING,message.toString());
                     item.setItemMeta(meta);
                     player.sendMessage(ChatColor.GREEN+ "Message Stored");
                 }
             }```This code is suppose to store a message in the PDC of the item but instead is just disables the plugin
onyx fjord
#

@torn shuttle you can't do ${var} in java

#

You need to do silly .format

torn shuttle
#

meh whatever I progressed with my webapp and it's actually starting to take shape

native nexus
#

You making a webapp with Java?

torn shuttle
#

no, the classic html+css+js

native nexus
#

Oh yes yes

#

Ghost errors

onyx fjord
#

Oh nana

#

Linters ๐Ÿฅต

shell bluff
#

Anyone have any idea why this isn't working? I'm trying to disable dyeing of a leather armor

@EventHandler
public void onLeatherArmorCraft(PrepareItemCraftEvent  e) {
        if(e.getRecipe() == null)
            return;
        
        if(e.getRecipe().getResult().getType() == Material.LEATHER_HELMET ||
                e.getRecipe().getResult().getType() == Material.LEATHER_CHESTPLATE ||
                e.getRecipe().getResult().getType() == Material.LEATHER_LEGGINGS ||
                e.getRecipe().getResult().getType() == Material.LEATHER_BOOTS) {
e.getRecipe().getResult().setType(Material.AIR);
        }
    }
eternal night
#

instead of attempting to modify the recipe itself (which won't work anyway)

shell bluff
#

oh thank you!

#
@EventHandler
    public void OnLeatherArmorCraft(PrepareItemCraftEvent  e) {
        if(e.getRecipe() == null)
            return;
        
        if(e.getInventory().getResult().getType() == Material.LEATHER_HELMET || 
                e.getInventory().getResult().getType() == Material.LEATHER_CHESTPLATE ||
                e.getInventory().getResult().getType() == Material.LEATHER_LEGGINGS || 
                e.getInventory().getResult().getType() == Material.LEATHER_BOOTS) {
            e.getInventory().setResult(new ItemStack(Material.AIR));
        }
    }
#

It works now

eternal night
#

๐Ÿ‘

crimson terrace
#

is there any way to make sure that my Listeners are called after the Listeners of another plugin?

eternal night
#

not really beyond event priority

crimson terrace
#

I have a plugin which edits mobs, wanna make another which edits mobs but with a lower priority. would it suffice to check for the tags I add to some spawned entities in the higher priority plugin and otherwise let the changes I make in the lower priority plugin be overwritten?

golden kelp
#

how do I check if a player is in a portal

golden kelp
eternal night
#

like, a custom portal ?

#

or a minecraft portal

golden kelp
#

minecraft portal

eternal night
#

I mean, the player is in the portal when they touch the portal block

golden kelp
#

I got two ends of it, i want to check if the player is in that portal

eternal night
golden kelp
#

Yea I tried it

#

no results, it just says player isnt it

chrome beacon
#

Make sure you have the correct bounds

golden kelp
#

I do

eternal night
#

Idk how the bb is constructed you might have to expand it

#

E.g it might be two dimensional if it just takes the floored cords of the two blocks

crimson terrace
#

how do people work with nms? is it even possible to read it?

hybrid spoke
#

mappings

crimson terrace
#

how can I remap it? its a pain rn

dense geyser
#

was there ever something called the packetverifier in spigot pre 1.8? found some old code that seems to mention it existing, and setting packet handlers inside a craftplayer object

crimson terrace
#

thanks Cipher ๐Ÿ™‚ ๐Ÿ‘

hybrid spoke
wet breach
#

get the opposing corners

#

bounding boxes can be 2d or 3d

golden kelp
#

how can I add invisible ligths that follow a player
I also want to change the colours (red and aqua, from the lantern thing) AND intensity
I was thinking of spawning invisble lanters around the player

crimson terrace
#

depending on the version I believe there is a Light block

golden kelp
#

1.18

nova prism
#

yh u can just place light blocks then

golden kelp
#

nvm

#

i asked the guy

#

its 1.15.2

crimson terrace
#

?paste

undone axleBOT
crimson terrace
golden kelp
#

what did you import

crimson terrace
#

Its in the paste at the bottom

golden kelp
#

i dont think you are using NMS

eternal oxide
#

You didn;t follow the instructions correctly. you used the wrong dependencies

quaint mantle
#

but i cnat figure it

quaint mantle
#

i do

#

it is fully created ive fixed that one ive ran into another one now

golden kelp
#
portals:
- ==: io.github.vinesh27.vclasses.entities.Portal
  effects:
  - ==: PotionEffect
    effect: 22
    duration: 500
    amplifier: 1
    ambient: true
    has-particles: true
    has-icon: true
  startBlock:
    ==: org.bukkit.Location
    world: world
    x: 60
    y: 60.0
    z: 60
    pitch: 0.0
    yaw: 0.0
  items:
  - ==: org.bukkit.inventory.ItemStack
    v: 2975
    type: STONE
    amount: 32
  - ==: org.bukkit.inventory.ItemStack
    v: 2975
    type: COBBLESTONE
    amount: 32
  commands:
  - /spawn %p%
  - /help
  endBlock:
    ==: org.bukkit.Location
    world: world
    x: 60
    y: 50
    z: 50
    pitch: 0.0
    yaw: 0.0

Why does getting the portals list return an empty list

undone axleBOT
#

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

golden kelp
#

nvm i found the issue, i was getting a List<Map>rather than a simple List<>

twilit roost
#

How can I enable 2nd Skin Layer on NPCs?

quaint mantle
#

so I am trying to make a plugin that hides all hoppers from players that are more than 10 blocks away from the player, is there any way of doing that without having to loop through an absurd amount of blocks?

golden kelp
#

So I have two ends of a portal, and I am checking if its the portal the player went through.
When I check using BoundingBox, it returns false. That is because the location of the player is 1 block ahead

#

So what should I do?

hybrid spoke
#

?bing TabCompletion

undone axleBOT
tardy delta
#

override TabCompletor#onTabComplete

#

lmao fking bing

tardy delta
#

who uses that shit

hybrid spoke
#

bing to hit the bong

tardy delta
#

๐Ÿคฆโ€โ™‚๏ธ

quaint mantle
twilit roost
tardy delta
#

my tab completions aaa

twilit roost
#

everyone uses normal mapping..

golden kelp
twilit roost
golden kelp
#

PlayerPortalEvent doesnt provide the coordinate in the portal. (It gives the block ahead of the portal, messes up when axis come in the game). How can I get the location in the portal

eternal oxide
#

the portal event shoudl give you the actual portal block the player interacted with

golden kelp
#

i m using PlayerPortalEvent

eternal oxide
#

test the entity one

#

the player one is Called when a player is about to teleport because it is in contact with a portal which will generate an exit portal.

golden kelp
#

I want it to be cancellable

#

so the player doesnt go into the portal if it matches the condition

eternal oxide
#

then check the from location

golden kelp
#

its 1 block ahead of the portal

eternal oxide
#

it should be the portal block

golden kelp
#

it isnt :(

eternal oxide
#

not the player Location, use the event.getFrom()

golden kelp
#

Yes I am using that

eternal oxide
#

sec I'll have to start my IDE to test it

twilit roost
#

Im trying to sneak my npc
in Remapped NMS
what am I doing wrong?

daring lark
#

why when i click at chest in playerInteractEvent the block is null?

golden kelp
daring lark
# golden kelp show code
    public void playerInteractListener(PlayerInteractEvent e) {
       Player player = e.getPlayer();
       if(!e.getClickedBlock().getType().equals(Material.CHEST))
           return;
       Chest chest = (Chest) e.getClickedBlock().getState();
       if(!shopManager.isShop(chest))
           return;
       String shopId = chest.getPersistentDataContainer().get(shopManager.getKey(), PersistentDataType.STRING);
       player.sendMessage(shopId);
       player.sendMessage(String.valueOf(shopManager.getShopCount(player)));
    }```
golden kelp
#

does it throw an NPE?

daring lark
#
java.lang.NullPointerException: Cannot invoke "org.bukkit.block.Block.getType()" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getClickedBlock()" is null
        at me.placek.blockeconomy.listeners.PlayerInteractListener.playerInteractListener(PlayerInteractListener.java:25) ~[BlockEconomy.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor430.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:git-Paper-186]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]``` error also
golden kelp
#

do a null check

daring lark
eternal oxide
#

doh had to restart. my dev server had the nether disabled so no portaling

golden kelp
#

sadge

#

how do u print all the blocks in a BoundingBox? I think i m onto something here

#

can it be converted to a Collection

wet breach
#

portals are a predictable size though, those from the game that is

#

easiest way is to just detect the obsidian that outlines the portal

golden kelp
#

I am making a plugin which gives player items when he goes through a portal. And I am having problems detecting the portal. I have two ends of it

wet breach
#

then you know that the inside dimensions is the portal

eternal night
#

isn't there PlayerChangedWorldEvent

#

or do they just have to walk through

eternal oxide
#
    @EventHandler
    public void onPortal(PlayerPortalEvent event) {
        
        event.getPlayer().sendMessage("Block: " + event.getFrom().getBlock().getType().name());
    }```Reported teh portal block teh first time, then it was always air
eternal night
#

and not actually teleport

golden kelp
#

Yes

#

just walk through

golden kelp
glossy venture
#

did u set api version to 1.18 or whatever

golden kelp
#

yes

#

api-version: 1.18

glossy venture
#

tf

golden kelp
#

i wonder if reducing one block from the player's vector would work

#

but i need to calculate how to reduce it depending on the axis

#

how does one add fake lights around a player
like the light glows but doesnt show
something like a fake lantern (so i can change colours) but I also want to change intensity

eternal oxide
#

@golden kelp ```java
@EventHandler
public void onPortal(PlayerPortalEvent event) {

    event.getPlayer().sendMessage("Found Portal: " + !findPortal(event.getPlayer()).isEmpty());
}

public Set<Block> findPortal(Player player) {

    BoundingBox box = player.getBoundingBox();
    World world = player.getWorld();
    Set<Block> portal = new HashSet<>();

    for (double x = box.getMinX(); x <= box.getMaxX(); x ++) {
        for (double y = box.getMinY(); y <= box.getMaxY(); y ++) {
            for (double z = box.getMinZ(); z <= box.getMaxZ(); z ++) {
                Block block = world.getBlockAt((int) x, (int) y, (int) z);
                if (block.getType() == Material.NETHER_PORTAL)
                    portal.add(block);
            }
        }
    }
    return portal;
}```
golden kelp
#

ty

#

So what it will do is return a Set that contains all the Purple portal blocks thing?

eternal oxide
#

it will contain a Set of any portal blocks your player is in contact with

golden kelp
#

ooh

tardy delta
#

fancy fancy

golden kelp
#

so it returned the Set, now I make a boundingbox using my portal coords to check if its that portal?

#
public Portal getPortal(Player player) {
        for (Portal portal : vClasses.getPortals()) {
            Set<Block> blocks = findPortal(player);
            BoundingBox bb = BoundingBox.of(portal.startBlock(), portal.endBlock());
            for (Block block : blocks) {
                if (bb.contains(block.getLocation().toVector()))
                    return portal;
            }
        }
        return null;
    }
    
    public Set<Block> findPortal(Player player) {
        BoundingBox box = player.getBoundingBox();
        World world = player.getWorld();
        Set<Block> portal = new HashSet<>();
        
        for (double x = box.getMinX(); x <= box.getMaxX(); x ++) {
            for (double y = box.getMinY(); y <= box.getMaxY(); y ++) {
                for (double z = box.getMinZ(); z <= box.getMaxZ(); z ++) {
                    Block block = world.getBlockAt((int) x, (int) y, (int) z);
                    if (block.getType() == Material.NETHER_PORTAL)
                        portal.add(block);
                }
            }
        }
        return portal;
    }
eternal oxide
#

You have your portal start/end, so create a BoundingBox and check .overlaps on any block from the Set

golden kelp
#

why any block?

eternal oxide
#

BoundingBox.of(start, end).overlaps(Set#get(0).getBoundingBox())

golden kelp
#
public Portal getPortal(Player player) {
        for (Portal portal : vClasses.getPortals()) {
            Set<Block> blocks = findPortal(player);
            BoundingBox bb = BoundingBox.of(portal.startBlock(), portal.endBlock());
            for (Block block : blocks) {
                if (bb.overlaps(block.getBoundingBox()))
                    return portal;
            }
        }
        return null;
    }
eternal oxide
#

you only need test teh first blocvk found

golden kelp
#

oh

eternal oxide
#

you are not going to be in contact with more than one portal

golden kelp
#

what if two purple block thing

quaint mantle
eternal oxide
#

they will be connected, so the same portal

golden kelp
#

am i drunk or does Set not have a get method?

eternal oxide
#

probably not

#

portal.iterator().next() will get teh first entry

golden kelp
#

u mean the set right

eternal oxide
#

yes

warm light
#

java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.sihab.customcommands.CustomCommands.getCommand(String)" is null

#

what is this error?

golden kelp
#

show plugin.yml

eternal oxide
#

No command of that name in your plugin.yml

warm light
golden kelp
#

and show your code

warm light
golden kelp
#

weird

#

oh yea

#

Commands

#

in your yaml, make it lowercase

#

commands

warm light
#

oh thanks

daring lark
#

java.lang.reflect.InaccessibleObjectException: Unable to make field private volatile java.util.logging.Logger$ConfigurationData java.util.logging.Logger.config accessible: module java.logging does not "opens java.util.logging" to unnamed module @11d0811e what that error means?

eternal night
#

Sounds like you are trying to serialise stuff that should not be serialised

golden kelp
eternal oxide
#

it Should never be empty

#

never was for me

golden kelp
#

sometimes it is

#

weird

#

also, when i check for bounding box it returns false

eternal oxide
#

check for bounding box?

golden kelp
#
public Portal getPortal(Player player) {
        for (Portal portal : vClasses.getPortals()) {
            Set<Block> blocks = findPortal(player);
            BoundingBox bb = BoundingBox.of(portal.startBlock(), portal.endBlock());
            player.sendMessage(Arrays.toString(blocks.toArray()));
            if(blocks.size() == 0) {
                player.sendMessage("ZERO FAM");
                return null;
            }
            if(bb.overlaps(blocks.iterator().next().getBoundingBox()))
                return portal;
        }
        return null;
    }
#

returns empty when i went from nether to overworld

#

Ohh

#

its if u go from certain direction

tardy delta
#

i dont understand why people always use ::size() == 0 instead of ::isEmpty

golden kelp
#

i didnt know that existed

#

ty

ivory sleet
tardy delta
#

:o

tardy delta
warm light
#

where I can get all blocks list?

eternal oxide
#

Material Enum isBlock

urban kernel
#

can someone help me make config files work

#

out of the main class

golden kelp
#

use your main class instance

#

to use the getConfig method

#

I recommended you to learn Java

hybrid spoke
#

?learnjava

undone axleBOT
golden kelp
#

ty

urban kernel
golden kelp
#

By

#

?learnjava

undone axleBOT
golden kelp
#

learning java

hybrid spoke
#

or you give him the right direction so he can look it up

#

how 'bout that

eternal oxide
undone axleBOT
eternal oxide
#

wrong person ๐Ÿ˜ฆ

eternal oxide
undone axleBOT
golden kelp
#

Does anyone know any way/api to light up the area around a player. Id also like it if theres
-Intensity Changing
-Colour changing (Aqua/Red as Lanterns have that)

urban kernel
golden kelp
#

I am using 1.15.2

tardy delta
#
public class MyPlugin extends JavaPlugin {

  public void onEnable() {
    new ClassThatUsesPlugin(this);
  }
}

public class ClassThatUsesPlugin {
  private final MyPlugin plugin;

  public ClassThatUsesPlugin(MyPlugin plugin) {
    this.plugin = plugin;
  }
}```
#

@urban kernel

golden kelp
#

And if it is your Event/Command, add the this paramter when registering

hybrid spoke
tardy delta
#

create the constructor for the class that requires your plugin

urban kernel
#

?

#

oh throwing the other code in commands/discord.java fixed it

#

magic*

golden kelp
hybrid spoke
golden kelp
#

yes

#

theres a red version and a aqua version

urban kernel
#

java

hybrid spoke
golden kelp
#

i mean does it use lanters for the light?

tardy delta
golden kelp
urban kernel
tardy delta
#

same thing

#

pass the config thro the constructor

hybrid spoke
#

otherwise just sent them a packet

golden kelp
#

Yea ill have to use packets unfortunately

urban kernel
#

@tardy delta

golden kelp
#

domain is kinda sick

urban kernel
#

cheers

tardy delta
#

pass your plugins config thro the constructor of Discord and assign it to a field

#

then use it

urban kernel
#

u lost me at thro

tardy delta
#

through better

urban kernel
#

i mean u lost me as in i stopped understanding what u where saying

tardy delta
#

youre tryin to get your plugins config in the Discord class?

urban kernel
#

yessir

tardy delta
#
class MyPlugin extends JavaPlugin {
  void onEnable() {
    new Discord(getConfig()).doSmth();
  }
}

class Discord {
  final PluginConfigFile config;
  
  Discord(PluginConfigFile config) {
    this.config = config;
  }

  void doSmth() {
    //
  }
}```
#

so when making an instance of the Discord class, it gets the config through the constructor and sets it as a field

#

to use it when neede

urban kernel
#

with doSmth(); do i replace it with getConfig()?

tardy delta
#

why do you want a getConfig method in your discord class?

#

just take the field

urban kernel
#

so i can pull discordLink out of config.yml

tardy delta
#

if you look at the Discord class above, it has a config field so why not getting your stuff from there?

urban kernel
tardy delta
#

idk what type getConfig returns exactly

#

and please use access modifiers

urban kernel
#

what the fuck are they

glossy venture
#

is there a way to control which nbt tags are sent to the clients

tardy delta
#

private, public, protected

urban kernel
tardy delta
#

ah its FIleConfiguration

#

should be private final lol

urban kernel
#

ahah

midnight shore
#

What does protected really do?

urban kernel
tardy delta
#

makes it accessible from subclasses

#

mate what are you doin with that getConfig method

#

i told you to use the field

midnight shore
#

public void getConfig(){ return config; }

tardy delta
#

he just wants to get stuff from the config

urban kernel
#

i think my ide is broken