#help-development

1 messages · Page 1622 of 1

crimson scarab
#

ty

#

i need it to differiante between ranged trident damage and melee

eternal night
#

it is linked to the item meta tho

#

so save the item meta first -> grab the PDC from it and then, after modifying the PDC, re-set the item meta

wraith apex
wraith apex
eternal night
#

^^ keep my prior message in mind for this, getItemMeta clones the item meta. This would not persist

wraith apex
#

sorry wait

#

no you're right it's not

#

getItemMeta clones the item meta

#

so you would have to

ItemMeta meta = stack.getItemMeta();
meta.getPersistentDataContainer().set(new NamespacedKey(plugin.getInstance(),"trident_damage"),PersistentDataType.INTEGER,100);
stack.setItemMeta(meta);
crimson scarab
#

wait how to the itemstack of the projectile launched

#

if thats possible

wraith apex
#

I've been awake for 29 hours running off of will power and caffine

bright jasper
#

How should i structure this

#

Chat event is the only one that has other classes it uses

#

Should i just put it in its own nested package or should i put the other classes chat uses into a package and put SpigotChatEvent in the events package

crimson scarab
wraith apex
wraith apex
crimson scarab
#

as it leaves the hand

wraith apex
#

well you would have a ProjectLaunchEvent listener

#

to listen for projectile launching

#

this even is ran just before the item in the players inventory goes blank

#

so You can get get what Item they threw by getting who shot the projectile, in this case the trident

#

Here, have a quick read of this

dense remnant
#

How do I get the tps of a server again?

eternal oxide
#

You don't with Spigot

sharp garden
#

Hey guys!
Been messing around with custom enchants a bit lately and wanted to make an enchant that can increase xp drops, although whatever I try with the BlockBreakEvent it seems to drop the exp orb in game, but there is literally no exp in it. However, when I go to increase xp drops from mob kills there are no issues whatsoever.
Been reading through the docs and forum posts about this, but I can't seem to find anything relevant

Hoping some of y'all know a bit more about this than I do, and that we can figure something out 😄

Below is the code used to (try) and modify the exp drops from breaking a block
https://pastebin.com/Ctvv4kye

eternal oxide
eternal oxide
#

brain too fast for fingers

hybrid spoke
eternal oxide
#

It may do nothign, but its worth a try

sharp garden
#

Although I can't get the player from that event

midnight quarry
#

hey guys, I am modifying max health of Player using Attributes

eternal oxide
#

true

midnight quarry
#

but I am not saving any data.. is there a way I can reset the attributes?

eternal oxide
#

You are gettign completely empty exp orbs?

sharp garden
#

Yeah

eternal oxide
#

sysout your math

#

before and after

dense remnant
sharp garden
#

Well that doesn't really matter does it? Even if I return because the player doesn't even have the enchant, it still doesn't drop

eternal oxide
#

um, you are doing somethign else then. As simply returning will not result in zero exp

#

another plugin/event

sharp garden
#

There isn't though. This is the only plugin on my server as of right now

eternal oxide
#

Its simply impossible for just a return to set zero exp

chrome beacon
sharp garden
#

Well there sure is nothing else editing the values

chrome beacon
#

Should be a tutorial somwhere

eternal oxide
#

I'd take a few minutes break, then come back and glance over your code. Anything that is dealing with exp and block breaking

grim ice
#

Uh

#

?paste

undone axleBOT
grim ice
#

so i have this in my class

#

where should I put it?

#

at the top or?

eternal oxide
#

get rid of all those

#

make a Map

grim ice
#

o

eternal oxide
#

then put all yoru keys in a map

#

a single getter to pull one out

grim ice
#

Can you give me one example?

#

I'm not really familiar with maps

eternal oxide
#

Did you look at the code I sent you ages back using enums and keys?

grim ice
#

Nope. I'll look at it now

#

I think I have to use enums now

eternal oxide
#

If you are the same person that is. Yours was custom recipes?

wraith apex
#

Map<String,String> aMap = new HashMap<>();
A map is a type of parameterised data struct using a key -> value mapping

grim ice
#

why did u use name() tho?

#

is that a existing method

sharp garden
#

Okay @eternal oxide I got it to drop the exp from using a pickaxe with the enchant, but when I just return when the pickaxe doesn't have the enchant it still drops an orb with no exp

grim ice
#

this part
public NamespacedKey getKey() {
return NamespacedKey.fromString(name().toLowerCase(), RecipesManager.plugin);
} i dont understand

eternal oxide
eternal night
#

Where is that namespaces key class

eternal oxide
#

?paste this is a class I demo'd for him

undone axleBOT
eternal night
#

I'd argue against using name() if it's the Enum#name method

eternal oxide
ivory sleet
#

yeah functions do stuff

eternal oxide
#

name() is the recomended to use

eternal night
#

Says who xD

eternal oxide
#

the javadocs on teh method 🙂

hybrid spoke
#

teh

eternal oxide
#

Returns the name of this enum constant, exactly as declared in its enum declaration. Most programmers should use the toString() method in preference to this one, as the toString method may return a more user-friendly name. This method is designed primarily for use in specialized situations where correctness depends on getting the exact name, which will not vary from release to release.

#

we don;t want a "user friendly" we want precision

eternal night
#

Oh

grim ice
#

o

eternal night
#

Not what I was getting at tho

#

Using name binds directly to the enum field name

grim ice
#

i think i understood all the thing now

eternal night
#

Which is something that might change

#

