#help-development

1 messages · Page 1552 of 1

tribal sparrow
#

i know, i'm using a runnable but its setting all blocks that are on fire to air

wraith rapids
#

then just set the one specific block to air

digital plinth
#

so the blocks that are fire

wraith rapids
#

instead of all of them

digital plinth
#

not the fire block

#

wait what are you trying to do here

#

extinguish multiple fires or just one

tribal sparrow
#

just the one.

so a projectile hits a block, sets it on fire
that fire goes for 15 seconds
after 15 seconds i'm trying to extinguish the fire, but only the fire. not removing the blocks. yes i know some blocks burn within that 15 seconds that's fine though

wraith rapids
#

set the fire block to air

hardy swan
#

Can block at 255 be set on fire on the top

wraith rapids
#

no because the fire would have to occupy 256 which exceeds the world size

#

fire isn't an entity; it's a block and needs to occupy an entire block of space

digital plinth
#

like natrually

#

or burn the block away

digital plinth
#

i will not extinguish all fires if you do it correctly

tidal ferry
#

is there a way to make a line of code where there are no tall grass blocks in the world

wraith rapids
#

very difficult to do in a single line of code

tidal ferry
#

not on a single line sry

#

like just is there a way

wraith rapids
#

remove the block populator that spawns them from the generator

tidal ferry
#

idk how to do that

wraith rapids
#

then you should learn how to do that

digital plinth
digital plinth
tidal ferry
digital plinth
tidal ferry
#

...

#

bru

digital plinth
#

bru indeed

wraith rapids
#

spoonfeeding is frowned upon

digital plinth
#

:0

digital plinth
#

cant see live reactions

tribal sparrow
#
                                for(Block nearby : getNearbyBlocks(block.getLocation(), 15)) {
                                    if(nearby.getType() == Material.FIRE) {
                                        if(nearby.getBlockData() instanceof Fire) {
                                            //Fire fire = (Fire) nearby;
                                            //fire.setAge(15);

                                            nearby.setType(Material.AIR);
                                        }
                                    }
                                }
                            });```
so checking to see if the block is instance of Fire and the material still removes that block thats currently on fire (under the Fire)
dusk flicker
#

So what's the goal

#

Or I should say problem

tribal sparrow
#

Trying to put out the fire after 15 seconds and not remove the blocks that are under the fire when setting the fire to Material.AIR. as some of the blocks may not have been 100% burnt at the end of that 15 seconds.

what i've currently got now works but it also removes the block that the fire is sitting on

dusk flicker
#

So you don't want to remove the block the fire is on?

#

Or do you? Bit confused

tribal sparrow
#

correct, i don't want to remove it

dusk flicker
#

Alright so when you set the nearby to air it's removing the block underneath?

tribal sparrow
#

yeah, all blocks that are on fire get removed plus the block that the fire sits on.

dusk flicker
#

What version are you running for the server

tribal sparrow
#

1.16.4

wraith rapids
#

why are you running .4

tribal sparrow
#

it's what my test server has been running on for a while, i'll update it and see if that fixes

wraith rapids
#

it probably won't

dusk flicker
#

I don't think upgrading will fix but you wan to upgrade .5 added stability fixes

tribal sparrow
#

that's why i didn't update it haha

#

ill try .5 now

wraith rapids
#

i super vaguely do remember hearing someone mentioning something about some strange vanilla logick that'd consider a burning block as burnt when the fire on top of it is removed manually

dusk flicker
#

Honestly I don't know what the issue is with the fire thing as the fire javadocs are fucking shit

tribal sparrow
#

i thought casting it to Fire from the blockData and setting the age would work

dusk flicker
#

Literally the description of Fire is md_5's mixtape

tribal sparrow
#

yeah i seen that

dusk flicker
#

Gonna see if paper docs offer any better info

tribal sparrow
#

thank you for your help and everyone else

dusk flicker
wraith rapids
#

they generally don't care to touch up the shit that spigot left to rot

tribal sparrow
#

ill just settle for what it does now, thank you everyone

wraith rapids
#

only the new stuff has proper docs

dusk flicker
#

Def try .5, see if that helps, if it doesn't try paper possibly as maybe they have a fix for it

high pewter
#

Still not found any reason why this could be happening. Anybody got any ideas?

steel gulch
#

i want to make a plugin for 1.7.10 does anyone have a link for the right spigot download

haughty musk
#

Hi. I am working on a plugin.. I have the following code in my onjoin() event and I was wondering if anyone can help me figure out how to get this to work>?

sullen marlin
#

What is not working

haughty musk
#

the teams dont show up in team list or tab menu

sage swift
#

why is your name red

#

is that bad

#

are you banned from spiget

haughty musk
#

so do you guys know how to fix it or do it another way?

haughty musk
#

Got it to show up just gotta get it to show the prefix

#

on tab menu

#

which still doesnt seem to work for some reason

real spear
#

How do I create multiple servers on one host? Like what minigame servers have. (making a minigame plugin rn and need to switch between servers)

craggy osprey
haughty musk
#

ok just refreshed the plugin and it no longer makes the teams

maiden shore
#

Is it possible to add log4j settings for the Bukkit logger from a plugin? I'm trying to silence logs from a specific package but I can't find a way to add the log4j setting in the plugin itself

granite stirrup
#

i found out when you use the thing to simulate another device in devtools on google it actually sends to the website that your on mobile

#

i found this online

#

lmao

rugged topaz
#
    public static void updateScoreBoard(Player p) {
        if (CitizensAPI.getNPCRegistry().isNPC(p)) {
            Bukkit.broadcastMessage("npc"); // this doesn't get called, i guess NPCs aren't included in bukkit's getonlineplayers method
            return;
        }
        Objective health = score.getObjective("showhealth") == null ? score.registerNewObjective("showhealth", "health") : score.getObjective("showhealth");
        if (health.getDisplaySlot() != DisplaySlot.BELOW_NAME) health.setDisplaySlot(DisplaySlot.BELOW_NAME);
        health.setDisplayName(SkyblockBasics.replaceChatColors("&c❤"));

        p.setScoreboard(score);
}
for (Player p : Bukkit.getOnlinePlayers()) {
    Scoreboard.updateScoreBoard(p);
}```

is there any way to fix this with citizens NPCs https://prnt.sc/n8ph6k
Lightshot

Captured with Lightshot

granite stirrup
#

dont worry about the cringe console.logs

#

just for debugging

granite stirrup
#

unless you had a custom client

rugged topaz
#

hypixel and several other servers do it

granite stirrup
rugged topaz
#

oh yea?

#

lemme send u an ss

granite stirrup
#

well its not possible

rugged topaz
#

or ykw

#

npc to my right

#

healthbar on me and everyone else

granite stirrup
#

i believe it showed for me so maybe thats badlion or whatever client your using doing that

rugged topaz
#

lunar client, nah. i'll show you on vanilla too if you'd like

#

sec

granite stirrup
#

but let me tell you its impossible cuz the above name scoreboards are client sided all the info is grabbed from the server

rugged topaz
#

player to my right with healthbar, npc further forward with no healthbar

#

i'm on vanilla

#

so, it is possible one way or another

granite stirrup
#

it isnt tho

