#help-development

1 messages · Page 1633 of 1

grim ice
#

why is it not readiing it tho

eternal oxide
#

however for some reason the getObject will not parse an array

grim ice
#

easy solution

#

we change it to list

#

and change config too

#

so theyre both lists

#

then we use getStringList

rare cave
#

not found

prime mountain
#

**

rare cave
#

k

prime mountain
#

it doesn't have spigot support and im 99% sure there are no api docs

#

but its there

eternal oxide
#

you are going to have to java String[] matrix = data.getStringList("matrix").toArray(new String[0]);

rare cave
#

uh i dont know rust

prime mountain
#

always a time to learn my guy

#

rust is pretty cool

grim ice
#

String[] items = data.getStringList("items").toArray(new String[0]);

#

too, right

rare cave
#

oh fine ill try

prime mountain
#

no dont

#

its a meme

eternal oxide
#

yes

snow vector
#

anyone?

eternal oxide
#

Now watch your IDE bitch about possible null

prime mountain
#

just do object?

grim ice
#

it instead said that items/matrix cannot be null

#

when i was doing the if check

rare cave
#

try kotlin lmao

#

always there to check if its null

grim ice
#

idk anything about kotlin

prime mountain
grim ice
#

isnt kotlin a coding language

prime mountain
#

LOOK WHAT I FOUND

snow vector
#

Okay

prime mountain
# grim ice isnt kotlin a coding language

kotlin is a jvm language that works very similar to java but with nicer syntax. People yell at you for learning it first because its a bit smaller and theres less examples

#

but as you learn kotlin you learn java by extension so eh

eternal oxide
prime mountain
#

Its kinda like speaking italian and then listening to spanish

eternal oxide
#

you just changed to getStringList

grim ice
#

wait fuck

#

right

eternal oxide
#

so change teh config to match

grim ice
#
recipes:
  cow:
    itemStack: COW_SPAWN_EGG
    matrix:
      - "DDD"
      - "SSS"
      - "DDD"
    order: "DS"
    items:
      - "DIAMOND_SWORD"
      - "STICK"```
#

must be fine right

eternal oxide
#

yes

grim ice
#

imma test now

winged knot
#

yooo

#

could i use someones big brain

#

i have this custom item in my inv

#

what command would i use to clear it out of my inv

#

im really confused about all that info

#

i have a copy/paste of it too

#

[SZMYT: The data tag did not change: {Motion:[7.620469671919723E-6d,-0.0d,3.783139530776624E-6d],UUIDLeast:-7469281371821056333L,Health:5s,Bukkit.updateLevel:2,Invulnerable:0b,Air:300s,OnGround:1b,Dimension:0,PortalCooldown:0,Rotation:[15.942183f,0.0f],Thrower:"SZMYT",FallDistance:0.0f,Item:{id:"minecraft:fish",Count:1b,tag:{display:{Lore:["Pollock are plagued by parasites"],Name:"Pollock"}},Damage:0s},UUIDMost:-6329548184662228477L,CustomName:"§;§:x1 Pollock",Pos:

snow vector
#

Please someone help

prime mountain
#

well

winged knot
#

just copy and past?

prime mountain
#

I HAVE THE POWER

winged knot
#

do you have the power to help me 😂

prime mountain
#

oh sure

#

whats up

winged knot
prime mountain
#

no i cannot because an error is only like 1/3rd of the problem

#

theres also the code and the exception if there is one

civic tapir
#

why am I getting these

#

and these errors

#

Im compiling my plugin

rare cave
winged knot
#

i need to command so i can make a shop

rare cave
#

try NBTExplorer to edit your inventory

rare cave
#

code a plugin

dense compass
#

any idea how I would go about checking if the config.yml is outdated and if so reset it?

dense compass
winged knot
# rare cave code a plugin

the plugin is already there, its not mine, its a custom fishing plugin. but the gui for the shop is ass and all fucked. so i was gonna make my own in deluxe menus

civic tapir
dense compass
rare cave
dense compass
#

oh

#

i see

#

so just check that'

rare cave
#

yep

rare cave
#

if its opensource

civic tapir
#

can anyone help me with my problem??

dense compass
#

@rare cave how would I go about resetting my plugin config?

#

srry but google is not being very helpful

rare cave
#

delete it then saveDefaultConfig()

dense compass
#

yeah as in the delete code

civic tapir
#

Would this fix my problem

civic tapir
#

and if so, how do I run mvn install in the folder

winged knot
civic tapir
winged knot
#

but ty for your help

eternal oxide
civic tapir
#

nms??

#

OH

#

okay

dense compass
civic tapir
#

where would I find the names??

eternal oxide
#

read teh buildtools post about it

#

?bt

undone axleBOT
dense compass
#

i mean i cant use == for int to check if null

#

so what would I do

rare cave
#

uh

#

convert it to Integer

civic tapir
#

what post

dense compass
#

this should work anyways

dense compass
civic tapir
#

the stash link??

rare cave
#

wait

#

sry for my bad english

civic tapir
#

its fine

rare cave
dense compass
#

ima just use string

civic tapir
#

im deadass

dense compass
#

this doesnt seem to work

#

i just realised that the last 2 lines of the if are redundant

#

but the clearing of the file

#

doesnt seem to wok

grim ice
#

is having ur plugin depending like 99% on config.yml bad

noble spire
#

depends what for?

dense compass
#

but i still want the config to update

#

all im asking is how to clear/delete config

rare cave
#

File cfg = new File(getDataFolder(), "config.yml"); cfg.delete();

#

best way to lmao

eternal oxide
dense compass
civic tapir
rare cave
#

nope

eternal oxide
#

craftbukkit is in spigot

#

and nms is net.minecraft

civic tapir
#

whats nms I have nbt

eternal oxide
#

nms = net.minectaft.server

civic tapir
#

OHHH

#

where would I find the directories??

grim ice
eternal oxide
#

you read that post I linked you about 1.17 nms mappings

grim ice
#

whats different with using a different file

#

loll

eternal oxide
#

its separate from the config, so it won't stop your plugin starting up when a users breaks the recipes when editing them. And they WILL break it.

grim ice
#

o

eternal oxide
#

also if its a seperate file you can add a reload recipes command

grim ice
#

that's a really good point

#

okay sure when i finish rewriting the plugin ill do that

eternal oxide
#

keep users out of your plugin config as much as you can

grim ice
#

since i have like 40 recipes to make in config

#

Okay

civic tapir
#

Okay

#

So i changed all my files

#

but the error persists???

snow vector
#

nearly two hours ago I asked, anyone?

noble spire
chrome beacon
#

I mean you could try boolean instead of Boolean

eternal oxide
#

You are using a system no one here has ever used. But my guess is that yoiu are running an Async Future on server stop. However ther server will nto care and will stop anyway

chrome beacon
#

^^ This sounds possible too

hybrid spoke
#

my guess is that he just never uses his #handleStop method

#

since he's just adding the callbacks to his list via CF
EDIT: nvm

eternal oxide
#

He uses them via JavaScript through that spi whatsit plugin

hybrid spoke
#

spi whatsit yes

civic tapir
#

yes

young needle
#

How would I get the last location of the player in the last world in PlayerChangedWorldEvent

hybrid spoke
eternal oxide
#

No clue, who would use JS as a plugin to a plugin when you have direct Java plugin access anyway

noble spire
#

?jd

hybrid spoke
#

I can't see through there anymore

severe marsh
#

How do I give player Splash potion of Healing?

noble spire
civic tapir
#

bruh for somereason intellij wont let me click next

young needle
noble spire
#

nice

young needle
#

yeah works

hardy swan
#

Do plugins disable in the reverse order of enable?

tardy delta
#

is there an event for entities turning their head towards a player?

opal juniper
opal juniper
tardy delta
#

°-°

noble spire
hardy swan
#

I mean there must be a dependency topological order, shouldn't be weird if it is so

opal juniper
#

so

#

i think packets but idrk

hardy swan
tacit drift
noble spire
tacit drift
#

acutally thats how it does it right?

#

:))

hardy swan
#

Hence, server reload = bad

tardy delta
#

hmm too complicated i was just asking for a vanish plugin

#

😄

tacit drift
#

or actually

#

look here

mighty vine
#

my domain has a - and I cant use it to name a package in Java should I just name my package like my domain without the -?

silver shuttle
#

whats the best way to have a function continuously execute once every second?

eternal oxide
#

?scheduling

undone axleBOT
silver shuttle
#

tank you

#

also how do you make commands not run on the main thread

eternal oxide
#

commands always execute on the main thread, however you can hand off processing the same way

#

using the scheduler

silver shuttle
#

ah okay

eternal oxide
#

There are sync and async methods in it

#

be careful. Accessing teh Bukkit API is not safe async

opal juniper
#

git being dumb

grim ice
#

?paste

undone axleBOT
grim ice
regal anchor
#

why don't you directly go to hastebin

grim ice
#

?paste

undone axleBOT
opal juniper
#

are they?

regal anchor
#

why does it have to be on md5 website

grim ice
#

this is line 16 in main class : getServer().getPluginManager().registerEvents(new RecipesManager(this), this);

regal anchor
#

your object recipe is null

#

debug to see why I guess

opal juniper
#

thanks

grim ice
#

Condition 'recipe == null' is always 'false'

#

anyone

chrome beacon
#

It's failing when applying enchants

#

Have you messed with them in any way?

grim ice
#

wdym

#

1s

#

itemStack = ItemStacks.createBookStack(Enchantment.getByKey(NamespacedKey.minecraft(material.toLowerCase())));

chrome beacon
#

And what does that do

grim ice
#
public static ItemStack createBookStack(Enchantment enchantment) {
        ItemStack enchant = new ItemStack(Material.ENCHANTED_BOOK);
        EnchantmentStorageMeta meta = (EnchantmentStorageMeta) enchant.getItemMeta();
        if (meta != null) {
            meta.addStoredEnchant(enchantment, 1, true);
            enchant.setItemMeta(meta);
        }
        return enchant;
    }```
