#help-development

1 messages · Page 1885 of 1

spiral light
#

if this was in the api and i used all the years split and so on for this i would explode 😄

hardy swan
#

Try see which is the one giving the null value

#

I assume this is line 33?

#

yea then before that line executes try finding out which step gave that null

#

is it p? p.getWorld()?

#

did you execute it using console? lol

humble prairie
#

Does anyone know how i can place a log that is looking sideways? Every log that my script places is looking upwards

crimson verge
#

don't know crap about script, can only help ya if you're coding with Java and spigot lol

tardy delta
#

how people dare to use script

#

and come here

crimson verge
#

lmfao

hardy swan
#

is there a method in java that allow you to run c code

sacred mountain
#

doubt it lol

vocal cloud
crimson verge
#

sounds like a mess waiting to happen lmao

tardy delta
#

wasnt there a way to execute JS code tho?

vocal cloud
#

Yes java has a native JS reader boi

tardy delta
#

i thought i saw it somewhere

tardy delta
#

oh yes that

hardy swan
#

oh JNI was what i was looking for

#

and the native keyword

tardy delta
#

if you want to execute it directly from java code hmm

hardy swan
#

no thanks, just wanted to know

#

haha

paper viper
#

you can however, call methods from C shared libraries

#

(dll on windows, dylib on mac, so on linux)

ivory sleet
#

pulsebeat C enthusiast 😮

paper viper
#

i wish

ivory sleet
#

lol

hardy swan
quiet ice
vocal cloud
#

Yeah I imagine it's kinda useless lul

#

and probably a huge vulnerability

hardy swan
#

Nashorn4j exploit

quaint mantle
#

GraalJS good

#

Welp, it is not too bad for scripting engines

feral egret
#

How can I save a hashmap and load it back in on reload?

tardy delta
#

save it to a file

#

depending on what kind of data

feral egret
#

public static Map<String, Integer> playerIDs = new HashMap<>();

#

That's the hashmap that I wanna store, I've tried in-built bukkit methods and looked up docs for the past 3 hrs but I can't find anything on it

tardy delta
#

loop over the map

#

i kinda forgot how to save a map

feral egret
#

I don't know how to save in the first place tho 😢

tardy delta
#

ah like this

#

i like Map#forEach with (key, value) -> more

feral egret
#

I'll watch that vid again, I watched it earlier but couldn't get it working but I'll try again

tardy delta
#

its maybe not the best way

feral egret
#

I got the read part working but not the write part

tardy delta
#

the writing part isnt difficult as you work with primitives

quiet ice
#

Well, wrappers of primitives

tardy delta
#

well they both arent

#

true

#

easier than like itemstacks

#

but what does that data represent?

quiet ice
#

Also, I personally prefer DataOutputStream if you don't need it to be writable by a human. Saves on a lot of memory overhead imposed by yaml parsing

tardy delta
#

maybe saving it in the PersistentDataContainer would work tho

#

if it makes sense

feral egret
#

And will it auto save to config.yml?

tardy delta
#

you have to call the code if you want

#

also fileConfiguration.save(file)

quiet ice
#

Something like this would basically be

try (DataOutputStream out = new DataOutputStream(new FileOutputStream(new File(getDataFolder(), "ids.dat")))) {
    out.writeInt(playerIDs.size());
    for (Map.Entry<String, Integer> entry : playerIDs.entrySet()) {
       out.writeUTF(entry.getKey());
       out.writeInt(entry.getValue());
    }
} catch (IOException e) {
    throw new RuntimeException(e);
}
tardy delta
#

or just use the fileconfig api

quiet ice
#

Reading would be

try (DataInputStream in = new DataInputStream(new FileInputStream(new File(getDataFolder(), "ids.dat")))) {
    int size = in.readInt();
    if (playerIDs == null) {
       playerIDs = new HashMap(size);
    } else {
       playerIDs.clear();
    }
    for (int i = 0; i < size; i++) {
        playerIDs.put(in.readUTF(), in.readInt());
    }
} catch (IOException e) {
    throw new RuntimeException(e);
}
#

See, much nicer and far more compact on memory!

tardy delta
#

finally someone who uses try with resources :D

tender shard
#

Anyone know how I can get an NMS ComposterBlock from a regular BukkitBlock?

#

((CraftBlock)bukkitBLock).getHandle() returns a LevelAccessor

#

I need an NMS block though

tardy delta
#

if doing a calculation with an Integer object, it will call .intValue() right?

tender shard
tardy delta
#

ah right

#

its weird that you cant just do like a Dictionary<string, int> in c#

#

with primitives

quaint mantle
tardy delta
#

yea

quaint mantle
#

because primitives does not extend object

tardy delta
#

and something that extends object is required

quaint mantle
#

But it probably will be possible in next java versions

#

yep; thats the generics contract

tardy delta
#

its possible in dotnet :D

#

ah i get it like <T extends Object>

brave sparrow
#

It’s required because the compiler removes the <T> and replaces it with just Object types

glossy venture
#
Bukkit.getServer().getServicesManager().register(Permission.class, instance, pl, ServicePriority.Highest);

is this the correct way to implement a vault service

brave sparrow
#

The generics are for compile time type checking

#

And automatic casting

brave sparrow
tardy delta
#

or just <?>

quaint mantle
brave sparrow
tardy delta
#

oh

brave sparrow
#

For example, in C++ the template system compiles a separate version of the templated class for each “type”

quaint mantle
#

Fastutil will became useless

brave sparrow
#

So if my program uses vector<int>, vector<ClassA> and vector<ClassB>, the compiler is going to compile 3 versions of vector, with all the templates changed to each type respectively

#

In Java we instead compile just one, and replace everything with Object

tardy delta
#

so its much easier for the compiler?

quaint mantle
#

Ah, thats similar to how fastutil works

#

Int2Object Map, Long2DoubleMap, Char2ShortMap...

glossy venture
quaint mantle
#

Thats where modularity starts helping

glossy venture
#

it depends on the whole plugin

quaint mantle
#

Mock some parts

glossy venture
#

ok i looked at vault source thats how they do it so thats how i will do it

quiet ice
#

yep, that is the correct way to do it

sterile token
#

A secure way of saving private credentials on plugins?

sterile token
#

Properties file can be read as txt, json or yaml files?
Or they save content like hash/with protection

