#help-development

1 messages · Page 1762 of 1

lean gull
#

it's not an event

humble heath
#

for my problem

lean gull
#

oh ok sorry, my bad

hybrid spoke
humble heath
#

i have sorted that

slim kernel
#

thank you I am gonna look at this

mellow edge
#

does minecraft use netty?

hybrid spoke
#

debugging might help

chrome beacon
#

You need to run createConfig

humble heath
#

i have fixed my issue

lean gull
chrome beacon
#

He's not

lean gull
paper viper
#

why is it so pixelated

chrome beacon
formal dome
#

so in the interface CommandExecutor the only method is on command

lean gull
paper viper
#

yea lol

chrome beacon
paper viper
#

anyways

lean gull
#

i just changed it to the minecraft font

formal dome
#

which of those parameters do you have to set yourself

paper viper
#

why

lean gull
#

it's supposed to be that way

#

i like the minecraft font lol

lean gull
chrome beacon
#

So you either need to set it again or use the same instance

lean gull
#

i'm not sure what you mean, i do not know how instances work

chrome beacon
#

?learnjava Time for this

undone axleBOT
lean gull
#

so can anybody help?

chrome beacon
#

I told you how to fix it

#

...

pastel stag
#

question for curiosity sake, if i make a plugin's database logging log someone's uuid and username on join, and a server is running in offline mode, and a cracked player joins the server, what happens? do cracked players have uuids assigned to them by the server or naw

lean gull
#

no you told me to learn java

#

which you should know by now is offensive to me and you should also know that i have my own way of learning

chrome beacon
#

Run it again

#

In TabManager

lean gull
#

wdym

formal dome
#

hey olivo, i'm trying to create a command

#

i'm implementing CommandExecutor as one of the interfaces of my plugin

#

the onCommand function has some parameters i'm confused about

#

can you offer any explanation?

#

i want the server hoster to be able to set some properties in the config file through the console

pastel stag
#

what are the params of the function you are confused about

chrome beacon
#

^

formal dome
#

onCommand​(CommandSender sender, Command command, String label, String[] args)

pastel stag
#

which

formal dome
#

so i don't know how to set CommandSender

#

i want it to be a command sent from the console only

pastel stag
#

CommandSender is the sender of the command, whether thats console or instance of a player

formal dome
#

server hoster should be the only one be able to set it

chrome beacon
#

Then check if it's an instance of ConsoleSender

pastel stag
#

^

#

