#help-development

1 messages · Page 1583 of 1

earnest lark
#

not put one in onenable

ivory sleet
#

You can register event listeners outside onEnable also btw

#

Just that you should probably bake them also if you do which can cause lag thus should be avoided

hasty prawn
ivory sleet
#

Oh yeah very true indeed

quaint mantle
#

@twilit vector after some thought, boats would be better imo

earnest lark
#

can i make a new class that calls getServer().getPluginManager().registerEvents(new trackevents(), this); and implements listner

sage swift
#

conventions out the window

earnest lark
#

or can i do getServer().getPluginManager().registerEvents((Listener) new trackevents(), this);

#

would this work

sage swift
#

conventions still out the window

#

big window

opal juniper
#

the window is getting larger by the second

twilit vector
#

why?

#

and boats on land?

#

wont it be too slow

proud basin
earnest lark
#

sad

#

to

#

say

#

but i dont know how to implement listner in my main class lol

proud basin
#

earnest lark
#

it just gives me error messages

#

lol

proud basin
#

you don’t implement it in your main class

earnest lark
#

yea i was going to sayt

proud basin
#

you do it in your trackevent class

sharp bough
#

what yall talking abt

earnest lark
#

should i do ```public void eventregister() {

getServer().getPluginManager().registerEvents(new trackevents(), this);

}

ivory sleet
#

Yeah implementing Listener in main class would violate sr principle but probably not relevant if you’re just a beginner

proud basin
#

yes

#

but make sure you implementing Listener in your trackevents class

#

and add capitals to that class please

earnest lark
#

i willl

#

would i add a @override before it

sharp bough
ivory sleet
#

Presumably not

sharp bough
#

and the main method gets smaller

ivory sleet
#

Lucas showing yall how to write clean code 😌

proud basin
#

😆

earnest lark
#

ok the getServer().getPluginManager().registerEvents( new trackevents(), this);

#

aint working

#

what can i use to replace this

proud basin
#

Stop casting Listener

sharp bough
opal juniper
proud basin
#

Show us trackevents class

#

?paste

undone axleBOT
sharp bough
ivory sleet
#

jeff yeah it’s cleaner

earnest lark
ivory sleet
#

Probably an insignificant change to a plugin but still

proud basin
#

Show your main class now

#

and is there a error?

earnest lark
#

?paste

undone axleBOT
sharp bough
earnest lark
proud basin
#

bro

#

your not even

#

registering it

sharp bough
#

xdddddddd

quaint mantle
# twilit vector wont it be too slow

well obv you have to modify the movement, even if you used armor stands lol
and boats are made to be ridden, closest thing to a vehicle in minecraft already

earnest lark
twilit vector
#

so i am doing that now

#

XD

earnest lark
#

?paste

undone axleBOT
earnest lark
proud basin
#

Test it now

sharp bough
#
        System.out.println("it broke");
        System.out.println("going to the spigot discord");
        System.out.println("asking a million questions");
        System.out.println("ok all fixed");```
#

whats that

limpid bronze
#

Hey, I have a problem with two of my functions:

// Glow or unglow function
public static void setGlow(boolean glow, ItemStack itemStack) {
        ItemMeta meta = itemStack.getItemMeta();
        if(glow) {
            if(ItemStackUtils.isAnArmor(itemStack)) {
                meta.addEnchant(Enchantment.LURE, 1, true);
            } else {
                meta.addEnchant(Enchantment.PROTECTION_EXPLOSIONS, 1, true);
            }
            meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
            itemStack.setItemMeta(meta);
        } else {
            for(Enchantment enchantment : meta.getEnchants().keySet()) {
                meta.removeEnchant(enchantment);
            }
        }
    }
public void setGlowUnglowOthers(InventoryContents contents, ItemStack itemGlow) {
        for (int columns = 2; columns < 6; columns++) {
            if (contents.get(1, columns).isPresent()) {
                ItemStack item = contents.get(1, columns).get().getItem();
                ItemStackUtils.setGlow(item.isSimilar(itemGlow), item);
                contents.set(1, columns, ClickableItem.of(item,
                        e -> {
                    e.setCancelled(true);
                    reason = e.getCurrentItem().getItemMeta().getDisplayName().substring(2);
                    setGlowUnglowOthers(contents, e.getCurrentItem());
                }));
            }
        }
    }```
Both functions are called correctly but the one that unglows the item when needed does not remove the enchantments. I don't see what the problem is. Could someone explain me the problem ?
earnest lark
#

its just for concole

ivory sleet
#

?paste

undone axleBOT
earnest lark
#

ik i could put something in chat but there is no point because people are not going to see it anyways

#

unless a restart

#

but idk that much abt that stuff

#

i just need to know that it is in concle and working

proud basin
#

concle

earnest lark
#

i dont know how to spell it'

#

dont make fun of me

proud basin
#

console

earnest lark
#

cncle

#

concwole

proud basin
#

Anyways did it work?

earnest lark
#

im testing right now

sharp bough
#
    trigger:
        give 1 glowing dirt named "&aI am dirt" with lore "&cOooh" to player

# Change the above item to any item you want```
#

loooool

proud basin
#

LMAO

earnest lark
#

i shut down my server so i can delete the other plugin that doesnt work

#

ik it takes longer but i like to be neat

earnest lark
#

it works pogggg

#

i seriously need more ram if i am going to be programing more

#

lol

proud basin
#

How much you got?

earnest lark
#

8gb

quaint mantle
#

did him like tht

proud basin
#

You should be fine

quaint mantle
#

😳

earnest lark
#

imma ask for like 36gb on my bday so

#

or 26gb

#

*16

quaint mantle
#

wack lol

ivory sleet
#

I also got 8 gb as of now lol

earnest lark
sharp bough
#

amd r9 200 series

#

lool

proud basin
#

go for the 3080 founder edition

earnest lark
#