trim surge
#
• Developer & Technician
• Java, and others``` 
🤔
trail dragon
#

Is there an event that can detect if a players armour breaks?

tardy delta
#

itembreakevent? is there one?

sterile token
quiet ice
trail dragon
tardy delta
#

armour is an item ._.

sterile token
quiet ice
#

You should limit its powers as much as possible, there is no real way to store it "safely"

sterile token
#

Properties file can be read as txt, json or yaml files?
Or they save content like hash/with protection

trail dragon
crimson verge
#

ye

#

getBrokenItem()

#

and go from there

trail dragon
#

ahhhhh

#

right thank you!!!

crimson verge
#

np!

quiet ice
#

If you are really paranoid about it, use JNI and use the API key there. As soon as it gets into the JVM you are out of luck

sterile token
#

I cannot use JNI

quiet ice
#

You can as far as I know

sterile token
#

Lol really?

quiet ice
#

You might not be able to publish it to spigotmc though

vocal cloud
#

I mean you're API key is only as secure as the system it's running on. Once you load it it's in memory

quiet ice
#

If the damage of having the API key published publicly is next to nil, do not bother. To limit damage you can e.g. have a 1 key per jar type of thing

#

Plus having any protection on anything will just pull attention towards it.

sterile token
#

Ah you make reference to having 1 key hash each plugin let say

#

Thanks

quiet ice
#

No, 1 key hash each download/user. Would require dedicated infrastructure, but possible

sterile token
#

Im between NodeJS RestAPI or C# Websocket

#

I have seen that from java you can execute C# methods

#

So i will think a trick

left swift
#

When i use remmapped mojang spigot nms i have that error, why? maybe my maven md-5 plugin is wrong configuredfix Caused by: java.lang.ClassNotFoundException: net.minecraft.world.entity.EntityType$EntityFactory at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] ... 12 more

spiral light
#

can you send pom ?

quiet ice
#

You could just have a regular http server written in java

left swift
# spiral light can you send pom ?
<plugin>
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-obf</id>
                        <configuration>
                            <srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                            <reverse>true</reverse>
                            <remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                            <remappedArtifactAttached>true</remappedArtifactAttached>
                            <remappedClassifierName>remapped-obf</remappedClassifierName>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-spigot</id>
                        <configuration>
                            <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                            <srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                            <remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>```i want to us it on 1.18.1
vocal cloud
#

For chonker amounts of text use pastebin please

quiet ice
#

not that much tbh

left swift
trail dragon
#

hm @crimson verge how would I fix this?

Operator '==' cannot be applied to 'org.bukkit.inventory.ItemStack', 'java.lang.String'

if(p.hasPermission("test.playing") && e.getBrokenItem()=="NETHERITE_BOOTS"){

hasty prawn
#

e.getBrokenItem()=="NETHERITE_BOOTS"

#

Those can never be the same thing

crimson verge
#

Material.NETHERITE_BOOTS

hasty prawn
#

^

trail dragon
hasty prawn
#

And use getType() on the ItemStack

crimson verge
#

^^

quiet ice
trail dragon
quiet ice
#

That's Java 5 javadocs or something

indigo cave
#

E:\Coden\Java\Minecraft\Plugins\AirDropRebornNew\v1_17\src\v1_17\entitiy\AirDrop.java:68:103 java: cannot find symbol symbol: method sendPacket(net.minecraft.network.protocol.game.PacketPlayOutExplosion) location: variable a of type net.minecraft.network.NetworkManager
what does this error mean?

sterile token
#

Btww

#

😂

#

I will definitly make a library for this new project

#

If not i would have amazing headaches

left swift
trail dragon
hasty prawn
#

Yes

spiral light
left swift
#

yeah

coarse shadow
#

how do i set a persistent data from config

trail dragon
# hasty prawn Yes

hm, there still seems to be the same error

this is my code
e.getBrokenItem().getType()=="Material.NETHERITE_BOOTS"

crimson verge
#

remove the "

hasty prawn
#

^^

trail dragon
#

okay

trail dragon
#

ah! that works thank you very much <33

crimson verge
#

always down to help haha

indigo cave
hasty prawn
#

?paste the code

undone axleBOT
left swift
spiral light
#

cant see something there but you also need to run buildtools once with -remapped flag or smth

#

and also the 1.18.1 version

spiral light
#

hmmm reloaded pom ?

left swift
#

i did it too, i dont have any errors

#

in pom

quaint mantle
#

is there any event to cancel when dragon breaks blocks

crimson verge
#

block break event you can get who broke it

#

and cancel if it was dragn

hasty prawn
#

Livvy you type too damn fast, you've answered before I even read it KEKW

quaint mantle
#

i tried that but doesnt work

crimson verge
#

coding hand heheheh

mental sapphire
#
import net.md_5.bungee.api.ChatColor;

Error is: The type net.md_5.bungee.api.ChatColor is not accessible
This isn't working for me, I'm not exactly sure why. I've tried a few things but haven't gotten it to work. Any ideas?

crimson verge
spiral light
crimson verge
#

blockbreak is only players lol

spiral light
#

yes

left swift
#

and can u show that plugin in pom?

hasty prawn
spiral light
#

?paste

undone axleBOT
left swift
#

if its not a problem,

crimson verge
#

no worries :)

mental sapphire
hasty prawn
#

Could you send a screenshot of the error?

crimson verge
#

i think you want to import import org.bukkit.ChatColor; instead

hasty prawn
#

They still should be able to access the bungee ChatColor, expecially because I think it's required for working with components.

crimson verge
#

oh somehow i completely missed the bungee part lmfao

mental sapphire
hasty prawn
#

You should verify so you can send screenshots 😄

left swift
spiral light
#

😄

crimson verge
#

it happens xD

hasty prawn
mental sapphire
left swift
#

btw, why i have nosuchfieldexception here?