if(sender instanceof ConsoleCommandSender){

formal dome
#

okay, so let me try to describe this.... is the sender passed in by the api ?

#

kinda like an event ?

pastel stag
#

yes

formal dome
#

okay cool thanks

pastel stag
#

CommandSender is passed in

tardy delta
#

Isn't Sender always instanxeof xonsolesender?

#

As player extends xonsolesender

formal dome
#

well there are some commands that can only be sent in the server console

#

so i wouldn't think so

pastel stag
#

@lean gull if you look up and gain an understanding of how instances work in java i think you will see what is wrong w/ your code

#

that's why @chrome beacon linked those links, not to insult you

tardy delta
#

Not instanxeof player

lean gull
#

a lot of people here know that i get insulted by the learn java command

lean gull
#

and you don't even need to know me to know that, that command is just insulting to most people

formal dome
#

i'll give you a brief explanation of what an instance is... an instance is just when you create an object of a class

last ledge
lean gull
#

craftinc i don't know what an object is yet

formal dome
#

can i dm you something

#

i want to help

lean gull
#

there are a lot of things i don't know in java but i like my way of learning

formal dome
#

i think it'll help you

lean gull
#

i'm guessing you want to send me a link to a resource about learning java or whatever?

formal dome
#

then you can come here for spigot stuff

lean gull
#

that's not that different from the learning java thing

pastel stag
#

@tardy delta i don't think so but i suppose if it works that way you could just if(sender instanceof Player)){ sender.sendMessage("This command can only be executed from console.") return false; }

lean gull
#

it's still rude

#

but thank you, you seem like you want to actually help me

formal dome
#

i don't mind it personally

last ledge
lean gull
#

i'm not really looking to learn the basics, that will just get me unmotivated

#

i want to learn the basics along the way

#

yes, it's in-efficient and will take longer but it has a lesser chance of me quitting java and getting fustrated

pastel stag
#

@last ledge i always like printing usage back when someone uses something wrong but i suppose it doesn't really help anything in this case so yeah might as well return true;

#

instances are kind of a difficult thing to like fully fully explain

#

in a text chat like here

formal dome
#

it will make it a lot easier

#

you don't have to go learn all the basics. that's too much as well

lean gull
#

i'll try googling it and i will probably come back immediatly with questions about it lol

formal dome
#

they won't want to answer here

pastel stag
#

@lean gull think of instances of classes as VM's if that makes sense to you, thats kinda what i did/do and it gives you the base idea

#

its a bad analogy but it works

lean gull
#

idk what or how the virtual machine is/works

pastel stag
#

ok very tldr here so for you hawks out there dont correct the small stuff

#

the base idea is

humble heath
#

i get this error evertime someone clicks in the game not in the gui

#

how can i fix this

hybrid spoke
#

it goed deeper and deeper

lean gull
#

please don't use metaphors, those just confuse me

last ledge
#

wait

formal dome
#

@lean gull dm if you want me to explain

hybrid spoke
#

until we get to earth and earth is the player f.e.

quaint mantle
humble heath
#

how can i fiz @last ledge

humble heath
#

ty

quaint mantle
#

can someone help me please

last ledge
#

ha bhai bolo

sharp bough
#

what did you try so far?

last ledge
#

waiting for someone to 🥣

worldly ingot
#

Don't use raw NBT. We have the PersistentDataContainer API now

#

1.14+

last ledge
#

ye

sharp bough
#

yo choco you got a girl in your pfp

worldly ingot
#

I do

quaint mantle
sharp bough
#

where did you download it

worldly ingot
quaint mantle
#

yeh ;-;

humble heath
worldly ingot
#

There are some APIs for that if you really want

quaint mantle
#

please

last ledge
undone axleBOT
last ledge
#

send ur code

visual tide
worldly ingot
#

Yep

#

Beat me to it

#

iirc that's the standard for NBT APIs if you're not using PDC

quaint mantle
hybrid spoke
quaint mantle
worldly ingot
#

Oh, are you writing a datapack?

#

Or do you mean PDC isn't accessible to root NBT?

humble heath
quaint mantle
#

just modifying one of its items

sharp bough
quaint mantle
#

plus idk how to do loot tables in spigot

worldly ingot
#

The purpose of PDC was to avoid polluting the root NBT of an item and hide everything under Bukkit's namespace. Ideally nothing on the root NBT should be added/edited by a plugin because we have ItemMeta for that

#

That's the reason you can't access any tag from there, only ones defined by plugins

last ledge
worldly ingot
#

(though obviously data packs have no concept of that)

last ledge
#

anyone can rename their chest to that title

#

and fool u

formal dome
#

OK, so. now i can ask my question

sharp bough
humble heath
#

so how would you do it

quaint mantle
#

api is nice and all, but how would i do it myself

sharp bough
visual tide
formal dome
#

ok here it goes: how do i create the custom Command to pass in to my commandExecutor function?

quaint mantle
#

i want to learn to make them myself

formal dome
#

onCommand​(CommandSender sender, Command command, String label, String[] args)

sharp bough
#

you mean how to create a basic command?

formal dome
sharp bough
#

watch a tutorial?

quaint mantle
visual tide
quaint mantle
#

and if you are using a class for a single command then you dont need to check if label is the command name

hybrid spoke
quaint mantle
sharp bough
#
quaint mantle
#

real help right here

hybrid spoke
#

go over the command

#

the label is for being very specific

quaint mantle
#

i know u can use command.getString() as well

worldly ingot
#

getName(), yes. The preferred way

quaint mantle
worldly ingot
#

The label is useful for command feedback and label-specific execution

quaint mantle
#

i just prefer to make individual classes for each command and define aliases

quaint mantle
hybrid spoke
#

the label is the alias which got executed

#

the alias of the command

worldly ingot
#

e.g. you have a command with aliases "foo", "bar", and "bazz". I write "/bar" but my command tells me "You wrote foo!". No I didn't. I wrote "bar" 😛

quaint mantle
#

btw, ik i can use apis to ease up my work too much but if i were going from scratch, how would i check if my stick that's hitting an entity has the nbt "stick:1b"

quaint mantle
#

i get it

#

now

#

same functionality

#

different messages

#

or may have other uses

#

right?

worldly ingot
#

Yeah definitely

formal dome
#

HAH

#

i'm happy i was doing it the right way lol

#

without looking at the tutorial first

quaint mantle
#

ye the thing is, even tho i gave myself the item with an nbt that i added, when i run it, it says that the nbttagcompound is null

worldly ingot
#

nms.ItemStack#getTag() will only return null if the item has no NBT at all

quaint mantle
#
@EventHandler
    public void OnBottleBreak(ProjectileLaunchEvent e) {
        Projectile projectile = e.getEntity();
        if (projectile.getShooter() instanceof Player) {
            Player p = (Player) projectile.getShooter();
            ItemStack item = p.getItemInUse();
            net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
            NBTTagCompound nbtTag = nmsItem.getTag();
            for (String string : nbtTag.getKeys()) {
                System.out.println(string);
            }
        }
    }

this gives that nbtTag object is null

quaint mantle
#

in java ofc

worldly ingot
#

Javadoc notation. Methods are referred to using #

quaint mantle
#

oh

worldly ingot
#

getItemInUse() is the item being consumed by the player (i.e. food, or a potion)

#

You probably want player.getInventory().getItemInMainHand()

quaint mantle
#

hmmmm

#

lemme try that

worldly ingot
#

(if you want to be really fancy you can account for multiple hands by doing a null/air check then grabbing the other hand)

#
ItemStack item = player.getInventory().getItemInMainHand()

// If there was no item in the main hand, get the item in the off hand
if (item == null) {
    item = player.getInventory().getItemInOffHand();
}

// There wasn't an item in the main or the off hand. Don't proceed
if (item == null) {
    return;
}```
quaint mantle
#

like sword swap maybe

maiden briar
#

I have no idea what is happening here

worldly ingot
#

It's called on launch so ye

quaint mantle
#

hmm

worldly ingot
quaint mantle
golden turret
#

when i try to drop a specific item of my plugin with the creative inventory open it dont drops

worldly ingot
maiden briar
worldly ingot
#

There's no way that that alone would cause that large of a performance hit

maiden briar
#

Wanna analyse the code?

worldly ingot
formal dome
#
    @Override
    public void onEnable() {

        this.getCommand("setDiscordIDs").setExecutor(this);
}```
#

is this valid

#

since my plugin is the one implementing the CommandExecutor

quaint mantle
#

no

#

setExecutor should be the name of the class where ur onCommand is

formal dome
#

ok

#

so my plugin class

quaint mantle
#

yeah

#

but

#

if u made it in main class

#

then yeah

#

this is correct

formal dome
#

this doesn't return an error but using the class where my onCommand is does

maiden briar
#

Then you are not implementing the code right

maiden briar
#

Show us the rest of the code

quaint mantle
#

yuh

formal dome
#
public class BroadcastReader extends JavaPlugin implements Listener, CommandExecutor
{

    public Socket clientSocket;
    public PrintWriter out;


    @Override
    public void onEnable() {

        this.getCommand("setDiscordIDs").setExecutor(this::onCommand);

        saveDefaultConfig();

        getConfig().addDefault("guild-id", 0);
        getConfig().addDefault("channel-id", 0);


        try {
            clientSocket = new Socket("ip", 8080);
            out = new PrintWriter(clientSocket.getOutputStream(), true);
        } catch (IOException e) {
            e.printStackTrace();
        }

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

    }


    @EventHandler
    public void onPlayerChatEvent (AsyncPlayerChatEvent event) throws IOException {
        out.println(event.getMessage());
    }

    @EventHandler
    public void onPlayerCommandPreprocessEvent (PlayerCommandPreprocessEvent event) throws IOException {
        out.println(event.getMessage());
    }

    @EventHandler
    public void onDisable (PluginDisableEvent event) throws IOException {
        clientSocket.close();
    }

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if(!(sender instanceof ConsoleCommandSender)) {
            ConsoleCommandSender console = (ConsoleCommandSender) sender;
            return true;
        }
        else
            return false;
    }
}```
quaint mantle
#

oh yeah this works

maiden briar
#

Create listeners and command classes

quaint mantle
#

LMFAO

maiden briar
#

This is really not OOP

quaint mantle
quaint mantle
quaint mantle
#

xDD

#

"this" will work since the onCommand is in the same class as "extends JavaPlugin"

maiden briar
#

this::onCommand is wrong

#

Just this

quaint mantle
#

yea

formal dome
#

it works lol

maiden briar
#

Yep and creating bigger projects

#

Not able to find mistakes

#

Rewriting code over and over

formal dome
#

;D didn't think so

#

unless u wanna come work for me

quaint mantle
#

@formal dome what is this plugin for

formal dome
quaint mantle
#

so i can yoink it with context hehe

formal dome
#

dam

quaint mantle
#

xD

formal dome
#

maybe i shouldn't say

maiden briar
#

@worldly ingot are you able to find the problem, or should I DM you the full plugin?

formal dome
#

you dno't have the backend still lol

quaint mantle
#

too late

quaint mantle
trail flume
#

What about the thing at the bottom? the rubies I mean

stone sinew
#

Almost anything can be added with textures

trail flume
#

Well that's obvious but which textures

stone sinew
#

Could be bubbles IDK

trail flume
#

and the number?

lean gull
trail flume
#

yeah that was a dumb question on my part tbh

trail flume
lean gull
#

i tried doing this in main:

    public ConfigManager getConfigManager() {
        return cfgm;
    }```and this in the tab manager class:
