#help-development

1 messages Β· Page 2239 of 1

tender shard
#

I don't know, can't you guys just look at the code I sent lol

grim ice
#

it doesnt explain much

vale ember
#

i made typo, it should actually be deserialize since it turns Map into T

tender shard
#

it should of course work with all classes, not only those that I registered somewhere. But anyway, there is other way than what I'm currently doing unless Constructors could be declared in interfaces or abstract classes, which at least they can't as of java 17

#
public class Question extends MapSerializable {

    @Getter private final String question;
    @Getter private final Answer answer;

    public Question(String question, Answer answer) {
        this.question = question;
        this.answer = answer;
    }

    public Question(Map<String,Object> map) {
        this.question = YamlUtils.getString(map, "question");
        this.answer = new Answer(YamlUtils.getStringList(map, "answers"));
    }

    @Override
    public Map<String, Object> serialize() {
        return new MapSerializable.Builder().put("question",question).put("answers",answer.getCorrectAnswers()).serialize();
    }
}

For example this. If I remove the Map constructor, it still compiles fine, but then throws an exception when trying to deserialize it. And that's what I want to avoid

vale ember
lost matrix
lost matrix
vale ember
tender shard
lost matrix
# vale ember wdym?

If you have a centralised registry for (de)serialisation then it needs to know the type it is deserializing in order to know which MapDeserializer to use.

#

Anyways i didnt read through the whole convo. Do you guys want to implement marshalling?

granite owl
#

why arent mob spawners holding PDC values i add to them?

#

mob spawner itemstacks

tender shard
vale ember
granite owl
tender shard
granite owl
#

sec lemme give u the code

#

its a debug mess but its working

#
public static void breakMobSpawner(BlockBreakEvent event)
    {
        Block block = event.getBlock();
        Player player = event.getPlayer();
        
        if (block != null && player != null)
        {
            if (block.getType() == Material.SPAWNER && player.getGameMode() != GameMode.SURVIVAL)
            {
                Bukkit.broadcastMessage("TEST");
                ItemWrapper wrapper = new ItemWrapper(new ItemStack(Material.SPAWNER, 1), null);
                
                wrapper.setItemString("test", "LEMAO");
                
                ItemMeta meta = wrapper.getItemStack().getItemMeta();
                
                meta.setDisplayName("LUL");
                
                wrapper.getItemStack().setItemMeta(meta);
                //wrapper.setItemBytes("block_data", NonReflectables.serializeBukkitObjectToByteArray(block.getBlockData().getAsString()));
                
                block.getWorld().dropItemNaturally(block.getLocation(), wrapper.getItemStack());
            }
        }
    }
#

result is 1 NBT flag

#

the name

#

setItemString is a wrapper method to set PDC values

#

its working in alot of my other methods

lost matrix
granite owl
#

just not here?

#

sec

#
public boolean setItemString(String key, String value)
    {
        if (this.is != null)
        {
            if (this.is.hasItemMeta())
            {
                ItemMeta meta = this.is.getItemMeta();
                meta.getPersistentDataContainer().set(new NamespacedKey(main.getPlugin(main.class), key), PersistentDataType.STRING, value);
                this.is.setItemMeta(meta);
                return true;
            }
        }
        
        return false;
    }
    
    public String getItemString(String key)
    {
        if (this.is != null)
        {
            if (this.is.hasItemMeta())
            {
                PersistentDataContainer pdc = this.is.getItemMeta().getPersistentDataContainer();
                NamespacedKey nKey = new NamespacedKey(main.getPlugin(main.class), key);
                
                if (pdc.has(nKey, PersistentDataType.STRING))
                {
                    return pdc.get(nKey, PersistentDataType.STRING);
                }
            }
        }
        
        return "";
    }
lost matrix
#

If you wrap something, make sure to add all the methods you need so you dont have garbage like this where you have to constantly unwrap the wrapped object

granite owl
#

^ code is there

lost matrix
#
if (this.is.hasItemMeta())

This might be the problem

granite owl
#

but a newly instantiated is usually has itemmeta

#

well

#

ill test it for its return value sec

#
boolean b = wrapper.setItemString("test", "LEMAO");
                
Bukkit.broadcastMessage(((b) ? "TRUE" : "FALSE"));
#

the code

