#help-development

1 messages ยท Page 2125 of 1

quaint mantle
#

What does that function do?

#

Cause BoundBox returns a box via a location with blocks inside it,.

#

I need one for a sphere.

safe notch
quaint mantle
golden kelp
#

Why

safe notch
#

and a VoxelShape contains a collection of boundingboxes

tardy delta
quaint mantle
#

Look.

#

Im trying to make a sphere, in which

#

It gets locations for each part of the sphere

#

checks if a block already exists there

#

and overwrites it

#

with stone

#

The center of the sphere, is where a block is placed

eternal night
#

I don't think spigot has logic build in to calculate a sphere of blocks

safe notch
#

yea

#

if you want something like that then try worldedit api ig

golden kelp
quaint mantle
#

I need a tutorial on that.

eternal night
#

google ?

quaint mantle
tardy delta
waxen plinth
#

I have a library that can easily do that

#
SpheroidRegion region = new SpheroidRegion(center, radius);
region.forEachBlock(b -> b.setType(Material.STONE));```
coarse finch
#

how can i convert all my args to a single string? (command: /sc words here, args will be: ["words", "here"], i want: "words here")

quaint mantle
waxen plinth
golden kelp
coarse finch
quaint mantle
#

Is it possible for me to check if something isnt the instanceof a class?

exotic depot
#

if(!(something instanceof class))?

quaint mantle
#
b.getLocation().add(0,1,0).getBlock().getType() == Material.AIR
#

Is this how id check if the above block is air?

tender shard
#

i'd use isAir() instead

#

that also checks for CAVE_AIR and VOID_AIR

timid quail
#

can i get persistant data from an offline player?

eternal night
exotic depot
#

hey so I have a class that stores an arraylist of a custom object i made for shop entries, and builds a shop inventory based on that. How can i check in InventoryClickEvent that the inventory that was clicked is this one specifically, and also is there anything i can store in the item clicked that can trace back to the shop item that was clicked? The item is paper and invisible btw, but there are 4 of them per shop item.

eternal night
#

not with plain spigot

quaint mantle
#

thank you

#

never knew there were different types of air

tardy delta
#

ayy that looks cool

quaint mantle
#

but how did you make that?

#

that looks sick

tender shard
#

custom resource pack + custommodeldata

exotic depot
#

using resource pack + custom font

tender shard
#

oh with fonts? I've only seen it using modeldata

exotic depot
#

the title has all the images

quaint mantle
#

the 10

exotic depot
#

eventually im gonna add that in

quaint mantle
#

oh cool

#

would it be weird for me to ask you to teach me that lol

tardy delta
#

wait is Map<UUID, int[]> valid java?

exotic depot
tardy delta
#

i guess not

exotic depot
quaint mantle
exotic depot
#

ok yeah it will work

tender shard
tardy delta
#

i was thinking that id need Integer[]

tender shard
#

nope

#

generics do not support primitives

#

but they do suport primitive arrays

tardy delta
#

aah

quiet ice
#

As all arrays are objects

quaint mantle
#

how would I place a block lol

quiet ice
#

Which uhm might be unexpected but that is actually the case

quiet ice
#

if you want, you may need to emit events, but really it is that easy

opal juniper
ivory sleet
#

" ".join(args) :d

opal juniper
#

:)

exotic depot
#

how can i check if an inventory is a specific one without checking the title?

tardy delta
#

.equals?

daring lark
#

you can check for example if first item is glass or sth

exotic depot
#

unless i can store the inventory to the player and check that way?

daring lark
#

what are u going to do with plugin?

exotic depot
#

itโ€™s a shop thats built every time the player opens it based on their items

daring lark
#
                    .getDisplayName().equalsIgnoreCase(ChatColor.WHITE + "Wybierz rolฤ™"))```
tardy delta
#

check the CraftInventory::equals implementation id say

golden kelp
#

Object.requireNonNull

Why

daring lark
tardy delta
#

i hope he knows what that does

#

so you prefer throwing exceptions instead of handling cases correctly?

golden kelp
#

Just do null checks man

daring lark
#

yes

#

that's great

tardy delta
#

๐Ÿ’€

daring lark
#

btw

#
            LogTools.log("saving crim spawns");
            Writer w = new FileWriter(crimSpawnsFile);
            gson.toJson(crimSpawns, w);
            w.flush();
            w.close();
            LogTools.log("crim spawns saved");
        }``` did someone know what is wrong with this code(i'll send error message)
tardy delta
#

crimSpawn.isEmpty() is smth too x)

daring lark
waxen plinth
#

Is the code not working as you expect it to?

tardy delta
#

what the error message you said

#

ello ๐Ÿ‘‹

quiet ice
daring lark
#
        at java.util.Arrays.copyOf(Arrays.java:3537) ~[?:?]
        at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228) ~[?:?]
        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:582) ~[?:?]
        at java.lang.StringBuffer.append(StringBuffer.java:313) ~[?:?]
        at java.io.StringWriter.write(StringWriter.java:106) ~[?:?]
        at com.google.gson.stream.JsonWriter.string(JsonWriter.java:586) ~[gson-2.8.8.jar:?]
        at com.google.gson.stream.JsonWriter.value(JsonWriter.java:418) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.TypeAdapters$16.write(TypeAdapters.java:409) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.TypeAdapters$16.write(TypeAdapters.java:393) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:127) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:245) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208) ~[gson-2.8.8.jar:?]
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145) ~[gson-2.8.8.jar:?]```
tardy delta
#

java.lang.OutOfMemoryError: Java heap space kekw

daring lark
#

but why i have no memory?

#

wait

quiet ice
#

IO Exceptions? Generally just kill the process. NPEs? Kill the process. The only time where I do have exceptions correctly is for ThreadDeath and reflective exceptions

daring lark
#

this code was working one week ago and know i opened project and it's not working

quiet ice
#

Generally means that you have a deadlock or you have just struck malware

tardy delta
#

id say open taskmanager and check how many % of your memory its consuming

daring lark
#

but i mean, it's problem with gson library

#

becouse when i skip code with gson it work

quiet ice
#

what are you parsing?

daring lark
#

map with mafias which are have owner members etc.

#

but on other project this code work perfectly

#

lol