final Field suppliers = DefaultAttributes.class.getDeclaredField("SUPPLIERS");```
hasty prawn
# mental sapphire

Weird. Can you send a screenshot of what library you're adding? Also try restarting Eclipse.

left swift
hasty prawn
#

If you're using reflection you do

left swift
#

hmm, ok

glossy marsh
#

Hello!
I've got a fairly obscure question; I want to add a new custom enchantment which is a curse. This is because the grindstone in Minecraft can remove enchantments but not curses from items. There used to be a function isCursed(), but it is now deprecated. I'm wondering how the grindstone checks if an enchantment is a curse, because it doesn't seem possible to give an enchantment a special "curse" attribute.

Alternate question: How do I make a new enchantment that can't be removed by the grindstine (same behaviour as curses).

left swift
#

and when i use remapped mojang, when i build using maven and i want to use plugin on the server i should use that normal file (xEntities-2022-01-13 21.09 i mean that :D)

spiral light
#

-remapped iirc

hasty prawn
crimson verge
#

it is sadly

glossy marsh
glossy marsh
hasty prawn
#

I mean it's deprecated but still works

crimson verge
#

you would want to look for the enchantment you added everytime someone uses the grindstone and cancel it if it is your "curse"

#

but im sure dessie's is much easier

#

also yes it does still work deprecated lol

left swift
spiral light
#

yes

crimson verge
#

but i dont believe you can make a new item cursed

hasty prawn
#

Mine is quite literally just calling setCanRemoveWithGrindstone(false); lol

crimson verge
#

oh yeah go with that then LMAo

#

copying that link for later dev use 😆

hasty prawn
#

peepoGiggles there's a few APIs in there that are useful and they're all somewhat documented lol

mental sapphire
crimson verge
vocal cloud
#

Ah eclipse what a rare sight

hasty prawn
crimson verge
#

eclipse is big dum

quaint mantle
#

Friendly reminder that custom enchantments are unsupported

hasty prawn
#

Reimport it

crimson verge
#

but yeah spigot includes bungee stuff lol

hasty prawn
quaint mantle
mental sapphire
# hasty prawn Reimport it

When I try to auto import it the only option is org.bukkit.ChatColor, it doesn't seem to see the bungee one

hasty prawn
#

Where did you get that jar file

crimson verge
hasty prawn
#

The spigot-api-1.17.1 one

hasty prawn
crimson verge
#

very much so sunglas

#

i took one of my boosts from my home server for this i gotta make it worth it heheh

mental sapphire
hasty prawn
#

I think the one you included doesn't have the Bungeecord stuff with it.

#

PacketPlayOutPlayerInfo probably

#

Or ClientboundPlayerInfoPacket if you're using moj maps

left swift
#

can I somehow move the jar file of my plugin built with maven to the plugins folder on my server so that I can debug? (localhost server)

quaint mantle
#

Create a symlink to your jar and put it in the plugins folder

mental sapphire
#

It also doesn't like having both

hasty prawn
#

Yeah don't have both

#

Just the shaded one

mental sapphire
#

That's the result from just the shaded one

hasty prawn
#

wat

tender shard
#

Does anyone know what kind of inventories a hopper can fill? I know it can fill furnaces and brewing stands, but what about e.g. enchantment table, loom, beacon, anvil, etc?

left swift
quaint mantle
#

Do you really change the version that often

left swift
#

time is version, so i can see which build is latest

hasty prawn
#

Because that JAR has all of those.

loud haven
#

Or switch to a different IDE that isn't Eclipse lol

crimson verge
#

intellij idea is so much better

loud haven
#

Agreed

crimson verge
#

i started on eclipse and didnt know what i was missing lol

hasty prawn
#

Same, IntelliJ was intimidating at first though.

#

Now I'm like Prayge

loud haven
#

Had the same problem with Eclipse being dumb. It frustrated me so much I ended up switching to Intellij and never looked back.

left swift
left swift
thorn bane
#

algum br ai nessa pouha?

tender shard
#

/D is for directories

#

just remove the /D at the beginning

tender shard
#

aren't hoppers supposed to move a book into a lectern?

#

because that doesn't work for me lol

young knoll
#

Uhh

#

Don’t think so?

red sedge
#

Should I create my own file to store player data or use PDC??

tender shard
young knoll
#

Where?

tender shard
#

oh I am stupid

#

it's listed here but it says it is NOT possible

#

I just saw it in the list and thought it should work then

quaint mantle
#

Can you make an array / list of blocks?

tender shard
#

sure, why not?

quaint mantle
#

Nvm I’m a dumbass Xd

#

I was getting an error and I forgot to define the var for the block array 🤦‍♂️

loud haven
#

lmao that got me too sometimes

left swift
tender shard
#

if you don'T use NMS, it doesn't matter whether you use --remapped or not

left swift
#

im using nms, and jar without --remapped, it works too

tender shard
#

yeah lol

#

but you have the obfuscated mappings

#

e.g. fields and methods will be called a, b(), c instead of playerConnection, getPosition(), etc

#

and you will have to change your code on every new MC release when not using --remapped

left swift
#

yes, when writing code i use remapped nms but when i add a plugin to the server does it matter?

chrome beacon
#

You need to put the dragon in to the packet

quaint mantle
#

With smoke particle how can I make it last longer? For the extra on spawning particle what would I put?

charred echo
#

Having some troubles with maven resolving a local module in my project as a dependency

#

this is my project structure

tender shard
charred echo
#

other way around

#

server uses api

tender shard
#

did you install the API with mvn install?

charred echo
#

lmao

#

forgot.

#

thank you.

tender shard
#

np 🙂

quaint mantle
#

Would I just make a loop of spawning the particle over and over?

#

Nvm I can use a bukkit runtasktimer

trim surge
charred echo
woeful crescent
#

Can someone please explain data leaks to me?

#

Java is juggling with references, so why does it matter how big an object that you are storing is?

#

I thought that all objects exist somewhere else in memory, and all that's being kept when you make a variable is a reference to that object

tender shard
#

that's correct

#

but imagine you do not need an object anymore but keep a reference to it. that object will now forever take up memory

#

if you get rid of your reference, garbage collection will eventually free up the memory again

quaint mantle
#

when doing block.getRelative(BlockFace.UP).getType(); if it is an air block it should return Material.AIR right? or does it return null

mental sapphire
vocal cloud
#

BEAT ME TO IT. reeeeeeeee

quaint mantle
#

well i got an error when trying to check the material and it says it returns null but javadoc said it returns Material.AIR so didnt know xd

topaz cape
#

do anyone have anyidea why this doesnt work

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <links>
            <link>https://guava.dev/releases/17.0/api/docs/</link>
            <link>https://javadoc.io/doc/org.yaml/snakeyaml/1.25/</link>
          </links>
          <stylesheetfile>${basedir}/javadocs.css</stylesheetfile>
          <show>public</show>
        </configuration>
      </plugin>
tender shard
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

topaz cape
trail bough
#

Does not working, prefect engmislsh™️

upper niche
#

what is the difference between ADD_SCALAR and MULTIPLY_SCALAR_1 for attribute operations? they seem to do the exact same thing from my testing, which is just multiplying by the given value

tender shard
# topaz cape

hit the maven reload button so that it downloads it

topaz cape
#

it just doesnt

#

im not dumb

#

lol

trail bough
#

adding adds... i think

tender shard
trail bough
#

so if its 1 by default itll act the same

#

try a sword and its damage

upper niche
#

thats what i did

#

i used 2 as the value, set the modifier to the former, checked
+200% damage
changed the modifier to the latter, still +200% damage

topaz cape
vocal cloud
#

What even

#

Intellij forest edition

topaz cape
#

just add a background?

tender shard
#

that's not the full error

#

anyway, the plugin is in maven-central, it should be able to find it

#

try mvn clean package -U

topaz cape
#

well, this isn't a plugin.. so mvn clean install -U

tender shard
#

maven-javadoc-plugin

topaz cape
#

oh i found the issue

#

😮

tender shard
#

what was it?

torn shuttle
#

sonarlint fears my big brain

quaint mantle
#

Id there an event for button click or just playerInteractEvent

sterile token
#

JNI doesnt work with C# right?

#

Cuz c++ its similar to writing on assamble

topaz cape
#

then remove it

#

😄

tender shard
#

that's normally not required lol

#

but the javadocs plugin goes into <reporting> and not into <build>

topaz cape
#

well it now works :DDDDDDDD ❤️

tender shard
#

maybe that was the mistake?

quaint mantle
upper niche
#

is there a way to get a Server instance from an ItemStack?

unreal quartz
trail bough
#

how would i make something like essentialsx's variable home system? [like rgsmputilities.home.limit.15] since I imagine you don't want to code in hundreds of perm nodes manually. i'm still new to java so its probably a dumb question but it'd help

young knoll
#

They let you configure them via the config

#

So you basically add your own nodes as needed

trail bough
#

alright

#

but i just want it so they can have it be an integer instead of a set name pretty much

young knoll
#

Yeah I’d still go with a config

#

Rather than looping a bunch of numbers

trail bough
#

aight

sullen marlin
#

You could use getEffectivePermussions and loop their permissions

#

Though wouldn't surprise me to see permissions plugins break that, what with their Regex permissions and all

trail bough
sullen marlin
#

If it's just 1-25 I'd loop that

#

Since they prolly have more than 25 permissions

trail bough
#

well i dont think someones gonna really want to give more than 25 homes

#

so

#

shrug

sullen marlin
#

Real estate mogul

trail bough
#

i still need to figure out how to store homes but

upper niche
#

how do i read what blocks an itemstack is allowed to break or be placed on?

vocal cloud
#

Does anyone know if you can force close a book? I can't seem to find anything on it.

young knoll
upper niche
#

nms?

#

is it doable through that?

#

id know how to do it if nms itemstacks still had a getTag() method but they dont seem to anymore so i dunno

young knoll
#

Use remapped

sterile token
#

if you have a jni file you cannot get its source or yes? Im confused because with C# you cannot. And Java yes you can

#

Thanks

worldly ingot
#

If you're making a public plugin, you could go with user-defined permissions as well, which is what I was considering doing in VeinMiner for maximum vein sizes

trail bough
#

hm

#

interesting

#

i'll probably go with what essentials does and have it be a list checkup. time to learn configs : D

#

it's probably gonna end up being named SimpleTeleports [tpa, home, sethome, maybe warp and setwarp]

worldly ingot
#

Just in your config,

max_home_permissions: [ 1, 5, 10, 25 ]

Then you can just iterate over that array

#

Check if they have the permission + "." + value

trail bough
#

thanks

worldly ingot
#

o/ Figured I'd offer an alternative

#

It's up to you

trail bough
#

i barely know while loops so this is pretty helpful

#

How should I save the homes then?

#

I'm going with files because I don't wanna hurt my brain with databases too right now, but should it just be pure coords or something like a miniocnfig

young knoll
#

Coords work fine

#

You can easily serialize a location to yml

patent horizon
#
    mavenCentral()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
}```
trail bough
young knoll
#