#
[12:13:05] [Server thread/INFO]: FALSE
```well rip
#

how can that even happen

#

so my fallback condition is the issue, question stands how can an IS even NOT have itemmeta

green prism
#

How to check if a player is looking at a door?

vale ember
# granite owl so my fallback condition is the issue, question stands how can an IS even NOT ha...

i am not sure, but looking at type ItemStack's constructor

        Preconditions.checkArgument(type != null, "Material cannot be null");
        this.type = type;
        this.amount = amount;
        if (damage != 0) {
            setDurability(damage);
        }
        if (data != null) {
            createData(data);
        }

i would assume that ItemMeta is null at the start, and when u call getitemMeta first time

        return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone();

it creates new via Bukkit.getItemFactory()

granite owl
#

yea ive just browsed trough the docs

#

seems if its null getItemMeta instantiates a new container

#

as such i should only check if the itemstack itself is null

#

as getItemMeta cant throw null errors

vale ember
#

you should probably also check if getItemMeta() is null since getItemFactory().getItemMeta() is nullable

granite owl
#

so change hasItemMeta to

vale ember
#

like this

if (is != null && is.getItemMeta() != null)

granite owl
#

is.getItemMeta != null

#

^^

vale ember
#

yea

granite owl
#

right ty so ive just used the implementation incorrectly xD

vale ember
#

wait, hasItemMeta() does the same thing

#

apparently something else is wrong

misty current
#

can you make a case insensitive query on mongo?

granite owl
#

yea ty works now

#

πŸ˜›

granite owl
#

ive changed my implementation to check for getItemMeta being null

#

hasItemMeta returns false

#

getItemMeta returns an itemmeta

vale ember
#

oh i see

granite owl
#

or at least a not null value that i can edit

#

properly

vale ember
#

i read it wrong, item meta checks if the this.meta is not null

granite owl
#
public boolean setItemString(String key, String value)
    {
        if (this.is != null)
        {
            if (this.is.getItemMeta() != null)
            {
                ItemMeta meta = this.is.getItemMeta();
                meta.getPersistentDataContainer().set(new NamespacedKey(main.getPlugin(main.class), key), PersistentDataType.STRING, value);
                this.is.setItemMeta(meta);
                return true;
            }
        }
        
        return false;
    }
    
    public String getItemString(String key)
    {
        if (this.is != null)
        {
            if (this.is.getItemMeta() != null)
            {
                PersistentDataContainer pdc = this.is.getItemMeta().getPersistentDataContainer();
                NamespacedKey nKey = new NamespacedKey(main.getPlugin(main.class), key);
                
                if (pdc.has(nKey, PersistentDataType.STRING))
                {
                    return pdc.get(nKey, PersistentDataType.STRING);
                }
            }
        }
        
        return "";
    }
#

this

vale ember
#

yeah this is correct

granite owl
#

and works now

#

teye

#

πŸ˜„

#

but it does make sense that i didnt notice it before because the plugins main purpose is to create new custom items and add flags to it. so the item meta was never null before

maiden briar
#

I have tried things like

SELECT (SELECT *, FIND_IN_SET(rating, (SELECT GROUP_CONCAT(DISTINCT rating ORDER BY rating DESC) FROM {table} WHERE ranked = 1)) FROM {table} WHERE ranked = 1) AS r
(SELECT *, FIND_IN_SET(previous_season_rating, (SELECT GROUP_CONCAT(DISTINCT previous_season_rating ORDER BY previous_season_rating DESC) FROM {table} WHERE previous_season_ranked = 1)) FROM {table} WHERE previous_season_ranked = 1) AS previous_season_rank

But that gives an syntax error

granite owl
#

the mob spawner thing is just a minor subroutine im adding in because the framework already exists

sacred sparrow
#

umm... can i question?
What is the api in the red frame in this picture?
i search "spigot screen api",but i coudlne find it.

chrome beacon
#

Those are mods

granite owl
sacred sparrow
#

oh really😭

misty current
#

can you make a case insensitive query on mongo?

chrome beacon
misty current
#

that's 12 years old and not by using the java driver

limpid bronze
#

Hey, i'm trying to send packets with sendPacketNearby but this function doesn't exist and I don't know how to access to this, i'm using protocolLib in 1.18.1

covert karma
limpid bronze
#

no i have protocolLib

misty current
#

and(eq("familyId", item.familyId), eq("userName", item.userName)) i don't really understand how this is supposed to be java code

sacred sparrow
covert karma
#

??

misty current
#

there's just the normal sendpacket method under PlayerConnection

covert karma
chrome beacon
limpid bronze
mortal hare
#

i get the same message on my ungoogled-chromium browser

#

but everything works apart of search

sand vector
#

Im trying to make a pickaxe enchant which creates an explosion. This can break a hole which is the same size and can destroy obsidian. How would I do this? I have the base enchant sorted just need to make the effects

misty current
#

does the explosion have to be a sphere?

#

you can iterate all the blocks in an area and then check the distance between the central block and the iterated block and if it is bigger than a certain number, don't break the block

winged anvil
#

do i have to do anything extra to remove an enchant from all items in a chest?

#

right now im going through the chest inventory and removing mending from all items in the chest but the mending isn't actually removing

#

im updating the tilestate of the chest afterwards, is this why?

#

nevermind, it is cause the tilestate

umbral socket
#

Do I have to follow a specific file structure for my plugin to work? Does bukkit, or paper read a plugin in a specific way?

quaint mantle
#

Hey, how can I raycast?

misty current
#

this could be helpful

#
    public static List<Block> getBlocksWithin(Location start, Location end) {
        List<Block> blocks = new ArrayList<>();

        int startX = Math.min(start.getBlockX(), end.getBlockX());
        int startY = Math.min(start.getBlockY(), end.getBlockY());
        int startZ = Math.min(start.getBlockZ(), end.getBlockZ());
        int endX = Math.max(start.getBlockX(), end.getBlockX());
        int endY = Math.max(start.getBlockY(), end.getBlockY());
        int endZ = Math.max(start.getBlockZ(), end.getBlockZ());

        for (int x = startX; x <= endX; x++) {
            for (int y = startY; y <= endY; y++) {
                for (int z = startZ; z <= endZ; z++) {
                    Location loc = new Location(start.getWorld(), x, y, z);
                    blocks.add(loc.getBlock());
                }
            }
        }

        return blocks;
    }
umbral socket
visual tide
#

does anyone by any chance know what exactly is happening if the server logs are full of this
com.mojang.authlib.GameProfile@5c7f092d[id=<null>,name=lLD_Mftz*****,properties={},legacy=false] (/200.2.***.**:58251): Took too long to log in
like its a crash attempt but im not sure about how to migitate it
maybe killing the login if the id is null at some point?

misty current
#

took too long to login sounds like a network issue

#

i've seen often null ids so im not sure if that's a problem

visual tide
#

i dont think so

#

its some sort of attack

#

theres 40k of those invalid login attempts

#

and it crashed at some point

misty current
#

from different accounts?

visual tide
#

yeah

#

and diff ips

misty current
#

hmm

#

i have no idea why

visual tide
#

i dont get why it crashes, shouldnt all the login stuff be on the netty threads?

misty current
#

how long was the span of time where it happened

visual tide
#

uhm

#

8 minutes

#

and 44 thousand logins

misty current
mortal hare
#

ah yes

#

generics

visual tide
#

usernames are random strings

mortal hare
#

Collection<ServerboundPacketListener<Packet<ServerGamePacketListener>>>

misty current
visual tide
#

yes i figured that much

mortal hare
#

runtime casting

#

πŸ™ƒ

tardy delta
#

if the system should exit caused by a crash, should i use System.exit(0) or -1?

#

not in the context of a plugin anyways

misty current
#

0 is when the code ran successfully

#

there are different exit codes based on what happened

tardy delta
#

ah wait i meant 1 then

misty current
#

i had a pretty big generic somewhere

#

that was pretty much unreadable

tardy delta
#

Map<Map<?, ?>, Map<?, ?>>

#

mapmapmap

mortal hare
#

yes positive integer numbers as error codes are the best since not all JVM implementations theoretically can support negative numbers

#

IN THEORY ONLY

tardy delta
#

oh lol

misty current
#

Map<Map<? extends Map<?>, ? extends Map<?>>, Map<? extends Map<?>, ?>>

mortal hare
#

We are not in dino ages

#

oh hey

tardy delta
#

arent we?

mortal hare
#

i just solved unchecked cast

tardy delta
#

@Supresswarnings("unchecked") smh

mortal hare
#

i managed to achieve type safety somehow

misty current
#

generics confuse me at times

#

i have made a /pay command that lets you steal money from others if you insert negative amounts

#

nice

tardy delta
#

always fun

misty current
#

imagine you're in baltop and a guy comes over and robs the shit out of you

tardy delta
#

/pay kill05 -100000 coins

misty current
#

/pay kill05 -10000000000000

#

lol

misty current
#

player profiles that are then saved in a database

earnest forum
#

adding a negative is subtracting

misty current
#

yea that's what happens basically

tardy delta
#

no shit sherlock

misty current
#

it subtracts a negative amount so it sums

mortal hare
misty current
#

and adds a negative amount so it subtracts

#

lol

tardy delta
earnest forum
visual tide
#

hm

mortal hare
#

lol

tardy delta
#

im out

visual tide
#

i did some research on the ip's and theyre mostly exposed routers

#

probably hacked

zealous osprey
subtle folio
umbral socket
#

Do I have to follow a specific file structure for my plugin to work? Does bukkit, or paper read a plugin in a specific way?

tardy delta
#

does this look like a good beginning??

tardy delta
#

and just put your code in your package

#

very simple

umbral socket
#

Ight thank you

zealous osprey
#

Quick question, atleast I hope so, is there a way to easily serialize this: {id:"minecraft:cobblestone",Count:1b,Damage:0s} into an Itemstack?

#

got smth πŸ‘

tardy delta
#

i'm looking at kotlin code to get ideas for java code.. i mean...

tardy delta
#

json would be "Count": true

zealous osprey
#

Thing is... it's kinda mojankjson, since it doesnt work correctly

zealous osprey
chrome beacon
#

If it's Mojangson use the TagParser class

#

(NMS Mojmaps)

tardy delta
#

it prints 18 how do i make it print 19?

#

looks like the right bound of #between is exclusive

chrome beacon
#

So you want it to round up?

tardy delta
#

it would make sense to print 19 seconds if the cooldown was 20s and only one second passed no?

chrome beacon
#

I would assume something took slightly longer and it's like 18.99 seconds

tardy delta
#

actually, lets print the millis

#

18995

#

i guess thats why

#

just adding 15 milliseconds now smh πŸ˜‚

ebon topaz
#

how do i make a config file

chrome beacon
humble tulip
#

A custom one?

tardy delta
#

just follow the guide

ebon topaz
#

The embedded resource 'config.yml' cannot be found in plugins\resourcepacker-1.0-SNAPSHOT.jar

humble tulip
#

You need to put the config in your jar file

#

Are ypu usijg maven?

ebon topaz
#

mhm

humble tulip
#

You using*

#

Do you have a config.yml in your resoirces folder?

ebon topaz
#

ah

tardy delta
#

saveDefaultConfig() in your onEnable

balmy fox
#

When using this player.getInventory().getItemInMainHand().getType().name() to get name of item in MainHand it returns the right names whit most of the block. But by the new blocks and items like Amethyst Shard it returns AIR. How can I fix that?

chrome beacon
#

Send the output from /version

#

That sounds odd

balmy fox
chrome beacon
#

Yes

balmy fox
brittle lily
#

Thats weird

balmy fox
chrome beacon
chrome beacon
balmy fox
brittle lily
chrome beacon
#

Latest

#

Vault doesn't really care about mc version

brittle lily
#

?paste

undone axleBOT
chrome beacon
#

Did you add Vault as depend in your plugin.yml

#

(Or soft-depend)

brittle lily
#

oh Actually I didnt add on plugin.yml

grim ice
#

make a JsonItem class with the fields id count and damage

#

then use gson to turn the json into the class

#

then have it implement ItemForm interface which has a static method

#

ItemStack toItem(ItemForm itemForm)

chrome beacon
#

It's mojangson not json

grim ice
#

that sets the fields from json to an item stack

chrome beacon
#

There is a difference

grim ice
#

idk whats mojangson

brittle lily
grim ice
#

but im doing what i would do in a normal java project i assume

#

dunno about these mojang quirks

chrome beacon
brittle lily
#

I didnt how can I

chrome beacon
humble tulip
brittle lily
humble tulip
#

You also need softdepend: [Vault]

#

So ur plugin always enables before vault

#

After **

heavy marsh
#

Anyone know why sometimes I get a "CraftBlockState cannot be cast to Container" here:

Block block = ((Location)serializedMap.get("container")).getBlock();
Container container = (Container)block.getState();
tender shard
#

because it's not a container

humble tulip
#

Check if it is first

heavy marsh
#

this is in a deserialize method, what would I do if it isn't a container? Can I return null in that method?

humble tulip
tender shard
humble tulip
#

It depends on what you want to happen if it's not a container

heavy marsh
# tender shard what do you need the container for anyway? in the code you sent, you only cast i...

sorry, here is the whole method for context:

public static LockedContainer deserialize(Map<String, Object> serializedMap) {
    String ownerUUID = (String)serializedMap.get("owner");
    OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(ownerUUID));

    Block block = ((Location)serializedMap.get("container")).getBlock();
    Container container = (Container)block.getState();
    UUID uuid = UUID.fromString((String)serializedMap.get("uuid"));

    LockedContainer deserialized = new LockedContainer(container, owner, uuid);
    return deserialized;
}
tender shard
#

well you have to know for yourself whether you're fine with this returning null or not

heavy marsh
#

it is YamlConfiguration.loadConfiguration which runs all the deserialize methods, I just don't know if would be happy with null being returned. I can test it ig

humble tulip
#

It is

heavy marsh
#

ok cool

reef lagoon
#

Can I make a player say a message with a tooltip?

waxen plinth
#

Using chat components

heavy marsh
humble tulip
#

Hm

#

A lockedcontainer is a chest?

heavy marsh
#

Surely there must be a way to abort a deserialization or something?

twilit roost
#

stupid question
but how does Method#invoke work?
since I have shoot()
and Im getting the method and just doing method.invoke(null)
But it returns null

heavy marsh
ivory sleet
humble tulip
ivory sleet
#

Or null in case the method is static

twilit roost
twilit roost
ivory sleet
#

so like

lol.doStuff();

would be getMethod("doStuff").invoke(lol)

humble tulip
#

So if u wanna invoke it on a player, you do method.invoke(player)

#

Which is the same as player.shoot()

twilit roost
#

ooh right

#

i thought it was enough when I got the class,method

ivory sleet
#

It’s only if the method is static that you pass null to invoke like .invoke(null)

#

Same goes for Field::get

twilit roost
#
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
ivory sleet
#

You passed an instance of wrong type

twilit roost
#
Class<? extends RangedWeapon> wep = getWeaponClass(p.getItemInHand());

public static Class<? extends RangedWeapon>  getWeaponClass(ItemStack item){
    if(item.getItemMeta()==null)
        return null;
    ItemMeta meta = item.getItemMeta();
    PersistentDataContainer pdc = meta.getPersistentDataContainer();
    NamespacedKey key = new NamespacedKey(Pirates.plugin,"rangedWeapon");
    switch (pdc.get(key,PersistentDataType.STRING)){
        case ("SNIPER"):
            return Sniper.class;
        default: return null;
    }

river oracle
twilit roost
#

yep πŸ˜„

river oracle
#

Why...

#

Did you not properly expose classes need so your compensating via reflection

ivory sleet
humble tulip
#

Why don't u just cast to rangedweapon and call shoot normally?

twilit roost
#

I have Super class RangedWeapon and my Weapons are extending it

Yet I have no other idea how to execute method when the class is extending RangedWeapon

river oracle
#

Using reflection in your own code makes almost 0% sense a good 90% of the time

humble tulip
#

If obj instanceof RangedWeapon

twilit roost
humble tulip
#

Yeah cuz ur providing a class

twilit roost
#

forgot to cast

humble tulip
#

U can't cast thwt

river oracle
#

Bro what are you on

twilit roost
#

sleep deprecation

river oracle
#

This is a simple instance of call no classes needed

humble tulip
#

Just regoster each rangedweapon with an instance

#

Register*

#

Have a manager class for weapon so u can call weaponManager.register(Weapon)

#

That class can also give you the weapon for a given itemstack

#

Bump

#

Conclure can you maybe have a look? ^^

chrome beacon
#

Interface

river oracle
#

I said thag already

glossy venture
#
public WeaponManager(Pirates plugin) {
  this.plugin = plugin;
  this.KEY_WEAPON = new NamespacedKey(plugin, "weapon");
}

final Pirates plugin;
public final NamespacedKey KEY_WEAPON;

final HashMap<String, RangedWeapon> weapons = new HashMap<>();

public RangedWeapon getWeapon(ItemStack stack) {
  if (!stack.hasItemMeta())
    return null;
  PersistentDataContainer pdc = meta.getPersistentDataContainer();
  return weapons.get(KEY_WEAPON, PersistentDataType.STRING);
}
river oracle
#

Bruh tryna steal my suggestion

chrome beacon
#

πŸ™ƒ I didn't see that

river oracle
#

I don't care I'm livid now fuxk yoh Olivo

#

I'm bouta pull up get ready to square up pal

chrome beacon
#

Not sure if you want to

#

I have Covid

river oracle
#

Bruh I've already had it recently I'm immune we are good to go

chrome beacon
#

You can get it more than once

river oracle
#

Ik it's not been long since I've had it thougj

chrome beacon
#

Also how do you know it's the same variant

river oracle
#

I don't and I don't care

rotund pond
#

Hello !
I've created a fly command, and I'm trying to remove fall damages only after the command /fly (when fly is disabled)...
How can I do this ?
I tried 3 things:

  • Create a list, then put the player in this list when he does /fly. When he get fall damages, cancel and remove the player from the list.
    Problem: The player is still in the list if he wasn't falling, and he will be safe for his next fall.
  • Remove the player from the list when he hits the ground
    Problem: He hits the ground before getting damages, so he will get damages
  • Use the method Player#setFallDistance() after using the command, but it doesn't work (idk why).
agile anvil
rotund pond
#

0.0F

#

Like Essentials :']

reef lagoon
#
java.lang.IllegalStateException: AsyncPlayerChatEvent may only be triggered synchronously.
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:657) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.adventure.ChatProcessor.post(ChatProcessor.java:194) ~[paper-1.18.2.jar:git-Paper-347]
        at io.papermc.paper.adventure.ChatProcessor.process(ChatProcessor.java:66) ~[paper-1.18.2.jar:git-Paper-347]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.chat(ServerGamePacketListenerImpl.java:2223) ~[?:?]        at org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer.chat(CraftPlayer.java:673) ~[paper-1.18.2.jar:git-Paper-347]
        at me.wihy.nextdc.MCcmds.item.onChat(item.java:18) ~[NextDC-1.0.0-SNAPSHOT.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-347]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:669) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.adventure.ChatProcessor.post(ChatProcessor.java:194) ~[paper-1.18.2.jar:git-Paper-347]
        at io.papermc.paper.adventure.ChatProcessor.process(ChatProcessor.java:66) ~[paper-1.18.2.jar:git-Paper-347]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.chat(ServerGamePacketListenerImpl.java:2223) ~[?:?]        at 
``` what does this mean
agile anvil
chrome beacon
#