#
        ExampleClassGson exampleClassGson = new ExampleClassGson(15, "dawid", new Adress(1, "warszawa"));
        Gson gson = new Gson();
        String gsonClass = gson.toJson(exampleClassGson);
        System.out.println(gsonClass);
    }``` i mean this code
quiet ice
#

and what are the fields of ExampleClassGson? It is possible that you have some recursion at play, though it surprises me that there is no stack overflow

brittle lily
#

Guys My Lore doesnt work

#

why?

quaint mantle
#

you need to first apply the lore and after the meta

brittle lily
#

oh really

#

Let me try

#

Yep Thanks ๐Ÿ™‚

#

And How Can I remove text of +7 Attack Damge from there?

quaint mantle
#
public class OnPlayerChat implements Listener {
    @EventHandler
    public void onPlayerChat(AsyncPlayerChatEvent event){
        if(event.getPlayer().getName().equals("AnEmerald")){
            String Char = String.valueOf(0xE001);
            event.setFormat(Char + " " + event.getFormat());
        }
    }
}
#

Why isnt this showing my texture packs image VIA chat

broken orchid
#

You are looking for free hosting

quaint mantle
#

it just says 57345

quaint mantle
broken orchid
#

Free hosting for Minecraft

brittle lily
eternal night
#

dunno what you are trying to do, but 0xE001 is just an int

tardy delta
#

String Char = String.valueOf(0xE001); hmm

ivory sleet
#

sadly naming the variable to Char wont have the effect of making it to one magically

eternal night
#

lol

tardy delta
#

๐Ÿคก

quaint mantle
#

its a bitmap

eternal night
#

Yea then just define the char like that ?

trail oriole
#

hello, quick dumb question, is it okay to put two commands in a single onCommand() ?

eternal night
#

final char c = '\uE001';

#

is valid java

tardy delta
maiden thicket
trail oriole
#

so I have to create a class per command ?

eternal night
#

you should yea

#

just from an object oriented approach as well

trail oriole
#

thanks a lot

#

for the tips

tardy delta
#

ye

quaint mantle
#

@eternal night Now it just makes a []

trail oriole
#

Can I create an inv in a class and add items to it in another ?

golden kelp
#

Yes

trail oriole
#

wait

#

that was such a dumb question

#

nevermind me sorry

golden kelp
#

It's finee

tardy delta
#

i asked more stupid questions when i was here at first

trail oriole
#

I'm coding a plugin for 1.8.9, is there any java/spigot stuff I shouldn't use ?

golden kelp
#

Anybody got a plugin idea?? (Useful)

golden kelp
trail oriole
golden kelp
#

Elaborate please

smoky oak
#

if i set a block to be powered (redstone) do i have to manually unpower it if it recieves no block updates, or does that happen 2 ticks later naturally

tardy delta
#

only one way to find out

#

but i think the second thing

brittle lily
#

Oh Why It Doesnt Work?

smoky oak
#

eh whatever i have written a test effect for stuff like that

trail oriole
# golden kelp Elaborate please

./bounty add (adds a bounty to a player or adds onto an existing player's bounty, not self)
./bounty menu (opens the bounty gui, with all the bounty set by players on other players)
./bounty pay (Pay your own bounty to remove it from the menu)
If you kill a player with a bounty, you get the money on his head

#

bascially

smoky oak
golden kelp
#

Enums as well

smoky oak
#

no idea then

golden kelp
brittle lily
#

I tried with colorless too but doesnt work

golden kelp
#

Debug using print statement?

brittle lily
#

There is no error

golden kelp
#

I mean check where the code reaches

brittle lily
#

Guess. Do you think Who didn't add Listener to implements?

tardy delta
#

best way to make inventory click stuff is to write a class that wraps an inventory and has consumers for each item in the inv

brittle lily
brittle lily
#

Wait what does it public void fill doing

tardy delta
#

filling the whole inventory with a filler item (black glass)

brittle lily
#

Ohh I see

tardy delta
#

i was doing stuff like Optional.ofNullable(items.get(slot)).ifPresent(InventoryButton::onClick) but i thought lets not do that :'(

midnight shore
prime kraken
#

Hello, it is possible to put a block in an hashmap ? For exemple When i click on a diamond block, it put in the hashmap the playerId and the location of the block

tardy delta
#

Map<UUID, Location> then

midnight shore
tardy delta
#

dunno what you would do with a block object x)

prime kraken
midnight shore
#

Map<UUID, Block>

tardy delta
#

someMap.put(player.getUniqueId(), event.getBlock())?

prime kraken
midnight shore
#

: )

tardy delta
#

did you refactor the path/name of that class?

#

its sayin the class doesnt exist

midnight shore
#

wdym? s

tardy delta
midnight shore
#

but it does exist...

tardy delta
#

on that path?

midnight shore
#

is it a problem that its in an enum?

tardy delta
#

the class in an enum?

echo basalt
#

god you code like nms ๐Ÿคฎ

tardy delta
#

never saw anyone doin that

midnight shore
#

i wanted trying

#

yesterday i asked if it was possible

#

iirc mfnalex said yes

waxen plinth
tardy delta
#

win win situation ๐Ÿ’€

echo basalt
#

can we tell the difference apart

tardy delta
#

nop

midnight shore
#

should i try putting it in a separate file?

waxen plinth
#

And why is it always pet plugins too

tardy delta
#

uhm i would try that im not sure

waxen plinth
#

I have never seen a well-written pet plugin

echo basalt
midnight shore
waxen plinth
#

That's not what I was saying

midnight shore
#

sorry then

echo basalt
#

pov: pet plugin

midnight shore
#

i misunderstood

#

btw

#

any clue why i get that error?

waxen plinth
#

That error usually happens when you try to save something to config that is not primitive or ConfigurationSerializable

#

In this case it looks like you tried to save a PetInstance to config

echo basalt
#

for example

crisp steeple
midnight shore
tardy delta
#

where's da 800 lines long switch?

echo basalt
#

not 800 but close enough

trail oriole
#

How would I use InventoryOpenEvent ?

waxen plinth
#

That's a really vague question

trail oriole
#

well like do something when a specific inv opens

echo basalt
#

InventoryOpenEvent -> event.getPlayer().closeInventory()

#

is an example

waxen plinth
#

If you have a reference to the inventory

echo basalt
#

or an inventoryholder

waxen plinth
#

You can just do e.getInventory().equals(yourInvHere)

trail oriole
#

I need the event when a specific invs opens

waxen plinth
#

Again

crisp steeple
#

yes

#

do the above

waxen plinth
#

You can just do e.getInventory().equals(yourInvHere)

coarse finch
#

should i add placeholderapi support?

echo basalt
#

great question

waxen plinth
#

.-.

echo basalt
#

what context

tardy delta
#

probably wanting to listen for InventoryClickEvent then

#

well

#

what were you doin again?

waxen plinth
#

Asking extremely vague questions

tardy delta
#

hmm thats a good one

waxen plinth
#

Guys what do I do with regex??

tardy delta
#

eat it

coarse finch
echo basalt
#

ugh

#

idk you tell me

coarse finch
#

yes?

waxen plinth
#

Seems like it would benefit from papi support

coarse finch
#

ok

trail oriole
waxen plinth
#

Have you tried walking into the sea

tardy delta
#

have you tried turning it off and back on again?

#

๐Ÿคค

prime kraken
coarse finch
tardy delta
#

if i see md5 ill ask him to add an :checkTheDoc: emoji

waxen plinth
#

But you shouldn't be using containsValue

#

You should be using a separate Set<Block> or something

trail oriole
#
public void onOpen(InventoryOpenEvent event) {
        Player player = (Player) event.getPlayer();
        Inventory inv = event.getInventory();
}```so that'd work right ?
tardy delta
#