I would do 1 file per user

patent horizon
#

yeah you dont want to deal with multiple files

#

pain

trail bough
#

so just .yml? ok

patent horizon
#

yeah

trail bough
#

i'd do something like BukkitObjectInputStream in = new BukkitObjectInputStream(new FileInputStream(filePath)); then i guess

young knoll
#

Why, spigot has a yaml api

trail bough
#

oh it does?

young knoll
#

YamlConfiguration.loadConfiguration

trail bough
#

send javadoc link if you could

trail bough
#

ty

patent horizon
#
    public String grabDataAsString(String dir, String file, String key) {
        YamlConfiguration yC = YamlConfiguration.loadConfiguration(new File("directory path"));
        return (yC.get(key) != null ? yC.get(key) : "None");
    }```
#

heres a method i use for it

trail bough
patent horizon
#

basically just returns the value in the config from the given key

trail bough
#

ah ok

patent horizon
#

and if the value is null, it returns "None"

trail bough
#

oh smart

patent horizon
#

pretty sure it's called like the ellis operator or smth

trail bough
#

how do i write to it then?

young knoll
#

Elvis operator

patent horizon
#

ah

patent horizon
trail bough
#

sorry me no know :C

sterile token
sterile token
# trail bough ty

If you want i can send you my FileHandler based on YamlConfiguration

#

I have notice something that i never seen before

sterile token
#

Do you want the .class or the paste link?

sterile token
trail bough
sterile token
trail bough
#

ah aight

sterile token
#

I explain you

#

If boolean parent:

  1. True -> It will create a file with the content from your resource file (Like you should first create your file inside your jar)

  2. False -> It will just create an empty file which you can add, remove, get, etc parameters

#

If you need more help Tag me or dm me

quaint mantle
#

whenever i spawn a particle for example campfire smoke it goes flying at like 400 mph one direction, how can i make it spawn a particle like smoke and stay in. the same place and just fade away like it should

trail bough
#

i think i'll use wally's version for locations

quaint mantle
#

if anyone respondes ping me

eternal oxide
patent horizon
#

can someone give me the link to the docs that tell you what gradle/maven build stuff to enter for the spigot api?

#

all the sudden my old api links arent working now in my gradle.build

jade perch
torn shuttle
#

I feel like I losing my mind with pitch and yaw coords

#

when I do getDirection it looks like they are flipped

#

as in yaw becomes pitch and pitch becomes yaw

ancient plank
#

😔

torn shuttle
#

which is which

#

on facing is the first coordinate yaw and the second pitch?

eternal oxide
#

Yaw and Pitch are rotations. getDirection returns a Vector.

torn shuttle
#

yeah, a vector pointing towards the direction of the pitch and yaw

eternal oxide
#

Yes

#

How are you seeing them reversed?

torn shuttle
#

if I set the pitch to 0 and yaw to 66 and teleport to that location I end up looking at the floor

#

but if I do math on the direction vector it shifts the y value but not the x or z values

#

sorry

#

if I do math on the direction it shifts x or z but not y

#

and if I invert it I shift y on the vector and teleport with a different horizontal viewing coord

eternal oxide
#

depends on the math I guess. Unless you are applying a rotation.

broken hare
#

I am trying to use RecipeChoice.MaterialChoice with 1.17.1 API, but my IDE and gradle compiler says that it can't find that symbol.

torn shuttle
#

here's the perfect example:
[EliteMobs] Developer message: Location: Location{world=CraftWorld{name=em_primis},x=1407.0,y=20.0,z=362.0,pitch=0.0,yaw=66.0} direction: -0.9135454576426009,-0.0,0.4067366430758002

#

yaw is 66

#

pitch is 0

#

on the direction, y is 0

#

that doesn't make sense

#

yaw should be the value setting the vertical value

#

actually looking at the API

        double rotX = this.getYaw();
        double rotY = this.getPitch();
#

can someone do a sanity check for me, I am pretty sure the api got it backwards

broken hare
buoyant viper
#

pitch is your vertical (up/down)

#

actually i think thats how rotations work in general

torn shuttle
#

I think I found the issue

#

it's got to do with the direction

torn shuttle
#

I suspect updating a location's pitch / yaw doesn't modify its direction? so it shifts freely and in somewhat unpredictable ways

dusk flicker
#

ive had to deal with pitch and yaw way too much recently

#

just not in mc sadly lmao

torn shuttle
#

ok there is no way this is correct

#

it wasn't the direction

thick drum
#

?jd

thick drum
#

Hey everyone, does anyone know how to get the name of a block? For example: if I rename a button in an anvil, and then press the button, how do I know the name? I have tried .getMetadata and .getBlockData but can't seem to find anything. Thanks!

hollow bluff
#

Doesn't the name go back to default when placed?

dusk flicker
#

A block or an item?

#

As far as I know like SayWhatHappened said, when placed t he name resets iirc

ancient plank
#

yes

dusk flicker
#

Would recommend using PDCs if you need persistance

#

?pdc

thick drum
#

It's a block (placed down), thanks, I'll look into that!

sterile token
#

Please help me. Im having this inssue while installing forge server. Via the installer

#
java.io.FileNotFoundException: C:\Users\Usuario\Desktop\Server-1.16.5\libraries\de\oceanlabs\mcp\mcp_config\1.16.5-20210115.111550\mcp_config-1.16.5-20210115.111550-mappings.txt (Acceso denegado)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at net.minecraftforge.installertools.McpData.process(McpData.java:122)
    at net.minecraftforge.installertools.ConsoleTool.main(ConsoleTool.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraftforge.installer.actions.PostProcessors.process(PostProcessors.java:226)
    at net.minecraftforge.installer.actions.ServerInstall.run(ServerInstall.java:118)
    at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:423)
    at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:175)
    at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:147)
Failed to run processor: java.io.FileNotFoundException:C:\Users\Usuario\Desktop\Server-1.16.5\libraries\de\oceanlabs\mcp\mcp_config\1.16.5-20210115.111550\mcp_config-1.16.5-20210115.111550-mappings.txt (Acceso denegado)
See log for more details.
trail bough
#

Serious Spigot and Bungeecord programming/development help

sterile token
#

Ahh

#

So what i can do?

trail bough
sterile token
#

Allright

sullen marlin
#

Sir this is a spigot’s

sterile token
crimson verge
#

no lmao

#

forge is entirely separate

sterile token
#

Oh allright

#

I didnt know

hardy swan
#

even if it is the same owner....

thick drum
#
if (nameData.has(new NamespacedKey(HTTPPost.getPlugin(), key:"message"), PersistentDataType.STRING)) {
  p.sendMessage(ChatColor.GRAY + "There is already a command stored in this item!");
  p.sendMessage(ChatColor.GRAY + "Message: " + ChatColor.GREEN + nameData.get(new NamespacedKey(HTTPPost.getPlugin(), key:"message"), PersistentDataType.STRING));
                        
} else {
  nameData.set(new NamespacedKey(HTTPPost.getPlugin(), key:"message"), PersistentDataType.STRING, message,toString());
  item.setItemMeta(meta);
  p.sendMessage(ChatColor.GREEN + "Message Stored!");```