AsyncPlayerChatEvent may only be triggered sync

agile anvil
chrome beacon
#

(Basically call that chat method sync)

tardy delta
rotund pond
rotund pond
rotund pond
tardy delta
#

the decompiled code shows weird stuff sometimes

reef lagoon
chrome beacon
#

You're doing it async

#

Do it sync

reef lagoon
#

nvm

ivory sleet
#

^ its gonna go off thread anyway

dim palm
tardy delta
#

removing fly damage when fly is disabled? wait wha..

#

or am i reading ir wrongly

brittle lily
#

Guys I have a custom ItemStack. I wanna make event with When ItemStack Placed on the ground but I cant cast my custom Item to Block How Can I Do That

rotund pond
tardy delta
#

uh ye

rotund pond
#

What's wrong ?

tardy delta
#

im not understanding this
I've created a fly command, and I'm trying to remove fall damages only after the command /fly (when fly is disabled)...

stiff zinc
#

Hey, I have a weird error happening today with Maven and I can't seem to find any fix for it.
Basically, I'm building an API for changing player skins. I've already done this API in the past, but I'm currently rewriting it.

This is the project structure:
The API contains the PacketProvider<T> class for sending the correct packets for the given Bukkit version: https://github.com/itspinger/DisguiseAPI/blob/master/API/src/main/java/net/pinger/disguise/packet/PacketProvider.java

