#development

1 messages Β· Page 133 of 1

lyric gyro
#

well then find your own per-version workarounds lol

#

but the old stuff works perfectly fine

shell moon
lyric gyro
#

Just so you know, deprecated does not mean "it will be removed eventually" (unless documented as such), it means "you shouldn't be using this, consider using this other, better alternative instead"

formal crane
#

is this the correct import for nms? compileOnly 'org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT'

lyric gyro
#

looks about right

formal crane
#

When i try it just doesnt work

#

cant find why

lyric gyro
#

did you run buildtools for 1.12.2?

formal crane
#

is that required?

mental cypress
#

Yes

lyric gyro
#

for internals yes

formal crane
#

not sure

lyric gyro
#

well I am

formal crane
#

i have this folder

#

from a few months ago

mental cypress
#

You have to run BuildTools for the version of NMS you're trying to access.

#

So you'll need to run it for ver 1.12.2.

formal crane
#

gonna lookup the exact command for a sec

mental cypress
#

java -jar buildtoolsjarfile.jar --rev 1.12.2

formal crane
#

oh ty

mental cypress
#

Replace the jar name with whatever it's called in your folder.

formal crane
#

its building

#

do i need to do anything else after building?

mental cypress
#

I typically restart my IDE, but that's personal preference.

formal crane
#

I restarted my ide but it gives an error at net.minecraft (the imports)

mental cypress
#

refresh gradle dependencies

#

Also do you have mavenLocal() in your repos for the build file?

formal crane
mental cypress
#

πŸ‘

hoary scarab
#

I'm attempting to get the pitch of an location towards the player
float pitch = nextDistance.toVector().subtract(p.getLocation().toVector()).toLocation(p.getWorld()).getPitch();
But it always returns 0.0... Is there another way to calc the pitch needed?

sterile hinge
#

Well that’s not a way to calculate the pitch

hoary scarab
#

I figured it out.

Vector lineToPlayer = nextDistance.toVector().subtract(p.getEyeLocation().toVector());
Location lineTowardsPlayer = nextDistance.clone().setDirection(lineToPlayer);
float pitch = lineTowardsPlayer.getPitch();
wintry shadow
#

yo, I made a plugin in 1.16.5, we change the server version to 1.12.2, if I just change the spigot.jar it will work ? I don't use anything specific to spigot 1.16.5

mental cypress
#

Theoretically yes.

queen plank
#

How do transform a head ID (like this eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTk4ZGY0MmY0NzdmMjEzZmY1ZTlkN2ZhNWE0Y2M0YTY5ZjIwZDljZWYyYjkwYzRhZTRmMjliZDE3Mjg3YjUifX19) into an item stack? I want to be able to get a head from a site like this: https://minecraft-heads.com/custom-heads/decoration/51584-easter-basket and take the ID, enter it as a string and get the item stack.

mental cypress
rigid mountain
lyric gyro
#

MalformedJsonException
malformed JSON at line 1 column 1 path $

#

what are you doing exactly? might as well show some code

rigid mountain
#

So, im converting a Object to json to store in Redis and mongo. This is where im saving it rn, i plan to mve it later.

        Gson gson = new Gson();
        String json = gson.toJson(game).trim();;

        Pipeline pipeline = Main.jedis.pipelined();
        pipeline.set(game.getId(), json);
        pipeline.sync();

        collection.insertOne(Document.parse(json));

    }```

This is the game object https://paste.helpch.at/uyigakihil.java
#

I dont convert back from json yet

lyric gyro
#

can you show the lobby class

rigid mountain
lyric gyro
#

I don't think this is valid nowadays wc.generatorSettings("2;0;1;");

#

and by that I mean it isn't, lol

rigid mountain
#

Im in 1.8 sorry i ment to mention that

lyric gyro
#

[paper-1.18.1.jar:git-Paper-85]

rigid mountain
#

OHHHH

#

lollll

lyric gyro
#

and trying to run it on a newer version, yeah that's not going to work

#

:d

rigid mountain
#

I see, i uploaded some different files to the server. Forgot its on a different version, my bad. Thank you lol

dusky harness
#

oh shoot thats mc doing the json πŸ₯²

#

just realized

dense drift
rigid mountain
#

How can i remove all of the messages from mongodb?

#

The ones it spams in console

formal crane
#

Is it possible to get the texture of the head from a player?

slim vortex
formal crane
#

How do i open a door with nms? i cant find it

shell moon
#

Can you compile latest HikariCP version using java8? (to support 1.8.8+)

lyric gyro
#

have you considered using an older version of HCP?

shell moon
#

Currently using 4.0.3

#

but seems to have some issues related to

#

x_isolation or something like that

#

when using MySQL 8.x

#

iirc

#

hence why i ask if someone used it in java8

#

java.sql.SQLException: Unknown system variable 'tx_isolation'

rugged yacht
#

How to fix this in deluxe menus saying menu tittle for (menu) is not present

proud pebble
slow folio
#

Quesiton

#

Question*

#

I need opinions

#

What do you think is the best method to go for when trying to display a floating item/block but not being able to be picked up?

First Method: Spawn an invisible armor stand with a block with direction and other data values

Second Method: Same as first method but using packets

rugged yacht
round sail
#

skip the extra armor stands and packets

slow folio
#

I went with the packets and are working flawlessly

#

I went with Protocol lib though

proud pebble
#

i believe packets is the best way.

round sail
round sail
#

There's even a simpler solution to my simple solution.

slow folio
#

I want it to bend and transform in different ways

#

rotation values

#

etc

#

although I ran into another problem

#

I'm unsure how to set a entity's main hand slot

#

with packets of course

#

using protocol lib

#
PacketContainer itemSlotPacket = new PacketContainer(PacketType.Play.Server.SET_SLOT);
        itemSlotPacket.getByteArrays().write(0, new byte[]{0});
lyric gyro
slow folio
slow folio
#

Hmm weird

#

No field with type net.minecraft.world.entity.EnumItemSlot exists in class PacketPlayOutEntityEquipment

thorn cape
#

So I'm reading the documentation for the PotionSplashEvent. How would I modify the effected entities since getAffectedEntites() returns an copy list and not the original?

Figured it out lol

slow folio
#

was going to bed

#

fixed now

#

πŸ™‚

#

they recently updated protocol lib and changed the format of the packet

#

which i was unsure how to use and nobody had it online

#

^ why got that error

quasi wigeon
#

Is it possible to completely remove the hitbox of an invisible armor stand? Maybe with packets or idk?

brittle thunder
#

What are you trying to achieve?

quasi wigeon
#

Literally what I said, also I found the setMarker method

edgy wedge
spiral prairie
rigid mountain
#

Question, so i have a list of objects and inside each of those objects they store an integer, how can i sort that list by highest to lowest bassed on those integers?

wheat carbon
#

implement Comparable<T> & compareTo in your object

#

then call Collections.sort on your list

rigid mountain
#

Ok thank you

lyric gyro
uneven lanternBOT
#
default void sort(Comparator c)
throws ClassCastException, IllegalArgumentException, UnsupportedOperationException```
Description:

Sorts this list according to the order induced by the specified Comparator. The sort is stable : this method must not reorder equal elements.

All elements in this list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list).

If the specified comparator is null then all elements in this list must implement the Comparable interface and the elements' natural ordering should be used.

This list must be modifiable, but need not be resizable.

Since:

1.8

Parameters:

c - the Comparator used to compare list elements. A null value indicates that the elements' natural ordering should be used

Throws:

ClassCastException - if the list contains elements that are not mutually comparable using the specified comparator
IllegalArgumentException - (optional) if the comparator is found to violate the Comparator contract
UnsupportedOperationException - if the list's list-iterator does not support the set operation