ye

trail oriole
#

damn

prime kraken
trail oriole
#

easier than my brain can process

tardy delta
#

add the @EventHandler annotation too

#

on the method

trail oriole
#

I did

tardy delta
#

ah

trail oriole
#

just sent you this tiny bit

tardy delta
#

how dare you

trail oriole
#

sorry

prime kraken
# waxen plinth containsValue

    @EventHandler
    public void interactDoor(PlayerInteractEvent e){

        Player p = e.getPlayer();

        if(Objects.requireNonNull(e.getClickedBlock()).getType() == Material.ACACIA_DOOR && e.getAction() == Action.RIGHT_CLICK_BLOCK && Objects.requireNonNull(e.getItem()).getType() == Material.PHANTOM_MEMBRANE){

            if (buyDoor.containsKey(p.getUniqueId())){
                p.sendMessage("YOu have already this house");
                e.setCancelled(true);
            } else {
                buyDoor.put(p.getUniqueId(), e.getClickedBlock());
                p.sendMessage("You buy this house");
                e.setCancelled(true);
            }

        }

    }```
waxen plinth
#

?paste

undone axleBOT
tardy delta
#

```java
code here
```

waxen plinth
#

Yeah or that for short blocks

tardy delta
#

lot to learn lol

waxen plinth
#

Why are you doing Objects.requireNonNull there

prime kraken
#

Wdym

waxen plinth
#

That's going to just throw an NPE if a player ever interacts with air

tardy delta
#

cuz he saw someone doing it

prime kraken
#

Holy what did idea put that

#

x)

waxen plinth
#

You're going to spam your console with errors

#

Removing Objects.requireNonNull is not going to fix it, either

#

It's just going to make it spam NPEs instead

prime kraken
#

Yes thanks i just remove

waxen plinth
#

You can really easily just change the order of your conditions

#

e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.ACACIA_DOOR

#

Thanks to short circuiting this will never throw an NPE

prime kraken
#

nice thanks for the tips

quaint mantle
#

How do I find text in a string, and replace it?

tardy delta
#

just realized that the block wont be null if the action is clicking a block ๐Ÿคค

waxen plinth
#

.replace

prime kraken
waxen plinth
#

Use a separate Set<Block> rather than containsValue

#

containsValue will iterate over all the entries in the map to check if the value is contained

#

A Set<Block> can determine if a value is contained in constant time

prime kraken
#

Nice, thanks u a lot

quaint mantle
#

to replace it

waxen plinth
#

You could just read docs

#

But no, it doesn't

coarse finch
#

i dont understand how papi works, do i need to make a placeholder expansion in my plugin?

tardy delta
#

if you want your plugin to provide a placeholder ye

coarse finch
#

ok

#

how come i can use gradlew.bat prepareKotlinBuildScriptModel in terminal but when i let intellij do it to update the gradle changes it errors with ```Could not find spigot-api-1.18.2-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220408.234706-30).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.2-R0.1-SNAPSHOT/spigot-api-1.18.2-R0.1-20220408.234706-30.jar

Possible solution:

gloomy edge
#

What's the difference between SpecialSource and SpecialSource2?

tardy delta
#

the one is 2 and the other isnt

gloomy edge
#

Wow thank you!

mellow edge
#

how can I only allow players to break blocks that they build for them selfs, currently I have an areaylist, to store player placed blocks in it, but what if the server would restart or crash? the list would be gone

#

and there would be no way to reset it

tardy delta
#

is that part of a minigame?

#

if so i dont think you should store them over reloads

#

otherwise just save the locations to a file/database or smth

mellow edge
#

it is an bedwars base protection

tardy delta
#

if you want your game to continue after the server restarted, save the stuff to a file/database

sterile token
#

Preferible working over a cache and save it on important update and every time into database

tardy delta
#

dunno if hes actually creatin a kind of game like hypixel skywars

sterile token
#

No lmao

#

I code a plugin for a client that told me that its must contains cache the plugin

#

If not he wouldnt accept it

tardy delta
#

makes sense no?

sterile token
#

Of course it makes sense

#

Caching make things more quick

#

Because you are not everytime writing to database

#

And i dont tell you If you dont write database in Async

#

๐Ÿคฃ

trail oriole
#
if (current.getType() == Material.LEATHER_HELMET || current.getType() == Material.IRON_HELMET)``` Does that work to check if current is either a leather or iron helmet ?
tardy delta
#

writing to the database sync can be useful

echo basalt
#

oh no a customer expects an actual plugin that doesn't burn their database

trail oriole
#

Why would it display like this then ?

coarse finch
#
                    String PlaceholderFilled = PlaceholderAPI.setPlaceholders(loopPlayer, Bukkit.getPluginManager().getPlugin("GeneralUtils").getConfig().getString("messages.kickall-message"));
                                               ^
  symbol:   variable PlaceholderAPI
  location: class KickallCommand```why do i get this?
tardy delta
#

idk its eclipse :kekw:

trail oriole
#

how do you know lmao

#

isn't eclipse good btw ?

tardy delta
#

i dont like it

trail oriole
#

oh

#

why ?

tardy delta
#

looks like some 50 y/o program

sterile token
#

Eclipse its shity for me

trail oriole
#

would vscode work ?

#

I use eclipse for java and vscode for all the other languages

sterile token
tardy delta
#

vscode misses some stuff to be an actual ide

#

its more a fancy text editor

sterile token
#

For Java I recommend Intellij idea