Each module has a class which implements the PacketProvider<Packet> class (1.16.4 for example):
https://github.com/itspinger/DisguiseAPI/blob/master/v1.16.4/src/main/java/net/pinger/disguise/packet/v1_16_4/PacketProviderImpl.java

The plugin module is the module where all modules are combined within the PacketContext implementation
https://github.com/itspinger/DisguiseAPI/blob/master/Plugin/src/main/java/net/pinger/disguise/packet/PacketContextImpl.java

But what happens when I actually try to compile is I get the cannot access net.minecraft.server.v1_14_R1.Packet error when I do a mvn clean install

rotund pond
#

wow

tardy delta
#

remove embeds pls

stiff zinc
#

wtf

rotund pond
ivory sleet
#

<link> will remove embeds fyi itspinger

stiff zinc
#

okay

tardy delta
#

something in my head is saying that whenever you fall when just having set Player#setFlying to false, that you dont get fall damage but that cant be true

earnest forum
tardy delta
#

i understand ye

unreal quartz
tardy delta
#

or just set the fall distance?

stiff zinc
#

But they build fine in own modules respectively

#

Like only the Plugin module fails with that message

chrome beacon
#

But you need to run BuildTools to have the nms dependency πŸ™ƒ

stiff zinc
#

1.8.8, 1.9.4 build fine

stiff zinc
chrome beacon
#

Oh no

tardy delta
stiff zinc
#

It's already built on my machine either way

unreal quartz
rotund pond
# tardy delta what parameter did yu give it?
  @Override
  public void disableFly(FileConfiguration fileConfiguration, boolean forced) {
    Player player = this.getPlayer();

    if (player == null) return;
    if (!player.getAllowFlight()) return;

    player.setFallDistance(-500f);
    player.setFlying(false);
    player.setAllowFlight(false);

    String flyDisabled;
    if (forced) flyDisabled = fileConfiguration.getString(Message.FLY_DISABLED.getKey());
    else flyDisabled = fileConfiguration.getString(Message.FLY_OFF.getKey());
    player.sendMessage(MessageUtils.setColorsMessage(flyDisabled));
  }
tardy delta
#

-500?

#

why not just 0 or 1

chrome beacon
#

Depending on an illegal distribution of Mojang code is not good

rotund pond
stiff zinc
#

The 14 fails

#

And when I remove the 1.14 the 1.13 fails

tardy delta
#

maybe put setfalldistance after you disable its flight

unreal quartz
#

Yeah, so you don't have the nms dependency available in your build path

#

Either whatever repo you're using doesn't serve it, or you don't have any of them locally

rotund pond
stiff zinc
#

They are all in my .m2

earnest forum
rotund pond
stiff zinc
tardy delta
#

lol

stiff zinc
#

IDE points me to the line where I add them to the providers set

#

Like I said, the Plugin module is the one that fails building, the other modules build just fine

#
    public PacketContextImpl() {
        // Add default providers here
        // this.registeredProviders.add(PacketProviderImpl.class);
    }
#

If I comment out the line and then try to build, it builds fine

#

So Idk why that happens

unreal quartz
#

Haven't work with maven for a while, but maybe it's because the specific versions have the nms dependency with the provided scope? Maybe that's why the plugin module doesn't have the nms dependencies as transitive dependencies

atomic niche
#

Without NMS or mixins, is there any reliable direct way to cleanly redirect an end exit portal to a specific destination in the overworld?
We have an indirect workaround, but its 100+ lines, requires a bunch of vector calculations, and is a slight pain to maintain.

stiff zinc
#

Provided means that the compiler shouldn't inject it into the jar

#

It should already be loaded within the JVM

#

I've tried googling but it doesn't get me anywhere

#

If I did use <compile> tag on all of them the .jar file would be huge aswell

#

More than 70mb probably

unreal quartz
#

You can try with the compile tag and see if it works

#

But looking at the documentation, it says that provided dependencies aren't offered as transitive ones

stiff zinc
#

I'm not actually using any of the nms classes inside the Plugin module

kind hatch
#

The <provided> tag should be what they need though.

stiff zinc
#

I'm using wrapper classes

unreal quartz
#

Do you mean the PacketProviderImpl classes? Because they import net.minecraft

rotund pond
#

I don't get the difference between Location#getY and Location#getBlockY πŸ€”
IntelliJ says they can be null, but why ?
(Using it in EntityDamageEvent, to prevent fall damages)

lavish folio
#

can i get radius from one location to new location?

rotund pond
lavish folio
#

yes sorry

rotund pond
atomic niche
lavish folio
kind hatch
mighty pier
#

how to get the thing where you fall over and turn red and shit the carpet?

rotund pond
mighty pier
#

in spigot

mighty pier
#

you die

#

and you turn red and fall

#

the animation thing

kind hatch
rotund pond
#

Ah, idk sry

stiff zinc
#

I'm using .class only to store the classes

#

Like I'm not directly importing the net.minecraft inside the Plugin module

kind hatch
#

Then why not remove the dependency in the pom then?

#

If it's not used anywhere in the actual module, then it can be removed.

stiff zinc
#

Well it's not included in the Plugin module

#

But it is in the version modules

#

Because I need it there

#

Could anyone clone the repo and try to build it

#

Incase it's only on my machine lol

atomic niche
# atomic niche That only works for end gateways; not end portals.

Btw, what was the rationale for making end portals so aggressive?
How long do PRs take with spigot? Would an end portal fix be within the purview of what one might be able to get merged?