Also kinda limits you in terms of separators (e.g - isn't supported)

#

Unless you do some replace logic

eternal oxide
#

The name can only change between version release. Which has no effect on this.

grim ice
#

but honestly i still dont think i can make something like that myself easily lmao

eternal night
#

Hmmm. Yeah I guess you have full control over the change of an enum name so you could implement conversation

grim ice
eternal oxide
#

its really simple when you break it down

grim ice
#

yeah i can understand it but i have no clue how to make it from zero

eternal oxide
#

The constructor public RecipesManager(JavaPlugin plugin) just loops over its own enum and creates teh recipes

grim ice
#

thats the easier part

eternal oxide
#

once the key is registered you don;t need to store or recreate it

#

its been created once, you can just pull it from teh keystore

grim ice
#

but'

#

name()

#

why did u write that

#

how does it know if what u mean by name() is what u mean

eternal oxide
#

yes, thats a method inside teh Enum. So any access to any element accesses that enums key

grim ice
eternal oxide
#

because you use Keys.ZOMBIE.getKey()

#

you specify which enum you want when accessing

grim ice
#

o

#

so u made a method to use

eternal oxide
#

inside the enum yes

#

look at the PlayerJoinEvent

#

it loops over each entry in the enum

#

retrieves its key and discoveres the recipe for the player

vivid temple
#

anyone an idea how i could turn config values into a hologram leaderboard?

grim ice
#

and where did u define key

eternal oxide
#

key?

grim ice
eternal oxide
#

Keys is the enum

grim ice
#

but u said key not Keys

eternal oxide
#

You mean this Arrays.stream(RecipesManager.Keys.values()).forEach(key -> { new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()); });

grim ice
#

yes

eternal oxide
#

that loops over (streams) each entry in the enum and passes it into teh lambda

#

its basically a for loop

grim ice
#

but

eternal oxide
#

key being each entry

grim ice
#

key is undefined?

#

what

#

does java use grammar

eternal oxide
#

its a lambda

grim ice
#

o

eternal oxide
#

so it for loops over each entry in teh enum (key)

tardy delta
#

how would i store my player homes with an uuid a name and a location

grim ice
#

what is materialKey?

eternal oxide
#

that is the order in which the recipe items are listed

sharp garden
#

@tardy delta I would do something like ```java
public void WriteNewWaypoint(Player player, Location location, String name) {
UUID playerUUID = player.getUniqueId();

    this.getConfig().set(playerUUID + "." + name + ".x" , location.getX());
    this.getConfig().set(playerUUID + "." + name + ".y" , location.getY());
    this.getConfig().set(playerUUID + "." + name + ".z" , location.getZ());
    this.getConfig().set(playerUUID + "." + name + ".w", WorldHelper.GetIntFromWorld(location.getWorld()));
    this.saveConfig();
}```
eternal oxide
#

like the matrix for ZOMBIE is "RDR", "DZD", "RDR"

tardy delta
# sharp garden <@!583252968497872900> I would do something like ```java public void WriteNe...

i go tthis

private void setHome(String name, Location l) {
        if (hasHome(p, name)) {
            Utils.message(p, "§cYou already have a home with that name, please try again!");
            return;
        } else if (hasAtleastOneHome(p) && hasLimitReached(p)) {
            Utils.message(p, "§cYou have reached the maximum amount of homes, please delete one first!");
            return;
        }
        name = "homes." + p.getUniqueId() + "." + name;
        homesFile.set(name + ".playerName", p.getName());
        homesFile.set(name + ".world", p.getWorld().getName());
        homesFile.set(name + ".x", (int) l.getX());
        homesFile.set(name + ".y", (int) l.getY());
        homesFile.set(name + ".z", (int) l.getZ());
        homesFile.set(name + ".yaw", l.getYaw());
        homesFile.set(name + ".pitch", l.getPitch());
        ConfigManager.saveConfig();
        Utils.message(p, String.format("§aSuccessfully set your new home! [%s]", name));
    }
eternal oxide
#

so it needs to know whast item DRZ are

#

because there is no order in teh recipe you add a key to say what each is

tardy delta
#

is there also nothing to write a location into a file?

eternal oxide
#

and you get "DRZ", new Material[] {Material.DIAMOND, Material.ROTTEN_FLESH, Material.ZOMBIE_HEAD})

grim ice
#

O

eternal oxide
#

3 entries in the key, 3 materials in the array

grim ice
#

yeah i just put it in intelliJ now it explains stuff

#

Arrays.stream(RecipesManager.Keys.values()).forEach(key -> { new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()); });
can be replaced with
Arrays.stream(RecipesManager.Keys.values()).forEach(key -> new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()));

#

right

tardy delta
#

hmm i was thinking about placing three datatypes in a map better i can make a home class

eternal oxide
#

I like the {} as its clearer adn used if you have more than one line of code

grim ice
#

whats array.stream?

tardy delta
#

makes a stream

eternal oxide
#

basically take every item from an array one at a time

ornate hollow
#

Anyone had luck using hibernate with plugins? Before i get into it i want to hear people;s opnions

tardy delta
#

twitch stream :/

grim ice
#

oh ok

#

@eternal oxide

#

why does this have 4 letters

#

"BSDE", new Material[] {Material.SLIME_BLOCK, Material.SLIME_BALL, Material.DIAMOND, Material.GOLD_NUGGET}),

#

"
BSDE"

eternal oxide
#

4 materials

grim ice
#

o right lmao

#

i jsut realized when i sent it here

eternal oxide
#

if you used 9 different items in your recipe you'd have 9 in the key and 9 materials.

grim ice
#

i think i got the code

#

i went thru all of it and i think i udnerstand it

eternal oxide
#

Good. Its not hard. The hardest part is understanding the enum

grim ice
#

(enums were the easiest)

#

lol

#

now ill add the 30 more recipes

#

:D

#

again

tardy delta
#

its possible to print a location to a file no?

eternal oxide
#

its serializable

tardy delta
#

uhh

eternal oxide
#

So yes

tardy delta
#

i'm making my own class for homes now and i dunno if it looks good

hybrid spoke
tardy delta
grim ice
#