trail oriole
ivory sleet
tardy delta
#

some stuff is just easier in an ide

#

like refactoring

sterile token
#

For example intellij allow to refactor a +100 packages group id to another in less than 5m

#

๐Ÿ˜Ž

trail oriole
#

so intellij > eclipse ?

sterile token
#

In my opinoon Intellij its 90% better

#

The main issue is that its not to much optimized, so it will fuck your ram

#

hahaha

#

Agree

ivory sleet
#

Eclipse is fine but its UI is a bit meh

sterile token
ivory sleet
#

nah

maiden thicket
#

intellij is stupid when it comes to optimization

sterile token
#

Eclipse is so shity that doesnt have tab completation

ivory sleet
#

it wasnt particularly slow for me

trail oriole
#

I have it

maiden thicket
#

i remember when i upgrades intellij to like 2020 from like 2019 and everytime i loaded an enum it would die for like 1 minute

sterile token
maiden thicket
#

upgraded*

#

i went eclipse -> netbeans -> intellij ce -> intellij pro or whatever tis called

west forge
#

is it safe to completely disable moved too quickly or moved wrongly check from PacketPlayInFlying?
https://imgur.com/a/ToHCzQF

Are they just an internal anticheat or do they prevent exploits/lag?

ivory sleet
#

eclipse before netbeans?

tardy delta
#

just kicks the user if theyre doing weird stuff

ivory sleet
#

thats an interesting one

maiden thicket
#

their built in "anticheat" for allow flight sucks

maiden thicket
tardy delta
#

there was a time i used netbeans

maiden thicket
#

netbeans is even more mid

#

eclipse is better than it imo

sterile token
#

I cannot fuck i used to code java on 2019 using Intellij with only 4gb of ram and never had big problems hahaha. Now i have 32gb of ram and a Ryzen 7 3800x and i cannot fuck

maiden thicket
#

i just liked netbeans built in browser i believe it had for web apps

tardy delta
#

the ui's a little bit better than eclipse but thats all lol

sterile token
maiden thicket
#

!=

sterile token
#

Im spanish

maiden thicket
#

whats joder

maiden thicket
trail oriole
#

i have 8 -_-

#

Should i upgrade to 16 in my laptop ?

sterile token
#

And even more im from latam and i have a decent pc

#

I cannot complain about that

#

Fortunatly im from Uruguay where it doesnt have as many problems and its stable

tardy delta
#

i should probably upgrade

trail oriole
#

If I set an item in a gui where another item is, will it override it and put the new one ?

ivory sleet
#

ye

tardy delta
#

pc starts lagging with mc, ij and mc server open

sterile token
#

Lmao

#

I need ideas for plugin

tardy delta
#

what about that claims plugin?

sterile token
#

I want to apply my knowledge about Redis and Mongo

#

I finished

#

Fourten

tardy delta
#

uhu

#

is it public?

sterile token
#

Not at the momment

#

Fourten

#

can we privately talk?

#

Or you are busy

ivory sleet
#

๐Ÿ‘€

tardy delta
#

uh we can

sterile token
#

I need to talk someone i actually dont have friends

ivory sleet
#

you got us

#

lol

tardy delta
#

best thing i heard today

sterile token
#

I have moved this year to new highschool and most of my friends dont even follow me on instagram

rough drift
tardy delta
#

lol its just instagram

ivory sleet
waxen plinth
#

instagram

rough drift
#

why instagram

#

just use spigot irc

#

?irc

undone axleBOT
ivory sleet
#

๐Ÿฅฒ

rough drift
ivory sleet
rough drift
#

I don't like something in the irc panel

#

The x's here are miniscule

#

ads have bigger x's

ivory sleet
#

oh

#

thats nasty

#

mye discord is just nicer

rough drift
#

but irc

tardy delta
#

hmm 23:23

rough drift
#

yes

#

now

#

I don't know how to use irc commands

#

how do I set my real name

tardy delta
#

what are irc commands?

rough drift
#

idk

tardy delta
#

what does irc stand for

rough drift
#

Internet Relay Chat or smt

tardy delta
#

oh

ivory sleet
#

yeee

rough drift
#

I got good memory lol

#

le bruh

#

Guess who made the supplier null!

tardy delta
#

it was you

rough drift
#

ofc it was me

#

this core ain't even on gh

tardy delta
#

good

sterile token
#

What the codec audio on discord?

rough drift
#

Discord epic shitcodecโ„ข๏ธ

quaint mantle
#
event.setCancelled(true);
item.setAmount(item.getAmount() - 1);

SpheroidRegion region = new SpheroidRegion(block.getLocation(), 15);
region.forEachBlock(b -> {
    if(b.getType() != Material.AIR && !(block.getState() instanceof TileState)){
        b.setType(Material.DEEPSLATE);
    }
});
#

Is there a reason why my block isnt updating?

#

AKA: Its not removing hte item, or anything

trail oriole
#

?paste

undone axleBOT
quaint mantle
#

its 5 lines of code

#

paste is for 100+

trail oriole
#

?

#

oh no

#

sorry

#

was for me to get the link

quaint mantle
#

oh was that for you

#

oh sorry lol

trail oriole
#

lmao sorry ๐Ÿ˜…

#

how do I fix this please

tardy delta
#

you compiled with java8+?

trail oriole
#

16 I believe

tardy delta
#

and the server is running with java 8

trail oriole
#

how do I know that ๐Ÿ˜…

tardy delta
#

'plugin has been compiled by a more recent version of java'

quaint mantle
#
@EventHandler
    public void onBlockPlace(BlockPlaceEvent event){
        Block block = event.getBlock();
        ItemStack item = event.getItemInHand();

        PersistentDataContainer pdc = item.getItemMeta().getPersistentDataContainer();

        if(pdc.get(NamespaceKeyList.getKey("gemCatalyst"), PersistentDataType.STRING) != null){
            event.setCancelled(true);
            item.setAmount(item.getAmount() - 1);

            SpheroidRegion region = new SpheroidRegion(block.getLocation(), 15);
            region.forEachBlock(b -> {
                if(b.getType() != Material.AIR && !(block.getState() instanceof TileState)){
                    b.setType(Material.DEEPSLATE);
                }
            });
        }
    }
#

Any reason this doesnt work?

#

No blocks are replaced, and the item amount isnt changed.

#

Yet, the key is valid.

#

And, it cancells the event.

trail oriole
tardy delta
#

what mc version is your server?

trail oriole
#