```java
    public TabManager() {
        cfgm = MangaTab.getConfigManager();
        cfgm.reloadTab();
        FileConfiguration tabConfigFile = cfgm.getTab();
        tabConfigFile.set("banana", "yes");
        cfgm.saveTab();
    }``` and this is what i got:
formal dome
#

what are the various options for command permissions?

#

in the plugin.yml?

#
commands:
  setDiscordIDs:
    description: Sets your desired Guild and Channel for interaction
    usage: /<command>
    permission: BroadcastReader.
#

the example from spigot

# Replace "kit" with the name of your command.
commands:
   kit:
      description: Your description
      usage: /<command>
      permission: yourplugin.yourcommandpermission ```
lean gull
hybrid spoke
#

thats not a singleton

lean gull
#

now it sends me an error and says that the plugin is already initialized

hybrid spoke
#

what do you have right now?

#

i would need some code to overview it

lean gull
hybrid spoke
#

seems like someone cant take a joke

hasty prawn
#

You're getting that error above because you're trying to access a non-static method from static context

lean gull
#

ok i fixed it

#

it works now

plush crescent
#

Sorry for the late reply.
I would like to try again with a delay, but I don't know how. Can you please tell me how to do it?

lean gull
#

what's the best way to put comments, keys and values, and sections in a yml file and also later making it so it sends you an error if you did something wrong like deleting a key or something

undone axleBOT
covert remnant
#

Hello, I'm currently trying to change the amount of items certain recipes give, but and just set up custom crafting recipes, hoping they'd override the vanilla ones, but that didn't seem to work. Does anyone know of a method I could use.

(Notes: I am new to Java; This is for Spigot 1.17.1; I have tried google, but I didn't find anything (although that might just be me not using the right keywords))

glossy venture
#

what is the code?

#

or didnt you attempt it yet

#

otherwise try that

covert remnant
#

I have attempted updating the amount by creating custom recipes with the same crafting table input, hoping it'd just override the vanilla recipes.

glossy venture
#

did you set the amount on the item stack

#

the result

covert remnant
#
public class ___ {
    public void ___() {
        ItemStack result = new ItemStack(Material.ACACIA_STAIRS,8);
        NamespacedKey key = new NamespacedKey((Plugin) this, "___");
        ShapedRecipe recipe = new ShapedRecipe(key, result);
        
        recipe.shape(
            "X  ",
            "XX ",
            "XXX"
        );
        recipe.setIngredient('X', Material.___);
        
        Bukkit.addRecipe(recipe);
    }
glossy venture
#

so the first in the list gets recognized first

#

minecraft recipes are first so you will have to either put yours before it

#

or remove the other one

covert remnant
#

How do I remove a recipe though?

glossy venture
#

no clue

covert remnant
#

Me neither, and I've tried googling. :/

glossy venture
#

maybe using Bukkit.getRecipe()

#

to get the vanilla recipe

#

and edit it?

#

what item craft are you trying to overwrite

#

ohk acacia stairs

#

try ```java
((ShapedRecipe)Bukkit.getRecipe(new NamespacedKey("minecraft", "acacia_stairs"))).getResult().setAmount(amount)

#

idk if it will work

#
/* get recipe and cast to shaped crafting recipe */
ShapedRecipe recipe = (ShapedRecipe) Bukkit.getRecipe(
  new NamespacedKey("minecraft", "acacia_stairs") // key, same as "minecraft:acacia_stairs" in text
);

/* set amount of result */
recipe.getResult().setAmount(amount);
covert remnant
#

Imma test it out now.

#
public void ___() {
  String item = "";
  Bukkit.getRecipe(new NamespacedKey("minecraft", item)).getResult().setAmount(_);
}
young knoll
#

Bukkit.removeRecipe

tardy delta
#
obj.___();```
-_-
young knoll
#

Is that a valid method name

tardy delta
#

cringe

#

imagine coding in that way

covert remnant
#

Lol, I put that as a placeholder.

covert remnant
#

I usually store stuff like that in an external file so I can store it for possible future projects. All I have to do is copy/paste, and replace the underscores.

tardy delta
#

wew

covert remnant
tardy delta
#

it compiles so i guess i doesnt

pastel mauve
#

How can I create a custom World, for example a plot world

tardy delta
#

if i type a command and hit space is args[0] == " "?

#

or doesnt args[0] exist?

pastel mauve
#

args[0] doesnt exist

#

just check for args.length

tardy delta
#

ah

#

ah true

lean gull
tardy delta
#

it depends on how you saved those keys and values earlier

gray crypt
#

Is there any event for when a player enters an end gateway?

tardy delta
#

you mean to enter the end?

#

or to leave?

elfin talon
#
 if (command.getName().equalsIgnoreCase("stats")) {
            Inventory inv = Bukkit.createInventory(null, 9, "§aChosse a player");

            for (Player players : Bukkit.getOnlinePlayers()) {
                    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
                    ItemMeta meta = skull.getItemMeta();
                    meta.setDisplayName("§e§l" + players.getName());
                    skull.setItemMeta(meta);
                    inv.addItem(skull);
            }
            p.openInventory(inv);
        }```

How can i change the texture of the skullitem
young knoll
#

Does it fire PlayerEnterPortalEvent

lean gull
covert remnant
#

Can I post a Gyazo link here?

gray crypt
#

@tardy delta the specific end gateway block, not the portal block

tardy delta
gray crypt
tardy delta
#

