#help-development

1 messages · Page 194 of 1

errant snow
#

But this would refer to the class that I'm making the instance in wouldn't it?

ivory sleet
#

mye

eternal night
#

OOP has nothing to do with mutability

ivory sleet
#

no not really

torn badge
errant snow
#

Just from a high level overview, intellij autocomplete says this references the outter class

torn badge
#

Please just show your real code

#

Why should all objects be immutable?

ivory sleet
#

no thats not what I said

#

but you should design against mutability if possible

#

makes unit testing easier for instance

torn badge
#

Yeah true and actually it’s unnecessary here because that’s no real state change

errant snow
# torn badge Please just show your real code

This is the function where I make the instance of MaterialListMenu, my end goal is that the line back(it.whoClicked) will reference the back(HumanEntity) method inside the instance of MaterialListMenu

private fun createStandardRegennableGui() {
    gui.addItem(BasicItem(
        ItemBuilder(regennable.getReplaceMaterial())
            .name("&aReplace Material")
            .addLoreLine("&7Current: &a${regennable.getReplaceMaterial()}")
            .addLoreLine("&7Click to change")
            .build(),
        onClick = {
            it.isCancelled = true
            MaterialListMenu(
                "&aSelect replace material for ${regennable.getIdentifyingBlockName()}",
                onMaterialClick = { onClick, material ->
                    onClick.isCancelled = true
                    regennable.setReplaceMaterial(material)
                    back(it.whoClicked)
                },
                previousMenu = this
            ).show(it.whoClicked)
        }
    ), 3, 2)
}
#

the onMaterialClick BiConsumer is called with an InventoryClickEvent and a Material determined by what was clicked by the player in the given event

torn badge
#

What’s it?

errant snow
#

hm?

torn badge
#

The variable it

errant snow
#

Oh, it's the InventoryClickEvent from onClick on line 8

#