The fact that it takes a load of vector calculations to redirect an end portal seems like an api limitation worth addressing

unreal quartz
stiff zinc
#

Wait let me push the latest

zealous osprey
#

How would one check if a block is a tileentity?

eternal night
#

check if its state is a TileState

zealous osprey
#

Will do, thx

kind hatch
atomic niche
#

EntityPortalEnterEvent can not be cancelled

kind hatch
atomic niche
#

Not called

heavy marsh
#

Hello I have a listener for the BlockBreakEvent and I cancel the event when the player tries to break a specific block, but the block still breaks anyway, anyone know why?

@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
    Block block = event.getBlock();
    if (!manager.isLockedContainer(block)) return;
    event.setCancelled(true);
    logger.info("cancelled");
    ...
}

(the log message is sent)

atomic niche
#

PlayerRespawnEvent is what gets called, and it also can not be cancelled

kind hatch
# atomic niche Not called

Weird, because that should get called.

Called when a non-player entity is about to teleport because it is in contact with a portal

#

Oh

#

wait

#

lmao

atomic niche
#

End exit portals are a special case

#

there is no cancellable event that gets called, and thus, if the player touches the block, it is impossible to cancel the teleportation.

kind hatch
unreal quartz
# stiff zinc Okay done

Got the same error as you, it seems like .class ends up initialising the class? Because when I remove the scope for the 1.16 module it compiles successfully

stiff zinc
#

Yeah it does compile but the whole jar gets shaded inside

atomic niche
stiff zinc
#

And I don't really want that

#

But it makes no sense why that would happen aswell

#

Like

#

I've never had this problem

kind hatch
atomic niche
#

nope

#

PlayerRespawnEvent and EntityPortalEnterEvent trigger before PlayerMoveEvent

#

You need to catch the blocks surrounding the portal and make them the teleport triggers, which makes it seem unnatural

#

Our workaround involves using a bunch of normalised vectors to predict the motion of the player or entity.
Using those checks, we determine whether it is likely they will hit a portal.

We then use some more expansive checks to expand the portal block's hitbox by 0.1 blocks, and teleport the player before they can touch it.
If the player is going too fast, we let them touch it, then hijack the respawn event to force them to respawn at a specific location in the overworld.

kind hatch
atomic niche
#

Doesn't work for entities, doesn't get called in the first place

#

End exit portals do not technically teleport the player; they force the player to respawn

#

not only do they force the player to respawn, they do so the moment the player touches a portal, and before the player technically moves there with PlayerMoveEvent

unreal quartz
# stiff zinc I've never had this problem

So I can't quite explain why, but it seems like removing extends PacketProvider<?> from line 14 (so that it's just private final Set<Class<?>> registeredProviders = new HashSet<>();) allows it to compile?

atomic niche
#

The only way around that is to cancel the respawn event (or the EntityPortalEnterEvent) with nms.
Or, to implement your own detection algorithm slightly out from the block.

Such algorithms are flawed though at maximum velocities though, so hijacking the portal event is required

kind hatch
#

Can you explain what you are trying to achieve? From what I gather, you are making a teleportation system that uses end portals that works for all entities.

zealous osprey
eternal night
#

what

zealous osprey
#

I cannot check for TileState

eternal night
#

Well, rip

atomic niche
# kind hatch Can you explain what you are trying to achieve? From what I gather, you are maki...

Basically, we have a recursive teleporter able to teleport literally any combination of players and/or entities.
This can be triggered by any "traversable" block set by the player; one such block is an end portal.

Thus, we want to be able to teleport any combination of players and/or entities that hit an end portal.

This is our current workaround; it feels a bit much for what should be a simple task.
https://github.com/stargate-rewritten/Stargate-Bukkit/blob/4fa09c15c20cdebf6dd9e26a56a690be07ff8f75/src/main/java/net/TheDgtl/Stargate/listener/MoveEventListener.java#L92-L202
Basically trying to determine if there is an existing direct solution, or if this is a PR-worthy issue.

#

The easiest solution would just be if PlayerRespawnEvent or EntityPortalEnterEvent had setCancellable

atomic niche
#

Hence the prospect of a PR

kind hatch
# atomic niche The easiest solution would just be if PlayerRespawnEvent or EntityPortalEnterEve...

I don't think those would be accepted though. Player respawning is important for many things. Being able to cancel that event in a plugin could cause the game to break. However, I think this is one of those cases where you would have to listen to multiple events if you wanted this to work as expected. Due to the Teleporation logic for players and entites being split into their respective events. (PlayerTeleportEvent & EntityTeleportEvent)

Players have the TeleportCause enum that you could leverage, but regular entities don't. (Entity teleportation is pretty easy though.)

atomic niche
#

The problem here though is that it isn't teleportation

#

When you enter an end exit portal, you do not teleport

#

therefore, none of the teleportation events get triggered

limpid bronze
#

Hey, I'm trying to follow this https://www.spigotmc.org/threads/1-8-1-13-custom-block-breaking-change-block-hardness.362586/ for a custom block breaking system but this tutorial is outdated (i'm in 1.18.2), I still have follow this tutorial and the system doesn't work properly. Is there a updated tutorial or someone that can help me about that? The principal problems are:

  • PlayerAnimationEvent is not called sometimes when it should
  • The author of this tutorial forgot to calculate time that should take to broke the block depending on the tool used
  • The author of this tutorial forgot to set hardness depending on the block
atomic niche
#

Neither PlayerTeleportEvent nor EntityTeleportEvent is called.
The actual "Teleportation" is playerRespawnEvent

kind hatch
#

That's odd. I wonder if the other events get fired later or are tied to other specific use cases. Because they wouldn't exist otherwise.

#

Let me setup a test server and try some of this stuff out.

smoky oak
#

cant you just set the goal of playerrespawnevent to where the player currently is instead of cancelling it

atomic niche
atomic niche
#

Also makes it less than seamless if the destination is in a dimension other than the overworld.

#

For example, try to teleport an experience bottle riding a bat leashed to a boat riding a furnace minecart riding a donkey riding a player to the nether from an end exit portal.
It can be done by hijacking various respawn events and reconstructing everything.

It's just far more complicated than doing it directly, and is very noticeable for the player.
The easier solution is just to prevent the respawn events and do it yourself.
That involves a load of vectors and whatnot, with respawn hijacking as a fallback for high velocity entities.

smoky oak
#

why not save all passengers into someting, teleport the player, then set the passengers of the player back to whatever that stack was

kind hatch
#

Ok, just did some testing and the PlayerPortalEvent & EntityPortalEvent are both cancellable.
When I try to enter a normal end portal. The event is cancelled.
When I place a mob in the portal, the event is also cancelled.

smoky oak
#

iirc theres some special rules for passengers and teleports

kind hatch
heavy marsh
kind hatch
stiff zinc
#

But I'm wondering whether I should leave it at that

heavy marsh
stiff zinc
#

Even doing Class<? extends PacketProvider> works

#

But I get the raw use of parameter type warning

kind hatch
smoky oak
#

its part of the if claus

atomic niche
smoky oak
#

ha?

#

i thought passengers are unaffected by nether portals?

heavy marsh
#

plus I have already confirmed the code gets past that point

#

the problem is that even though the event is being cancelled the block still breaks

kind hatch
#

Then your check isn't doing what it needs to.

#

If it's getting past a guard clause, then you need to reevaluate what you are checking for.

heavy marsh
#

🀨

kind hatch
#

Think about it.

smoky oak
#

@kind hatch he is saying the block breaks even if he sets the event to cancelled, also, im fairly certain that check does what it's supposed to

kind hatch
#

I'm not sure it does. Otherwise the event would be cancelled.

#

Unless you have another plugin on the server that is interfering with yours, then it comes down to that one check.