lyric gyro
#

πŸ‘€

wheat carbon
#

is that preferred

lyric gyro
#

I don't know if there's any difference but it exists

wheat carbon
#

I wasn't thinking any functional difference

#

more so design wise

#

holding comparison/ordering logic in the object versus not holding it in the object

#

in the event two lists of the same type need to be ordered differently

lyric gyro
#

well you can throw different comparators at each's sort method

#

idk it's kinda bleh, idrm

#

it's not like I'm sorting lists every day lol

wheat carbon
#

@rigid mountain alternative above ^

rigid mountain
#

ok thank you

wintry grove
#

everything is there

#

I'm using LWJGL

wheat carbon
#

so l24 isn't working?

wintry grove
#

indeed

#

also sorry forgot to add the other method

wheat carbon
#

yeah no clue ngl

#

looks like it should work

formal crane
wheat carbon
#

how is gamescreen getting initialized?

wheat carbon
wintry grove
#

on the last line of the init method

#

it calls this method

public void changeScreen(Screen screen) {
        currentScreen = screen;

    }
#

and the currentScreen thing is an instance of screen

wheat carbon
#

where does the actual instance of GameScreen come from

#

how is it made

wintry grove
#
changeScreen(new GameScreen());
#

like this

wheat carbon
#

yep

#

no clue

wintry grove
#

even on the guide I'm seeing it does work

#

exactly like that

hoary scarab
#

Debug everything lol

wintry grove
#

ah thats pain

cursive wigeon
#

There is Deluxemenu for 1.8.9?

hoary scarab
wintry grove
#

wait

#

I think ik where it copies it

#

so if the floats get initialized in the Window constructor

#

will that affect it?

wraith scarab
#

hi i'm trying to use this event in my 1.18.1 code but its don't work any explanation pls :
"BlockDamageAbortEvent"
Error : "Plugin ClickerGame v0.0.1 has failed to register events for class unnaincompris.clickergame.BlockInteract because org/bukkit/event/block/BlockDamageAbortEvent does not exist."

broken elbow
#

it says that the BlockDamageAbortEvent event doesn't exist. so maybe it wasn't added on the version your server is in?

wintry grove
lyric gyro
#

The Window.getWindow().r/g/b?

wintry grove
#

yes

#

the getWindow method returns an instance of the WIndow class

#

which takes as parameter the height and width, and the name

#

on the constructor

lyric gyro
#

does this print the updated values?
System.out.println(Window.getWindow().r + " " + Window.getWindow().g + " " + Window.getWindow().b);

wintry grove
#

nope

#

if I do it on the window class it doesnt

#

havent tested on the other class

#

a sec

lyric gyro
#

care to share the Window class?

#

also is any of this changed async?

wintry grove
#

I dont think

#

and sure give me a sec

wintry grove
lyric gyro
#

but that change isn't reflected elsewhere?

#

tf

wintry grove
#

apparently nope

#

yeah its fucking weird

#

somehow it is copying the values to the class were they are accesed

lyric gyro
#

try making those fields volatile

wintry grove
#

alright

#

nope

#

doesnt work

lyric gyro
#

well i'm all out of ideas lol

wintry grove
#

pain

#

I surrender lmao

#

I do not know what to do

lyric gyro
#

I'd say make the Window constructor private so you ensure you aren't creating new instances and always using the singleton instead

#

But other than that, attach a debugger

wintry grove
#

alright

#

I have the debugger on now but in what will that help actually?

#

havent used it yet

lyric gyro
#

place breakpoints, step through each bit, list a class's instances and references etc

wintry grove
#

oh alright

lyric gyro
#

IJ's debugger is really damn nice and powerful

worn jasper
#

Uhm, how can I check if my inventory can receive an itemstack?

#

I could check for empty slots

#

but I also want to count slots that also have like idk, 43 items of that itemstack

#

since there's still space there too

proud pebble
#

usually i just try to add the itemstack to the inventory, and check if the return of that method is empty

worn jasper
#

wdym?

proud pebble
#

cause addItem(ItemStack) returns a map of what couldnt be added

worn jasper
#

and how can I get that map?

proud pebble
#

addItem(ItemStack)?

#

addItem().isEmpty() thats what i do

#

tho its not a perfect method really

formal crane
lyric gyro
#

you set the datasource class as driver class in hikari

#

setDriverClassName("org.sqlite.SQLiteDataSource");

worn jasper
#

This might the stupidest question ever

#

lol

#

now that I think about it

proud pebble
#

depends on if its able to

dense drift
#

its are added, obvious

worn jasper
#

so it gets added and returns something

#

okay

proud pebble
#

it returns either an empty map or a map with itemstacks that werent able to be added, with their stack size adjusted if some were added

dense drift
#

d;spigot Inventory#addItem

uneven lanternBOT
#
@NotNull
HashMap<Integer,ItemStack> addItem(@NotNull ItemStack... items)
throws IllegalArgumentException```
Description:

Stores the given ItemStacks in the inventory. This will try to fill existing stacks and empty slots as well as it can.

The returned HashMap contains what it couldn't store, where the key is the index of the parameter, and the value is the ItemStack at that index of the varargs parameter. If all items are stored, it will return an empty HashMap.

If you pass in ItemStacks which exceed the maximum stack size for the Material, first they will be added to partial stacks where Material.getMaxStackSize() is not exceeded, up to Material.getMaxStackSize(). When there are no partial stacks left stacks will be split on Inventory.getMaxStackSize() allowing you to exceed the maximum stack size for that material.

It is known that in some implementations this method will also set the inputted argument amount to the number of that item not placed in slots.

Parameters:

items - The ItemStacks to add

Throws:

IllegalArgumentException - if items or any element in it is null

Returns:

A HashMap containing items that didn't fit.

formal crane
lyric gyro
#

I know, you're setting the datasource as driver

#

that is wrong

formal crane
#

oh

lyric gyro
#

you set the driver as driver, not the datasource as driver

formal crane
#

so i should create a second variable for driver?

lyric gyro
#

change the string you're passing to the sqlite driver class name

formal crane
#

to?

lyric gyro
#

the sqlite driver class name

#

according to google search results it's org.sqlite.JDBC

torpid raft
#

the more i work with sqlite the weirder i find it to be

formal crane
#

one weird thing tho

#

the server keeps crashing

#

because of the database

lyric gyro
#

don't run database operations sync, run them on an async task through the scheduler

formal crane
#

it crashes when i use the database to much orsm,
Main:

private Database data;`

@Override
public void onEnable() {
    this.data = new Database();
    data.connect();
    data.createTable();
}

public Database getData() {
    return this.data;
}

How i get it in other classes:
Database data = rsRugzakken.getInstance().getData();

lyric gyro
#

it crashes because you're running sql operations on the main server thread and it's hanging there trying to wait for something to complete, so the entire server is waiting for you to complete your operation

lyric gyro
#

bukkit scheduler

formal crane
#

like this?

            @Override
            public void run() {
                data = new Database();
                data.connect();
                data.createTable();
            }
        });
lyric gyro
#

well not in onEnable, in your listener

formal crane
#

oh

lyric gyro
#

that stack trace above is coming from onInventoryClose

formal crane
#