onClick = {

#

kotlin just names them it by default

#

so it.whoClicked is InventoryClickEvent#whoClicked

torn badge
#

You can introduce another parameter like backAfterClick and then do the back() after accepting the consumer

errant snow
#

Ah I see, that's a smart approach

torn badge
#

But yeah consumers should be independent from their accepting instance

#

So that would be a way

errant snow
#

Right right

#

Thank you for the help, just needed some other brains that haven't been looking at this project for the past 4 hours lol

crimson terrace
solemn escarp
#

I am using MCreator and when I try to build a procedure It gives errors and the command doesn't work. This is the error it gives
error: cannot find symbol
getServer().getPluginManager().registerEvents(new FMapProcedure(), this);

tall dragon
#

isnt MCreator for mods?

solemn escarp
#

There is also the same error for
this.getCommand("fallmap").SetExecutor(new FallMap());

#

Yes, but there are extensions to allow building plugins

tall dragon
#

is your command in plugin.yml ?

solemn escarp
#

Nope, it didn't do that, I will add it

fluid river
#

why don't you just code in java with maven depndency

solemn escarp
#

I don't know a lot of java

fluid river
#

what you do here is basically copypaste from actual plugin code

#

registering listener and a command

#

you just need to

#

?learnjava

undone axleBOT
fluid river
#

or take FREE JAVA LESSONS from me

#

to start making own plugins

thorny marsh
#

Hey how can I limit water so that it doesn't flow more than X blocks?

fluid river
#

yes

#

jree fava lessons

sterile token
#

Hey, im again fucking, but what can cause exception when doing deserialization?

#

Because im using the ConfigurationSerializable and my class is not getting deserialized

brave sparrow
eternal oxide
sterile token
sterile token
eternal oxide
#

or you missed one of the requirements of ConfigurationSerializable

brave sparrow
sterile token
sterile token
#

wait let me upload the plugin

eternal oxide
#

you MUST register it before you attempt to access the config the Object is in

sterile token
#

ohh

#

that the reason

#

LMAO

#

I have been calling the config before doing class registration

balmy valve
#

anyone know a good method to recreate the teleport created by a chorus fruit?

balmy valve
#

yes

sterile token
#

Hmn

#

What is that?

balmy valve
#

its a fruit you get from the end

#

that does a random teleport

sterile token
#

Reason unacceptable code point '' (0x0) special characters are not allowed in "'reader'", position 0 - Loving fucking yaml

#

And the file is empty LMAO!!!

#

🤣 🤣 🤣

thorny marsh
#

Hey how can I limit water so that it doesn't flow more than X blocks?

sterile token
#

You can use the event

thorny marsh
sterile token
fluid river
#

no it doesn't work like this

#

🙂

crystal salmon
#

Hi, what way do you recommend to save inventories in config files? Reading in forums, they recommend get each item like ItemStack and save it in a specific section, later, get that section if you require the items. Is that the only way? I got serialize the Inventory object but I can't get it back Inventory object again

fluid river
#

Inventory is wrapping Iterable<ItemStack>

#

you just need to serialize it's contents

#

and name + size

#

then build it with Bukkit.createInventory(null ,name, size);

#

and then set contents from what you stored

ivory sleet
#

yes chrislo

#

mainly because the notion of serializing inventories is a bit ambiguous

#

in nms they seperate this by container contra ui

#

and so then the container (which just represents a stack of itemstacks) is serializable

fluid river
#

well you can store classname of Holder and use reflection to create new instance

ivory sleet
#

which is why the forums presumably directed you towards that solution

fluid river
#

and put it to inventory

#

so it would be

#
inventory-one:
  name: '&dBruh'
  size: 45
  holderClassName: 'MyHolder'
  contents:
    1: 'null'
    2: ITEMSTACK #DEFAULT ITEMSTACK SERIALIZATION
#

and then just build inventory with name size and new instance of holder class

#

after that loop through contents section and add items

crystal salmon
#

Thanks for the help, I will look into it. If anything, I'll ask around here 😁

fluid river
#

good luck

thorny marsh
fluid river
#

well you can create a cringe alogrithm

#

which would loop through all blocks in max radius(which you set manually with your plugin) from the block in the event

#

if block type is water

#

you get it's blockdata and cast it to Levelled

flint coyote
#

The source could also be a waterlogged block tho

fluid river
#

if level is maximum level

#

then allow event to happen

#

if there is no block with max level around, then cancel the fromtoevent

#

in legacy mc there were 2 types

#

STATIONARY_WATER

#

and FLOWING_WATER

#

but now it's all just water and have Levelled blockdata

thorny marsh
fluid river
#

yeah sadly there is no WaterFlowEvent

eternal oxide
#

its either Spread or Form event

wary topaz
#
int e = Integer.parseInt(args[2]);
                if (e == null) {
                    sender.sendMessage("null");
                }
                sender.sendMessage("debug lol" + e);
#

ping me when you reply

flint coyote
#

what's the question?

wary topaz
#

Why am I getting a error

#

thats my question ;-;

fluid river
#

there is no error in this code you sent

fluid river
#

if (s.name().toLowerCase().startsWith(args[1].toLowerCase())) {

#

change to args[0] probably

#

don't ask

wary topaz
#

Operator '==' cannot be applied to 'int', 'null' for the if (e == null)

#

args[0]? why?

#

im just checking if its a number

eternal oxide
#

don;t use Plugwoman

#

or Plugman

#

it breaks shit

worldly ingot
#

Was going to say, that error isn't even yours

fluid river
#

tho that's not even the error you should have

wary topaz
flint coyote
#

Also Integer.parseInt will throw a NumberFormatException if it fails. You shouldn't simply null check it after but instead go by try catch

wary topaz
#

ill do a try

eternal oxide
fluid river
#

do

try {
   int i = Integer.parseInt(string);
   // work around your i
} catch (NumberFormatException ex) {
    player.sendMessage("not a number");
}```
fluid river
#

what's this

wary topaz
#

did I import that?

#

oh idk I removed it

fluid river
#

yes, for making empty array lists

wary topaz
#

oh wait I needed it lol

fluid river
#

you can just use java's Collections.emptyList()

#

without importing google stuff

#

since when google adds stuff to Java?

#

or that's some random Google JDK which i don't know about

worldly ingot
#

Guava

#

It's shaded into Bukkit

#

Collections.emptyList() will return an unmodifiable empty list, so if you want an empty list you can modify, just do new ArrayList<>();

wary topaz
#

Works perfectly, thanks guys.

river oracle
#

Guava is amazing ❤️

wary topaz
#

This is what 2 months took me

#

(They all work)

#

"#recreating essentialsx"

fluid river
fluid river
worldly ingot
#

Yeah that's fine then. In fact that's better so a new list isn't created every time

wary topaz
#

ya really want to?

#

lol

fluid river
#

i can make this in 2 hours tho

#

why did it take so long tho

wary topaz
#

I quit halfway

#

got addicted to rick and mort

#

i'll get the links ready for the code review 😉

fluid river
#

dm

wary topaz
#

its gonna be a github but alr

jagged monolith
#

Colour comes from the Particle particle

#

As far as I know, only REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT can use custom colours. The rest can't

#

Those particles allow you to use the Particle#dustOptions

#

I haven't done it in ages, So can't remember exactly. I just remember that's how I did it

fluid river
#

Just open javadocs

#

you need to spawn particle with custom dust options added

#

like (..., ..., new Particle.DustOptions(Color.AQUA, 1));

#

iirc

worldly ingot
#

You need the spawnParticle() methods that accept T data

fluid river
#

ye

fluid river
quaint mantle
#

Whats the difference between extends and an implement interface?

worldly ingot
#

Only interfaces can extend interfaces

#

Though beyond that, you implement an interface, you extend a class. That's about the only difference

quaint mantle
#

Oh, i see

subtle bay
#

Hey there, I am beginning to trawl through plugin creation files, is there anyone around willing to answer a bunch of inane beginner questions so i don't have to spam a bunch of dumb easy to answer questions everywhere?

fading spindle
#

is there such thing as a player kill event? like a player killing another player, if so i cant seem to find it in player events

fading spindle
remote swallow
#

?scheduling

undone axleBOT
remote swallow
#

PlayerDeathEvent as well

fluid river
#

if entity.getKiller() is not null and is instance of player then here is the player who killed the entity

fading spindle
#

got it

fluid river
#

then player killed another player

fluid river
fluid river
#

and yeah interface can extend another interface to become sub-interface🤓

fluid river
#

hey @echo basalt look at the tutorial topic

#

Message where i have listener

fierce whale
#

does anyone know about this error? : java.io.StreamCorruptedException: invalid stream header: 5B424033

I can't solve this error 😦
Please help me...

Here is my code that read Object from yaml configuration by using ObjectInputStream

    public void setObject(String path, Object obj) {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            oos.writeObject(obj);
            oos.close();
            byte[] btarray = baos.toByteArray();
            String data = new String(btarray);
            getConfig().set(path, data);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public Object getObject(String path) {
        try {
            byte[] buf = getConfig().getString(path).getBytes();
            ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buf));
            Object obj = ois.readObject();
            ois.close();
            return obj;
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }```
quaint mantle
#

what's the best thing to use for spigot nms in paper?

#

since alvinss paper nms changes everything

#

and it bad

quaint mantle
fluid river
#

probably yes

quaint mantle
#

damn

fluid river
#

i don't think paperspigot changes nms

quaint mantle
#

im smort :)

#

let me try

fluid river
#

so you can access them same way as in spigot plugins

quaint mantle
#

alr, i gotta wait for my git to remap spigot

#

i'll come back

#

since i dont got a 1.19.2 version

fluid river
#

it's 8 am for me

#

gotta go sleep

#

won't notice you came back 🙂

quaint mantle
#

damn, alr

#

well gn

chrome beacon
#

Paper has Paperweight for nms

quaint mantle
#

which is way different than spigot's

#

i just wanna make an nms way to set blocks

#

people have sent me examples but they all spigot

chrome beacon
#

Just use the api?

quaint mantle
#

i use alvinss api

#

for paper nms

#

which should work

#

but its wayyy different

#

or im doing something wrong

#

but i dont think i am

#

this for example

#
// 1.19.2
    @Override
    public void setBlockSuperFast(Block b, Material material, byte data, boolean applyLightUpdate) {
        WorldServer nmsWorld = ((CraftWorld) b.getWorld()).getHandle();
        Chunk nmsChunk = nmsWorld.d(b.getX() >> 4, b.getZ() >> 4);
        BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());

        IBlockData ibd = CraftMagicNumbers.getBlock(material).m();
        ChunkProviderServer chunkProvider = nmsWorld.k();

        //modify blocks
        nmsChunk.a(bp, ibd, false);

        //update lights
        if (applyLightUpdate) {
            LightEngine engine = chunkProvider.a();
            engine.a(bp);
        }

        // send to client?
        chunkProvider.a(bp);
    }``` is so much different than alvinn's remapped version
chrome beacon
#

Just use the bukkit api

quaint mantle
#

i need the nms

#

and i can't use spigot's for paper

chrome beacon
#

You don't need nms for placing blocks

quaint mantle
#

#setType(mat) is laggy asf

chrome beacon
#

And you can use Spigots for Paper

chrome beacon
quaint mantle
#

cap

#

i'll try again

chrome beacon
#

The only way to make it faster is to make it unsafe

#

And you really don't want to break the world

crimson terrace
#

You can always make block placing fancy and make it do 10 per tick

noble cloak
#

what settings disables "vanilla bug fixes"

chrome beacon
#

None

#

Use Vanilla if you want vanilla

#

Or if you're using Paper ask them

quaint mantle
#

200x200x1 area

#

it'll be used for prison enchants which will be decently sized

fluid river
#

this prison enchants are always weird

quaint mantle
#

why?

#

its just looping blocks

#

and getting price then setting to air

fluid river
#

calling all weird enchantments prison

quaint mantle
#

xD

fluid river
#

i guess prison servers are like ultra fancy

#

i'm in a prison mining 200x200 blocks with wooden stick

quaint mantle
#

i really dont trust #setType(material)

fluid river
#

for government

#

cuz i killed 200^2 people with prison enchanted sword

quaint mantle
#

would #setBlockData() be faster than #setType()?

chrome beacon
#

For large areas split the load over multiple ticks

tender shard
#

how many blocks do you have to set, anyway?

quaint mantle
#

5-15K

tender shard
#

5000 isnt that much, have you tried to disable physics?

fierce whale
#

are there any way to save object in configuration file?

quaint mantle
tender shard
#

the method is called set(String, Object), and your object should implement ConfigurationSerialitable

fierce whale
#

wow..

#

okay I'll try thx 🙂

quaint mantle
tender shard
quaint mantle
#

server specs should be plenty

#

ik it aint that

#

well

#

in a way it is

tender shard
#

i wonder, what the heck are you doing that you need to paste 5-15k blocks PER SECOND per player

quaint mantle
#

well, i wouldn't say per player

#

every like 4 players

#

but prison enchants, aka looping blocks getting how much the block costs, adds cost, gives money to player, set's block to air

#

which some "enchants" will be pretty big

tender shard
#

no idea what prison enchants are

quaint mantle
#

i just explained it

tender shard
#

i still dont get it

hoary wing
#

How can I create a plugin that shows me how many players there are in the world where the player is?

#

placeholder suport

quaint mantle
#

anyways, how would i set a large amount of blocks fast

tender shard
quaint mantle
#

i would switch to spigot but im using minimessage

tender shard
quaint mantle
#

yes, but paper nms is way different than spigots

tender shard
#

setting blocks in NMS is like 1000% faster

quaint mantle
#

since paperweight

tender shard
#

wrong reply

#

anyway

quaint mantle
#

i've tried

tender shard
#

paper's NMS and spigot's NMS is the same

quaint mantle
#

many examples

tender shard
#

both use the original obfuscated mappings as released by mojang

#

and in both you can just use mojang maps for coding

hoary wing
tender shard
#

if so, the PAPI docs already explain everything you need

hoary wing
quaint mantle
#

its different for me

#

nms still works

#

just everything is different

tender shard
#

you can just check if the player is online, then do getPlayer()

#

then you know their world

tender shard
hoary wing
#

?

quaint mantle
#

if this stupid dependency would download i'll show you 😅

#

this is an example from Epic

// 1.19.2
    @Override
    public void setBlockSuperFast(Block b, Material material, byte data, boolean applyLightUpdate) {
        WorldServer nmsWorld = ((CraftWorld) b.getWorld()).getHandle();
        Chunk nmsChunk = nmsWorld.d(b.getX() >> 4, b.getZ() >> 4);
        BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());

        IBlockData ibd = CraftMagicNumbers.getBlock(material).m();
        ChunkProviderServer chunkProvider = nmsWorld.k();

        //modify blocks
        nmsChunk.a(bp, ibd, false);

        //update lights
        if (applyLightUpdate) {
            LightEngine engine = chunkProvider.a();
            engine.a(bp);
        }

        // send to client?
        chunkProvider.a(bp);
    }```