rugged topaz
#

i'm legit showing you

granite stirrup
#

ok but hypixel uses a custom server

#

its not spigot or paper

#

its modified

rugged topaz
#

then that means nms would do the job?

granite stirrup
#

no

rugged topaz
#

i'm stumped

granite stirrup
#

its not possible

rugged topaz
#

several servers pull this off. hypixel isn't one of a kind

#

and not every server uses some modified server jar

#

or they might, but it'd at least be public since not everyone has the money or expertise to do that

granite stirrup
#

its not possible

rugged topaz
#

you just said it's possible with a custom server

granite stirrup
#

i said might idk if it is or not

#

but im telling you u cant do it with nms or with just the spigot api

rugged topaz
#

well someone in this discord's gotta have the answer ig

granite stirrup
#

if this was possible it would be in the citizens config

#

to disable health above name

rugged topaz
#

citizens faq does not provide info on how to fix the issue, rather to just disable it

granite stirrup
#

yeah cuz it isnt possible

rugged topaz
#

but they do say you're able to get in touch with the plugin dev for an alternative

#

nah

#

^^

granite stirrup
#

it isnt possible

#

with spigot

#

or nms

rugged topaz
#

i think ik

#

what hypixel and other servers do

quaint mantle
#

well hypixel probably fixes it by using internal plugins

rugged topaz
#

name of npc is invisible, idk how they pulled that off or what

#

but it's just it seems a hologram on top of the npc

granite stirrup
#

its not possible lol

quaint mantle
#

which wont randomly create stuff

rugged topaz
#

and hypixel prolly does the same

#

so on that note

#

is it possible to make the npc's nametags and stuff invisible?

granite stirrup
#

yeah

#

just name the npc &3

rugged topaz
#

great

granite stirrup
#

or whatever

#

any color code

#

without text

rugged topaz
#

to my knowledge that'll give u something like this

granite stirrup
#

should make the name invis

rugged topaz
#

i think i'll have to use an outside plugin for that like nonamenpc ig

#

seems like that plugin's only limited to 1.8.8 tho and no idea why

#

wdym

#

idk at all how protocol lib's used

#

what exactly do you mean by "custom names"

granite stirrup
#

try /npc name ? with nothing after it

rugged topaz
#

nah it'll just give me an argument error

granite stirrup
rugged topaz
#

isn't that premium tho

granite stirrup
#

¯_(ツ)_/¯

rugged topaz
#

well okay

#

i think i got everything i need tbh and might just use that 1.8.8 plugin

tidal ferry
#

so im doing this plugin where like the last player alive wins and I want it to show a title saying victory on the last player alive can someone help me

dusty estuary
#

is it possible to use code to check if a certain gmail account (in config file) is subscribed to a youtube channel

#

so as to people subscribe to a youtube channel before using some plugins

opal juniper
#

I imagine that it is possible with some oauth stuff

#

But YouTube doesn’t publicly share emails thankfully

dusty estuary
#

i mean cuz i need to find a way to get large amount of sub outside of YouTube, or else I will never get 1000 sub

But i dont see a api for doing so.... time to really dig into docs

#

Or maybe buy subs and view hours myself

quaint mantle
#

You just inject into the netty pipeline, and check for entity use packet or whatever

rugged topaz
#

PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER?

#

does sending that packet to the npcs work

#

or

#

idek

granite stirrup
#

isnt npcs just fake players

rugged topaz
#

mhm

granite stirrup
#

then if that thing works for players that it might work for npcs

rugged topaz
#

im struggling to figure out how to loop thru all the npcs

granite stirrup
#

citizens api?

rugged topaz
#

soo we'll see in like a few years

#

yea trying

#

i'm not really sure what to do about this line

        Iterable<NPCRegistry> reg = CitizensAPI.getNPCRegistries();
        for (NPCRegistry _reg : reg) {
            Iterable<NPC> npc = _reg.sorted();
            CraftPlayer _npc = (CraftPlayer) npc.iterator().next(); // since NPC's aren't craftplayers
            PacketPlayOutPlayerInfo pack = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, _npc.getHandle());
            _npc.getHandle().playerConnection.sendPacket(pack);
        }
#

that's commented

quaint mantle
#

Citizens doesent handle all that for you?

rugged topaz
#

wdym?

#

best explanation i found on how to loop thru npcs

#

am i supposed to send this packet to players and not npcs?

#

since that sounds more logical and possible

quaint mantle
#

Why can’t you just call .destroy

rugged topaz
#

i'm not trying to delete the npc

quaint mantle
#

If you use scoreboard teams you can set name tag visibility

#

If you really want it blank

rugged topaz
#

yea i do

#

but are you sure that's possible

#

seems too good to be true rn

quaint mantle
#

Lol ofc it’s possible

rugged topaz
#

does it disable showhealth objective tho

quaint mantle
#

I’m pretty sure playerinfo packet just takes them off tab btw

rugged topaz
#

it should

#

well blame this guy for misleading me then

quaint mantle
#

Idk what citizens is using

#

I mean you can try it

#

Doubt it’ll work, I think “hypixel” did this lol

rugged topaz
#

u dont know hypixel?

quaint mantle
#

Ofc I do

rugged topaz
#

quoted it lol

rugged topaz
quaint mantle
#

Yea cause it’s weird that the guy was like I think hypixel used this

#

Like ok lol?

rugged topaz
#

LMAO

#

this it?

quaint mantle
#

Unless he knows there secrets 🧐

#

Yea I believe that’ll work

#

Idk what you gotta do after that tho.

#

Assign teams and stuff

rugged topaz
#

well idk how to assign the team to the npc

#

i guess i already got the iteration done

eternal oxide
#

NPCs are treated as players so you add them by name to Teams

rugged topaz
#

by name?

eternal oxide
#

other Entities you add via UUID.toString()

rugged topaz
#

as in

#

&e&lCLICK for their name?

#

lmao

#

do i add entry or addplayer

quaint mantle
#

team.add(name)

rugged topaz
eternal oxide
#

deprecated

rugged topaz
#

alright

eternal oxide
#

do as Bomp said, add them by name

rugged topaz
#

team.addEntry(replaceChatColors("&e&lCLICK"));
yea and that should be this?

#

that all?

#

already registered team, blah, set the scoreboard

#

that did it <3

#

thank u

quaint mantle
#

Bettt yw

cedar rampart
#
@EventHandler
    public void ChunkDestroyEvent(BlockPlaceEvent e){
        Player player = e.getPlayer();
        Block block = e.getBlockPlaced();
        ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
        String name = meta.getDisplayName();
        Chunk chunk = block.getLocation().getChunk();
        World world = player.getWorld();


        if(block.getType()==Material.DIAMOND_BLOCK && name.equalsIgnoreCase(ChatColor.AQUA+"ChunkDestroyer") ){
            player.sendMessage("Chunk gone");
            int X = chunk.getX() * 16;
            int Z = chunk.getZ() * 16;
            for (int x = 0; x < X+16; x++) {
                for (int z = 0; z < Z+16; z++) {
                    for (int y = 0; y < 128; y++) {
                        world.getBlockAt(x, y, z).setType(Material.AIR);
                    }
                }
            }






        }

    }