1.8.9

tardy delta
#

then compile your plugin plugin with java8

#

intellij?

trail oriole
#

eclipse

tardy delta
#

then i dunno how to change it

trail oriole
#

shit

#

i'll figure dw

#

thanks

tardy delta
#

do a quick google

trail oriole
#

yup

#

I have 9 or 1.8

tardy delta
#

1.8

trail oriole
#

thanks

ivory sleet
#

1.8 basically means java 8

#

and 9 just java 9

trail oriole
#

Why won't inventory.clear() clear armor slots ?

maiden thicket
trail oriole
#

done

#

Why does Material.PLAYER_HEAD doesn't exist ?

waxen plinth
#

I think it's just SKULL now

#

?jd

waxen plinth
#

Oh no it is PLAYER_HEAD

#

Skulls are the old ones

ancient plank
#

they're on 1.8

waxen plinth
#

skull

#

( ๐Ÿ’€ )

ancient plank
#

ye it was skull back in ye ole day

trail oriole
#

So I need skull to put a player's skin on it ?

maiden thicket
#

SKULL_ITEM iirc old versions

trail oriole
#

?paste

undone axleBOT
trail oriole
#

any ideas where the error is ?

waxen plinth
#
05.05 00:07:16 [Server] INFO Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
05.05 00:07:20 [Server] INFO at fr.frenchkiwi.kiwipvp.kiwiListener.onClick(kiwiListener.java:66) ~[?:?]```
#

kiwiListener.java:66

#

Uppercase your classes please

trail oriole
#

my line 66 is empty

crisp steeple
#

did you remember to build the plugin

trail oriole
#

yes ?

crisp steeple
#

well if your line 66 is empty the plugin on the server clearly isnโ€™t the latest build

trail oriole
#

well new error now lmao

#

And for as much as I could understand the last error, this one is really confusing

crisp steeple
#

it appears whatever item meta you were trying to cast was not an instance of skullmeta

#

could you share your code

trail oriole
#

this ?

crisp steeple
#

no

trail oriole
#

the entirety of my code ๐Ÿ˜…

quaint mantle
#

does anyone know how to calculate blocked and critical hits

crisp steeple
trail oriole
#

I cast it in two parts of the code

#

like I change the display name at different places

crisp steeple
#

โ€ฆso find the one where it errors?

#

and send that

ancient plank
#

1738

trail oriole
#
skullMeta.setDisplayName("You have " + points + " left");
skull.setItemMeta(skullMeta);
inv.setItem(1, skull);``` I have this twice in my code, in different events
crisp steeple
#

dude

#

that is not where you are casting the itemmeta

#

what is your line 17

ancient plank
#

is this a learnjava moment

trail oriole
#
    ItemStack skull = new ItemStack(Material.SKULL);
    SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();```
#

sorry mate

#

I got confused

#

OHHHH

#

i'm trying to change the display name from a skullMeta and not an item meta

#

could that be the error ?

crisp steeple
#

no

#

that is not a classcastexception

trail oriole
#

then idk

ancient plank
#

do you actually read the error you're given

trail oriole
#

yes i did

#

i didn't understand this one

ancient plank
#
05.05 00:28:25 [Server] INFO java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.SkullMeta
05.05 00:28:25 [Server] INFO at fr.frenchkiwi.kiwipvp.kiwiListener.<init>(kiwiListener.java:17) ~[?:?]
``` what's there to not understand
crisp steeple
#

the error is that

#

you arent making it a playerskull

#

its just a skeleton one

#

you need to set the damage value

ancient plank
#

CraftMetaItem cannot be cast to SkullMeta,
at fr.frenchkiwi.kiwipvp.kiwiListener.<init>(kiwiListener.java:17)
class kiwiListener.java, line 17

trail oriole
#

but you guys told me I couldn't use PLAYER_HEAD earlier

crisp steeple
#

yes

#

player_head does not exist on 1.8

#

it is just a damage value of skull

trail oriole
#

what is that ?

crisp steeple
#

a value on items in 1.8

#

that determine what type they are

#

cobblestone, stone, andesite, etc

#

actually cobblestone might not be a damage value of stone

#

but you get the point

ancient plank
#

I don't recommend trying to learn legacy api, most people wont even give you help with it

crisp steeple
#

yea true

#

better to start on later versions if you can

ancient plank
#

start with something more recent if you're learning

trail oriole
#

Should I just give up on this for now in 1.8 ?

crisp steeple
#

i would probably just recode it in 1.17 or 1.18

#

it will make things a lot easier

trail oriole
#

my server runs 1.8

crisp steeple
#

well you would need to change that if you were to code on a later version wouldnt you

trail oriole
#

everything works fine, thanks a lot everyone

red sedge
#

do i need to remove the entities i spawn

#

on disable

quaint mantle
#

how to make player unride

echo basalt
echo basalt
quaint mantle
#

how do i define this as an adult

#

Horse horse = (Horse) player.getWorld().spawnCreature(player.getLocation(), EntityType.HORSE);

echo basalt
#

you're asking some very trivial questions

red sedge
#

horses dont spawn as adults?

vagrant stratus
#

@hexed hatch
Okay so. I have an InteractableItemStack class, as you're aware. This class would be extendable to allow custom actions for specific item stacks.
e.g. A stone named Ban Me would ban the specific player. The issue is if there's 2 stone ItemStacks which do two different things, e.g. Kick Me, and Give me a diamond. The previous idea HashMap<Material, InteractableItemStack> would work, but only if it was certain a material would be used one.
The issue now is properly storing the ItemStack/Material/Info in a way to easily get and run the correct method

#

i.e. Kick Me always gets and runs the class that kicks the player, and Give Me a Diamond always gets and runs the class that gives the player a diamond

hexed hatch
#

If it were me, I would give every custom item a PDC string value

#

and this would be the key for the item

#

I'd have HashMap<String, InteractableItemStack>

quaint mantle
#

why isn't leaveVehicle working?

vagrant stratus
#

I always forget PDC is a thing lol

hexed hatch
#

It's a lifesaver

#

and and and

#

people can rename the item

#

and it still works

#

Before this, I did exactly what I mentioned above but with localized name

#

which is also a out of reach value for items

vagrant stratus
#

The custom items would not be renamable, thankfully lol

hexed hatch
#

but PDC is much better for this I'd say

vagrant stratus
#

and if they somehow get renamed, I'd have more important issues to worry about ๐Ÿ˜‚

hexed hatch
#

Well with PDC, you can let renamability be an option

