#help-development

1 messages · Page 1404 of 1

dusty herald
#

but i just did

lime mortar
#

Just asking for advice on how to do it. How am i then supposed to learn it.

odd gulch
lime mortar
#

Thanks that is exactly what i needed! 😄

rotund pond
#

Gonna see, thank you 😮

#

Is it possible to force spigot to load its plugin last?

wraith rapids
#

no

#

what happens if two plugins want to load last?

#

what you can do, however, is declare a specific plugin as a dependency or a soft dependency

#

doing that will make your plugin load after that plugin

drowsy helm
#

Can loadafter in plugin yml

lilac dagger
#

you can also use a schedule to run after the server has started

wraith rapids
#

there is still no guarantee that your scheduled task runs after all other plugins' such scheduled tasks

lilac dagger
#

well it did work with a specific issue of mine regarding multiverse core

wraith rapids
#

yeah

#

but if I now want to create a plugin that loads after your plugin

#

there's no guarantee that my task runs after your task

silver robin
#

If i serialize an item and then load it by literally copying all the meta, does it guarantee it will be the same item?

For example if i put a crate key inside some kind of bank, and when I want to withdraw it, is it safe to create a same item and just copy the serialized meta to it and give it to me?

wraith rapids
#

if the serializer works, the item going in will be exactly the same as the item coming out

young knoll
#

Why not just serialize the entire item

wraith rapids
#

i'm not sure why you're mixing in item meta and shit into it though

silver robin
#

I just want to save it directly to a file, from the memory, and when loading it , it becomes the same item

wraith rapids
#

yes, just serialize the item them

#

that is what serialization is

silver robin
#

Crate keys are a good example , if they dont work after , something is wrong

#

ok i'll try, thanks

#

Wait are there methods for doing that for me?

#

or do i have to copy the item meta myself?

wraith rapids
#

yes but most of them kind of suck

#

ItemStack is ConfigurationSerializable

lilac dagger
#