im trying to make a block but when its placed it destroys a chunk
im not sure if this code is correct

cedar rampart
#

oh lol it works

cedar rampart
#

my server is just slow

subtle kite
#

oh does it break bedrock though?

cedar rampart
#

ye

subtle kite
#

thought so

#

something to think about if you want to use it your servers.

granite stirrup
#

Shouldn't he run in the bukkit scheduler?

#

So then it doesn't cause huge lag

cedar rampart
#

imma try and change it then

red fox
#

Good afternoon, could anyone give a link to the simple murder mistery/skywars/bedwars github?

At the moment I am trying to write my own mini-game and would like to see some sample code on how to correctly build the architecture of the application.

Thank's.

red fox
next stratus
stiff topaz
#

BentoBox is a gamemode with a bunch of stuff like bedwars and one block

#

A bit like a mini game api for devs

#

It’s all open source too

#

So you can “borrow” code

stable plinth
#

hey guys, is it not possible to set default name to a custom item? I'm trying to set a smithing recipe for a custom item but the display name and attack damage won't change (cuz smithing will keep the item meta i guess)

stiff topaz
#

When a somebody uses a smithing table just change the item meta

stable plinth
#

so I should use prepareSmithingEvent right?

stiff topaz
#

Ill check

stable plinth
#

or SmithItemEvent

stiff topaz
#

Prepare just triggers when somebody puts an item in a smithing table

#

Not uses it

#

So SmithItemEvent is when a user completes an action

#

For the events read the spigot docs

stable plinth
#

oh so SmithItemEvent is called when the upgraded item shows up?

stiff topaz
#

When they take the item

#

Called when the recipe of an Item is completed inside a smithing table.

stable plinth
#

ummm cuz I want to chanage the item meta after the upgraded item shows up (for preview purpose)

stiff topaz
#

It might be when a preview is made, I dont quite understand the docs

#

Its worth trying

stable plinth
#

oh setResult in prepareEvent will help i guess

stiff topaz
#

Try using SmithItemEvent

stable plinth
#

alright thx ❤️

stable plinth
#

so it's gonna be prepare one

stiff topaz
#

Alright

supple elk
#

I'm trying to make a custom tab menu, however I've ran into some difficulty. This will currently add a fake player to every player's tab menu, however I don't know how to reset the tab menu. What I want to do is reset, then reconstruct the tab menu every couple of ticks but I don't know how I can do this/

grand coral
#

How to order a MySQL table to top 5 players by balance?
SELECT * FROM tablename LIMIT 3 ORDER BY Balance LIMIT 3?

supple elk
#

if you want top 5 why are you limiting to 3?

#

also don't you need to specify if it's ASC/DESC?

quaint mantle
#

ima assume they googled it

grand coral
grand coral
supple elk
#

I think you do ORDER BY Balance DESC LIMIT 3?

#

@grand coral

#

I don't know if the syntax is different for MySQL

grand coral
#

Ok thx

eternal oxide
#

DIAMOND is not a valid ItemStack

earnest sonnet
#

Αn itemstack

eternal oxide
#

a serialized ItemStack

earnest sonnet
#

Just save one and check it out

eternal oxide
#

getConfig().set("items.0", new ItemStack(Material.DIAMOND));

earnest sonnet
#

Update it again

subtle kite
#

player.getPlayer().hidePlayer();

what is the hideplayer part I can't find it on the API website

supple elk
#

the packet just adds a player

hardy swan
#

just to confirm

#

comparing 2 UUIDs with .equals() yields the same result as comparing its .toString().equals() right?

eternal oxide
#

yes

hardy swan
#

ok great

supple elk
#

I want to make a team system for some minigames

#

there's the default mc Teams, however I want to keep track of some additional stuff

#

so I thought I'd extend Team, went down a rabbit whole of finding out where that actually led and eventually found the CraftTeam class which is private so I can't extend it

#

so do I just make a wrapper? That's kind of annoying tho

#

can I just implement Team, or does that break stuff?

tardy delta
#

why does this not works this time???

lament bronze
#

I extended Command and implemented PluginIdentifiableCommand once

waxen barn
#

what is the easiest way how to remove /pluginname:command form tabcomplete and only leave the /command?

lament bronze
tardy delta
#

???

lament bronze
#

you can't really get rid of it

tardy delta
#

there's no way to do that

lament bronze
#

well you could but why

#

its made like that so if there are multiple commands with the same name you can use all of them

waxen barn
lament bronze
#

or you could just remove the commands from the commandmap

#

you'd need to use reflection to access the command hashmap though

#

since it's a protected field

waxen barn
lament bronze
#

hm

#

lemme make a little method

supple elk
#

I don't know what it does but it's probably important, so it's probably safer to just wrap

lament bronze
#

yeah i guess

#