so like this then

            @Override
            public void run() {
                Database data = rsRugzakken.getInstance().getData();
                String base64ItemStack = Util.toBase64(e.getInventory());

                data.setItems(uuid, base64ItemStack);
            }
        });```
lyric gyro
#

looks okay

formal crane
#

doesnt look like its crashing, ty

#

it does seem to be spamming this sometimes:

[22:21:38 WARN]:        at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:696)
[22:21:38 WARN]:        at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:181)
[22:21:38 WARN]:        at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:146)
[22:21:38 WARN]:        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128)
[22:21:38 WARN]:        at be.razerstorm.rsrugzakken.utils.storage.Database.getItems(Database.java:73)
[22:21:38 WARN]:        at be.razerstorm.rsrugzakken.menus.RugzakGUI$1.run(RugzakGUI.java:46)
[22:21:38 WARN]:        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:64)
[22:21:38 WARN]:        at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52)
[22:21:38 WARN]:        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
[22:21:38 WARN]:        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[22:21:38 WARN]:        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[22:21:38 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)
>```
queen plank
#

I was trying some stuff with my plugin, and got this error: https://paste.helpch.at/mujiyolemo.bash. My server just instantly crashed. It is not mentioning my plugin, so any idea what might have caused it?

mental cypress
#

Did you do something with an inventory and setting an itemstack to air / null?

queen plank
#

I did yeah

#

I'm pretty sure this is the line that is killing my server user.getInventory().setItem(storage.getSlot(), new ItemStack(Material.AIR));. I've worked with this plugin for months though and I've never had any trouble with it. It just now decided to start killing my server for some reason when I use it.

mortal timber
#

Is there a way in 1.18 to get a material from the ID?

lyric gyro
#

Registry.MATERIAL.get(NamespacedKey.fromString("iron_sword")) (also works for the namespaced versions like minecraft:iron_sword)

formal crane
#

i have an item and everytime i click on it it gets a string from the database, why does it after only like 3 clicks (in a row) start to spam errors etc

lyric gyro
#

what does the error say

formal crane
#

(it spams that error)

lyric gyro
#

can you send your Database class to see how you're actually handling the queries?

mortal timber
lyric gyro
#

those no longer exist since 1.13

mortal timber
#

ok

lyric gyro
#

like what "number" would spruce_sign be? it was added in 1.14, the id is minecraft:spruce_sign

mortal timber
#

I do not know

lyric gyro
raven estuary
#

Hey guys who can help me,
Hacker hack my primary account and he buy nitros and doing what he want how I fix that

#

Plz help me

lyric gyro
#

?not-discord

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

lyric gyro
#

@raven estuary read that carefully ^

raven estuary
lyric gyro
#

This is not discord support

#

This is a Minecraft help server

hoary scarab
#

I'm surprised more people come in here thinking it's an official discord support server then an official minecraft server lol.

lyric gyro
# formal crane sure, https://paste.helpch.at/ihunihawof.java

Okay yeah you need to close your connections/statements/result sets, not closing those will lead to deadlocks/thread deaths/memory leaks/other kinds of stuff, you can close them like so

try (
  Connection connection = hikari.getConnection();
  PreparedStatement statement = connection.prepareStatement("blah blah ?")
) {
  statement.setString(1, "blah");
  try (ResultSet rs = statement.executeQuery()) {
    rs.next() whatever
  }
}

the try (thing = thing()) is called a "try with resources", it automatically closes the declared "resources" when it exits the try block. https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

#

+1 on using prepared statements tho, lol

formal crane
#

so i just add

    rs.next() whatever
  }``` at every method that uses statements etc?
lyric gyro
#

for all connection, statements and result sets usage, yes

#

it's possible that it's left waiting until a new connection is available before it can do anything next, but since they aren't being closed it's hanging there indefinitely

formal crane
lyric gyro
#

with the hikari.getConnection() you mean? yes

#

I mean hikari will do its own stuff under the hood too but it needs to be "signaled" when you're done using a connection

formal crane
#

i tried adding it in the createTable but i get this error

lyric gyro
#

well in that case you don't need a result set, just put the statement in the try-with-resources thing instead (alongside the connection too) and call execute then

#
try (
  Connection conn = hikari.getConnection();
  Statement statement = connection.createStatement();
) {
  statement.execute("create table blah blah");
}
tight junco
#

You'll typically use PreparedStatement#executeQuery when requesting, so when doing SELECT * FROM tableName for example

#

and use PreparedStatement#executeUpdate or PreparedStatement#execute when modifying the table

#

although im not entirely sure what the difference is between execute and execute update

lyric gyro
#

execute "may be any kind of SQL statement."
executeUpdate is for "an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement." (whatever that means, just google ig lol) and returns the number of rows affected
executeQuery is for statements that return.. stuff ig, like SELECT

round sail
#

Is there a good widely accepted item NBT library?

#

I liked Matt's GUI frameworks πŸ˜„

surreal lynx
#

d;spigot PersistantDataContainer

uneven lanternBOT
#
public interface PersistentDataContainer```
PersistentDataContainer has 8 methods.
Description:

This interface represents a map like object, capable of storing custom tags in it.

lyric gyro
#

when will someone make an nbt api that uses adventure-nbt πŸ˜”

mental cypress
#

When you make it.

lyric gyro
#

Oh Glare don't tempt me..

mental cypress
#

Do it, you won't.

surreal lynx
#

Never even heard of adventure nbt

round sail
#

I'll use PersistentDataContainer for now as my use case is simple, I was just curious if there were any better alternatives nowadays.

#

Different question that I can't seem to find on any tutorial - is there an equivalent for this.saveDefaultConfig() that can copy a file not named config.yml from the jar into the data folder?

this.saveResource("otherfile.yml", false);

formal crane
lyric gyro
#

^

full wasp
#

hi, i'm trying to show health in tablist (with the heart) but instead of showing real health i want to show custom health (like divide the hearts by 2 so its 5 max)

#

anyone knows how i can do that?

#

i know how to show health in tab

#

but with custom hearts i have no idea

lyric gyro
#

%math_1:1_{player_health} / 2% should probably work

#

make sure to /papi ecloud download Math and /papi reload first tho

full wasp
#

no but i want to render minecraft hearts

winged pebble
#

You probably can't do straight up minecraft hearts, but you might be able to use the heart character

lyric gyro
#

oh wait I just realized this is the development channel lmao

queen plank
inland light
#

Hi, anyone has an idea about why (presumably) VSCode keeps adding aliases to itself in my .zshrc? Thanks.

slim vortex
#

it’s establishing dominance

inland light
#

truly the correct answer

pearl topaz
#

how come

