#help-development

1 messages ยท Page 1411 of 1

south onyx
#

do any of yall know how to get the slot of an item in someones inventory?

mortal hare
#

#Player.getInventory().getItem(int slot);

sullen dome
#

loop throu the inventory, check for the item, get it's slot

#

that's not what he wants i think

south onyx
#

ok thx

sullen dome
#

or is it? lol

south onyx
#

@sullen dome

#

yeah

sullen dome
#

i mean...

south onyx
#

thats what i needed

sullen dome
#

then you spelled it wrong lol

#

you want to get the item of a slot, not the slot of an item then

mortal hare
#

slot != itemstack

sullen dome
#

how to get the slot of an item

that pretty much looks like he wanted to get for example, at which slot is cobblestone

wispy monolith
#

I compiled into a jar file and then checked the jar file and i didn't find anything except the plugin.yml

#

How to fix?

mortal hare
sullen dome
#

idk to be honest

wispy monolith
#

intellij

mortal hare
#

check compile output

#

in artifacts tab

sullen dome
#

you used maven or not?

#

if not, do what dovidas said

wraith rapids
#

there's also an util method

#

getFirst(ItemStack) or something

wispy monolith
sullen dome
#

yeah, but that doesn't really works when you have 2 stacks of smt, or similar

#

it gets confused then pretty much

wraith rapids
#

neither does iterating the inventory, though

sullen dome
#

well, idk

wraith rapids
#

i mean

#

getFirst just iterates over it

#

and compares equals

mortal hare
#

add compile output

#

to the the artifact

#

by double clicking right side table

sullen dome
#

i think you mean this one right here?

mortal hare
#

and click ok

wispy monolith
mortal hare
#

and recompile artifact

wispy monolith
mortal hare
#

if it still persists

#

check the folder structure

sullen dome
#

this is how it should look like at the end tho

mortal hare
# mortal hare

you should throw your java files if you are using maven inside the java folder and resources inside resources folder

#

idk if that's the same with intellij build system

#

also if you somehow fucked up these folders

#

you need to remark them

#

in order for IDE to detect properly

sullen dome
#

oh my god

#

guys