#

wait

narrow vessel
#

and if meta == null

grim ice
#

I know why its doing that

#

probably

#

i mean idk

#

prob cuz

#

getByKey(minecraft.

#

wants

#

the minecraft name not the

#

namespacedkey

tacit drift
#

as long as it traces back to you

#

or your org

#

it's good

grim ice
#

itemStack = ItemStacks.createBookStack(Enchantment.getByKey(NamespacedKey.fromString(material.toLowerCase())));
is fine

#

right

tacit drift
#

Can't you just create a book and add enchants to it

#

and would be the same thing?

grim ice
#

thats what im dong

#

doing

tacit drift
#

No

#

a normal book

#

that has damage of enchanted book

#

so it's practically a enchanted book

#

or wait

#

is enchanted book material diff from book?

#

oh woops

hexed hatch
#

ENCHANTED_BOOK

quaint mantle
#

Hello everyone, I am using google translate to send this message, sorry for the potential errors.

Let me introduce myself, I am a young Minecraft developer. I am currently programming a local Minecraft server with the Python 3 programming language. I am using Spigot for my local test server.

My problem :

  1. When I create the script for example:

import mcpi.minecraft as minecraft
#I'm not sure what it is for but I think it allows me to code in Python on Minecraft

mc = minecraft.Minecraft.creat ()
#Allows to create a link between my Python page and my Local server

mc.postToChat ("Hello Worl")
#Allows the console to write in the chat: "Hello World"

What I want is to create the command "/ hello world"
Then use it in a secon time so that it executes the script at the top

You have an idea ?

hexed hatch
#

You can't write Python scripts for Minecraft Java Edition servers

grim ice
#

bruh..'

hexed hatch
#

Spigot is a Java api

#

Learn Java to make use of it

grim ice
hasty prawn
quaint mantle
grim ice
#

@eternal oxide aaa r u here

#

sorry for pinging

hasty prawn
#

Whats line 84 in RecipesManager

slim magnet
#

Hey you know in spectator mode how you can right click an entity then you get their view? How do I do this in code?

grim ice
#

Bukkit.addRecipe(recipe);

#

@hasty prawn

hexed hatch
slim magnet
humble heath
#

is there a way to check if someone has flymode enabled#

eternal oxide
slim magnet
hazy igloo
hexed hatch
slim magnet
#

or getAllowFight

hasty prawn
#

Something within recipe must be null 2Hex, I'm guessing it's probably not finding something from the config, so check the order, matrix and itemstack.

slim magnet
hazy igloo
hasty prawn
mighty vine
humble heath
#

[12:22:42 INFO]: [EndereleteNew] [STDOUT] NAME: ArcaneLegend
[12:22:42 WARN]: Nag author(s): '[]' of 'EndereleteNew' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).