kind hatch
atomic niche
atomic niche
kind hatch
#

No, that is a normal end portal.

atomic niche
#

i.e. a portal in the end going to the overworld?

#

Radically different

#

Portals in the overworld going to the end are easy enough to deal with

kind hatch
#

Either way, it gets called for every portal I make and try to use.

atomic niche
#

Have you tried going from the end to the overworld?

kind hatch
#

Let me see.

atomic niche
#

That's going to the end though

#

what about going from the end to the overworld?

#

i.e. exiting the end

atomic niche
smoky oak
#

whats the difference between PlayerInteractAtEntityEvent and PlayerInteractEntityEvent?

kind hatch
#

@atomic niche

atomic niche
#

End gateway != end portal?

kind hatch
#

Yes

#

They are separate things.

atomic niche
#

Why is end gateway firing if its an end portal?

kind hatch
#

It's not.

#

I entered The End. Killed the dragon, then entered an End Gateway

atomic niche
#

end gateways are these things

#

nvm, cant upload screenshots

#

either way, not something I care about

#

end exit portals are the things that spawn when you kill the dragon

kind hatch
#

End Gateway

atomic niche
#

^ Don't care about those

kind hatch
#

You mean this?

atomic niche
#

yes

kind hatch
#

Oh, well yea.

#

That fires the Respawn event.

#

That's the end of the game.

atomic niche
#

indeed

#

I want to redirect one of those

#

And that's why I need a 100+ line vector workaround

kind hatch
#

Ok, that helps clear things up. Let me see if I can't find anything about it.

atomic niche
#

As far as I am concerned, there are six solutions

kind hatch
#

Ok, already have an idea.

#

The end has a special property.

#

Every end portal in The End acts as the end dragon portal.

atomic niche
#
  1. Crazy vector workaround (we are doing this) with respawn hijackcing as a fallback for high velocity entities.
  2. Brick the end exit portal with NMS.
  3. Brick the end exit portal by screwing with world loading.
  4. Replace the end exit portal with falling end portal blocks.
  5. Get a PR to make EntityPortalEnterEvent cancellable
  6. force a bunch of bounding boxes and detect colisions
atomic niche
flat galleon
#
    private void dropItem(Location location, int amount) {
        for (int temp = amount; temp > 0; temp--) {
            ItemStack itemStack = new ItemStack(ore);
            if (!stack) {
                ItemMeta itemMeta = itemStack.getItemMeta();
                itemMeta.setDisplayName("custom" + dropID++);
                itemStack.setItemMeta(itemMeta);
            }
            Item item = location.getWorld().dropItem(location, itemStack);
            item.setVelocity(new Vector(0, 0, 0));
        }
    }
#

Can someone explain briefly what this code does

compact haven
#

dropItem

flat galleon
heavy marsh
#

@kind hatch I have removed all other plugins, the problem still happens, though may I point out it is only handled incorrectly if the person breaking the block is not the owner of the locked container (as far as I can tell)
Here is the repo, maybe you can take a further look with more context https://github.com/Synthetic-Dev/LockedContainers/blob/main/src/main/java/me/syntheticdev/lockedcontainers/events/BlockListener.java#L47

GitHub

User-owned locked chests and barrels. Contribute to Synthetic-Dev/LockedContainers development by creating an account on GitHub.

smoky oak
tender shard
compact haven
#

It spawns a number of β€œore”s at the provided location in the provided amount and adds a special metadata to prevent stacking, if it’s not meant to stack

smoky oak
#

oh hey alex... do you know if i can override nms without having to rebuild the server?

eternal night
#

beyond mixins not much

smoky oak
smoky oak
#

it was something in LivingEntity

#

dont know the exact name atm

flat galleon
heavy marsh
chrome beacon
smoky oak
#

ah that was it. I wanted to override LivingEntity#isDamageSourceBlocked

limber owl
#

how do I get players respawn location?

heavy marsh
limber owl
tender shard
#

when do you need the respawn location?

heavy marsh
limber owl
smoky oak
limber owl
#

for safety reasons

chrome beacon
#

Because you would need to make a custom jar that launches instead of the server jar

heavy marsh
chrome beacon
#

Your jar then needs to launch the server

#

Basically you need the Mixins to load quite early

smoky oak
#

im not good enough for that urgh

#

is there any other possebility?

kind hatch
#

@atomic niche I guess I'm getting different results.

atomic niche
#

Is that going from the end to the overworld?

kind hatch
#

Yes

#

It also looks like the EntityPortalEnterEvent gets called first according to the output.

atomic niche
#

Yes, but EntityPortalEnterEvent can not be cancelled

kind hatch
#

But it can be leveraged.

#

You could use it to store information about a player or entity. Then in whatever event you want to use, use that information you stored to make comparisions.

atomic niche
#

but how does one go about preventing the applicable respawn events?

PlayerMoveEvent's getTo is too late
Neither EntityPortalEnterEvent nor PlayerRespawnEvent can be cancelled

We have all the information we need for the teleport;
The missing information is when to preform the teleport.
To make it as seamless as possible, we want to teleport the player a fraction of a second before they would trigger the respawn events

kind hatch
#

I think you would actually want to use the RespawnEvent and just set the respawn location using PlayerRespawnEvent#setRespawnLocation()

#

That way it is seamless.

chrome beacon
#

Probably not

kind hatch
#

How so?

atomic niche
#

The thing is,
a: that forces overworld.
b: it's a pain to resync entities when hijacking the respawn

kind hatch
#

If they check for the proper criteria, it should be fine.

chrome beacon
#

Actually nvm

#

It might be fine

kind hatch
atomic niche
#

ah

#

nvm, I guess I misremembered something

#

Anyways, still a pain to resync. For example, several parts of the entity recursion can enter the portal at the same time.
When rebuilding the entity, it needs to be done in a very specific order with very finicky timings, or stuff breaks.

If you have an experience bottle riding a bat leashed to a boat riding a furnace minecart riding a donkey riding a player.
And if the teleportation is not handled with very specific timings, everything will fall apart.
It can be rebuilt, but it gets really confusing and messy

#

Handling the teleport ourselves, unless absolutely necessary, makes life easier

kind hatch
#

Why do you need to rebuild the entity? Just use the methods from the events.
EntityPortalEvent#setTo()

#

Or, Entity#teleport()

atomic niche
#

Because none of the existing spigot teleport events are able to deal with complex entity stacks

#

they invariably split apart after one or two deep recursion

#

and they fail to handle leads

kind hatch
#

Wdym entity stacks?

smoky oak
#

again why not stuff all passengers except the main entity into something and the restore it once the main entity teleported

#

unless a player is a passenger

#

you should be fine

atomic niche
heavy marsh
#

I don't think even vanilla supports stacked entities going through portals?

smoky oak
#

how the fuck do you stack entities in a loop

kind hatch
#

You mean passengers? No

atomic niche
#

Passengers are not complex entities

kind hatch
#

It supports players riding entities, but that's it.

sterile token
#

Why isnt possible to know the slot on InventoryDragEvent

#

It had broken my menu api

#

😑

kind hatch
#

Because you are dragging an item. You could be dragging multiple items across multiple slots.

sterile token
#

Okay

#

So how can i cancel it?

atomic niche
#

.
1️⃣
⬆️⬇️
2️⃣⬅️3️⃣

This is circular leashing ^

sterile token
#

Because i keep items as Map<Integer, MenuButton>

smoky oak
sterile token
#

Oh yeah good idea

#

Just cancel it

#

Instead of checking the button

smoky oak
#

check if it does something weird to items but you shouold be fine otherwise

sterile token
#

Thanks matter

kind hatch
heavy marsh
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
#

Sorry wrong command

#

?notworking

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.

sterile token
#