#

then with the plugin you can just allow/disallow it

vagrant stratus
#

well yea lol

hexed hatch
#

I actually did exactly this with localized name for a old plugin of mine for detecting custom items

#

worked beautifully

quaint mantle
#

do invisibility tiers matter

#

do they make a difference

hexed hatch
#

nope

vagrant stratus
#

now I just have to figure out the whole PDC thing lol

hexed hatch
#

It's super, super easy optic

#

it's actually lifechanging

vagrant stratus
#

The issue is actually finding docs or at least an example ๐Ÿ˜‚

hexed hatch
#

I'd be happy to walk you through it personally if need be

#

you're going to need a NamespacedKey first

sterile token
#

PDC its a simple Key-value storage

#

๐Ÿ˜‚

vagrant stratus
#

Yea, I figured it out lol

#

all I need to do now is modify the class to properly make use of it, as well as make a manager then everything's good

#

which will actually a tad annoying, given how I'm going about it, though I can always just do an item builder lol

#

no real non-annoying way to do it though >.<

frail spire
vagrant stratus
#

Per plugin basis

sterile token
#

Optic how old you are ?

#

I always have that question

vagrant stratus
#

999999999999999999999999

sterile token
#

Hahaha

#

So funny...

vagrant stratus
#

Exactly.

sterile token
#

Please if you dont wanna say it, just tell me dont worry. But i dont like jokes

#

I can be really agresive

frail spire
queen patio
#

I've been trying to use worldedit in my plugin to do stuff like pasting structure files on events, but when I try to maven install, I am getting the error that the worldedit package does not exist. I have downloaded the worldedit api and included the jar as part of my library. Am I supposed to do something like include it in my pom xml or something as a dependency/repository?

sterile token
queen patio
vagrant stratus
frail spire
vagrant stratus
#

No

#

go to their discord

frail spire
vagrant stratus
#

lol you're screwed then

ivory sleet
#

appeal :3

vagrant stratus
#

This isn't paper's support server and if you can't go there, you'll just have to hope they have a section on their forums

#

Assuming you're not banned there too

frail spire
eternal oxide
#

Dev on Spigot and test on Paper, then get support here

vagrant stratus
#

You'll have to hope they have a section to get help lol

vagrant stratus
#

?paper

#

no?

#

?paperdev

undone axleBOT
#

Make sure to ask in the appropriate server concerning development towards different JAR types such as PaperMC. (Tip: Google them!)

frail spire
queen patio
wary harness
#

how would i check if TNTPrimed is getting pushed by another TNTPrimed explosion

eternal oxide
wary harness
#

so event is not fired

frail spire
eternal oxide
wary harness
eternal oxide
#

Even though TNTPrimed is not damaged, have you tested the event to see if it is fired?

#

Check EntityDamageEvent too (its parent)

white jasper
#

how do i make a resource pack for a plugin

eternal oxide
#

Google, as resource packs are not Spigot related.

vagrant stratus
#

All I need to do now @hexed hatch is find some way to abstract this enough to not be shit and OOP friendly for multiple plugins & item stacks, but I can do that after first impl lol

eternal oxide
#

If you get stuck making a resource pack, come back here and ask specific questions. You may get answers

white jasper
#

ok

queen patio
eternal oxide
hexed hatch
vagrant stratus
#

Yea I know lol

hexed hatch
#

Abstraction is something I just havenโ€™t totally familiarized myself with yet

vagrant stratus
#

?pom

#

no

hexed hatch
#

I need to sit down and just take time to learn it

vagrant stratus
#

not a thing lol

hexed hatch
#

But Iโ€™m lazy

tranquil viper
#

tough]

#

Can someone send me a pom

#

I don't feel like making it

hexed hatch
#

I gotchu

tranquil viper
#

โค๏ธ

hexed hatch
#

There

#

Enjoy

tranquil viper
#

bro

#

that fs took you loner

#

longer

hexed hatch
#

I love being unhelpful

tranquil viper
#

than sending an actual pom

#

LOL

golden turret
#

then getBlocks

delicate lynx
golden turret
#

or something like this

tranquil viper
#

alright

#

u guys

#

are weird

#

I got one

queen patio
golden turret
#

google: worledit maven

vestal dome
#

hello guys, so I'm attempting to make a console reader type of application, but I'm having technical difficulties reading the spigot's console,

#

I was thinking it could be that the console has that > to type the command in, is there a way to make it not appear at all?

golden turret
#

wdym

vestal dome
#

like I cannot use another application to read the console

#

for like, testing

#

I mean this.

#

is there any way, like with a argument while starting java or smth?

#

sorry! Found it, it was just adding -nojline when starting spigot!

tranquil viper
#

Is there a way to reset someone's "sleep schedule" as if they had slept

#

My intentions are to prevent spawning phantoms

hexed hatch
#

Player#somethingsomething with insomnia

#

but that's unnecessary iirc

#

because you can just use /gamerule doInsomnia false

tranquil viper
#

I want to make an easy to use plugin that anyone can use

hexed hatch
#

anyone can run that command

#

but

#

if it were per-player

tranquil viper
#

It is

#

That's what I mean

hexed hatch
#

then yeah, just modify the player's insomnia value

tranquil viper
#

Cool thank you!

#

Odd.

tranquil viper
hexed hatch
#

Strange

#

It seems it isn't wrapped by the api

delicate lynx
#

there is HumanEntity#getSleepTicks

#

idk if that is the thing you want

tranquil viper
#

Could be

delicate lynx
#

might have to do NMS for this to set their sleep ticks

tranquil viper
#

I found a plugin called "SoloSleep" I'm just going to decompile and see what it uses

#

ah, it's player.setStatistic(Statistic.TIME_SINCE_REST, 0)

vagrant stratus
#

Feel like I'm missing something lol
depend: [Core] and the dependency is definitely called Core

hexed hatch
#

So I'm trying to make a plugin that adds in the armor stand posing behavior from Bedrock Minecraft. In Bedrock, the player shift right clicks an armor stand to change it's pose, and it kind of cycles through in a order

hexed hatch
#

I'm struggling to figure out how to set up that order in my plugin

vagrant stratus
hexed hatch
#

Like, let's say I have pose A, B, C and D

#

If the armor stand is on pose B, what would be a good way to determine what's next?

tranquil viper
vagrant stratus
tranquil viper
#

Send your pom

tranquil viper
delicate lynx
#

try to forceload it before?

vagrant stratus
#