@waxen barn

    @SuppressWarnings("unchecked")
    public static void unregisterPrefixes(String prefix) {
        try {
            final Field f = Bukkit.getPluginManager().getClass().getDeclaredField("commandMap");
            f.setAccessible(true);
            final SimpleCommandMap commandMap = (SimpleCommandMap) f.get(Bukkit.getPluginManager());

            final Field knownCmds = SimpleCommandMap.class.getDeclaredField("knownCommands");
            knownCmds.setAccessible(true);

            final HashMap<String, Command> knownCommands = (HashMap<String, Command>) knownCmds.get(commandMap);

            for(Map.Entry<String, Command> commandEntry : knownCommands.entrySet()) {
                if(commandEntry.getKey().startsWith(prefix)) {
                    knownCommands.remove(commandEntry.getKey());
                }
            }
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
#

look so

#

this is not the best way

#

since im doing a for loop and removing from the map at the same time

#

i'm sure you can do that part better

waxen barn
#

oh, thanks

lament bronze
#

but I think you get the idea

#

what spigot version are you running?

waxen barn
#

1.15.2

lament bronze
#

if you aren't running this onEnable then you need to sync commands

#

otherwise it's fine

tardy delta
#

can i copy the itemmeta of an item or something?

private void completeTrade(Player sender, Player target) {
        List<ItemStack> targetItems = new ArrayList<>();
        for (ItemStack s : target.getInventory().getContents()) {
            if (s.hasItemMeta()) {
                // copy itemmeta
            }
        }
    }
quiet ice
#

s.getMetadata() already results in a clone

true jacinth
#

Do I have to create a "plugin.yml" for every plugin I have? Or can I use my project to create multiple plugins using only one?

waxen barn
#

@lament bronze, it doesn't work, probably because as I saied, the hash map is responsible for executing the commands, but the tab list is managed by the command dispatcher, but still I can apply similar logic there.

wintry marten
true jacinth
quiet ice
#

well, for every plugin jar - if you bundle plugins into a single jar it isn't needed

lament bronze
#

the command appears but it says it doesn't exist when you execute it right?

quiet ice
#

But bundling plugins into a single jar is untypical to say the least at it would result in more work

#

So, don't try it

ivory sleet
#

I mean is creating a plugin.yml really that hard?

supple elk
#

how can I find players who have a particular skin? I'm trying to find players who just have a single colour on their entire skin

quiet ice
#

have a single class that extends JavaPlugin and the rest are just semi-independent subcomponents of it

supple elk
#

like the skins used in this tab menu

true jacinth
quiet ice
#

having multiple classes that extend JavaPlugin is possible, but ultimately not worth the effort

ivory sleet
#

Idk if that simplifies the process

true jacinth
ivory sleet
#

but just because something takes less than 2 minutes doesn't mean you can or have the ability to always automate it

wintry marten
#

Hello guys how do you store the data of a sign? Like if there is a message written in an oak_sign

How will I save it in memory (if u get what I meant :<)

true jacinth
ivory sleet
#

anything particular?

quiet ice
#

so?

#

That is a fully valid plugin.yml - if the intentions behind it are also valid is another thing

ivory sleet
wintry marten
#

Ohh I see

true jacinth
#

I'm creating a server so I wish I could make just 1 plugin.yml that starts from PluginHeart and go through the other plugins. Basically when the player send /help MCPlugins they get a list of all options they can use. Instead of just multiple projects with just one class/plugin

ivory sleet
#

I mean you could mess with classloaders such that one jar loads all the other jars of yours

#

Though Idk why you would want that

quiet ice
#

no, dont - not worth the effort

#

Messing with classloaders is a pain

true jacinth
#

just to organize things and give up spaghetti code

ivory sleet
#

This just sounds a little bit like a you problem, not to be rude or anything.

quiet ice
#

All JavaPlugin classes have to be loaded with the bukkit plugin loader - which complicates things

true jacinth
ivory sleet
#

yeah well I thought of something like papi expansions

supple elk
quiet ice
#

The issue is that we have no idea what they are actually doing

river spear
#

How can I prevent a door from opening and closing during the PlayerInteractEvent when it is canceled. Would you have to somehow block with client packets, but how?

wary harness
#

@river spear best use protocol lib

#

It will be the simpler way

eternal oxide
#

or just get the open state in the event and set it back to that after canceling

wary harness
#

@eternal oxide didn't know u can do that xd

eternal oxide
#

Canceling door open events is an odd one as even canceling the event can end up ignored by the client, so it ends up open.

lament bronze
#

here

#
    public static void syncCommands() {
        try {
            Method m = Bukkit.getServer().getClass().getDeclaredMethod("syncCommands");
            m.invoke(Bukkit.getServer());
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
        }
    }
#

run this after you remove the commands

waxen barn
#

oh, ok

waxen barn
lament bronze
#

its public void

waxen barn
#

yep, it throwed illegalaccessexception without it

lament bronze
wary harness
#

@waxen barn so what are u doing here

waxen barn
#

rn nothing, because @lament bronze solved the problem

wary harness
#

@waxen barn i mean what were u trying to accomplish 🤔

waxen barn
wary harness
#

Oh

#

Lol

#

Why is that

waxen barn
wary harness
#

Well I got you man

#

Perfection fetishism

#

😁

#

@waxen barn

supple elk
#

This is a command to give a blue head, how can I find the username or UUID of the player with this head?/give @p minecraft:player_head{display:{Name:"{\"text\":\"Dark blue (#00008B)\"}"},SkullOwner:{Id:[I;1390846929,-1328133163,-1764951099,406210083],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmE0NjA1MzAxMmM2OGYyODlhYmNmYjE3YWI4MDQyZDVhZmJhOTVkY2FhOTljOTljMWUwMzYwODg2ZDM1In19fQ=="}]}}} 1

#

or does a player with this skull even exist?

waxen barn
eternal oxide
#

UUID = new UUID (long mostSigBits, long leastSigBits);

river spear
wary harness
#

@river spear just cancel event and set state of doors back to closed like @eternal oxide said

river spear
wary harness
#

Delay it for one thick

eternal oxide
#

how did you set the door open state?

wary harness
#

@eternal oxide it ould be he needs to delay task for one thick

eternal oxide
#

yes

#

he also likely needs to get the other half of the door and do the same

#

Bisected

north niche
#

how to replace the item that is holding by the cursor on InventoryClickEvent event
I tried...

public void onInventoryClickEvent(InventoryClickEvent event) {

        Player player = (Player) event.getWhoClicked();
        ItemStack ClickedItem = event.getCurrentItem();
        ClickedItem.removeEnchantment(Enchantment.MENDING);
        
        //I TRIED THESE THINGS:
        //event.setCurrentItem(ClickedItem);
        //event.setCursor( ClickedItem );
        //player.setItemOnCursor(ClickedItem);

        //player.updateInventory();
    }

I'm just removing the clicked item's mending enchantment and replacing that item stack back to the player's cursor.

river spear
# wary harness Delay it for one thick
                                 TrapDoor door = (TrapDoor) bdata;
                                 door.setOpen(door.isOpen());
                                Bukkit.getScheduler().runTask(Main.main, () -> {
                                    event.getClickedBlock().setBlockData(door);


                                });``` no working
eternal night
#

I mean

#

you aren't delaying it 😂

wary harness
#

Delay one thick

#

@river spear

kind coral
#

what is the best way i can make an abstract class / interface for Kits that my Kit Class will extend/implement

#

Like Archer Kit extends/implements KitBase

#

something like that

river spear
wary harness
#

@river spear delayed tak runnable

wary harness
#

@eternal night thanks god u send it

young knoll
#

I mean that is delayed one tick already

north niche
young knoll
#

runTask schedules it for the next tick

wary harness
#

@north niche u maybe need to cancel event

#

And set item after it

north niche
wary harness
#

@north niche well not sure then

river spear
#
                                 TrapDoor door = (TrapDoor) bdata;
                                 door.setOpen(door.isOpen());
                                Bukkit.getScheduler().runTaskLater(Main.main,  () -> {
                                    event.getClickedBlock().setBlockData(door);
                                }, 1);```The trap door is still opened and closed briefly
wary harness
#

@north niche well i was talking about that

#

That u should cancel event

#

Then change items

north niche
wary harness
#

What is currently a problem

eternal oxide
north niche
river spear
#
                                Bukkit.getScheduler().runTaskLater(Main.main,  () -> {
                                    BlockData bdata = event.getClickedBlock().getBlockData();
                                    TrapDoor door = (TrapDoor) bdata;
                                    door.setOpen(door.isOpen());
                                    event.getClickedBlock().setBlockData(door);
                                }, 1);```Still no change
north niche
wary harness
#

Door.isopen

noble spire
#

With plugin yml aliases for commands, if you use an alias does it automatically change the command name supplied to the plugin?

wary harness
#

Replace it with false

#

@river spear

eternal oxide
quaint mantle
#

is there any library that contains blocks and items from like 1.7 to 1.17so they are easilly accessible? like getBlock(WHAT, version)

supple elk
opal juniper
#

Not really sure what u mean

supple elk
#

however this is too short I'm pretty sure

#

typing it in on that website gives nothing

opal juniper
#

oh - i read up

quaint mantle
# opal juniper What?

there are changes for items and blocks with versions, like its called another in 1.13 and another in 1.8, most of the things, so is there any library that maps it all

opal juniper
#

idk

supple elk
supple elk
eternal oxide
supple elk
#

well clearly the player doesn't exist, so how do I create a fake player with this ksin?

#

I'm trying to do this

#

when I create a game profile the skin is set to the plyaer or whichever UUID I pass in

north niche
#

how to replace the item that is holding by the cursor on InventoryClickEvent event
I tried...

public void onInventoryClickEvent(InventoryClickEvent event) {

        Player player = (Player) event.getWhoClicked();
        ItemStack ClickedItem = event.getCurrentItem();
        ClickedItem.removeEnchantment(Enchantment.MENDING);
        
        //I TRIED THESE THINGS:
        //event.setCurrentItem(ClickedItem);
        //event.setCursor( ClickedItem );
        //player.setItemOnCursor(ClickedItem);

        //player.updateInventory();
    }

I'm just removing the clicked item's mending enchantment and replacing that item stack back to the player's cursor.

opal juniper
#

something like this?

quaint mantle
#

exactly

north niche
waxen plaza
#

Is there a special folder to store plugin data such as databases or config files?

river spear
cold field
#

Guys, I was thinking... Is it a good idea make an updater that is able to update even the plugin dependency... Bc I've some dependency like the commandManager or the GUIFramework that I use and whenever I change something into the dependency I need to update every plugin... Obv this has the problem that if i remove some methods that my plugins use it will not work anymore.. What I am asking is, Is it worth?

north niche
river spear
#

I don't want the client to see it open

#

I want the trap door to stay closed in the video I can see that it is open but it is already canceled.

opal juniper
#

u need to stop packets then

river spear
#

I want to try that too, but what is the name of this packet

opal juniper
#

check the wiki ig

young knoll
waxen plaza
cedar rampart
#
@EventHandler
    public void ChunkDestroyEvent(BlockPlaceEvent e){
        Player player = e.getPlayer();
        Block block = e.getBlockPlaced();
        ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
        String name = meta.getDisplayName();
        Chunk chunk = block.getLocation().getChunk();
        World world = player.getWorld();


        if(block.getType()==Material.DIAMOND_BLOCK && name.equalsIgnoreCase(ChatColor.AQUA+"ChunkDestroyer") ){
            player.sendMessage("Chunk gone");



            new BukkitRunnable() {
                int X = chunk.getX();
                int Z = chunk.getZ();
                int y = 0;

                @Override
                public void run() {



                    world.getBlockAt(X, y, Z).setType(Material.AIR);

                    X++;
                    Z++;
                    y++;

                    if(X<=X+16){
                        this.cancel();
                    }
                    if(Z<=Z+16){
                        this.cancel();
                    }
                    if(y<=255){
                        this.cancel();
                    }



                }


            }.runTaskTimer(Main.getInstance(),0,1);






        }
``` can someone tell me whats wrong here?
young knoll
waxen plaza
hybrid spoke
#

?paste

undone axleBOT
hybrid spoke
cedar rampart
river spear
north niche
river spear
#
                .addPacketListener(new PacketAdapter(main, ListenerPriority.HIGHEST,
                        PacketType.Play.Server.BLOCK_CHANGE) {
                    @Override
                    public void onPacketSending(PacketEvent event) {
                        if (event.getPacketType() == PacketType.Play.Server.BLOCK_CHANGE) {
                            Player p = event.getPlayer();
                            PacketContainer packet = event.getPacket();
                            event.setCancelled(true);
                        }

                    }
                });``` does not work
ivory sleet
#

what does not work

river spear
#

the door was opened

noble spire
#

Is there an EntityMoveByEntity event?

#

(well something like that)

wraith rapids
#

there may be a collision event

noble spire
#

I can't find anything looking under org.bukkit.event.entity or org.bukkit.event.player

eternal oxide
#

I don;t belive there is

#

Some vehicle collisions is all

noble spire
#

hmm oh well

twin venture
#

i need help iam trying remove items when player die , only the items with [Kit Lore]

#

but its not remove them ..

#

idk what's wrong there ar eno errors in the console

wary harness
#

@twin venture use delayes task after respown

twin venture
#

this is in playerDeathEvent ..

#

i really need help i was trying to figure this out for like 5 hours now ..

wary harness
#

Set it null

twin venture
#

that won't work

opal juniper
wary harness
#

Well then iterate thru slots

twin venture
wary harness
#

And just set specific slot item null

#

What is pdc@opal juniper

twin venture
#

no no that won't work for me ..

#

i just want when player die

dusk flicker
#

?pdc

twin venture
#

iam using 1.8.8 ..

#

that wont work ..

#

:L

wary harness
#

@twin venture just iterate per slot

twin venture
#

and after i do that?

#

should i check for lore or ?

wary harness
#

And set item to null

wraith rapids
#

easy solution

#

don't use 1.8

wary harness
#

Check for lore

twin venture
wary harness
#

@wraith rapids i mean he will inconter same shit

#

On 1.17

twin venture
#

1.8.8 is the lagless ver i ever used

#

try to change my mind .

wary harness
#

Dont set item material to null

twin venture
#

you just told me too

#

lol

wary harness
#

Just set that specific slot item to null

#

So invenory.setitem null

twin venture
wary harness
#

I told u to iterate thru inventory per slot

twin venture
#

ok

wary harness
#

And then u grab current slot number set it null and done

twin venture
#

still learning don't be mad bro .

wary harness
#

It is ok np

noble spire
#

What's the best way to store a player's Location as a primitive type? My first thought is an int[] with {x, y, z}, but that misses out world, and looking direction. I could have multiple primitive vars where one is {x, y, z}, then {pitch, roll, yaw}, then ẁorld_index but there might be a better way...

noble spire
#

A player's PersistentDataHolder

eternal oxide
#

odd, but why store a location in PDC?

#

?paste

undone axleBOT
eternal oxide
#

Location in PDC

noble spire
#

You've probably seen the /spectator mode thing for smp before, where running the command toggles you between spectator and survival, but going into survival puts you back where you went in to spectator, so you can't use it for teleport as such, I'm making a simple implementation of that, except you need to store the last location persistently

#

thanks!

#

I didn't quite get my head around the to primitive and from primitive

wary harness
#

@eternal oxide so what is presistent data container

#

What is the point of it

wraith rapids
#

a container that persists data

noble spire
eternal oxide
#

Stores data on an object that is saved with the object

wraith rapids
#

for example, a custom ID on an itemstack that lets you identify it as a custom item easily

#

without having to check for visible and modifiable things like lore or name

wary harness
#

@wraith rapids intresting

#

So that saves on preformance

wraith rapids
#

and allows items to be renamed and their lore modified

wary harness
#

Is it supported on 1.8

wraith rapids
#

obviously not

eternal oxide
#

no

wraith rapids
#

nothing is supported on 1.8

wary harness
#

Oh ok

#

Just checking

#

Because people expect when they buy plugins support for 1.8

wraith rapids
#

tell those people to piss off

wary harness
#

Well those are bed reviews

#

Which I love to avoid

wraith rapids
#

tell choco to delete them

wary harness
#

@wraith rapids is that possible

wraith rapids
#

of course

wary harness
#

If some one review base on version

wraith rapids
#

if its a dumb or false review you can yeet it

#

reviewing something poorly because it doesn't work on a version it's not intended for is a false review

wary harness
#

Didn't know that and 1.8 and older version are making my plugin big and problematic

eternal oxide
#

just drop 1.8. If they want 1.8 they use older versions.

wary harness
#

@eternal oxide should peoe drop 1.12 to

#

?

#

What is opinion of community on that

eternal oxide
#

Thats a choice you need to make

#

Many willingly support 1.12+ A lot only 1.14+

quiet ice
#

Supporting 1.12 or older means that you cannot make any use of the wonders of newer java versions - which is another thing to consider

noble spire
#

I was thinking PersistentDataType_LOCATION.class or something, although that doesn't work

eternal oxide
#

if you are using the class I just gave you, you pass it

noble spire
#

intellij doesn't like it

wraith rapids
#

if it wanted a .class, the method declaration would say it wanted a Class<PersistentDataType<T,​Z>>

quiet ice
#

IJ or javac?

noble spire
#

(IJ)

wraith rapids
#

yeah, you are trying to provide it a Class

#

it doesn't want a class

#

it wants a PersistentDataType object

eternal oxide
#

yeah, no .class ^

noble spire
#

yeah, I'm not sure what to pass 😳

wraith rapids
#

you pass it an instance of the class

#

not the class itself

noble spire
#

okay I'm dumb

#

thanks

#

I swear it didn't work hmmm

eternal oxide
#

Don;t worry, when I came back to Bukkit a couple of years ago I fell over that too

wraith rapids
#

i remember that

#

in fact I think I was the one who explained it to you

ivory sleet
#

Look how the PersistentDataType is implemented in the interface itself

wraith rapids
#

on the paper discord I think

eternal oxide
#

I could not for the life of me see what I was doing wrong.

wraith rapids
#

it was quite amusing

eternal oxide
#

Yep, it was on paper and NNY was my saving Angel

noble spire
#

I have no idea what I did lol

ivory sleet
#

No because you did it wrong

wraith rapids
#

everybody else was telling you to learn java

eternal oxide
#

Yeps

main dew
#

How I can apply change without send packet to players? java Sign sign = (Sign) new Location(Utils.world, x, 23, z).getBlock().getState(); sign.setLine(2,"");

wraith rapids
#

you drop the packet with protocollib or you use nms to skip the doodads that send the packet

twin venture
#

so i found this code in the fourm .. its working for me thx for the guy who make it

#

it fixed my problem ..

#

but my other problem is not fixed

#

i gived my self diamond

#

and when i died well diamond is stuck with me

#

..

#

well i guess i need to get the last location of player before respawn?

white viper
#

how to make game?

wraith rapids
#

a fucking brilliant question

idle grotto
wraith rapids
#

you shoot it dead and you've got game

wary harness
#

@wraith rapids so was looking in to pdc

#

Will this not be more complicated or intense on system then just using nbtapi

#

ItemStack itemStack = ...;
NamespacedKey key = new NamespacedKey(pluginInstance, "our-custom-key");
ItemMeta itemMeta = itemStack.getItemMeta();
PersistentDataContainer container = itemMeta.getPersistentDataContainer();

if(container.has(key , PersistentDataType.DOUBLE)) {
    double foundValue = container.get(key, PersistentDataType.DOUBLE);
}

eternal oxide
#

no

wary harness
#

@eternal oxide u sure

eternal oxide
#

PDC is a wrapper over NBT

wary harness
#

I mean I understand that

#

But nbtapi look simpler

eternal oxide
#

its doing the exact same thing as NBTAPI

ivory sleet
#

What’s simpler?

#

Or what looks simpler?

wary harness
#

@ivory sleet nbtapi then pdc

ivory sleet
#

I asked what is simpler. Not which one.

wary harness
#

Loom example up from tutoril

#

In chat

#

Pdc needs more lines of code then nbtapi

ivory sleet
#

Myeah in that sense I guess

wary harness
#

Like here u need instance of plugin to get namespacekey

#

And so on

#

So I dont know which will be more intense on plugin

eternal oxide
#

neither

#

Both will perform the same

wary harness
#

Example nbtapi can do lag if u are checking nbt data on pickupevent

#

And there is lots of items

#

Expirianced it

#

Learned on hard way xd

ivory sleet
#

🌞

kind coral
#

hi guys i am making a kitpvp plugin for my server, tho i have like 20kits or something, and i want to "register" them efficiently, how would i do this, i got an abstract class ( i know i can make it an interface but i tought i could add something in it)

#

as u can see many lines in the archer class are taken by getting itemstacks

ivory sleet
#

For the registration, maybe have some sort of immutable registry and then have a builder, each entry would take 1-2 lines.

kind coral
#

yeah, as of registering i know how i could make, the only thing is how i would actually make the kit class compact

wraith rapids
#

wither skull is its own block these days i'm pretty sure

vale cradle
#

Cuz MrTommy was taken lol

vale cradle
kind coral
#

thats why i made it abstract

vale cradle
#

Btw, there are so many methods that are not actually needed to be abstract. You can simply make a super class wich requires a list of the items and the permission needed for this kit, that way you can define the kits and not even need to make a subclass extending from Kit

kind coral
#

yeah i know, but i feel better using interfaces and abstract classes

vale cradle
#

Smth like:

public class Kit {
  private List<ItemStack> items;
  private String permission;
  public Kit(List<ItemStack> items, String permission) {
    this.items = items;
    this.permission = permission;
  }
  
  //Just make the getters
}
vale cradle
#

as you see, you're complicating so much trying to make it that way ;p

lament bronze
#

could use an enum for kit types

#

or even just a string for the name

kind coral
#

the only thing, if i make an itemstack of potions with amount for example 27 and i give them to the player, will they stack or not?

#

also, what is the sound that the arrow makes when hitting the player?

ivory sleet
#

They will stack

kind coral
#

sad

ivory sleet
#

mye

vale cradle
#

Just add each one individually

opal juniper
#

For loop go brrrrrr

kind coral
ivory sleet
#

ArrayList iterates faster probably tho

vale cradle
#

Copy this, I think this might be helpful:

public void addVanilla(Player target, ItemStack item) {
  int iterations = item.getAmount() / item.getMaxStackSize();
  int toGive = item.getAmount();
  for (int i = 0; i < iterations; i++) {
    int give = toGive % item.getMaxStackSize();
    toGive =- give;
    ItemStack itemToGive = item.clone();
    itemToGive.setAmount(give);
    target.getInventory().addItem(itemToGive);
  }
}
ivory sleet
#

Or just an array

vale cradle
hardy swan
#

I'm very curious if we have a class that extends ItemStack, say PaperClone that is basically of material paper, without extra stuff like display name or custom model

#

Can the server recognize that the item is an instanceof PaperClone?

eternal oxide
#

an object on the server, yes. An ItemStack sent from the client, no.

hardy swan
#

But you can mix this paper with other normal paper, no?

ivory sleet
#

I mean ItemStack is just an api class essentially

#

Extending it will have minimal impact though as it for instance gets cloned to a CraftItemStack or the nms variant depending what you do with it

vale cradle
kind coral
#

or just check if the itemstack is above max stack size

ivory sleet
vale cradle
#

Not only potions

kind coral
#

i just need potions so yeahh

vale cradle
#

lol

kind coral
ivory sleet
kind coral
#

i saw arrow hit player and arrow hit

#

they do not match

vale cradle
#

How I've been so stupid this time

ivory sleet
#

I found out about it recently also 😅

vale cradle
ivory sleet
#

🥲

wraith rapids
#

the underlying server itself doesn't handle ItemStacks at all

#

ItemStack is a bukkit api concept

#

every time you pass an ItemStack to the server, for example by placing it in an inventory, the values of the ItemStack are retrieved with the various getters and a new nms itemstack is built from them

hardy swan
#

yea that makes sense

vale cradle
#

kinda, but you can override those getters to make that items custom ;p

wraith rapids
#

well yes, but only within the scope of those getters

vale cradle
#

Like a getLore, you can, for example, make the lore prettier using a better design for enchantment definitions

#

just to give you an example

wraith rapids
#

and when you retrieve it back from the inventory or wherever you placed it, you will just get a new standard CraftItemStack instead of your custom class

#

you can do it, but you need to remember that the moment you pass your item to the server it drops everything except what an itemstack might be expected to hold

amber hill
#

there is some issue with my mob spawning in my world .I don't know why the chest become invisible but I can open them

opal juniper
#

They seem completely unrelated…?

vale cradle
#

mob spawning? chest invisible?

wraith rapids
#

sounds like a 1.8 user

opal juniper
#

TRUE

hardy swan
#

which I also find weird that it is possible

#

that every of this instance in saved in metadata space?

ivory sleet
#

ItemStacks get cloned like whenever u pass them through other api classes

#

InventoHolder is quite different sometimes

vale cradle
#

Bukkit is stupid when it comes to implement your own version of their api stuff lol

#

keep that in mind

wraith rapids
#

inventoryholder can hold classes provided by plugins as it is not persistent

ivory sleet
#

Yeah it misses @NonExtendable 😫

wraith rapids
#

it only exists as long as the inventory itself is around

#

i'm not sure if it is evicted properly on plugin unload

#

probably not

vale cradle
#

Reload the inventory holder somehow (Reloading a chunk if its a Chest or Player Rejoin if it's a player) and will most likely go brrrrrrrr

kind coral
hardy swan
#

Sound.ENTITY_ARROW_HIT_PLAYER?

wraith rapids
#

and that's why you need to provide a PersistentDataType both when setting and getting from a PDC

kind coral
#

its different

wraith rapids
#

neither the complex object nor the data type object are stored anywhere at all

#

only the primitive data the datatype's serializer shits out is stored

ivory sleet
vale cradle
#

so, sounds have yaw? kekkkkk

vale cradle
ivory sleet
#

Yeah I believe lol

kind coral
#

nop, i've tried everything ahah

ivory sleet
#

Assumably not

vale cradle
vale cradle
wraith rapids
#

even if you do try to serialize the function, the function object itself is not retained anywhere

vale cradle
#

ofc

#

that's the purpose of serialization

hardy swan
#

maybe Sound.ENTITY_ARROW_HIT?

ivory sleet
kind coral
hardy swan
#

prob client side then, only heard by the shooter

kind coral
#

bruh

ivory sleet
#

Spleed anyways

#

If you mean the hypixel sound, they use exp orb one

hardy swan
#

or player level up one

ivory sleet
#

But what solarrabbit mentioned is correct for vanilla

kind coral
ivory sleet
#

👍

loud island
#

What's the best way to go about making a http request in a plugin?

eternal oxide
#

That all depends on what request you want to make and what to do with the response

loud island
#

POST request & the response is pretty much not needed (except status like 404)

eternal oxide
#

this is a simple request. just wrap it in an async task ```java
URL url = new URL("https://api.mojang.com/users/profiles/minecraft/" + name);

        URLConnection conn = url.openConnection();
        conn.setReadTimeout(5000);
        conn.addRequestProperty("User-Agent", "Mozilla/4.0");
        conn.setDoOutput(false);

        // Handle redirects.
        String redirect = conn.getHeaderField("Location");
        if (redirect != null){
            conn = new URL(redirect).openConnection();
        }```
#

as you don;t need to know what the response is

loud island
#

wouldn't that make a GET request?

eternal oxide
#

probably

#

just build yoru address as you need

eternal night
#

if only java 16 had an inbuild http client

eternal oxide
loud island
#

Perfect, thanks!

eternal night
#

might be the more elegant solution anyway

minor garnet
#

Does anyone have an idea to create a collision system that can rotate the item through the place it collided?
is hard to explain

vale cradle
#

take it or leave it kek

minor garnet
wraith rapids
#

define 'item'

minor garnet
#

armor stand euler angle

wraith rapids
#

not via the api

#

api doesn't expose proper collision shapes

minor garnet
#

not like, I managed to do similar things by rotating the item across the face of the block

#

hm

wraith rapids
#

if you plug into nms for collision shapes or hardcode them yourself, yes

#

after that it's just math

#

after that it's just math

minor garnet
#

like, i use a egg like projectile

vale cradle
#

I mean, he refered to rotate an entity through the place it collided

#

basically implement physics

minor garnet
#

I use the projectile to detect collisions, but the tricky thing would be to just rotate it according to the direction the projectile went, but there are certain times when it rotates the item gets into the block xd

vale cradle
#

that's the thing

#

I think there is no conventional way to do this

#

to not say there is no way to do this cuz I'm not totally sure tbh

wraith rapids
#

implementing physics is just math

#

and something that has been done a billion times, so a lot of helpful resources exist for it out there

minor garnet
#

i do not know how to do it

wraith rapids
#

look it up on stack overflow

minor garnet
#

i check

wraith rapids
#

check again

minor garnet
#

i'll check***

wraith rapids
#

but, again, you need access to collision shapes to rotate things properly

#

otherwise it'll phase into shit while you rotate it

minor garnet
#

i cant use the euler angle like a collision shape ?

wraith rapids
#

rotating a collision shape causes its points to move

#

if you rotate your item, you move the points of its collision shape

#

you need to be able to tell when those points collide with other collision shapes and stop rotating it accordingly

#

otherwise the corners of your item will phase into shit while rotating

#

well. unless your collision shape is a sphere

dusty sphinx
#

Is there a way to register/dispatch events? Not listeners, events.

wraith rapids
#

Bukkit.getPluginManager().callEvent(event)

eternal oxide
#

Yes, but you should only ever do it to offer other plugin the opportunity to prevent your actions

dusty sphinx
#

I want other plugins to be able to hook into my plugin

wraith rapids
#

for 'registration', your event class should declare a public static HandlerList getHandlerList() method which should return the class' HandlerList

#

f.e

public class TransactionEvent extends Event {

    private static final HandlerList handlers = new HandlerList();

    @Override public @NotNull HandlerList getHandlers() { return handlers; }
    public static @NotNull HandlerList getHandlerList() { return handlers; }
#

java can't enforce you to implement a static method, so the most common noob issue with custom events is forgetting about the static getHandlerList

dusty sphinx
#

so event is just an abstract class?

#

actually that doesnt matter

wraith rapids
#

yes, and all events must extend Event

#

org.bukkit.event.Event

dusty sphinx
#

is PluginManager.callEvent() blocking?

eternal oxide
#

yes

dusty sphinx
#

hmm ok

eternal oxide
#

It has to be so you can get teh canceled state when finished

dusty sphinx
#

cancelled state?

eternal oxide
#

If your event is cancelable .

dusty sphinx
#

ah

eternal oxide
#

it gets passed to any registered listeners, then you get it back to see if anyone made any changes

dusty sphinx
#

so

#

I would construct the event with whatever parameters that I want, and then call it, correct?

eternal oxide
#

yes

dusty sphinx
#

and listeners will receive the instance of the event

#

ok

#

i think i get it

eternal oxide
#

the return of callEvent gives you the result of your event

wraith rapids
#

its void

eternal oxide
#

ok yes

#

teh event is modified directly

wraith rapids
#

chaining .isCancelled on it would be too easy

dusty sphinx
#

should i call super() in my constructor

wraith rapids
#

super is called implicitly

#

Event has two constructors

#

the default no-args constructor

#

and a constructor intended for events that are supposed to be fired asynchronously

#

which lets you pass a boolean that determines whether the event is fired asynchronously or not

dusty sphinx
wraith rapids
#

you store the event in a variable

eternal oxide
#

the event you pased

wraith rapids
#
        PreTransactionEvent preEvent = new PreTransactionEvent(... );
        Bukkit.getPluginManager().callEvent(preEvent);
        if (preEvent.isCancelled()) { do stuff }
#

there is no explicit, separate result; the event instance itself is modified

eternal oxide
#

That event is not cacnelable

wraith rapids
#

yeah

#

you canc cacnel it

dusty sphinx
#

how do I listen to an event i dispatch

wraith rapids
#

as you would to any other event

eternal oxide
#

same as you would any event, import it in a Listener

dusty sphinx
#

how does bukkit know which listeners to fire when an event is dispatched, is it the name of the listener or something else

wraith rapids
#

with the HandlerList

#

as the name might imply, it's a list of event handlers

dusty sphinx
#

wrong question mb
how does bukkit know which event to register the listener to

#

is it the name of the listener or something else

wraith rapids
#

registerEvents scans the class of the object you pass it

#

and looks at the method declarations

dusty sphinx
#

ohhh so its the type of the argument

wraith rapids
#

yes

dusty sphinx
#

wow i was overthinking that

hardy swan
#

can I ask a ruby question here

wraith rapids
#

only if it's ruby on rails

hardy swan
#
# event.start_date = 2021-06-25T00:00:00.000Z
clone = event.clone
clone.attributes ={:start_date=>event.start_date.strftime("%d %B %Y")}
render json: {:start_date=>clone.start_date, # = '2021-06-25T00:00:00.000Z'
:intended_date=>event.start_date.strftime("%d %B %Y")} # = '25 June 2021'
#

ok it is, so basically

#

my clone's attributes never gets updated

#

any idea why

wraith rapids
#

no

hardy swan
#

ok maybe now clearer

dusty sphinx
# dusty sphinx ohhh so its the type of the argument

does it go all the way up the hierarchy ladder? like if I dispatch an event that extends another event and there is a listener that listens to the base event will it get fired when the event that extends the base event is dispatched

#

woah boy thats some run-on sentence

wraith rapids
#

only events that have a static HandlerList in the class can be listened to

#

abstract superclasses like Event or PlayerEvent don't, so you can't listen to them

#

but yes, each superclass of an event declaring a HandlerList is invoked in order

#

for example, EntityDamageEvent and EntityDamageByEntity event both declare a HandlerList

#

firing the latter will first fire listeners for the latter, and then for the former

#

while firing the former only fires the listeners for the former

dusty sphinx
#

alright, makes sense

dusty sphinx
wraith rapids
#

you'll have to implement it yourself if your class extends/implements Cancellable

#

but, it's just a boolean field with a setter + getter so not much to implement

quaint mantle
#

I was wondering if its possible to make a gui smaller than 8 slots?

#

like this

chrome beacon
quaint mantle
#

Ahhh

limpid bronze
#

Hey, I have a question, according to this wiki https://www.spigotmc.org/wiki/creating-a-gui-inventory/ I should create a variable outside of the functions and then use that variable in the "event" function InventoryClickEvent to check if the inventory is the same. Is there any other alternative to not creating a variable outside of the functions or do I have to do like the wiki?

wraith rapids
#

super hyper technically yes there is an alternative but it's not one you should take

#

using fields is part of java; you should get used to it

limpid bronze
#

Ok so better to use the wiki technique

olive scaffold
#

Sorry, not really sure where to ask this - I have had multiple users show me that there is no option to pay for my premium plugin when they click the purchase button on the resource page, I have had people purchase it already (last one was on the 25th of June) but nothing has changed on my end and now it seems that the option isn't there for new purchases. Any ideas what could have caused it or where I should take this problem?

wraith rapids
#

simple solution

#

don't sell premium resources

#

you capitalist pig

eternal oxide
#

Come join us socialists. Give us everything and we'll look after it for you.

earnest sonnet
#

Yeeees

#

We're the most trustworthy batch

waxen plaza
#

How do I make it so when I type a command for example "/tp" and I go to type the next argument to show me a list of options like "/tp" does show a list of players

earnest sonnet
waxen plaza
earnest sonnet
waxen plaza
#

Do you know a tutorial or a post somewhere?

#

nvm, I found a tutorial when I searched tab complete

wraith rapids
#

implement tabexecutor and return a list of results

quaint mantle
#

how to force entity to shake?

wraith rapids
#

a brilliant question

sage swift
#

type in chat "boo" while looking at it

worn tundra
#

works better if the entity doesn't see you

quaint mantle
#

ha-ha

waxen plaza
#

Why is the tab completer not working?

chrome beacon
#

Did you register the tab completer

waxen plaza
#

Yes, like this "getCommand("privateChest").setTabCompleter(new VaultTabCompleter());"

#

Do you know why it doesn't work?

wraith rapids
#

have you debugged it

waxen plaza
#

no

wraith rapids
#

try debugging it

waxen plaza
#

ok

#

btw I implement TabCompleter is that right?

wraith rapids
#

probably

#

a good first step is to have sysout in your onTabComplete to see if it's getting called at all

waxen plaza
#

It doesn't get called

real spear
#

how do i set a permission level for a command I am making?

#

Example: I want to req op or a custom permission to run a command.

earnest sonnet
#

plugin.yml

#

and if checks

compact haven
waxen plaza
#

Anyone knows why tab completer might not work?

digital plinth
#

bc you did something wrong

#

:>

#

post some code for debugging

waxen plaza
#

the method doesn't get called at all

#

and I did set tab completer on my command

digital plinth
#

codeeeeee

#

no code = i can only tell you you did something incorretly

waxen plaza
#
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        if (!(sender instanceof Player)){
            Bukkit.getServer().getConsoleSender().sendMessage("Tab Completer non player");
            return null;}
        Bukkit.getServer().getConsoleSender().sendMessage("Tab Completer");
        List<String> arguments = new ArrayList<>();
        arguments.add("Argument1");
        arguments.add("Argument2");
        arguments.add("Argument3");


        return arguments;
    }```
#

getCommand("privateChest").setTabCompleter(new VaultCommand());

#

I watched a couple tutorials to figure what I did wrong but they did same thing as me

digital plinth
#

it seems fine to me hmmm