tender shard
tender shard
#

e.g. since 1.16+, it should be ServerLevel and not WorldServer

quaint mantle
#

okay so i ain't going crazy

#

okayy

tender shard
#

1 sec pls

hoary wing
#

😦

quaint mantle
#

i was about to say

#

everything is different for me

tender shard
#

you can use this website

#

in the top, click on "Spigot", then enter "WorldServer"

#

now it tells you that the "actual" new name is ServerLevel

#

and you do that for all classes that your IDE cannot find

quaint mantle
#

oh, oky

#

bet

#

let me try this

hoary wing
#

%online_world%

tender shard
quaint mantle
#

bro

#

thanks so much

#

that only took 3 days

tender shard
tender shard
quaint mantle
#

bro thats sooooo much faster

#

can't thank you enough

tender shard
quaint mantle
#

also

#

one more question, if you don't mind

tender shard
#

sure

#

that's what this channel is for

quaint mantle
#

the Three Common Maven Questions

#

it seems like it cant find the version 3.1.0

#

of maven-jar-plugin

tender shard
#

3.1.0 should be on maven central, but tbh it's probably already outdated again

#

one sec

#

the latest version is 3.3.0

#

change it to 3.3.0, if it still doesnt find this, hit the "maven reload button"

quaint mantle
#