and i like to have my browser,intellij,discord,mc all op[en at the same time so

proud basin
#

it's like $800

earnest lark
#

lol

sharp bough
#

nah

#

i would live constantily worried

#

what if something happens

#

there goes your 3080 founder edition

#

you dont even need that much

proud basin
#

but price on it won't inflate

sharp bough
#

a 2080 is more than enough

ivory sleet
#

Is GeForce rtx 3090 good btw?

sharp bough
#

unless you play those massive games

proud basin
#

Since it's only sold by nvdia

sharp bough
#

but for mc

#

i dont see why on earth you would need a 3080

#

lol

nova sparrow
#

well get the 3070

#

It's basically just a cheaper 2080 ti

eternal oxide
#

1070 is ample

nova sparrow
#

yeah true

#

considering mc is cpu intensive not gpu

winged anvil
#

is there a way to have multiple people work on one project in intellij? if anyone knows. and is it like google docs where its real time edits?

proud basin
sharp bough
#

yea

sharp bough
proud basin
#

let me get you the link'

ivory sleet
proud basin
opal juniper
proud basin
ivory sleet
limpid bronze
#

But i dont know where i should debug

sharp bough
limpid bronze
sharp bough
#

there ya go

limpid bronze
hasty fog
#

Can you safely change variables in a class that executes sync methods from an async task?

ivory sleet
#

Yes

#

Or if that "sync method" is synced in relation to the server thread

quaint mantle
#

how to edit item's lore before enchant?

hasty fog
#

Alright! I can I also start a sync runnable from an async runnable without messing things up?

ivory sleet
#

If one thread writes and multiple reads use volatile, if many threads write and read use a Lock or the synchronized mechanism

chrome beacon
ivory sleet
#

yeah

hasty fog
#

One thread will write and main will read only

quaint mantle
ivory sleet
#

Executors.newCachedThreadPool().submit(() -> {
Bukkit.getScheduler().runTask(plugin,() -> {
this.variable = blah;
});
});

#

Somethjng like this would be fine

sharp bough
hasty fog
#

thanks for your help!

ivory sleet
#

Since the runnable that mutates the variable is queued to run on the server thread (;

chrome beacon
quaint mantle
#

i need to set nbt

#

or PDC

limpid bronze
sharp bough
quaint mantle
#

k, other answer. Can i edit item after enchant?

#

that's easier than "before"

#

i think

limpid bronze
quaint mantle
#

HideFlags

#

are you tried?

sharp bough
limpid bronze
# sharp bough code?
// Glow or unglow function
public static void setGlow(boolean glow, ItemStack itemStack) {
        ItemMeta meta = itemStack.getItemMeta();
        if(glow) {
//ignore here, it's working and it's not where is the problem
            if(ItemStackUtils.isAnArmor(itemStack)) {
                meta.addEnchant(Enchantment.LURE, 1, true);
            } else {
                meta.addEnchant(Enchantment.PROTECTION_EXPLOSIONS, 1, true);
            }
            meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
            itemStack.setItemMeta(meta);
        } else {
            for(Enchantment enchantment : meta.getEnchants().keySet()) {
                meta.removeEnchant(enchantment);
            }
        }
    }
public void setGlowUnglowOthers(InventoryContents contents, ItemStack itemGlow) {
        for (int columns = 2; columns < 6; columns++) {
            if (contents.get(1, columns).isPresent()) {
                ItemStack item = contents.get(1, columns).get().getItem();
                ItemStackUtils.setGlow(item.isSimilar(itemGlow), item);
                contents.set(1, columns, ClickableItem.of(item,
                        e -> {
                    e.setCancelled(true);
                    reason = e.getCurrentItem().getItemMeta().getDisplayName().substring(2);
                    setGlowUnglowOthers(contents, e.getCurrentItem());
                }));
            }
        }
    }```
limpid bronze
sharp bough
#

is that a command?

#

i have no idea what you are trying to do

#

is it in a inv?

#

why do you use InventoryContents

#

doesnt that remove all enchants of the item?

#

you are missing a bunch of information

winged anvil
proud basin
#

Yea

#

It's a plugin

winged anvil
#

im trying to install from disk but it says my intellj is outdated but im on the latest version

limpid bronze
limpid bronze
limpid bronze
limpid bronze
#

i've explain below the code

limpid bronze
ivory sleet
#

No

sharp bough
#

so its just the glow command

#

if glow == true : unglow

ivory sleet
#

Map<K,V>.<K>keySet() returns a Set<K>

sharp bough
#

else glow?

limpid bronze
# sharp bough so its just the glow command

no it's a report command who open a inv, and that when you press a specific item it enchants it. If you press another specific item it will enchant it but it will disenchant the other one

sharp bough
#

then use invclickEvent

#

if inv == the report inv

#

get item

#

item set glow true

#

theres no need to do what you did

#

you can also use InventoryFramework

#

if you want

#

it will create an inv with actions attached to the items

#

so you can add the set glow true

limpid bronze
sharp bough
#

to the item

limpid bronze
#

it's the set glow false

#

who removes all the enchantements

sharp bough
#

the problem is

#

if an item is already enchanted

#

it will still glow

#

after you remove your enchant

#

but

#

if you "unglow" an item you didnt glow

#

then you are gonna remove the enchant the item already had

limpid bronze
#

No, the glow doesn't stay if you remove all the enchantments unless I'm wrong

sharp bough
#

the glow will stay as long as theres an enchant

#

meaning that if you try to unglow an item with other enchants

ivory sleet
#

As long as the enchant tag is present

sharp bough
#

it wont unglow

limpid bronze
sharp bough
#

but what if the item has enchants added by the player?

limpid bronze
sharp bough
limpid bronze
sharp bough
#

it doesnt look like the same code

gritty urchin
#

Hey is there a reverse packet for PacketPlayOutEntityDestroy to show entity?

opal juniper
#

Spawn entity

gritty urchin
#

thanks

opal juniper
#

Follower by the meta packet

tardy delta
#

is there a way to check if the server is reloading instead of just starting up?

opal juniper
#

Yep

#

getLoadedWorlds() will be length 0 on startup and it will be longer on reload

#

Something like that at least

#

It may be just

#

Bukkit#getWorlds()

limpid bronze
burnt current
#

Hey! Quick question: Does anyone know how I can use multifacing on a glass pane that I want to set as follows?:
event.getBlockPlaced().getLocation().add(-2, 1, 0).getBlock().setType(Material.WHITE_STAINED_GLASS_PANE);

eternal oxide
honest iron
#

how do i get chest state's inventory name

#

in 1.16.5

#

tried to google but outdated

sharp bough
#

wdym with chest state's inventory name?

burnt current
sharp bough
#

the gui name?

honest iron
#

yea

#

gui's name

#

java.lang.NoSuchMethodError: 'java.lang.String org.bukkit.inventory.Inventory.getTitle()'

sharp bough
#

first link

honest iron
#

you realize that i want for 1.16.5?

#

i already tested in 1.8 it works, 1.13 doesn't

sharp bough
#

getTitle got removed

#

thats what you used to use

#

in 1.8..

honest iron
#

Is it possible to get the name tho?

sharp bough
#

but in newer versions you gotta use what i sent

sharp bough
honest iron
#

I can't get the view from the chest's state

sharp bough
#

cuz chest state is not what you need

burnt current
#

you can get the GUI Name with event.getView().getTitle() the variable "event" has the data type InventoryClickEvent

ivory sleet
#

Something happened and Inventory#getTitle was lost

sharp bough
#

getTitle() doesnt work anymore

burnt current
#

of course

#

i just use 1.16.5 and it works

ivory sleet
#

On InventoryView it does

honest iron
#

I've tried won't work

ivory sleet
#

It’s on Inventory it doesn’t

honest iron
ivory sleet
#

Too bad

burnt current
#

when you also use #getView before the #getTitle

honest iron
#

So its not possible to get the view from Chest?

ivory sleet
#

No

#

You could use nms I guess

#

That is if nms still keeps track of inventory names

burnt current
honest iron
#

Crates

burnt current
#

okey

#

Well, I've never created a crate before, but I can imagine setting up a crate with a special persistant data and then building a listener that queries whether the crate has that persistant data. Then you cancel the event that opens the crate and open a self-created inventory where you can collect your reward.

ivory sleet
#

Ideally don’t need the title yeety?

#

I mean BlockInventoryHolder should be enough if you want to keep track of stuff or smtng, well identifying the inventory

burnt current
#

I also have a question: Does anyone know how I can use multifacing on a glass pane which I have created as follows?:
event.getBlockPlaced().getLocation().add(-2, 1, 0).getBlock().setType(Material.WHITE_STAINED_GLASS_PANE);

crude sleet
#

Are armorstands that you spawn with packets actually worse in terms of performance than normal armorstands? I would always use normal ones anyway, because that would be unnecessary but I am interested.

ivory sleet
#

Probably better in terms of performance

young knoll
#

Blockdata

burnt current
# young knoll Blockdata

So I should create a block variable with the material WHITE_STAINED_GLASS_PANE and then somehow put this in the BlockData there.?

young knoll
#

block.getData and cast

#

Or is it getState, spigot is weird with those 2

quaint mantle
#

how to set the center of sound?
That i'm using now: p.playSound(p.getLocation(), "felmon:music_disc.18", SoundCategory.RECORDS, 0.1f, 1);

hasty prawn
#

Change the Location argument

quaint mantle
#

i need the effect how from jukebow

#

with moving volume doesn't lowing

hasty prawn
#

Yeah, set the sound to play at the location of the "jukebox"

#

Instead of at the player

earnest lark
#

ok how would i go about making like a tag system for player

quaint mantle
#

Use PDCs

burnt current
earnest lark
#

so that someone could have the tag like owner

#

and they can have a special perms

quaint mantle
#

ah

eternal oxide
#

So prefixes

quaint mantle
#

scoreboards for you

earnest lark
#

not tag tag

hasty prawn
#

Teams I think is the best way to do that afaik

#

Scoreboard Teams

quaint mantle
#

there are a lot of pages

#

about scoreboards

earnest lark
#

well im making a tracking system

#

and i want the tracked tag

quaint mantle
#

change team's prefix.

earnest lark
#

so i can have something like this player.setCompassTarget(tracked);

hasty prawn
#

Why do you need prefixes for that

earnest lark
#

well imma give the tracked and tracker

#

bc the tracker needs to be able to locate the tracked

quaint mantle
earnest lark
#

oh yea

quaint mantle
#

it isn't hard

earnest lark
#

but you see i dont know how to get the target location

quaint mantle
#

?jd

hasty prawn
#

Well the Target is a player, yes?

earnest lark
#

yep

hasty prawn
#

So... get their Location

young knoll
#

You'll have to update it regularly

quaint mantle
#

what the fuck dude

#

you need to read spigot's java docs

earnest lark
#

but how would it know witch person is the one getting tracked

hasty prawn
#

Yeah you'll have to keep updating it periodically with the tracked player's new location

quaint mantle
#

and have iq more than 1

hasty prawn
#

No reason for that Koto

earnest lark
quaint mantle
#

sry

#

i'm bad in english ;P

earnest lark
#

im sorry but you need a iq more than 1 to understand

#

lol

#

jk

quaint mantle
#

bruh

#

you can tracking player

#

periodically taking his location

#

every tick, every it move

#

how you want

#

and writing in compass

earnest lark
#

i know that

quaint mantle
#

good

earnest lark
#

that i understand

quaint mantle
#

let's try

earnest lark
#

im still confuse

#

d

plain sequoia
#

Hello, does anyone best way to store chunks in a yml file?

dusk flicker
#

that just does not sound like a good idea

#

like

#

at ALL

plain sequoia
#

nvm already got it

#

😁

#

how would you recommend to store chunks?

dusk flicker
#

in there standard format, not in a yml

plain sequoia
#

what's their standard format?

quaint mantle
#

Quick question, is there an direct method to cancel the fall damage on Player.setVelocity

plain sequoia
#

make them invincible or cancel the damage event I think

kind coral
#

hi guys i am using Damageable from inventory tho when setting the damage my item literally gets removed like 100+ durability even tho its 18 blocks mined, i am making a area pickaxe

eternal oxide
#

what are you setting for damage?

kind coral
#

im setting the damage of the item + the size of the list

plain sequoia
young knoll
#

Store the chunk x and z

eternal oxide
kind coral
#

then what about durability?

quaint mantle
#

Is that setting the actual stats of the pickaxe (attack damage)

kind coral
#

is there a way to get the title of an inventory?

quaint mantle
kind coral
plain sequoia
kind coral
#

with booleans if the condition is true just put your boolean like this:

if(yourboolean)

instead if it is false
if(!yourboolean)

kind coral
limpid bronze
#

Hey, I would like to know if it was possible to get the fishing rod from the event with PlayerFishEvent. If yes, how?

hollow lodge
#

How would you install a Maven Dependency in IntelliJ?

plain sequoia
limpid bronze
#

Hum yes

plain sequoia
#

sounds dodgy but I think it works

quaint mantle
#

i want to fix it

kind coral
kind coral
limpid bronze
quaint mantle
#

Ah ok

kind coral
#

easy as that lmao

limpid bronze
#

Thanks for the help

quaint mantle
kind coral
#

u doing

if(urboolean == true) instead of

if(urboolean)

quaint mantle
#

i changed

kind coral
#

and also

u doing
if(urboolean == false) instead of

if(!urboolean)

quaint mantle
#

but i still have the 2 kill porblem

#

problem

kind coral
#

also your variables can be stacked like so

Player player1,player2,player3

quaint mantle
#

oh

kind coral
#

instead of
Player player1
Player player2
etc.

chrome beacon
#

Is this your first Java project?

quaint mantle
#

no

plain sequoia
kind coral
#

also what is the point on making a string object for the args[0] and 1?

kind coral
quaint mantle
#

easier

plain sequoia
#

ah

kind coral
quaint mantle
#

oh

kind coral
#

u could just make args[0]

#

and args[1]

#

instead of using ifs use switches

ivory sleet
kind coral
quaint mantle
#

well idk what the problem is that let player win the game with 2 instead of 5 kills

#

i know how to use switchs

kind coral
#

what line

quaint mantle
#

lemme check

#

122 & 110

kind coral
#

hm idk then, i can't understand your code, please learn how to make methods to make your code smaller and run efficiently, also instead of making playerkills = playerkills +1 just use playerkills++;

quaint mantle
#

it was working until i added this, but its essential

    @EventHandler
    public void onPlayerMove(PlayerMoveEvent e) {
        if (hasStarted) {
            if (player1.getLocation().getY() == 64) {
                Location tp = new Location(Bukkit.getWorld("world"), 12.5, 87, -527.5);
                player1.teleport(tp);
            }
            if (player2.getLocation().getY() == 64) {
                Location tp = new Location(Bukkit.getWorld("world"), 12.5, 87, -527.5);
                player2.teleport(tp);
            }
        }
    }
eternal night
#

this might very well not work

#

y being exactly 64 in a move event is pretty impossible

ivory sleet
#

😌

quaint mantle
#

you could use >=

#

if that's a thing in java

#

ik

#

or round it

#

but i need to see if they are on a certain Y

#

and taht works

#

that

#

but that requires more code

eternal night
#

at least use getBlockY

#

instead

ivory sleet
#

I believe getBlockY is a thing

#

Oh nvm lynx faster

quaint mantle
#

ok

#

ill try

kind coral
quaint mantle
#

Wdym

crude sleet
#

Was anything changed in the inventories in 1.17? All my inventories load quickly and normally, but the inventories where you first open the inventory from a brewing stand load very long (I didn't have the problem in 1.16.5)

kind coral
#

it can run up to 16 times per tick with 2 players

quaint mantle
#

im checking if the minigame had started

kind coral
#

still

#

it would trigger so many times you dont even know

quaint mantle
#

Yeah if it has to run an event like almost every 10 ticks it can use up a lot of cpu usage

#

ok idk what to do then

kind coral
#

even if a player spinned their head that would count as player move

#

there is a cool method

#

getFrom and getTo

#

use the respective .getBlockX .getBlockY getBlockZ

quaint mantle
#

im confused now

kind coral
#

to check if the player has walked at least a full block.

quaint mantle
#

i dont want them too

kind coral
#

i hate spoonfeeding...

quaint mantle
#

i want it to go off when they hit the ground

earnest lark
#

ok i want a copass to target a specific player but i dont know how to make it target another player help

#

?paste

undone axleBOT
kind coral
#

this will make it so that they have to walk at least a fullblock in the z and x axis for event to fully tigger.

earnest lark
kind coral
quaint mantle
#

I want them to get tped when they touch the ground

eternal oxide
earnest lark
kind coral
earnest lark
kind coral
quaint mantle
#

ok ill try

earnest lark
#

i already hvae most of the stuff i just want to do a command that adds someone to a team that i can then track

eternal oxide
kind coral
kind coral
earnest lark
#

yea i know what im doing i just want to know how to get a pl,ayer onto a specific team that i can then track

eternal oxide
quaint mantle
earnest lark
# kind coral

this is helpfull but i already have that and just need to get the target

kind coral
#

Interfaces? Abstract Classes, Normal classes that require parameters in constructor?

earnest lark
#

that would be a specific team

kind coral
#

just need to add another check in the line

#

you have x and z, what's missing?

quaint mantle
#

nah ill just debug myself i need it to trigger the instant they touch the ground

#

the other one workerd

#

worked

kind coral
#

ok, have fun with your 3Tps then 😄

quaint mantle
#

i was saying that i think it interfered with it

#

no ive tested and get 20

quaint mantle
#

code

kind coral
#

try with 10+ players, i don't think you'll get that far, also learn java pls i was also at your point asking stuff like this, it only took me like 1-2months

quaint mantle
#

Well if there is no other way to it without the player moving 2 tps it is

earnest lark
static whale
#

So I am capturing BlockDropItemEvent and changing the drops however whenever for example a player breaks scaffolding the attached blocks still drop as scaffolding instead of the modified. Same with breaking the block a torch is on, the torch drops instead.

#

Are there any events for that which I'm missing?

earnest lark
#

blockdroped event mabey

#

idk

young knoll
#

There is an ItemSpawnEvent

static whale
young knoll
#

You wouldn’t

static whale
#

Oh, welp

tame iron
#

hi!

error

Could not pass event CreatureSpawnEvent
java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
at ...getSkull(main.java:1422) ~[?:?]
tame coral
#

Just google it

#

Like

tame iron
#

I don't quite understand what is wrong here, did I import something wrong?

tame coral
#

it takes 5 seconds

#

Better answer

tame iron
#

thx!

ancient whale
#

Hey, I would like to store coords in a yaml file but I can't figure out the best way to easily use and modify it (I don't want to name children as there is not specific amount) so far I tested

warzone_drop_spots:
  -
    x: 0
    y: 1
    z: 0
  -
    x: 1
    y: 0
    z: 0

But I'm struggling to parse it into coords as I get a java Object 😒

eternal oxide
#

Location is serializable

#

just set and getLocation

granite beacon
#

Is there a way to cancel a runnable scheduled with runTaskTimer from inside of it's self?

peak yacht
#

can a dev tell me who developed TAB plugin

#

and why it disappeared from sipgot and planet earth

#

I mean should I worry and remove it from my server does contain a trojan etc

ancient whale
quaint mantle
#

hey hey

#

how might i calculate the time it's been since a player has jumped

#

using PaperMC PlayerJumpEvent )))))))))

eternal oxide
#

Spigot not paper here

limber dust
#

simple way of tracking time between events

quaint mantle
#

tbh im mainly just checking IF the player is jumping with the Move event, but that does help too as i will need that :D

limber dust
#

ahhh, def go ask in the paper discord if you're using their api since they may have a way to check that specific thing

#

there might be a isJumping() method but can't say (sorta like isSneaking())

granite beacon
#

is there any way to get the glowing effect to only apply to the visible parts of the armor stand rather than the whole thing?

earnest lark
#

anyone wanna go over my code and check it

#

its pretty small

outer crane
#

Hey, I've got the setupEconomy() function taken from the example for the Vault API: ```java
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
economy = rsp.getProvider();
return true;
}

#

That returns false for some reason

#

Vault is running on the server and is set as a depend in plugin.yml

outer crane
#

isJumping is client-side, so you might wanna be careful abt that

indigo iron
#

everytime I spawn in a magma it spawns in as a small one

tacit storm
#

0 = Small
1 = Medium
3 = Large
(If I recall correctly)

earnest dome
#

cube

tacit storm
#

0 and 1 are actually the same

#

So the values are 0, 2, 3, ...

unreal quartz
#

smh scammed

shadow gazelle
#

sender.sendMessage should work for console and a player, right?

#

Okay

#

Wanted to be sure

hasty prawn
#

Is it just me or is Gradle more trouble than what it's worth.. Like what even is this

faint vector
#

does anyone know how I could call a block break event to actually break a block

unreal quartz
faint vector
#

liek say I right clicked on stone and wanted that to break the block with the sound and possible drops

#

I LOVE YOU

hasty prawn
unreal quartz
#

what’s your build.gradle

#

is the target version set and correct

hasty prawn
#

Oh might not be, hang on

ivory sleet
#

What gradle wrapper version?

hasty prawn
#

Any idea why JavaVersion.VERSION_16 doesn't exist when using 7.1.1 🤔

#

7.1.1

ivory sleet
#

It should appear

hasty prawn
#

Ah, I got it. Appreciate the help 👍

#

i still hate gradle 😂

ivory sleet
#

😔

hasty prawn
#

It's so useful and such a pain at the same time

ivory sleet
wild reef
#

Hey guys, I wanted to ask if you can set gamerules for a specific area / chunk?

proud basin
#

no

wild reef
#

alright, thank you

waxen barn
#

Can someone help me with nms, that is not as easy as just sending some packet to player? (I am asking first, because I don't want to uselessly spam here with the problem)

worn sierra
#

i'm trying to use guice on my plugin but Preconditions gives me an error

#

I guess spigot has that dependency built-in

#

an old version

#

how can I fix that?

#
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V```
exotic scroll
#

?scheduler

waxen barn
# quaint mantle https://dontasktoask.com

ok, so I have problem, that I am trying to make custom entity, that extends EntityInsentient, but should be sent to client as armor stand (and i couldn't find any way how to do it, because the entityType must extend the class that is extended by the custom entity)
And I also have one more advanced problem and that is, that I don't understand what exactly is ControllerMove.a(double, double, double, double) doing and how to use it.

#

because I need to extend EntityInsentient because I am using .setGoalTarget(), .......

faint vector
#

does anyone have any idea on how i could trigger a left click animation for a player?

quaint mantle
#

tf is goleTarget?

waxen barn
#

nope, it extends EntityLiving, otherwise it will be ok, because i can still use it as an entity type even if it extends the class that I am extending

waxen barn
quaint mantle
#

ah

worn sierra
faint vector
#

I ahve a plugin where you can easily replant a crop by rightr click it with the seed but no animation is happening

worn sierra
#

well you can play the animation for anybody but not the player itself

#

not for the player who replants

exotic scroll
#

can someone do an example of a scheduler that run a task 1 seconds later?

undone axleBOT
waxen barn
worn sierra
waxen barn
#

ik

#

i am just doing many things at same time, so i misspelled it

torn shuttle
#

is it just good form to load worlds on load instead of on enable?

worn sierra
#

can you load worlds in onLoad method?

#

iirc you can't

torn shuttle
#

am I misremembering? I thought that's how world management plugins did it

#

yeah I think they do

#

it's hard to tell because there's not exactly a message with a cutoff but they consistently seem to load it either on load or at the very top of on enable

faint vector
#

Thank you

torn shuttle
#

I figured that if I put world loading on onload instead of on onenable it might curb the weird issues I'm getting with startup entity loading (I'd then load entities on onenable) but I'm not sure

worn sierra
#

it seems like these methods called consecutively

#

but idk... ¯_(ツ)_/¯

#

I mean, I am pretty sure that I have failed to load a world on onload method

torn shuttle
#

hm

#

I really hate this bug

worn sierra
#

what bug

torn shuttle
#

I ran into a weird issue where either entities are double spawning or not despawning correctly when adding them to a world that just loaded on startup

worn sierra
#

do you use something to load the world or is it just spigot

torn shuttle
#

just the spigot api

#

if I wait for a few ticks it works just fine, but I would rather not do that if I can avoid it

#

I should revive my double chunk loading detection code

vast sapphire
#
    public static ItemStack amethystLeg() {
            ItemStack amethystLeggings = new ItemStack(Material.NETHERITE_HELMET);
            LeatherArmorMeta amethystLegMeta = (LeatherArmorMeta) amethystLeggings.getItemMeta();
            amethystLegMeta.setColor(Color.PURPLE);
            amethystLegMeta.addEnchant(Enchantment.DURABILITY, 70, true);
            amethystLegMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 10, true);
            List<String> amethystLegLore = new ArrayList<>();
            amethystLegLore.add(format("&7Amethyst X"));
            amethystLegMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
            amethystLegMeta.addItemFlags(ItemFlag.HIDE_DYE);
            amethystLeggings.setItemMeta(amethystLegMeta);
            amethystLegMeta.setLore(amethystLegLore);
            return amethystLeggings;

    }
``` I get this error ```Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaItem cannot be cast to class org.bukkit.inventory.meta.LeatherArmorMeta (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaItem and org.bukkit.inventory.meta.LeatherArmorMeta are in unnamed module of loader 'app')
#

i see

#

i wonder why

#

missed that one lol

#

thanks

fierce salmon
#

So I am making a book that when you right click it, three axolotls spawn, but I want to add a cooldown of 20 seconds. How would i do that?

#

If you need to I can show you my code

tacit storm
fierce salmon
#

hmm

young knoll
#

Map with a time stamp

earnest dome
#

give me idea for plugin

steep nova
#

no

silk mirage
earnest dome
#

...

#

kek

silk mirage
#

Oh, I got a idea. I think I should create some kind of /eval command in game so the developers don't have to write a new plugin to test just around a single line

earnest dome
#

lol

#

discord bots do that

#

xD

silk mirage
#

alot of bots aren't made in java

earnest dome
#

true

silk mirage
#

and they don't have bukkit and other imports

#

Yep, I do have a JDA Minecraft bot with java eval command with Bukkit

#

i'll now make that plugin commands based

#

and possibily post it as resources??

waxen plinth
#

Mine lets you run it as a command or a book

dense geyser
#

This is more of a theory question, but why can't block changes be asynchronous?

stone sinew
dense geyser
#

ah okay, thanks!

stone sinew
#

Look into Block change via NMS before trying to go completely async.

#

Not that I know of. Just use InventoryClickEvent and check for an merchant inventory.

silk mirage
#

I think you'll have to use InventoryClickEvent

#

It's a real pain when they there is no Events for the required fundamental thing

#

_<

stone sinew
#

Could always make your own with the provided methods in the API or PR one to spigot. Doubt it will ever be accepted though. I see 6 year old threads of the same thing xD

silk mirage
#

ikr

#

W h a t y o u k n o w a b o u t r o l l i n' d o w n i n t h e d e e p

#

👌

granite stirrup
#

I see

#

That

#

Pfp

#

Everywhere

fluid cypress
#

why do lighting bugs happen? (specifically using fawe) how can i fix those from a plugin? idk how that works, but i know there are plugins to fix it, and none are updated to 1.17, so i have to make my own

fluid cypress
#

not worse than the alternative, wait half an hour just for a medium size cube with world edit, or even worse, put blocks manually

silk mirage
fluid cypress
#

but i want to use the vanilla lighting, using the light emiting blocks, not just add light

#

and in some places, the light emitting blocks put with fawe dont emit light. //fixlighting doesnt fix it

#

didnt know about that

#

what is the second arg, radius in chunks?

#

what is a heightmap? can it be fixed somehow?

young knoll
#

Heightmaps are data stored in the world file that save the highest block for certain conditions in each column

quaint mantle
static whale
#

I'm noticing that my BlockExplodeEvent doesn't trigger at all for TNT and such, any ideas as to why? Am I using the wrong event for that?

split egret
#

Spigot has a max TNT setting

#

I think*

#

check spigot.yml

static whale
#

I mean the TNT is exploding, its the event that isn't firing.

vague oracle
#

Entity explode event as it’s a primed tnt

static whale
vague oracle
#

👍

young knoll
#

Afaik block explode event only fires for world.createExplosion

#

Actually beds and respawn anchors, didn’t think of those

static whale
#
@EventHandler(ignoreCancelled = true)
public void on(final @NotNull EntityExplodeEvent event) {
    event.blockList().forEach(block -> {
        Collection<ItemStack> drops = block.getDrops();
        if (Math.random() < event.getYield()) {
            drops.clear();
            drops.addAll(Arrays.asList(new ItemStack(Material.STICK)));
        }
        else
            drops.clear();
    });
}

So I have this code for EntityExplodeEvent however for whatever reason the drops from the blocks are not modified. I'm assuming this is similar to BlockDropItemEvent in that you need to spawn item entities yourself, but I don't even see a place to get the list of item entities, so I am quite lost.
Even if I can just cancel dropping items that would be fine because then at least I can summon the entities with the block locations, but that doesn't seem to be the case.

drowsy helm
#

I dont think there is any method for getting dropped items

#

you can set yield though

static whale
#

So maybe set the yield to 0 and summon the items myself with block locations, that's what I'm thinking.

drowsy helm
#

yeah

#

also final and Notnull arent really necessary in the params

static whale
#

Cool, I'll give that a shot, thanks for the tip!

#

I know, I just like to do it everywhere I can haha.

drowsy helm
#

lol fair

odd sentinel
#

I'm using PrepareSmithingEvent to set a dynamic result - it works, but I can't actually take the resulting item out. any ideas what I've missed

sour loom
#

how can i add something to the default config of the plugin and then save it?

twilit vector
#

I am getting a LOT of errors for Block Break event

#

This is the log

#

And this is the code

#

There are no errors in the code

static whale
#
Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.bukkit.persistence.PersistentDataContainer.get(org.bukkit.NamespacedKey, org.bukkit.persistence.PersistentDataType)" is null

This tells me that your first calls to p.getPersistentDataContainer().get(new NamespacedKey(main.getPlugin(), "xp"), PersistentDataType.INTEGER); is null because it has not been set yet.

quaint mantle
#

I'm struggling to decide which is the better code structure

@AllArgsConstructor
public class InventoryEventListener implements Listener {
    private final Economy economy;
    private final GUIManager manager;
    
    private final PersistentDataUtil util = GalaxyShopAPI.getApi().getUtil();
    private final Messages messages = GalaxyShopAPI.getApi().getMessages();
    private final GalaxyShop shop = GalaxyShopAPI.getApi().getShop();

or, just require all of them as an argument
in the main class, if all were arguments

getServer().getPluginManager().registerEvents(new InventoryEventListener(manager, util, getEconomy(), messages, this), this);
getServer().getPluginManager().registerEvents(new InventoryEventListener(getEconomy(), manager), this);

and if they werent

quaint mantle
twilit vector
#

on which line?

quaint mantle
#

27

twilit vector
#

ok 1 sec

quaint mantle
#

and also potentially 28

twilit vector
#

ohhh

#

rightt

#

so is there a way i can initialize it to 0?

young knoll
#

getOrDefault

twilit vector
#

oh

#

but i dont want it to be 0 whenever the server starts

#

i only want it 0 when the player mines the very first time

quaint mantle
#
//pseudo

player:hasMined > player.getPersistentDataContainer().getXp else 0
sour loom
#

how to make a timer in the plugin, wich wont block the plugin, but does something after a certain time?

quaint mantle
#

and the code format above

twilit vector
#

oh

#

but

#

umm

quaint mantle
sour loom
#

understood, thank you

quaint mantle
#

?scheduling 👈 see also

undone axleBOT
twilit vector
#

right?

quaint mantle
#

how would you code it?

twilit vector
#

code what?

quaint mantle
#

wym

twilit vector
#

idk

#

what was your question?

quaint mantle
#
//pseudo
PDC pdc = player.getPDC()

int xp = pdc.getOrDefault(key, PDCType.int, 0)

// ...
updateXp()
twilit vector
#

oh

#

what is key here?

quaint mantle
#

namespaced key

twilit vector
#

and is pdc persistent data container?

quaint mantle
#

thats pseudocode its just an example

twilit vector
#

thank you!!

sour loom
#

question, if some one does /command firstarg
and i do args[1] will it return null or will it raise an error (im kinda new to java :( )

young knoll
#

ArrayIndexOutOfBoundsException

quaint mantle
#
// pseudo
array = [elementOne] [elementTwo]

array[0] // elementOne
sour loom
#

thank you

quaint mantle
#

guys i have been having issues registering commands, can anyone help?

tacit storm
errant drift
#

Send Code!!!!

quaint mantle
#

gimme a sec

quaint mantle
#

but i dunno how to register it

#

in main

#

like without args, i could do it

tacit storm
#

You do

getCommand("nameFromPlugin.yml").setExecutor(YourClass);

quaint mantle
#

okey give me a sec

#

OHHH

#

i didnt know it had to be from plugin.yml

#

thx so much

tacit storm
#

You also won't really need this anymore
if (command.getName().equalsIgnoreCase("custom_items")) {

quaint mantle
#

im just starting out so,..

tacit storm
#

All good, glad I was able to help!

tacit storm
#

Not even that!

quaint mantle
#

then?

tacit storm
#

It will only execute the Method if you actually enter the Command

#

You don't really need a Check if the Command equals this

quaint mantle
#

oh

#

but what if there are many commands with different labels?

tacit storm
#

They will get their own Executors

quaint mantle
#

oh

tacit storm
#

The Command itself and it's Aliases will all link to that Executor

quaint mantle
#

ok thx

tacit storm
#

👍

quaint mantle
#

im still getting an error :(

tacit storm
#

U wanna move to DM's maybe ?

#

So we don't spam in here too much

quaint mantle
#

okey

quaint mantle
tacit storm
#

True, will do so for further occasions then

sour loom
#

NVM, typo XD

#

in a config.yml like so :

jail:
  default_time : 60 # in minutes
  location :
    x : 0
    y : 0
    z : 0

i can access the x by giving the jail.location.x as the path right?

tacit storm
#

yep
Emotes not working Sadge

young knoll
#

🤔

quaint mantle
#

Hello i created leaderboard of kills with MySQL but it doesnt sort correctly someone can help me?

PreparedStatement select = connection.prepareStatement("SELECT * FROM PVP_stats ORDER BY 'kills' DESC LIMIT " + showPerPage + " OFFSET " + ((Integer.parseInt(page) - 1) * 10));) {
                            ResultSet top = select.executeQuery();
                            for(int i = 0; i < showPerPage; i++) {
                                if(top.next()) {
String uuid = top.getString("uuid");
int kills = top.getInt("kills");
int deaths = top.getInt("deaths");
                                 
                                }
                            }
tacit storm
#

Instead of "SELECT * FROM PVP_stats ORDER BY 'kills' DESC try "SELECT * FROM PVP_stats ORDER BY 'kills' ASC ?

eternal oxide
#

yep

quaint mantle
#

Ok i will try thanks

tacit storm
#

The ASC stands for ascending and the DESC stands for descending. You use ASC to sort the result set in ascending order and DESC to sort the result set in descending order. https://www.mysqltutorial.org/mysql-order-by/

sour loom
#

in here : PotionEffect(PotionEffectType.WEAKNESS,timer.intValue(),100, false, false), setting ambient to false and particles to false, player or others wont see the effect particles on the player right?

#

i dont understand what ambient does here

tacit storm
sour loom
#

so it just makes it to generate more particles ?

tacit storm
#

Seems like it, yes.

sour loom
#

will doing "some thing \n something else" go to the other line in minecraft chat?

tacit storm
#

yep

#

But for the future

#

Man I love this link

sour loom
tacit storm
#

Best way to learn is by doing/trying it yourself and hopefully running into errors

#

Cuz u best learn from errors

elfin rapids
sour loom
#

i totally agree, but the stuff that im asking are super simple stuff.. and i know the answer to most, i just want to be sure (and im a bit lazy ;) )

#

is there an function to turn minutes or seconds into ticks, or do i have to do the math?

opal juniper
#

I mean

candid galleon
#

1 second = 20 ticks

opal juniper
#

Ticks = seconds * 20
Seconds = minutes * 60

candid galleon
#

seconds = ticks / 20

#

minutes = seconds / 60

sour loom
#

i know that, i was just looking for a more clear and good looking way :/

candid galleon
#

...

static whale
#

Just make your own util functions

opal juniper
#

private int getTicks( int minutes) {
return minutes * 60 * 20
}

#

I guess

static whale
#

Right also, I'm having this issue with BlockDropItemEvent where I am changing the drops for the broken block. That's all fine, except for the fact that when I for example break a block with a torch ontop of it, the torch drops instead of my drop. I saw somewhere that I will need to use BlockPhysicsEvent, but I'm not quite sure how to go about that as I didn't see anything in there specific to breaking, only movement.

I asked a while ago previously but the only answer I got was to use ItemSpawnEvent, which isn’t useful because there are other cases where an item may spawn.

candid galleon
#

might be worth checking that out

static whale
#

That only triggers when the player is the one breaking the block

#

Plus that’s already what I’m using in conjunction with BlockDropItemEvent which is a result of BlockBreakEvent

fluid cypress
#

why cant i do this?

     @Override
    public void onEnable() {
        instance = this;
        new BukkitRunnable() {
            @Override
            public void run() {
                instance.getCommand() // getCommand doesnt exists
            }
        }.runTask(this);
    }
drowsy helm
#

getCommand takes an argument

#

what are you trying to achieve with that?

fluid cypress
sour loom
#

i was wondering how i could send an action bar message.. and i found this :
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("an string"));
is there an easier way to do it? like player.sendActionbar or something?

drowsy helm
fluid cypress
tacit storm
# static whale Right also, I'm having this issue with `BlockDropItemEvent` where I am changing ...

Tried this code:

    public void onBlockBreak(BlockDropItemEvent e){
        e.getItems().forEach(item -> {
            if (!item.getItemStack().getType().equals(Material.SAND))
                return;

            item.setItemStack(ItemBuilder.buildNewItem(Material.STICK).setDisplayName("§bTest").build());
        });
    }```

And everything is working perfectly fine for me?
The Sand Drop is getting replaced with my Custom Drop and the Torch Block above drops the same old Torch, I don't see the problem here?
static whale
tacit storm
#

OH, I see, let me try something

#

Nope, still works for me

#

Same code, just changed Material.SAND to Material.TORCH

static whale
#

No, as in when you break the block under the torch both that block and the torch drop custom drops. I have no problem with doing it for the block broken, it’s when the block the torch is on is broken when it’s not quite working

static whale
burnt current
#

Quick question: Does anyone know how to create a variable that creates a block and where you can then also edit the block data?

drowsy helm
#

huh

static whale
tacit storm
drowsy helm
tacit storm
#

Or am I misunderstanding something here ?

static whale
tacit storm
#

Let me check

#

Still works fine for me

#
    public void onBlockBreak(BlockDropItemEvent e){
        e.getItems().forEach(item -> {
            switch (item.getItemStack().getType()){
                case SAND:
                    item.setItemStack(ItemBuilder.buildNewItem(Material.STICK).setDisplayName("§bA").build());
                    break;
                case TORCH:
                    item.setItemStack(ItemBuilder.buildNewItem(Material.DIAMOND).setDisplayName("§aB").build());
                    break;
            }
        });
    }```
This is the code I used
#

Could I see your code actually? I have a feeling I know what the issue is

#

We should've prob. started with that one lmao

static whale
#

Lmao yeah sure thing, just one moment

undone axleBOT
burnt current
drowsy helm
#

I mean you can make your own class for that. But only containers can have persistent data

#

when placed*

burnt current
#

oh yeah i mean persistantdatacontainers

static whale
young knoll
#

Why not setItemStack on the existing item

burnt current
static whale
young knoll
#

Also you only drop one there, regardless of the collection size

#

?

#

Multiple separate items?

static whale
#

Yeah I might do that

tacit storm
#

man

static whale
#

Don’t gotta do us like that

young knoll
#

Shame that list can’t be written to

drowsy helm
cinder timber
#

fuck

static whale
burnt current
undone axleBOT
#

gecko10000#7137 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.

young knoll
#

What kind of English language vomit

paper geyser
#

hey idk if this is the right place to ask but anybody know how wynncraft has client side mining for wood? Ik it has something to do with structure blocks

drowsy helm
#

client side mining?

#

as in other players dont see it

paper geyser
#

yeah

drowsy helm
#

all packets

#

you can just send packets to spoof the block being there despite it not

#

or vice versa

paper geyser
#

so like

#

mine the block

#

cancel the event

#

packet stuff

#

so the block isnt there for the player that mined it

#

right?

drowsy helm
#

yeah exactly

paper geyser
#

cool beans thank you

drowsy helm
#

well, that would be the easiest way of doing it

paper geyser
#

ahhh

#

any other ways?

#

i mean if they're more lag efficient haha

drowsy helm
#

id recommend just going with that method

#

but

#

keep in mind when changing blocks with packets, once the chunk is unloaded or player dies it will reset

#

so you have to keep track of that

paper geyser
#

meh shouldnt be a problem

drowsy helm
#

But for temporary things, like trees shouldnt really matter too much

paper geyser
#

yeah thats what i thought

tawdry cedar
#

Anyone know how to change the level of the light block itemstack?

paper geyser
#

im new to java so sorry about that

drowsy helm
#

dont apologise lol

#

its a good question

paper geyser
tawdry cedar
#

there is different levels of it

paper geyser
#

lichen?

drowsy helm
#

ah right. Would most likely be in the ItemMeta

tawdry cedar
#

but there doesn't seem to actually be a way to set the level on an itemstack

paper geyser
#

WAIT

#

THEY ADDED IT

#

I FORGOT

drowsy helm
#

huh

static whale
paper geyser
#

it changes to bedrock whenever its mined i just wanted to see if maybe i could have smth cool like that :)

static whale
#

Go for it, sounds like a really nice idea

paper geyser
#

will do! gotta do some reading up on packets so ill be back with more questions

tawdry cedar
#

Seem to get somewhere with the BlockStateMeta

#

But I'm getting an error when I cast it to an itemstack so

paper geyser
drowsy helm
#

yeah, far easier then regular packets

static whale
#

Wait wrong link lmao

#

Edited

tawdry cedar
#

thank you

#

i'll try this

paper geyser
#

oh wow

#

oh wow i have no clue whats going on here edit: was reading the wrong section

sour loom
#

for editing and saving a the default config, do i do :

@Override
public static FileConfiguration config;
public void onEnable(){
        getConfig().options().copyDefaults();
        saveDefaultConfig();
        config = getConfig();
//In some other file
Main.config.set("world.spawn.x", X);
Main.config.set("world.spawn.y", Y+1);
Main.config.set("world.spawn.Z", Z);
try {
    Main.config.save(.instance.getCurrentPath());
}catch (IOException e){
                //Log the error
}

like this? cause it raises file not found.
what should i do?

eternal oxide
#

His code is fine, so long as he actually has a config.yml in his jar

#

other than static abise

#

he can scrap the copyDefaults line

#

but save default is correct

sour loom
#

ok i got lost, i have a config.yml, now should i do RolePlayCore.instance.saveConfig(); or RolePlayCore.instance.saveDefaultConfig();

eternal oxide
#

saveDefault, it will create folders and copy your yml from your jar to your data folder

sour loom
eternal oxide
#

So long as your config.yml is actually IN your jar

#

it will not copy it if there is already a file there

#

if you want to change values you just getConfig(). It will load the config.yml from the data folder

sour loom
#

im doing that, but i dont know what to pass into .save method of FileConfiguration

eternal oxide
#

you just getConfig().saveConfig()

sour loom
#

it takes an string but string to what

eternal oxide
#

Yep no need to getConfig. just saveConfig

sour loom
smoky finch
#

Is there a way to check if a server command exists from a string? I can already check bukkit commands using Bukkkit.getPluginCommand but how do I do that for a command like /say? Other than events like PlayerCommandPreprocessEvent

paper geyser
#

alright so packets question

#

lets say i want to use viaversion

#

wouldn't that break everything and crash people on lower versions?

#

because you'd have to import net.minecraft.server.(version)

static whale
#

No because you’re importing server side

#

The client never sees what’s going on in the plug in

smoky finch
#

I'm not sure how this is related to ViaVersion, but yes, you have to import from different packages depending on the server's version.

paper geyser
#

oh ok

#

so its based on the server's version

#

not on the client's version

static whale
#

As long as the server version matches you’re good

#

Yes

paper geyser
#

alright got it

#

i was like "wouldnt the client freak out and cry itself to sleep"

drowsy helm
#

it translates packets

#

it would be a huge pain in the ass if it didnt lol

paper geyser
#

haha eyah

#

yeah*