Just followed a tutorial on persistent data storage, does anyone know why eclipse throws "The method has(NamespacedKey, PersistentDataType<T,Z>) in the type PersistentDataContainer is not applicable for the arguments (NamespacedKey, PersistentDataType<String,String>)" on ```nameData.has``` ?
young knoll
#

Because you have key:”message”

#

And also message,toString

thick drum
#

Sorry if it's a dumb question, but what is wrong with key:"message"?

young knoll
#

Java doesn’t let you pass arguments by name

thick drum
#

Oh okay I think I get it, thanks!

lavish hemlock
#

That's why you should download an IDE :)

#

Wait sorry you did

#

That's why you should understand the language :)

thick drum
#

I'm trying I'm trying!

quaint mantle
#

?learnjava

undone axleBOT
young knoll
#

Afaik you can’t

#

But you can remove them from the list in the PlayerCommandSendEvent(?)

#

Then they won’t show up when the player tries to tab complete them

#

I think they can still use them tho? Idk

#

Impossible to intercept the tab completion before they add an argument

#

It will

#

But that isn’t intercepting the tab completion, it’s just removing it from them entirely

opal sluice
#

Hi, would this be a good approach to make a list add out of bound?

The goal here, is to be able to have for example, a list and then be able to add at any index even if the list isn't that long yet

    public static <T> List<T> insertToIndex(List<T> list, T toAdd, int indexToInsert)
    {
        if(indexToInsert >= list.size())
        {
            int loopAmount = indexToInsert - (list.size() - 1);
            for(int i = 0; i < loopAmount; i++)
            {
                list.add(null);
            }
        }
        list.set(indexToInsert, toAdd);
        return list;
    }
young knoll
#

No

#

Like I said, remove the commands from the list

lavish hemlock
opal sluice
lavish hemlock
#

Yeah basically.

opal sluice
#

Ok thanks ^^

young knoll
#

No

#

It fires when the commands are sent to the player

#

Which is usually when they join

quasi patrol
#

Does the getblock from the block break event get the block broken on the server side, or the client side? If it is the server side, how would I get the block broken on the client side?

unreal quartz
quasi patrol
opal sluice
young knoll
#

If you have changed the block on the client side it will change back as soon as they click it anyway

quaint mantle
#

Hi I was making a custom mob plugin and I tried to add a wither every 30 seconds but it won't let me do this java WorldServer world = ((CraftWorld) loc.getWorld()).getHandle(); world.addEntity(EntityWither.class); I have no idea why but can someone help me?

quasi patrol
young knoll
#

Then you aren’t breaking the block

quasi patrol
#

Cancelling PlayerInteractEvent also cancels breaking client side blocks?

quaint mantle
#

I know but I was making a custom entity

#

wait I dont need nms to do the like spawn entity thing?

#

should I just do it the regular way?

#

with spigot?

golden turret
#

if he is storing the fake block

#

then he can get the fake block

young knoll
#

True

#

It’s up to you to keep track of client side blocks

golden turret
#

then yes, nms

#

if not

#

use the api

patent horizon
sullen marlin
#

you cant map a void

#

you want forEach

#

or ya know, a for loop

lavish hemlock
#

You can still forEach an Iterable

#

No need for the Stream middleman

thick drum
#

How do I go about storing a string in a placed lever? Or within a lever item, which is callable when the lever is placed?

young knoll
#

For the item you can use pdc

thick drum
#

Alrighty I'll have a go, thanks!

sullen marlin
#

What brand server are you running

trail bough
#

Try fixing spigot on spigot first

#

to make sure it's a paper issue

young knoll
#

You can make a custom jar

#

Otherwise no, not without NMS/packets

buoyant viper
hardy swan
#

Guys im new to particles, why do particles burst out in random directions whenever I spawn them?

#

Is there a way for them to not move

young knoll
#

For most of them you set the extra int value to 0

#

As it controls the speed

hardy swan
#

Oh so Integer will govern the speed

young knoll
#

Generally yes

#

Particles are weird and inconsistent

hardy swan
#

Ah ok thanks!

honest sentinel
#

How may I use arraylist in an interface? I need it for CraftLivingEntity for different versions?

#

dk if its even a thing

#

I'm trying to get what's inside of public static ArrayList<CraftLivingEntity> Zombies = new ArrayList(); but I can't do it since I'm doing the whole version thing and I can't find a way to use it in multiple versions since I cant put CraftLivingEntity inside of the Arraylist in the interface

alpine urchin
#

what is your goal

#

but why not a list of LivingEntity

#

thats cross version

#

CraftLivingEntity implements LivingEntity

honest sentinel
#

Zombies.add((CraftLivingEntity) location);

#

I can't do that, that's the issue

#

actually nvm, I don't think I need it afterall

alpine urchin
#

need what

honest sentinel
#

The arraylist, I don't think I actually need it

alpine urchin
#

btw why don’t you follow java naming conventions

#

why did you name the list like that

honest sentinel
#

I just did i guess, ima fix it tho

quaint mantle
# hardy swan Ah ok thanks!

Did this fix it? I had the exact same issue and asked the exact same legit word for word question earlier xd

hardy swan
#

No it doesnt

#

Im thinking it is offset instead

#

Offset seems to be a value for a target location

#

Not spawn location as I thought it would be

quaint mantle
hardy swan
#

Im testing it

quaint mantle
#

I set offset to 0,0,0 so that might be it

#

Just remove offset and lmk if it works

hardy swan
#

And there is a forth value

#

Which i assume is speed

quaint mantle
#

Extra

#

Ye

hardy swan
#

Set that to 0

quaint mantle
hardy swan
#

Just tested

#

I assume particles are assign random vectors when you spawn it

hardy swan
quaint mantle
#

So what do I change? Lol

#

Set extra to 0?

hardy swan
#

Yep

quaint mantle
#

Kk ty

alpine urchin
#

in that case since its static make it ZOMBIES

#

otherwise if not static make it zombies

young knoll
#

Isn’t that only static final

quaint mantle
quaint berry
#