ofc

tender shard
#

you are using intelliJ right?

quaint mantle
#

yeah

#

still cant find it doe

tender shard
#

hm lemme see

#

paste this as text pls

#

@quaint mantle

quaint mantle
#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <outputDirectory>C:\Coding\Minecraft\Testing Server\plugins</outputDirectory>
                    <finalName>Bound_Plugin</finalName>
                </configuration>
            </plugin>```
tender shard
#

thx, 1 sec

#

works fine for me. have you tried Ctrl+Shift+O, then waiting until it's done doing its stuff?

quaint mantle
#

oh it just popped up

tender shard
#

if that doesnt work, hit "ctrl" twice quickly, then enter "mvn clean package -X" and send the full output pls

quaint mantle
#

just doubling checking if it works rq

hoary wing
#

import me.clip.placeholderapi.expansion.PlaceholderExpansion;

public class Expansion extends PlaceholderExpansion {

    @Override
    public String getAuthor() {
        return "Monkey";
    }

    @Override
    public String getIdentifier() {
        return "world";
    }

    @Override
    public String getVersion() {
        return "1.0.0";
    }
}```
quaint mantle
#

yep it does

#

thanks again 😅

tender shard
#

np! :3

tender shard
#

you should normally have an onRequest method that takes an OfflinePlayer, and a String

#

you can then just check if that offlineplayer is online. if yes, do getPlayer(). if no, just return null

#

now you have a Player object where you can get the world from

#

sth like this should do what you're looking for

quaint mantle
#

ain't bad at all

tender shard
hoary wing
undone axleBOT
quaint mantle
#

how would i write to a packet?

#

im looking at the protocol docs

#

but seems like it doesn't like it

#
    public void playPacket(Player player, double x, double z) {
        CraftPlayer cPlayer = (CraftPlayer) player;
        WorldBorder border = new WorldBorder();
        ClientboundSetBorderCenterPacket borderCenterPacket = new ClientboundSetBorderCenterPacket(border);
        borderCenterPacket.write(0, x);
        borderCenterPacket.write(1, z);
        cPlayer.getHandle().connection.send(borderCenterPacket);
    }``` Expected 1 arguments but found 2
#

damn 😭

wet breach
#

you just need to hook into the network manager via NMS to send a packet or use protocollib but I think it is good experience to learn how to do it though

hoary wing
#

😭

wet breach
quaint mantle
#

would it be like this, by chance?

#
    public void playPacket(Player player, double x, double z) throws NoSuchFieldException, IllegalAccessException {
        CraftPlayer cPlayer = (CraftPlayer) player;
        WorldBorder border = new WorldBorder();
        ClientboundSetBorderSizePacket borderSizePacket = new ClientboundSetBorderSizePacket(border);
        write(borderSizePacket, "a", x);
        write(borderSizePacket, "b", z);
        cPlayer.getHandle().connection.send(borderSizePacket);
    }

    public void write(Object instance, String name, Object value) throws IllegalAccessException, NoSuchFieldException {
        Field field = instance.getClass().getDeclaredField(name);
        field.setAccessible(true);
        field.set(instance, value);
    }``` there
hoary wing
quaint mantle
#

like that?

wet breach
#

so you can then send a packet

quaint mantle
#

oh, okay

wet breach
honest echo
#

so am trying to spawn a particle using World#spawnParticle

#

but instead spawning static particle its spawning particle with a velocity

#

i want them to stay on their position

tiny tangle
#

What's the plugin that lets you rtp when entering a fake end portal

honest echo
quaint mantle
#

I would just make one yourself, it ain't that hard

#

Its like 3 classes not even

honest echo
honest echo
quaint mantle
#

I mean

#

True

sonic barn
#

@wet breach OMG... everything I had to do this whole time was to click this play button in Intellij 😭😭

#

not build artifacts ... just this play button and it output remapped version of my plugin 😭

#

and everything works now

wet breach
#

glad you figured out the issue

serene sigil
#

why doesnt this work??

wet breach
wet breach
serene sigil
#

so basically i want to detect if the dragon egg is thrown in the void

hybrid spoke
serene sigil
#

wdym?

wet breach
#

all items have a health of 5

timid jetty
#

is there a library with a method to get the direction from one vector to another?

wet breach
#

that being said, it doesn't take much for them to die, 1 damage from the void is enough for them to die XD

wet breach
#

use this event instead if you want to detect if a player threw an item

#

and then you can track if the item is falling into the void

hybrid spoke
#

they dont even have a health

wet breach
hybrid spoke
serene sigil
#

so how should i fix it?

hybrid spoke
#

it even puns itself Items have essentially no health

wet breach
#

Health: The health of the item, which starts at 5. Items take damage from fire, lava, falling