if (sampleRateValue == null || sampleRateValue.asLong() <= 10) {
   // ...
}```gives "Caused by: java.lang.UnsupportedOperationException: Not a number: null at org.hjson.JsonValue.asLong(JsonValue.java:410)". Should it not match the first condition and go into the `if` block anyway?
#
if (sampleRateValue != null && !sampleRateValue.isNull() && sampleRateValue.asLong() > 10) {
  // !...
}
leaden sinew
pearl topaz
#

the problem is that sampleRateValue.isNull() is a separate check to sampleRateValue == null

#

so it was passing the latter

queen plank
#

Is it possible to create a GUI like this Bukkit.createInventory(null, InventoryType.FURNACE); and actually get it to work without using a block?

neon wren
#

Can you explain the goal? When providing the inventory type, it'd allow you to make the GUI look like that @queen plank.

#

To create a normal inventory in rows of you can do Bukkit.createInventory(null, 9, "Inventory Name'); // Multiples of 9, up to 54

queen plank
#

Ok, so I want to be able to click with an item, bring up a GUI, lets say a furnace, and use it. A.k.a a portable furnace. I know I can open the GUI for a placed block, but I want it to be per player, and I can't just have 5000 furnaces placed somewhere.

#

I get a GUI, but the it does not work. I can place items in it, but nothing is smelting

#

I currently just have a furnace backpack lol

neon wren
#

So you'd need to use a InventoryHolder, and use the player's open inventory via a task.

#

Let me make sure the method still exists, one moment.

#

So you'd need to implement a system that keeps track of a furnance's cook progress, burn time, total burn time of the items when it's supposed to be cooking a item.

kind granite
queen plank
pearl topaz
neon wren
#

Here's a plugin from 1.12 that seems to do what you want from a command.

#

It's outdated and may not work on the latest version but it's based on a command, but you may be able to update it to your need.

queen plank
#

I can't use it though lol

neon wren
#

Explain why not?

queen plank
#

This GUI thingy I'm talking about is one of many abilities for my plugin. I'm planning on selling my plugin, not only using it my self. Also, I need it to work for all types of crafting stations

#

:>

neon wren
#

So then you'd need to implement it for what you want.

#

You can't expect everything to be easily be done in coding, as sometimes it takes effort and debugging.

#

You'd also need to implement a data saving system in case the server shuts down, or player leaves.

queen plank
#

I know I know, I was just hoping I would have missed something.

#

I guess I'll get to work then, thank you

neon wren
#

You'd also need to give them xp based on cooking, if it'll be exactly like a regular furnace.

queen plank
#

Yup, IDK how I'll do that yet. But Imma figure something out

#

Thanks again :))

neon wren
#

No problem, feel free to message here if you have any other questions regarding another inventory type etc.

queen plank
#

This prints FURNACE and false for me. Why is this?

Block b = loc.getBlock();
System.out.println(b.getType());
System.out.println(b instanceof InventoryHolder);```
lyric gyro
#

b is a Block, what you want to check is the BlockState (it's what contains the data) which, if the block is a furnace, then it will be a Furnace block state (which extends Container -> BlockInventoryHolder -> InventoryHolder)

queen plank
#

Ahh, I see. Thank you!

surreal lynx
#

Crossposting this to help a friend:

anyone got a clue on a solid way to do timebased checks on a block?
need to come up with a way to mimic vanilla farmlands dryout.

Current idea was to store a PDC on the noteblock like furniture has for barriers
Then use the timer mechanic to set a say 3 second timer on it.
Then every x time check x blocks around for water, if found pog reset, if not change blockstate
thoughts?

dense galleon
#

How can I guarantee a loot table to drop two pools all the time?

#

I am trying to have two pools so that my block drops two different items 100% of the time, but it seems that each pool has a 50% chance of being dropped

surreal lynx
#

Java

round sail
#

The timer mechanic made me think you were doing an mm skill :p

surreal lynx
#

Yeah idk why it was worded like that

lyric gyro
#

can someone tell me way for disable chest opening on creative mode

mental cypress
#

on inventory open event, if its a chest and player is in creative, cancel

lyric gyro
#

can you write me simple code?

mental cypress
#

How would you learn from that then?

#

I'm on my phone anyways

#

InventoryOpenEvent -> if event.getplayer .getgamemode or whatever == gamemode.creative, cancel. Easy to prevent inventory opening in creative.

#

Or if event.getinventory.type == chest? idk the type of the top of my head, && gamemode code above, event.setcanceled true

mortal timber
#

Try with the playerinteractevent

mental cypress
#

That works too but that is fired wayyy more.

lyric gyro
#

tried with this

#

but still not working

mental cypress
#

Did you register the event?

lyric gyro
#

yup

dense drift
#

player#getInventory refers to PlayerInventory aka their own inventory

#

d;spigot Player#getInventory

uneven lanternBOT
#
@NotNull
PlayerInventory getInventory()```
Description:

Get the player's inventory.

Returns:

The inventory of the player, this also contains the armor slots.

lyric gyro
#

so i should replace it?

mental cypress
#

It'd be event get inventory get type

lyric gyro
#

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onInventoryOpen(InventoryOpenEvent event) {
Player player = (Player) event.getPlayer();
if(player.getGameMode() == GameMode.CREATIVE){
if (event.getInventory().getType() == InventoryType.CHEST) {
event.setCancelled(true);
}
}
}

#

still not working

#

idk

charred mason
#

Where is playerConnection field in 1.18?

#

Nvm, found it it's b

lyric gyro
#

If you're using something like plugman or whatever to load your plugin on a live server for the first time, your listener won't register, it needs a full restart

lyric gyro
#

Well what was the issue?

#

not registered the correct event

lyric gyro
#

Lmao

formal crane
#

Does it matter if i write directly to the database or should i create a object for the player and save when the player leaves or the server shuts down?

#

If i save like kills to my database does it matter if i save it every time a player kills or should i only save when the player leaves

#

Alr ty

dense galleon
#

Generally speaking, what's better?

if (squaredDistanceTo(getOwner()) >= 8 * 8 && !isSprinting()) {
    setSprinting(true);
}``` OR
```java
if (squaredDistanceTo(getOwner()) >= 8 * 8) {
    setSprinting(true);
}```
fallen rock
#

Hi can i get any help here ?

#

So silence

dusty frost
#

Do you care if they are sprinting, or do you just always want to make sure they are sprinting when they are within the distance

dense galleon
#

Hence I am wondering whether it's worth checking that sprinting is false before setting it to true or not

dusty frost
#

It comes down to if you care

#

Do you have an alternative path for if they are sprinting? Or does it not matter

#

Especially if it happens often, like on a move event or something, you probably want to have as many checks as possible to avoid running methods you don't need

dense galleon
#

This is in the FabricAPI, but yeah the method runs every tick

dusty frost
#

Sheesh, then yeah you want to check as many things as possible as not running methods is ideal

dense galleon
#

I guess it comes down to which method is "beefier", setSprinting() or isSpriting()

#

But say that isSprinting was as simple as return sprinting; and setSprinting(boolean sprinting) was as simple as this.sprinting = sprinting

#

Is it worth checking isSprinting() every time before doing setSprinting()?

brittle thunder
#

micro optimization, either is fine

#

First one probably is better context for readers

dusty frost
#

could also swap the order around, check the simple isSprinting first to early return, then do the expensive distance calculation

icy shadow
#

distanceSquared is pretty cheap

dusty frost
#

dunno might be expensive

#

could be some spicy square roots or somethin

icy shadow
#

distanceSquared doesn't need a square root lol

#

it's just a^2 + b^2 + c^2

dusty frost
#

you don't know that

#

but that would make sense lmao

icy shadow
#

although yes that's a different method

#

it's entirely possible he's being extremely stupid, but i'm optimistic

wheat carbon
#

is that a javax annotation

icy shadow
#

nope

#

JB

#

javax is NonNull

wheat carbon
#

whoever wrote that is stoopid

icy shadow
#

classic bukkit code

wheat carbon
#

classic bukkit code definitely didn't use jb annotations

icy shadow
#

guess someone added the annotation without removing the check then

pulsar ferry
#

MD added the annotations randomly to places, some that are even wrong

#

Like some NotNull annotated methods are 100% nullable lol

wheat carbon
#

interesting

pulsar ferry
#

d;spigot ItemStack#getItemMeta

uneven lanternBOT
pulsar ferry
#

I guess not this one

icy shadow
#

Yeah some of them are just wrong

lyric gyro
wheat carbon
#

he was saying that brister didn't know it was just "a^2+b^2+c^2"

#

the name may have not been properly descriptive of the logic

#

but then bm posted the actual function and it was that so all g

wheat carbon
#

star assumed that brister's assumption on the logic was based on the naming of the function

#

seeing as bm bolded "squared" in the function name

#

but due to this

the name may have not been properly descriptive of the logic
star replied with "you don't know that"

icy shadow
#

Yeah klyser was technically using a different function for distanceSquared

#

Maybe it's return distance * distance πŸ™ƒ

warm steppe
#

yoy

lyric gyro
icy shadow
#

sqrt(aΒ² + bΒ² + cΒ²) obviously

#

Idiot

terse belfry
#

Calm down

icy shadow
#

no thank you

dusty frost
# icy shadow sqrt(aΒ² + bΒ² + cΒ²) obviously

yeah this is what I thought initially for distance, didn't see the squared part, but now that I think of it, can't you just use distance not square rooted if you just use that everywhere and it's not like in actual relation to the world

#

for like a heuristic or something

#

since it's all relative right

lyric gyro
#

hi can someone help me fix this throw err;
^
SyntaxError: /home/container/config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensio

#

{
"bot": {
"token": "private",
"prefix": "n!",
"testguild": "895560577055883265",
"owner": "845312519001342052"
},
"embed": {
"color": "BLUE",
"footer": "NovaNodes"
},
"panel": {
"panelurl": "private",
"panelname": "Nova",
"panelapikey": "private",
"panelclientapikey": "private"
}

#

index.js?

#

const Discord = require('discord.js');
const { Collection } = require('discord.js');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_MESSAGES'] });

module.exports = client;

const fs = require('fs');
client.categories = fs.readdirSync("./commands/");
client.aliases = new Collection();
client.commands = new Collection();
client.slashCommands = new Collection();
client.config = require("./config.json");

require("./handler")(client);

let db = require("quick.db");

client.userData = new db.table("userData");

client.login(client.config.bot.token);

#

entire error

#

throw err;
^
SyntaxError: /home/container/config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1163:22)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/container/index.js:12:17)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)