the bukkit serializer is pretty weak :(

wraith rapids
#

meaning you can set and getSerializable it in a Configuration

silver robin
#

is that what Essentials does for kits?

wraith rapids
#

no

silver robin
#

but its similar?

wraith rapids
#

it is not

silver robin
#

how exactly

lilac dagger
#

i've got one

wraith rapids
#

essentials uses some shitty item syntax parser

#

it's not a serializer

#

it can't represent all itemstacks as text

silver robin
#

I mean i believe there is no efficient and stable way for doing that

wraith rapids
#

and only has limited options with what it can do

lilac dagger
wraith rapids
#

ConfiguationSection::set

lilac dagger
#

this one is better imo

#

it worked for me flawlessly 🤔

wraith rapids
#

ConfigurationSection.getSerializable(ItemStack.class)

#

there's also bukkit object output stream

#

but it might have the same issue as the config serializer

lilac dagger
#

both are incomplete tho

#

i tried them

#

they're losing info

wraith rapids
#

don't use a youtube course

#

youtube videos are trash

silver robin
#

github is best

ivory sleet
#

Lmao I think not by the looks of that thumbnail

silver robin
#

if you know what youre reading

wraith rapids
#

a written guide is always better than a video

ivory sleet
#

GitHub? You mean open source then?

#

Ofc not

wraith rapids
#

if you know how to program already yes

#

but if you've never used an api that is probably not the case

ivory sleet
#

If it’s spigot api you fundamentally need to know java and oop

wraith rapids
#

look up a guide on java first

#

once you can write some simple shit in java, then you can start getting into the bukkit api

quaint mantle
#

Hello, i'm Comparing location. but it returns false always

#

if (event.getClickedBlock().getLocation().toString().equalsIgnoreCase(reactLocation.toString()))

#
[20:25:26 INFO]: Location{world=CraftWorld{name=world},x=-46.0,y=82.0,z=-16.0,pitch=0.0,yaw=0.0} Location{world=CraftWorld{name=world},x=-46.0,y=83.0,z=-16.0,pitch=0.0,yaw=0.0}
[20:25:26 INFO]: Location{world=CraftWorld{name=world},x=-46.0,y=82.0,z=-16.0,pitch=0.0,yaw=0.0} Location{world=CraftWorld{name=world},x=-46.0,y=83.0,z=-16.0,pitch=0.0,yaw=0.0}
``` (toString() location)
#

it's same

undone pebble
#

Why are you turning it into a string? You can simply compare the two objects with .equals

quaint mantle
#

but it doesn't work

#
if (event.getClickedBlock().getLocation().equals(reactLocation))
lilac dagger
#

test their distance squared then

#

i s'pose the floating precision might mess it up

quaint mantle
#

how can I test distance squared? 🙂

#

reactLocation.distanceSquared()?

#

what should I put on ()?

#

it needs double

quaint mantle
#

ah! thanks i forgot to see javadoc

quaint mantle
#

ah

#

I understood thansk!

wraith rapids
#

Location::equals tests both the position and the direction of the location

#

meaning the two locations need to be exactly the same

quaint mantle
#

help ```package me.yowshee.test;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;

public class diamondBlockBreak implements Listener {
@EventHandler
public void onPlayerBreakBlock(BlockBreakEvent event) {
Block blockBroken = event.getBlock();

    if (blockBroken.getType() == Material.DIAMOND_ORE)
    { event.setCancelled(true);

        blockBroken.setType(Material.AIR);
        ItemStack iron_ingot = new(Material.IRON_ORE)
        blockBroken.getWorld().dropItemNaturally(blockBroken.getLocation(), iron_ingot);

    }

}

}

#

why no work

wraith rapids
#

down to like 1/8000th of a block and some minute fraction of a degree for the angle

quaint mantle
#

i am new to java

wraith rapids
#

you can start by describing "no work"

wraith rapids
#

what does it say when it doesn't compile

young knoll
#

I mean surly your IDE will tell you why it won’t compile

wraith rapids
#

we don't have a crystal ball

#

or I do but it's in the repair shop

eternal oxide
quaint mantle
wraith rapids
#

we can't tell you why your code explodes if you don't give us any information

#

look at your fucking IDE

#

it tells you

#

or javac output if you're not using an ide

quaint mantle
#

waht

wraith rapids
#

that is not valid java

young knoll
#

new ItemStack....

quaint mantle
#

wdym

young knoll
#

You can’t make a new nothing

wraith rapids
#

new ItemStack(material)

#

not new(material)

quaint mantle
#

ohhhhhhhhh

maiden briar
#

If I want to create an universal class which supports both bungee and bukkit, how would I do that? Because it can't extend 2 classes

wraith rapids
#

you don't

#

you create 2 classes

#

and move your plugin's main functionality to a third class

quaint mantle
#

shit

#

ok

maiden briar
#

Ok

wraith rapids
#

the purpose of the bukkit/bungee classes becomes to be the entry points for bukkit and bungee

eternal oxide
maiden briar
#

Yes, but I want to let people extend the 3th class, what do they have to type in the main?

wraith rapids
#

they just extend your main class then

#

call the classes BukkitEntryPoint and BungeeEntryPoint and MyPlugin respectively if you want

#

an extending class would then extends MyPlugin

#

that said why do you want someone to extend your main class

maiden briar
#

This is what I want

public class Bukkit extends JavaPlugin
{
  
}

public class Bungee extends Plugin
{
  
}

public class Universal
{
  
}

public class InMyPlugin extends Universal
{
  
}
quaint mantle
#

no suitable method found for registerEvent(me.yowshee.test.diamondBlockBreak,me.yowshee.test.Main)

#

waht

eternal oxide
#

include a plugin.yml for Spigot and a bungee.yml for Bungee

wraith rapids
#

why do you want to extend your main class

maiden briar
#

Because it's an API

wraith rapids
#

then make it an interface

#

and implement it

maiden briar
#

How? Pls give an idea with code

wraith rapids
#

public interface Universal

maiden briar
#

Yes and what methods?

#

onEnable and onDisable?

wraith rapids
#

whatever methods you declare there

maiden briar
#

Yes I will choose the methods for my API then

maiden briar
#

Some defaults as getConfig, onEnable, onDisable, getResource, etc

wraith rapids
#

registerEvents

#

not registerEvent

quaint mantle
#

oh

#

incompatible types: org.bukkit.Material cannot be converted to org.bukkit.inventory.ItemStack

#

stupid

#

bruh

#

python wasnt this hard

#

why java do me like dat tho

wraith rapids
#

I want an apple

#

why are you giving me an orange

#

give me an apple instead

#

that is a fucking orange

maiden briar
#

Oh I got ya

public interface Universal

public class Bukkit extends JavaPlugin implements Universal

public class Bungee extends Plugin implements Universal

And I let people extend Bukkit or Bungee, and if I want to get the plugin I just need to call the Universal interface?

eternal oxide
#

bruh for real! Its so simple bruh

#

🙂

wraith rapids
#

it wants an itemstack

#

you are giving it a material

#

an apple is not an orange

#

you give it the apple it wants

#

it's not that hard

#

no, you just suck

#

(at java)

#

and listening to instructions

#

you want an itemstack

#

you have a material

maiden briar
#

new ItemStack(Material)

wraith rapids
#

maybe look at the itemstack class and see if it has any constructors that take a material

maiden briar
#

Cmon learn Java

eternal oxide
#

That is basic Java. You need to learn more if you want to write plugins

#

no

wraith rapids
#

sigh

eternal oxide
#

They literally gave you all the code you need

young knoll
#

Don’t learn java with bukkit

#

Just... don’t

wraith rapids
#

the itemstack constructor

#

that takes a material

eternal oxide
#

tvhee told you already

dusk flicker
#

Dear fuck

#

Learn java

wraith rapids
#

consult the fucking tutorial

dusk flicker
#

No it's your first day with bukkit

wraith rapids
#

we're not an interactive day 0 tutorial

dusk flicker
#

Drop it and learn java

eternal oxide
#

Learn Basic java before you attempt plugins

young knoll
#

October 2020 isn’t even that old

wraith rapids
#

👀

eternal oxide
#

You are struggling on the Basics of object constructors

wraith rapids
#

yeah, that's what you need to do

#

but java is strongly typed

eternal oxide
#

every object has a Type in Java.

wraith rapids
#

so you need to declare the type of that variable as well

#

ItemStack iron_ingot

#

the first one is the type of the variable/field

#

and the second one is the name of the variable/field

#

= means put the thing on the left in the thing on the right

#

new ItemStack means "make me a new itemstack"

#

=

eternal oxide
#

close

#

no

#

ok, so you want to create a field called IRON_INGOT

#

so the first thing you do is create your field ItemStack IRON_INGOT

#

then you need to assign it a value, which youwant to be an ItemStack

#

so ItemStack IRON_INGOT =

wraith rapids
#

stop talking

#

and start listening

eternal oxide
#

now you have to create the value ItemStack IRON_INGOT = new Itemstack(

#

and to create a new ItemStack you have to tell it what type

young knoll
#

If only the internet had info on this

wraith rapids
#

dude has literally not written a single line of java before this

eternal oxide
#

ItemStack IRON_INGOT = new Itemstack(Material.IRON_INGOT);

wraith rapids
#

doesn't know how to declare a field, how to assign anything in it, let alone how to construct the thing to assign

chrome beacon
#

._.

wraith rapids
#

literally knows nothing

chrome beacon
#

Please go learn some basic Java and come back here

thick tundra
#

Hey! I cant seem to figure out how to check if there is a player in a worldguard region

#

anyone capable of helping me?

wraith rapids
#

you're in for a fucking aneurysm

thick tundra
#

oh

#

ah oh

wraith rapids
#

basically

young knoll
#

Pretty sure it’s a simple get region from location

wraith rapids
#

the folks at enginehub don't document their shit

thick tundra
#

yes

#

it seems they dont

wraith rapids
#

and all of their existing documentation is from like 3 major versions ago

#

and all of the posts and guides on the internet are outdated

#

the best option is to ask on the enginehub discord

thick tundra
#

LOL

#

okay

#

wait i know how to solve this. just use a onregionentry command

wraith rapids
#

their wiki thing has a small set of simple functions documented

chrome beacon
#

You don't

thick tundra
#

cant

wraith rapids
#

checking whether a player is in a region is one of those functions

thick tundra
#

yeah but i cant seem to figure out which function it is 🤣

wraith rapids
#

but go pester them on their discord so maybe one of them will eventually write proper docs

#

no, you're the stupid one here

chrome beacon
#

It's not Intellijs fault

thick tundra
#

OMG

wraith rapids
#

you right click the resoruces directory

#

and click new

thick tundra
#

just use the Minecraft Developer plugin

wraith rapids
#

and then you make a new yml

#

and then to generate the contents

eternal oxide
#

a plugin.yml is just a text file that has no TABS and is formatted as YAML

wraith rapids
#

you need to smash the little buttons on your keyboard for a bit

eternal oxide
#

google

wraith rapids
#

this will generate the content for the file

thick tundra
#

okay so if u just use the mc developer plugin it auto generates one for you

#

just remake the project with spigot as the minecraft version

#

and it wil make one

eternal oxide
wraith rapids
#

i would tell you to look at the bukkit docs and learn how to write one yourself, as that is a crucial bit of information for a developer, even if they use the mcdev plugin

#

but based on how you are here asking about day 0 java questions, you probably aren't into learning

eternal oxide
#

In my opinion everyone should manually create their project and first plugin when starting out.

thick tundra
#

hey @wraith rapids cant i just use this: ``` if(region.getMembers().getPlayers().contains(event.getPlayer())) {

    }```
#

on a player move event

eternal oxide
#

Depends on how you are building yoru pluign

wraith rapids
#

uh, don't

eternal oxide
#

then it goes in the resources folder

wraith rapids
#

that is going to make the server shit bricks with a lot of players

thick tundra
#

oh

wraith rapids
#

player move event fires like multiple times a tick

#

and having worldguard check every player's location against every region for every player every time any player moves

eternal oxide
wraith rapids
#

is unwise

eternal oxide
#

only process IF the player has moved a full block

#

so getFrom().getBlockX() != getTo().getBlockX() etc

thick tundra
#

yeah but idk if this is a good option xD

#

ill just go ask those guys at the other discord

#

or something

eternal oxide
#

its teh only option if you need to check players entering an area

young knoll
#

I’m pretty sure get members gets the list of added players

#

Not the players inside it

#

Also there is a region entry event iirc

wraith rapids
#

yeeeah that's also true

#

members are like the owners/residents of a region

#

not just the people in it

thick tundra
#

i want a countdown on a hologram to tick down when players are in a area

#

then when it hits 0 it triggers a method

#

thats it

eternal oxide
#

If they have an enters event use it

thick tundra
#

yea and reset when they leave right?

eternal oxide
#

it will be running the same code as you on move

quaint mantle
#

i have been kicked for the 3rd time

#

what i meant to say

#

wHy tHe fUcK is pLugIn.yml Not ComPiLiNG

#

hello?

#

have you all given up on me

glass sparrow
#

hi yowsheeeeee

wraith rapids
#

a long time ago

glass sparrow
#

show yml

quaint mantle
#

helo

glass sparrow
#

oh if nny couldnt fix it i wont

#

bye

quaint mantle
wraith rapids
#

the issue isn't his yml, it's him

#

he has not written a line of java ever and refuses to read a guide

quaint mantle
#

u assume i am male???

wraith rapids
#

and has no idea what he is doing

quaint mantle
#

i am but still

#

again

#

why

glass sparrow
#

yowshee google learn java in 3 hours

#

then come back in 3 houts

eternal oxide
quaint mantle
#

the entire one will be How TO DO HELO WORL

quaint mantle
glass sparrow
#

then learn that

#

more than you know atm

quaint mantle
#

nein

#

poekls

#

pls

#

tel me

#

why plugin.yml not compile

thick tundra
#

JUST

#

DO

#

THIS

quaint mantle
#

I SELECTED THAT

#

I SELECTED SPIGTO

#

SPIGOT

thick tundra
clever plover
#

Hey! I have a problem, im developing a custom items plugin, but if i enchant the weapon it doesnt has its abilities anymore. I do know why, because i made the event only executing, when you have an item with that item meta. I want my players to enchant it by themselves so i couldnt just add the enchantments in the meta.

thick tundra
quaint mantle
thick tundra
#

WOW

#

its in test

quaint mantle
#

wyht

thick tundra
#

not main

#

omg

quaint mantle
#

waht

#

where do i put

wraith rapids
#

it's in the fucking test directory

thick tundra
#

yes

quaint mantle
#

where do put

glass sparrow
#

what the fuck

thick tundra
#

just put it in the main directory

wraith rapids
#

in the correct directory

quaint mantle
#

oh

wraith rapids
#

now he's going to literally put it in the main directory

thick tundra
#

you sure you selected spigot. because for me it put it into the main folder automatically

#

else create a new project

#

and just copy everything over

quaint mantle
#

this good?

    main: 1.0
  version: 1```
thick tundra
#

uh

#

okay so i just recommend you to make a new project and copy everything over

quaint mantle
#

whAT

#

i squoosh mouse

#

becus me angy

wraith rapids
#

i recommend you give up

thick tundra
#

well the minecraft developer plugin automatically makes a yml file for you

quaint mantle
glass sparrow
#

i recommend you learn how to code

clever plover
#

I have a problem, im developing a custom items plugin, but if i enchant the weapon it doesnt has its abilities anymore. I do know why, because i made the event only executing, when you have an item with that item meta. I want my players to enchant it by themselves so i couldnt just add the enchantments in the meta.

wraith rapids
#

enchanting an item changes the item meta

#

because the enchant is stores in the item meta

#

if you are doing isSimilar or equals or whatever, an item with an enchant will obviously not be equal to an item that does not have an enchant

#

what you should do is use the persistent data container of the itemmeta to store a tag

#

and then use that tag to identify the item

clever plover
#

ok im gonna try

zinc saffron
#

Does the PotionSplashEvent also trigger when throwing lingering potions? or do i need a seperate LingeringPotionSplashEvent?

vast quest
#

which type of listener should I use to just changed the packet completely

#

like monitor or veryhigh

#

or high

eternal oxide
#

No changes on Monitor

vast quest
#

so

#

HIGHEST?

eternal oxide
#

depends on what you are doing

vast quest
#

uh some sort of runes that come up on attack

#

trying to cancel the damage_indicator particle

eternal oxide
#

if you are always going to cancel then highest

vast quest
#

ok

#

uh dumb question but

#

how can I check if its only damage_indicator type of apcket

eternal oxide
#

That would be protocolLib not spigot

vast quest
#

o ye

#

imma go to their discord

#

they dont efen have a discord

#

welp ig

maiden briar
#
public class BukkitPlugin extends JavaPlugin implements UniversalPlugin
{
    @Override
    public InputStream getResource(String name)
    {
        return ((JavaPlugin) this).getResource(name);
    }
...

Why do I get this error? java.lang.StackOverflowError: null

eternal oxide
#

that method is calling itself

maiden briar
#

I just want to call the JavaPlugin method, if I click with my mousewheel I will also get the JavaPlugin method

eternal oxide
#

You are overriding so use super

maiden briar
#

Ok

#

But I override from my UniversalPlugin

#

But super is an option, thanks

eternal oxide
#
    @Override
    public InputStream getResource(String name)
    {
        return super.getResource(name);
    }```
maiden briar
#

Yes thanks

#

Btw is there an option that I can override onEnable from JavaPlugin, and do my thing and then the plugin which is extending my plugin must use my onEnable?

ivory sleet
#

If your universal plugin actually has logic why is it an interface

maiden briar
#

Cause I want to have multiple bungee and bukkit support, and both have 2 the same methods so for some of my classes it doesn't matter if it's bungee of bukkit

ivory sleet
#

Have you seen luckperms? They kinda fix this by splitting common bootstrapping into a separate class while platform based bootstrapping happens in the entry point class

maiden briar
#

Can you show the source?

ivory sleet
maiden briar
#

And which class?

ivory sleet
#

common/.../plugin/
bukkit/.../
Classes named like LuckPermsPlugin, LuckPermsBootstrap etc

maiden briar
#

Ok

quaint mantle
#

lol

quaint mantle
#

thank you 🙂

vast quest
#

pog you!

quaint mantle
#

also thank @thick tundra

#

he helped me

maiden briar
#

You don't need so many classes for the same event....

vast quest
#

it kinda seems like uh waste of classes

#

;-;

quaint mantle
vast quest
#

yeah but like...

hybrid spoke
#

stop guys

#

let him do his thing

#

let him live the moment

quaint mantle
#

its easier for me to access

vast quest
#

idk its just copypaste ;-;

#

atleast u could have made a config for it

#

;-;

hybrid spoke
ivory sleet
#

Tho why is it called Event when you’re just listening to an event. By the looks of it one could be fooled enough thinking that’s an api

eternal oxide
ivory sleet
#

Not really

quaint mantle
hybrid spoke
vast quest
#

we really ruined the moment for him

#

lmfao

quaint mantle
#

tf

#

its my first day

#

i #

#

leraned basic java

#

and coded a plugin

ivory sleet
#

At least no static abuse (:

quaint mantle
#

what is static abuse

hybrid spoke
#

a bad thing

vast quest
#

something bad

hybrid spoke
#

what i actually do

ivory sleet
#

People who uses the keyword static whenever they want to design logic

hybrid spoke
#

and i am too lazy to change my static abuse

quaint mantle
#

can yall try t out?

eternal oxide
# quaint mantle bruh

You could just do java switch (blockBroken.getType()) { case DIAMOND_ORE: //code break; case IRON_ORE: //code break; default: }

vast quest
#

^^^^^^^^

#

and add a... config

quaint mantle
#

BRO

#

ITS MY FIRST DAY ON JAVA

vast quest
#

well

hybrid spoke
#

they are just giving you tips

vast quest
#

configs are not hard

#

;-;

quaint mantle
#

first

#

day

#

FIRST

#

1

#

ONE

hybrid spoke
#

they don't judge u, we'all are proud of you

vast quest
#

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

hybrid spoke
#

if you spam more i change my mind

wary harness
#

xd

quaint mantle
#

nvm

wary harness
#

suggestion

#

first learn java from some tutorial

quaint mantle
#

i swear to god if you rate it one star-

hybrid spoke
#

can any1 rate it two star?

vast quest
#

sure if u ask so

hybrid spoke
#

store the entity and sent living entity packet 🤔

#

if your entity isn't a LivingEntity yes

vast quest
#

ciphe

#

can u tell me how on earth can I listen for DAMAGE_INDICATOR particle

opal juniper
#

Can you change the colour of light

hybrid spoke
hybrid spoke
vast quest
#

I couldnt find it

#

:/

hybrid spoke
#

seems like you just have to catch the particle effect packet, check if the particles are those which you don't want and block/cancel it

hybrid spoke
sharp bough
#

how can i add a white bed to a gui on 1.12?when i try to make an itemstack with material: Material.WHITE_BED with amount 1 add some meta to it and add it to a inv i get No such field error: WHITE_BED

vast quest
#

oh

#

Hippidy hoppidy ur code is now my property

eternal oxide
vast quest
#

1.16

eternal oxide
#

Java not spigot

#

8, 9, 11, 15?

vast quest
#

o I dunno

#

how can I check thgat

sharp bough
#

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

#

in your pom

quaint mantle
#

Anyone can help me setup a script to automatically execute ./start.sh if the process -java spigot.jar is not running?

vast quest
#

1.8

minor garnet
#

how i disable a colidition of projectile between entity using a spigot api ?

eternal oxide
#

?paste

queen dragonBOT
eternal oxide
quaint mantle
#

ok

#

thx

#

also

#

how do i make a config

vast quest
#

just

#

config.yml

quaint mantle
#

and then

#

how do i make it ACTUALLY CHANGE THE CODE

hybrid spoke
#

xD

quaint mantle
#

and how do i generate it

vast quest
#

add it and put
saveDefaultConfig();

#

in ur on enable

quaint mantle
#

wdym

quaint mantle
#
    static {
        replacements.put(Material.DIAMOND_ORE, Material.IRON_ORE);
        replacements.put(Material.EMERALD_ORE, Material.LAPIS_ORE);
        replacements.put(Material.GOLD_ORE, Material.REDSTONE);
        replacements.put(Material.IRON_ORE, Material.DIAMOND);
        replacements.put(Material.LAPIS_ORE, Material.EMERALD);
        replacements.put(Material.REDSTONE_ORE, Material.GOLD_ORE);
    }

    @EventHandler
    public void onPlayerBreakBlock(BlockBreakEvent event) {

        Block blockBroken = event.getBlock();
        Material material = blockBroken.getType();

        if (replacements.keySet().contains(material)) {

            event.setCancelled(true);

            blockBroken.setType(Material.AIR);
            ItemStack itemDrop = new ItemStack(replacements.get(material));
            blockBroken.getWorld().dropItemNaturally(blockBroken.getLocation(), itemDrop);
        }
    }```
#

Hello here! config getkeys returning only first key! My config looks like:

data:
   test:
     d: 1
   ee:
     a: 2

and code:

for (String name : ReactData.ReactDataFile.getConfigurationSection("data").getKeys(false)) {
            Bukkit.broadcastMessage(name + " <");
``` and it returns only test
#

where is on enable

#

ohh

#

in the main one

#

okkk

eternal oxide
#

Yep, thats all the code you need in one listener class

quaint mantle
#

ok

vast quest
#

ayo how much do I have to wait for the plugin to update the config.yml

#

afte like setting it to smth

eternal oxide
#

you have to save it

vast quest
#

o

#

that makes

#

alot of sense

#

actually

quaint mantle
#

wait but how do i make it NOT generate a config if it has been already made

#

actually nvm

#

config too hard

eternal oxide
#

this.saveDefaultConfig() in your onEnable

#

saves a config from your jar to the plugins data folder, IF one doesn;t exist

quaint mantle
#

ok

#

and how do i make it actually change

#

because rn it does nothing

eternal oxide
#

what are you trying to change?

quaint mantle
#

what items will drop when the ore is mines

#

mined

eternal oxide
#

do you have anything in yoru config now?

quaint mantle
#

waht

eternal oxide
#

Have you thought about having it drop a random type?

#

then you need no config

quaint mantle
#

so basically i can put at the start random: true

#

or false

#

and if it is true

eternal oxide
#

No real point in customizing. As soon as players break an ore they know what to look for

quaint mantle
#

ok

#

so i do random

#

how do i do random

eternal oxide
#

thats even easier

quaint mantle
#

how

#

How

#

@eternal oxide pls

eternal oxide
#

sec

quaint mantle
#

Pls help I need antigrief chest plugin

#

And login plugins pls help

#

nlogin for login

sharp bough
#

is there a config.reload or do i must use YamlConfiguration.loadConfiguration

#

File file = new File(plugin.getDataFolder().getAbsolutePath() + "/config.yml");
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);

#

like that

sharp bough
quaint mantle
#

I need best login plugin

vast quest
#

how can I summon particles with protocolib

quaint mantle
#

OK tysm

sharp bough
quaint mantle
#

here

#

now piss off

#

this is for coding

sharp bough
#

yea fk off

quaint mantle
#

not plgin recommendations

quaint mantle
#

not i nEED l0gin plUgIN

#

i cAnt BuY MinECrAFT

vast quest
#

How can I send a global particle?

quaint mantle
#

i think this is what you want

vast quest
#

o yeah I think so

quaint mantle
#

ok

hybrid spoke
#

wtf guys

#

be friendly

quaint mantle
#

wdym

#

i gave him the particle thing

eternal oxide
quaint mantle
#

that just gives you a random ore

vast quest
#

uh um

#

l.getWorld().spawnParticle(Particle.CRIT_MAGIC,l2,8, 0.3F, 0.2F, 0.3F); this will work right

#

idk

eternal oxide
vast quest
#

whats the 0,3D 9,2D

#

and stuff

eternal oxide
hybrid spoke
hybrid spoke
#

...

#

bot flaggin me

quaint mantle
#

they do be like that tho

#

does anyone have an array of every item in mc?

eternal oxide
#

Every item has a Material

quaint mantle
#

so

lilac dagger
#

Material.values()

eternal oxide
#

so

quaint mantle
#

so i should set random to Material.values()

#

and it will drop anything?

eternal oxide
#

it would

lilac dagger
#

yes

eternal oxide
#

however no

quaint mantle
#

how

eternal oxide
#

if you just set random to teh Material.values() it would drop a random item when you broke anything

quaint mantle
#

hmm

#

how do i fix

#

myb i could check if block broken is an ore?

eternal oxide
#

You need teh random List to check what block was broken on line 8

#

You need a second list for rewards OR pick a random from Material.values()

lilac dagger
quaint mantle
#

yeh that fine

#

i just want it to drop anything

#

since that is a variable i could make a config.yml also

#

bcz anyone could enter in their own material

#

maybe an if else statement?

vast quest
#
    public void Damage(EntityDamageByEntityEvent event) {
        if(event.getDamager() instanceof Player) {
            if(getConfig().getBoolean("Status", true)) {
                Location l = event.getDamager().getLocation();
                String p = getConfig().getString("Particle");
                l.getWorld().spawnParticle(Particle.p, l, 1);
            }
        }
    }``` what am I missing
#

seems like I cant use it but does anyone know how

#

this part

#

l.getWorld().spawnParticle(Particle.p, l, 1);

quaint mantle
#

if block broken is one of these blocks then just choose a random block to drop from the same list
but if not then just drop what would normally be dropped

eternal oxide
#

However I'd not recomend use that

vast quest
#

can I use a varuable in a particle text

#

like her

#

Particle.p,

quaint mantle
eternal oxide
#

You could drop a command block

#

or spawn eggs

#

it covers literally every item in Minecraft

quaint mantle
#

ok

eternal oxide
#

I'd recomend you make a rewards list for it to pick from

quaint mantle
#

no

#

any item

#

i dont care what it is

eternal oxide
#

ok

eternal oxide
vast quest
#

yeah but

#

how can I make it work

#

make the var a particle?

sharp bough
#

how can i teleport a player to a location saved as a lore

#

Location loc = (Location) clickedItem.getItemMeta().getLore();

#

doesnt work

eternal oxide
#

Particle.valueOf(p)

sharp bough
#

i need to open a gui and send them to the location of the item clicked (the item has a lore with coordinates)

vast quest
#

ok

#

doesnt seem to work

eternal oxide
sharp bough
#

i got the lore as an array [x,y,z]

#

i dont get why i cant cast that to a location and send the player there tho

eternal oxide
#

you can;t cast it as its not a sub type of Location

#

you need new Location(values here )

sharp bough
#

i currently have the location saved there

young knoll
#

so use new Location(world, x, y, z)

eternal oxide
#

then create a new Location from them

vast quest
#

hey uh

#

what am I doing wrong

#
    public void Damage(EntityDamageByEntityEvent event) {
        if(event.getDamager() instanceof Player) {
            if(getConfig().getBoolean("Status", true)) {
                Location l = event.getEntity().getLocation();
                String p = getConfig().getString("Particle");
                if(event.getDamager().hasPermission(Objects.requireNonNull(getConfig().getString("RunePerm")))) {
                    event.getEntity().getWorld().spawnParticle(Particle.valueOf(p), l, 1);
                    event.getDamager().sendMessage("Works also " + p + l);
                } else {
                    event.getDamager().sendMessage(ChatColor.RED + "[!] " + ChatColor.GRAY + getConfig().getString("NoPerm"));
                }
            }
        }
    }```
sharp bough
#

you have too much code piled up, you have no idea what you are doing because you simply cant see what you are doing

#

lol

vast quest
#

nope

sharp bough
#

split that into functions and you will see

vast quest
#

it doesnt even send the message

sharp bough
#

how it starts working on its own

vast quest
#

I dont even think the event is right

#

im just going to debug

onyx shale
#

i assume you correctly registerd the event and have the eventhandler annotation

vast quest
#

OH

#

forgot to register

#

im dumb ok

upper vale
#

possible to expand the hitbox here?

onyx shale
#

if you have ur own hitbox system yeah,if not no

upper vale
#

wdym custom hitbox system

onyx shale
#

some have such system for diferent things(mostly gun based)

stone sinew
onyx shale
#

basically armortands simulating body parts or such

upper vale
#

i guess ill go with the aabb solution

vast quest
#

please if ur making a custom hitbox system make it properly

upper vale
#

non-alighed-axis bounding boxes when @mojang:c_:

sharp bough
#

how can i change a string to a world ?

onyx shale
#

you get the world by name thru bukkit

sharp bough
#

clickedItem.getItemMeta().getLore().get(0)

onyx shale
#

Bukkit.getWorld(name)

sharp bough
#

ah

onyx shale
#

also its nullable so yeah..

sharp bough
#

thanks

solemn shoal
#

hello guys welcome to my minecraft lets play

#

jk

vast quest
#

will touppercase make it so it will be like CRIT

onyx shale
#

well the method name...

vast quest
#

hmmm

quaint mantle
#

k

onyx shale
#

and yes it will make everything

vast quest
#

aaaaaaaa

#

everything works except the particle spawning

#

event.getEntity().getWorld().spawnParticle(Particle.valueOf(ps), l, 1);

#

Location l = event.getEntity().getLocation();
String p = getConfig().getString("Particle");
String ps = p.toUpperCase();

vast quest
#

huh

quaint mantle
#

hey uhhh

#

@eternal oxide i got an error java.lang.ClassCastException: com.yowshee.randomore.BlockBreak cannot be cast to org.bukkit.event.Listener

opal juniper
#

Hey @lost matrix, you know the method you made a while back to show entities, it seems to not work with other players...
i never really noticed though cause i always tested it alone

eternal oxide
quaint mantle
#

yeah

#

how di i fix that

opal juniper
#

idrk why though, i tried adding an EntityPlayer selection but it doesn't change anything

eternal oxide
#

a Method is inside a class. The class implements Listener

quaint mantle
eternal oxide
#

?paste No clue, you'd need to show code

queen dragonBOT
quaint mantle
#

kk

opal juniper
eternal oxide
#

BlockBreak implements Listener

quaint mantle
#

how

opal juniper
#

public class BlockBreak implements Listener{

vast quest
#

someone help for some reason I cant spawn the particles Location l = event.getEntity().getLocation(); String p = getConfig().getString("Particle"); String ps = p.toUpperCase(); if(event.getDamager().hasPermission(Objects.requireNonNull(getConfig().getString("RunePerm")))) { event.getEntity().getWorld().spawnParticle(Particle.valueOf(ps), l, 1); event.getDamager().sendMessage("Works also " + p + l + event.getEntity());

#

the locations work

quaint mantle
opal juniper
#

like i said

quaint mantle
#

ok

sharp bough
#

this is one line of code

#

Location loc = new Location(Bukkit.getWorld(Objects.requireNonNull(clickedItem.getItemMeta().getLore()).get(0)) , Double.parseDouble(clickedItem.getItemMeta().getLore().get(1)),Double.parseDouble(clickedItem.getItemMeta().getLore().get(2)),Double.parseDouble(clickedItem.getItemMeta().getLore().get(3)));

#

lol

eternal oxide
#

Stop using Objects.requireNonNull its pointless and only hiding any issues you have

#

create your objects properly

wraith rapids
#

Objects.requireNonNull explodes if it is null

#

it doesn't make things magically not null

#

it just makes null things explode sooner

vast quest
wraith rapids
#

you can hide it by doing

try {
   //your code
}
catch (NullPointerException ignore) {}
vast quest
#

can someone tell me why my particles arent workin

#

event.getEntity().getWorld().spawnParticle(Particle.valueOf(p), l, 500, 2, 2, 2, 0.1);

wraith rapids
#

define not working

vast quest
#

does not spawn particles

eternal oxide
#

check your valueOf is returning a valid particle

vast quest
#

it does event.getDamager().sendMessage(p + l + event.getEntity());

#

have tried this

wraith rapids
#

if it doesn't find a proper particle by that name it should explode because it's an illegal argument

#

but if the code runs without exceptions yet doesn't spawn anything, dunno

eternal oxide
#

What particle are you attempting to spawn?

vast quest
#

I have tried CRIT and DAMAGE_INDICATOR

#

and ASH

wraith rapids
#

is there a function in like java standard libraries or apache commons or something to get the lexicographic distance between two strings

#

not levenshtein distance, mind you

eternal oxide
#

if you already have l as a location, just use l.getWorld().spawn

#

and try somethign simple like l.getWorld().spawnParticle(Particle.CLOUD, l.getLocation(), 100);

vast quest
#

l i the location of the entity tho

eternal oxide
#

doesn't matter, its in the same world

wraith rapids
#

i guess computing the lexicographic values of and distances between strings is kind of expensive

vast quest
#

ok done but uh

#

about not spawning

#

:P

eternal oxide
#

if it doesn;t spawn with a simple spawn code as I showed you its the rest of yoru logic thats failing

vast quest
#

o wait

#

I didnt even see that

wraith rapids
#

i guess i'll just do it myself

eternal oxide
#

so now replace the particle and see what happens

vast quest
#

doesnt work

#

:/

eternal oxide
#

so teh issue is yoru particle it seems

vast quest
#

WAIT

#

IM STUPID

#

YES I AM STUPID

eternal oxide
#

ok

vast quest
#

completely forgot I made it so damage indicator packets are not sewnt

quaint mantle
#

Hello everyone if someone needs to setup plugins or server for free dm me. I can help you make it. I am Jr.Developer.

eternal oxide
#

?services

queen dragonBOT
vast quest
#

uh dumb question but can I add 2 blocks to the Y value of l

eternal oxide
#

yes

vast quest
#

ok

#

now for the next question coming up....

#

How?

eternal oxide
#

type l.add and see what shows up

nova hare
#

hey how do i send some one a message on spigot*

vast quest
#

mm so

#

l.add(0, 2, 0)

#

will add 2 to the y

#

value

alpine urchin
#

to send a message to a player you use Player#sendMessage

#

so
player.sendMessage("Your message");

vast quest
#

y do ppl use #

#

instead of .

wraith rapids
#

because . implies it's a static method

vast quest
#

o

wraith rapids
#

:: is technically the "correct" indicator for instance methods

#

but # works just as well

alpine urchin
#

yes

#

@nova hare

nova hare
#

were do i go tho

alpine urchin
#

wraith rapids
#

are you trying to send someone a message on the spigot website

#

inb4

nova hare
alpine urchin
#

you said player

nova hare
#

I am here

wraith rapids
#

i fucking called it

alpine urchin
#

ok

wraith rapids
#

this is the developer channel

#

shoo

#

only sub 70 iq junior developers allowed here

nova hare
#

?

nova hare
wraith rapids
#

to #general

nova hare
#

I was told to go here

eternal oxide
#

I bet you were not

wraith rapids
#

they misunderstood your question

#

they thought you wanted to code a plugin

#

which you are not

nova hare
#

OH

young knoll
#

So my core plugin has class like StringUtil and FileUtil, should I add something to the name to help distinguish them from the 50 other classes with those names.

wraith rapids
#

not really

eternal oxide
#

thats what packages are for

wraith rapids
#

the class name should indicate what it does

#

the package name is responsible for distinguishing it from the 50 other such classes

young knoll
#

Fair

wraith rapids
#

of course if you have to use all of those 50 classes in a single class, you might want to do something about it

young knoll
#

Some libraries like to make classes named String, and my IDE loves to import them by default sometimes

cinder thistle
#

yeesh yeah don't make a god class

wraith rapids
#

yeeeah I don't think calling things String or any of the other standard library class names is a good idea

young knoll
#

Agreed

cinder thistle
#

if you can't avoid it...

#

then your code is flawed :D

wraith rapids
#

i've started adding Master and Slave to class names at random

young knoll
#

I think you have to call it Main now

#

According to github :p

wraith rapids
#

yeah well fuck them

#

i don't have any public github repositories but I've changed the main branch back to master manually on all of the private ones

eternal oxide
#

you should start using cuck and simp too

young knoll
#

I changed the default back

paper viper
#

simp?

wraith rapids
#

i've also added several branches with names typical to black people with a _slave suffix

opal juniper
wraith rapids
#

if you call attention to something, it will have more attention drawn to it

vast phoenix
#

does anyone know what packet calls PlayerInteractEvent

wraith rapids
#

the arm animation packet

vast phoenix
#

the right click with empty hand

wraith rapids
#

whatever it was called

vast phoenix
#

that doesn't work for me

#

that only works for left clicks

wraith rapids
#

define doesn't work

vast phoenix
#

doesn't work as in i'm listening to the arm animation packet

#

and I'm making it output to console but it's not outputting anything when right clicking

#

only when left clicking

wraith rapids
#

could be that it monitors a different packet for right clicks, I don't remember

#

what are you doing though

vast phoenix
#

I have a plugin for my roleplay server but I have a different server for every city/town in my roleplay server.

#

So the inventory has to load from the database when a player joins, but I want to cancel every possible interaction.

#

of every plugin

wraith rapids
#

block AsyncPlayerPreLogin event until the inventory is loaded

#

you can block it up to 30 seconds before the client times out

vast phoenix
#

would an inventory still load then?

#

as in would I still be able to add items to a player's inventory

wraith rapids
#

the player isn't on the server yet during the event

#

so no plugin can interact with the player

vast phoenix
#

so that wouldn't work

urban trout
wraith rapids
#

you can probably write the inventory data to the offline player's file

vast phoenix
#

that would work

wraith rapids
#

and leave it to the server to load it from there atomically

vast phoenix
#

that sucks haha

#

that means I will have to rewrite everything haha

#

thank you

#

ill try this 🙂

eternal oxide
#

just build the inventory in the PlayerJoinEvent. Whats the issue?

wraith rapids
#

i'm not sure whether the inventory is loaded from disk before or after the event, so check and make sure it's done after

vast phoenix
#

yes

vast phoenix
mortal hare
#

why sending packets from the main thread is faster than from the netty thread wtf

eternal oxide
#

the Interact event can;t fire during the PlayerJoinEvent

wraith rapids
#

i'm not 100% sure but common sense would kind of dictate that the player can't fire interact events before the join event finishes for it

mortal hare
#

i get way much faster response time to the client when sending packets via main threads

vast phoenix
#

the loading takes up to 3-4 seconds.

wraith rapids
#

preload the data in async prelogin

#

then apply the data on login

mortal hare
#

im not using schedulers

hybrid spoke
#

yeah obv

vast phoenix
eternal oxide
#

yeah, 3-4 seconds is yoru data access times. Have the data ready

mortal hare
#

why are they delayed?

wraith rapids
#

most packets need to be scheduled to the main thread to be sent

mortal hare
#

oh

wraith rapids
#

so you still get some thread hopping overhead if you send them off the main thread

#

compared to just immediately getting shat out the tube on the main thread

mortal hare
#

why do they schedule the packets

#

instead of just firing them

vast phoenix
wraith rapids
#

i don't remember, on paper it's because of the anti xray processing

#

don't know if it happens on spigot or if it does why

vast phoenix
#

and I also have plugins for backpacks etc that have to be unable to open during loading

mortal hare
#

well im using purpur

#

could be that's the case

wraith rapids
#

read the data from your database during the async prelogin

#

block until it's ready

#

then on actual login, apply the ready data

wide galleon
wraith rapids
#

that way the server doesn't shit bricks because you're blocking the join event

vast phoenix
#

yes I'll try that thank you 🙂

eternal oxide
mortal hare
#

should i send packets via main thread instead then? i get way faster response time of client

wraith rapids
#

depends

mortal hare
#

its like 1 second faster

#

no joke

wraith rapids
#

that doesn't sound like it would be caused by just thread hopping alone

vast phoenix
#

I'm already using hte AsyncPreLoginEvent

mortal hare
#

well im overexageratting

wraith rapids
#

thread hopping would be like a few milliseconds at most

mortal hare
#

its like 500-250 ms

#

delay

vast phoenix
#

but never thought of making the inventory data ready there too

wraith rapids
#

make everything ready there

vast phoenix
#

yeah thank you for the help

wraith rapids
#

lots of plugins make the mistake of making everything ready in the join event

#

which starts stacking up when you have 50 plugins doing dumb shit in the same tick

vast phoenix
#

haha

wraith rapids
#

even seemingly negligible time usage of a few fractions of a millisecond from loading a bukkit yml file for the player or some shit stacks up quickly

vast phoenix
#

You said I have like 30 seconds in the AsyncPreLoginEvent right

wraith rapids
#

yeah

vast phoenix
#

because at the PlayerQuitEvent in the other server it saves the inventory

#

and it needs about 2 secs to make sure its totally saved

#

to prevent inventory loss

#

to the database^^

wraith rapids
#

if the client doesn't receive any packets from the server in 30 seconds, the connection is timed out

vast phoenix
#

okay thank you

wraith rapids
#

and the server doesn't send any packets while you block the event

eternal oxide
#

(for that specific player)

wraith rapids
#

you could maybe get around it by throwing keepalive packets at the player but that seems kind of dubious

vast phoenix
#

wouldn't need that the longest this has taken ever was max 10 secs

vast phoenix
#

(the loading)

mortal hare
#

before ^

#

after

vast phoenix
#

so I think I'll be fine

wraith rapids
#

mm

#

do it on the main thread if you need to i guess

wraith rapids
#

but using like the bukkit scheduler to hop onto the main thread should 100% be slower than letting the server sync it for packet sending

wide galleon
vast phoenix
#

location or player = null

mortal hare
#

im using DedicatedServer

vast phoenix
#

and looking at your event

mortal hare
#

.executeSync()

vast phoenix
#

it's probably location

mortal hare
#

which executes it instantly

vast phoenix
#

because player is from the PlayerMoveEvent

eternal oxide
#

use UUID not player

mortal hare
#

by using .get()

vast phoenix
#

that too

wraith rapids
#

well, more or less instantly

wide galleon
vast phoenix
#

unless you really need Player

wraith rapids
#

it can't exactly terminate stuff like plugin code or individual entity ticking to just do it instantly

vast phoenix
eternal oxide
#

Its safer to get a player from a UUID as the UUID object is persistent. Player is not

wraith rapids
#

but it might be able to splice it in between ticking of individual entities or however it works

#

haven't looked at the impl

mortal hare
# wraith rapids well, more or less instantly

tbh i always wondered wtf caused that delay because when i enable netty channel chaining, and let NMS handle it its instant and when i would disable it its not instant. Now i know, thanks! I've been investigating this shit for weeks.

#

❤️

wraith rapids
#

also do you know any library methods for calculating the lexicographic distance between two strings

vast phoenix
#

@wide galleon just assign the new HashMap<>(); after the variable

#

because now you're assigning it to a static method in your class constructor

wide galleon
#

so like this? public static HashMap<UUID, Location> location = new HashMap<>();

vast phoenix
#

yes

wide galleon
#

and do I have to use the uuid or the player

vast phoenix
#

UUID

#

so player.getUniqueId();

wide galleon
#

okay

vast phoenix
#

see if that works

#

@wraith rapids do you have any idea if Thread.sleep(); would work in AsyncPlayerPreLoginEvent