if you save data in a specific way which makes it difficult for your code to use in some scenarios..

#

just depends on the context

formal dome
#

what are the various options for command permissions?

commands:
  setDiscordIDs:
    description: Sets your desired Guild and Channel for interaction
    usage: /<command>
    permission: BroadcastReader.

the example from spigot

# Replace "kit" with the name of your command.
commands:
   kit:
      description: Your description
      usage: /<command>
      permission: yourplugin.yourcommandpermission 
lean gull
#

currently i just have a simple <config manager>.set thingie, it's not used for anything and it's just for testing

tardy delta
#

show me that class

covert remnant
#
public void ___() {
  String item = "_";
  Bukkit.getRecipe(new NamespacedKey ("minecraft", item)).getResult().setAmount(8);
}

The constructor NamespacedKey(String, String) is deprecated
Can I ignore this warning?

#

XD

tardy delta
#

no

covert remnant
#

Yeah, I thought so

tardy delta
#

doesnt "namespace:key" works as only parameter?

#

so only one string?

#

not sure

#

ah nvm you need to provide your plugin

hasty prawn
#

It wants your Plugin instance

covert remnant
#
Bukkit.getRecipe(new NamespacedKey ((Plugin) this, item)).getResult().setAmount(8);
``` Certainly works.
lean gull
tardy delta
lean gull
#

btw what i'm trying to achieve here is a tab plugin that has a footer and a header, each of them has 5 lines

tardy delta
#

what is the purpose of a TabManager instance?

#

also a constructor is the way to do it

public void getPluginConfig(MangaTab plugin) {
        this.plugin = plugin;
    }
lean gull
#

and all of that is stored by something like this:

# each line is stored from line 1 to line 5, top to bottom
header:
  line1:
  line2: aa
  line3:
  (etc etc)```
#

so a comment, a section, and 5 keys and their values

#

and if the value is not set then it will not count it as a line

tardy delta
#

and what exactly are you trying to achieve?

tardy delta
#

so just saving a header & footer into the config file?

lean gull
#

wdym

#

the header and footer of all players' tab would be what you set there, and if a value is empty then it won't be counted as anything

tardy delta
#

you're saying your plugin has a footer and a header so probably you're going to save them somewhere

hasty prawn
#

So what is the issue, Derpy?

lean gull
tardy delta
#

why not just using the FileConfiguration class?

#

to get values from config

#

like plugin.getConfig() -> return the config.yml fileconfig

#

and just set your things there?

covert remnant
# tardy delta

Are you saying I have to call "Bukkit.getRecipe(public NamespaceKey(@NotNull Plugin plugin, @NotNull String key))" then, cuz I'm pretty sure that 'aint gonna work. I'm trying to edit an existing recipe, and need the "minecraft" namespace keys, not my plugins'.

tardy delta
#

just a Plugin and a String as parameter

#

btw the minecraft namespace isnt tht just ```java
var key = NameSpacedKey.minecraft("stone");

#

stupid me

#

i think its just

covert remnant
#

Finally, thank you. No errors

tardy delta
#

i have to read questions better...

pastel mauve
#

How can I create a custom World, for example a plot world?

gritty urchin
#

Can I use Java 16/17 SDK for compiling pre-1.17 plugins? Will there be any issues?

hasty prawn
#

Pretty sure it won't work

gritty urchin
#

Even if I use it to run the server jar?

hasty prawn
#

I mean you can certainly try it, I've just not really seen Java 16/17 work well with Minecraft versions that aren't 1.17

tardy delta
#

when was (... instanceof Clazz clazz) introduced?

#

java 11?

elfin talon
#
 if (command.getName().equalsIgnoreCase("stats")) {
            Inventory inv = Bukkit.createInventory(null, 9, "§aChosse a player");

            for (Player players : Bukkit.getOnlinePlayers()) {
                    ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
                    ItemMeta meta = skull.getItemMeta();
                    meta.setDisplayName("§e§l" + players.getName());
                    skull.setItemMeta(meta);
                    inv.addItem(skull);
            }
            p.openInventory(inv);
        }```

How can i change the texture of the skullitem to the texture of the player
tardy delta
#

googled it?

patent horizon
#

and then theres a method to do setSkullOwner()

tardy delta
#

isnt & 0b1111 the same as >> 4?

pastel mauve
#

How can I create a custom World, for example a plot world?

crimson terrace
#

getServer().createWorld() that is

wide coyote
#

14*

golden turret
quaint mantle
# wide coyote 14*

in 14, it was only a preview feature
Preview features are disabled by default. To enable them, we must use the enable-preview argument, which enables all preview features at once.
tho

wide coyote
#

ah

#

didnt know that

#

thanks

glossy venture
#

java 17 is alr out

#

crazy

#

well i think it might be preview

#

idkfs

mortal hare
#

ah yes

#

my minecraft client eats 12gb of ram

#

more than RUST LOL

glossy venture
#

lmfao

#

what are you running bro

mortal hare
#

it rains in snow golems

#

idk what's wrong

#

probably sodium has a memory leak

#

or other optimization mod

glossy venture
#

like 15k mods with an internal server

#

oh shit

#

memory leak not good

pastel mauve
glossy venture
#

you will have to make a custom block populator

#

i think its called

#

gets run when the chunks are generated

mortal hare
#

i cant close my mine craft client

glossy venture
#

then just set the world type to flat

glossy venture
mortal hare
#

ah yes

glossy venture
#

do you have linux equivalent of taskkill

mortal hare
#

love it

glossy venture
#
taskkill /f /im javaw.exe
mortal hare
#

i'll try xkill

glossy venture
#

oh ye

mortal hare
#

im on linux

glossy venture
#

i know

#

but thats how you'd do it on win

pastel mauve
glossy venture
#

wdym by with a command?

#

you mean when they run a command they create a new world

#

?

pastel mauve
#

I would like to create the would with a command. The tutorials always use the bukkit.yml the create it or something old like multiworld

eternal oxide
#

Sounds like you are looking to configure your server not write a plugin

mortal hare
pastel mauve
#

not at all lol

mortal hare
#

guys be careful with sodium

#

memory leak exists in sodium

glossy venture
#

hes writing a plugin

mortal hare
#

its still not fixed

glossy venture
#

sad

mortal hare
#

its going to be fixed in sodium 0.3.3 it seems

lavish hemlock
#

Sodium still better than OptiFine imo

#

but yeah a memory leak sucks

karmic mural
#

just have 128gb ram allocated ezpz