#
    public static void addPermission(UUID uuid, List<String> permission) {
        File file = new File(plugin.getDataFolder(), "permissions.yml");
        if (!file.exists()) {
            try {
                file.createNewFile();
                FileConfiguration config = YamlConfiguration.loadConfiguration(file);
                config.set(uuid.toString(), permission);
                config.save(file);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

i sit here for like 1 hour, wondering why this isn't saving anything.
now i know why.
so please tell me why i'm dumb lol

wraith rapids
#

that looks horrible

sullen dome
#

lol

sullen dome
#

yeah, was pretty much just shaking my head agains whatever

#

if (!file.exists()) {
AHHHH

wraith rapids
#

reading and saving an entire file to add a permission

mortal hare
#

im pretty sure file.createNewFile() return boolean

#

which you can check if file is created

wraith rapids
#

make sure to modify player permissions in the player move event

sullen dome
#

i dont think i'll ever do that

wraith rapids
#

do you read the file every time from disk when checking the permission too

sullen dome
#

yeah, but when using that in commands it's not that performance-demanding

#

i'm not trying to link movement with an permission dud

wraith rapids
#

is that a rhetoric question or

#

reading an entire file every time you want to check a permission is omega pepega

mortal hare
#

does everyone know if the player.getOpenInventory().getCursor() is thread safe?

wraith rapids
#

lol

#

at long last I have found the answer to my question

sullen dome
#

i dont think i need to do smt different, when using this on my 4 players server

wraith rapids
#

nevermind

#

does anyone know the answer to this question

sullen dome
#

which question

mortal hare
#

i found an answer

#

which didn't made sense

#

since cursor would still be updated from the non volatile field

#

or wait

#

maybe it does

#

packet windowclick

#

pickup type

#

clicked item is cursor

sullen dome
#

let me guess... you still didn't got pm'd from bot bc of spamming?

#

bot just hates me

#

tells me i'm spamming
for 3 messages

wraith rapids
#

d

#

f

#

g

#

i think it only fires for repeated messages

#

g

#

yeah

sullen dome
#

i guess i'm going to sleep rn

#

good night boys and girls

wraith rapids
#

suffer

wispy monolith
#

I have the code inside java folder but inside package

#

So why it's not appering in jar file?

#

maven

wraith rapids
#

i am in the god damn matrix

#

this trie implementation is becoming more and more convoluted

wispy monolith
wraith rapids
#

i'm not an arab

#

so I have this list of item offers

wispy monolith
#

No

eternal night
#

?paste

queen dragonBOT
wraith rapids
#

and I want players to be able to search these offers by the item name

wispy monolith
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>MutualDamage1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>

    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>
eternal night
#

oof

#

tRie

wispy monolith
#

idk

#

What should I put?

#

my package?

#

Do I need to click this

#

isn't this going to delete my code?

wispy monolith
eternal night
#

Lets try to make it two :>

#

you can do it ๐Ÿ’ช

wispy monolith
eternal night
#

moderators do be dead ๐Ÿ˜ญ

#

pretty sure they see deleted messages xD

wispy monolith
#

@wraith rapids gimme ur thoughts about arab

eternal night
#

Wanna like move your brains thoughts that are not focused on coding out of this channel xD

#

๐Ÿ˜‚

#

good luck

vital ridge
#

Yo, anybody knows how can i make every enchantment special? Like i need to detect them that they are special and not multiplied before. I have a plugin what multiplies enchantments.

#

im currently stuck here

#

before

#

i added my enchantments to a list

#

and then checked if it doesnt contain

#

but that fked up since enchantments share all different names

#

like it multiplied 1 swords sharpness

#

but not other swords sharpenss

#

since the list arleady contained

#

sharpness

#

Well I cant understand that smar tpeople language yet

#

i thought i can but i cant

#

how can i get

#

enchantments arbitrary data

worldly ingot
#

Is it too much to fucking ask for the development channel to stay a fucking development channel?

#

Jesus Christ, I don't want to have to baby you

#

?kick @wraith rapids

queen dragonBOT
#

๐Ÿ‘ข Kicked NNYaKNpGms0eUVpiSdHx#5618

worldly ingot
#

?kick @mortal hare

queen dragonBOT
#

๐Ÿ‘ข Kicked Dovias#0629

eternal night
#

maybe go check some of their deleted messages

#

there is some rather racist stuff up above

mortal hare
#

im sorry

#

๐Ÿ˜ฆ

mortal hare
#

i didnt do any racist comments

#

but still disrespectful

eternal night
#

yeah, mostly the NNY guy

vital ridge
#

Yea nice i was just starting to understand what he said

#

and he doesnt accept my friend request

wraith rapids
#

do you need like a role or something to access the dev channel

#

some of my alts cant talk in here

vital ridge
#

NNYa

eternal night
#

pretty sure there are a bunch of pdc tutorials out there

wispy monolith
#

@mortal hare still doesn't compile the classes

vital ridge
#

im using pdc

vital ridge
#

But on my item meta

eternal night
#

oh hi its me

vital ridge
#

nnya

eternal night
#

i mean, item meta is the part where you use pdc on o.O

wraith rapids
#

that's you? i have a few bits of criticism for your resource

vital ridge
#

Iam using there

#

But the thing is, the enchantments will still be multiplied

eternal night
#

I could not care less about your input NNY xD

wraith rapids
#

i don't exactly remember what they are

#

but looking at the guide makes me feel awkward

eternal night
#

that is okay, you can also just read the javadocs for it

#

I am sure you'll get it!

#

the community here can also help you โค๏ธ

wraith rapids
#

is something wrong

#

you seem awfully sappy and pink colored all of a sudden

eternal night
#

just missed your opinion so much for the short time you were gone xD

wraith rapids
#

oh i wasn't gone

vital ridge
#

I arleady have pdc in my code with itemmeta

wraith rapids
#

what

obtuse basin
#

Is there a tutorial for integrating H2 DB into Spigot plugins?

wraith rapids
#

your issue is that you need to keep track of which enchantments you have multiplied already, yes?

#

or is this not the case?

vital ridge
#

Yes

#

I need to keep track

#

of the multiplied enchantmentsd

wraith rapids
#

store the list of multiplied enchantments in the pdc

vital ridge
#

Okay heres the first thing

#

if i add the multiplied enchantment in the list

#

Okay i rly dont know how to explain it very well tb

#

h

#

Is it sage

#

safe to store just enchantment names in the list?

#

Ahh you problaly didnt understand my plugin. If i enchant an itemstack, it multiplies its itemstacks

wraith rapids
#

ideally you would store the keys

#

Enchantment implements Keyed

#

that way it'll (probably) be compatible with custom enchant plugins

vital ridge
#

And all the enchantments have different keys?

wraith rapids
#

yes, that is the point of a key

vital ridge
#

aight

wraith rapids
#

every enchantment type in the game has a different key

vital ridge
#

Okay bout the namespacedkey

#

before i used a method that i

wraith rapids
#

don't even need to fetch them, can just check if the key of a specific enchantment is present in the set

eternal night
#

true that

vital ridge
#

Okay whatever

#

ill try

#

what ill come up with

#

and see wassup

#
main.multipliedEnchants.add(ench.getByKey(multipliedKeys));
#

i came up with this

#

Like its wrong ik

#

but i dont then understand the logic behind it

#

Other things like itemstacks etc ive used have getPersistentDataContainer, but enchants.. How can i get it by key if i havent even set the key. Or do i even have to? That enchantment bs doesnt make any sense to me

wraith rapids
#

get the persistent data container of the itemstack

#

write the list of enchantments you have multiplied for that itemstack in there

#

enchantments do not have a persistent data container

#

you do not get the enchant's persistent data container

#

you get the item's persistent data container

#

and put the enchantment's name in it

vital ridge
#

so as a string

#

nvm I think i understood u

vital ridge
wraith rapids
#

yes, you get the persistent data container from the item's item meta

#
Set<NamespacedKey> enchantsThatHaveBeenMultiplied = item.getItemMeta().getPersistentDataContainer().get(yourKeyForStoringTheSet, yourPersistentDataType);
#
if (enchantsThatHaveBeenMultiplied.contains(enchantToMultiply.getKey())) {
     //do not multiply
} else {
    //do multiply
    enchantsThatHaveBeenMultiplied.add(enchantToMultiply.getKey())
}
#

and then write the Set back into the persistent data container

wispy monolith
#

hmm how can I take a specific amount of health from player without using player.damage();

wraith rapids
#

uh

#

is there a setHealth method?

wispy monolith
#

yeah

wraith rapids
#

that seems like a possible choice

wispy monolith
#

What does that do?

wind lichen
wraith rapids
#

the whole jist of the ComplexRecipe is that the result is too complicated to really define in the contract

#

like, iirc removing dye from a leather armor piece is a ComplexRecipe

wispy monolith
#

ok I'll try

vital ridge
#

it wont let me use sets then

#

But sets are rly necessesary here

eternal night
#

Pretty sure NNY wants you to implement your own type

wraith rapids
#

yes, you should create a PersistentDataType<String, NamespacedKey>

wispy monolith
#

What should I type in the if statement to avoid doing a task if damage was caused of player.damage()?

wraith rapids
#

uh

#

check the damage cause and see if it's like UNDEFINED or something

#

or however that works, i'm not really sure

wispy monolith
#

What should I put here "something for player damage"

wraith rapids
#

the damage cause that player.damage() uses

#

whatever it may be

wind lichen
wispy monolith
#

And What is it? CUSTOM?

wraith rapids
#

well, yes, it's always an ItemStack

#

but see, the result may depend on the exact ingredients used

#

for example, the result of the tipped arrow recipe requires the potion item stack's data to tell what effects there'll be on the arrow

#

the recipe object doesn't have access to what's actually in the grid

#

it just tells what can be in the grid for it to be that recipe

wispy monolith
#

What is the cause of damage of player.damage();? this is why I asked bcz I tried doing it before But i didn't know the cause

wraith rapids
#

try it and see

wispy monolith
#

not a thing

eternal night
#

it should be GENERIC

wispy monolith
#

Let me try

#

.getDamager isn't a thing

eternal night
#

oh, DamageSource#GENERIC is mapped to DamageCause#CUSTOM

#

sorry ๐Ÿ˜…

wispy monolith
#

So it's custom

wraith rapids
#

peak bukkit moment

eternal night
#

yeah

#

there is some paper PR open to allow the plugin to define the DamageCause on invokation

#

but eh

#

not applicable here xD

wraith rapids
#

paper has that already i'm pretty sure

#

fingerguns

eternal night
#

oh did they pull it into master already

#

neat

wraith rapids
#

i remember seeing talk about it a good while ago

#

i'm assuming they've done it by now

wispy monolith
#

I got warned bcz I deleted the message to resend it but reply to him this time

#

cool innit?

wraith rapids
#

the bot is trash yeah

#

might be confusing it with the custom spawn cause for world::spawnEntity

eternal night
#

oh, nah #5191 is still not pulled into paper master ๐Ÿ˜ญ

wraith rapids
#

yeah just checked, not popping up in muh autocomplete

#

sad

eternal night
#

agreed. sadness

wraith rapids
#

oh well, reflection solves all problems

wispy monolith
#

I'm using this

EntityDamageEvent with ```java
if(event.getEntity() instanceof Player)

#

I use intellij so yeah

#

if (!event.getCause().equals(EntityDamageEvent.DamageCause.CUSTOM))

wraith rapids
#

use == when comparing enum constants

wispy monolith
#

I'm going to try

wispy monolith
wraith rapids
#

it would be the same

wispy monolith
#

So?

wraith rapids
#

you're supposed to use ==

eternal night
#

saves you a method invocation, actually probably not true xD

wispy monolith
#

I used .equals just to be sure that it's going to work

wind lichen
wispy monolith
#

How to swap players invs?

#

invs = inventories

sage swift
#

player.remove();

wispy monolith
sage swift
#

definitely

#

Inventory#getContents and Inventory#setContents

#

:)

wispy monolith
#

But I can't save the players invs in a list or something so alot of glitches happens

#

@sage swift

sage swift
#

huh

#

well you cant switch them at the same time

#

you gotta store one while you switch one way

wispy monolith
#

yeah

sage swift
#

then put the temp one into the other one's inventory

wispy monolith
#

But this will dupe inv

solemn gulch
#

how do i prevent an entity from slowing down after i set its velocity

for example i have this (its in kotlin but that doesnt matter)

val fb = sender.world.spawnFallingBlock(sender.location.add(0.0, 2.0, 0.0), Bukkit.createBlockData(Material.SAND))
fb.velocity = Vector(1.0, 1.0, 1.0)
fb.setGravity(false)

and initially it goes on for a while but after a bit it starts slowing down and eventually stops

wispy monolith
#

and alot other problems

sage swift
#

what

wispy monolith
#

How can I store the invs contents?

sage swift
#

getContents

wispy monolith
#

I tried lists but it saves the command not the contents

sage swift
#

ItemStack[] tempInv = player1.getInventory().getContents()

main dew
#

how to check if a player has permissions in luckperms?

sage swift
#

again, luckperms has their own discord

wispy monolith
# sage swift `ItemStack[] tempInv = player1.getInventory().getContents()`

this is my code

TimerTask task = new TimerTask() {
            @Override
            public void run() {
                List<Player> Players = new ArrayList(Bukkit.getServer().getOnlinePlayers());
                List<ItemStack[]> invs = new ArrayList();
                for (int i = 0; i < Players.size(); i++) {
                    invs.add(Players.get(i).getInventory().getContents());
                }
                for (int u = 0; u < invs.size(); u++) {
                    if (u == Players.size() - 1) {
                        Players.get(0).getInventory().clear();
                        Players.get(0).getInventory().setContents(invs.get(u));
                        Bukkit.broadcastMessage("Invs Swaped");
                    } else {
                        Players.get(u + 1).getInventory().clear();
                        Players.get(u + 1).getInventory().setContents(invs.get(u));
                        Bukkit.broadcastMessage("Invs Swaped");
                    }
                }
            }
        };
        timer.schedule(task, 10000, 10000);
sage swift
#

why do you need that

wispy monolith
#

I'm trying to swap players invs

glass sparrow
#

wtf

sage swift
#
ItemStack[] temp = player1.getInventory().getContents();
player1.getInventory().setContents(player2.getInventory().getContents())
player2.getInventory().setContents(temp)```
wispy monolith
glass sparrow
#

don't overcomplicate stuff

wispy monolith
glass sparrow
#

perform the algo alot of times

sage swift
#

repeat the center line for all players

#

preferably in a loop

wraith rapids
#

if you find yourself repeating yourself repeating yourself

#

you're probably going something wrong

sage swift
#

you know what i mean

wraith rapids
#

do the thing

#

you know

glass sparrow
#

the pp thing

sage swift
#

also im very happy and excited that your player set variable is capitalized

#

sorry, player list

glass sparrow
#

its exciting

sage swift
#

isnt it

frail burrow
#

how do you disable tnt explosion damage to players

#

ive tried making an unharmed fake explosion and tried setting getDamage to 0

#

doesnt work

eternal night
#

Yeah best bet is probably to listen to ExplosionPrimeEvent, check if it is tnt, cancel the event and create the explosion yourself

#

power has to be 0 I guess

waxen plinth
#

You do realize there's more than just a handful of topics to learn in order to code, right?

#

I'd guess the first one teaches more introductory concepts and the second one teaches more intermediate ones

modern fox
#

How could I change a passengers y to be higher?

paper viper
#

half of the stuff needed in just general coding isn't even found in courses

jagged root
#

how

#

dop

paper viper
#

nope

#

you arent ready yet lol

untold rover
#

Hey, whats the best way to get all chunks inside a Worldborder?

quaint mantle
paper viper
#

no please no lmao

crude charm
quaint mantle
#

player.getItemInHand().getItemMeta().getDisplayName().equals(CC.GREEN + "Toggle players " + CC.GRAY + "(Right Click)" Most likely .equals is null.

vernal basalt
#

anyone here ever used jackson api

crude charm
hoary tiger
summer scroll
#

Can someone explain to me, what the fuck is this? Just happened so randomly, on my localhost.

summer scroll
crude charm
#

was trying to debug it but my mc isn't starting lmfao

hoary tiger
summer scroll
hoary tiger
hoary tiger
young knoll
#
}```
quaint mantle
#

Anyone got a util for configs for bungee?

glossy scroll
#

hey im having a bit of trouble understanding perlin noise

#

im not exactly sure what the distribution is of the bukkit perlin noise impl

quaint mantle
#

If I use spigot 1.12 will it work in 1.8?

summer scroll
#

If you don't do anything with Off Hand on your code then it's fine.

quaint mantle
#

okay

summer scroll
#

and also other couple things

young knoll
#

Youโ€™ll have to use the deprecated methods

#

Since getItemInMaonHand isnโ€™t in 1.8

ivory sleet
sour sand
#

is there an event that runs every tick

opaque grove
#

How do i get a sign to edit the lines. I tried
Bukkit.getWorld("world).getBlockAt(x, y, z)
and
Bukkit.getWorld("world).getBlockAt(x, y, z).getState();

eternal oxide
#

getBlockData() and cast to Sign

lost matrix
quaint mantle
#

Which one to download?

eternal oxide
#

AdoptOpenJDK

robust forge
#

How can I set frosted ice age?

#

For example change blocks type to frosted ice with age of 2

robust forge
#

Thanks

quaint mantle
#

Do I need this to start coding?

eternal oxide
#

develop for Spigot 1.16 and use AdoptOpenJDK 11 or 15

quaint mantle
#

What?

eternal oxide
#

Everyone is moving away from Oracle as much as possible due to their behavior

quaint mantle
#

What behaviour

sage swift
#

oar uh cull

eternal oxide
#

Trying to copyright APIs

quaint mantle
eternal oxide
#

At first they succeeded and it would have destroyed Open Source.

#

yep

quaint mantle
#

16?

#

15 is not there

eternal oxide
#

Upto you. You can set the source version in your ide

#

I use 11

quaint mantle
#

Who is Jenkins?

eternal oxide
#

You don't need to know Jenkins for a LONG time

quaint mantle
#

okay, mr. British man

severe zenith
#

how to send messages with clickable text in bungeecord?

quaint mantle
#

How do I download Java?

cold field
#

Guys I need a little help about commodore

#

this is my .commodore file

quaint mantle
#

ok so how would I go about generating pvp arena's on the fly without making the server kill itself

drowsy helm
#

SlimeWorldManager is great for that stuff

#

or check out this:

grand coral
#

What is the best method to make a config file?

drowsy helm
#

spigot has a default method for it

#

saveDefaultConfig() will save a config.yml from your root to the plugin folder

flint elk
#

how can i change the skin from a player in tablist

drowsy helm
#

an existing player?

flint elk
#

no

#

I want to make a custom tablist with informations

drowsy helm
#

GameProfile has a properties map

#

one min ill show

flint elk
#

okay

#

thanks

drowsy helm
#

profile.getProperties().put("textures", new Property("textures", signature, textureBase64)));

#

just a matter of getting the signature and b64 of the skin

flint elk
#

like this? @drowsy helm

drowsy helm
#

yep

#

ah other way around

#

signature last

#

mb

cold tusk
#

How to send a colored message to a CommandSender?

flint elk
#

With ยง

#

lol

drowsy helm
#

can use the method in ChatColor

#

to translate alternate whatever

#

lemme find what it is holup

flint elk
drowsy helm
#

ChatColor.translateAlternateColorCodes('&', msg)

#

super verbose

#

ยง can be iffy

#

and requires UTF-8

#

so annoying

flint elk
#

buoobuoo now i have the signature but whats the value?

drowsy helm
#

i find it safer just to use &

#

value is the base64 of the skin

cold tusk
# flint elk With ยง

So you can easily use:

sender.sendMessage("ยงcYou have to be a player to use this command");
flint elk
#

ik lol

drowsy helm
#

yes

#

but again, safer just to use &

drowsy helm
#

and use a util class

#

whats the questions? I just answered it

flint elk
#

._.

drowsy helm
#

elaborate

#

?

flint elk
#

lol it works

maiden briar
#

org.bukkit.plugin.InvalidPluginException: Cannot find main class 'me.tvhee.main.Main'

#

Btw plugin to test my API

#

BukkitPlugin does extend JavaPlugin, and directly extending JavaPlugin also doesn't fix the error

drowsy helm
#

please dont name your package main lol

maiden briar
#

Yes I know, it is only a plugin for myself to test my API

drowsy helm
#

hm that is strange

#

tried different package name?

maiden briar
#

Ok I will try

#

me.tvhee.testplugin.TestPlugin

#

No it's not the fix

#

I also didn't misspell something

drowsy helm
#

hmm im not entirely sure tbh

maiden briar
#

Ok

#

If I use the direct arctifact from Intellij it works

#

API

@Override
    public final void onEnable()
    {
        instance = this;
        TvheeAPI.setInstance(new API(this));
        config = getAPI().createConfigFile("config.yml");
        System.out.println("onEnable bukkit plugin");
        onPluginStart();
    }```
TestPlugin:
```java
@Override
    public void onPluginStart()
    {
        registerCommand(new TestCommand());
        saveDefaultConfig();
        getConfiguration().set("testboolean", true);
        saveConfig();
        getLogger().info("Plugin started");
    }```
Why doesn't it get called? TestPlugin is overriding the onPluginStart() method
#

Oh nvm, used a too old version of my API

cold field
#

@wraith rapids sorry for the ping, but I need a person who knows how to use commodore. Do you mind?

chrome beacon
#

Commodore just allows you to use Brigadier

quaint mantle
#

How to see what the Artifact ID is in Eclipse?

cold field
#

the 4th line doesn't work

#

it doesn't do anything. Am i using it wrong?

chrome beacon
#

How are you registering the command

solemn shoal
#

imagine if there was a C# plugin compatibility layer for spigot plugins

quaint mantle
#

Olivo are you able to help me?

vast quest
#

How can I delete a yml

cold field
chrome beacon
solemn shoal
#

for specifically spigot?

wraith rapids
#

48% of transpilers commit suicide

chrome beacon
cold field
#

๐Ÿ˜ฆ

chrome beacon
quaint mantle
#

@wraith rapids How to see what the Artifact ID is in Eclipse?

wraith rapids
#

you define it

#

you write your artifact id in your pom

quaint mantle
#

I forgot what I defined it as

chrome beacon
#

Stop pinging random people

wraith rapids
#

then go fucking look

#

open up your pom

#

and use your eyes

solemn shoal
#

if java supported COM calls you'd be able to use C# lol

quaint mantle
#

Is this bad?

wraith rapids
#

use your brain

vast quest
#

why would it be

wraith rapids
#

one of those is for your project

#

the other is not

#

can you tell which is which

quaint mantle
#

So should I rename it?

wraith rapids
#

why would you rename it

chrome beacon
quaint mantle
#

idk

vast quest
#

How can I delete a file like... idk config.yml

quaint mantle
#

I am stupid

vast quest
#

on enable

quaint mantle
#

I don't know how this stuff works

solemn shoal
wraith rapids
#

you're not stupid

quaint mantle
#

Do I keep it that way?

wraith rapids
#

you just refuse to read up on it and learn

#

you're lazy

cold field
wraith rapids
#

which is worse than stupid

quaint mantle
#

Where do I read up on it?

wraith rapids
#

on the internet

quaint mantle
#

oof

solemn shoal
chrome beacon
wraith rapids
#

try googling "how maven works" or something

quaint mantle
#

Is using IntelliJ easier?

solemn shoal
#

i didnt even know java supported header files?

#

oh wait thats c++

chrome beacon
#

Mhm

wraith rapids
#

it can be

solemn shoal
#

i guess you'd use C++ as middleware

#

since you can do COM+ calls through C++

quaint mantle
#

I don't know what my groupID is

wraith rapids
#

you have written your group id

#

go look at your pom

cold field
#

ahahhahahaha

quaint mantle
#

I meant GroupName

vast quest
wraith rapids
#

there is no such thing as group name

quaint mantle
#

This is on the wiki

chrome beacon
wraith rapids
#

that's just the guide being dumb

quaint mantle
#

What do I do now?

wraith rapids
#

what is your artifact id

cold field
solemn shoal
#

tfw jetbrains rider committed die on me

quaint mantle
#

It's Soldier

wraith rapids
#

i saw that

#

and what is your group id

chrome beacon
quaint mantle
#

my.soldier.here

cold field
wraith rapids
#

now, what you are trying to do right now is figure out your 'plugin package'

#

this is the package where your plugin's code is

cold field
#

I'm using spigot to register the commands

wraith rapids
#

it should be unique to your plugin

quaint mantle
wraith rapids
#

the convention is to make it 'groupId'.'artifactIdInLowerCase'

#

do you still remember your group id

quaint mantle
wraith rapids
#

good, now, write it down

#

then, add a . at the end

#

do you still remember your artifact id?

quaint mantle
#

Did I do it wrong?

wraith rapids
#

that's correct

#

however, now there is an issue

chrome beacon
# cold field I'm not using brigadier.

But you asked how to do it with commodore ;/. Oh well then just add your command to your plugin.yml and then you getCommand and set the executor on enable

wraith rapids
#

look at the sidebar on the left

#

the one with the project structure

quaint mantle
cold field
wraith rapids
#

Soldier
src/main/java
soldier
Soldier.java

quaint mantle
#

I'm looking

wraith rapids
#

this should match the text you write on the first line of a class

#

which it does not

#

now, if you were using intellij, I could tell you how to move your package so it matches

quaint mantle
#

Should I download it?

wraith rapids
#

no, you don't download it

#

you write it

#

it's your plugin

quaint mantle
#

No, IntelliJ

chrome beacon
#

Please look at a basic Java tutorial

quaint mantle
#

I can install IntelliJ if you want me to

wraith rapids
#

you can try it i suppose

quaint mantle
#

Okay, I'll download it

vast quest
#

I can send you some tutorials if you want

quaint mantle
#

yes

wraith rapids
#

i've already linked you the intellij maven tutorial several times

cold field
#

anyway olivo. I am able to use commodore. It doesn't give any errors. It even does the auto-completation. The problem is that I don't know how to use commodore

wraith rapids
#

this time, you're going to have to find it yourself

vast quest
#

ight imma send u in dms

quaint mantle
vast quest
#

I have sent him all he needs

cold field
#

I don't know how should I format the .commodore file

wraith rapids
#

you can't send him effort and the conviction to pull through

#

which is what he needs

quaint mantle
#

I'm trying

#

how do people code like the plugin works in both 1.16 and 1.8

chrome beacon
wraith rapids
#

either multi-module project layout or reflective fucknuggetry

#

either way it's 10x the effort

chrome beacon
#

^^

wraith rapids
#

and not worth the time

cold field
#

What does the 4th line do?

#

I write it but i don't know what it does...

#

XD

chrome beacon
#

._.

cold field
#

it doesn't do anything in game....

#

sooo

cold field
wraith rapids
#

i should write myself a brigadier library at some point

cold field
#

make it public

#

XD

wraith rapids
#

i doubt i'd have the effort to make it public

cold field
wraith rapids
#

i don't really use brigadier

#

or commodore

cold field
#

๐Ÿ˜ข

#

I'm stuck with my problem..

wraith rapids
#

i find just tab completitions to be enough most of the time

cold field
#

I'm using commodore over spigot (idk how to use brigadier) just for tab-completations

#

it works

vague cloud
#

How can I achieve this?

Basically I have 2 H2 databases (that contains some duplicated data) that I need to merge to 1, it's for a LiteBans database.

vast quest
#

remove the duplicate data

sullen dome
#

same for brigadier lol

quaint mantle
#

How do I do this?

wraith rapids
#

do not follow that guide

#

that is not for maven

sullen dome
#

but yeah, if you use maven, use the pom.xml-way instead. i suggest the intellij-plugin Minecraft-Development, that does all of that automatically

minor garnet
#

why i getting a diferent location ?

wraith rapids
#

you are either serializing or deserializing it wrong

minor garnet
#

yes

wraith rapids
#

your code is unintelligible

minor garnet
#

what code ?

wraith rapids
#

that "should" work

minor garnet
#

?

wraith rapids
#

print out some debug or stick it into a debugger and see what is going wrong

minor garnet
#

alright

#

i already found my problem

#

i getting block else of location

wraith rapids
#

you are getting the block location yes, not the full precision location

#

you are also not serializing the direction of the location, but idk if that's intentional or not

minor garnet
#

i need too xd

wraith rapids
#

unless you want your data to be human readable, you probably also want to serialize the world to its UUID rather than its name

#

that way, if someone renames a world or something, your database doesn't explode

minor garnet
wraith rapids
#

yes, the full location is not an Integer

#

it is a floating point number

#

don't call Integer.parseInt() on values that aren't integers

minor garnet
#

i'm making the code, in addition to adding new things, fixing new things and adding new errors, you know

minor garnet
#

I would probably add an error in the gui

near crypt
#

how can i teleport a player to a specific lacation for example 10 2 14?

#

location

wraith rapids
#

player.teleport(location)

eternal oxide
#

I'd try player.teleport

near crypt
#

yes but how can i define the location variable

wraith rapids
#

Location location =

eternal oxide
#

new...

wraith rapids
#

then construct a new Location that represents the coordinates you want

near crypt
#

and after the =?

wraith rapids
#

there you construct your Location

near crypt
#

but where can i give the coordiantes?

wraith rapids
#

in the constructor parameters

eternal oxide
#

?jd

eternal oxide
#

look up Location

wraith rapids
#

see the constructor documentation

sullen dome
#

new Location(world, x, y, z yaw, pitch));

hate me guys

wraith rapids
#

i'll shove a spoon up your ass

sullen dome
#

tf

#

i love hate, hell yeah

#

it's the same result as letting him look at the doc tho. just saves him time

#

an we haven't much time :/

wraith rapids
#

it does save him time

#

but it also saves him the experience of understanding what the fuck he is doing

#

he'll be back here asking how to construct a player next

eternal oxide
#

I got my mummy player and my daddy player...

sullen dome
#

she calls me puppy like an english dog

#

i dont think that makes sense in english tho

eternal oxide
#

Not really

sullen dome
#

papi basically means daddy lol

severe zenith
#

how to configure the tab complete to a bungeecord command?

lean bone
#

I'm trying to register a custom event (in Kotlin). This is the code for the event itself, and in the class it is in I have another event (not custom). When I register the event, I get an exception (org.bukkit.plugin.IllegalPluginAccessException: java.lang.NullPointerException). If I remove the code from the custom event, this does not happen. Could anybody help me with this?

#

The class from the event itself

eternal oxide
#

EventManager.kt:77

quiet ice
#

Report this to the maintainers of com.dualipa.song:Levitating-Base-English:jar:1.0-20210430.184020-2

#

It's not an issue of yours; they are likely using the system scope somewhere

lean bone
# eternal oxide EventManager.kt:77

Yeah I got that, but that just leads to the following line: Bukkit.getPluginManager().registerEvents(RegionEvents(), BandiCore.instance!!)

eternal oxide
#

isn;t guava shaded in Spigot?

unreal quartz
#

is there really a namespace com.dualipa.song

#

lol

young knoll
#

What even is that

patent cargo
#

how can i check if player has a diamond pickaxe named "something" in their hand?

#

im trying to make a pickaxe that makes everything drop twice

#

if the name is right

eternal oxide
#

Don;t use teh item name

#

item names can be changed in an Anvil

patent cargo
#

yeah i know

wraith rapids
#

store a ID in the persistent data container of the item

#

then check for that ID

patent cargo
wraith rapids
#

look up a guide

#

"how to use persistent data container spigot" + google

#

then skip the youtube videos

#

those are trash

patent cargo
#

thanks

lean bone
quaint mantle
#

My plugin doesn't work

package someboodi2.soldier;

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

public final class Soldier extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getLogger().info("onEnable is called!");

    }

    @Override
    public void onDisable() {
        getLogger().info("onDisable is called!");
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onLeaveBed(PlayerBedLeaveEvent event) {
        Player player = event.getPlayer();
        player.sendMessage("You left a bed");
    }
}
wraith rapids
#

we have been through this before

#

"doesn't work" does not tell us anything

#

also

#

take a good look at what you are doing

#

use your eyeballs and then your brain

#

onEnable is called when the server starts, the plugin loads

#

onDisable is called when the server stops, the plugin unloads

#

can you see the issue?

quaint mantle
#

oofy

weary fossil
#

someone can helpme?

wraith rapids
#

other than that, yes, very good progress

#

you've been able to do something on your own for once, I think

eternal oxide
wraith rapids
#

kotlin is gay

weary fossil
#

i need to verify an data archive with my plugin on a command, but does work :c

wraith rapids
#

gayest shit ever

#

@rotund ravine come help this guy

eternal oxide
#

debug your issue. The npe is thrown in that register line. So either the class is null or the instance is null

maiden briar
wraith rapids
#

you are triggering server ping event asynchronously

maiden briar
#

And how to trigger sync?

wraith rapids
#

do it on the main thread

weary fossil
#

if closed false, turn "closed" to true, if true return the "already closed message"

maiden briar
#

Bukkit.getServer().getScheduler().runTask() ? But I am already doing that

wraith rapids
#

something somewhere is making it happen off the main thread

maiden briar
#

Look in the class

#

I can't return the serializer then

wraith rapids
#

i can't see shit in your class

#

it's all unintelligible

#

print out the current thread you're on and see where your stuff is running

#

if it's something you can block, you can sync to main thread and fire the event there, and then block until that is done

#

and then return your serializer or whatever you're doing

quaint mantle
#

How do you guys word wrap on IntelliJ?

wraith rapids
#

actually, show me your stack trace

#

you're supposed to word wrap manually

#

by pressing enter before the vertical line on the right

quaint mantle
#

why manually?

ivory sleet
#

?paste

wraith rapids
#

that's just how it is

queen dragonBOT
maiden briar
#

Ok I will show the stacktrace

wraith rapids
#

line breaks are part of your code and shouldn't be diddled with by some line break automation

maiden briar
wraith rapids
#

yeah this happens off the main thread

#

your code is invoked whenever a packet is received

maiden briar
#

Ok, but how?

wraith rapids
#

it is invoked by what I assume to be protocollib

#

or you might just be hooking directly into netty

#

regardless, it's not the main thread, it's some networking thread somewhere

maiden briar
#

The problem is that the bukkit method is a void method, and I can't return the serializer. It worked before, but I since I call it inside it doesn't work

eternal oxide
#

what is PingModifier.java:109

wraith rapids
#

like I said

#

you can still return

quaint mantle
#

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Iterable

maiden briar
#

Bukkit.getServer().getPluginManager().callEvent(event);

wraith rapids
#

you just need to create an object to hold onto what you want to return

eternal oxide
#

that line is being called async

wraith rapids
#

since it needs to be final

maiden briar
#

Ok I want to return JsonSerializer<?>, and set it into the Gson

wraith rapids
#

f.e

Serializer[] returnMySerializer = new Serializer[1];
Bukkit.getScheduler().runTask(() -> {
    //compute the thing here, write it to the array
});
//block execution until runTask completes
#

and then return returnMySerializer[0]

maiden briar
#

Ok thanks

wraith rapids
#

remember to block the execution

maiden briar
#

And how to block?

wraith rapids
#

use futures or object monitors

maiden briar
#

That is exactly the problem

#

I can't work with futures

wraith rapids
#

why

#

f.e

CompletableFuture<Serializer> returnMySerializer = new CompletableFuture<>();
Bukkit.getScheduler().runTask(() -> {
    //compute the thing here, write it to the array
    returnMySerializer.complete(//your result);
});
return returnMySerializer.get();
#

.get blocks until the future is completed by the code on the main thread

#

and then returns the value it was completed with

maiden briar
#

Ok, and I can set the .get into the Gson?

wraith rapids
#

what

#

it's a return value

maiden briar
#

I will first try, then I will speak any further

wraith rapids
#

you can do whatever with it

maiden briar
#

Ok thanks

quaint mantle
#
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Iterable
#

this is the error i get

wraith rapids
#

String cannot be cast to Iterable

#

String is not iterable

quaint mantle
#

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

public final class Soldier extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getLogger().info("onEnable is called!");
        getServer().getPluginManager().registerEvents(this, this);

    }

    @Override
    public void onDisable() {
        getLogger().info("onDisable is called!");
    }

    @EventHandler
    public void onLeaveBed(PlayerBedLeaveEvent event) {
        Player player = event.getPlayer();
        player.sendMessage("You left a bed");
    }
}```
wraith rapids
#

send the stack trace

maiden briar
#
[14:55:42 WARN]: [TestPlugin] Task #523 for TestPlugin v1.0.0 generated an exception
java.lang.IllegalArgumentException: null
    at com.google.gson.internal.$Gson$Preconditions.checkArgument($Gson$Preconditions.java:46) ~[patched_1.16.5.jar:git-Paper-597]
    at com.google.gson.GsonBuilder.registerTypeAdapter(GsonBuilder.java:472) ~[patched_1.16.5.jar:git-Paper-597]
    at me.tvhee.api.PingModifier.lambda$onServerListPing$0(PingModifier.java:61) ~[?:?]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-597]
    at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-597]
    at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1423) ~[patched_1.16.5.jar:git-Paper-597]
    at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:418) ~[patched_1.16.5.jar:git-Paper-597]
    at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1338) ~[patched_1.16.5.jar:git-Paper-597]
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1126) ~[patched_1.16.5.jar:git-Paper-597]
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-597]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281]

At this line: .registerTypeAdapter(serverPingClass, getSerializer())
Class: https://paste.md-5.net/ebiliyovax.java

wraith rapids
#

one of the arguments is null

#

either serverPingClass or getSerializer()

maiden briar
#

Both are not null

wraith rapids
#

one is

#

preconditions doesn't lie

maiden briar
#

I will try CompletableFuture#thenAccept

wraith rapids
#

you are literally returning null

maiden briar
#

Yes if there is an error

ivory sleet
#

Wat

wraith rapids
#

also that still runs off the main thread

severe zenith
#

how to get offline players in bungeecord

wraith rapids
#

youa re just creating the serializer on the main thread

maiden briar
#

java.lang.IllegalStateException: ServerPingEvent may only be triggered synchronously.

wraith rapids
#

the serialization itself is still done off the main thread

#

which means your event is also fired off the main thread

maiden briar
#

What to do then?

ivory sleet
wraith rapids
#

run the event on the main thread

#

wrap it in bukkit.runtask

#

you have wrapped the creation of your serializer in bukkit.runtask

maiden briar
#

Ah

wraith rapids
#

you have not wrapped the contents of your serializer in bukkit.runtask

cold field
#

does anyone know a collection class that allows me to write from a thread and concurrently read from another?

maiden briar
#

Now just set the thing into the ServerListPingEvent into the runTask?

#

A new one

wraith rapids
#

remove the old one

#

it's pointless

maiden briar
#

Ok

wraith rapids
#

create the same future logic for the event

#

and only the event

ivory sleet
#

CopyOnWriteArrayList
Collections.synchronizedList synchronizedSet
ConcurrentHashMap.newKeySet()
@Mr.EmPee#8047

cold field
#

Thanks

maiden briar
ivory sleet
#

Or just synchronize a non thread safe collection externally

cold field
#

Yeah that was the second option

wraith rapids
#

you return whatever information you need

#

if you need the event, you return the event through the future

ivory sleet
#

Depending on situation, synchronized keyword or Lock interface might be better

cold field
#

really?

ivory sleet
#

If youโ€™re making it thread safe externally yeah

cold field
#

oh ok

#

I thought you were saying they were better than using the ready-made class

ivory sleet
#

Assume you only have 2 threads both reading and writing to the collection for instance a single thread executor and the server thread. Then use synchronized itโ€™s faster when the amount of threads are lower. But letโ€™s say you use a thread pool like a fork join pool in that case Lock interface may perform better (more amount of threads)

#

No

#

If you can, use a thread safe collection

cold field
#

mhmh understood

#

thanks

ivory sleet
#

It will abstract away the need of implementing synchronization in a multithreaded environment. Needless to say java does a decent job optimizing those ones.

wraith rapids
#

meanwhile i'm still writing my trie

maiden briar
#

callServerPingEvent(serverPing).thenAccept(event ->
But how am I going to return the JsonObject then?

wraith rapids
#

normally

maiden briar
#

No that is not possible

ivory sleet
#

What are you doing precisely? TL;DR

wraith rapids
#

he's trying to run an event on the main thread

#

and then use the result of that event for a task that's running on a netty thread or something

maiden briar
#

Oh it is actually working, returning the thing

wraith rapids
#

baby's first concurrency steps

ivory sleet
#

Lol

maiden briar
#

Yep

#

I can better use paste?

#

?paste

queen dragonBOT
maiden briar
wraith rapids
#

what is the impl of callServerPingEvent

maiden briar
#
private CompletableFuture<ServerPingEvent> callServerPingEvent(ServerPing serverPing)
    {
        CompletableFuture<ServerPingEvent> futureEvent = new CompletableFuture<>();

        ServerPingEvent event = new ServerPingEvent(serverPing);
        Bukkit.getServer().getPluginManager().callEvent(event);
        futureEvent.complete(event);

        return futureEvent;
    }```
cold field
#

Is there a method to loop though a player inside a location range or do I need to built it myself?

rotund ravine
#

@wraith rapids whay

wraith rapids
#

nothing

wraith rapids
#

there was a guy needing help with kotlin earlier

cold field
#

k

wraith rapids
#

figured your princess gloves could be put to use

cold field
#

thanks

wraith rapids
#

wrap the callEvent in bukkit.runtask

#

and complete the future with the event in the lambda

maiden briar
#

I done that

wraith rapids
#

you haven't

maiden briar
#

I will do the bukkitruntask now

wraith rapids
#
private CompletableFuture<ServerPingEvent> callServerPingEvent(ServerPing serverPing)
    {
        CompletableFuture<ServerPingEvent> futureEvent = new CompletableFuture<>();

        final ServerPingEvent event = new ServerPingEvent(serverPing);
        bukkit.runtask(() -> {
            Bukkit.getServer().getPluginManager().callEvent(event);
            futureEvent.complete(event);
        });

        return futureEvent;
    }```
maiden briar
#

Ok

wraith rapids
#

then call .get() on the return value of this method

#

to get the event

weary fossil
#

some one can help me?

wraith rapids
#

the event has already run

#

you can use it as if it was any other object

#

you don't need thenX blocks or anything

daring sierra
queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

weary fossil
# daring sierra ?ask dont ask to ask

i need to verify the ticket ID are closed,
the constructor is:
'ticketID(int)':
closed: 'false'
on the archive, i want to make the command change "closed" to "true" on /helper close "ticketID(int)"

#

but, when i execute the command

#

don't change in the tickets.data

#

stay "closed" "false"

maiden briar
#

Remote "true", and use true without "

weary fossil
#

is not a boolean

#

is a string

maiden briar
#

I think he want to set a boolean in the config like true of false

weary fossil
#

dont

#

i cant

maiden briar
#

Then don't use ", otherwise it will become a string

weary fossil
#

the constructor os those classes are string

maiden briar
#

Make then booleans

#

true or false is a boolean

weary fossil
#

i cant

wraith rapids
#

sure you can

weary fossil
wraith rapids
#

you can

maiden briar
#

I am testing now

weary fossil
#

i use mysql too

wraith rapids
#

that doesn't mean that everything needs to be strings

#

Boolean.valueOf()

#

String.valueOf()

#

you can convert types from one another

maiden briar
#

Learn Java

wraith rapids
#

always use the correct data type in your code

#

if you need it as a string later, convert it to string

weary fossil
#

but you don't understand

maiden briar
#

You had it right @wraith rapids , I fixed it

#

Thanks!

weary fossil
#

i can't cast string to boolean when i using other api methods, i have erros when i do this

wraith rapids
#

yes.

modern fox
#
public class FlashPet extends Pet {

    @Override
    public String getName() {
        return "Flash";
    }

    @Override
    public String headValue() {
        return "id";
    }

    @Override
    public PetAbility getAbility() {
        return new SpeedAbility();
    }

    @Override
    public int getValue() {
        return 15;
    }

}

How would I make the SpeedAbility a instance for every player instead of creating a new instance always

wraith rapids
#

casting is not converting

#

casting does not convert anything

#

you need to convert your boolean to a string, or vice versa

#

Boolean.valueOf(string)

#

String.valueOf(boolean)

#

learn java

weary fossil
#

again

#

you

#

dont

#

not

wraith rapids
#

you clearly don't

weary fossil
#

understand

wraith rapids
#

i do

#

i understand that you have no idea what you're doing

#

and are trying to cast Strings into booleans

weary fossil
#

its my code

#

or

#

your code?

eternal oxide
#

You can cast Entity to LivingEntity because one extends/implements the other. You can NOT cast String to Boolean because they are in no way connected.

wraith rapids
#

bad code is bad code

weary fossil
wraith rapids
#

you are not receiving of support

#

we have told you what you need to do

weary fossil
#

sure

wraith rapids
#

you refuse to do it

maiden briar
#

In earlier times I also didn't agree, but learn Java, then you will understand

summer scroll
modern fox
#
public class FlashPet extends Pet {

    @Override
    public String getName() {
        return "Flash";
    }

    @Override
    public String headValue() {
        return "id";
    }

    @Override
    public PetAbility getAbility() {
        return new SpeedAbility();
    }

    @Override
    public int getValue() {
        return 15;
    }

}

How would I make the SpeedAbility a instance for every player instead of creating a new instance always

wraith rapids
#

declare a field for it somewhere, instantiate and assign it

#

then retrieve it instead of constructing a new one

modern fox
#

Well, I want it different from players

summer scroll
#

Create something like SpeedAbilityManager class maybe.

wraith rapids
#

create a playerdata class and assign it there

#

then maintain a single instance of playerdata for each player

modern fox
#

Well as Every Ability inherits from PetAbility which just looks like this

public abstract class PetAbility {

    public abstract String getName();
    
    public abstract String getDescription(int value);
    
    public abstract void onEquipped(Player plr, Pet pet, int value);
    
    public abstract void onDequipped(Player plr, Pet pet, int value);
    
}

wraith rapids
#

not relevant to how you maintain the instances of them

modern fox
#

I do not need to keep the same instance on restart meaning I do not need to make a data class of it

#

I just want different instances for the petability for each player

wraith rapids
#

that is not what a data class does

modern fox
#

Oh nvm

wraith rapids
#

if you need to hold a specific instance of this class for each player, then you need some sort of a holder for each player

modern fox
#

I know what you mean

wraith rapids
#

therefore, create a playerdata class which will hold the instances, and instantiate one for each player

modern fox
#

Okay