Quick question...
Can I detect a model id for an item through code?
If not can I check through protocol lib?

young knoll
#

Like the custom model data value?

spiral light
#

i think he wants those methods from ItemStack#getItemMeta()

jolly acorn
#
  panel-1:
    perm: default
    rows: 5
    title: '&8Generated panel-1'
    empty: BLACK_STAINED_GLASS_PANE
    item:
      '20':
        material: DIAMOND
        stack: 1
        name: '&d&lBUY VIP+ ROLE'
        commands:
          - 'paywall = 300000'
          - 'add-data= vip+ bought'
          - 'msg= Thank You For Buying Vip+!'
          - 'console= lp user %cp-player-name% parent set vip+'
      '24':
        material: GOLD_INGOT
        stack: 1
        name: '&6&lBUY VIP ROLE'
        commands:
          - 'paywall = 100000'
          - 'add-data = vip bought'
          - 'msg= Thank You For Buying Vip!'
          - 'console= lp user %cp-player-name% parent set vip'```

i wanna add a notif like where if they buy it they cant buy it again how do i fix this?
spiral light
#

seems like you use some api to use a config file to generate an inventory
but its not the spigot api ^^

jolly acorn
#

i dont know what to add on the buttom to make it like say them "Youve Already Bought This!" like that

jolly acorn
#

since iam from the philppines and i cant understand the code in the video

spiral light
#

yeah but how should we know how a plugin works ^^

#

is the video java and in english ?

jolly acorn
#

yes

quaint berry
quaint berry
#

So can I check if someone is eating a golden apple with a certain model tag then run another code if that is happening?

jolly acorn
# spiral light yeah but how should we know how a plugin works ^^
  panel-1:
    perm: default
    rows: 5
    title: '&8Generated panel-1'
    empty: BLACK_STAINED_GLASS_PANE
    item:
      '20':
        material: DIAMOND
        stack: 1
        name: '&d&lBUY VIP+ ROLE'
        commands:
          - 'paywall = 300000'
          - 'add-data= vip+ bought'
          - 'msg= Thank You For Buying Vip+!'
          - 'console= lp user %cp-player-name% parent set vip+'
      '24':
        material: GOLD_INGOT
        stack: 1
        name: '&6&lBUY VIP ROLE'
        commands:
          - 'paywall = 100000'
          - 'add-data = vip bought'
          - 'msg= Thank You For Buying Vip!'
          - 'console= lp user %cp-player-name% parent set vip'```

and heres the code i have rn
quaint mantle
jolly acorn
quaint berry
quaint mantle
#

Why would it

jolly acorn
#

i also dont want them to buy it when they already have bought this role

spiral light
#

i am (and i think almost everyone else here) not here to code stuff for you ^^
if you use an other plugin to do stuff and dont know how to use it - we maybe dont know how it works too ?
you will need to understand their plugin and if you have a problem you should contact the plugin-dev

#

hmmm wondering if this is bannable here

#

everything ok with you ?

jolly acorn
#

lol

quaint mantle
#

Component better

spiral light
#

@ivory sleet @tender shard can you get this guy away from here pls (ping a mod or smth i dont know a mod)

quaint mantle
#

"are" tho

buoyant viper
#

where the fuck i am

ivory sleet
#

?ban @thorn bane inappropriate

undone axleBOT
#

Done. That felt good.

ivory sleet
#

What version?

#

That’s strange

spiral light
#

because they are boosted ^^ 😄
(no they just know more then i and.... conclure can ban somehow :D)

#

no

#

conclure is taff

coarse shadow
#

how do i check if the helmet slot is null but other slots are?

coarse shadow
#

to check all slots except helmet slot, do i need to add those slots to an arraylist?

#

or do i need to check them one by one

low temple
#

I think there’s a .getEquipment() or .getHelmetSlot() method within a PlayerInventory Object

coarse shadow
#

there is getHelmet method

lost matrix
# coarse shadow there is getHelmet method

There are 5 approaches:

    EntityEquipment equipment = player.getEquipment();
    ItemStack helmet = equipment.getHelmet();
    ItemStack chestPlate = equipment.getChestplate();
    ItemStack leggings = equipment.getLeggings();
    ItemStack boots = equipment.getBoots();
    PlayerInventory inventory = player.getInventory();
    ItemStack[] armor = inventory.getArmorContents();
    ItemStack helmet = armor[3];
    ItemStack chestPlate = armor[2];
    ItemStack leggings = armor[1];
    ItemStack boots = armor[0];
    PlayerInventory inventory = player.getInventory();
    ItemStack helmet = inventory.getHelmet();
    ItemStack chestPlate = inventory.getChestplate();
    ItemStack leggings = inventory.getLeggings();
    ItemStack boots = inventory.getBoots();
    PlayerInventory inventory = player.getInventory();
    ItemStack helmet = inventory.getItem(EquipmentSlot.HEAD);
    ItemStack chestPlate = inventory.getItem(EquipmentSlot.CHEST);
    ItemStack leggings = inventory.getItem(EquipmentSlot.LEGS);
    ItemStack boots = inventory.getItem(EquipmentSlot.FEET);
    PlayerInventory inventory = player.getInventory();
    ItemStack helmet = inventory.getItem(103);
    ItemStack chestPlate = inventory.getItem(102);
    ItemStack leggings = inventory.getItem(101);
    ItemStack boots = inventory.getItem(100);
coarse shadow
#

aight so lets say i've one of these approaches

#

if the slot is empty and i call isEmpty method, will it call true?

low temple
#

depends what you do

#

if youre checking the helmet

#

you can use .getHelmet() and check if its null

#

itll either be null or Material.AIR

coarse shadow
#

i'm checking if the helmet is not null and other slots are

low temple
#

if youre checking the type

lost matrix
#

in those examples helmet, chestPlate, leggings and boots can all be null

low temple
#

@lost matrix are empty slots considered null or air?

hardy swan
#

Air

#

Equipment is air

lost matrix
#

If its in the players hand then its air. Otherwise its null.

coarse shadow
#

yea thats where my head is confused

hardy swan
#

Inventory is null

low temple
#

does the .getMaterial() method on a null itemstack return Material.AIR?

hardy swan
#

Null dont have methods

low temple
#

oh right

coarse shadow
#

so i should say helmet != Material.AIR if i want helmet not to be null right?

lost matrix
#

If you call anything on null then it throws an NPE

lost matrix
coarse shadow
#

oh ok

low temple
#

so you would do "inventory.getHelmet() != null"

coarse shadow
#

thanks

#

also another question

hardy swan
#

The last i checked equipment always return nonnull

#

Maybe im tripping