\ehfuoawehfuoaehfuoaefuayefayewbfawfnawef

hybrid spoke
hybrid spoke
tardy delta
#

what do you mean by service class?

hybrid spoke
#

i mean the service layer design pattern

tardy delta
#

i'm considering to make a home class now

hybrid spoke
#

but i think in your case a simple manager should be fine

hybrid spoke
#

you just need a HomeService

tardy delta
#

yea thats the command

#

uhh lemme see

hybrid spoke
#

whaat

hybrid spoke
tardy delta
#

yea that wasnt

#

the link was the command

#

the screen the home class

opal juniper
#

skullMeta.setOwner(player); what is the arg here?

#

is it the players uuid / display name?

#

it needs a string name

tardy delta
#

can be both i think

#

isnt there one with uuid?

opal juniper
#

i will try uuid

tardy delta
opal juniper
#

meh its not teh uuid

tardy delta
#

displayname prob

opal juniper
#

ye it is

#

that seems stupid.... oh well

dense remnant
#

Whats the best way to get the current tps?

hybrid spoke
#

that should be enough for you

hybrid spoke
dense remnant
#

And how?

chrome beacon
#

NMS ;/

hybrid spoke
chrome beacon
#

Should be in the Minecraft Server class

hybrid spoke
#

or is there a way nowadays?

quaint mantle
dense remnant
quaint mantle
#

You’re telling me the /tps command isn’t a thing anymore?

dense remnant
#

It is

chrome beacon
#

You access the Minecraft Server class and read it

dense remnant
#

But how should I implement that into a plugin xd

chrome beacon
#

As I said a few hours ago there should be a guide online

hybrid spoke
grim ice
#

@eternal oxide what if i want to check for a config and only add the recipes if the config boolean is set to true

quaint mantle
#

Just look how the command does it in spigot

grim ice
#

not all recipes though, only a certain set of recipes

eternal oxide
grim ice
#

wdym?

eternal oxide
#

you can't dynamically change an enum

sharp garden
eternal oxide
#

you manage the registering though

grim ice
#

WAIT

eternal oxide
#

so in the class constructor the array.stream

grim ice
#

CANT I CHECK IF i = a certain number where the set of recipes start???

#

then check again if the config is true and continue

#

and if it isnt i break>

#

?

eternal oxide
#

If I were you I'd do a disabled list

grim ice
#

Wdym?

eternal oxide
#

a list in your config you add any recipes you want turned off

quaint mantle
#

if (config.getBoolean(whatever)) { use the recipe

grim ice
#

how do i do that is the problem

#

for(int i = 0; i < data.materialKey.length(); i++) {
recipe.setIngredient(data.materialKey.charAt(i), data.materials[i]);
if(i == 20){
break;
}
}

#

i thought about this thing

tardy delta
#

enable them all except for the ones in the file

grim ice
#

ill add 11

#

&&

#

and check if the config is set to true

dense remnant
grim ice
#

if it is then continue;

eternal oxide
#

look in the addRecipes() method

quaint mantle
#

You’re using a newer version of java

eternal oxide
#

disable any recipe you want turned off in the addRecipes() method

#

you simply don;t register it

grim ice
#

uh

#

idk

#

its registering everything though

eternal oxide
#

yes

#

you have to tell it what NOT to register

grim ice
#

honestly if i use the way i sent

#

it will prob fix it

eternal oxide
#

disabled = config.getStringList(path);

tardy delta
#

the best way to save data is on disable right?

#

to files

wraith apex
#

Well yes and no

#

You should save when you think its convenient for the server to do so

#

not just onDisable()

tardy delta
#

:/

wraith apex
#

what if the server crashes?

#

all data lost

#

ofc you should have a save method in onDisable by default

#

but also saving as you go

#

(if the values being saved are pretty small)

tardy delta
#

i'm saving homes to files

wraith apex
#

larger data would require a caching approach

tardy delta
#

so they're pretty small

wraith apex
#

aigh, then the former would be fine

#

just save when they update

tardy delta
#

wdym update?

grim ice
wraith apex
#

when any variable in the home changes

grim ice
#

the part is how to disable it

tardy delta
#

its not supposes to change

#

you make a home with your location

cold field
#

Hum guys, quick question. When you add a functionality to your plugin but later on you think that functionality will not be used so often. What do you do? Do you remove that functionality or do you keep it?

grim ice
#

I have thought of if(Onceuncraftable.INSTANCE.getConfig().getStringList("disabled").contains(data.name())){
i++;
break;
}

#

but will break stop the loop forever

#

i assume it will

wraith apex
#

yes

#

break means break out of the loop

#

continue means skip the rest of the code in this loop and go to the next loop

grim ice
#

do u think this will do

#

for(int i = 0; i < data.materialKey.length(); i++) {
if(Onceuncraftable.INSTANCE.getConfig().getStringList("disabled").contains(data.name())){
i++;
}
recipe.setIngredient(data.materialKey.charAt(i), data.materials[i]);

        }
        Bukkit.addRecipe(recipe);
    });
#

cuz without setting the integredient there will be an error and the recipe wont be registered

#

i just have to stop the error from showing in console

#

wait

#

how to check what stage is it in a array.stream

tardy delta
#

stage?

grim ice
#

yeah like

#

like

#

what

#

LIKE UH

#

ARRAYS HAVE

#

VALUES

#

RIGHT

tardy delta
#

yes

grim ice
#

what value is it in

#

for example here

#