#

this is an nbt tag part of items

hybrid spoke
#

but it doesnt take damage by the void

#

it just despawns at a high of <-64

wet breach
#

it does, that is how they die and or despawn

#

the server isn't constantly checking if items are below that

#

it just kills them with damage

honest echo
#

so

#

am trying to spawn a arrow

hybrid spoke
#

they dont take damage by the void

#

they despawn after 5 minutes of ticks and/or falling below the descripted height

honest echo
#

e.getLocation().getWorld().spawnArrow(e.getLocation().add(0.5, 0.5, 0.5), e.getLocation().getDirection(),0.1F,0.1F).setVelocity(e.getEntity().getVelocity());

#

it does spawns a identical arrow

#

but spams in console about stackoverflowerror exception

wet breach
hybrid spoke
hybrid spoke
wet breach
#

but items have like such small health the smallest of damage kills them

#

I might load up my IDE later to make a PR to add items to entity events

#

as well as update the item interface to get their health

honest echo
#

this is full logs

#

ah wait nvm

#

apprently the error isnt in logs

#

weird

serene sigil
#

so DeathEvent?

#

nvm it doesnt work

wet breach
#

the entity events don't work for items

#

you have to make use of the few events there are for items, if you need the items health however need to currently resort to using NMS

minor garnet
serene sigil
echo basalt
echo basalt
#

🤦

minor garnet
#

i want get those red locations dud

echo basalt
#

start from the middle of the block, add 0.5 to any axis to get your offset

minor garnet
echo basalt
#

and rotate your offset by 90 deg

minor garnet
echo basalt
#

then do that instead

#

btw the word for º is degrees, not graus

minor garnet
#

furthermore i would need to rotate from 0 to 90

echo basalt
#

what is the end result

#

I don't care about those 4 points

#

what would you do with those 4 points

minor garnet
#

obb intersection

minor garnet
echo basalt
#

try it and see

#

break down your problem into a series of steps you'd do in any scale

mighty pier
#

how do i make a wrapper class of a player

#

without having to retype everything

#

or copy paste

#

nvm

tardy delta
#

make it wrap a player instance lol, or even better an uuid

mighty pier
#

how do make it wrap the instance

#

i wanna have stuff like User.setBanned(true);

#

User u = (User) player;

#

or something like that

tardy delta
#

just do ```java
class UserWrapper {
private final UUID id;

public Player getPlayer() {
return Bukkit.getPlayer(id);
}
}```
user.getPlayer().setBanned(true) dunno if that method exists but anyways

wet breach
tardy delta
#

you cant just make a class implementing Player or you'd have to write all the nms impl yourself

wet breach
#

if you need to rotate 180 degrees, then all you have to do is just apply the inverse of the numbers you currently have

minor garnet
#

just imagine an abb just that you can rotate it,

tardy delta
#

this is what i've done

wet breach
#

abb doesn't need 3 angles

#

just needs 2 coords

minor garnet
#

but in my case, I'm just going to rotate it sideways

minor garnet
#

in the case of two angles then

mighty pier
#

ok

wet breach
#

then you just need to use inverse operations

#

given x,z if you replace it with x,-z this will rotate clockwise 90 degrees

#

-x,-z is 180 degrees, -x,z is 270 degrees

minor garnet
tardy delta
#

he might just implement that himself in that class

minor garnet
#

i would need to know how to rotate this from 0 to 90

minor garnet
#

and boring besides explaining it off that I have to use a translator all the time

wet breach
#

well it is annoying for us to give a solution to only have someone say it doesn't work because of a hidden requirement they never bothered to state

minor garnet
#

but that was it, rotate between 0 to 90 based on the player's yaw

wet breach
#

might need to use raytracing to get the appropriate angles to do the math since now everything is relative to how the player is looking

minor garnet
wet breach
#

once you have your angles, the math I gave above still works

#

only need to use inverse operations to rotate

wet breach
#

well, you need a way to setup a grid, can't do that only from the players position, need also where they are looking, if you know where they are looking and their position that gives you the angles to setup the grid, once you have your grid you can rotate. Can't really rotate something arbitrarily if you don't have known points

minor garnet
wet breach
#

you could but you wanted it based on yaw

minor garnet
#

alr let me code

fallow marsh
#

Hello, I would like to know how I can add an outline like in the screen below to a grade as a prefix

river oracle
#

Texture pack

#

Map it to an unused unicode Texture than set a prefix to that unicode char

fallow marsh
#

Okay but how do I do that? Isn't it like a normal texture pack?

river oracle
#

Idk what a normal Texture pack is

river oracle
#

But you'd have to look into the details

quaint mantle
#

Google has many tutorials on this stuff

fallow marsh
#

Ok I see thanks for the help

quaint mantle
timid jetty
#

Is there someway to bypass the isInWater boolean for something like riptide?

wet breach
#

what do you mean bypass boolean?

serene sigil
#

why doesnt this work?

#

(it prints every item)

#

how do u make it only say the location of the dragon egg

wet breach
#

this is the second time you have come here asking why something isn't working and it is because of something so trivial

#

instanceof Item

#

is all that is needed

zealous osprey
wet breach
eternal oxide
#

thats fine, its java 14?

brazen hollow
#

lol

#

java weird

eternal oxide
#

auto creates a local variable if its true

serene sigil
#

it works tho

wet breach
drowsy helm
#

Is a dragon egg considered an item

icy beacon
drowsy helm
eternal oxide
drowsy helm
#

Saves an if statement and variable declaration

wet breach
#

I would love to see a use case for that in where it is better

serene sigil
drowsy helm
#

99% of the time

wet breach
brazen hollow
eternal oxide
#

if (sender instanceof Player player)

icy beacon
#
if (something instanceof Cool)
    Cool cool = (Cool) something;