If you have an issue just send the issue and the code

#

Dont ask someone for specific help!

heavy marsh
naive bolt
#

can i have multiple items in a ItemStack

smoky oak
#

no

#

but you can have the same items a lot of times in it

#

ie

#

a stack

naive bolt
#

yea

smoky oak
#

long story short

naive bolt
#

but for different items needs a new item stack

smoky oak
#

itemStack = 1 slot

sterile token
smoky oak
#

and a shulker is a single item just with some extra data that is its contents

sterile token
#

Yeah because a banana is no the same as an apple. They are 2 fruits but are totally diff

#

πŸ˜‚

kind hatch
heavy marsh
sterile token
kind hatch
# heavy marsh What is wrong with that logic? I've tested it and it seems to work

You have three methods for checking the same criteria. Named slightly differently or overloaded. Then in your #isLockedContainer() method you have a boolean called is It would help if it was named isLocked That coupled with the boolean using different checks makes this a little more confusing.

Anyways, that method first checks it see if the container is a proper type of container. You then use a different named method to get the same result. Which is then used to check for double chests.

I'm not sure if it is causing your issue, but it is definitely not easy to read.

acoustic pendant
#

hey! does someone have any tutorial about using mounts? such as mounting ender pearls, i haven't found anything in google. Thanks πŸ˜„

acoustic pendant
#

okay, thanks!

naive bolt
#

whats the best way to turn a string from config into a itemstack

kind hatch
naive bolt
#

what about an array so

