#help-development

1 messages · Page 400 of 1

graceful oak
#

What is a good way to detect when I player has a piece of armor with an enchant on it for applying and removing potion effects?

dry yacht
#

Just an array I once used to calculate the length of text lines in books in order to wrap them manually. I forgot why I needed that, xD. I think this data came from the minecraft fandom website.

quaint tapir
#

I want to create a plugin where when a player dies about 20 bones explode outwards from where they died
but I want to bones to despawn after 1 second and not be able to be picked up by player
how do I make items fly basically

dry yacht
quaint tapir
#

how can I spawn an item on the ground

dry yacht
# quaint tapir how can I spawn an item on the ground
Item itemEntity = location.getWorld().dropItem(location, item);
itemEntity.setVelocity(...);

Then you just need to calculate random velocities by picking random points in a sphere of radius 1 around the point of death and creating a vector through subtracting that point (end) from the death point (beginning). You can multiply each of those with a random double in a range to make it look more organic.

quaint mantle
#

chess in minceraft when

dry yacht
dry yacht
# quaint mantle chess in minceraft when

If only I'd know how to play, xD. But I wouldn't recommend rendering that in chat, as it'll probably be spammed away by other players. Either holograms or maps would be an even better fit.

native gale
#

Thank you

#

Would you mind to share this array though? I want to do some experiments on it

#

I have an idea to emulate alpha channel using these characters

dry yacht
native gale
dry yacht
#

https://github.com/GorgeousOne/NetherView

I found it again, damn, that's so inspiring, :D. Such a great idea, using raytracing and fake block updates to simulate this effect. I'm just pretty sure that it can be pretty expensive, both for the client and the server.

worldly ingot
#

Yeah, it's based on SethBling's POC done with command blocks

inland siren
#

anyone have a significant amount of experience w plib

echo basalt
#

plib is easy

inland siren
#

gotta find the function im tryna reference

#

didnt expect an answer soq uick lmao

#

can i get away with just spawning an entity and giving it the base meta from WrappedDataWatcher#fakeEntity

#

am tryna make entities solely packet manipulatable and tick on the netty thread

#