#

case 2:
if (player.getAllowFlight()) {
player.setFlying(true);
player.setAllowFlight(true);
e.setCancelled(true);
} else {
player.setFlying(false);
player.setAllowFlight(false);
}

#

if (e.getView().getTitle().contains("Player Control's for")) {
String name1 = e.getView().getTitle().substring(31);
/*String name = e.getView().getTitle().substring(17);
name = name.substring(0, name.length() -2);

        */
        Player player = Bukkit.getPlayerExact(name1);
        System.out.println("NAME: " + name1);
        if (player == null) {
            e.getWhoClicked().sendMessage(Utilities.color(" Player is not online or the player is staff you cant do there gamemode!!"));
            e.getWhoClicked().closeInventory();
            e.setCancelled(true);
            return;
hasty prawn
#

??

humble heath
#

the elitra just popes out#

hasty prawn
#

?paste

undone axleBOT
humble heath
grim ice
#

i figured out my problem myself lmfao

#

it was becuz NamespacedKey.minecraft didnt use namespacedkeys

slim magnet
regal anchor
#

guys getItemOnCursor().getType() always returns AIR

#

I use ViaVersion maybe it causes this

#

(my sever is 1.12)

slim magnet
#

whats the best/smoothest way to interpolate teleportation from location x to y over a certain time like in seconds or ticks

main dew
#

how I can disable Falling gravel sand and other?

regal anchor
#

ten seconds search

#

EntityChangeBlockEvent

#

check if the block is instanceof FallingBlock

#

cancel

grim ice
#

How do I make a seperate file for my config.yml? Since I don't want people fucking it up and ruining their copy

#

Do I just use normal java files system

blazing bronze
#

Anyone know the proper way to cast a block to a Bed? (1.16)

This seems to give me a class cast exception...

            import org.bukkit.block.data.type.Bed;
            Bed bed = (Bed) block.getBlockData();
java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.block.impl.CraftBed incompatible with org.bukkit.block.Block
grim ice
#

getBlockState() prob

grim ice
#

pog its spoonfeed code!!!!

#

jk

blazing bronze
grim ice
#

Wait

#

No IM wrong

#

Bed extends BlockData

grim ice
#

So ig you will use getBlockData()

eternal oxide
#

then you lookup its superinterfaces

#

That will tell you what you need from Block to be able to cast

grim ice
#

or just be a smart peep

#

B)

blazing bronze
#

so BlockData

#

okay

eternal oxide
#

teach a man to fish 🙂

blazing bronze
grim ice
chrome beacon
grim ice
#

I think he imported the wrong thing, no?

blazing bronze
#

Nah didn't import the wrong one. That's the correct import I'm using

grim ice
#

Are you checking if the block is actually a bed

#

before casting

blazing bronze
#

Yes

#
if (MaterialUtil.BED.contains(block.getType())) {
grim ice
#

what

eternal oxide
#

no

grim ice
#

if(block.getType() == Material.BED)

#

no?

blazing bronze
#

That's literally what I'm doing

#

lol

grim ice
#

Your way is either wrong or weird

blazing bronze
#
    public static final Set<Material> BED = ImmutableSet.of(
            Material.WHITE_BED,
            Material.BLACK_BED,
            Material.BLUE_BED,
            Material.BROWN_BED,
            Material.CYAN_BED,
            Material.GRAY_BED,
            Material.GREEN_BED,
            Material.LIGHT_BLUE_BED,
            Material.LIGHT_GRAY_BED,
            Material.LIME_BED,
            Material.MAGENTA_BED,
            Material.ORANGE_BED,
            Material.PINK_BED,
            Material.PURPLE_BED,
            Material.RED_BED,
            Material.YELLOW_BED
    );
grim ice
#

oh Right

#

thats the best way to do it actually

blazing bronze
#

🙂

eternal oxide
#

if (Tag.BEDS.isTagged(block.getType())

hazy igloo
blazing bronze
#

Sec testing BlockData

#

That's what Directional needs

grim ice
#

is

eternal oxide
#

Tags are so you don;t nee to build your own lists

grim ice
#

endsWith()

#

check if the material (convert to string if it isnt already) endsWith() "BED"

#

those are both ways

#

but what ElgarL said is better

blazing bronze
grim ice
#

?paste

undone axleBOT
grim ice
#

dont mind me im just using this to store my code

hazy igloo
#

@blazing bronze so you tried block.getState().getData() ? i guess that should work

blazing bronze
cold tartan
#

if i wanted to maintain formatting (italic, coloring, etc.) while manipulating a string, how would i do that?

cold tartan
#

btw the "a player" is intentional

chrome beacon
blazing bronze
grim ice
#

guys

#

private static MainClass plugin;and
private static JavaPlugin plugin;
are the same right?

hazy igloo
#

yeah

blazing bronze
#

Yes and no.

grim ice
#

first one is better right

blazing bronze
#

MainClass refers to your mainclass

hazy igloo
blazing bronze
#

while JavaPlugin refers to any JavaPlugin

grim ice
#

becuz with first onne ii cann access stuff there

#

like plugin.getSmthThereIDK

#

11111111eeeeeeeeeeQEFefWEG

hazy igloo
humble heath
#

hey any idea

grim ice
#

right?

hazy igloo
#

yes

grim ice
#

I can ignore 'Field can be converted to a local variable' right

grim ice
#

customConfigFile = new File(getDataFolder(), "recipes.yml"); if (!customConfigFile.exists()) { customConfigFile.getParentFile().mkdirs(); saveResource("recipes", false);
Result of 'File.mkdirs()' is ignored, why?

proud basin
#

Would this still be considered a list List<Map.Entry<UUID, Integer>> ent = new ArrayList<>();?

glossy scroll
#

hey are fallingblock entities cached by the client in some way?

#

i feel like when i spawn some out of render distance, the player will eventually see them when they come into view

#

was curious if someone knows a way to avoid that

#

hmm i suppose i can cancel the spawn packet

vale ember
#

hi everyone, i have a question, how to set custom skin to fake player

chrome beacon
#

You set the skin in the PlayerDataInfo (or just Player Info if you're looking at wiki.vg) packet

grim ice
#

customConfigFile = new File(getDataFolder(), "recipes.yml"); if (!customConfigFile.exists()) { customConfigFile.getParentFile().mkdirs(); saveResource("recipes", false);
Result of 'File.mkdirs()' is ignored, why?

humble heath
hazy igloo
humble heath
#

any idea

#

if (player.getAllowFlight() == false) {
player.setFlying(true);
player.setAllowFlight(true);
e.getWhoClicked().sendMessage(player.getName() + "fly enabled");
e.setCancelled(true);
} else {
player.setFlying(false);
player.setAllowFlight(false);
e.getWhoClicked().sendMessage(player.getName() + "fly Disabled");
e.setCancelled(true);
}

grim ice
#

bro

#

WHY

#

DO U HAVE

#

SETFLYING

#

BEFORE ALLOW FLIGHT

#

LOFMAOIWEFNAWOEFUA

#

\

hazy igloo
humble heath
#

and when i remove == false it only trys to disable thje flight

grim ice
#

ok so simply

#

instead of

#

player.setFlying(true);
player.setAllowFlight(true);

#

do player.setAllowFlight(true);
player.setFlying(true);

#

Because youre making the player fly without them having the ability to

hasty prawn
#

You can set them to flying even if they don't have the ability to.

grim ice
#

youre only giving the player the ability to fly after you make them fly

hasty prawn
#

setAllowFlight just gives them the ability to toggle it on and off themselves

grim ice
#

well thats what i understood from the error

#

just try it ig

hazy igloo
undone axleBOT
hazy igloo
#

paste the error there.

hasty prawn
#

Oh I didn't see that error

#

You're right

#

That's odd 🤔

humble heath
hazy igloo
#

btw you can change if(player.getAllowFlight() == false) to if(!player.getAllowFlight())

quaint mantle
#

Hey!

#

Is there something like LeatherArmorMeta for horse leather armors?

grim ice
#

Why would you need that

humble heath
#

still keeps trying to disable

grim ice
#

Ohh for the displayname or lore?

grim ice
#

Use normal item meta

#

What is different between normal items and horse armors?

#

Nothing.

humble heath
#

thank you

grim ice
#

LeatherArmorMeta mainly exists because Leather armor can also be colored

quaint mantle
grim ice
#

No?

quaint mantle
#

Which is not possible with a simple ItemMeta

grim ice
#

What??

#

You cannot..

quaint mantle
#
Minecraft Wiki

Horse armor is a special type of armor that can be given to a horse to wear. Only normal horses can wear armor; donkey, mule and undead variants such as skeleton horses and zombie horses cannot be equipped with armor. Horse armor decreases damage done to horses when hit by melee attack or a ranged attack from the player or another mob. Horse ar...

grim ice
#

wait

#

Waht the actuaal fuck

slim magnet
#

How do I make it so a player cant change their yaw or pitch without it being glitchy

quaint mantle
#

This is what I am using for colorable furnitures

quaint mantle
grim ice
#

@quaint mantle

#

You can use

#

LeatherArmorMeta

#

It will work for horse armor too.

quaint mantle
#

this is not what the javadocs says

#

that's why I asked

slim magnet
slim magnet
#

i tried making the helmet of the armorstand and the payer a pumpkin but it didnt work

quaint mantle
#

Alright thank you

grim ice
#

:D

quaint mantle
#

It would be cool to have a ColorableItemMeta interface or something

grim ice
#

mhm

quaint mantle
#

because it's not really cool to have to add 3 if else

grim ice
#

?paste

undone axleBOT
grim ice
#

Hey!

#

Why is my custom config nnot working?

#

I followed the Wiki

#

It seems outdated and flawed, anyone knows how to do iit better

chrome beacon
#

It's not outdated

grim ice
#

If it's not, then am I misusing it

#

my recipes.yml (In my jar) is inside my src folder

#

But not with my classes

#

my classes are in main\java\projectshit\

chrome beacon
#

It should be in the root of the jar in the same place as the plugin.yml

grim ice
#

what fuckery

#

then theyre wrong

chrome beacon
#

Also you forgot .yml in your saveResource

grim ice
#

I don't need that

#

It's saving the file directly

#

and it's copying the file type as well

#

and everything belonging to it

#

thats what i think

eternal oxide
#

you put all yml files in your resources folder

grim ice
#

what fuckery

#

is the wiki saying then

eternal oxide
#

it was probably pre maven

grim ice
#

I edited it

humble heath
#

hey is the a way in the if statment to check if a player is glowing like

#

if ( player.getGlowing){

vast sapphire
#
                if (command.getName().equalsIgnoreCase("ench"))
                    if (p.hasPermission("ab.enchant"))
                    switch (args[0].toLowerCase()) {
                        case "sharpness":
                            p.getInventory().getItemInMainHand().addEnchantment(Enchantment.DAMAGE_ALL, Integer.parseInt(args[1]));
                            p.sendMessage("Enchanted" + args[0] + args[1]);
                    }
                else if (args.length == 0)
                    p.sendMessage(ChatColor.RED + "Usage: " + ChatColor.BLUE + "/enchant <enchantment> <level>");``` Why does my command not perform anything when I run it?
chrome beacon
grim ice
#

@eternal oxide It still does not create it

humble heath
#

player.setglowing(true):

eternal oxide
humble heath
#

}thank you

chrome beacon
civic adder
vast sapphire
#

yes

grim ice
chrome beacon
#

._.

chrome beacon
#

Do that

eternal oxide
#

full file name

hazy igloo
grim ice
#

WHAT

vast sapphire
grim ice
#

ok then anoother thing to edit in the wiki

#

i swear these wikis are fucked

chrome beacon
#

They did it in the wiki

grim ice
#

wait

#

wtf

chrome beacon
#

You're just bad at following it

vast sapphire
#

?paste

undone axleBOT
eternal oxide
#

wiki says custom.yml

grim ice
#

bruh

grim ice
#

im pretty sure i followed it right

#

ehfiehfawebfouaewf

eternal oxide
#
    private void createCustomConfig() {
        customConfigFile = new File(getDataFolder(), "custom.yml");
        if (!customConfigFile.exists()) {
            customConfigFile.getParentFile().mkdirs();
            saveResource("custom.yml", false);```
#

from wiki

grim ice
hazy igloo
grim ice
#

ok worked

vast sapphire
#

oh mb

#

you edited

eternal oxide
#

register them in your plugin.yml

vast sapphire
#

I see the issue

vale ember
#

how to enable second layer for fake player skin?

vast sapphire
#

I get Index 0 out of bounds for length 0

hazy igloo
vast sapphire
#

ok

hazy igloo
# vast sapphire ok

you should also do the commands in separate classes... and your isFloat and isInt method should be private and not public static

vast sapphire
#

I'm going to have a lot of commands

hazy igloo
vast sapphire
#

ok

#

i guess i can do that

hazy igloo
#

yeah thats cleaner and better practice

vast sapphire
hazy igloo
vast sapphire
#

ok

civic adder
#

So I've been having this issue with the following snippet of code:

TextComponent mainComponent = new TextComponent(String.format(event.getFormat(), player.getDisplayName(), ""));

Where player.getDisplayName doesn't show the correct hex colors, it only uses the last letter in the hex code (since I'm pretty sure it uses § instead of ChatColor, the display name is set by EssentialsX). Is there a way to convert hex colors using § into something that a TextComponent can properly use as color? Sorry if the question is weird, I can show an in game example of the issue if needed.

chrome beacon
#

TextComponents can use §

#

Altough it's deprecated since it's legacy text

civic adder
#

huh alright. well either way the issue I'm having is that my display name is showing up as this

#

instead of this

fallow dragon
#

on client + servre

civic adder
#

yeah I'm running the latest 1.17.1 jar

fallow dragon
#

Gotcha, try doing something like this

fallow dragon
# civic adder yeah I'm running the latest 1.17.1 jar
TextComponent component = new TextComponent("Test string");
component.setColor(ChatColor.of("#1565C0"));

player.spigot().sendMessage(component);

Source: https://www.spigotmc.org/threads/using-bungee-chatcolor-with-textcomponent.488979/#post-4082026

#
    @EventHandler
    public void onPlayerTeleport(PlayerTeleportEvent event){
        if(event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)){
            System.out.println("Nether");
            event.setCancelled(true);
        }
    }

Source https://www.spigotmc.org/threads/stand-in-a-portal-but-cancel-enter-it.282178/

#

then teleport elsewhere

civic adder
fallow dragon
#

Also

#

Why are you doing that within tempcomp and not maincomponent?

#

Oh i found your bug smack

#

It is the name being colored to begin with according to this thread

fluid cypress
#

Chunk#getChunkSnapshot() Capture thread-safe read-only snapshot of chunk data
that means i can call that method from another thread or that i can use that snapshot object in another thread?

civic adder
#

tempComp is used to convert each word in the message to a TextComponent to be added to mainComponent.

Also its colored however EssentialsX colors it, as it's a nickname from that plugin.

fallow dragon
fluid cypress
#

so, just use, not call the method?

#

what happens if i call that method from another thread

fallow dragon
fluid cypress
#

ok, good

fluid cypress
#

if i divide any coordinate by 16, ill get the chunk coordinates, right?

fallow dragon
#

mod 16 google is wrong? xD yes divide by 16

Source: https://minecraft.fandom.com/wiki/Chunk (see Finding chunk edges)

Minecraft Wiki

Visualization of the ground portion of a single chunk. The entire chunk extends up to a height of 256. A chunk is a 256-block (384-block‌[upcoming: JE 1.18]) tall 16×16 segment of a world. Chunks are the method used by the world generator to divide maps into manageable pieces.

median anvil
#

so with setdurability, the items go below 0 durability and never break

eternal oxide
#

bitshift

fallow dragon
#

not a stupid question

prime mountain
#

it doesn't make sense. The only other optinion is to just put it in another file

#

which, i might do

fallow dragon
#

Breaking your logic into methods is good practice, even if they only are called once

prime mountain
#

i was thinking about putting my latters into logic

#

but the only check i do consistently is is.online basically

#

i try to keep complex code out of the plugin area

fallow dragon
#

I'd do it as much as you feel necessary. following good naming conventions will make the code really easy to read and maintain

prime mountain
#

the only problem i have is i haven't commented as much as i would like to

#

but its all relatively simple

#

then i get functions like bettterwrritte(iterable<iterable<String>>, file)

#

with 3 t

fallow dragon
#

In many times,good named methods explain more than comments do. i like both.

What does betterwrite do?

prime mountain
#

it appends to the last line of a file

#
  //writes to last line
  val index: MutableList<String> = ArrayList()
  for (x in file.readLines()) {
    index.add(x)
  }
  for (x in string)
  index.add(x)
  write(index, file)}
fallow dragon
#

What needs to be appended?

prime mountain
#

i should just do file.readLines().toMutable().add(x)

fallow dragon
#

honestly a lot of programmers have different style. I'm not sure what language that is or what tools it has, but in Java, I would just name that method appendToFile.

prime mountain
#
  //writes to last line
  val readfile : MutableList<String> = file.readLines().toMutableList()
  for (x in string){
    readfile.add(x)
  }
  write(readfile, file)}
fluid cypress
#

what does Vector#toBlockVector do?

prime mountain
fluid cypress
#

just round its values?

prime mountain
#

for some reason i thought i could do a better
job than appendToFile

#

and i trust myself

#

it had something to with \n not working how i wanted it to and sometimes messing up

silver shuttle
#

whats the easiest library to have GUI's that dynamically adjust? (As in they change content data whilst you are looking into them)

prime mountain
#

probably one you program yourself

silver shuttle
#

I doubt that

prime mountain
#

its the most lightweight implementation and the one most suited to your needs, and you understand how it works

silver shuttle
#

I have never even worked with GUI's before

prime mountain
#

working in minecraft isn't like working in Qt5

prime mountain
fallow dragon
fallow dragon
ivory sleet
fallow dragon
# silver shuttle whats the easiest library to have GUI's that dynamically adjust? (As in they cha...

https://www.spigotmc.org/resources/smartinvs-advanced-inventory-api.42835/ is very easy to use and capable of dynamic adjusting through the update method and relatively compatible with 1.17 (tested on their v1.3.0), but I'm not sure of any up to date API's for inventories

https://www.spigotmc.org/resources/if-inventory-framework.57216/ haven't tried this one before but it looks pretty interesting, easy to use, and 1.17 tested*

native dragon
#

anyone got some good resources for getting started?

silver shuttle
unique halo
#

how do i make it so that the distance required for a fishing rod to unhook is shorter?

humble heath
hazy igloo
undone axleBOT
humble heath
#

i==1 works

#

i==2 the item apears even if the player dont have perms

#

and none apeAR WHEN OP

fallow dragon
hazy igloo
humble heath
#

yes

#

only glow apears when op and realy i dont want that i only want it to apear if they have perms op or not

#

all the others work like that but glow

native dragon
#

not sure what the difference is between java and spigot programming

fallow dragon
silver shuttle
fallow dragon
# native dragon plugin development for 1.17

Gotcha,

Java being the language, spigot being the API.

Here's the Javadocs: https://hub.spigotmc.org/javadocs/bukkit/
Here's a little getting-started on spigot: https://www.spigotmc.org/wiki/spigot-plugin-development/

silver shuttle
fallow dragon
silver shuttle
#
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
        //xvar = !xvar;
        SmartInventory INVENTORY = SmartInventory.builder()
                .id("customInventory")
                .provider(new InventoryProvider() {
                    @Override
                    public void init(Player player, InventoryContents inventoryContents) {

                    }

                    @Override
                    public void update(Player player, InventoryContents inventoryContents) {

                    }
                })
                .size(4, 9)
                .title(ChatColor.RED + "Unclosable inventory!")
                .closeable(false)
                .build();
        INVENTORY.open((Player)sender);
        return true;
    }
unique halo
#

how do i unhook a fishing rod from an entity?

fallow dragon
#

In your plugin.yml make the default false then by default nobody has the permission

fallow dragon
# unique halo how do i unhook a fishing rod from an entity?

I haven't tried this before but I THINK you could kill the fishing hook entity? So maybe listen for ProjectileHitEvent to get the fishing hook entity.

More info: https://www.spigotmc.org/threads/can-you-remove-the-players-fishing-rod.309918/

native dragon
#

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class AtlasCore extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("<!> AtlasHost has loaded <!>");

        getServer().getPluginManager().registerEvents(listener:this, plugin:this);
    }```
#

i seem to be missing something?

#

(listener:this, plugin:this); gets highlighted in red

echo basalt
#

Just

#

registerEvents(this, this)

native dragon
#

ah

#

thanks alot

barren granite
#

So I want to code this command where when a player runs a command, a book gui pops up to their screen, with text and other pages. They dont get a book though, a gui just opens after they run the command. How could I code this? I googled it, and couldn't find anything. Even looked on YouTube and couln't find anything.

ivory sleet
#

You need to give the player a book and quill and then open it for them

#

Yea ik it’s hacky but that’s how it’s done

barren granite
#

oh

echo basalt
#

I think that calling Player.openBook on the new versions does that natively

#

From what I remember reading spigot code

ivory sleet
#

Oo I’m outdated perhaps lol

native dragon
#

how do you include a variable in a string?

grim ice
#

?paste

undone axleBOT
final monolith
#

how to use sync methods in async events?

echo basalt
#

call a sync scheduler

quaint mantle
#

Hello, I think I found a bug with spigot 1.17

#
"max dura: " + item.getType().getMaxDurability()
#

This prints 0 for a diamond_sword

final monolith
echo basalt
#

I generally just call runTask but that works

hazy igloo
final monolith
chrome beacon
#

?scheduler

#

?scheduling

undone axleBOT
native dragon
#

is there a faster way of testing your plugin on a local server?

echo basalt
#

make the IDE compile it directly to the plugins folder

native dragon
#

dont i need to unload the plugin first?

echo basalt
#

then just restart the server

#

and test

#

If you're extra fancy, make it replace the plugin and automatically restart

native dragon
#

do you know how to do that?

echo basalt
#

I don't really test locally so just google it

native dragon
#

where can i set the compilers output?

echo basalt
#

IDE likely

unique halo
#

i need the entity to be alive

echo basalt
unique halo
#

oh yea that

#

yea i tried fishinghook.remove but it doesn't work

#

it doesn't unhook

#

the next time they rihgt licck they're fishing rod it messes up

grim ice
echo basalt
#

All I see is event.getBlock everywhere

#

and getPlayer

#

Start your listener with the following:

Player player = event.getPlayer();
Block block = event.getBlock();
Material blockType = block.getType();
World world = block.getWorld();
BlockState blockState = block.getState();

and work with those variables

#

You can also call
private final Random random = ThreadLocalRandom.current(); at the top of the class to simplify a bit

#

And name your variables properly

#

All I see is lazy copypaste

grim ice
#

wait what

#

wdym copy paste

echo basalt
#

read first and last line

grim ice
#

Yeah i did that on purpose

#

because my ide is stupid

echo basalt
#

why are you calling getInt twice for the same path?

grim ice
#

and gives me warnings

#

if i dont use that

echo basalt
#

just reuse the variable

grim ice
#

shit might be null warnings

#

ok whatever ok

echo basalt
#

Re-use all the variables

grim ice
#

Condition 'chance == 0' is always 'false'

echo basalt
#

That's because your random already cleared it

#

Also do the cheapest calls first

#

Like checking for entity types

grim ice
#

does that really make my code look better

echo basalt
#

It makes it perform better for literally free

#

But reusing variables does make your code look a lot better

#

Naming them correctly does too

grim ice
#

aha ok

echo basalt
#

Also IDK why your IDE isn't screaming at you

#

But when doing toLowerCase, toUpperCase, pass in a Locale

grim ice
#

Condition 'e.getPlayer().getInventory().getItemInMainHand() == null' is always 'false'

#

do i remove this

native dragon
#
    public void onPlayerChat(PlayerChatEvent e) {
        Player player = e.getPlayer();
        player.sendMessage("Hi");
    }``` am i doing this wrong?
echo basalt
#

Although it shouldn't do in most cases, it can give issues when translating weird text

#

Arabic symbols and things like that

echo basalt
#

Did you register the listener?

grim ice
#

زي كذا؟

#

ok

native dragon
#

by register do you mean this?

#

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;```
echo basalt
echo basalt
grim ice
#

do i remove this Condition 'e.getPlayer().getInventory().getItemInMainHand() == null' is always 'false'

echo basalt
#

Item might be null

#

Or it might be air

grim ice
#

ok

echo basalt
#

I believe it will be returned as air as it's tagged with @NotNull

hazy igloo
#

yes

grim ice
#

ok

raw coral
#

how do i gib my armorstand armors

#

*arms

grim ice
#

i wanna check if the config i set to 0

#

or wait

#

does that

#

if (!(ThreadLocalRandom.current().nextInt(100) < chance)) return;

#

right

#

ik i could use > but whatever

grim ice
#

?paste

undone axleBOT
elfin pilot
#

yo, i have some questions about LibsDisguises if anyone is familiar with the api

#

i asked these in the MythicCraft discord but it is a little less active than this server 😛

opal juniper
#

this?

elfin pilot
#

yep

#

I have taken a few looks at the source code as well as the wiki

elfin pilot
#

attempts were made

#

as well as DisguiseUtilities

opal juniper
#

😄

elfin pilot
#

i am going to copy-paste part of something I already wrote if that's alright

opal juniper
#

what are you trying to do

#

ok sure

#

?paste it

undone axleBOT
opal juniper
#

bit easier to read cause i’m on mobile haha

elfin pilot
#

no worries, it isn't actually code :P

#

Basically

#

I am trying to serialize a Disguise object

#

For now we can ignore the PlayerDisguise as i have another method which handles those

#

DisguiseUtilities includes a getGson() method which allows me to serialize the disguise, but deserializing using gson.fromJson(disg, Disguise.class) throws an exception

#

In essence... it serializes just fine, but deserialization is proving to be an issue

opal juniper
#

can you call the constructor?

elfin pilot
#

of the Disguise?

opal juniper
#

myeah

#

Takes a disguiseType

elfin pilot
#

hmmmmmm

#

there is a new Disguise() which is an anonymous inner type

#

if that's what you mean

#

apologies

#

i am still familiarizing

opal juniper
#

i’m not too sure - never used this plugin before

#

so don’t really know what to look for tbh

elfin pilot
#

ahhh understandable

native dragon
#

how do i install snakeyaml?

#

or just use yaml in general

unique halo
#

what is the event for when an egg breaks after hitting a wall

native dragon
#

im not using it as a config file though

#

im trying to use it to store data

eternal oxide
#

scroll down to the custom section

native dragon
#

thanks alot

quaint mantle
#

hey sorry to ask for code

#

im wondering how i can have like

#

logs for stuff in-game? obviously i store a ton of stuff in a log file

#

but im wondering how i can get something like...

(a player or somethinglike that types /logs)

and they get text like

#

-- Server Logs --
1.
2.
3.
4.
etc.

#

its just a loop... im just not sure the exact values of that loop

crude charm
#

for (everything in the config) {
print the config
}

but I recommend using a database if you're going to be storing ALOT of data
@quaint mantle

echo basalt
#

Might seem stupid but Block#getDrops is returning an empty collection

#

Is there any workaround or something?

prisma needle
#

This might be a bit over the top of my head, but I am trying to set the outer layer of a players skin to the outer layer of someone else's skin. Is that even remotely possible with spigot?

echo basalt
#

You'd have to make a custom skin, upload it to mineskin, get the data and whatever and send it to the player

#

lots of work

prisma needle
#

aha... but theoretically it could work?

echo basalt
#

with a ton of packet hackery yes

candid galleon
#

definitely possible

prisma needle
#

Alright... I'm willing to take on the challenge... but where would I even start to do that :P

echo basalt
#

Editing the skin

regal anchor
#

that's the goal not the start xd

echo basalt
#

Like

candid galleon
#

first learn how skins work in MC

echo basalt
#

getting the skin data and adding the overlay to the png

candid galleon
#

then learn how they're encoded in the data

#

then learn web API

echo basalt
#

then posting a http request to mineskin and getting the result

#

then sending the result

#

Skin data is just some fancy base64

prisma needle
#

aha I see... time to do lots of research :)

quaint mantle
#

sorry i guess i just didnt know how else to word it

#

i.e; /lookup somethinghereidk 8

#

and get the 8th page of logs

torn shuttle
#

I'm really not good with gradle/maven, how can I fix the class loading to resolve this?

java.lang.LinkageError: loader constraint violation: when resolving method 'javassist.d javassist.f.a(javassist.d)' the class loader 'EliteMobs.jar' @77a2c467 of the current class, com/magmaguy/elitemobs/EliteMobsL10, and the class loader 'LuckPerms-Bukkit-5.3.53.jar' @5f295a1c for the method's defining class, javassist/f, have different Class objects for the type javassist/d used in the signature (com.magmaguy.elitemobs.EliteMobsL10 is in unnamed module of loader 'EliteMobs.jar' @77a2c467, parent loader 'app'; javassist.f is in unnamed module of loader 'LuckPerms-Bukkit-5.3.53.jar' @5f295a1c, parent loader 'app')
 
#

is this something a relocation would fix? again, I absolutely suck at this side of things

silver shuttle
#

If I have a BukkitScheduler Task and set the delay between each execution to a variable, will it change the delay whenever the variable changes or will it stay the same?

regal anchor
#

I think java code is executed step by step

#

so when it will read for example runTaskLater(duration)

#

it will be the value of duration at the moment

silver shuttle
#

I mean if I change the 1L at the bottom to say a public integer variable, and then modify that variable with a command, will it change the delay or not?

#

Because I think it wont

eternal oxide
#

no, once you create the runnable its timer is set

silver shuttle
#

ok thank you

eternal oxide
#

you can change the timer for any new runnables

silver shuttle
#

so I just cancel it and start it again with the command

eternal oxide
#

why do you need to change the timer?

silver shuttle
#

to have a fast forward in the variance calculation

#

making a market plugin

sleek pond
#

Will the spigot api work on bukkit?

eternal oxide
#

what?

silver shuttle
#

just use paper or spigot

waxen plinth
#

Does anyone still make plugins just for bukkit

regal anchor
#

what minecraft version was last bukkit

quaint mantle
eternal oxide
#

1.7

regal anchor
#

is there a spigot 1.7 ?

hasty prawn
#

Pretty sure Bukkit supports 1.17

quaint mantle
silver shuttle
eternal oxide
#

Why do you want 1.7?

hasty prawn
quaint mantle
# silver shuttle yea

its not like you're declaring is a new instance or anything... its always getting the same scheduler...

regal anchor
eternal oxide
#

yes, that was when all teh Bukkit devs stopped work on Bukkit

hasty prawn
#

You can sort plugins by 1.17 on the Bukkit forums though 🤔

eternal oxide
#

yes, its an API that is now updated and maintained by Spigot

hasty prawn
#

Ah

eternal oxide
#

But Bukkit itself was stopped at 1.7

silver shuttle
#
    xsetval:
        usage: "xsetval.usage"
        not-enough-arguments: "xsetval.not-enough-arguments"
        too-many-arguments: "xsetval.too-many-arguments"
        must-be-integer: "xsetval.must-be-integer"
        too-high: "xsetval.too-high"
        invalid-item: "xsetval.invalid-item"
        does-not-exist: "xsetval.does-not-exist"
        successful: "xsetval.successful (Item: %item%, Value: %value%)" # %item%, %value%
    xsetvariance:
        usage: "xsetvariance.usage"
        not-enough-arguments: "xsetvariance.not-enough-arguments"
        too-many-arguments: "xsetvariance.too-many-arguments"
        must-be-double: "xsetvariance.must-be-double"
        not-zero: "xsetvariance.not-zero"
        too-high: "xsetvariance.too-high"
        invalid-item: "xsetvariance.invalid-item"
        does-not-exist: "xsetvariance.does-not-exist"
        successful: "xsetvariance.successful (Item: %item%, Variance: %variance%)" # %item%, %variance%
    xvartoggle:
        on: "xvartoggle.on"
        off: "xvartoggle.off"

sender.sendMessage(messages_prefix + config.getString("messages.xvartoggle.off").replace("&", "§"));
Why do I get a NullPointerException from this?

#

every other getString works fine except the xvartoggle category

quaint mantle
#

how to make the experience decrease every second?
for example: the full scale of experience and you need to remove the experience a little bit to 0

silver shuttle
eternal oxide
silver shuttle
eternal oxide
#

ok then your code is broken 🙂

quaint mantle
silver shuttle
#

but where .-.

eternal oxide
#

break it down and see exactly what is null

#

make sure prefix isn't null

silver shuttle
#

because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null
at me.konstanius.konstanius.commands.xvartoggle.onCommand(xvartoggle.java:23) ~[?:?]

#

prefix works fine in every other message

#

wait

#

ok now I look like a clown

eternal oxide
#

Then check teh actual file you are accessing is fully upto date and those entries are not missing

silver shuttle
#

it works after I changed the names

#

Thanks for the tip!

eternal oxide
#

np, I had a feeling they were

digital plinth
#

spigot > bukkit

#

ZeroDay, Astolfo, Moon, Azura, and Tenacity

#

apparently these clients

#

can bypass AAC

#

are the checks neutralized from the hax devs lookin at AAC source code?

quaint mantle
#

im just wondering how i can make pages of text.. something like

text here or something, and then:

  1. text here
  2. other text
  3. more text
  4. even more text
  5. etc.
unkempt ore
#

If I develop in 1.8 pure API, no NMS, will I remain forward compatible with later versions?

barren moon
#

Im using packet to spawn client side entity, but how can i get a free entityid?

#

if i spawn an entity with a id that already exist in the client, the existed entity will be removed, right?

unkempt ore
#

Or are you just intuitively not sure, because same here

#

Feels like there should be caveats

hazy igloo
ivory sleet
proud basin
#

How can you kill all armor stands?

prime mountain
#

can i steal this

#

or rather

#

should i steal this

ivory sleet
#

Steal LuckPerms?

somber hull
#

how am i getting a NPE on this line?

#

if(item.getType() == Material.AIR || item == null) continue;

prime mountain
#

no just lke

#

having ascii

#

on enable

regal anchor
ivory sleet
#

There’s a lot of plugins which prompt an ascii banner on enable

proud basin
#

... They didn't invent it

somber hull
#

lol

ivory sleet
#

Wouldn’t call it stealing

proud basin
#

^

prime mountain
#

im gonna make a big ole CB

#

whats that bash command for the ascii text

barren moon
hazy igloo
prime mountain
#

figlet

regal anchor
#

btw @ivory sleet I finally got what you said about my gitlab (CraftInventory may be the problem) and the CraftInventory you saw was actually a GUI and what's causing my problem is giving a list of items

ivory sleet
#

Yeah

barren moon
#

But because I want to generate dozens of random numbers, I feel that random numbers may still repeat

eternal oxide
#

random can alwasy repeat, thats random

barren moon
#

It may be better to record the existing ID of the client to the server

eternal oxide
#

if you want a never repeating and have a limit on teh amount of numbers you can simply ensure you only pick new numbers

#

ah entity id conflicts. Yeah good luck with that

silver shuttle
#

why does this not work?!?

ivory sleet
#

Isn’t there a synchronous id instance for that

#

Idk might be nms

#

But definitely exists one

#

See if you can trace some methods and it should be all good

barren moon
hazy igloo
silver shuttle
#

heres some context

hazy igloo
#

print out his level so you can see if his level is == 1

unkempt ore
#

What's the alternative to the PersistentDataContainer in versions before it was added

eternal oxide
#

nbt

ivory sleet
#

CustomTagContainer or smtng iirc

unkempt ore
#

Like the NBT API? It says that can only work with vanilla tags in entities

silver shuttle
unkempt ore
#

What would you do about that back then

#

Ah nvm it looks like that's changed

hazy igloo
silver shuttle
#

because they arent kicked

#

oh wait

#

was a config file error

hazy igloo
#

did u solve it?

silver shuttle
#

yes

#

thank you!