jolly acorn
#
  panel-1:
    perm: default
    rows: 5
    title: '&8Generated panel-1'
    empty: BLACK_STAINED_GLASS_PANE
    item:
      '20':
        material: DIAMOND
        stack: 1
        name: '&d&lBUY VIP+ ROLE'
        commands:
          - 'paywall = 300000'
          - 'add-data= vip+ bought'
          - 'msg= Thank You For Buying Vip+!'
          - 'console= lp user %cp-player-name% parent set vip+'
      '24':
        material: GOLD_INGOT
        stack: 1
        name: '&6&lBUY VIP ROLE'
        commands:
          - 'paywall = 100000'
          - 'add-data = vip bought'
          - 'msg= Thank You For Buying Vip!'
          - 'console= lp user %cp-player-name% parent set vip'```

bruh they didnt pay the paywall but still got vip+ and vip 😐
coarse shadow
#

can we get value names from persistent data containers

#

not key names, values

jolly acorn
#

how do i fix this

coarse shadow
#

all i've seen was getting key names and not values

low temple
#

so you need to get the persistent data container value

#

so you would do container.get(new NamespacedKey(<Plugin variable>, <String key>), PersistentDataType.<Data type>);

jolly acorn
#
  RANKSHOP:
    perm: default
    rows: 5
    title: '-------- RANKSHOP --------'
    empty: BLACK_STAINED_GLASS_PANE
    item:
      '20':
        material: DIAMOND
        stack: 1
        name: '&d&lBUY VIP+ ROLE'
        commands:
          - 'paywall = 300,000'
          - 'add-data = vip+ bought'
          - 'msg= Thank You For Buying Vip+!'
          - 'console= lp user %cp-player-name% parent set vip+'
        lore: 
          - '&b&lDO NOT BUY AGAIN AFTER BUYING!'
          - '&b&lIT WILL TAKE YOUR MONEY AGAIN!'
      '24':
        material: GOLD_INGOT
        stack: 1
        name: '&6&lBUY VIP ROLE'
        commands:
          - 'paywall = 100,000'
          - 'add-data = vip bought'
          - 'msg= Thank You For Buying Vip!'
          - 'console= lp user %cp-player-name% parent set vip'
        lore: 
          - '&b&lDO NOT BUY AGAIN AFTER BUYING!'
          - '&b&lIT WILL TAKE YOUR MONEY AGAIN!'```

i need help! they didnt pay the "paywall" but still got the vip role !!! how do i fix this!?
coarse shadow
#

wait i asked wrong

#

we can get vales

lost matrix
low temple
#

Oh you want to get all the keys? or search the keys by value?

coarse shadow
#

can we check if a key has a value that we ask for

jolly acorn
lost matrix
low temple
jolly acorn
low temple
#

or check the datatype of the key?

coarse shadow
#

no

#

lets say i want a key that has "blabla" value but i didnt create it. i want to check if the item has any key with that value

low temple
#

Hmm

#

you might be able to do the .getKeys() method, loop through those and see if it matches ur value

#

theres a very low chance youll get interfearing keys from other plugins

#

you can make the key to basically whatever you want

coarse shadow
#

got it thx

low temple
#

@coarse shadow btw when you use the .getKeys() and use the .forEach() method, the variable will be the namespacekey itself

#

so youll have to do key.getKey()

lost matrix
low temple
#
PersistentDataContainer container = player.getPersistentDataContainer();
container.getKeys().forEach(key ->{
    if (key.getKey().equals("your_key")) {
        // Do something
    }
});
#

as smile said, this is often unneeded and you really shouldnt be making PDC without having a reasonably unique key

lost matrix
# coarse shadow got it thx

This is how you should use PDCs.

  private final NamespacedKey tagKey = Objects.requireNonNull(NamespacedKey.fromString("some-namespace:some-key"));

  // Sets or overwrites a tag
  public void tagItem(ItemStack itemStack, String tag) {
    ItemMeta meta = itemStack.getItemMeta();
    PersistentDataContainer container = meta.getPersistentDataContainer();
    container.set(tagKey, PersistentDataType.STRING, tag);
    itemStack.setItemMeta(meta);
  }

  public boolean isTagged(ItemStack itemStack) {
    ItemMeta meta = itemStack.getItemMeta();
    return meta.getPersistentDataContainer().has(tagKey, PersistentDataType.STRING);
  }

  // returns a String or null if not present
  public String getTag(ItemStack itemStack) {
    ItemMeta meta = itemStack.getItemMeta();
    PersistentDataContainer container = meta.getPersistentDataContainer();
    return container.get(tagKey, PersistentDataType.STRING);
  }
hardy swan
#

Bruh how to declare a number to be a float

#

Or must cast

lost matrix
#

float x = 1;

#

or float y = 1.0F;

hardy swan
#

Ok nvm

spiral light
#

or float f = (float) 20D;

lost matrix
#

1.0 is a double 1.0F is a float

hardy swan
#

I was thinking why F isnt working, the method doesnt accept float :)

lost matrix
buoyant viper
lost matrix
hardy swan
#

0xABDFF

#

Wait what

#

public DustOptions(Color, float)

#

And yet

#

Ide says not compatible?

lost matrix
#

Prediction: wrong color import

hardy swan
#

Org.bukkit.color, correct import

#

Wait fk

#

Wrong import

#

Kill me

coarse shadow
#

if i add armor slots that i declared to an arraylist then call isEmpty method, will it call true if the player arent wearing anything on those slots

hardy swan
#

javafx.scene.paint.Color

low temple
sweet lance
#

Hi all, is there an event with which I can undo the damage that an anvil suffers after being used?

coarse shadow
#

?paste

undone axleBOT
coarse shadow
sweet lance
lost matrix
coarse shadow
#

do i need to check if they are null one by one?

coarse shadow
#

okay

lost matrix
buoyant viper
sweet lance
#

I'll go on with Paper. Thanks

hardy swan
worn tundra
spiral light
coarse shadow
#

finally my plugin works after two days lol

#

but im getting an NPE tho

#

?paste

undone axleBOT
coarse shadow
candid galleon
#

"helmet" is null

#

if only it tells you the reason of errors

#

😢

coarse shadow
#

yea but how do i prevent it to give error when the helmet is null

candid galleon
#

to be frank; learn java

spiral light
#

or
if helme is null: dont print npe

hardy swan
#

use try catch

candid galleon
#

you should not use try catch

hardy swan
#

Im joking, before you actually do that

coarse shadow
#

in try catch it still gives the error

#

lol

candid galleon
#

?learnjava

undone axleBOT
coarse shadow
#

lemme show you the code

#

?paste

undone axleBOT
coarse shadow
candid galleon
#

if(helment != null || chest != null)
// what do you think can be null here

coarse shadow
#

helmet duh

#

but only helmet throws the npe, other slots dont

spiral light
#

itemstacks are nullable... you have to check always if the getItem or smth related to getting items returns you something that is null

trail dragon
#

Im getting this error
java.lang.IllegalArgumentException: Plugin already initialized!

This is my main class

package dev.goldenedit.mcbacore;


import dev.goldenedit.mcbacore.commands.CheckPoints;
import dev.goldenedit.mcbacore.commands.ResetPoints;
import dev.goldenedit.mcbacore.events.EntityResurrect;
import dev.goldenedit.mcbacore.events.PlayerDeath;
import dev.goldenedit.mcbacore.events.PlayerItemBreak;
import dev.goldenedit.mcbacore.events.PlayerJoin;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;

public final class MCBACore extends JavaPlugin{
    @Override
    public void onEnable() {
        getLogger().info("MCBA Core has started");
        getLogger().info("https://goldenedit.dev");

        /*getServer().getPluginManager().registerEvents(new PlayerJoin(), this);
        getServer().getPluginManager().registerEvents(new PlayerItemBreak(), this);
        getServer().getPluginManager().registerEvents(new EntityResurrect(), this);
        getServer().getPluginManager().registerEvents(new PlayerDeath(), this);*/
        getCommand("resetpoints").setExecutor(new ResetPoints());
        getCommand("points").setExecutor(new CheckPoints());

    }
    public HashMap<Player, Integer> score = new HashMap<Player, Integer>();
}
lost matrix
spiral light
#