is identical to

if (something instanceof Cool cool)
#

how is it error prone

#

it's literally against errors

serene sigil
#

ye i knew that already lol

icy beacon
serene sigil
#

lol

icy beacon
wet breach
drowsy helm
#

Roxy im on phone rn

icy beacon
#

wtf now lmao

drowsy helm
#

But try if you can just do entity instanceof DragonEgg

icy beacon
#

you just can't admit that you were wrong about "learn more java"?

drowsy helm
#

Because Material.DragonEgg is refereing to the itemstack

icy beacon
#

when in reality you were the one who didn't know this even existed

#

lmao

serene sigil
drowsy helm
#

Isnt there just a DragonEgg class

wet breach
drowsy helm
#

Or whatever the name of the class is

wet breach
#

but hey I can block you that is fine

serene sigil
icy beacon
#

lmao arguing with strangers is so cool

#

especially when they don't understand shit

drowsy helm
#

Well thers gotta be a wrapper class for it

serene sigil
#

no, there isnt

icy beacon
#

thanks, this was delightful

drowsy helm
#

Hmm

#

Is it an entity ir block

wet breach
eternal night
#

help-development is my fav place upsidedown_cry

wet breach
#

that is the problem with arguing with strangers, don't know them and you assume something

icy beacon
#

oh, I thought you wanted to block me?

serene sigil
#

well im looping through every entity in the world

icy beacon
#

sorry for distracting you from that

serene sigil
#

and the dragon egg can be an Item

wet breach
minor garnet
#

@wet breach what i need to do now?

drowsy helm
#

What part is it failing at

#

Debug each tier

wet breach
icy beacon
#

that's right

wet breach
#

you want to argue like a child? Is that what you are trying to instigate ?

serene sigil
icy beacon
#

oh, you wanna get personal

#

this is gonna be the fun part

#

go ahead

serene sigil
wet breach
#

I don't care to get personal, there isn't anything you could possibly say that would hurt me

drowsy helm
#

Where are you printing it

icy beacon
#

ok

serene sigil
#

that method

icy beacon
#

anything else you wanna tell me?

drowsy helm
#

I cant see a print method

serene sigil
icy beacon
#

i'm all ears

drowsy helm
#

Oh that prints it?

serene sigil
drowsy helm
#

Uhh thers no way all items satisfy that if statement

wet breach
icy beacon
#

ok

drowsy helm
#

Bruh just shutup

icy beacon
#

this dude still trying to prove something to me 🤣

serene sigil
wet breach
serene sigil
#

lol

drowsy helm
#

Print out the getType

wet breach
#

you are not someone of significance to me to be worth that

drowsy helm
#

See what material it is

icy beacon
eternal oxide
drowsy helm
#

Yeah thats what im saying

#

It’s not an itemstack

#

It’s an actual entity or block

#

Not sure which the egg counts as

wet breach
#

It should be a block

#

well I guess it could be a tile entity

drowsy helm
#

Yeah

eternal oxide
#

a Placed egg is a Block. a falling egg is an Entity and a dropped egg (floating item) is an Item

wet breach
#

let me check real quick lol

wet breach
#

exactly

#

lmao

eternal oxide
#

or a mess 🙂

wet breach
#

even better if its someone elses mess 😉

drowsy helm
wet breach
#

and it be accurate lmao

serene sigil
#

its DROPPED_ITEM

eternal oxide
# serene sigil

? that pick shows nothing other than an egg in your inventory

drowsy helm
#

Yeah placed drgaon egg is definitely a block

eternal oxide
#

DROPPED_ITEM is the Item not the ItemStack

serene sigil
eternal oxide
#

Item is a wrapper

eternal oxide
#

yes

serene sigil
#

there are also other dragon eggs in the world and it says its DRAGON_EGG

serene sigil
eternal oxide
#

then they are placed

#

so Blocks

serene sigil
#

yes

#

oh now i understand

#

Item gets placed blocks (Blocks) and dropped items (DROPPED_ITEM)

frail gale
#

just for fun asking

#

is there a way to open Donkey Inventory xD

wet breach
#

both are possible

frail gale
#

the second

#

I mean opening a fake Donkey Inventory

wet breach
#

donkey inventory is just a player inventory just with the title of donkey

frail gale
#

I mean more

#

the Donkey Storage inventory

serene sigil
#

a very quick question: i need to detect the location of a dropped item, so i use for (Entity entity : Bukkit.getWorld("world").getEntities()) etc...
now my question is do i have to do a for loop for all dimensions or is there a way to like .getWorld("all") or sth

frail gale
serene sigil
#

its ok

frail gale
wet breach
#

one loop for the worlds and then stuff the getEntities inside of that with its own loop

frail gale
#

yeah

wet breach
#

for (World world : Bukkit.getWorlds()) {
    for (Entity entity : Bukkit.getWorld(world).getEntities()) {
    }
}
serene sigil
#

oh ok

#

tysm

serene sigil
zealous osprey
#

just use world.getEntities()

frail gale
serene sigil
frail gale
#

also yeah no need to do Bukkit.getWorld(world)

wet breach
#

either way works

#

but getWorld() only accepts UUID or a String

#

which you could have done world.getUUID() or world.getName()

#

its either UUID or Id can't remember

frail gale
#

damn I didn't know Worlds had an UUID

zealous osprey
#

but why would you call those methods, if you just get the world to begin with?

frail gale
#

because I haven't been looking in the World methods

wet breach
zealous osprey
#

true

wet breach
#

instead of dealing with a string name which could change

#

the UUID's of a world do not change

serene sigil
frail gale
#

UUIDs are very good thing I like that entities have it too

tardy delta
#

im just saving world uuid to my db instead of name

#

only thing i use it for

wet breach
#

it is really the only way to know if you are dealing with the same world

#