Pom's not needed in this case, the issue afaik is that it's either 1) Not detecting the depend or 2) I fucked something up somehow
The pom dependency anyways is

        <dependency>
            <groupId>optic_fusion1</groupId>
            <artifactId>Core</artifactId>
            <version>0.5.0</version>
            <scope>provided</scope>
        </dependency>
vagrant stratus
kind hatch
tranquil viper
#

try adding

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

to your pom

delicate lynx
#

is the plugin.yml name also just Core?

vagrant stratus
#

I don't see how that'll help @tranquil viper

vagrant stratus
delicate lynx
#

shading it in will not help

tranquil viper
#

Everytime I get a class not found exception I shade it and it works

hexed hatch
delicate lynx
#

do you want Core to load before or after

vagrant stratus
#

Before, seeing as the plugin in question uses functionality from said plugin

hexed hatch
#

Wow I actually cannot communicate this properly

kind hatch
delicate lynx
#

yeah I answered my own question

tranquil viper
vagrant stratus
#

Required dependency.

tranquil viper
#

then add it as a depend

vagrant stratus
#

I did lol

tranquil viper
#

odd

vagrant stratus
#

That's why I'm confused, it should be working as intended

delicate lynx
#

maybe try to use loadbefore on Core? kinda hacky

vagrant stratus
#

No, then I'd have to update that every time a plugin uses the Core plugin as a dependency lol

hexed hatch
#

Like, if it's on a pose named "bob", with what data structure could I check to see what comes after "bob" in a sensible way

#

I'm not sure if that makes any sense whatsoever

#

I may be approaching this wrong by using name to identify it, but I'm not using numbers because poses can be loaded/unloaded at any time basically

kind hatch
#

Well using strings for the poses may not be ideal. Since there could be any number of ways to order them.
Alphabetically, Longest name first, Shortest name first, etc

I'd recommend using numbers instead, but a list should preserve the order regardless. I don't think there would be any issue with them even if they can be randomly assigned/chosen.

kind hatch
# kind hatch Well using strings for the poses may not be ideal. Since there could be any numb...

I mean, I do have a method for getting the next string in a list, but it works off of the order of the list itself.

public String getNext(String element) {
    int index = myList.indexOf(element);
    if (index < 0 || index + 1 == myList.size()) {
      return myList.get(0);
    }
    return myList.get(index + 1);
}

public String getPrevious(String uid) {
    int index = myList.indexOf(uid);
    if (index <= 0) return myList.get(myList.size() - 1);
    return myList.get(index - 1);
}
hexed hatch
#

That seems to be exactly what I need, or at least what I thought I needed

#

but I kind of realize now I should just refer to the pose as a number in the PDC and just increment it

#

because even if the current pose was removed, it'll just go to the next one without issue

#

I appreciate the help

kind hatch
#

Will these poses be customizable by the end user?

hexed hatch
#

No, or at least not in the first version

#

it's intended to replicate the behavior in bedrock edition for changing poses

#

a set of curated poses you can just swap through by shift right clicking the armor stand

kind hatch
#

Ah, well if you want to let users add more, then use the methods above. Otherwise, you could just cycle through an Enum. Here's an example from one of my projects.

private static final ParticleQuality[] values = values();

public ParticleQuality getNext() {
  return values[(this.ordinal() + 1) % values.length];
}

public ParticleQuality getPrevious() {
  if (this.ordinal() == 0) {
    return values[values.length - 1];
  }

  return values[(this.ordinal() - 1) % values.length];
}
hexed hatch
#

I'll be honest in that my understanding of enums is limited, but wouldn't a enum approach not allow for data driven poses?

kind hatch
#

Yes. If its data driven, then don't use an Enum. It's just that if you are only wanting a fixed amount of poses, using an enum might be easier.

hexed hatch
#

the poses will be loaded from a yml file

#

When I said curated, I mean curated by the server owner and not the plugin itself

#

but players on the server, as of now at least, won't be able to design poses

kind hatch
#

Gotcha, then the previous methods should work just fine. You may need to adapt them a little, but they make it so that the list will rollover.

#

So that you can go from the last pose directly to the first pose or vice versa.

hexed hatch
#

Wonderful, that's exactly what I need

#

I appreciate your help

vagrant stratus
#

Fixed my issue, no clue what fixed it though lol

supple basin
#

Is it possible to call an event (InventoryClickEvent), inside itself ? I need to change the clicktype and make the other plugins identify it.

eternal oxide
#

You can execute any event you want, but it's unexpected behaviour, so there is no guarantee all plugins will understand it

frail spire
#

hoe can i get blocktype in str from event.getBlock()

delicate lynx
#

getType

frail spire
delicate lynx
#

call it on the block

frail spire
delicate lynx
#

call toString()

#

this is pretty basic java

frail spire
quaint mantle
#
Block playerHead = b.getLocation().add(0, 1, 0).getBlock();
playerHead.setType(Material.PLAYER_HEAD);

Skull head = (Skull) playerHead.getState();
head.setOwningPlayer(Objects.requireNonNull(Bukkit.getServer().getPlayer(skullIdent)));
head.update();
#

Is there a reason my head isnt updating?

#

Skull ID: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2JmMDdhODcyYmJjOTg1YTZmMWE1YTI4M2IzYTZmNjVmMjgzZjM0YjEyZjE0NTY5MWZkOTQwYTVkZTNkNGExMiJ9fX0=

wet breach
#

maybe its defective ๐Ÿ™‚

quaint mantle
wet breach
#

well, that usually invovles separating the head from the body and putting a new one on

#

however, modern medicine hasn't gotten to the point of being able to successfully do that so that may not solve your problem

#

so we could go with the next best thing, we could just reboot it

quaint mantle
wet breach
#

so the reason the skull is probably not updating is if the player is not on the server

#

if that is the case due to the methods you are using, wouldn't cause it to update

#

I was messing with you earlier to see how long it would take for you to realize I wasn't referring to MC ๐Ÿ˜›

quaint mantle
#

and modern medicine

#

lmfao

frail spire
#

Anything wrong with this structure

#

Spigot keep saying class not found

winged lark
quaint mantle
eternal oxide
#

his structure is fine as he's not using any build tool

eternal oxide
undone axleBOT
quaint mantle
eternal oxide
#

did you actually build your plugin? The error says Cannot find main class ga.darren.darrenmc

eternal oxide
#

It found the plugin.yml in your jar but no actual java classes

eternal oxide
#

look inside the ga.darren folder in the jar