?paste your error pls

undone axleBOT
trail dragon
lost matrix
trail dragon
lost matrix
#

Via mutators and accessors.
public void setPoints(Player player, int score)
public void addPoints(Player player, int points)
public void getPoints(Player player)
and so on.

trail dragon
#

ahh okay i see

#

thank you!!

lost matrix
# trail dragon ahh okay i see

Btw you are somewhere creating an instance of MCBACore
In spigot you are not allowed to instanciate JavaPlugin classes.
You are probably doing this in your ResetPoints or CheckPoints constructor

opal juniper
#

7smile7 pink again 👀

trail dragon
#

and then core.score.get(target)

lost matrix
trail dragon
#

ohh right

lost matrix
# trail dragon ohh right

So what you want to do is add a parameter to your ResetPoints and CheckPoints constructors like this

private final MCBACore plugin;

public CheckPoints(MCBACore plugin) {
  this.plugin = plugin;
}

And then call them in your onEnable with the current instance you are in:

        getCommand("points").setExecutor(new CheckPoints(this));
#

There is only one single instance of MCBACore.
And you need to makes sure that other classes become this one instance provided.

lost matrix
# trail dragon I'm a bit confused. Heres my code https://github.com/GoldenEdit/MCBACore

Example for CheckPoints.class:

public class CheckPoints implements CommandExecutor {

    MCBACore core = new MCBACore();

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    ...

To

public class CheckPoints implements CommandExecutor {

    private final MCBACore core;
    
    // This is your contructor
    public CheckPoints(MCBACore core) {
      this.core = core;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    ...
#

Dont create a new instance of MCBACore.
Let the the caller of new CheckPoints(MCBACore) pass an instance of MCBACore

#

But those are Java basics. And i mean basics you should know after at most 2 Weeks of Java.

#

Maybe 3

quaint mantle
#

?learnjava when?

undone axleBOT
dense geyser
#

is there a set format of uuids for minecraft accounts? I want to find a player by a UUID that has no dashes, UUIDs dont have set placement of them, they can sometimes change. Are the format of them always the same for minecraft accounts (for example {6}-{6}-{8}-{12} etc)

#

unless there's some mojang request that allows you to get it from an undashed uuid, I feel like ive seen something like that before

lost matrix
dense geyser
#

oh I thought they changed sometimes, do you happen to know the proper lengths of each section?

#

(thank you)

lost matrix
glossy venture
#

is there a way to hook into CommandSender#hasPermissionfor a player
(or CraftHumanEntity#hasPermission for the implementation)

glossy venture
#

make it return something

#

instead of accessing the permission map

dense heath
#

???

glossy venture
#

i want to replace the default implementation

dense heath
#

You'd like to make a permissions plugin?

glossy venture
#

yeah

#

im making one

dense heath
#

Figure out how another plugin does it. Here's pex

quaint mantle
#

Hey guys, How can I use my IDE to launch my server and plugin to debug it (I am using IntelliJ)

hardy swan
#

i rmb a link

quaint mantle
#

wdym

hardy swan
#

search on google

#

"Intellij Debug Spigot"

quaint mantle
#

ok

#

ty

#

What block should I change to a luckyblock texture? I want to change a rarely used block to become the luckyblock

#

also it shouldnt generate in the vanilla world so players cant find it (or if theres a way to disable it generating)

hardy swan
#

Player head maybe the most suitable

dense geyser
#

sponge

hardy swan
#

Tbh

quaint mantle
candid galleon
#

gold block?

quaint mantle
#

is there a way to get which player's head is the head (getting the owner's name)

#

thats really used

candid galleon
#

beacon?

quaint mantle
#

it generates a lot these days n the nether

#

player will still need it

candid galleon
#

there's a way to get the owner from the block yeah

hardy swan
quaint mantle
#

I mean from the skull

#

which skin it belogns to

hardy swan
#

It depends on how the player skull is created

quaint mantle
#

I will spawn it

#

through code

#

are vanilla mob heads and player heads different?

hardy swan
#

Vastly

lost matrix
ivory sleet
quaint mantle
#

Do u think using heads would be a good idea, as that doesnt require a custom pack

lost matrix
#

But going for playerheads is probably better as they are PersistentDataHolder

hardy swan
#

Yes, my idea is very good

hardy swan
#

Hee just...

hardy swan
#

Blocks do not have pdc

hushed stirrup
#

Event doesnt want to work

quaint mantle
#

thanks

lost matrix
#

Someone that holds a PersistentDataContainer

next stratus
#

Hey, all of a sudden gradle can't seen to find WorldGuardWrapper although it could find it not long ago and I haven't changed any of my gradle stuff... any advice?

quaint mantle
lost matrix
hushed stirrup
hardy swan
#

EventHandler annotation?

lost matrix
hushed stirrup
hardy swan
#

Nvm im blind

vague swallow
#

why can I not do if(int 5 == 5) {} ?

lost matrix
#

Those are separate methods

candid galleon
#

int 5 would be declaring a variable

#

and a variable has to start with _ or a letter

hardy swan
#

int 1 = 0;
return 1 == 0; // what will this return

candid galleon
#

well does 1 = 0?

vague swallow
#

nvm found out what I did wrong XD but thank you guys

hushed stirrup
paper viper
#

You can’t even define a variable with name 1

hardy swan
lost matrix
# candid galleon well does 1 = 0?
x = y
Then x2 = xy
Subtract the same thing from both sides:
x2 – y2 = xy – y2
Dividing by (x-y), obtain
x + y = y
Since x = y, we see that
2 y = y
Thus 2 = 1, since we started with y nonzero
Subtracting 1 from both sides:
1 = 0
hardy swan
#

Dividing by 0

candid galleon
#

^

#

Dividing by (x-y)

vague swallow
#

ty!

lost matrix
#

sshh

dense heath
#

There are almost no limitations on names for variables

paper viper
#

..

#

Try it out then

dense heath
#

Sure

paper viper
#

You can’t do it lmfao

dense heath
hardy swan
#

In before he sends a working program

paper viper
#

Your IDE will complain

dense heath
#

Hold on, renewing my IntelliJ subscription

quaint mantle
#

Javac wont compile sth Like that. The JVM would Accept Hand Made bytecode for it though

hushed stirrup
#

Item qty doesnt go down, or adds the effect after the right click on block interaction

hardy swan
#

does getItemInMainHand() return a copy

lost matrix
lost matrix
#

Use PDC to identify custom items

hardy swan
#

isSimilar could be what you were thinking

#

But yea, pdc

quaint mantle
#

Is there a way to give the ability of double jumping and tripple jumping so they can jump once again in the air

hardy swan
quaint mantle
quaint mantle
hardy swan
#

Double jumping could be fly

quaint mantle
#

I see

#

so Player Fly event?

lost matrix
#

Double jumping is detected for when the player wants to start flying

quaint mantle
#

also detected when he is in survival?

hardy swan
#

PlayerToggleFlightEvent

#

I think

hushed stirrup