#

Very cheap solution

#

buy 128gb ddr5

quaint mantle
opal juniper
#

means ya fucked sommin up

karmic mural
#

What exactly are you doing with chunkgen?

mortal hare
#

idk guys but vanilla minecraft runs better than running sodium or optifine

#

i'm getting 300 fps

#

on vanilla

#

while on sodium i get 200-250

opal juniper
#

🆒

karmic mural
#

I get lower FPS on Optifine but that's because I opt for higher quality

#

I do get more consistent FPS with Optifine vs Vanilla, though. So regardless the fps drop is weighed up for by better graphics and smoother framerate

#

But this is more #general isn't it?

mortal hare
#

Mojang really polished their graphical engine for caves and cliffs update

#

to get more fps

wary harness
#

hey is it possible to rename palyer crafting menu

mortal hare
#

no

karmic mural
wary harness
#

is Crafting even string
?

karmic mural
#

No, it's literally in the textures

mortal hare
#

iirc its a textrue

wary harness
#

oh

#

ok

karmic mural
#

Get a resource pack with what you want it to say, then force that as a server pack

wary harness
#

where can download default resurcepack

opal juniper
#

its in the game files iirc

#

just open the jar

young knoll
#

mcasset.cloud

#

Something like that

wary harness
#

thanks

karmic mural
# wary harness where can download default resurcepack

WHERE IS PACK.MCMETA? The pack.mcmeta isn't in the 1.17.jar file. Here's what to do instead! Create a file called "pack.mcmeta" and open it in notepad (or any text editor.) Copy/paste the following text, and save it!
{
"pack": {
"pack_format": 7,
"description": "Default 1.17 Resource Pack"
}
}

Learn how to make a resource pack in Mi...

▶ Play video
wary harness
#

thanks 🙂

mortal hare
#

i cant believe my minecraft in vanilla runs better than with optimization mods

#

well i do use starlight

#

and krypton with phosphor

karmic mural
quaint mantle
rough jay
#

What's the best way to make an area system where you can create areas and customize their permissions and add/modify owner and co-owner?

#

By replacing Group with a new name and UUID with the name of the area, would it work?

formal dome
#

what are the various command permissions you can use in your plugin.yml?

commands:
  setDiscordIDs:
    description: Sets your desired Guild and Channel for interaction
    usage: /<command>
    permission: BroadcastReader.

the example from spigot

# Replace "kit" with the name of your command.
commands:
   kit:
      description: Your description
      usage: /<command>
      permission: yourplugin.yourcommandpermission ```
#

is there like op only?

#

console only?

rotund pond
#

?paste

undone axleBOT
opal juniper
#

default is op/notop

#

but u can use any perm

formal dome
#

ok default is fine

left swift
#

is it possible to check from the client if entity is actually server side or packets?

quaint mantle
#

check if entity with given entity id exists on server

formal dome
#

wait i thought saveDefaultConfig() generated a config for you

#

why am i getting this error

#
The embedded resource 'config.yml' cannot be found in plugins/LogReader-1.0.0-all.jar
opal juniper
#

have you added defaults

#

getConfig().addDefault()

#

Have you registered it

formal dome
# opal juniper getConfig().addDefault()
    @Override
    public void onEnable() {
        this.saveDefaultConfig();
        this.getCommand("setDiscordIDs").setExecutor(this);
        getConfig().addDefault("guild-id", 0);
        getConfig().addDefault("channel-id", 0);
        saveConfig();
}```
opal juniper
#

after it

#

add then save

formal dome
#

oh okay lol

formal dome
glossy venture
#

?paste

undone axleBOT
opal juniper
formal dome
#

also why is my plugin considered legacy?

eternal night
#

if your plugin does not define an up-to-date api-version it will be considered legacy

eternal night
#

in your plugin.yml

#

api-version: '1.17'

formal dome
#

okayy

#

thx

subtle folio
#

is there a way to make a player transparent?

#

like you can still kind of see them

#

but they are see through?

final star
#

Hey guys, someone already made a rich presence in the minecraft plugin and could you help me? and because I need a server, but mine keeps giving an error

glossy venture
#

as its not about plugin development then

final star
#

I'm developing, and I wanted help

ivory sleet
#

What are you developing?

round gale
#

hello everyone, I want to make a plugin, that broadcasts over 2 (or more) servers. Here's the example out of the Thread on SpigotMC:

I want to for example send a broadcast message from one server to another.
So something like:
server1 executes /winner foobarbaz, sends a message to server2, says "hey, please broadcast, that foobarbaz has won!"

arctic moth
#

anyone know a good tutorial or so on the basics of creating a generation plugin

rough jay
#

Would PlayerChangedWorldEvent be a good event to check coordinates of a player to see if he enters a custom region?

mortal hare
#

Is it me or the PlayerChangedWorldEvent makes the the previously stored player object stale

#

i get two different world names

quaint mantle
#

hm?

mortal hare
#

I've checked the world name in the event.getPlayer().getWorld() and previously stored player object in hashmap and it turns out after PlayerChangedWorldEvent, player object gets stale, since world names do no match. Hashmap stored value retrieves the old world name while the event.getPlayer() player object retrieves new world name

#

nice

#

I wasted 7 hours

#

debugging this

#

thinking it was my fault in my algorithm

#

i thought Player object are stale only when player disconnects

#

or rejoins

#

turns out even world change can make it stale

#

since player object changes, whenever world changes in NMS

quaint mantle
#

Thats why you really shoudnt use player references

mortal hare
#

yea im gonna use UUIDS

#

those are persistent

quaint mantle
#

Players are entites, and they are bound to the world

mortal hare
#

i thought i was going to save some cpu power by not using getters to get the uuid everytime

#

since im utilising intensive events

#

like playermoveevent

#

and entitymoveevent

sullen marlin
#

no that's wrong

#

player objects do only go stale after a disconnect

#

what version of spigot are you running, post /version

mortal hare
#

then why world objects stored in player are different wtf

quaint mantle
#

ah

mortal hare
#

PlayerChangedEvent Player reference:

[23:08:03 INFO]: [DEBUG]: Player's current world name: world

Stored Player reference in hashmap:

[23:08:03 INFO]: [DEBUG]: Player's world: flat
#

all i did

#

is changed dimensions

#

via multiverse-core

formal dome
#

Why arent my config functions working