Arrays.stream(Keys.values()).forEach(data -> {

#

what value is it on?

tardy delta
#

data

#

is the value

#

its like for (String data : values) {...}

dense remnant
#

How do I set the world type? There is no "level-type" in my server.properties

chrome beacon
#

You can add it and it should work

gritty urchin
#

Hey does anyone have any exprerience with TokenEnchant?

#

Specifically their API

tardy delta
#

is there an event for picking up arrows?

wraith apex
#

There is an event for picking up entities

#

PlayerPickupItemEvent

tardy delta
#

and whats PlayerPickupArrowEvent

wraith apex
#

yeah, I just saw that haha

tardy delta
#

Thrown when a player picks up an arrow from the ground

sullen dome
#

probably the same, just only for arrows lol

tardy delta
#

oh XD

wraith apex
#

y so special treatment for arrows

#

:c

tardy delta
#

i already have one for entities

#

so lets add it there

sullen dome
#

because theres a difference between an arrow that lies on the ground, and one that sticks in the ground

tardy delta
#

yea

#

i need more city smh

grim ice
#

@tardy delta

#

data

#

is

#

the Enums

#

i want to see what enum is it on

tardy delta
#

oh wew about what you said yesterday from the home command that caused stuff with essentials it seems the permission for the command is null :/

#

uhh

#

when i run myplugin:home everything works fine

grim ice
#

help

#

pls

proper cedar
#

wrong chat mb

waxen plinth
tardy delta
#

i disabled it

waxen plinth
#

Ok

sullen dome
#

is there a better way to let sheeps despawn, if they're in spawn-area, than checking for sheep every like 3-5 ticks? they destroy my spawn area

quaint mantle
#

net.minecraft.(...)

tardy delta
#

using essentials dev build now for trying to fix the problems..

#

😵‍💫

grim ice
#

help pls

chrome beacon
sullen dome
chrome beacon
#

It should spawn chunks are kept loaded

sullen dome
#

spawn area is always entity-processing, but not ticking

#

wait

grim ice
#

How do i check what value is it on now?
Arrays.stream(Keys.values()).forEach(data -> {

My Keys enum : public enum Keys {
ZOMBIE(Material.ZOMBIE_SPAWN_EGG,
"RDR", "DZD", "RDR",
"DRZ", new Material[] {Material.DIAMOND, Material.ROTTEN_FLESH, Material.ZOMBIE_HEAD}),
SKELETON(Material.SKELETON_SPAWN_EGG,
"BDB", "DSD", "BDB"....ETC

sullen dome
chrome beacon
#

I saw that

#

You need to find the cause of why

sullen dome
chrome beacon
#

.-. Paper

sullen dome
#

that still didnt got fixed lol

#

its on spigot too

#

i'm sorry

#

at least for me

grim ice
#

@chrome beacon

#

do yo uhave an idea

left plover
#

Is there any alternative to PlayerMoveEvent that does not cause TONS of lag?

chrome beacon
waxen plinth
#

PlayerMoveEvent is fired 20 times per second per player that is moving

#

Sounds like a lot but computers are fast

stone sinew
waxen plinth
#

As long as you don't do anything too slow in the event it should be fine

tardy delta
#

is it possible that the server throws an error when not knowing which tabcompleter to use (from which plugin)

waxen plinth
stone sinew
waxen plinth
waxen plinth
tardy delta
#

normally my plugin loads after essentials which has the same command as me

left plover
waxen plinth
#

Anyways, if you want to cut back on lag in your move event make sure everything you do in it is fast

#

And check runtime complexity

#

Beyond surface level advice, we can't help you without knowing exactly what you're trying to do

stone sinew
tardy delta
#

i got an error with my tabcomplete and the run from essentials

waxen plinth
#

Didn't you say you disabled essentials

left plover
#

Couldn't I just schedule a task to run every second, to check every online player's location?

tardy delta
#

i disabled the command from them

undone axleBOT
sullen dome
chrome beacon
#

Reproduce it in vanilla and submitt a new bug report so Mojang can fix it

sullen dome
#

i'm pretty sure thats not a vanilla bug lol.. never had that in past on my vanilla server

chrome beacon
#

Then create a plugin that disables the AI or removes animals from spawn while players are offline

sullen dome
#

true thats an idea

chrome beacon
sullen dome
#

i'll just make that plugin. ty

#

uh... is there a method to get the spawn area?

chrome beacon
#

Not really you will have to calculate that yourself

sullen dome
#

fuck

chrome beacon
#

Shouldn't be hard

sullen dome
#

yeah... idk how far it goes tho

chrome beacon
#

It's just a radius around world spawn

#

Check minecraft wiki

sullen dome
#

pretty sure, it's more than 21x21, where the sheep destroy the world lol

tardy delta
#

is someone hasn't permission to use a command is its tabcomplete by default disabled?

quaint mantle
#

hey there!

I need some help to include MassiveCraft factions to my plugin using gradle. I can't find the repo. i tried:

    maven { url "https:/ci.herocraftonline.com/plugin/repository/everything/" }

but it doesn't seem to work

sullen dome
#

at least looks like that

quaint mantle
#

may be there is another repo?

sullen dome
#

that website isnt even existing lol

quaint mantle
#

yeah I found it on an old gist

sullen dome
#

so yeah, maybe they updated their repo

#

or fully removed it, idk

quaint mantle
#

I didn't think anything in their docs

sullen dome
#

whats the name of the plugin

#

or api

#

or whatever

#

in most cases, it's better to use an getter/instance, instead of letting static abuse go brr

sullen dome
eternal oxide
sullen dome
#

they have a discord, maybe you can ask there

ivory sleet
#

they r for different things

#

the first one implies its a static helper / utility method

gusty olive
ivory sleet
#

the second one is a singleton

#

and then the method is performed on that one instance

gusty olive
#

It's 1.16.5

#

Let me try to get the full log

chrome beacon
gusty olive
#

I tried to

#

Let me see

#

Also

#

Why do most plugins not specify api version?

chrome beacon
#

Because they target versions below 1.13

lavish wave
#

How can I get all Versions of BungeeCord? Whats the link from the YAML File?

sullen dome
#
        Bukkit.getScheduler().runTaskTimer(this, () -> {
            for (Entity entity : spawn.getWorld().getNearbyEntities(spawn, 300, 150, 300)) {
                if (entity instanceof Sheep) {
                    ((Sheep) entity).setAI(false);
                }
            }
        }, 0L, 100L);```
i don't think, this is a really good solution... but i saw that entities could always move into the spawn-region, so just doing it when they spawn, seems not to be enough
chrome beacon
#

They can't move in to the spawn region cause other chunks aren't loaded

#

They can spawn however

eternal night
#

move into the spawn region ?

#

you'd preferable listen to the respective spawn event and run your no ai logic there

gusty olive
#

Thank you @chrome beacon for the help.

chrome beacon
sullen dome
#

true... my head ahhhhhhh

chrome beacon
#

So no need for a timer

sullen dome
#

but what's if they spawn outside of spawn-area, and run into it when players are online? and then when all are going offline, they start eating

chrome beacon
#

You disable AI when last player quits

#

And enable again when a player joins

eternal night
#

doesn't NoAI persist ?

#

if your goal is to ensure no sheep has AI

sullen dome
#

i just dont want entities in spawn area have ai

#

in the always-loaded-chunks

eternal night
#

oh, well then you'd also have to give them AI back if they leave those chunks huh

eternal oxide
#

they can;t leave with no AI

sullen dome
#

can entities spawn SOMEWHERE if no player is online, but the chunks are still loaded?

eternal night
#

true, big brain moment

hexed hatch
eternal night
#

that would only be possible in those respective spawn chunks then xD

#

which are the only ones ticking when no player is online

sullen dome
#

bc if not, i'd just kill all sheeps on last player quit, who have no nametags

#

or let them despawn tho

eternal night
#

technically I think mob spawning is linked to players anyway (if I am not wrong)

sullen dome
#

well idk

#

how it is on servers

eternal night
#

e.g. it isn't the loaded chunks that spawn entities but rather entities are spawned around the player in a given radius

sullen dome
#

what does for example #setAI(true); do when an entity already has ai

#

report error, or just do nothing

eternal night
#

does nothing

gusty olive
#

What's the Api version for 1.16.5

sullen dome
#

1.16

#

it's always
1.13
1.14
1.15
...

gusty olive
#

Just 1.16

#

ok thanks

sullen dome
#

so... the only question is now... do entities spawn for example 3 seconds after the last player left

summer scroll
#

Is there in any way to check player POV?

chrome beacon
#

?

#

FOV?

summer scroll
#

pov

left plover
#

getPitch(), getYaw()

chrome beacon
#

What do you want to check

summer scroll
#

first person or third person

paper viper
#

Uh no

chrome beacon
#

Not possible

paper viper
#

That’s completely client side

#

Lol

shy wolf
#

hi!
how to set text in sign?

chrome beacon
#

Get the sign data from blockdata

#

Then set text

placid basin
#

Only me or is the spigot documentation really bad

shy wolf
sullen dome
#

is playerquitevent called after, or before the quit itself?

summer scroll
#

alright then, thanks

chrome beacon
#

You have Javadocs with a lot of info

#

Then you have wikis

placid basin
#

Yeah true

chrome beacon
grim ice
#

like what index

#

Because using streams seems impossible to do that with

#

i just did

#

?paste

undone axleBOT
shy wolf
sullen dome
#

2hex youre a god

grim ice
sullen dome
#

i wanted to use that command at literally the same time lol

grim ice
#

lmao

shy wolf
#
        BlockData sign =  world.getBlockAt(215 ,63 ,-353).getBlockData();
        sign.setLine```
chrome beacon
sullen dome
#

stop reading my head!

eternal oxide
sullen dome
eternal oxide
#

you use the keys

grim ice
#

whart

#

wwhat

#

i know

#

but

#

its just to explain

sullen dome
#

assuming, quitevent is called before quit

grim ice
#

ok

#

but

#

is this way right

chrome beacon
grim ice
#

i hope i didnt fuck it lmao

eternal oxide
grim ice
#

oo yea

eternal oxide
#

do not disable by integer, disable by name

grim ice
#

but

crude charm
#

guys

#

im so happy

grim ice
#

how

crude charm
#

so so so happy

eternal oxide
#

literally one list in yoru config with names you want disabled

sullen dome
#

i'm not :(

#

what happened so you're happy?

crude charm
grim ice
sullen dome
#

what is that? lol

eternal oxide
#
disabled_recipes:
    - ZOMBIE
    - SQUID```
crude charm
grim ice
#

thats not that

#

lmao

#

what im saying is

eternal oxide
#

yes it is

grim ice
#

how do i check

crude charm
#

after years of not being to access it and change password and stuff

grim ice
#

if the recipe exists there

crude charm
#

I could use it

#

but not change info

sullen dome
#

imagine spigot staff would answer my support request after about 3 months lol

#

i'd be happy too tbh

eternal oxide
#
if (plugin.getConfig().getStringList("disabled_recipes").contains```
crude charm
#

its been years and years

sullen dome
#

they need to fix my acc too :3

crude charm
#

Im so happy

grim ice
#

I know that

#

lol

#

the thing is

sullen dome
#

lol?

grim ice
#

how do icheck if the recipe

sullen dome
#

whaddafuq

grim ice
#

qwrhauwefhajefnawefuaw

manic furnace
#

Hey Guys! I need help. I will get the icon from a server from my code.

sullen dome
#

what have i done

grim ice
#

if the recipe thats getting registered

#

is in the list

#

what u told me is config basics lol

eternal oxide
#

I literally just showed you and you said you know

grim ice
#

what

sullen dome
#

if thats the help you need

grim ice
#

what??

eternal oxide
#

before you create/register the recipe you check if its in the disabled list

manic furnace
sullen dome
#

uhhhh

grim ice
#

how tho

eternal night
sullen dome
#

wdym exactly

chrome beacon
eternal oxide
sullen dome
#

how do you want to access spigot-stuff without the api? lol

grim ice
#

you legit told me the question i asked lol

eternal night
#

I know xD

#

they use your enum and static plugin accessor setup

grim ice
#

not that

eternal night
#

aren't they @eternal oxide

grim ice
#

oh god

eternal oxide
#

I literally told you how to check if a recipe is disabled before you register it

grim ice
#

i didnt mean it in a toxic way if it sounded liek so btw

#

w h a t

eternal oxide
#

?paste

undone axleBOT
grim ice
#

@eternal night also

#

this isnt a place to make fun of people

#

if you are helping or need help

#

if you are helping or need help

#

do so
something else can go to general

eternal night
#

What XD

#

Who did I make fun of

eternal oxide
grim ice
eternal night
#

what ?

grim ice
#

read

#

the

#

title

eternal night
#

I am so confused 😂😂

manic furnace
eternal night
#

If it looks like I'm making fun of someone I am sorry ? Merely proposing a maybe less static version to store and move namespaced keys

chrome beacon
manic furnace
#

But i mean from any server

chrome beacon
#

Then you will have to read packets

sullen dome
chrome beacon
#

How much Java do you know?

sullen dome
#

or whatever discordbot-api you use

grim ice
#

wait

#

@eternal oxide

#

can I ask why did everything go read

#

red

manic furnace
grim ice
#

when i did that

eternal oxide
#

You were shot in teh head and your eyes are full of blood?

chrome beacon
grim ice
#

Cannot resolve symbol

manic furnace
#

Ok

eternal oxide
#

what went red and what symbol?

grim ice
#

1s

sullen dome
#

@manic furnace why don't you just use JDA (or whatever api you use) inside a spigot-plugin? then you can safely use the spigot-api and your api together

grim ice
#

wait fuck

#

i forgot smth

eternal oxide
# grim ice

return not continue. I was right first time

chrome beacon
manic furnace
#

Because i can not upload a plugin to hypixel

grim ice
eternal oxide
#

then you broke something

sullen dome
#

uhhh... are server-images even accessable public?

manic furnace
#

yes about the server-query

sullen dome
#

that goes over my knowledge, sry

gritty urchin
#

How would I call a BlockBreakEvent for a specific block?

sullen dome
#

i just want my sheep's be friendly to others, that's all

sullen dome
manic furnace
#

ok thanks. I don't know how this goes to😂

eternal oxide
gritty urchin
sullen dome
#

probably create a custom event?

left plover
#

Any idea why this would be popping up with the line:

plyr.teleport(CrusadeCraftUtils.getPlayerOptimizedLocations().get(plyr));
grim ice
#

@eternal oxide

#

just discovered that

undone axleBOT
grim ice
#

Recipes isnt the enum

#

lmao

#

its Keys

#

and u cant use continue

gritty urchin
#

So could I call an existing Bukkit event or would that not work?

grim ice
#

becuz its not a loop

sullen dome
#

i dont think so

eternal oxide
#

Yes, I already told you that, twice

grim ice
#

o

chrome beacon
grim ice
#

sorry didnt see it

eternal oxide
#

return not continue

sullen dome
#

but for specific blocks?

chrome beacon
gritty urchin
#

yeah how can you just call events with Bukkit.getPluginManager().callEvent(exampleEvent); with no other information on the event.

chrome beacon
sullen dome
#

why would you even want to do that? wouldn't it be easier to just use

public void onBreak(BlockBreakEvent e){
  if(e.getBlock().getType() == Material.YOUR_BLOCK){
    //do your stuff
  }
}```
?
#

instead of creating a custom event/calling the existing one, just for one block?

gritty urchin
#

Because I want the plugin to break a block

sullen dome
#

i'm sure i'm getting this totally wrong lol

gritty urchin
#

and it to be called as a block break event.

chrome beacon
#

Is a player breaking the block in your plugin

gritty urchin
#

No

chrome beacon
#

Then you can't call the BlockBreakEvent

left plover
#

To simulate a fake BlockBreakEvent as a player?

chrome beacon
#

But a player wasn't breaking it

#

...

#

You can't call that event without a player

eternal oxide
#

You throw a new BlockBreakEvent yourself, then check its cancelled state to see if you can break the block.

#

if the event is not cancelled no plugins prevented it, so you breakNaturally

grim ice
#

btw

#

what if i want the materialKey to be an itemstack

#

cuz apparently enchanted books r only possible with item stacks

eternal oxide
#

the materialKey is only an index to the following Material array

grim ice
#

okay

eternal oxide
#

if you want to be able to define the ItemStack you would need to alter the enum to use ItemStacks and not Materials

grim ice
#

@eternal oxidewait

#

i was wrong

#

what imeant was

#

the result

eternal oxide
#

Then you would change the first element to be an ItemStack and not a Material

grim ice
#

i can just make a enchanted book item with a pcd and check with a sheduler if a player has it then give him the itemstack but thats way too long

grim ice
#

new ItemStack(Material. ///)

quaint mantle
dense remnant
#

Is there a way to apply a config/add a plugin across all servers connected to bungee?

chrome beacon
#

You would have to setup your own system for that

opal juniper
#

Myeah just use like the plugin messaging

slender flax
quaint mantle
#

Oh awesome!

tardy delta
#

what would be the best way to block damage from other players without a sword?

gritty urchin
#

Anyone have experience with WorldEdit 6.1.9 API (1.12.2)?

grim ice
#

holy fuck

#

finally

#

took me legit 5 hours

manic bison
#

hey, hey to set an item in player's offhand ?

compact cape
#

Anyone knows how to use a resource pack to show custom enchantments on item?

wraith apex
#

player.getInventory().getOffhand

manic bison
#

thanks!

grim ice
#

@manic bison hes wrong lol

manic bison
#

.setItemInOffHand

grim ice
#

player.getInventory().setItemInOffHand

manic bison
#

i found this

grim ice
#

yeah that

manic bison
#

yeah i guessed, just needed to know iwhat i needed to put before

waxen plinth
grim ice
#

just a tip

#

before u start coding

#

check out the player entity

#

and getInventory..etc

#

in the java doc

#

might really help you

manic bison
#

yah, i just knew that player.getItemInHand() existed, so i though player.setItemInOffHand existed

wraith apex
#

I meant set

#

My bad

#

Didn't know the method

manic bison
grim ice
#

Anyone wants to help me better the structure of my code>?

paper viper
#

Maybe consider using DI instead of static instance

#

?di

undone axleBOT
grim ice
#

what

#

im not using that

#

??

paper viper
#

You should

#

It’s better in terms of OOP

grim ice
#

IM NOT USING STATIC INSTANCES

#

WHAT

#

wait did i forget to remove it from my main

#

fuck

paper viper
grim ice
#

i dont actually use them

#

ye i dont use them

paper viper
#

grim ice
#

its only there i didnt use it at all

#

i forgot to remove it

#

this thing is old af

#

im rewriting it

paper viper
#

You just committed like 2 minutes ago lol

grim ice
#

yeah but look at spigot

#

lmao'

paper viper
#

?

grim ice
#

i just started using github today

paper viper
#

Ok.. how does that have anything to do with static instances…

#

Just get rid of the static and rewrite it with DI

compact cape
manic bison
grim ice
#

Before i didnt know di

#

so i was using that

#

when i learnt it

#

i started using it

#

but i forgot to remove

paper viper
#

You were asking for tips on structure, so I gave you one

grim ice
#

that part in main

paper viper
#

I understand

grim ice
#

thanks

paper viper
#

But it doesn’t mean you leave it like that

grim ice
#

1s ill fix it

paper viper
#

Lol

grim ice
#

u sure

#

check the github again

eternal oxide
# grim ice thanks

line 156 of RecipesManager you don't need to create an ItemStack there as you changed the eunm to include it

#

just set teh field

paper viper
#

Also

paper viper
#

Are you editing via GitHub?

#

Or by your IDE

grim ice
#

IDE?

ivory sleet
paper viper
#

Yeah cause the formatting

#

So whack

#

Lol

grim ice
#

lmao

#

ok ill fix it

grim ice
eternal oxide
#

this.itemStack = new ItemStack(material); should be this.itemStack = material;

grim ice
#

oh yeah got it

eternal oxide
#

you are no longer passing a Material but an ItemStack from teh enum

grim ice
#

Yeah

#

iits like saying new ItemStack(ItemStack);

eternal oxide
#

you should probably change the variable name from material to item

grim ice
#

yep i did that

glossy scroll
#

getWorld().getNearbyEntities(player.getLocation(), 1.5, 1, 1.5) seems to be getting a lot larger of bounding box than what i expect...

grim ice
#

where exactly

glossy scroll
#

im expecting it to be a radius of 1.5 blocks along x and z and 1 radius in y (3x3x2 box)

#

but it seems to be way bigger than that

patent horizon
#

would anyone know why velocity is so weird when applied to vehicles currently being ridden?

#

and how to get around it?

grim ice
#

yeah i found some

#

mineable

#

and

#

some stuff

paper viper
# grim ice where exactly

Like code formatting wise there are parenthesis in weird places which was as if you deleted some code that was originally there but left the parenthesis or whatever but it’s not a big deal

eternal oxide
# grim ice some stuff

check the ordering of yoru key in 116 "BD", new Material[] {Material.DIAMOND, Material.BLAZE_ROD}),

grim ice
#

yeah whats with it

#

OH WAIT

#

it should be DB my bad

#

what is pushing in github btw

patent horizon
#

like

#

the velocity gets cancelled mid air

quaint mantle
patent horizon
#

almost like rubber band lag or running into invisible blocks

#

except neither

quaint mantle
#

local (commit) (push) -> upstream.git (repository)

grim ice
#

o

#

ok

#

im trying to keep it as efficient as possible

#

even if its something really unnecessary but better tell me please

#

like a convention or something

#

yeah i noticed a naming convention msitake

eternal oxide
#

line 76 "LEB", new Material[] {Material.LAPIS_BLOCK, Material.GLASS_BOTTLE, Material.EMERALD}),

compact cape
#

How can I get NMS class of an API class?

For example the net.minecraft.world.item.enchantment.Enchantment class of org.bukkit.enchantments.Enchantment?

glossy scroll
#

it works on non-player entities

grim ice
#

that is intentional tbh

#

cuz im lazy

patent horizon
grim ice
#

there are many in my code like that

#

and i dont think its a convention or anything tbh

quaint mantle
#

I need a plugin dev

grim ice
#

it feels like preference more than stuff liek that

glossy scroll
undone axleBOT
grim ice
#

i cant believe upgrading a plugin structure took 6 hours

#

bruh

#

i mean now it prob has so many errors waiting for me so itll prob be 8h

grand sun
#

How i can delete plugin from spigot?

grim ice
#

go to ur server files

#

then

#

plugins folder

#

then remove the jar file

hearty latch
#

is any bungeecord server hosting free ??

gritty urchin
#

Hey, how would I remove the area between two xyz positions using WorldEdit API 6.1.9?

chrome beacon
grand sun
#

yes

chrome beacon
#

Report it and request it to be deleted

grim ice
#

if i have this in my RecipesManager class, (i also have the addRecipes() method in my RecipesManager class)

public RecipesManager(JavaPlugin plugin) {

        RecipesManager.plugin = plugin;
        Arrays.stream(RecipesManager.Keys.values()).forEach(key -> new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()));
        addRecipes();
    }```
I don't need to do `RecipesManager.addRecipes();` in main class's onEnable right
eternal oxide
#

no

grim ice
#

so i need to?

eternal oxide
#

that should really be private as its called from the constructor

grim ice
#

yeah but do i need to do

#

the thing in onEnable

#

i dont think so

eternal oxide
#

no, just instance the class

grim ice
#

What?

burnt current
#

Quick question: How can one, when setting stairs (through the plugin), set them in a certain direction?
I have already tried with the following code. Unfortunately it did not work:

event.getBlockPlaced().getLocation().add(-1, 4, 4).getBlock().setType(Material.BRICK_STAIRS);
                event.getBlockPlaced().getLocation().add(1, 4, 4).getBlock().setType(Material.BRICK_STAIRS);

                Block stair1 =  player.getWorld().getBlockAt(event.getBlockPlaced().getLocation().add(-1, 4, 4));
                BlockData stair1Data = stair1.getBlockData();
                MultipleFacing facing1 = (MultipleFacing) stair1Data;
                facing1.setFace(BlockFace.EAST, true);
                stair1.setBlockData(stair1Data);

                Block stair2 =  player.getWorld().getBlockAt(event.getBlockPlaced().getLocation().add(1, 4, 4));
                BlockData stair2Data = stair2.getBlockData();
                MultipleFacing facing2 = (MultipleFacing) stair2Data;
                facing2.setFace(BlockFace.NORTH, true);
                stair2.setBlockData(stair2Data);

Can anyone help me with this by any chance?

eternal oxide
#

it is private in the demo code I sent you

grim ice
#

Yeah

#

but

#

that isnt my question

#

im wondering if

#

should I do that thing in onEnable

eternal oxide
#

you just recipeManager = new RecipeManager(this);

#

in onEnable after you have ensured your config exists

grim ice
#

o ok

#

but i wont use "recipeManager"

#

so whats the point

eternal oxide
#

actually you need to register it as a Listener

#

unless you expose the recipies elsewhere

#

The class has a single login event to reveal teh recipes to the players

grim ice
#

uh

#

yeah i know

#

i registered lol

eternal oxide
#

then thats all you do

grim ice
#

thats why it was public

#

o

eternal oxide
#

no

#

that method shoudl be private

grim ice
#

if u make it private it tells me a warning

eternal oxide
#

that method has nothing to do with registering the litener or instancing the class

grim ice
#

actually

#

an error

#

'RecipesManager(org.bukkit.plugin.java.JavaPlugin)' has private access in 'me.hex.onceuncraftable.RecipesManager'

eternal oxide
#

you are setting teh constructor private not addRecipes

grim ice
#

wait fuck

#

private void addRecipes() {

eternal oxide
#

thats a method, one you shoudl never need to access yourself

grim ice
#

yeah

#

its private now

eternal oxide
#

all you do is instance/register the class event

grim ice
#

I tested before registering the event

#

but

#

it didnt work

#

i dont think it was because of registering

#

ill try again

toxic mesa
#

What would be the best way to check if a player is standing on something?
Just checking the block under the player wouldn't work as the player can stand on the edge and it'll get the wrong block

grim ice
#

well

#

thats the only way

#

lol

toxic mesa
#

I guess checking the coordinates would work but it feels like a meh solution

gritty urchin
#

Hey, how would I remove the area between two xyz positions using WorldEdit API 6.1.9?

narrow vessel
#

autoremoved

#

discord invite link: enginehub, go to api channel

gritty urchin
#

Alright cheers

#

Do they support older versions?

toxic mesa
#

i wouldn't

#

cant imagine they do

grim ice
#

waehquugguwhfwefhwfwfosdfn

rustic bloom
#

Can someone help me, how do I set durability of a tool in Spigot 1.17. Since setDurability and getDurability were deprecated

chrome beacon
rustic bloom
viral dome
#

how to not suck at code design and architecture

chrome beacon
#

There are 2 of them

rustic bloom
#

Oh... that makes sense, thank you so much

quaint mantle
#

i was going to say something that could've helped but saw that Olivo already answered

rustic bloom
#

yeah i imported Damagable from org.bukkit.entity but instead I had to use import org.bukkit.inventory.meta.Damageable;

quaint mantle
#

ahh yeah

umbral pagoda
#

hi ihave proplem

#

when player join the game get kit but when he is killed or dead never get the kit in respawn

quaint mantle
#

then add the kit to them one tick later

umbral pagoda
#

i'm

#

do all things

#

@quaint mantle can i dm you ?

quaint mantle
#

no

#

ask here

#

post your code

umbral pagoda
#

ijust need to send the code

quaint mantle
#

send it here

umbral pagoda
#

.

#

it said no

#

discord can't uplode

#

the code

quaint mantle
#

do it one tick later

#

?scheduling

undone axleBOT
grim ice
#

anyone that can help me better the structure of my code?

manic crater
#

how can i fix this red message issue???

eternal night
#

World#getEntities only returns loaded entities

manic crater
quaint mantle
#

maybe be patient

#

is that your plugin or are you looking for help with another one

manic crater
#

mine

#

1.17.1

quaint mantle
#

send code

manic crater
#
@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if(cmd.getName().equalsIgnoreCase("spawn")){
                p.sendMessage(ChatColor.BLUE + "Spawn>" + ChatColor.GRAY + " Sending you to the spawn...");
                Bukkit.dispatchCommand(sender, "mvtp " + p.getName() + " Hub");
                Bukkit.dispatchCommand(sender, "mvconfirm");
                return true;
            }
        }
        return true;
    }
eternal night
#

don't get started on static abuse in 2hex plugin 😅