but they keep spawning invisible >:(

echo basalt
#

So basically

#

You don't really need much to spawn packet-based entities

#

You just need to send a SPAWN_LIVING_ENTITY packet

#

and the entity should appear

#

You can create metadata packets with that WrappedDataWatcher entity, and send them under your packet entity's entityId

inland siren
#

aware, spawn entity packet is spawning it in invisible for no reason at all

echo basalt
#

ah that

#

Show code

inland siren
#

bout to say fuck it and just move to a diff version to test it

echo basalt
#

Pretty sure I know why

inland siren
#

1.8 version that i had to regress to test just for fun

#

was also happening on 1.18

#

sidenote why do spawn packets on 1.8 just have int fields

#

not even rotation is a double / float ??

#
WrappedSpawnEntityPacket packet = new WrappedSpawnEntityPacket();
        packet.setEntityId(this.id = PacketServer.handleEntityId());
        debug("handle packetid " + packet.getEntityId());
        packet.setType(type.get().getId());
        packet.setX((int) location.get().getX());
        packet.setY((int) location.get().getY());
        packet.setZ((int) location.get().getZ());
        packet.setYaw((int) location.get().getYaw());
        packet.setPitch((int) location.get().getPitch());
        packet.setData(data);
        packet.setDx((int) velocity.get().getX());
        packet.setDy((int) velocity.get().getY());
        packet.setDz((int) velocity.get().getZ());
        return packet;

packet gen

#

just being sent to a list of players i've confirmed i'm on

echo basalt
#

Okay so here's the thing

#

I'd advise against packet wrappers as they're auto-generated

#

ProtocolLib wraps the fields on the NMS packet class

#

Not what's written to the buffer, which is what wiki.vg shows

rare rover
#

How would i detect a packet entity click? ( using for my hologram system ). I can't figure it out

#

Since the entities are packets

echo basalt
#

Client sends packets

#

With protocollib, you register a packet listener

#

with nms you register a listener on the netty thread

rare rover
#

I dont use Protocollib

#

Okay

#

Ty

#

Which packet would that be exactly?

#

If you dont mind

inland siren
#

iirc holographicdisplays checks for arm animations and ray traces to the holo

echo basalt
#

The client sends a packet usually containing the entity id hit

inland siren
#

yes, aware

#

was an example of what you could do

rare rover
inland siren
#

iirc client won't process a hit on an invis entitystand

#

unless i'm off my ass

echo basalt
#

it does

inland siren
#

i just wrap everything in holographicdisplays im lazy

#

oh actually

#

wild

echo basalt
#

ever noticed how you can't place blocks if you have an invisible entity at that location?

#

try it with an invis armorstand

rare rover
#

I delete the packet entity whenever i hide the hologram

#

Because i thought that was the best way without any issues

graceful oak
#

Ive been trying to figure out how to get custom enchants to work for a little would it be a bad idea to give my items PersistantData with the key being the enchant name and value being the tier then just adding a lore to it? Is there a better way to do this or should this work fine?

echo basalt
#

uhh

#

Probably a wrapper class that converts Legible Data <-> PDC

#

Honestly your idea isn't really that scalable?

#

I'd just store a whole tag containing all the data, and a data version for the tag

#

NBT data would look like

<enchantment-data>:
\-> data-version: 1
\-> enchant-type: SOMETHING
\-> enchant-tier: 123
#

you might end up adding data in the future, hence the data version

#

You'd make a converter that just

#
public CompoundTag process(CompoundTag original) {
  ...
}

and do a for loop that converts old data into new data

#

I might just be overengineering

graceful oak
#

ngl im kinda lost I do have some code I was following from a tutorial that just didnt work. Not really sure where it went wrong no errors and I threw some debug messages and it seems to be going through everything my only guess is that what I did is outdated would you mind taking a look?

echo basalt
#

ehh tutorials

graceful oak
#

Its more to just play around with it has me make an Enchantment Wrapper extending the Enchantment class and creating them through that

inland siren
#

it don't work at all

#

now i gotta make separate nms impl's for every version this is gonna be used on

#

packetwrapper 😭

echo basalt
#

Nah

#

writeSafely is king

#

The problem you're having

#

is that you're setting the entitytype as an id int

#

just set it as the bukkit object through the wrapper and it'll do its thing

#

wrapper.getHandle().getEntityTypes().writeSafely(0, EntityType.ZOMBIE) for example

graceful oak
echo basalt
#

oh god you're not following package naming conventions

inland siren
#

nor naming conventions

#

mfw i didn't know writesafely was even a thing

#

i'll screw with that in a bit ty 😄

echo basalt
#

readSafely is a thing too

graceful oak
inland siren
#

bout to rewrite every wrapper i have lolol

regal carbon
#

hey, is there a way to stop the end portal particles from showing up? the end result should look something like the second picture, but im not sure where to start for this

rough ibex
#

I don't think that's something the server can control.

#

Those particles are client-side for that block

echo basalt
rough ibex
#

To get rid of them you'd either need a core fragment shader that discards particles of that color

#

or retexture that particle to an 8x8 nothing

regal carbon
#

so something like a resource pack to disable it?

rough ibex
#

Yes.

regal carbon
#

alright cool, thanks

graceful oak
echo basalt
#

Here's the more official guide

dry yacht
regal carbon
echo basalt
#

by turning particles off ??

rough ibex
#

It might

dry yacht
rough ibex
#

new MC rendering is weird. Particles behind glass are invis

#

and in water

#

so, it very well may be like that

graceful oak
#

So after creating an enchant using the Enchantment class and I register it is there something else that needs to be done because I did both and its still not in my game.

dry yacht
lethal coral
#

so I'm, listening to a blockplaceevent and I want to get the item in their hand

remote swallow
#

get the player then Player.getInventory().getItemInMainHand()

lethal coral
#

however when the player places the item successfully and only has one item in their hand, BlockPlaceEvent#getItemInHand() returns an itemstack of air, not the itemstack of what they placed

remote swallow
#

get the block they placed

#

get the block and get type, if you need more you might need player interact event

lethal coral
#

that'll return the block not the itemstack which contains the nbt that's in the item

lethal coral
#

hmm it works now

#

I'm not complaining 🤷‍♂️

graceful oak
rotund ravine
#

?nocode

#

It’s hard to answer a programming question without code. In order to help, helpers are going to have to see what the code is. (source: http://idownvotedbecau.se/nocode/).
Please share your code! If it's short, wrap it directly into Discord. If it's long, use a third-party service (e.g. ?paste).

remote swallow
#

thanks

quaint mantle
#

?nocode @remote swallow @rotund ravine

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

remote swallow
#

thanks imajin

rotund ravine
#

Thx @quaint mantle

regal scaffold
#

How can I know how to correctly hook into a plugin dependency if they don't have a API usage page but I have the public repo with the API

remote swallow
#

it should initalize themselves because its a plugin, so you probably want to join there discord and ask

regal scaffold
#

Here we go again xd

#

Does EntityInteractEvent not fire when a player does it?

round finch
#

i think you want PlayerInteractEntityEvent

heavy perch
#

Non-Spigot-Related question

#

Circulating around Lombok

#

How do I define String array varargs via lombok @AllArgsConstructor or @RequiredArgsConstructor?

#

Anyone knows?

quaint mantle
heavy perch
#

they won't implement anything with it due to older java support

quaint mantle
#

i mean why not just have a varargs constructor that calls the lombok one

heavy perch
#

I hate constructors lol

#

ugly ahh thing

#

and I am using an enum so it saves time

quaint mantle
#
@Getter
@RequiredArgsConstructor
class Person {
    private final String name;
    private final Identity[] identities;

    public Person(String name, Identity... identities) {
        this(name, identities)
    }
}
#

looks pretty sexy to me

heavy perch
#

ohhh

#

I see what you did there

#

still uglyasf

quaint mantle
#

🙂

heavy perch
#

take it on a note

quaint mantle
#

😦

heavy perch
#

any constructor related stuff makes me sick

#

personal preference

fierce whale
#

How can I make custom mob? I just wanna make custom vehicle (riding system)

heavy perch
fierce whale
heavy perch
fierce whale
#

It was so hard 😦

heavy perch
#

And more customized aswell

remote swallow
#

built in denizen?

heavy perch
#

no.

#

Side coded API that he himself created for our network

#

took him about a month to manage the exceptions though.

fierce whale
#

he is so genius lol

heavy perch
#

I personally think he is

#

for a 15 yo

fierce whale
#

what the

heavy perch
#

I am 21 and I do not want to take any work on NMS cuz it sucks a lot, ppl require multi version support and then I need to go ahead use Reflections with caching otherwise memory god om nom nom nom nom

#

😿

#

Alexa play All codes are the same by Juice World

fierce whale
#

For person who don't know eng
Everything is so hard 🥹

heavy perch
#

How old r u

fierce whale
#

im 18 years old

heavy perch
#

Time to find an English girl to teach you everything lol

#

I did that when I was 14 and all of my English was taught from her

fierce whale
#

OMG It's impossible lol

heavy perch
#

nahhh

#

Just be attractive

fierce whale
#

You're soooo lucky

#

lolollll

heavy perch
#

And listen to Dubstep 😎

#
    @Getter
    private final int defaultMaxEventTime;

    @Getter
    private final String[] broadcast;

    DemoEventType(int defaultMaxEventTime, String... message) {
        this.defaultMaxEventTime = defaultMaxEventTime;
        this.broadcast = message;
    }

@quaint mantle ugly ahh code istg

mortal hare
#

although if you're looking for performance and advanced customizability NMS > API

#

My principle is that the less code i need to manage, the better, so I prefer to use API whenever I can

regal scaffold
#

Imagine

#

I just ran into a plugin

#

That I made a addon for. As a dependency. And in the version I tested (latest) the plugin name is "ThisPlugin"

But in the version the client used. the name is "ThisPluginS"

#

What kind of dev changes the plugin name randomly in the plugin.yml of their plugin. What an idiot

mortal hare
#

😄

#

Yea, if you release stuff with that name, leave it that way wtf

regal scaffold
#

Bro he just added an S to the end. That's it

mortal hare
#

unless you want a separate branch

#

with different codebase

mortal hare
#

i would be annoyed too

heavy perch
#

TL;DR

#

I've seen this countless of times

#

ppl are weird bruh

heavy perch
#

API requires 1/4 of the actual code

#

I am most fund of the way entities are able to be hidden from players now.

mortal hare
#

is a static boolean field?

#

or is it an instance field

#

lemme remind you that if you set the game active like this

boolean gameActive = plugin.gameActive;
gameActive = true;
#

this wont work

#

why? because boolean is primitive type and its not passed by reference like non primitive objects

#

its passed by value

#

so you're essentially setting gameActive local variable as true

#

If you used Boolean instead of primitive this would work, but its not recommended for such a simple case. doing plugin.gameActive = true would work tho

rough drift
#

If I put a plugin in the plugins/update folder, will it check for plugin name or file name

chrome beacon
#

Plugin I believe

#

But do test it

quaint mantle
#

I need to loop through this list adding each value which is gotten from user input to sql table, my issue is the first paramIndex is an id i generate. So I need to to start from param 2 but I need the first index of the list... I tried a nested loop but didn't seem to work

rough drift
#

file name

chrome beacon
#

Ouch

rough drift
#

that's a big issue

#

I might make a PR

#

or not

#

I am too lazy to do it

eternal night
chrome beacon
#

Same

rough drift
#

also that checkUpdate has a couple issues

updateDirectory == null || updateDirectory.isFile() is a better way to check (it does some extra useful checks such as existance check and dir check)

updateFile.delete() should be replaced with like

try {
  Files.delete(updateFile);
} catch(IOException e) {
  // Log the exception, it has better error messages
}

and should use plugin descriptions

rough drift
#

Well

#

I am making a pr

eternal night
rough drift
#

Oh god

#

this is actually insanity

#

you need to iterate over every loader that matches the file

#

reeeeeeeeee

eternal night
#

indeed

ivory nimbus
#

package net.md_5.bungee.api.connection does not exist

#

why

#

do i have this

#

i did this

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;

rough drift
remote swallow
#

that was quick

#

whos simone

rough drift
#

Me

remote swallow
#

sus

rough drift
#

Yes

#

Sus

#

Git bullshittery

#

It only allowed me to push with a space there lmao

#

Intellij just seems to have optimized imports

#

shit

chrome beacon
#

Make a new commit fixing that

rough drift
#

Oh alr

#

Intellij keeps reverting it

#

bruh

eternal night
#

There is a maven Checkstyle profile

#

I'd advise running it

rough drift
eternal night
#

The development profile

rough drift
#

ah

regal scaffold
#

Hey, i've never used gradle. How do I change the project output to be able to auto export to my servers folder

eternal night
#

Another notable point, the update dir is configurable

rough drift
#

Oh

eternal night
#

It's parent is not guaranteed to be the plugin die

rough drift
#

Welp

eternal night
#

Dir

rough drift
#

I don't really know how to get the plugin folder

eternal night
#

Why do you even iterate over the plugins dir the fuck

rough drift
#

Well I had no other idea how to find a matching plugin

#

since it runs before loading it

eternal night
#

Well you get a file that is a plugin

#

It has a plugin yml

mortal hare
eternal night
#

You also get a update directory

regal scaffold
#

👍 thanks

midnight shore
#

Hi, I'm using Jeff-Media ArmorEquipEvent but when I use the Number key to move armors the event only fires for the first armor piece i take off, its like the other ones become like a ghost and then i need to move them again to make the event fire, has anyone ever had this problem or someone knows how to fix this?

regal scaffold
#

Gradle is so meh

eternal night
#

Which has a bunch of files that may or may not be plugins

regal scaffold
midnight shore
#

oh really?

rough drift
regal scaffold
#

Yes

midnight shore
#

i didn't knew

rough drift
#

@eternal night

File pluginDirectory = file.getParentFile();
File updateDirectory = new File(pluginDirectory, Bukkit.getUpdateFolder());

And iterate over the update dir to find matching?

#

Note I still do not know how to get the plugin dir

#

since I am editing checkUpdate I don't have enough ctx

quaint mantle
eternal night
#

don't you literally get the update folder

#

like passed

#

in the existing code

rough drift
#

no

eternal night
#

its literally a field what do you mean

rough drift
#

inside loadPlugins maybe

#

Ah

#

I am dum

#

lmao

eternal night
grizzled oasis
#

Hi, im trying displaying an image and works just fine for north and south but for the other it wont rotate

    public static BukkitTask displayRenderedImage(Plugin plugin, Map<double[], Color> render, Callable<Location> location,
                                                  int repeat, long period, int quality, int speed, float size) {
        return new BukkitRunnable() {
            int times = repeat;

            @Override
            public void run() {
                try {
                    displayRenderedImage(render, location.call(), quality, speed, size);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (times-- < 1) cancel();
            }
        }.runTaskTimerAsynchronously(plugin, 0L, period);
    }

    public static void displayRenderedImage(Map<double[], Color> render, Location location, int quality, int speed, float size) {
        World world = location.getWorld();
        for (Map.Entry<double[], Color> pixel : render.entrySet()) {
            Particle.DustOptions data = new Particle.DustOptions(pixel.getValue(), size);
            double[] pixelLoc = pixel.getKey();

            Location loc = new Location(world, location.getX() - pixelLoc[0], location.getY() - pixelLoc[1], location.getZ());
            world.spawnParticle(Particle.REDSTONE, loc, quality, 0, 0, 0, speed, data);
        }
    }

the code to load it is

displayRenderedImage(plugin, image.get(), () -> player.getEyeLocation().add(player.getLocation().getDirection()), 1, period,1,0,0.8f);
rough drift
#

@eternal night Updated, did I do it correctly this time lmao

eternal night
mighty pier
#

can someone send the github link of the plugin creator

#

like where you can add dependencies while creating the plugin

chrome beacon
#

?

remote swallow
#

much confusion, im guessing i need to clear the permission table and fix some syntax?

remote swallow
warm mica
regal scaffold
#

That's not how you spell it ebic

#

lol

remote swallow
#

i copied it off a website

#

not my fault

regal scaffold
remote swallow
#

oh

regal scaffold
#

XD

remote swallow
#

ami that dumb

ocean hollow
#

Hello, how can I make a beam of particles in the direction where the player is looking at 2 blocks?

quaint mantle
#

Loops and MySQL

molten hearth
#

hmm

#

chatgpt recommended me to use ```java
Arrays.stream(StatTag.class.getDeclaredFields())
.filter(field -> field.getType() == Tag.class && Modifier.isStatic(field.getModifiers()))
.map(field -> {
try {
return (Tag<Integer>) field.get(null);
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
}
})
.forEach(tag -> System.out.println(tag.getName()));

#

is there not a cleaner way to loop over ```java
public class StatTag {
public static final Tag<Integer> HEALTH = Tag.Integer("health");
public static final Tag<Integer> DEFENSE = Tag.Integer("defense");
public static final Tag<Integer> STRENGTH = Tag.Integer("strength");
// ... you get the jist
}

molten hearth
#

I guess not

#

🅱️ootiful

thorn crypt
#

?pdc

thorn crypt
#

(for me dw)

safe ibex
#

Why the hell for some reason with my code does it still store the arrow in the world item PDC?

class InventoryClickListener(private val parentPlugin: TestPluginWMaven) : Listener {
    @EventHandler
    fun inventoryClickEvent(event: InventoryClickEvent) {
        val playerUUID = event.whoClicked.uniqueId

        if (event.inventory == TestPluginWMaven.guiMap[playerUUID]) {

            if (event.currentItem == null) return

            when (event.currentItem!!.type) {
                Material.ARROW -> {
                    event.isCancelled = true

                    val itemsToDonate = event.inventory.contents

                    // Put the items in the admin-only accessible NBT storage medium
                    val key = NamespacedKey(parentPlugin, "itemsForDonation")
                    val pdc = Bukkit.getWorlds()[0].persistentDataContainer

                    val items = pdc.get(key, DataType.ITEM_STACK_ARRAY)

                    if (items == null) {
                        pdc.set(key, DataType.ITEM_STACK_ARRAY, itemsToDonate)
                    } else {
                        val itemsToStoreInPDC = mutableListOf<ItemStack?>()

                        val inventoryItemsList = itemsToDonate.filter {
                            it?.displayName() != Component.text("Donate to Admins") && it?.type == Material.ARROW
                        }.toCollection(ArrayList())

                        val itemsInWorldPDC = items.toCollection(ArrayList())

                        itemsToStoreInPDC.addAll(itemsInWorldPDC)
                        itemsToStoreInPDC.addAll(inventoryItemsList)

                        pdc.set(key, DataType.ITEM_STACK_ARRAY, itemsToStoreInPDC.toTypedArray())
                    }

                    pdc.set(key, DataType.ITEM_STACK_ARRAY, itemsToDonate)
                    event.inventory.close()
                }

                else -> {}
            }
        }
    }
}
tardy delta
#

💀

safe ibex
#

Like surely the filter means that it should not add the arrow - but it for some reason still has it?

safe ibex
rough drift
safe ibex
rough drift
#

I guess

#

also

#

?pdc

safe ibex
#

?

#

I've seen that

#

And I'm also using the com.jeff_media.morepersistentdatatypes.DataType library to store item stacks

#

But for some odd reason, the arrow is still in the PDC data after it was clicked?

#

@rough drift Is there like an on take out of inventory event or something?

rough drift
#

InventoryClickEvent is the only thing

safe ibex
#

That I can listen to and then make sure items aren't duped by not being removed from the PDC?

#

Hmm

#

Because the other issue I have is when I have a command to view the items in that world item storage PDC thing - I can take shit out but ofc it doesn't remove it from the PDC also

#

So I was wondering how I'd attempt to do that 🤔

cinder spindle
#

Hey

tardy delta
#

what are you doing

late sonnet
quiet ice
safe ibex
#

Would anyone know why in this code block, there is still one item left over even when I take all of the items out of the custom inventory?

else if (event.clickedInventory == TestPluginWMaven.OtherGuiMap[playerUUID]) {
            val inventoryGUIItems = event.clickedInventory!!.contents.filterNotNull()

            val key = NamespacedKey(parentPlugin, "itemsForDonation")
            val pdc = Bukkit.getWorlds()[0].persistentDataContainer
            val itemsInDonationPDC = pdc.get(key, DataType.ITEM_STACK_ARRAY)

            if (itemsInDonationPDC != null) {
                // Compare inventory items to PDC data
                val itemsInPDCNotNull = itemsInDonationPDC.filterNotNull()

                if (inventoryGUIItems.any { it in itemsInPDCNotNull }) {
                    println("Fixing inequality!")
                    pdc.set(key, DataType.ITEM_STACK_ARRAY, inventoryGUIItems.toTypedArray())
                    println("New inventory length: " + pdc.get(key, DataType.ITEM_STACK_ARRAY)!!.filterNotNull().size)
                }
            }
        }
#

Because when I take out both of the items I have put in previously, it still says "New inventory length: 1".

#

And I am doing this code by the way in the InventoryClickListener.

#

It is basically removing every item but one?

thorn crypt
#

Yo I got a problem, in a project I was able to use PDC but on a new one I can't, when I do player.getPersistentDataContainer(), it say that getPersistentDataContainer doesn't exist

hazy parrot
#

and what spigot version are you using

thorn crypt
#

Version 1.14

safe ibex
remote swallow
#

iirc pdc was 1.14.4

#

?pdc

remote swallow
#

also its not an int

thorn crypt
#

Oh 1.14.4 that's why

safe ibex
thorn crypt
tardy delta
#

me wondering what all those bools mean

quiet ice
#

the better question is why they aren't a bitset

tardy delta
#

heehee i was thinking about that too

thorn crypt
#

Does anyone know why when I'm adding Vault on my pom.xml, I can't use PDC (Spigot 1.16.5)

ivory sleet
#

vault might be adding a transitive dependency

thorn crypt
#

Uh

eternal oxide
#

move Vault down below Spigot in your dependency list in your pom

#

vault adds 1.14

quiet ice
#

I wish maven had something similar to compileOnly and implementation

safe ibex
#

Would anyone know why with my code, after clicking on an item and moving it from the custom inventory to my new inventory - why the item still after being removed is kept in the array stored in the PDC?

#

I'm really lost for ideas

ivory sleet
#

isnt it just compile and provided?

safe ibex
#

Conclure, would you know?

ivory sleet
#

cuz provided adds to compileClasspath, and compile adds to both compileClasspath and runtimeClasspath

ivory sleet
#

maybe transitivity is a bit different tho

safe ibex
tardy delta
#

i dont understand kotlin man

safe ibex
#

Wait hold on

tardy delta
#

you never modify that array?

safe ibex
#

Oh for fuck sake I might not be 💀

#

And I didn't notice

tardy delta
#

💀

safe ibex
#

Hold on

humble yacht
#

Does anyone have any ideas how i can advertise my plugin coding service and get more customers?

safe ibex
#

No wait

#

Hold on

eternal oxide
#

?services

undone axleBOT
quaint mantle
#

What's a good way of allowing multiple databases and letting the user pick which one. (Java not spigot :))

ivory sleet
#

@safe ibex contents returns a copy

safe ibex
ivory sleet
#

and then you might wanna switch on some string input that decides which implementation to use

ivory sleet
quaint mantle
safe ibex
# ivory sleet no in general Inventory.contents returns a copy

Yes I know. My logic is supposed to check if anything after an interaction in the custom inventory is clicked/picked up/moved out of the "inventory", it should then update the world PDC array with the items in so that it doesn't have that item in any longer.

#

Like a chest emulation, basically

ivory sleet
#

ah I c

safe ibex
#

So my code should be working, but it's not removing properly

#

Like if I have 8 items and remove one, it'll still have all of the items in the PDC still, even after removing

smoky oak
#

fuck does a !! in java do

ivory sleet
#

asserts non null

safe ibex
ivory sleet
#

and its kotlin

safe ibex
#

Yeah

ivory sleet
#

basically it allows for NPE in worst case

safe ibex
#

Like look:

ivory sleet
#

cookernetes idk

safe ibex
#

I removed an item, but in the PDC it is still there

ivory sleet
#

might be an issue with DataType.ITEMSTACKarray

#

thingy

safe ibex
#

Oh? That's the one provided by "jeff_media"

ivory sleet
#

not sure

safe ibex
#

Which is recommended?

#

?morepdc

undone axleBOT
smoky oak
#

question. Why dont you just make a extends inventoryholder class, and check on inventorycloseevent if the inventoryholder is of that class

safe ibex
#

by that

ivory sleet
#

idk, I implement my own types

#

cuz I dont trust that lib

safe ibex
#

You don't?

#

Are you saying it could be an issue with the lib, or does my code just look dodgy?

#

Because in theory my code should be fine

ivory sleet
#

no it could be the lib

#

but also ur code

#

cuz Idr if contents returns Array<out CraftItemStack> or Array<out ItemStack>

ivory sleet
#

let me look that uo

safe ibex
#

If that helps

ivory sleet
#

CraftItemStack is an ItemStack derivative

safe ibex
#

?

#

I'm not using a CraftItemStack anywhere though, am I?

smoky oak
#

maybe he means that bukkit itemstack is a nms itemstack wrapper

safe ibex
#

🤔

#

You lost me, kind of

smoky oak
#

bukkit is an api to make mojang code easier to interact with

quaint mantle
smoky oak
#

instead of every single plugin only bukkit has to be updated in lots of cases

ivory sleet
#

ah nvm it doesnt cookernetes

safe ibex
#

Oh?

#

So what should I do then do you think, Conclure?

ivory sleet
#

maybe try for testing sake

#

and use one of the standard ones

#

if it still does not work, then its probably ur code

safe ibex
#

How can I use a standard one for an item stack???

ivory sleet
#

there's no standard one

#

but try another type

safe ibex
#

Are there other libs I can try?

#

@tender shard Do you know if this is a your lib issue or my code issue?

quaint mantle
safe ibex
#

I think it's a me issue - but idk if the lib's ITEM_STACK_ARRAY type is borked

ivory sleet
#

writing vexx

safe ibex
ivory sleet
#
database: 
  type: PostgreSQL 
  # ADDITIONAL stuff 
  settings:   
    password: ... 
interface DatabaseSettings {
  ConfigurationSection configuration();
} 
interface Database {
 void bootUp(DatabaseSettings settings);
 PlayerTransfer loadPlayer(UUID id); 
} 

class DatabaseFacade {
  Database delegate;
  DatabaseSettings settings;

  DatabaseFacade(Database database, DatabaseSettings settings) {
    delegate = database;
    this.settings = settings;
  }

  void bootUp() {
    this.delegate.bootUp(settings);
  }
  
  CompletableFuture<PlayerTransfer> loadPlayer(UUID id) {
    return CompletableFuture.supplyAsync(() -> {
      return delegate.loadPlayer(id);
    },executor);
  }
}

class DatabaseFactory {
  public DatabaseFacade createFromConfiguration(ConfigurationSection section) {
    var type = section.getString("database.type","")
    switch (type.toLowerCase(Locale.ROOT)) {
      case "postgresql": {
        return new DatabaseFacade(new PostgreSQL(),section.getConfigurationSection("settings"));
      }
    }
  }
}

class PostgreSQL implements Database { 
  @Override void bootUp(DatabaseSettings settings) {
    //load stuff
  } 

  @Override CompletableFuture<PlayerTransfer> loadPlayer(UUID id) {
    return CompletableFuture.supplyAsync(() -> {
      //TODO
    });
  }
}

//onEnable
var factory = new DatabaseFactory();
var database = factory.createFromConfiguration(...);
database.bootUp();
tardy delta
#

heehee

ivory sleet
#

stop

#

im writing :C

undone yarrow
#

Is it possible to have a plugin that lets you change the colour of an object? For example, you get a custom item called a canvas (just a white block), then the plugin lets you choose a specific colour which automatically gets the texture and changes its hue?

#

Or would you just need a lot of different model textures with pre-applied different colours?

tardy delta
#

just give them another color block 💀

undone yarrow
#

?

tardy delta
#

white wool -> black wool

undone yarrow
#

yeah but the canvas was just an example

native gale
undone yarrow
#

It's a more detailed model Im using, such as a vehicle

undone yarrow
#

Probably just easier to have multiple pre-applied colours

safe ibex
#

Ok actually, I don't know what I did with my code @ivory sleet but now when I remove an item from the inventory - it removes all of the items, not just the one I took out of the custom inventory, from the PDC 🤔

ivory sleet
#

just an example but ye

#

and if u wanna do it more dynamically, use a hashmap instead of a switch

mortal hare
#

does any of you know how does cpp templates work

#

i have a bitset

#

std::bitset<N>::reference

#

and i want to make a template

#

with N as a std::size_t

safe ibex
#

this server is for java/kotlin - specifically for spigot dev

#

I'd say go to the programmers hangout?

ivory sleet
#

na

safe ibex
ivory sleet
#

any programming stuff is fine here

safe ibex
#

oh ok

hazy parrot
ivory sleet
#

but like, its likely people wont know a pertinent answer yk

safe ibex
mortal hare
#

errors out

ivory sleet
#

?

mortal hare
#

it cannot retrieve reference class

#

from a templated class

safe ibex
#

(in a nutshell)

hazy parrot
undone yarrow
#

For simple things such as custom foods and custom recipes, what's better: datapacks or plugins?

mortal hare
#

i want to have literal integers

hazy parrot
#

you already know its gonna be size_t

mortal hare
#

its an outside class declaration

safe ibex
mortal hare
#

i edited it

#

i need it so i can use it like this

Bar<8>::foo(ref8bitClass)

ivory sleet
#

so thats during clickevent right?

#

and u wna update whether an item got removed or added

safe ibex
mortal hare
#

i just dont know how to declare this properly

safe ibex
#

when an items is removed: do something

mortal hare
#

it doesnt error out in the header definition

#

of a struct template

safe ibex
ivory sleet
#

I see

quaint tapir
#

How can I make items not merge without turning item merging off

hazy parrot
#

it probably doesn't work because cpp doesnt know that std::bitset<N>::reference is type

ivory sleet
#

@safe ibex I would say

#

why not just save the pdc on inv close

safe ibex
#

That's a good point, but I don't understand why this isn't working. I also need it this way so that it can be like a true chest so that if more than one people are looking at the items in the PDC via the inventory-style GUI viewer, it will update like a real chest.

tardy delta
#

uh oh Our mutual friend, Conclure, highly recommended you.

safe ibex
#

I need the true-est chest emulation possible

mortal hare
#

that actually works

#

but im not sure why

quaint mantle
#

Кто добрый человек

mortal hare
#

can you further explain?

#

wdy doe it need that keyword

quaint mantle
#

Кто добрый человек

ivory sleet
quaint tapir
mortal hare
#

there isnt any good people here @quaint mantle

quaint mantle
#

Шо

hazy parrot
ivory sleet
#

well Idk, if event.clickedInventory.contents would display the recent change

regal scaffold
#

I've seen a lot of people use ACF

safe ibex
#

Yeah that's what I'm thinking

ivory sleet
#

since its cancellable

hazy parrot
regal scaffold
#

Do you guys use it in actual plugins you make?

#

Besides testing

safe ibex
#

You know?

mortal hare
hazy parrot
#

i don't understand that completely too, but had same issue while ago

ivory sleet
#

yeah cookernetes was thinking that too

safe ibex
#

@ivory sleet It'd be really helpful if there was an actual like itemMovedOutOfInventory event, but there's not 🤔

ivory sleet
#

havent touched spigot for a while

#

true

safe ibex
#

Or there is one, but it's for hoppers (and observers?)

mortal hare
#

yep it works

ivory sleet
#

when items jump between hoppers

safe ibex
#

Yeah

mortal hare
#

you saved me so many hours of frustration. thank you ❤️

safe ibex
#

I really need to fix this though or else this is gonna drive me absolutely fucking crazy 🤣

#

Like oh my

#

If anyone knows a way to reliably listen for an item being removed from an inventory, I'd be so happy

ivory sleet
#

hmm Ican test sth rq

safe ibex
safe ibex
#

Or I'm doing it in an un-reliable manner

mortal hare
#

how is it unreliable

safe ibex
#

Not actually the event

#

It's me getting the items after the event is called and something is clicked on/removed

mortal hare
#

what about running task one tick later?

#

inside that event

safe ibex
#

How would that help

mortal hare
#

i dont understand the problem

#

correctly

safe ibex
#

TL;DR - I am making a virtual chest system which basically has the following features:

  1. /donate-items creates a temporary "inventory" attached to the player which also has a "button" in which when clicked, runs the inventory click event which stores the array of item stacks in a PDC stored on the world.
  2. /test-show - reads all items currently in the world PDC, then makes an inventory like in the donate items command (minus the button) - and displays all those items in the array ("donated" by the other command)
#

Very specific, and is simple in theory but isn't in practice for some reason

quaint mantle
#

Кто русский , может сделать плагин за ₽

#

До 800₽

tardy delta
#

english only

quaint mantle
#

Нет

tardy delta
#

?services

undone axleBOT
sacred wyvern
#

First time diving into MC Plugin dev. I'm using VSCode and following tutorials to setup my spigot plugin. Does the spigot-api dependency version have to match the spigot server version? VSStudio Maven/Minecraft plugin setup with version 1.15.1-R0.1-SNAPSHOT.

safe ibex
sacred wyvern
smoky oak
#

can someone explain why this only removes one ladder instead of two

inv.setItemInMainHand(new ItemStack(Material.LADDER,inv.getItemInMainHand().getAmount()-2));
safe ibex
#

@ivory sleet you getting anywhere? 😭

ivory sleet
#

ye

#

just setup the env up

safe ibex
#

Because, @ivory sleet I definitely don't think the contents are being updated/the thing is being taken out of the inventory - as I modified my script like this (in image) which is even simpler WITH an explanation and it's still not working

#

It just doesn't remove the items 😭

smoky oak
#

?scheduling

undone axleBOT
safe ibex
#

?

#

You want me to run it on the next tick or something?

ornate patio
#

Hello, how can I throw all the inventory with spigot in front of me please ?

smoky oak
#

no my ide is mucking up

safe ibex
smoky oak
safe ibex
#

Kinda thing

ornate patio
#

Thank you 🙂

hazy parrot
safe ibex
#

yeah

#

like python I guess lol

smoky oak
#

???????

safe ibex
#

Does it like remove them one by one but needs a delay?

#

Idfk

torn shuttle
#

ah, yes, my changelog is 5885 characters long

#

classic

ivory sleet
#

@safe ibex

#

clicked inv shows content before update

smoky oak
#

how do inventory work man

ivory sleet
#

so clicked inv wont include updates from the click itself, aka depositing or looting

safe ibex
#

Oh for fuck sake

#

Amazing!!!!

#

Is there any workaround/alternative?!

smoky oak
#

isnt java pass by reference? Couldnt you just update whatever inventory youre using when you change it?

ivory sleet
#

no

#

its pass by value

smoky oak
#

then why do i call clone on vectors

dry yacht
smoky oak
#

its sure not cuz i want to type extra 5 chars

dry yacht
smoky oak
#

the method is called additionally it doesnt replace the event tho

orchid gazelle
#

uhm what was the formula for degrees -> yaw/pitch rq?

safe ibex
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

ivory sleet
#

like its still pass by value

safe ibex
#

Is there any solution then, @ivory sleet? And I really appreciate your help btw lol

dry yacht
#

I need to open my laptop, not gonna type this out on my small ass phone keyboard

orchid gazelle
dry yacht
safe ibex
dry yacht
# smoky oak blockplaceevent

I bet that the block place event saves the item in main hand before it's called, then calls the event and then, if not cancelled, sets the item in main hand to the saved item minus one. So no matter what you set it to in the event, it will be overridden to item - 1 afterwards. If you go into a scheduler of 1 tick (0L is still next tick), you effectively override this.

Isn't there a way to change the hand item through the event?

ivory sleet
#

by using bukkit scheduler

safe ibex
#

so just wait a tick then?

#

and then do it?

#

because it'd be better if there was like an after event

smoky oak
#

interesting

ivory sleet
#

ye

#

ik, but I think that might be the only way

smoky oak
#

if you overwrite the inventory in the event the handler from the event itself doesnt run

#

turning the 2 into a 3 removes two additional items

safe ibex
ivory sleet
#

no, not at all

#

but like
Bukkit.getScheduler().runTask(plugin, () -> {
//TODO
});

safe ibex
trail lintel
#

Hey guys, I need a way to "tag" a block or take note of it so I can do some custom logic on it when its interacted with. My initial idea was to use PDC, and store a bit that's basically a flag saying "Hey, this is a custom block". But blocks don't have a PDC :O. So then I was thinking I would just maintain a set of Block, and check to make sure the interacted with block is in that set. But THEN I found this old MetaData api, and figured I could just store the "tag" as a metadata value on the block, but this seems to be an old (and often abused) api. Any suggestions on which route I should go?

dry yacht
tall dragon
#

technically their stuff is then stored in their chunks pdc. but to you u work on a per block level

ivory sleet
smoky oak
trail lintel
#

I did actually stumble upon this library yesterday. I was wondering if maybe this is overkill though, since all I need to do is store a simple bit to tag a block. Using the metadata api would also allow me to provide support for pre 1.14 versions. Hmmmmm.

safe ibex
#

It's so dumb that I have to fucking do that though

tall dragon
#

well its your own decision then depending on what u need. but i would go for the lib

ivory sleet
#

yea true

#

Post and Pre events would be a nicer design conceivably

safe ibex
trail lintel
#

I do see its a compile time dependency so it won't require another plugin to be installed, I may just go for the lib 😉

#

You guys are very helpful, thanks a bunch

orchid gazelle
#

can I move armorstands async?

river oracle
#

AFAIK you can't even change anything about the world async

#

You can read a lot if stuff about it just not make changes

safe ibex
#

Ok well thanks so much @ivory sleet 👍

smoky oak
#

making async interact with the server is such a pain in the ass

orchid gazelle
smoky oak
#

you need to make a queue of changes to be made and ensure you dont get race conditions

dry yacht
echo basalt
#

might be late

#

just woke upo

river oracle
echo basalt
orchid gazelle
echo basalt
#

bascially yaw and pitch are represented as a byte iirc

river oracle
torn shuttle
echo basalt
orchid gazelle
#

I just wanna move an armorstand over time basicly lol

echo basalt
#

with reflections

river oracle
#

But ig

smoky oak
#

on that topic, is runtaskasync in the current or in the next tick?

echo basalt
echo basalt
river oracle
torn shuttle
orchid gazelle
echo basalt
#

No matter your efforts, brute-forcing will never work

#

:)

river oracle
#

Just makw the move task synced

#

And async the actual countdown and timer

torn shuttle
echo basalt
#

say that again and imma buy your neighbourhood

smoky oak
# echo basalt No matter your efforts, brute-forcing will never work

Brute Force: Allied Strategy and Tactics in the Second World War (published 1990) is a book by the historian John Ellis that concludes that the Allied Forces won World War II not by the skill of their leaders, war planners and commanders in the field, but by brute force, which he describes as advantages in firepower and logistics.Ellis describes...

echo basalt
smoky oak
smoky oak
tardy delta
dry yacht
# orchid gazelle wait what? Never seen that one

Yaw and pitch are degrees, so dividing them by 360 will give you a number ranging from 0 to 1, which you then scale to the range of a byte by multiplying by 255. Yaw, for example, ranges from -180 to 180, resulting in a byte value ranging from -128 to 128 - a signed byte. Pitch ranges from -90 to 90, yielding -64 to 64. This conversion works, because the values are always <= 180. Otherwise, you couldn't interpret them signed.

dry yacht
orchid gazelle
tardy delta
#

true

dry yacht
echo basalt
orchid gazelle
#

no, im converting degrees -> yaw/pitch

dry yacht
#

Yaw and pitch are already in the unit degrees? :-:

orchid gazelle
#

oh what?

dry yacht
#

Location#getYaw and Location#getPitch are values ranging from -180 to 180 and -90 to 90, respectively.

smoky oak
#

aint they doubles in .1 steps

dry yacht
#

Do you mean how to convert 0 to 360 to -180 to 180? xD

dry yacht
smoky oak
#

ye

orchid gazelle
smoky oak
echo basalt
#

get your 2014 acoustic panels outta here

torn shuttle
#

because I just finished writing the changelog and dunking on illusion was next on my todo list

echo basalt
#

mans so old his pic's in black & white

smoky oak
#

if that really is magma ill be disappointed

#

you know

echo basalt
#

it is

orchid gazelle
smoky oak
#

sharing personal info online

#

is something id never do

echo basalt
#

oh no he's gonna get caught

torn shuttle
#

I was literally streaming this morning

echo basalt
#

I used to be paranoid like that when I was 14

tardy delta
torn shuttle
#

I am editing a video I am uploading on youtube

#

my discord pfp is of me

echo basalt
#

just because you have acoustic panels doesn't mean you're a youtuber

torn shuttle
#

I'm not an assassin, I don't need my face to be unknown

#

no I am not a youtuber because I am currently releasing 1 video a year lol

river oracle
echo basalt
#

there goes your oportunity to say you've murdered the competition

river oracle
#

So it syncs up

smoky oak
#

all my 'videos' are entries in a competition i really shouldnt have been in lol

echo basalt
#

I don't need fake online fame to cheer myself up, so I just don't upload stuff

torn shuttle
#

I don't need online fame either, but I could use some advertising

orchid gazelle
# river oracle You gotta make a sync call with bukkit scheduler
                new BukkitRunnable() {
                    @Override
                    public void run() {
                        as.teleport(new Location(as.getLocation().getWorld(), as.getLocation().getX() + xPT, as.getLocation().getY() + yPT, as.getLocation().getZ() + zPT));
                    }
                    
                }.runTask(LoopCityScript.plugin);
``` just like that?
#

IN my async loop?

smoky oak
#

wait

#

runTask syncs

#

never knew that

dry yacht
orchid gazelle
#

hmmm

echo basalt
#

just

#

yaw %= 180

#

type deal

#

or be a clown like me and do a while loop

smoky oak
#

oh btw have you ever worked with databases?

quaint mantle
#

whats the smartest way to make an npc move like an real player

dry yacht
#

We're talking about converting 0-360 to yaw, so how's either of that gonna solve it? You need to end up with a negative number in "half of the cases", but you're inputting a strictly positive one.

#

At least that's how I interpreted the question

smoky oak
dry yacht
quaint mantle
#

great idea

dry yacht
#

So how is yaw %= 180 gonna cover the cases where you're looking into negative yaw direction

#

if yaw ranges from 0 to 360, as that's what DaFeist wants to input

river oracle
#

you could shrink that code so much

smoky oak
#

tbh i also completely forgot u can lambda a runnable

orchid gazelle
river oracle
#
Bukkit.getScheduler().runTask(() -> as.teleport(new Location(as.getLocation().getWorld(), as.getLocation().getX() + xPT, as.getLocation().getY() + yPT, as.getLocation().getZ() + zPT));```
orchid gazelle
#

because it looks 10x more ugly to me

ivory sleet
#

Waat

dry yacht
# orchid gazelle wait is it just Math.toRadians actually lol?

Have you tried to just input the angle as is yet? Could be that due to the signed nature of bytes, this conversion is done automatically for you anyways. It would just be reversed, likely, as it's 256 to -256 instead of -256 to 256. But then, again, I'm rusty on that kind of topic. I'd just play it save by using my formula if it was me.

safe ibex
#

@ivory sleet Strannnggee issue - for some reason now when I add logic in the scheduler (highlighted in image) for managing items being put in it, it makes all of the other logic just not work... would you know why?

orchid gazelle
#

eh I have not tested anything(just building kind of an API around armorstands rn) but imma put a note there so I know whats wrong when it does not work

ivory sleet
river oracle
ivory sleet
#

addAll @safe ibex ?

#

Is that ur method

safe ibex
#

In SS yeah I’m doing that

#

But under no circumstances should it modify the other logic

#

Like the one I tried for hours to do

ivory sleet
#

No im just curious what the method does lol

#

Concretely that is

safe ibex
#

Adds all items in one array to other

#

Like spread + concat in JS

ivory sleet
#

Oh

#

Wait it’s MutableList::addAll?

#

Ah fuck im not used to kotlin mb

safe ibex
#

Think of it as adding all the items in the other array to an array

#

But that’s really not the issue

ivory sleet
#

Yeah but did u write it, or is it a std method?

safe ibex
#

Stdlib for kotlin

#

@ivory sleet do you know why it fucks up the rest of the logic!?

#

Like it shouldn’t

ivory sleet
#

No but you’re overcomplicating stuff

#

Why do you just write to the pdc put simply?

safe ibex
#

What do you mean

#

I’m checking if an item is added by checking if there’s an item in the inventory that’s not in the PDC, then I’m making a new array that consists of the old PDC items and the item that’s not in the PDC currently, then I set it to the PDC

astral wedge
#

I'm trying to create a brush that will "paint" a biome. This takes the biome given by the player and should change the blocks to the given biome, but instead just changes them to an ocean. Is there anything I'm missing here?

this.selectedBiome is the correct biome, I checked with a console log.

            final double xSquared = Math.pow(x, 2);

                for (int z = -brushSize; z <= brushSize; z++) {
                    for (int y = 0; y < 256; y++) {
                    if ((xSquared + Math.pow(z, 2)) <= brushSizeSquared) {                   
                        this.getWorld().setBiome(this.getTargetBlock().getX() + x,                                  y,
                                this.getTargetBlock().getZ() + z,
                                this.selectedBiome);

                    }
                }
            }
        }```
ivory nimbus
#

are there proper velocity docs ?

safe ibex
#

Would anyone else know?

small hawk
#

Is there a way to check if player has shulker box in his hand, i mean no matter what color of the shulker is

remote swallow
#
if (player.getInventory().getItemInMainHand().getType().toString().contains("SHULKER_BOX") 
twin venture
#

anyone know how stop the countdown , if players in arena are less than in current players?

#

i have this check but ti does not work

grizzled oasis
#

How can i get the nearby players and entities like from 20 blocks away?

twin venture
#

player.getLocation().getWorld().getNearbyEntities(location,20,20,20).forEach(entity -> {

        });

you can use stream

quaint tapir
#

Wither wither = location.getWorld().spawn(location, Wither.class); wither.setCustomName(ChatColor.DARK_RED + "Wither" + ChatColor.WHITE + " ( " + ChatColor.GREEN + "4000" + ChatColor.WHITE + " )"); wither.setCustomNameVisible(true); Attributable witherAt = wither; AttributeInstance damage = witherAt.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE); AttributeInstance health = witherAt.getAttribute(Attribute.GENERIC_MAX_HEALTH); AttributeInstance speed = witherAt.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED); speed.setBaseValue(10); health.setBaseValue(4000); wither.setHealth(4000); damage.setBaseValue(100);
I'm trying to set a wither that spawns at max hp of 4000 and has attack damage of 100 but it doesn't work in game and returns errors anyone know how to work with withers?

pseudo hazel
#

what errors

quaint tapir
#

when I summon it in it says an internal error occured

#

basically it spawns a wither that says 4000 health on the bossbar

#

but it spawns with regular health and 1/3 hp

grizzled oasis
#

what?

quaint tapir
#

it counts players

#

items

#

mobs

#

& more

rapid topaz
#

?paste

undone axleBOT
hazy parrot
rapid topaz
rapid topaz
#

what?

tall dragon
#

there might be 2 of the same plugins present in your plugin folder

rapid topaz
#

well it is not

eternal oxide
#

you tried to do new Customthington() in your plugin at line 8

tall dragon
rapid topaz
#

i did not create a new customthington

eternal oxide
#

?paste your Customthington.java

undone axleBOT
rapid topaz
#

here

#

just registering some commands and events

eternal oxide
#

one of yoru other classes also extends JavaPlugin

#

Only your main class can do that

rapid topaz
#

oh

#

i get iot

#

so i just delete extends Javaplugiun

hazy parrot
#

btw this is spigot support server

twin venture
#

or smth

#

anyway ,
is there a way i can check if the task is canceled?

hazy parrot
mortal hare
#

man i feel soooooo dumb

#

cmon

#

i've been working on bitwise operations

#

and wondering why that wasnt working

#

so i did two different algorithms

#

which only partially worked

#

turns out you just needed one, by executing it twice

#

I wrote that algorithm knowing that it would work for that case, but somehow i forgot that I can use it

#

and here I am, after 8 hours of sitting and wondering what's wrong

#

feeling dissapointed with my lack of intelligence for a such a simple thing.

twin venture
hazy parrot
#

¯_(ツ)_/¯

mortal hare
hazy parrot
#

probably pre-1.8 lol

mortal hare
#

it surely exists in 1.8

#

pre 1.8 era minecraft versions are not safe

#

due to log4j exploit

#

iirc

hazy parrot
dry yacht
dry yacht
twin venture
twin venture
mortal hare
#

maybe you can use reflections

#

to find some private field that states if the task is active

#

inside implementation

echo basalt
#

too much work

mortal hare
#

is there taskid?

echo basalt
#

just get the taskId

#

and check the scheduelr

mortal hare
#

Bukkit.getScheduler().isCurrentlyRunning(taskId)

twin venture
#

alr

dry yacht
#

Is that really the same as isCancelled tho?

#

Doesn't look like it

rain plinth
#

does anyone know how to get bukkit.yml on a fabric server?

river oracle
#

:O lol

#

bukkit isn't fabric

#

and it never will be

twin venture
#

what iam doing is :
now if 2 players in arena , and one of them leave the arena , it will stop the countdown so this is fixed , but if the same player who left join the same arena again , the countdown will not work .

#

ideas?

mortal hare
dry yacht
# dry yacht Doesn't look like it

Looks like they use a period of -2 as some sort of sentinel value to mark cancelled tasks. So checking it's period for < 0 should be the same as modern isCancelled

#

Yep, indeed

twin venture
#

alright thanks 😄

dry yacht
#

If not async, always return false

mortal hare
#

if task == null async statement check will not be invoked

twin venture
#

iam canceling the task :

#

if the players in the arena is not less than 2

dry yacht
dry yacht
mortal hare
#

if task is running and task is not async do the code nested inside else return false

#

where tf do you see that it would return false if task is async

dry yacht
mortal hare
#

if task is not running it will return false

#

if you cancel it

#

the task is not running

safe ibex
#

Would anyone know of a cleaner way to write the following?
https://paste.md-5.net/ogoletetin.cs

And the section I am talking about is the one screenshotted as this (while scuffed) is the only way I have gotten my logic semi-working 🤔

wispy jasper
#

a quick question: how do i give a player a tag and how to remove?

dry yacht
#

((CraftTask) task).getPeriod() < 0 means it's cancelled.

quaint tapir
#

can I make passive mobs target a player

dry yacht
# mortal hare if task is not running it will return false

task != null && !task.isSync()

If the task is null, it will not enter the block and thus return false. If the task is not null, the second condition is resolved. The block again is only entered if the task is NOT sync, thus async. So this check only works for async tasks and will yield false for all sync tasks.

mortal hare
#

yes, but by the time you cancel the task

#

it would always return false

dry yacht
#

But it's completely useless to check if a sync task has been cancelled...

#

While the sentinel value comparison always works out

twin venture
#

iam cancling the task here , so if the player join the arena again the task will be canceled

mortal hare
#

but its version dependant

twin venture
#

so i need to make new task right?

dry yacht
mortal hare
#

isnt CraftTask package

#

prefixed

#

OBC?

dry yacht
#

You shouldn't access CB without reflection anyways. But that one reflective access shouldn't be too hard, even for beginners to reflection.

frosty cairn
#

Hii, do you know any good tebex theme for free?

reef acorn
#

Hello, I have a problem that the connection breaks down after a while and "?autoReconnect=true" doesn't work eithertxt [08:31:17 WARN]: com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 33,554,299 milliseconds ago. The last packet sent successfully to the server was 33,554,299 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. ```java
con = DriverManager.getConnection("jdbc:mysql://"+data[0]+":"+data[1]+"/"+data[2]+"?autoReconnect=true", data[3], data[4]);

dry yacht
twin venture
mortal hare
#

well you're kinda right for async tasks, cancelling the task wouldnt immediately shutdown the task

#

thus there's a risk that it would still find the task in the scheduler

sacred mountain
#

hey slightly offtopic, is there a quick and easy way to encrypt a string (a mysql database connection link) without having to obfuscate my jar?

dry yacht
# twin venture its oky , i was hoping to get a fix xd

You asked how to check if a task is cancelled, that's all I can currently help with, sorry. I really need to work on a project right now, so I cannot get into the mindspace of your project. I could only provide a solution for that. If it's about some state machine or on how to architect things, I'm currently not able to provide help :/

sacred mountain
#

because i'm trying to create a connection without people decompiling and logging into my db

twin venture
mortal hare
eternal oxide
dry yacht
#

If it's about logging, send the logs to your server through a socket, then access the DB there.

eternal oxide
#

My guess is you are trying to implement some authentication system for people who have purchased your plugin. Not allowed on premium resources

river oracle
#

is to not do it

dry yacht
safe ibex
river oracle
#

kotlin :O

eternal oxide
#

Not touching kotlin whith a 10 foo tpole

safe ibex
#

Why

#

What's the fackin issue with Kotlin

eternal oxide
#

To improve your code you could write it in Java

echo basalt
#

that color scheme

safe ibex
#

It's more maintainable in Kotlin

river oracle
echo basalt
#

no it's not

safe ibex
safe ibex
echo basalt
#

The industry is settled in java