#
this.getCommand("setDiscordIDs").setExecutor(this);
        this.getConfig().addDefault("guild-id", 0);
        this.getConfig().addDefault("channel-id", 0);
        this.saveDefaultConfig();```
sullen marlin
#

saveDefaultConfig copies the config from your jar

mortal hare
#

im running airplane

sullen marlin
#

if you are using addDefault you want regular saveConfig

#

@mortal hare so not spigot and almost probably a bug they've introduced

mortal hare
#

This server is running Airplane version git-Airplane-99 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT) (Git: e68f5c2 on HEAD)

#

lemme try changing server software

sullen marlin
#

not helpful to moan here about it

mortal hare
#

im not moaning im just thinking what's wrong

sullen marlin
#

in the spigot server

quaint mantle
#

(try on paper)

sullen marlin
#

....

mortal hare
#

👀

young knoll
#

Try bukkit

mortal hare
#

How to trigger md_5 101

arctic moth
#

what do i use instead of material.getid()

#

cuz its deprecated

young knoll
#

Probably getKey

quaint mantle
#

Dont use numeric ids at all

young knoll
#

Numbers are evil

formal dome
#

why is my config.yml still blank 😦

#
    @Override
    public void onEnable() {
        getCommand("setDiscordIDs").setExecutor(this);
        getConfig().addDefault("guild-id", 0);
        getConfig().addDefault("channel-id", 0);
        saveConfig();
     }```
sullen marlin
#

getConfig().options().copyDefaults(true) before saving

rough jay
formal dome
arctic moth
#

how do you check if the server has a world by name

paper viper
#

Bukkit.getWorld

#

and check if null

rough jay
#

and then check if it's null or not

#

if not null then the world exists

paper viper
#

🤓

eternal night
#

obviously implies that that world is loaded

#

the server may still have a world with that name as a folder

paper viper
#

Yeah

mortal hare
#

yay

#

i found my problem

#

but at the cost of 7 hours

#

😐

rough jay
mortal hare
young knoll
#

Add ItemFlag.HIDE_ENCHANTS to the meta

mortal hare
#

your Area API

rough jay
#

it's... not an API? and what about "refactoring" it? what do u mean?

#

and what I did is not done yet don't worry, I just wanted to make sure I'm not doing shitty work before doing more

paper viper
#

public static final HashMap<String, Area> areaMap = new HashMap<>();

#

dont do this

mortal hare
#

I mean when the Area framework will grow, you will refactor the classes sooner or later

rough jay
paper viper
#

static

mortal hare
#

he meant static

#

store it in the instance instead

#

without static

paper viper
#

The point of managers is to hold this stuff inside the actual instance not like to be static

#

there is only supposed to be 1 manager

#

so put your map in there

#

instead of using static

mortal hare
#

I name my managers registry's but im not sure if that's the proper name for them

#

all of my managers do is register deregister things

paper viper
#

that might be confusing tho

#

cause you know

#

block registries

rough jay
#

but I separate my managers to avoid having a 2k lines file

paper viper
#

and stuff

paper viper
rough jay
#

you said there is only 1 Manager

mortal hare
#

but its a registry. It registers stuff

#

idk

paper viper
paper viper
#

if there is only 1 manager

#

no need to make it static

#

just put the map inside your actual manager class

rough jay
#

uh I'm not sure to understand what you're saying

#

if there is only 1 manager
I don't have 1 manager but 2

paper viper
#

1 manager instance

#

What you are currently doing is trying to store your map like a singleton. Singletons are something which is only defined once. However, your AreaManager class is a Manager class already, meaning there should only be 1 instance of AreaManager in your plugin. Therefore, you don't have to turn your Map into a singleton and you should remove the static.

rough jay
#

but my map is already inside AreaManager so it's inside the class

#

I know there is only 1 instance of AreaManager, it is defined in MaxiCity.java

paper viper
#

Just 👏 remove 👏 the 👏 static

#

thats all we're asking

#

lol

rough jay
#

just put the map inside your actual manager class
do I remove the static or do I put the map inside my manager class???

mortal hare
#

java oop experts be like

rough jay
#

ok

#
public final HashMap<String, Area> areaMap = new HashMap<>();

done

paper viper
#

without static

#

no need to make it static

#

should remove the static.

#

remove the static

#

🥲

young knoll
#

public maps?

paper viper
#

And encapsulate it

rough jay
# paper viper > without static

he said just put the map inside your actual manager class
he lost me because my map is already in my manager's class that's why

#

anyways, everything's good now

arctic moth
#

how do i use one of the custom things, like Environment.CUSTOM and stuff

#

like a custom environment for a dimension

#

there isnt like anything on it

#

just says represents a custom dimensino

#

also why am i the only one to have talked in 30 mins this is usually active lol

lean gull
#

hey everyone, i have a question regarding yaml files: what is it the best way to set comments, sections, keys and values in a yaml file? and also i want it so if like a section or key or value is not how it is supposed to be, as in someone messed with it, it will send an error to console. i also want to make it so you can do a command in game to reload it to see if there are any problems with it but instead send the errors to the player

pastel stag
#

sigh

ornate heart
#

I know how to copy a resource file from my jar file and put it onto the server. How would I copy a resource folder though?

arctic moth
#

(srry)

#

Making Custom World Environment

mortal hare
#

i dont fucking get it

#

in one world

#

packet entity

#

always spawns

#

but in another

#

it just doesnt

#

no matter what i do

arctic moth
#

lol

#

i wanna make like nether mob gens, end sky, etc tho

mortal hare
#

its not as if its not sending packets

#

it does

#

the client just doesnt render

#

for some fucking reason

#

but in another world

#

it does

#

i've debugged all the if statements

#

that could cause packets not to be sent

#

nothing

#

i tried adding tick delay

#

via scheduler

#

it adds after one second

#

in the flat world

#

while in another dimension it doesnt

#

im so pissed

ivory sleet
#

You know editing messages is a thing 😄

unkempt peak
#

Are you sending the packet to each world?

mortal hare
#

wdym by each world. im using player's connection to send the packet

#

via spawn entity living packet

unkempt peak
#

Yes are you spawning said entity in each world?

mortal hare
#

im sending destroy packet at the worldchangeevent and then resend the spawn entity living packet

#

spawn entity living doesn't have a field for dimension UUID

unkempt peak
#

Ok and it's spawning it in the wrong world?

mortal hare
#

im not sure

unkempt peak
#

What world are you trying to spawn it in?

mortal hare
#

but it doesnt spawn in the right world

#

at the right time

#

survival

#

none of the dimensions do not work

#

apart from one

unkempt peak
#