code wise

#

since names can change

frail gale
#

true

raw prairie
#

@eternal oxide

#

I made a new NBT file

eternal oxide
#

does it load?

raw prairie
#

no errooors either

eternal oxide
#

send to me and I'll test it

raw prairie
raw prairie
#

then ill send ind ms

eternal oxide
#

just drop nbt in here

raw prairie
#

@eternal oxide

vivid skiff
#

How can i add lines to a item lore?

eternal oxide
#

doesn;t load

#

sec my bad I had a typo

#

ok same issue. zip error

frail gale
#

@vivid skiff itemMeta.getLore() wihch returns a List then you can modify the list after that itemMeta.setLore(modifiedList) and then item.setItemMeta(itemMeta)

#

how I can get the the /data get storage NBT provider

raw prairie
#

how how

eternal oxide
#

I'm just running some tests. Structure loading may be bugged in Spigot

wet breach
#

maybe it isn't gzipped ?

quaint mantle
#

hello, i write this,
private CustomPlayer customPlayer;

public getCoins(CustomPlayer customPlayer){
    this.customPlayer = customPlayer;
}

the name of class is obv the same as constructor, but when i register a commands the customPlayer object asks me, how do I solve it?

wet breach
#

well should say compressed

eternal oxide
#

interesting

#

it loads fine, if read via it's NamespacedKey

#

if that same file is placed in the jar as a resource it fails to load and complains it's not GZIP

wet breach
#

yeah, the loading must expect it to be compressed

#

could just compress it or just extract it for reading

eternal oxide
#

its a zip when placed in the jar, so calling plugin.getResource("backrooms.nbt") should feed an InputStream of the zip resource

wet breach
#

I would need to look into it, but maybe the file extension has something to do with it?

#

what happens if you change it to some other extension lol

eternal oxide
#

nope, thats ignored

#

well

#

in teh jar the extension would be ignored

wet breach
#

maybe, unless the method does something differently if it has .nbt

eternal oxide
#

external I loaded it using NamespacedKey so it only has a name and it applies the extension

#

external (file in the world folder) loading using its Namespaced works fine

#

I'll change the resource name to zip

wet breach
#

have a feeling it will work

eternal oxide
#

?paste

undone axleBOT
eternal oxide
#

line 48 is Bukkit.getStructureManager().loadStructure(plugin.getResource("backrooms.zip"));Doesn;t matter what extension when its included as a resource

#

I wonder if the InputStream is somehow affecting it

wet breach
#

it is

#

need to set the encoding to UTF-8

eternal oxide
#

thats a pain as you can;t then use the native Plugin#getResource

wet breach
#

actually I know the issue

#

getResource probably wraps the stream with GZIP

#

when doing this, it expects all resources to be GZIP'ed which means all files need to have a gzip header

#

the appropriate method to extract if just tossing into the jar would be to just get it raw

#

that is just use inputstream without wrapping it

#

it is the only thing I can think of that will cause that

eternal oxide
#

I don;t see anywhere it could be wrapping it

#

getResource should be a raw InputStream

frail gale
wet breach
quaint mantle
#

how can you not see it? this.customPlayer = customPlayer;

#

let me guess, isn't he a constructor?

wet breach
#

that isn't a constructor

quaint mantle
#

off

serene sigil
#

whats the event called again that fires if u place a block in a container?

wet breach
#

a constructor is a method that has the same name as the class and generally is located at the beginning of the class

eternal oxide
#

InputStreams don;t have an encoding. It's just a byte stream and the file is exactly as placed in teh jar. This is odd

wet breach
eternal oxide
#

InputStreamReader has an encoding

quaint mantle
wet breach
eternal oxide
#

np

wet breach
#

it is strange nonetheless however

eternal oxide
#

?stack

#

?stash

undone axleBOT
wet breach
eternal oxide
#

which code?

wet breach
#

that you used to do your test

eternal oxide
#

literally just System.out.println("Loading Structure..."); try { this.room = Bukkit.getStructureManager().loadStructure(plugin.getResource("backrooms.nbt")); } catch (IOException e) { e.printStackTrace(); }

wet breach
#

I wonder if it is loadstructure that is causing it

wet breach
#

ok, so with inputstream it needs to be binary stream

#

as that is what it expects

#

getResource() probably isn't doing that maybe?

eternal oxide
#

let me try something

wet breach
#

only thing I can think of doing is to toss plugin.getResource("backrooms.nbt") into a byte array

eternal oxide
#

well no matter what I do it complains about not being in GZIP

quaint mantle
#

in a music disc how can i hide for instance who its by?

example: C418 - far <- How can i remove this from showing? I tried:

stalmeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);

but that doesn't seem to work even after i added it to the item meta,

wet breach
#

and then feed that to the intputstream

#

if it still doesn't work, then for whatever reason loadstructure however it is implemented is wrapped with GZIPInputStream

#

and probably should be changed possibly to detect if the structure file is actually compressed

#

it makes sense why it is most likely wrapped

#

and that is because NBT data can sometimes be compressed with GZIP, which isn't the same as just compressing the file overall

frail gale
quaint mantle
#

i do that

#

i don't understand

frail gale
#

what you don't understand?

quaint mantle
#

i do that

#

you told me earlier that he is not a constructor

#

now is it

frail gale
#

and what is your problem?

tardy delta
#

?learnjava

undone axleBOT
frail gale
#

yeah

quaint mantle
#

yeah, i kn but when I create the command in main and I do getCommand("coins"). setExecutor(new getCoins (here it asks me to insert customPlayer));
, how do i solve?

#

there is the point

#

not the constructor

frail gale
tardy delta
#

naming conventions pls

frail gale
#

you have made a constructor if it asks you to put a parameter

tardy delta
#

you dont just name a class the name of a getter

sterile token
#