#

thats like entire error

#

@rugged bane client.config = require("./config.json");

#

its complaining here

fiery pollen
lyric gyro
fiery pollen
#

to end "panel"

lyric gyro
#

lemme see

#

there is a bracker

fiery pollen
#
    "bot": {
        "token": "private",
        "prefix": "n!",
        "testguild": "895560577055883265",
        "owner": "845312519001342052"
    },
    "embed": {
        "color": "BLUE",
        "footer": "NovaNodes"
    },
    "panel": {
        "panelurl": "private",
        "panelname": "Nova",
        "panelapikey": "private",
        "panelclientapikey": "private"
    }
}```
lyric gyro
#

OH

fiery pollen
#

ye

lyric gyro
#

fixed it but theres an error

fiery pollen
#

send it

lyric gyro
#

/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildApplicationCommandManager.set (/home/container/node_modules/discord.js/src/managers/ApplicationCommandManager.js:146:18)
at async Client.<anonymous> (/home/container/handler/index.js:53:9) {
method: 'put',
path: '/applications/857655637492498462/guilds/895560577055883265/commands',
code: 50001,
httpStatus: 403,
requestData: { json: [], files: [] }

fiery pollen
#

Whats at line 53 in the index file

#

@lyric gyro?

lyric gyro
#

k

#

lemme see

#

maximum lines index has is 23

#

this is line 9

#

client.aliases = new Collection();

#

@fiery pollen

fiery pollen
#

Try this:

You did not select the right permissions when creating bot login link for your discord server.

Goto developers / oauth again, click bot and select all the required permissions that you're using in this bot.

Then copy the link generated and use it to login with your bot into your server.

lyric gyro
#

its administrator

#

@fiery pollen any possible fixes

fiery pollen
#

Have you enabled the intents?

lyric gyro
#

all of them

#

except 0auth advanced

#

i promised everyone its gonna be up in 3 mins

#

i got 2 more left

#

oh no

#

@fiery pollen async set(commands, guildId) {
const data = await this.commandPath({ guildId }).put({
data: commands.map(c => this.constructor.transformCommand(c)),
});
return data.reduce((coll, command) => coll.set(command.id, this._add(command, true, guildId)), new Collection());
} is there anything wrong with this as it complained here too

fiery pollen
#

?

lyric gyro
#

idk why

fiery pollen
#

did it have a error?

#

If so, please send it

lyric gyro
#

its the same one

fiery pollen
#

The only thing i can find if i search on google, it says that you haven't given the bot the right permissions

lyric gyro
#

i gave it admininstrator

#

nothing else

#

its also complaining here

#

await this.queue.wait();
try {
return await this.execute(request);
} finally {
this.queue.shift();
}
}

kind granite
#

define "complaining"

lyric gyro
#

ok

#

define

#

ez

kind granite
#

ok

lyric gyro
#

new error

#

/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)

#

damn

#
      let data;
      try {
        data = await parseResponse(res);
      } catch (err) {
        throw new HTTPError(err.message, err.constructor.name, err.status, request);
      }

      throw new DiscordAPIError(data, res.status, request);
    }

    // Handle 5xx responses
    if (res.status >= 500 && res.status < 600) {
      // Retry the specified number of times for possible serverside issues
      if (request.retries === this.manager.client.options.retryLimit) {
        throw new HTTPError(res.statusText, res.constructor.name, res.status, request);
      }

      request.retries++;
      return this.execute(request);
    }```
kind granite
#

send the rest of the stacktrace

lyric gyro
#

whats that

#

do you know what type of bot it

#

is

#

its a pterodactyl server monitor

#