And your trying to spawn it if somone joins the survival world?

mortal hare
#

as i said im spawning an entity whenever PlayerWorldChangeEvent hits

unkempt peak
#

that event has 2 locations it has a from and a to which one are you trying to spawn it at?

mortal hare
#

it doesnt matter

#

i dont use these getters

#

since protocol of packet doesnt require it

unkempt peak
#

Where are you getting the location from then?

mortal hare
#

wait

#

maybe its spawning

#

but at the wrong location

#

lemme try

unkempt peak
#

Sorry I gtg I'll be back in about 30m dm me if you still need help

mortal hare
#

thank you

#

it was the location issue

#

finally my lovely cod fish spawns

#

how did i not thought about this before.. I'm so tired that my brain is feeling like the phone on powersaver mode

patent horizon
#

oh hi dovidas

#

thats exactly my question

#

i saw a yt video that explains how to find out what the params were for the nms code (this.a, this.b, this.c, etc.) but the letters arent on the wiki for spawn entity

livid moon
#

There was a server where you could design level and publish it for other to play (super mario maker) and I was trying to find if there is a plugin for that?

livid moon
arctic moth
#

anyone know why this is freezing the server during loading/making it take forever to load the world?

if(Bukkit.getWorld("doomdimension").getBiome(x, currentheight, z) == Biome.SOUL_SAND_VALLEY)
young knoll
#

Where are you running this

arctic moth
#

in generateChunkData function

young knoll
#

Yeah you can't get get the world during generation like that

arctic moth
#

o

#

how would i get the biome then

young knoll
#

ChunkData has a getBiome

arctic moth
#

im using a SimplexOctaveGenerator

#

ok

arctic moth
patent horizon
arctic moth
#

the thing isnt showing up in intellij

patent horizon
#

intellij isnt a lifeline

#

docs are

arctic moth
#

lol

#

@young knoll

unkempt peak
young knoll
#

What version are you on

hasty prawn
#

Man this guy says 30 minutes and he means it

arctic moth
young knoll
#

Minecraft version

arctic moth
#

o

#

1.17

patent horizon
young knoll
#

Well these are the latest docs, so ¯_(ツ)_/¯

arctic moth
#

lol

young knoll
#

Make sure spigot is up to date

arctic moth
#

ye maybe my api is outdated

unkempt peak
patent horizon
#

i wanna spawn an entity, similar to what hes doing

#

im not sure how many of the params in the wiki page i need to include when calling the method though

unkempt peak
#

What do you want to spawn?

arctic moth
patent horizon
#

just something basic rn to get used to packets

arctic moth
#

lol

#

downloads updated one

#

reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

unkempt peak
runic mesa
#

How do i create an enchantment

#

I want to combine a few

runic mesa
#

Thank you

hasty prawn
arctic moth
#

oh

#

nvm

#

now createChunkData() is deprecated

young knoll
#

Correct

#

See the JavaDocs

arctic moth
#

it says its directly provided what do they mean by that

#

like how do i get the chunk data then

#

oh\

#

nvm

#

its split up now

#

thats annoying

patent horizon
#

im doing packet entities

#
    @EventHandler
    public void onSomething(PlayerInteractEntityEvent event) {
        EntityPlayer player = (EntityPlayer) event.getPlayer();
        PlayerConnection playerConnection = player.b;
        PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();

    }```
unkempt peak
#

In that case you should be able to create an EntityChicken and pass it into PacketPlayOutSpawnEntityLiving

patent horizon
#

do i specify location and such when creating the entity chicken or in the method?

#
//'EntityChicken(net.minecraft.world.entity.EntityTypes<? extends net.minecraft.world.entity.animal.EntityChicken>, net.minecraft.world.level.World)' in 'net.minecraft.world.entity.animal.EntityChicken' cannot be applied to '(net.minecraft.server.level.WorldServer)'
public class PacketsAHH extends EntityChicken  {

    public PacketsAHH(Location loc) {
        super(((CraftWorld) loc.getWorld()).getHandle());
        this.setPosition(loc.getX(), loc.getY(), loc.getZ());
    }

}
#

whats up with this

lean gull
formal dome
#

how do you change the value of a default in the config.yml

#

so i've added it already, now i want to change it

#
@Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if(sender instanceof ConsoleCommandSender) {

            config.addDefault("guild-id", args[0]);
            config.addDefault("channel-id", args[1]);
            getConfig().options().copyDefaults(true);
            saveConfig();
  
            return true;
        }```
#

so im' trying to figure out why it doesn't change everytime i run the command

#

i set some values the first time and it worked... now everytime i run the command it defaults to those values

#

i guess that's why it's called default eh

#

AH i figured it out

#

theres an inherited method in FileConfiguration from ConfigurationSection called set 🙂

#

that does the trick

young knoll
#

Yes

#

I never use defaults honestly, I don’t even know what they do

hasty prawn
#

Probably just set it to that value if it's null maybe? When you use saveDefaultConfig? Thonk

#

🤷‍♂️

waxen plinth
#

Man

#

People really be out here writing commands like this

#

@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args

#

Like jeez

#

And all that for just a few lines of logic

next stratus
waxen plinth
#

Well at the very least you don't need the @NotNull annotations because it's not an API method or anything

lavish hemlock
#

IDEA screams at you if you don't use them lol

waxen plinth
#

I just ignore it

#

Fuck you intellij I can figure out null safety for myself

lavish hemlock
#

I haven't had a null pointer exception in my own codebases in like

#

months

#

but I still use constructs to avoid null errors

#

e.g. Optional, NotNull, Nullable, you get it

next stratus
#

I know a easy fix for this btw

#

You can use redlib by redempt 😏

waxen plinth
#

I swear I don't pay him to do this

#

Nor instruct him to

hasty prawn
#

🧢

quaint mantle
#

can someone help me, im using this code:

@EventHandler
    public void onBottleBreak(ExpBottleEvent e) {
        Projectile projectile = e.getEntity();
        if (projectile.getShooter() instanceof Player) {
            Player p = (Player) projectile.getShooter();
            ItemStack item = p.getInventory().getItemInMainHand();
            net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
            NBTTagCompound nbtTag = nmsItem.getTag();
            if (nbtTag.hasKey("bottleType")) {
                if (nbtTag.toString().equalsIgnoreCase("grand")) {
                    System.out.println("bottleType:grand");
                }
            }
        }
    }

with this command:

/give @p experience_bottle{display:{Name:'{"text":"Grand Experience Bottle","color":"blue","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}'}, bottleType:grand} 1