Please follow the name conventions tho

#

?conventions

quaint mantle
frail gale
quaint mantle
#

yes

eternal oxide
frail gale
eternal oxide
#

its an odd one

wet breach
#

weird

sterile token
#

So you dont disturb other pp

wet breach
#

hmmm

#

probably should change that ending

sterile token
quaint mantle
# frail gale then what you want?

I said it before, I needed a constructor and I created it, now that I made the constructor it doesn't let me register the command because it asks me to insert customPlayer ... I don't understand what's absurd

quaint mantle
#

ok

#

Constructor

#

?paste

undone axleBOT
tardy delta
#

this is gonna be a long day

sterile token
#

The thread

smoky widget
#

is there an api or something for armorstand clientside? Because I had already tried 1 month ago to do it with protocollib but I had not succeeded I had errors with the devbuild

#

(I used to do it in nms but it's not available anymore)

sterile token
#

?ask

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!

sterile token
#

?nohello

undone axleBOT
smoky widget
sterile token
smoky widget
#

sry

sterile token
#

na i mean is okay

smoky widget
#

okay

sterile token
#

But we have to follow the channel rules😂

tardy delta
#

🤔

old cloud
#

🤔

sterile token
#

I mean if pp want to chat #general

old cloud
#

stop saying "pp" pls

sterile token
unborn sigil
#

Я си гледайте работата

old cloud
#

english only pls

sterile token
old cloud
#

thanks for repeating me

unborn sigil
#

Млъквай

sterile token
unborn sigil
#

Shut up

old cloud
#

no u

smoky widget
#

Does anyone know about hCore library? And if it's good or buggy

sterile token
#

I'll thank you if you stop bothering in a channel that is for asking for help. There is no need man. Please

smoky widget
#

we dont understand

sterile token
#

@ancient plank i would be really thankful if you take actions. This man is disturbing and not following rules

fluid river
#

ok and

sterile token
#

Im on fire with that man being annoying

fluid river
#

why don't you tag yourself

quaint mantle
#

This guy just called verano's mom a gypsy

sterile token
quaint mantle
#

Little he knows Verano is latino 🤨

fluid river
#

who is that guy

#

ukrainian?

sterile token
fluid river
#

oh

#

my bad

sterile token
#

I dont now if correctly in english

#

i was using deepl translator ahaha

fluid river
#

he is using Ъ so true

sterile token
#

Also adele thanks for taking actions 👏 👏 👏 👏

fluid river
#

@unborn sigil use english here

#

only english

unborn sigil
#

Много ми пука, ще пиша на какъвто искам език

sterile token
tardy delta
#

people being assholes again

sterile token
quaint mantle
#

we need to communicate here

fluid river
#

Божий дар, if you don't need help, leave

eternal oxide
# wet breach weird

I found the issue. It seems Maven uncompresses filtered resources. I just have to find a way around it now

unborn sigil
quaint mantle
#

bojidar knows english, for a reason they are answering in their language

earnest knoll
#

does 1.19.1 spigot work with 1.91.2 server

quaint mantle
#

why are we supposed to translate while it could be you? i mean, you are already doing it 🤨

sterile token
earnest knoll
#

no, for my server to run plugins.

fluid river
sterile token
fluid river
#

1.19.1 plugins work on 1.19.2 servers

tardy delta
#

lower api version doesnt work unless your not using newly added features in higher versions iirc

earnest knoll
#

gotcha

fluid river
cobalt thorn
#

Hi a question how i can make pick up the item to the nearest player and none else

tardy delta
#

i once was working with 1.1.6.1 or whatever and server was 1.16.2 and i got a nomethodfound exception for smth specific 1.16.2

fluid river
#

NMS or blockbreakevent

tardy delta
#

true

fluid river
#

just let player go and pick item up

unborn sigil
hazy parrot
#

Classic Bulgarian

cobalt thorn
sterile token
cobalt thorn
sterile token
cobalt thorn
#

And with i can check it

cobalt thorn
fluid river
cobalt thorn
#

How i can get the nearest user to it?

fluid river
#

for all players whos nicnkame is not nickname of nearest

#

umm

#

you need to loop through all entities in radius

sterile token
fluid river
sterile token
#

I dont like jokes that why

fluid river
#

woudln't really change anything tho

#

on server restart item would probably get removed anyways

cobalt thorn
#
    @EventHandler
    public void onDropUp(PlayerPickupItemEvent event) {

        if (event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK || event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK) {
            List<Entity> near = event.getItem().getNearbyEntities(1, 1, 1);
            for (Entity entity : near) {
                if (entity instanceof Player) {
                    Player nearPlayer = (Player) entity;
                    nearPlayer.sendMessage("near");
                }
            }
        }
    }

Like this?

fluid river
#

you need

#

external variable

#

to which you would write entity

#

add if statement which checks distance between current nearest entity

#

and new entity in loop

#

if new entity is closer, modify current nearest variable

sterile token
eternal oxide
sterile token
#

oh i having maven zip issues tho

#

😂

cobalt thorn
#
    @EventHandler
    public void onDropUp(PlayerPickupItemEvent event) {

        if (event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK || event.getItem().getItemStack().getType() == Material.CARROT_ON_A_STICK) {
            List<Entity> near = event.getItem().getNearbyEntities(1, 1, 1);
            for (Entity entity : near) {
                if (entity instanceof Player) {
                    Player nearPlayer = (Player) entity;
                    if(event.getItem().getLocation().distance(nearPlayer.getLocation()) <= 1) {
                        nearPlayer.sendMessage("near");
                    }
                }
            }
        }
    }

like this?

sterile token
cobalt thorn
echo basalt
#

both of you are idiots

woven tide
#

hey guys is it possible for players to have variables?

earnest knoll
#

Do you guys have a plugin for banning people when they die?