quaint mantle
#

Open that folder

eternal oxide
#

then fix the path in your plugin.yml to the correct place

frail spire
eternal oxide
#

if you have a class file there, yes

#

BTW class names should start with a capitol letter

eternal oxide
#

I guess I'm correcting your methodology so you correcting my spelling is ok

frail spire
#

Should I try loading it now?

eternal oxide
#

if you fixed your plugin.yml, yes

frail spire
eternal oxide
#

My guess looking at a mobile screen I'd say its disabled

#

So find the startup error

frail spire
chrome beacon
chrome beacon
#

Yes

eternal oxide
#

Add the api version entry in your plugin.yml

frail spire
eternal oxide
#

the lowest Spigot version you want it able to run on

eternal oxide
#

1.13 is the lowest you can specify

#

ok so 1.16

frail spire
eternal oxide
#

yes

frail spire
#

I got it

#

Working

kindred valley
#

How can i prevent a player to execute a command while he is already in a scheduled command

crisp steeple
#

what is a "scheduled command"

kindred valley
broken orchid
#

You are looking for free hosting

dark arrow
#

is it possible to make a recipe which will work on throwing items on ground?

frail spire
#

Works alr lol

dark arrow
#

i trying to create a recipe which will work on throwing specipic items in a cauldron and then a lightning will summon and player will get the output of the recipe

urban kernel
#

i'm adding config files to my bungee plugin, do you know where i should put config.yml?

dark arrow
#
public void onDrop(PlayerDropItemEvent event){
        Player player =event.getPlayer();
        Item item = event.getItemDrop();
        if(event.getItemDrop().equals(Material.DIAMOND)){
           player.sendMessage("Why are you so noob");
           player.sendMessage("Get nethrite");
           player.getWorld().spawnEntity(player.getLocation(), EntityType.LIGHTNING);
        }
    }

This code is suppose to summon lightining if we throw diamond on ground but thats does not happens and no console error

quaint mantle
#

did you forget @EventHandler ?

dark arrow
#

nope

quaint mantle
#

the event is registred ?

dark arrow
#

?

quaint mantle
#

event.getItemDrop() return an Item, not an Itemstack

dark arrow
#

yah buat atleast it should send the message

wet breach
#

you need to change the comparison

golden kelp
#

Yes

wet breach
#
event.getItemDrop().equals(Material.DIAMOND)

needs to be

event.getItemDrop() == Material.DIAMOND
golden kelp
#

Enums & Primitives using ==
Objects using #equals(foo)

wet breach
#

well

#

they can append getType

#

for the comparison

dark arrow
#

THanks It worked

#

one more thing is that possible for multiple items?

wet breach
#

so in a way it already does it for multiple items

dark arrow
#

i mean if i throw diamond and diamond block both then

#

the code i wrote earlier instantly summons lighning

#

on one item

#

and player wont get the chance to throw another

kindred valley
eternal oxide
#

You are not explaining a "scheduled command"

crude loom
#

How do I make a player face a block?

kindred valley
eternal oxide
#

Well, two people have now asked you what you mean by a "scheduled command" as no one understands what you are asking

kindred valley
#

Scheduled command

eternal oxide
#

No one here understands what a "scheduled command" even is

kindred valley
#

When you enter a command

safe notch
#

How is a command suppose to keep running lmao

modern vigil
#

Oh i see

kindred valley
#

ฤฐt repeats for 20 seconds

rough drift
#

command with cooldown

modern vigil
#

Do you mean that the one command blocks other commands from running while it is activve

safe notch
#

make a hash map and store command cooldown

modern vigil
#

roihgeroi what am i saying

#

oih nv

#

r/ihadastroke

kindred valley
modern vigil
#

like that the command is a single thread

crimson terrace
#

a simple boolean could work

kindred valley
#

How to use it

modern vigil
#

once a command gets used

#

the plugin waits for that command to complete

#

then other commands can run

#

basically a blocking thread

eternal oxide
#

ok so nothing to do with any scheduling, just a cooldown

modern vigil
#

kinda like async/await

eternal oxide
#

Do you mean you don;t want ANY commands run, or just not YOUR commands to run?

safe notch
eternal oxide
#

ie, they run one of yoru commands and they are then blocked for x minutes from using that same command

rough drift
#
private final HashMap<UUID, Long> cooldowns = new HashMap<>();

public Long getCooldown(UUID id) {
  return cooldowns.contains(id) ? cooldowns.get(id) : -1;
}

public void resetCooldown(UUID id) {
  cooldowns.put(id, 0);
}

public void setCooldown(UUID id, long cooldown) {
  cooldowns.put(id, cooldown);
}
// in command method
if(getCooldown(player.getUniqueId()) - System.currentTimeMillis() > 0) return;
resetCooldown(player.getUniqueId());

// stuff

setCooldown(id, 500); // half a second of delay
#

example

dark arrow
#

is there anyway to do floor crafting ? or is there any api for it?

rough drift
#
public class MyPlugin extends JavaPlugin {
  private final HashMap<UUID, Long> cooldowns = new HashMap<>();

  @Override
  public void onEnable() {
    // Your stuff
    getCommand("mycommand").setExecutor(new MyCommand());
  }

  public Long getCooldown(UUID id) {
    return cooldowns.contains(id) ? cooldowns.get(id) : -1;
  }

  public void resetCooldown(UUID id) {
    cooldowns.put(id, 0);
  }

  public void setCooldown(UUID id, long cooldown) {
    cooldowns.put(id, cooldown);
  }

  // Do this as a convenience method
  public static MyPlugin getInstance() {
    return JavaPlugin.getPlugin(MyPlugin.class);
  }
}
public class MyCommand implements CommandExecutor {
   @Override
   public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
      MyPlugin plugin = MyPlugin.getInstance(); // Too lazy to type dependency injection in discord
      long timeRemaining = plugin.getCooldown(player.getUniqueId()) - System.currentTimeMillis();
      if(timeRemaining > 0) {
        sender.sendMessage("You need to wait " + (timeRemaining / 1000) + " more second(s)!");
        return;
      }
      plugin.resetCooldown(player.getUniqueId());

      sender.sendMessage("Heyo");

      plugin.setCooldown(id, 500); // half a second of delay
   }
}
#

@modern vigil

modern vigil
#

?

dark arrow
#

is it possible to make floor crafting?

golden kelp
#

wdym

dark arrow
#

crafting by throwing items in floor

small current
#

to face a block

dark arrow
golden kelp