/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildApplicationCommandManager.set (/home/container/node_modules/discord.js/src/managers/ApplicationCommandManager.js:146:18)
at async Client.<anonymous> (/home/container/handler/index.js:53:9) {
method: 'put',

#

@kind granite

lyric gyro
#

@kind granite theres a new error

kind granite
#

please stop pinging me

#

i am working

lyric gyro
#

shoot

#

wrong person

#

i was supposed to ping my friend

#

so sorry

kind granite
lyric gyro
#

im confused

#

/home/container/node_modules/discord.js/src/rest/RequestHandler.js:355
if (res.status >= 500 && res.status < 600) {
^
SyntaxError: Unexpected token '.'

worn jasper
dusty frost
#

what's on line 20 of ItemManager.java?

worn jasper
#

1s

dense drift
#

I guess you are using paper and have a different version of adventure on your project that the one available on the server?

dusty frost
#

possibly invalid MiniMessage or something, but yeah probably some weird version conflict

worn jasper
dusty frost
#

are you shading Adventure/MiniMessage and if so, did you relocate it?

dense drift
#

you can shade adventure and not use adventure methods from paper

worn jasper
worn jasper
#

may be that

dusty frost
#

yeah if you're not targeting spigot

worn jasper
#

I am not

#

does the version of the adventure-platform-bukkit matter?

#

does it need to be the one from 1.17.1?

broken elbow
#

seems like a miss match of adventure and minimessage versions

worn jasper
#

(version I am using)

dusty frost
#

any reason to use a version behind latest?

#

but yeah you should try and match up your version to the one paper has

#

although I don't even think you need adventure-platform-bukkit because Paper has its own

worn jasper
dusty frost
#

wtf lol

#

i hate people

worn jasper
#

same

worn jasper
dusty frost
#

probably nothing, should just be in paper already

worn jasper
broken elbow
#

I mean same thing as before. there seems to be a missmatch between your minimessage version and your adventure version

worn jasper
#

breh

worn jasper
#

uh what should I put here?

#

(want to relocate minimessage)

dense drift
#

the package of minimessage

#

net.kyori.adventure.text.minimessage or whatever

dusty frost
#

or don't shade it

#

then you don't need to relocate

lyric gyro
#

then there is no minimessage lol

worn jasper
#

^^

dense drift
#

I think star meant to use whats provided by paper

worn jasper
#

has no minimessage

#

only latest has

#

(not using 1.17 by choice)

dense drift
#

If you shade latest mini, you most likely also want to shade latest adventure

worn jasper
#

well I want to shade whichever version was for 1.17.1

#

but no idea which it was

#

cause github got basically "closed"

#

since it got added to paper itself

twilit delta
#

Is tabnine/kite acually good?

wintry grove
#

I would apply for copilot

#

tabnine uses a lot of resources

#

in my experience

twilit delta
#

But does it work well?

#

Is Kite better?

wintry grove
#

copilot does better

#

kite idk what that is

twilit delta
#

k il try copilot thanks

lyric gyro
#

1.17.1 didn't have MM

#

yep

dusty frost
#

oh shit really

#

i thought it did

elfin geode
#

Anyone know where I can find some skins?
For NPC's?

dusty frost
#

oh no it had adventure, not minimessage

mental cypress
#

Stick to 1 channel please.

#

You've asked in 4 now.

formal crane
next pewter
#

I need help

neat pierBOT
#

There is no time to wait! Ask your question @next pewter!

next pewter
#

My discord account got disabled for a mistaken reason

#

this is my alt account

#

I have sent like 3 inqury's and no one has responded

#

its been like a week

odd prawn
#

Well, explain your problem once again

#

I can't guess your alt names defective

neon wren
#

?not-discord

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

lyric gyro
#

heya i don't know where else to send this. but i am running into an issue with my minecraft server. its running on docker and I am able to join the server perfectly fine but my users are not. they get the error "connection refused" with no console output

#

anyone have an idea?

#

Well how are they joining the server? What IP?

#

through my domain

#

i could see if the bare ip works, but that would expose my vps ip

lyric gyro
#

Maybe it didn't propagate yet? How long ago did you set it up?

#

And how was it set up? Through an A record or a SRV record?

#

a record is for play and a srv record

lyric gyro
#

can you maybe show how you set them up?

#

then the play just aims to the bare ip

#

okay are you sure your play IP is set to dns only?

#

because if its proxied it won't work

#

yep it is

#

Yeah I've no idea then πŸ˜› It might have to do with the way you set up docker

#

But I don't have much experience with that as of now so I can't help

#

fixed it

#

dunno how, but it works

#

Oh what was it?

#

If you didn't do anything then that means the IP just didn't propagate yet

lyric gyro
#

🀨

cinder forum
lyric gyro
#
throw err;
^
Error: Could not locate the bindings file. Tried:
 β†’ /home/container/node_modules/better-sqlite3/build/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/build/Release/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/Debug/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/out/Release/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/Release/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/build/default/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/compiled/17.3.0/linux/x64/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
 β†’ /home/container/node_modules/better-sqlite3/lib/binding/node-v102-linux-x64/better_sqlite3.node
    at bindings (/home/container/node_modules/bindings/bindings.js:126:9)
    at new Database (/home/container/node_modules/better-sqlite3/lib/database.js:48:64)
    at Object.<anonymous> (/home/container/node_modules/quick.db/src/index.js:7:15)``` can someone help me with this
somber gale
#

What would be the easiest way to make an EnumSet where certain entries are excluded?
I want to make an EnumSet of Bukkit's EntityType but exclude specific entities from it such as ARMOR_STAND

dense drift
#

EnumSet#copyOf maybe?

somber gale
#

Creates an enum set with the same element type as the specified enum set, initially containing the same elements (if any).

icy shadow
#

yeah theyre mutable

#

mutate them

lyric gyro
#

ew

icy shadow
#

shut up

lyric gyro
#

but yes, EnumSet.allOf and then remove entries to your heart's content

icy shadow
#

^

somber gale
#

mkay

dusty frost
#

does java have a cute like set removal analogy or something

#

like set a - set b

icy shadow
#

removeAll

dusty frost
#

ah

somber gale
#

Other question:
How does a static { behave in a class?
Like when I have some objects - like a list - that I manipulate within the static, will this only happen once (similar to when you do stuff in a constructor and then call the new <object>) or will this stuff happen every time you call any (static) method in the class itself?

dusty frost
#

what you're describing is a static init block, which only happens once, ever

icy shadow
#

specifically it happens when the class is first loaded

#

i believe

dusty frost
#

yeah on first initialization

somber gale
icy shadow
#

wtf

#

just use Collection#removeAll

somber gale
#

Like the blacklist contains a different object

icy shadow
#

yeah why is it

#

make the blacklist an enumset too

somber gale
#

That wouldn't help?

icy shadow
#

?

somber gale
#

Don't you see that ENTITY_TYPES is a List of EntityType?

#

That's why I use a removeIf

icy shadow
#
ENTITY_TYPES = new ArrayList<>(EnumSet.allOf(EntityType.class));
ENTITY_TYPE_BLACKLIST = Sets.newHashSet(EntityType.ARMOR_STAND, etc);
ENTITY_TYPES.removeAll(ENTITY_TYPE_BLACKLIST);
#

also any particular reason for ENTITY_TYPES being a List rather than a Set?

somber gale
#

Primarely the fact that getAllowedEntityTypes returns a List and would break existing stuff

#

And I don't wanna do a stupid stream() there

warm steppe
#

Why is it stupid?

icy shadow
#

although it might

somber gale
#

I would need to change the return type to Set

#

Which isn't List

icy shadow
#

is this public api code?

#

or is it just your project

#

if it's the latter, just change it and the compiler will say if anything breaks

somber gale
#

public

#

According to the IDE is it unused, but you never know if another plugin uses it

icy shadow
#

hm

#

ok

#

you'd need a major version update for that in semver lmao

somber gale
#

Also, I keep the blacklist as a String set, because the API/plugin uses 1.13 version of Spigot and I'm not risking updating the depenency to later on have the plugin break. You never know

#

Guess that'll do for the Set thing:

    public static List<EntityType> getAllowedEntityTypes() {
        return new ArrayList<>(ENTITY_TYPES);
    }
#

And another question again...

If I have this setup here:

private static final Map<String, String> DEFAULT_VALUES = Maps.newHashMap();

private static final CustomObject CUSTOM_OBJECT = new CustomObject("Some", "value", DEFAULT_VALUES);

static {
    DEFAULT_VALUES.put("Some", "value");
}

...would the map be populated first before it is used in the construction of the CustomObject, or would the map be created, followed by the custom object and then the map is populated?

icy shadow
#

uh i dont think so

lyric gyro
#

it runs in the same top-to-bottom order it's written, so it's passed to the constructor before you call .put

icy shadow
#

yeah

#

although it might not matter, depending on what the CustomObject constructor does

#

passing by reference and all

somber gale
#

So I guess I should make a method that returns a created map with the values (i.e. private static final Map<String, String> .... = getPopulatedMap();)

lyric gyro
#

yeah that sounds alright

somber gale
sterile hinge
#

EnumSet will also be faster than a HashSet πŸš€

muted trench
#

Hello gamers!
I need the Entity Animation packet but can't seem to find it in the protocol lib packet listener thingy.

#

Any ideas on how I might be able to listen for this exact packet?

#

Please @ me

past ibex
#

serverbound it's just called ANIMATION

#

clientbound entity animation

molten wagon
#

Is chunk loading buggy in 1.12.2 (ChunkLoadEvent)?

It seams register only spawn chunks. IΒ΄m not so familiar with older minecraft versions (work fine in 1.16 and newer versions (I have not test versions between))

Seams if you are to close to spawn chunk it not trigger ChunkLoadEvent.

broken wave
#

Hi, can i somehow make placeholder update not only when i join ?

tight tide
#

Hello, i have my own plugin with custom placeholder. This is placeholder class: https://pastebin.com/4QGk6FxQ
in main onEnable i have instance of this class with .register() method. On the server with /papi list, i can see that this exist, but when im using this placeholder it doesnt works. It is %name%..

#

someone could help me?

spiral prairie
tight tide
#

never mind i did it, btw thanks for help

tight tide
spiral prairie
#

ok

queen plank
#

What event registers a potion being thrown? I get nothing from PlayerInteractEvent, is it ProjectileLaunchEvent. If so, is it possible to get an ItemStack from the projectile?

dusky harness
#

d;spigot ThrownPotion#getItem

uneven lanternBOT
#
@NotNull
ItemStack getItem()```
Description:

Returns a copy of the ItemStack for this thrown potion.

Altering this copy will not alter the thrown potion directly. If you want to alter the thrown potion, you must use the setItemStack method.

Returns:

A copy of the ItemStack for this thrown potion.

lyric gyro
#

i have a problem with vault πŸ™‚

#

damn

#

that sucks bro

#

what's the matter

#

yeah, its just i cant get the vault_rank to work

#

ah you mean the placeholder

#

yeah

#

yes, ask in that channel

#

i have

#

but nobody have seen it

#

someone will eventually, this isn't the correct channel tho so chances are even lower lmao

#

lmao

pearl topaz
#

if you have a long class definition like

class ArrayMonitor<T>(override val monitorName: String, override val sampleRate: Long, override val platformRedisPool: JedisPool, value: ArrayList<T>?):ArrayList<T>(), Monitor {

should it be formatted like

class ArrayMonitor<T>(
    override val monitorName: String, 
    override val sampleRate: Long, 
    override val platformRedisPool: JedisPool, value: ArrayList<T>?
):ArrayList<T>(), Monitor {
  // ...
}
#
class ArrayMonitor<T>(
    override val monitorName: String,
    override val sampleRate: Long,
    override val platformRedisPool: JedisPool, value: ArrayList<T>?):
    ArrayList<T>(), Monitor {
  // ...
}
bitter basin
#

first

#

i would say

#

but i would also add a space before and after the :

#
class ArrayMonitor<T>(
    override val monitorName: String, 
    override val sampleRate: Long, 
    override val platformRedisPool: JedisPool, value: ArrayList<T>?
) : ArrayList<T>(), Monitor {
  // ...
}
#

thats just me tho

pulsar ferry
#

Convention is first one

lyric gyro
#

How to remove a item + amount from the player's inv, i've used many different codes but it still didn't worked

wintry grove
#

does anyone exactly know how to convert a byte to an int or a string

#

I'm stupid enough to not know how its done or to find anything online

lyric gyro
#

Java?

#

or what

wintry grove
#

yes

#

java

lyric gyro
#

byte b = 123
int i = (int) b
String s = String.valueOf(b)

wintry grove
#

alright ty

warm steppe
rigid niche
#

Hi, I am trying to get a player's tag in DeluxeTags via the API:

String deluxeTag = DeluxeTag.getPlayerDisplayTag(pl);

However, this returns NULL despite the player having a tag.

This also is NULL:

Collection<DeluxeTag> ok = DeluxeTag.getLoadedTags();

Is there any way to fix this? I've got tags in my config file.

broken elbow
pale swallow
#

Guys i need help i can't figure this out. So i'm trying to get a block location but the location z is wrong. I have no idea why.

So i'm creating the new location like this
new Location(location.getWorld(),location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getPitch(), location.getYaw());

Y: 98
X: 111
Z: -85

I get this, but the z should be -48.

Any idea

broken elbow
#

now is it wrong when you get it here location.getBlockZ() or is it wrong after you've created the new location?

pale swallow
broken elbow
#

so if you print location.getBlockZ() you get the correct z?

#

then show us more of the code where you create the location

#

and after it

#

where you print the z

sterile hinge
#

are you sure you're not mutating the location at some point?

broken elbow
#

this is what I'm thinking

worn jasper
#

visual confusion

sterile hinge
#

PlotSquared has its own location class as a large portion of the code does not depend on bukkit

lyric gyro
#

@urban questly

sterile hinge
icy shadow
worn jasper
queen plank
#

How do I spawn a dragon fire ball? Like a regular fire ball but purple?

pulsar ferry
#

Same as fire ball but DragonFireball instead

queen plank
#

Waw, I tried DragonFireBall. I'm stupid

dense drift
#

Since when dragons shoot fireballs?

queen plank
#

Hmm? They have since like 1.9 or smth. The end update, whatever version that was

dense drift
#

Ah ah ah

warm steppe
#

they blow the shit outta you

lyric gyro
#

guys can't import spigot why ?

urban quest
broken elbow
broken elbow
#

and?

lyric gyro
#

"the import org.bukkit cannot resolved"

#

i can't import paper ?

#

"JavaPlugin cannot be resolved to a type" error two

#

yes

#

paper didnt working

lyric gyro
#

bcs i import a paper 1.16.5 and didnt works

#

and i upload spigot 1.16.5

#

works

pulsar ferry
lyric gyro
#

sry my first plugin coding πŸ˜„

broken elbow
#

no. everything built against spigot should work on paper. idk how eclipse works but seems to be related with the library import

lyric gyro
#

okee

#

ty

broken elbow
#

I'd personally recommend you use a build tool like gradle instead but since you're new to this that might take a bit of learning as well

lyric gyro
#

ty

lyric gyro
#

if u know can u give me ?

broken elbow
lyric gyro
#

ty

#

πŸ˜„

wintry grove
#

me suppressing my agony of seeing someone using eclipse

worn jasper
#

on a for loop, how can I loop once, execute code, wait 3 seconds and continue?

#

I actually legit forgot how to do the wait part

#

lmao

dense drift
#

Thread.sleep() πŸ’€

worn jasper
#

.-.

#

wasn't joking

#

it's 2am in my defense

dense drift
#

If you run it on another thread, something similar might be what you are looking for

worn jasper
#

like, by a lot.

#

tps went to like 1.55 haha

lyric gyro
#

import java.awt.Event;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
     public void onEnable() {
         getLogger().info("start");} 
     public void onDisable() {
         getLogger().info("stop");}
     
    @EventHandler     
    public void onJoin(PlayerJoinEvent e) {
          e.setJoinMessage("");
        }
    }
``` idk join messages still working why ?
void orchid
#

You're missing two fundamental parts, first, you haven't registered the listener; second, you haven't implemented Listener in your Main class

broken elbow
#

you need to register the listener. the class you put the event handler in also needs to implement Listener

lyric gyro
#

trying

#

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener{
     public void onEnable() {
         getLogger().info("start");} 
     public void onDisable() {
         getLogger().info("stop");}
     
    @EventHandler    
    public void onJoin(PlayerJoinEvent e) {
    e.setJoinMessage("");

    }
}
``` is this true ?
wintry grove
#

nope

#

well yes but no

#

you need to register the listener

lyric gyro
#

how can i do register the listener

wintry grove
#

getServer().getPluginManager().registerEvents(this, this)

#

d;spigot PluginManager#registerEvents

uneven lanternBOT
#
void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin)```
Description:

Registers all the events in the given listener class

Parameters:

listener - Listener to register
plugin - Plugin to register

wintry grove
#

thats how it works

lyric gyro
#

πŸ˜„

#

where can i write this ?

broken elbow
#

in your enable method

wintry grove
#

anywhere really

#

but commonly used on the enable method

#

and if you use that method outside your plugin class make sure to first get an instance of the plugin class or do Bukkit.getServer() and so

lyric gyro
#

oke i try

wintry grove
#

but only do the other thing if you really need it

#

for small plugins doing it on the enable method is enough

rigid mountain
#

So for some reason im getting this error when trying to upsert with mongodb, https://paste.helpch.at/oyaderopez.cs . I thought it was supposed to insert or update the error seems like its only trying to update.

My code:

craggy zealot
#

hey does anyone know why my block place event dosnt work on my minigame world?

torpid raft
#

that's a block break event

craggy zealot
#

oh i ment the break

#

it works on the lobby but not the game world

torpid raft
#

not sure why that wouldn't work, can you double check where you register your event listener

craggy zealot
#

?? it works oin the main world

torpid raft
#

also on a side note, this brings great pain

Game game = Main.getInstance().getGame(player);
craggy zealot
#

lol

torpid raft
#

when you say 'main world' do you mean an actual separate world like with multiverse, or do you mean a separate spigot server

craggy zealot
#

i cant use img??

torpid raft
#

post in a different channel like off-topic

craggy zealot
#

i cant there

torpid raft
#

ah rip

craggy zealot
#

well you get it

#

the main world like where the plugin folders are

#

C:\Users\emmac\Desktop\SkyWiz Server\plugins\SkyWiz\maps

torpid raft
#

sure

craggy zealot
#

C:\Users\emmac\Desktop\SkyWiz Server\world

torpid raft
#

yep

craggy zealot
#

main world

torpid raft
#

right

craggy zealot
#

idk if you get it

torpid raft
#

the game world is inside the plugins folder?

craggy zealot
#

yes

torpid raft
#

very weird but okay

#

so i'm assuming you only have one spigot server, and both of the worlds are inside the same server

craggy zealot
#

no but it creates a active world

#

it copys the map world and creates a active world

torpid raft
#

ah okay

craggy zealot
torpid raft
#

yeah i have no idea why your listener would only work on the main world

craggy zealot
#

damn

#

than kyou so much

torpid raft
#

your best bet is to temporarily comment out any random stuff that isn't related to the listener being triggered and do some debugging

#

hopefully that leads you to the reason why it is not working

craggy zealot
#

ima make a player interact event

#

see where the player is looking

#

see if its a right click

#

see the block he is holding

#

get the location

#

and set the block as the block he is holding

#

remove the block he just placed

#

BOOM

#

shiity block placing >:)

torpid raft
#

oh god πŸ₯²

#

there's no reason your block place listener wouldnt work so there's gotta be some silly thing in the way

craggy zealot
#

like?

#

there is two classes that effect this

#

PlayerPlace

#

PlayerBreak

torpid raft
#

are you sure that when you test in your main world that the '1' being printed is actually coming from the block place event

#

'1' seems very ambiguous so maybe you have one left over from elsewhere that is being printed instead and you didn't realize

craggy zealot
#

nope

#

prints kys

torpid raft
#

hmm

#

maybe bukkit is just weird with worlds you loaded in on the spot? seems kinda suspicious though, idk if that's actually the case

craggy zealot
#

i think it has to do with politics

thorn cape
lyric gyro
#

ugh I can't paste images

neat pierBOT
lyric gyro
#

yeah yeah

#

Your constructor is re-assigning to the same variable twice

#

Hello

thorn cape
#

ima go jump off of something pepeW

lyric gyro
#

nah don't go hard on yourself lol. pretty common to make mistakes like these if you've been working on the project for a while

thorn cape
#

I literally looked over those spellings twice and my brain was like YEP all good here

robust crow
lyric gyro
#

I'm very close to getting there I think lol

robust crow
#

noice

lyric gyro
#

This is a form of cyberbullying

warm steppe
#

tier 2? 😸

broken elbow
#

what's that

#

haven't heard about it in years

night ice
worn jasper
#

yup, 1.55 tps

#

xD

hoary scarab
#

.txt it please.

worn jasper
#

got issues with that.

#

hence why it's .equals

worn jasper
hoary scarab
#

You can dm it if you don't want to repost it here.

worn jasper
#

ok

#

for context, it's a command to pickup all placed gens by me

#

the tests I did that went to 1.55 tps were only 1k gens lol

#

I think the issue might be somewhere in the adding the item, etc.

#

because I am doing that one by one

#

idk

hoary scarab
#
  1. Creating a new itemstack every location (Should cache the item and adjust it accordingly.)
  2. Creating a new list of locations instead of using the already instanced list.
  3. Discarding the removeCache list every single location.
#

@worn jasper ^^^

worn jasper
#

the reason I create a new list is because I modify the actual list

hoary scarab
#
var removedCache = new ArrayList<Location>();
for (var location : locations) {
    cache.getGenerators().discardAll(removedCache);
    db.removeAll(removedLocs.toArray(new String[0]));
}
```Put the remove methods outside the for statement.
hoary scarab
worn jasper
#

just at the end.

lyric gyro
#

disable physics when changing the block type

worn jasper
hoary scarab
lyric gyro
hoary scarab
#

Also you have var removedLocs inside the for loop so it creates a new list every time instead of just adding to the list.

dense drift
#

Consider using sets over lists where you dont need to preserve an order

craggy zealot
#

does anyone know why my event doesnt work if im in a list?

shell moon
craggy zealot
#

okay so i have a skywars minigame

#

and when i join a game i get added to a activePlayer list

#

when i get added my block break and place events stop working like theyt dont even fire

shell moon
#

probably becuase you messed the code

craggy zealot
#

bruh

shell moon
#

and did something like new BlockListener

#

everytime

craggy zealot
#

in the lobby

#

this prints

shell moon
#

better show code

craggy zealot
#

but when i join a game and get added to the activcePlayer list it doesnt even rpint

#
    public void onBlockPlace(BlockPlaceEvent event) {
        System.out.println(1);
        Player player = event.getPlayer();

        handle(event, player);
    }

    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        System.out.println(1);
        Player player = event.getPlayer();

        handle(event, player);
    }```
shell moon
#

better show the handle

craggy zealot
#

why?

shell moon
#

because that code doesnt help

craggy zealot
#

the event doesnt even fire

shell moon
#

it simply prints

craggy zealot
#

it fires in the main lobby but not in a game

shell moon
#

i cant tell you events do work

north robin
#

@rugged bane How come I was banned from Analyse?

shell moon
#

you probably made an error in other place of the code

craggy zealot
#
        Game game = Main.getInstance().getGame(player);
        if (game != null) {
            if (game.isState(Game.GameState.LOBBY) || game.isState(Game.GameState.PREPARATION) || game.isState(Game.GameState.ENDING) || game.isState(Game.GameState.STARTING)) {
                event.setCancelled(true); // Cancel, game isn't active
                return;
            }
            GamePlayer gamePlayer = game.getGamePlayer(player);
            if (gamePlayer != null) {
                    if (gamePlayer.getPlayer() == player) {
                        if (!game.getPlayers().contains(gamePlayer)) {
                            event.setCancelled(true);
                        }
                    }
            }
        } else {
                event.setCancelled(true);
        }
    }```
north robin
#

Is there a crime attached to having a new account?

#

Or do you just hate customers

high edge
#

Charlie hates everyone, don't sweat it

north robin
#

Makes sense

shell moon
#

how is that related to development? xd

craggy zealot
#

and i made a command

#

that removes me from the list

#

when i do so

#

the event works again

#

DeerJump even opened the project and testing it him self

#

even he doesnt know so thats why im here

shell moon
#

thats weird

#

can you show the registratin of the event

craggy zealot
#

the event is fine

#

it works becaseue it works in the main lobby

#

it prints

shell moon
#

such weird

#

i have so many events and never happenedd