NETHERITE_INGOT,
ENCHANTED_GOLDEN_APPLE
]```
and drop both them items
kind hatch
#

Iterate over your list.

smoky oak
#

is a string hard coded noticeably less efficient than having a separate text file containing the string if its around 1-2k words?

kind hatch
#

Not really. Strings are already the worst thing in terms of memory, but if you are grabbing it from a file, it would be the same as hard coding.
The only real difference would be the overhead for the file object. Once that gets gc'ed you are left with the same string.

smoky oak
#

ah well i was just wondering if pasting strings or eventually json is better done as hardcoded string or as file in src/resources

#

long strings i mean

#

i dont make an extra file for a regex string

kind hatch
#

I mean, if it's a file that's part of your plugin, you will have that file overhead unless you are streaming it.

smoky oak
#

i would be streaming it to read it in i think

atomic niche
# atomic niche . 1️⃣ ⬆️⬇️ 2️⃣⬅️3️⃣ This is circular leashing ^

Entity#addPassenger is very finicky for complex entities and requires very specific timings to avoid breaking apart.
Preventing leashes from breaking is also very difficult and requires carefully managing all stages of the teleportation.
Restoring momentum and dealing with legacy entities is also a challenge that requires careful execution.

Ensuring the above occurs seamlessly without desync or other visual problems is a challenge.
It involves a carefully considered DFS algorithm, a load of timing and motion calculations, etc.
It would be extraordinarily difficult to get that algorithm to work within the constrains of respawn events.

We originally tried simply hijacking respawns, but for particularly complex entities, it causes visual problems.
It works, but not in a way that is seamless for players; as such, its our fall-back method and not our solution.
By handling teleportation ourselves without respawn events, we can offer a much better player experience.

Anyways, thank you for help πŸ™‚

smoky oak
#

i dont exactly recall how i normally do it

umbral socket
#

getting multiple errors after setting a folder as package

smoky oak
#

something something getResource iirc

#

i think that was a stream

compact cape
#

How can you register an event to just call a method?
It's not going to be always the same Classes so I can not use Event Handler annotation

private void update() {
    // Some stuff
}

public void updateWith(Class<? extends Event> event) {
    // Call update when the event triggers
}

// on enable
public void onEnable() {
    // An example
    MyClass.updateWith(PlayerDeathEvent.class)
    MyClass.updateWith(PlayerLeaveEvent.class)
}
heavy marsh
smoky oak
#

actually you can. Its possible to register other classes to the plugin as event handlers

compact cape
smoky oak
#

grabs a file with the path having its origin in the same folder your plugin.yml is

river oracle
compact cape
smoky oak
#

actually you can

river oracle
compact cape
#

I just want to trigger the update...

umbral socket
#

getting multiple errors after setting a folder as package any help?

kind hatch
naive bolt
#

whats a way to do a 50/50 chance

river oracle
compact cape
smoky oak
#

random.double > .5

naive bolt
#

like random number between 0 1 and if its 1 then do something?

compact cape
umbral socket
sterile token
#

Is this okay or will make tps going down?

compact cape
kind hatch
heavy marsh
# kind hatch Well, do you know which part is giving you issue? What are you expecting to happ...

The issue is that event.setCancelled(true); is called in the onBlockBreak method, ok. And then, I have custom handling for breaking the block, line 60 if (lockedContainer == null || !cancelled) { only passes if the person who breaks the block is the owner (I have logged it), but if someone tries to break the block who isn't the owner the block is still broken (it uses the default breaking logic). Which means that the event.setCancelled(true) is not stopping them from breaking the block.

compact cape
# umbral socket yes

That's the package not skywars πŸ€¦β€β™‚οΈ πŸ€¦β€β™‚οΈ

sterile token
kind hatch
kind hatch
#

Player damage isn't that taxing.

#

Your contains lookup may be depending on how big the list is.

compact cape
umbral socket
quaint mantle
opal juniper
#

i thought they were O(1)

kind hatch
quaint mantle
#

contains on a hash table?

opal juniper
#

yes

quaint mantle
#

most of the time

#

if your hash function has a collision it will be slower

heavy marsh
quaint mantle
#

well i guess it'd be more accurate to say its O(1) average case

ivory sleet
#

which is bound to happen as soon as your V instances scale up

kind hatch
heavy marsh
# kind hatch Clarification :3

ill fix the returns then, hold on. the destroyLockedContainer method use to be used to determine whether to cancel the event or not but then I realised I needed custom block break handling

quaint mantle
#

also i havent touched plugins in a while and im trying to make a basic one rn, what am i supposed to name the groupid and artifact id?
im following the guide from apache maven and i got something in this format:

GroupID: com.username.plugin-name
ArtifactID: plugin-name
Main Class Name: com.username.pluginname.pluginname.PluginName

this seems horrible, i have to be doing it wrong right

ivory sleet
#

group id is just the reverse of a domain (preferably one you own)

quaint mantle
#

i dont own any domain

ivory sleet
quaint mantle
#

oh yeah i do

#

do i just put io.github.username

ivory sleet
#

some do like io.github.<ghname> or whatever

#

ye sth like that

quaint mantle
#

gotcha

kind hatch
#

If you didn't have one of those, then the format would be me.my-name.my-plugin-name

sterile token
#

why using own domains ?

quaint mantle
#

thanks Conclure

ancient plank
#

you don't put the plugin name in the gorup id tho

sterile token
ivory sleet
#

artifact id throws me off sometimes also

#

some people put their project name + module, for instance spigot-base-api whilst some have just api where the group id is supposed to clarify the project

sterile token
#

Is correct this

sterile token
# sterile token Is correct this

When i have multiple multi module project i use for parent=dev.alex.net.<project> and for modules=dev.alex.net.<project>.<module-name>

quaint mantle
kind hatch
tranquil viper
kind hatch
#

That just means that it needs to be run on a 1.18 server.

sterile token
quaint mantle
#

i dont think i have multiple modules at all

#

its gonna be a very simple plugin

kind hatch
sterile token
#

PTC lib = prtocol lib

ivory sleet
quaint mantle
#

gotcha

ivory sleet
#

which is annoying, cause afaik there's no rule which one is wrong

kind hatch
quaint mantle
#

aight thanks

alpine urchin
#

Poorgrammer

#

miment

quaint mantle
#

hi

sterile token
sand vector
#

im using mongodb as my database and im unsure on how to stop the spam after opening the server in the console. any idea how to stop it?

lost matrix
tender shard
#

it's amazing how github copilot is actually useful, and not completely useless as for example tabnine or all those other similar things

lost matrix
lost matrix
desert tinsel
#

how to cancel a command send event?

lost matrix
tender shard
tender shard
desert tinsel
#

the event is PlayerCommandSendEvent and event.setCancelled(true) doesn't exists

undone axleBOT
tender shard
#

what do you want to cancel? a player running a command, or the list of available commands being sent to the player?

desert tinsel
#

player running a command

ancient plank
tender shard
desert tinsel
#

thx vm

tender shard
acoustic pendant
#

why does this happen?

I store the world like this:

    World world = Bukkit.getWorld(player.getWorld().getName());
tender shard
#

you cannot store a world in a yaml

#

you must store the world's name or the world's UUID

#

but not the actual world instance

opal juniper
#

i had preview access

acoustic pendant
#

yea, i thought something like that

#

thanks

tender shard
opal juniper
#

nah its not

tender shard
#

huh

#

I'm definitely not paying for anything and I never signed up for the preview

acoustic pendant
tender shard
#

NOT paying*

opal juniper
#

oh its free trial

ancient plank
tender shard
#

ah yeah then it's free for me because I got unlimited university email addresses

opal juniper
#

how to sign up now then lol

tender shard
#

no idea lol

#

i think I just installed it in intellij and then it asked me to authorize it in the browser

#

and then it immediately worked like a charm

opal juniper
#

ill try it in pycharm in a sec

tender shard
#

for real, it's amazing what this thing can do

opal juniper
#

hmm yeah seems to work again weird

#

yeah its great

#

but sometimes it shits the bed alex

tender shard
#

i was spectical at first because all the other similar plugins were just utter bullshit

#

sceptical*

#

i can't write today

opal juniper
river oracle
tender shard
tender shard
# opal juniper

this is what code4me suggested to me ALL THE TIME, no matter what I entered

opal juniper
#

lul

prime kraken
#

Hi, A little question, How do I can switch on/off a redstone lamp with an Interact Event ? Thanks u

opal juniper
#

i imagine it is in the block state

tender shard
#

i'm not sure if that works because once the physics get calculated again, it'll be turned off again i think

opal juniper
#

nvm there is no block data for that

#

weird

tender shard
#

there's AnaloguePowered or sth similar for redstone

acoustic pendant
#

mfnalex, so the way to store a world is with a string? in a yaml file i mean

opal juniper
#

ah

#

AnaloguePowerable

tender shard
acoustic pendant
#

okay, thanks

opal juniper
#

is this a meme

tender shard
#

lol

tender shard
#

it accepts any integer

#

what's the problem?

#

have you tried to read the error message that intellij probably shows you?

#

Yes, Inventory doesn't have any getTitle() method. You can get the title from the InventoryView instead

#

it's a bad idea though to check your inventories by their title

#

you should rather keep all your created inventories in a collection and check if it contains the clicked inventory instead

#

get the InventoryView from the event, and then get the title from that

iron glade
#

Anyone here experienced with bStats graphs?

#

Wrong channel*

tender shard
#

?services

undone axleBOT
bitter garden
#

how do you get a list of every single permission on the server? getServer().getPluginManager().getPermissions() doesnt give them all

lost matrix
bitter garden
#

like the perms for /weather clear etc

tender shard
#

JDA question: does anyone know why TextChannel#sendTyping().queue() isn't showing the "XYZ is typing..." to me? No errors, it just doesn't show the "... is typing..." thing

smoky oak
lost matrix
smoky oak
#

yea thought so

#

but i meant more along the lines

#

does a permission get registered if it is in plugin yml as a command permission, but not an explicit permission in the permissions section

smoky oak
#

that makes things easier at least

bitter garden
acoustic pendant
#

Hey! how can i do this so i don't get an error?

I'm storing a world as a string in a file but then, when i try to create this: Location loc = new Location((World) plugin.spawnLocationFile.getcFile().get("Spawn.world")... etc

it says that a string cannot be casted to a World, how can i solve that?

brittle lily
#

Guys I wanna give chest to player and When player place it I will set something on chest What Should I set varible ItemStack or Chest?

lost matrix
chrome beacon
acoustic pendant
chrome beacon
#

Store the name

lost matrix
bitter garden
#

it is

acoustic pendant
#

if i do this, i get an error

chrome beacon
#

Well that would just be reduntant

#

Anyways what's the error

bitter garden
lost matrix
tender shard
chrome beacon
tender shard
#

you want to get the world by its name which you get from the world you get from the palyer?

bitter garden
lost matrix
bitter garden
#

YES!!!

#

thats what im talking about

#

the list getServer().getPluginManager().getPermissions() dont contain all permissions, including that one

#

so how do I get every permission on the server?!??

lost matrix
acoustic pendant
#

yea

crimson scarab
#

help!
java.lang.IllegalArgumentException: Invalid UUID string: 0/60
at java.util.UUID.fromString1(UUID.java:280) ~[?:?]
at java.util.UUID.fromString(UUID.java:258) ~[?:?]

    public static void displayCooldown(Player player, int cooldown) {
        final int[] counter = {0};
        Bukkit.getServer().getScheduler().runTaskTimer(plugin, new Runnable() {
            @Override
            public void run() {
                String message = counter + "/" + cooldown;
                player.spigot().sendMessage(ChatMessageType.ACTION_BAR, UUID.fromString(message));
                counter[0] += 1;
            }
        }, 0, 20);
    }
lost matrix
acoustic pendant
#

but i need the world

chrome beacon
lost matrix
lost matrix
crimson scarab
#

what is invalid about it

lost matrix
#

1c58dbdc-88ec-496e-b9c5-dd21f78c4884
This is a UUID

crimson scarab
#

then why does it want a uuid if it should send a string

ivory sleet
#

new UUID(counter,cooldown) kappa

wet breach
#

UUID.fromString(message) this method here doesn't create a UUID

lost matrix
chrome beacon
#

It's the UUID of the sender iirc

#

That you're supposed to give it

lost matrix
chrome beacon
#

You can really give it anyting though

#

Wait not a chat message

#

Nvm

lost matrix
#
public void sendMessage(@NotNull ChatMessageType position, @NotNull BaseComponent... component)
chrome beacon
#

Wait nvm on that nvm

#

The UUID is the sender

lost matrix
chrome beacon
#

Which in this case doesn't matter

#

Yeah

#

Yes

crimson scarab
#

no luck as of far

chrome beacon
crimson terrace
#

im having a problem where Bukkit.getWorld() doesnt get a world with a custom name... anyone know about this?

crimson scarab
crimson terrace
#

they say that they are in that world with their character

lost matrix
glossy venture
#

isnt there a way to display items on hover?

crimson terrace
#

they do. at this point I think they are in a differently named world

glossy venture
#

of a chat component

chrome beacon
glossy venture
#

like an item stack render

#

or is that a md

#

mod

chrome beacon
#

Mod

#

Rendering is client side

feral prairie
#

how can i make a file ?

#

and a directory

chrome beacon
#
feral prairie
#

no no

#

i already have that

#

but is there a way to make it already go into the sever area

chrome beacon
#

Call your code somewhere and use getDataFolder for your plugin folder

lost matrix
hasty prawn
humble tulip
glossy venture
#

ah

crimson terrace
#

I shall delay the getting of the worlds a few seconds, that should do it

feral prairie
chrome beacon
#

You need to call it on your plugin instance

feral prairie
#

wdym

chrome beacon
#

An instance of your plugins main class

#

Or just do it in there