to give me an experience bottle with nbt tag bottleType:grand
but for some reason it says that the nbt is null, please help
error:

#
Could not pass event ExpBottleEvent to XpBottleUpgrade v1.0
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[minecraft_server.jar:3276-
#
Spigot-3892929-b58f429]
        at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callExpBottleEvent(CraftEventFactory.java:1253) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.world.entity.projectile.EntityThrownExpBottle.a(EntityThrownExpBottle.java:47) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.world.entity.projectile.IProjectile.preOnHit(IProjectile.java:160) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.world.entity.projectile.EntityProjectile.tick(EntityProjectile.java:70) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.level.WorldServer.entityJoinedWorld(WorldServer.java:777) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.world.level.World.a(World.java:699) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.level.WorldServer.lambda$11(WorldServer.java:489) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.world.level.entity.EntityTickList.a(SourceFile:54) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.level.WorldServer.doTick(WorldServer.java:470) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1314) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:438) ~[minecraft_server.jar:3276-
#
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:438) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1217) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1050) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.NBTTagCompound.hasKey(String)" because "nbtTag" is null
        at net.fordium.xpbottleupgrade.Events.onBottleBreak(Events.java:26) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[minecraft_server.jar:3276-Spigot-3892929-b58f429]
        ... 18 more
waxen plinth
#

Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.NBTTagCompound.hasKey(String)" because "nbtTag" is null

#

at net.fordium.xpbottleupgrade.Events.onBottleBreak(Events.java:26) ~[?:?]

quaint mantle
#

yeah

#

but its not null

waxen plinth
#

Sure would be nice if the exception told you exactly what was happening and where

quaint mantle
#

mhm

waxen plinth
quaint mantle
#

ik

#

thats the problem

waxen plinth
#

I feel like a simple null check would fix this

#

Just early return if the nbt tag is null

quaint mantle
waxen plinth
#

If the nbt tag is null then it won't have the data you want to begin with

waxen plinth
#

What do you mean

quaint mantle
#

for the exp bottle

waxen plinth
#

Okay but like

#

That string isn't what's null

#

nbtTag is what's null

quaint mantle
#

oh

#

um

#

so how do i check for that string

#

then

waxen plinth
#

It's entirely possible that minecraft just ignores nbt data you put in the item that it doesn't think exists

#

Try throwing the item on the ground and using /data get entity @e[type=item,distance=0..5] or whatever

waxen plinth
#

It might not have had the tag applied at all

#

In which case you would have to apply it programmatically

quaint mantle
#

any reasons for that?

waxen plinth
#

Might just be how the game is written

#

Not sure why you're using nbt api to begin with

quaint mantle
#

i want to use this item in datapack loot tables

waxen plinth
#

You could easily use PDC for this

quaint mantle
waxen plinth
#

I don't think plugins and data packs mingle very well

#

So I wouldn't know how to help further with that

quaint mantle
#

ik

#

minecraft commands dont support pdc do they

#

;-;

waxen plinth
#

PDC must be represented in some structure in NBT

#

Where else would it be stored

#

I'm guessing it just puts a special map in the NBT data for an item or something

quaint mantle
#

hmm

#

well suppose i do not use a datapack, how do i make loot tables in spigot

waxen plinth
#

No clue

#

Wait, you mean implementing your own loot tables?

quaint mantle
#

yuh

waxen plinth
#

It depends on what you want to do with them

quaint mantle
#

i want to modify almost all vanilla structure loot tables

lavish hemlock
#

PSA: If the exception says a value is null, then it's null. It cannot lie as the exception is raised by Java (the JVM) itself.

waxen plinth
#

I don't think you could easily do that

waxen plinth
#

🥲

lavish hemlock
#

you know what I mean

quaint mantle
#

;-;;

#

how do i check for custom nbt tag strings

lavish hemlock
#

also it's hard for fake NPEs to exist lol

quaint mantle
#

maybe the way im checking for em is wrong

#

plus one thing i noticed, the exception only throws when i use the item in survival

lavish hemlock
#

I believe it's throwing bc the item isn't guaranteed to have a tag?

quaint mantle
#

and it displayed bottleType as an nbt

#

@lavish hemlock help pls

mortal hare
#

in newer versions of minecraft

#

it allows packet construction without reflection overhead

#

although packetdataserializer methods are obfuscated you can find out what those do by just looking at the PacketPlayOut class and comparing it to wiki.vg documentation

#

for example in 1.17.1

#

#PacketDataSerializer.d() would write minecraft implementation of VarInt to the buffer

#

by using these you can create packets without reflection

pastel stag
#

Karambwans? @mortal hare

mortal hare
pastel stag
#

karambwans are the answer

mortal hare
#

wdym

pastel stag
#

lol nevermind its just ur name

#

ignore my unproductive meme'ing

mortal hare
#

that's my real name in Lithuanian

#

without numbers

pastel stag
quaint mantle
ornate heart
#

Should i cache SQL data or is getting the data from the database every time fine?

pastel stag
#

never heard of caching data from an sql database and not just fetching it

#

i would imagine just using the database as intended would be plenty fast enough for pretty much any possible minecraft related use-case

quaint mantle
ivory sleet
#

You most certainly want to cache it

ornate heart
#

Why

ivory sleet
#

First and foremost querying sql is quite the operation, so it should be done async to avoid lag spikes as it’s not just any "function invocation" you’re doing there. Because of this you probably want to store the data retrieved from the database, such that if you’ve queried the database once, there’s no need to do it again. However, if you implement a cache you need to be damn disciplined such that you keep your cache in sync with the database regarding all data, and invalidate unneeded objects in the cache which might be after a certain duration.

quaint mantle
ivory sleet
#

You probably want to use a sophisticated cache if it’s across servers like redis

#

But that’d require even more discipline

quaint mantle
ivory sleet
#

🥲

quaint mantle
#

I used to think that i should keep everything in memory, but dam this plugin design is soo awesome

soft dragon
#

I have idea that I think its possible - since X-rays are very popular and its hard to stop x-rayers that want ORES why not we to stop ores - the server is hiding ores by changing the whole block to stone and if you mine block next to the ORE or close to the ORE its transofrming into ore so the player really must "find" it...

#

Would it be possible to implement in BIG servers?

ivory sleet
pastel stag
#

to stop x-rayers on my server i just tell the world generator not to generate gold, iron, diamond and emerald

#

cant xray ores if they dont exist, big brain move

soft dragon
#

xD

quaint mantle