#help-development

1 messages · Page 582 of 1

static ingot
#

next time

split gull
#

thank you

small holly
#

Hey I got a protocol Lib question, I currently have this for sending a "fake item" packet saying that the user has x mask on but I need it to update all the masks for the player that just joined the server

@Override
    public void onPacketSending(PacketEvent event) {
        Player player = event.getPlayer();
        int slot = event.getPacket().getIntegers().readSafely(1);

        if (slot != 4)
            return;

        PacketContainer equipmentPacket = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT);
        ItemStack item = equipmentPacket.getItemModifier().readSafely(0);
        System.out.println(player);
        if (item == null || item.getType() == Material.AIR)
            return;

        NBTItem nbtItem = new NBTItem(item);

        if (!nbtItem.getBoolean(NBTConsts.GLITCH_ITEM))
            return;
        String type = MaskUtils.getMaskType(item);
        int level = MaskUtils.getMaskLevel(item);
        Masks.Mask mask = MaskUtils.get().getMask(type, level);

        if (mask == null)
            return;

        equipmentPacket.getIntegers().write(0, player.getEntityId()).write(1, 4);

        equipmentPacket.getItemModifier().write(0, mask.getMaskItem());
        event.setCancelled(true);

        // Forward the modified packet to all online players except the sender
        for (Player targetPlayer : Bukkit.getServer().getOnlinePlayers()) {
            if (!targetPlayer.equals(player)) {
                ProtocolLibrary.getProtocolManager().sendServerPacket(targetPlayer, equipmentPacket);
            }
        }

    }
static ingot
#

brub

split gull
#

thats for big pieces of code right? if its small it should be ok

tender shard
#

change "spigot-api" to spigot with classifier "remapped-mojang". but as mentioned above, you don't need to do that, you already got the CBD to get a context from

split gull
#

alr

tender shard
#

just another self promotion since you already use my CBD lib, maybe you also find this useful:

#

?morepdc

undone axleBOT
tender shard
#

it allows to use maps, arrays, collections etc, e.g. to save a Map<EntityType,List<ItemStack>> and other fancy stuff in PDC

split gull
#

yeah i'll be using that soon

#

im implementing all the standard stuff first

#

then i'll add all the custom ones

#

ty for making these ❤️

small holly
split gull
#

actually, this wont work, what i mean is creating a standalone PDC, without having to use another's context

#

well it would work, but it's not what im looking for

tender shard
#

then you indeed need the craftbukkit classes

split gull
#

alr

tender shard
#

like this ^

#

you can cache the registry and context and reuse it btw

#

Player#showParticle(...)

#

or sendParticle, idk

split gull
#

or did i miss it

#

with classifier i assume you mean <remappedClassifierName>remapped-obf</remappedClassifierName>

tender shard
#

noo

#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
split gull
#

ohh

#

ty ill try it

tender shard
#

did you read the blog post I linked earlier? you need to run buildtools for this to work java -jar buildtools.jar --rev 1.20.1 --remapped

#

otherwise maven won't find spigot

#

well check the javadocs

split gull
#

yeah my bad, i usually dont understand these commands

tender shard
tender shard
#

?bt

undone axleBOT
tender shard
split gull
#

do build tools work across multiple versions?

#

like does 1.19.4 work with upper and other 1.19 releases?

tender shard
#

buildtools works for every 1.8+ version, but your code will be version dependent because the craftbukkit classes have the version in the package name

#

e.g. the CraftPersistentDataTypeRegistry on 1.20 is in package org.bukkit.craftbukkit.v1_20_R1.persistence

split gull
#

well thats an issue for me

#

i see

tender shard
#

then you gotta use reflection or a multi module project

split gull
#

oh god fancy words

#

is any of what you've mentioned going to require me to update the plugin whenever a new minecraft version drops for it to work on it?

split gull
#

then it's not worth doing, i dont want it to be version dependent

quaint mantle
#

well

#

not necessarily version dependant its just for certain updates the class may change its signature or functionality

split gull
#

for starters, what does creating a new pdc with a context do? whats the relationship between this new pdc and the context?

quaint mantle
#

reflection is your friend there

tender shard
# split gull oh god fancy words
        try {
            String packageName = Bukkit.getServer().getClass().getPackage().getName(); // Will be org.bukkit.craftbukkit.v1_20_R1
            Class<?> craftPersistentDataTypeRegistryClass = Class.forName(packageName + ".persistence.CraftPersistentDataTypeRegistry");
            Class<?> craftPersistentDataAdapterContextClass = Class.forName(packageName + ".persistence.CraftPersistentDataAdapterContext");
            Object registry = craftPersistentDataTypeRegistryClass.getConstructor().newInstance();
            PersistentDataAdapterContext context = (PersistentDataAdapterContext) craftPersistentDataAdapterContextClass.getConstructor(registry.getClass()).newInstance(registry);
            PersistentDataContainer myPdc = context.newPersistentDataContainer();
        } catch (ReflectiveOperationException ex) {
            throw new RuntimeException(ex);
        }
#

this works in all versions

split gull
#

oh damn

tender shard
#

you should cache the "context" object somewhere

split gull
#

yeye

quaint mantle
#

wtf is context

split gull
#

trust me i have no clue

#

it's just something that exists

quaint mantle
#

whats all in this 1.20 update

split gull
#

it's been a thing

quaint mantle
#

oh

tender shard
#

eg like this

public class MyPlugin extends JavaPlugin {
    private static final PersistentDataAdapterContext dummyContext;

    static {
        try {
            String packageName = Bukkit.getServer().getClass().getPackage().getName(); // Will be org.bukkit.craftbukkit.v1_20_R1
            Class<?> craftPersistentDataTypeRegistryClass = Class.forName(packageName + ".persistence.CraftPersistentDataTypeRegistry");
            Class<?> craftPersistentDataAdapterContextClass = Class.forName(packageName + ".persistence.CraftPersistentDataAdapterContext");
            Object registry = craftPersistentDataTypeRegistryClass.getConstructor().newInstance();
            dummyContext = (PersistentDataAdapterContext) craftPersistentDataAdapterContextClass.getConstructor(registry.getClass()).newInstance(registry);
        } catch (ReflectiveOperationException ex) {
            throw new RuntimeException(ex);
        }
    }

}
tender shard
quaint mantle
#

ive never touched that shit and hopefully i never have to

#

didnt even know that existed and i thought i memorized the entire API at one point

split gull
#

the // Will be org.bukkit.craftbukkit.v1_20_R1 comment is just you assuming im using 1.20 right?

tender shard
#

no

split gull
#

oh

tender shard
#

it will be v1_19_R3 in 1.19.4 for example

split gull
#

ohhh alright

#

perfect, thank you very much

tender shard
#

Bukkit.getServer() returns the interface "Server" but getClass() on the actual object returns its implementation class

#

hence you will always get the correct package name, no matter which version

split gull
#

you're a savior 🙏

tender shard
#

np

#

it's like Bukkit.getPlayer(...) seems to return a Player, but it's actually a org.bukkit.craftbukkit.<version>.entity.CraftPlayer or sth, which just implements Player

worldly ingot
#

Just being able to create an instance of it as an interface is all

#

The implementation isn't exposed to Bukkit so you can't create instances of it

split gull
#

oh alright

tender shard
#

i wonder why all classes (Entity, ChunkAccess, etc) have their own CraftPersistentDataTypeRegistry, why don't they all use the same instance?

#

choco, any idea?

shut sphinx
#

hey i hate to have to ask this here,
i was wondering how i can detect which chunks are taking the longest to tick

quaint mantle
#

How can I convert a spigot gradient to a mojang gradient when I just use a nms Component.literal it becomes this §x§3§e§4§2§f§6
(&#3e42f6 is the gradient)

worldly ingot
#

I didn't implement it

tender shard
#

damn this class is getting more and more ugly in every commit

shut sphinx
#

oh, dude

#

why is it so light?

glad prawn
#

💀

quaint mantle
#

💀

tender shard
#

huh is this really the correct form to mention constructors in javadocs? ClassName#ClassName() ?

shut sphinx
#

how would u go about detecting lag machines?

#

what methods have u guys come up with?

#
  • looking for where players are during lag spikes and honing in on - those chunks?

  • ruitine scan of all chunks tick speeds to see which ones are taking the longest to tick?

  • something else?

#

interested to hear ur guys thoughts as fellow developers

small holly
#

Anyone able to help me with some protocolLib stuff?

#

PacketUtils class https://sourceb.in/0vLrfGkAAs
Method that calls the setHelmet method https://sourceb.in/weVuaNfXVr
Issue: Packets only get sent sometimes but unsure if thats just a stroke of luck of something up with the code
Ideal outcome: Player 1 puts on a helmet with a mask "bound" to it and all players excluding player 1 see the mask instead of the helmet

#

its so annoying because It can work one second then bam not work again

manic delta
#

I want to make a personal plugin to send commands to the minecraft servers of my network, separately, I already have the logic and everything, I will use mysql for it, but my problem is that "I don't know how to optimize it", there are 200 users at the same time by server but with the code as such it ends up exploiting the server, can someone help me? I tried to use Scheduler Programming but I don't see any change

flint coyote
#

Why do the commands depend on the amount of players? Is it the same command times each player?

manic delta
#

To who u are talking

flint coyote
#

you

manic delta
# flint coyote you

The data query will be done every 5 minutes, but when the players enter the server starts to die, regardless of whether I'm asking for data or not

#

I mean, just by connecting it, everything starts to explode.

flint coyote
#

Are you doing your query on the main thread?

quaint mantle
#

How can I convert a spigot gradient to a mojang gradient when I just use a nms Component.literal it becomes this §x§3§e§4§2§f§6
(&#3e42f6 is the gradient)

manic delta
flint coyote
#

Show me the scheduler. It has to mention "async"

manic delta
#

sure 1sec

manic delta
# flint coyote Show me the scheduler. It has to mention "async"
public static void insertInv(StaffInventorySQL staffInventorySQL) throws SQLException {
        BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskAsynchronously(Main.getPlugin(), () -> {
            try {
                PreparedStatement statement = Main.getPlugin().getConnection().prepareStatement("INSERT INTO staff_" + getDatabaseType() + "(uuid, inventory, armor, fetched) VALUES (?, ?, ?, ?)");
                String inventory = Base64.itemStackArrayToBase64(staffInventorySQL.getInventory());
                String armor = Base64.itemStackArrayToBase64(staffInventorySQL.getArmor());
                statement.setString(1, staffInventorySQL.getUuid());
                statement.setString(2, inventory);
                statement.setString(3, armor);
                statement.setString(4, staffInventorySQL.getFetched());
                statement.executeUpdate();
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        });

    }

I clarify that it is only an example and some tests lol

#

||and that he was not very sure how to use the schedule programming with this||

flint coyote
#

hmm "runTaskAsynchronously" looks alright

manic delta
#
BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskAsynchronously(this, () -> {
            try {
                DatabaseManager manager = new DatabaseManager("", 3306, "s2", "ud", "+1");
                this.connection = manager.getConnection();
                manager.createTable();
            } catch (ClassNotFoundException e) {
                Chat.sendConsoleMessage("&a[DB] &cError to connect");
                e.printStackTrace();
            } catch (SQLException e) {
                Chat.sendConsoleMessage("&a[DB] &cError to create the main table");
                e.printStackTrace();
            }
        });

I have this on onEnable()

flint coyote
#

So you used it that way aswell? Since you said this is just an example. The asynchronous part is important

flint coyote
#

Well since the server is not dying after your plugin, what are you doing in the PlayerJoinEvent?

manic delta
#

nothing

flint coyote
#

Where do you execute your query?

manic delta
#

every five minutes

flint coyote
#

where

#

do you run it asynchronous aswell?

manic delta
#

At the moment I did not put it but it still crashes

#

just by loading the plugin

flint coyote
#

Oh so you load the plugin and even without players on the server it crashes again?

manic delta
#

sure

#

First it starts with very bad tps, then it gets worse

flint coyote
#

does this happen without you trying to connect to the db? E.g. commenting that part out?

manic delta
#

and finally it gives a thread error and explodes

manic delta
#

I will make the plugin again from 0 so I am open to suggestions

flint coyote
#

Are you 100% positive on that statement? It does look right to me. An asynchronous thread should never lock the main thread

manic delta
#

I'm going to redo the plugin so I'll be testing things anyway but I know what's going to happen

flint coyote
#

Well in that case you should check your crash dump for the line of your plugin that's causing the crash

#

Check if it's actually that part, too

manic delta
flint coyote
#

Sounds cool. Can you

manic delta
#

I am making the table in the database and then I will make the plugin

flint coyote
#

?paste your crash dump?

undone axleBOT
manic delta
#

i'll do it when i'm done

flint coyote
#

Sure, I just can't offer more help with your crash before I see it :)

manic delta
#

There is no more optimal way to use?
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskAsynchronously(this, () -> {});

manic delta
flint coyote
manic delta
flint coyote
small holly
flint coyote
small holly
#

Imma grab something to eat so if someone responds please ping

quaint mantle
#

How can I convert a spigot gradient to a mojang gradient when I just use a nms Component.literal it becomes this §x§3§e§4§2§f§6
(&#3e42f6 is the gradient)

river oracle
quaint mantle
#

but it doesnt display as a hex code

#

it only displays as the &6

river oracle
#

idk then you'll have to figure it out yourself, NMS isn't very well documented

#

you shouldn't ever really need to use mojang components anyways

quaint mantle
river oracle
#

CraftChatMessage.fromStringOrNull(your text);

rapid gust
#

I have a very strange issue, to begin with, my plugin cannot access some parts of the config file, but it can access others... however if i use /reload this completely fixes it?? Anyone have any idea what this could be? Thanks 🙂

flint coyote
#

Do you change those entries manually while the config is already loaded?

rapid gust
#

nope, at this point nothing has been changed at all

flint coyote
#

So you load the config, try to change values and it can't access them?

rapid gust
#

literally just saveDefaultConfig(); (in enable) and then plugin.getConfig().getBoolean("settings.debug") (which works) and then plugin.getConfig().getConfigurationSection("designs").getKeys(false); (Which does not work until after a /reload

manic delta
#

is ok for now

flint coyote
rapid gust
#

even stranger?! after enabling spigot debug and rebooting its now working fine?!?

#

let me reboot a couple more times and see if it stays the same

flint coyote
#

/reload can cause weird issues. It works fine 95% of the time. If you have weird issues you should however always do a full reboot

rapid gust
flint coyote
#

that should not be the case

rapid gust
#

exactly... thats whats confusing me so much lmao

#

one sec

#

the issue seems to be with this line (seprate class)

flint coyote
#

why do you call "getInstance()"? That's probably not an issue but plugin.getConfig() should work just fine

#

can you show me where you are calling the saveDefaultConfig()?

rapid gust
flint coyote
#

and what's plugin?

rapid gust
flint coyote
#

inside the class you are calling it I mean

rapid gust
#

i had just renamed it to try something else and should have probably put it back before taking that ss lol. sorry about that

flint coyote
#

Is your main class named "plugin"? Because if "plugin" in your other class is already an instance there isn't really a reason to call getInstance

flint coyote
#

or basically, is it a nullpointer because you call the getkeys?

rapid gust
flint coyote
#

If you don't get an error it won't be null. Otherwise .getKeys would throw a NPE

small holly
#

Anyone able to help me with some protocolLib stuff?
PacketUtils class https://sourceb.in/0vLrfGkAAs
Method that calls the setHelmet method https://sourceb.in/weVuaNfXVr
Issue: Packets only get sent sometimes but unsure if thats just a stroke of luck of something up with the code
Ideal outcome: Player 1 puts on a helmet with a mask "bound" to it and all players excluding player 1 see the mask instead of the helmet
its so annoying because It can work one second then bam not work again

flint coyote
#

Wait, plugin is a public static variable? Why?

#

Actually your function seems to be in a static context aswell. Maybe that's why your config is fucked up

#

You should never be in a static context unless you are calling some utility class

#

You can however create a static function in your main class that returns "this" and then do YourMainClass.getInstance().getConfig() ...

eternal oxide
#

You can;t actually return this in a static context. You have to set an instance variable and return that

flint coyote
#

oh, true. I guess I should go to bed some time soon

eternal oxide
#

🙂

flint coyote
#

already hit the 24 hour mark 😅

eternal oxide
#

I'm at the other end, not awake yet

flint coyote
#

Time flies when coding. Especially when it's not searching for annoying bugs for hours on end

#

Good morning btw

eternal oxide
#

Morning 🙂

rain patio
#

I'm trying to use a GUI to select a color and for some reason setCancelled(true) isn't working because I can pick up the item and put it in my inventory and when I reopen the gui the item is missing and I can just put it back like a player vault, can anyone help me? I've registered the listener and I don't know why its doing this

rapid gust
# flint coyote oh, true. I guess I should go to bed some time soon

Thank you so much for your help, I managed to work it out I think... It seems it only happens if the config file has just been generated. Still not completely sure why it happens, might be a mistake in my code (likely) or could be a strange bug w spigot (less likely) edit: I think it matters where exactly in the load saveDefaultConfig(); is placed. I think it wasnt working as I had it too far down?

shadow night
#

Hey, I want to make some machinery like in tech mods. My idea is to add custom crafts that give renamed blocks which on placement write to the block pdc and start a timer that runs every tick for checks. But I thought of storing it and using config files or databases just feels wrong. What should I use, in your opinion?

placid moss
#

just change block nbt

#

and store the blocks on runtime in a list f some sort

#

or you can like lazy load them

shadow night
placid moss
#

but you can just reload them using block nbt

#

because im pretty sure that is store inside the chunk?

#

or am i tripping

shadow night
#

Yeah

#

But do I like check every loaded chunk?

placid moss
#

thats probably the best way

shadow night
#

Ig

placid moss
#

in like some sort of chunk load event

shadow night
#

I'll do that that way then, thanks

small holly
#

Anyone able to help me with some protocolLib stuff?
PacketUtils class https://sourceb.in/0vLrfGkAAs
Method that calls the setHelmet method https://sourceb.in/weVuaNfXVr
Issue: Packets only get sent sometimes but unsure if thats just a stroke of luck of something up with the code
Ideal outcome: Player 1 puts on a helmet with a mask "bound" to it and all players excluding player 1 see the mask instead of the helmet
its so annoying because It can work one second then bam not work again.
Been stuck on this for almost 3 days now

placid moss
#

with that code wouldn't new players who join after the helmet is equipped not be able to see the helmet?

#

also players who disconnect and rejoin will not e able to see it

small holly
#

got something else for that

placid moss
#

oh ok

small holly
#

I tried with a packet listener but for some reason it sets the mask on all the other players

#
public class PacketListener extends PacketAdapter {



    public PacketListener(Plugin plugin, ListenerPriority listenerPriority, PacketType... types) {
        super(plugin, listenerPriority, types);
    }

    @Override
    public void onPacketSending(PacketEvent event) {
        Player player = event.getPlayer();
        int slot = event.getPacket().getIntegers().readSafely(1);

        if (slot != 4)
            return;

        ItemStack item = event.getPacket().getItemModifier().readSafely(0);
        if (item == null || item.getType() == Material.AIR)
            return;

        NBTItem nbtItem = new NBTItem(item);

        if (!nbtItem.getBoolean(NBTConsts.GLITCH_ITEM))
            return;

        if (!nbtItem.getBoolean(Consts.maskBound))
            return;
        String type = MaskUtils.getMaskType(item);
        int level = MaskUtils.getMaskLevel(item);
        Masks.Mask mask = MaskUtils.get().getMask(type, level);

        if (mask == null)
            return;

        PacketUtils.setHelmet(player, mask.getMaskItem());

    }
}
placid moss
#

your setHelmet method sets the helmet for some player, so if you are sending the equipment packet to all the other players, that will setHelmet on all the other players

small holly
#

so how would I do it then? Ive not touched protocol lib in like 4 years lol

placid moss
#

I guess you could store the player / helmet status in some sort of map and every time a player joins, you would loop through this map and send a packet that tells this new player all the helmets of the other players. For this, you would just do what you did up there with entity equipment packets, one for each player with a helmet.

dire bluff
#

Hello I’ve made a custom recipe but I need each craft cost 64 of each material instead of 1

#

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;


public final class CustomCrafting extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        ItemStack amethystblade = new ItemStack(Material.DIAMOND_SWORD , 1);
        ItemMeta amethystbladeMeta = amethystblade.getItemMeta();
        amethystbladeMeta.setDisplayName(ChatColor.DARK_PURPLE+"Amethys Blade");
        amethystbladeMeta.setCustomModelData(1);
        ArrayList<String> lore = new ArrayList<>();
        lore.add(ChatColor.RED+"* This is the Ametyhyst Blade forget from a blacksmith");
        lore.add(ChatColor.RED+"* For the Amethyst King of the AmethystValley");
        lore.add(ChatColor.RED+"* He lost it when he died in a fight vs Sparta");
        amethystbladeMeta.setLore(lore);
        amethystblade.setItemMeta(amethystbladeMeta);

        ItemStack amethyststring = new ItemStack(Material.STRING,64);
        ItemMeta amethyststringmeta = amethyststring.getItemMeta();
        amethyststringmeta.setDisplayName(ChatColor.DARK_PURPLE+"Amethyst String");
        amethyststringmeta.setCustomModelData(5);
        ArrayList<String> lore2 = new ArrayList<>();
        lore2.add(ChatColor.LIGHT_PURPLE+"* This is a material that lets");
        lore2.add(ChatColor.LIGHT_PURPLE +"* You craft Amethyst Equipment");
        lore2.add(ChatColor.LIGHT_PURPLE +"* Press /recipes for more info");
        lore2.add(ChatColor.LIGHT_PURPLE +"* You can obtain this item and a ");
        lore2.add(ChatColor.LIGHT_PURPLE +"*  lot of more in /rpg");
        amethyststringmeta.setLore(lore2);
        amethyststring.setItemMeta(amethyststringmeta);

        ItemStack amethyst = new ItemStack(Material.AMETHYST_CLUSTER,64);
        ItemMeta amethystMeta = amethyst.getItemMeta();
        amethystMeta.setDisplayName(ChatColor.DARK_PURPLE+"Amethyst Fragment");
        amethystMeta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3 ,true);
        amethystMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        amethystMeta.setLore(lore2);
        amethyst.setItemMeta(amethystMeta);

        ItemStack amethystheart = new ItemStack(Material.TURTLE_EGG,1);
        ItemMeta amethystheartmeta = amethyst.getItemMeta();
        amethystheartmeta.setCustomModelData(12);
        amethystheartmeta.setDisplayName(ChatColor.DARK_PURPLE+"Heart of amethyst");
        amethystheartmeta.setLore(lore2);
        amethystheart.setItemMeta(amethystheartmeta);


        ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this,"amethystblade"),amethystheart);
        recipe.shape("xyx ","xzx ","ysy");
        recipe.setIngredient('x',new RecipeChoice.ExactChoice(amethyst));
        recipe.setIngredient('y',new RecipeChoice.ExactChoice(amethyststring));
        recipe.setIngredient('z',new RecipeChoice.ExactChoice(amethystheart));
        recipe.setIngredient('s',Material.STICK);

        Bukkit.addRecipe(recipe);
    }

}
placid moss
#

I am pretty sure the only way to do this is using PrepareItemCraftEvent and CraftItemEvent

#

and then manually do math

small holly
dire bluff
small holly
placid moss
#

Yea just use ExactMaterial and then use PrepareItemCraftEvent to check if the slots have enough items, if so add the result to the result slot

#

And then on itemcraftevent simply subtract the right amounts from each slot

placid moss
#

i.e. its not the nbt checks for glitch item that are causing the issue

small holly
#

Yep added the System.out.println(player.getName() + " -> " + targetPlayer.getName()); gets sent every time

placid moss
#

Also istg that helmet is number 5

small holly
#

I thought so too

#

but nope its in the armor slots

placid moss
#

ok anyways

small holly
#

1.8

placid moss
#

ah ic

small holly
#

no off hand

#

I love being stuck in 1.8 for this server ;-;

#

thankfully the cannon Jar dev is making a 1.20 version so we can finally do 1.20

placid moss
small holly
#

it runs but doesn't work as intended

placid moss
#

aren't the two code pieces colliding

#

one is changing the packet sent

#

and results in the packet being sent more

small holly
#

when I test the packet listener one I comment out the other one

placid moss
#

uhh

#

ok

placid moss
#

cuz its listening for the entity equipment packet

#

and then making it so that the player who is viewing the armor

#

gets the armor

small holly
#

ye that is what I was getting

placid moss
#

you should just use the interact listener

#

and then keep that code

#

and then just use a hashmap and send on join

#

because I don't see an issue with the code

#

if the packets only work like sometimes, is there like a pattern to when it does not work?

dire bluff
placid moss
#
dire bluff
#

ty

timid hedge
#

How do i import something from my other plugin to my plugin?

placid moss
#

add plugin as a dependency

#

so add as depend in plugin.yml

#

and then use either a) the api for the plugin if its available as a repo b) use the jar as a dependency

#

then you can just grab the plugin instance with Bukkit.getPluginManager.getPlugin(name)

timid hedge
obsidian plinth
#

with bedrock packs is it possible to replace some chars with imgs like java

hollow beacon
#

yo, is there a way to get the configurationSection.getKeys(false) in order of the actual config

chrome beacon
hollow beacon
#

saves me an extra field to get the order I want

chrome beacon
#

It's a lot more work to get it in the right order

hollow beacon
#

aw

brazen violet
#

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXITS spieler_sprache(uuid String, sprache string)' at line 1

#

need the code?

chrome beacon
#

EXITS

#

Typo ^

shadow night
#

how can I set the state of a furnace? Like, the amount of fuel it already used up from the total. I want to be able to control how long it burns and stuff

brazen violet
shadow night
#

thanks

chrome beacon
brazen violet
#

yes

brazen violet
chrome beacon
#

Yup

#

So fix the typo

brazen violet
chrome beacon
#

._.

chrome beacon
quaint mantle
#

would pdc be the best way to make some blocks interactable, like a chest or sm shit to open a different gui

chrome beacon
#

PDC is a good way to identify your blocks

quaint mantle
#

so is that a yes or is there another better way

placid moss
#

add the dependency name in the list

chrome beacon
#

That is a yes

brazen violet
chrome beacon
#

?

#

Use the right word?

brazen violet
#

and what is the right word

chrome beacon
brazen violet
#

OH

#

I WROTE IT WRONG WTF AM I BLIND

brazen violet
glad prawn
#

you're not blind, just bad eyes xd

brazen violet
#

true

#

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' sprache string)' at line 1

did i wrote something wrong again?

#

the S big or

chrome beacon
#

String isn't a valid type

#

Use varchar or text

brazen violet
#

what would be better

#

depends on what i do or

chrome beacon
#

With varchar you can define a max length

brazen violet
#

then i use text

chrome beacon
#

Sure

brazen violet
#

like this´?

#

String sql = "CREATE TABLE IF NOT EXISTS spieler_sprache(uuid String, sprache text)";

chrome beacon
#

Yeah

#

Does MariaDB have uuids though

#

Maybe not so make string text again

brazen violet
# chrome beacon Does MariaDB have uuids though

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' sprache text)' at line 1

something went wrong

vivid cave
#

Some questions about PrepareSmithingEvent

chrome beacon
#

Did you do that

brazen violet
#

so the uuid String to uuid text

brazen violet
timid hedge
placid moss
#

the name of the plugin you are depending on:

depend:
- "Plugin1"
- "Plugin2"
timid hedge
#

It dosent work
I have a plugin named "FormatAsMoney" for making 1000 to 1k

depend:
  - "FormatAsMoney"
chrome beacon
#

You need to import the plugin in to your project if you want to access classes from it

placid moss
#

yea

#

you need to add the plugin jar as a dependency

#

or use maven api if available

timid hedge
#

But i dont understand what you mean with a and b

So i need to add it to my pom.xml right?

chrome beacon
#

Yes

timid hedge
#

But what should i switch out with what to add my other plugin?

      <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>1.8.8-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
placid moss
#

just add the built jar as a dependenc

#

or use maven install i think?

chrome beacon
#

???

placid moss
#

and then use local dependency

#

right

chrome beacon
#

Yeah mvn install

#

No need for jar depend

placid moss
#

lol i dont use maven ;-;

#

yea

chrome beacon
#

Same goes for gradle

drowsy helm
#

what are you using instead

placid moss
#

you dont have to change the other plugin

#

just run mvn install in the root of the other project

#

an then add the local dependency

placid moss
#

is this library yours or not yours

tawdry echo
#

i want to get all stone from player inventory but it must be divisible by 4 then remove how can do it?

timid hedge
#

Dude what are you talking about?
I just want so i can use my FormatAsMoney in my other plugin so i can make 1000 to 1k

drowsy helm
#

why does it need a whole dependency

timid hedge
placid moss
#

i dont think you should have a library for one function lmao

drowsy helm
#

that would make sense if it was some mult faceted method but its a util method

quaint mantle
#

whats the best way to do like a raycast/linetrace out of the player's eye until i hit an enemy?

drowsy helm
#

unless therei s some config that it depends on in the plugin you are just wasting time importing it

shadow night
#

how do I check if something is usable as fuel in furnaces?

shadow night
#

and how do I check burning time?

placid moss
#

i dont think theres api for that

#

use an enum to manually list i think?

shadow night
#

._.

drowsy helm
#

no there is

shadow night
#

oh thank god

drowsy helm
#

im trying to read my horrendous code

chrome beacon
drowsy helm
#
    private int getSmeltTime(Material mat) {    
        return getFurnaceRecipe(mat) != null ? getFurnaceRecipe(mat).getCookingTime()/20*1000 : 0;
    }
    
    private float getSmeltExp(Material mat) {
        return getFurnaceRecipe(mat) != null ? getFurnaceRecipe(mat).getExperience() : 0;
    }
    
    private FurnaceRecipe getFurnaceRecipe(Material mat) {    
        Iterator<Recipe> iter = Bukkit.recipeIterator();
        while (iter.hasNext()) {
            Recipe recipe = iter.next();
            if (!(recipe instanceof FurnaceRecipe)) continue;
            if (((FurnaceRecipe) recipe).getInput().getType() != mat) continue;
            return ((FurnaceRecipe) recipe);
        }
        return null;
    }```
placid moss
#

wow cool

shadow night
drowsy helm
#

have to get the recipe then the time form that

placid moss
placid moss
#

that is unrelated

eternal oxide
#

lots of values there

placid moss
#

that is the progress of the little bar

#

not the fuel time of the fuel

eternal oxide
#

there is also burn time ticks for fuel etc

drowsy helm
#

TICKS_FOR_CURRENT_FUEL

#

is the one

#

but that only works when afurnace is populated with a fuel item

#

cant just get it from the material

chrome beacon
shadow night
#

and my furnace won't be burning by itself

#

it does that from code

vivid cave
#

Do armor types have an actual impact on the stats ?
or is an armor entirely described by its attributes ?
(which ofc are initially given based on the type of the armor)

My question can be rephrasd:
If two armors, whatever their types, have the same attribute modifiers/data besides the type (gold / diamond etc), are they just a copy of each other ?

drowsy helm
placid moss
#

i think material matters when comparing armors

#

so they wont be a copy

#

but stats can be changed without changing the armor type

#

so you can have two different types of armor with the same armor stat using attributes

vivid cave
#

do you guys think that what i did in the screenshot is sufficient ?

#

(only for protection wise)

echo basalt
#

1 - what the actual fuck is that color scheme

vivid cave
#

with testing it feels like armors are the same but i ain't entirely sure

chrome beacon
#

Screenshot of code 💀

drowsy helm
#

oh my god

#

are you coding with hyperlinks

#

holy fuck

vivid cave
#

😢

chrome beacon
#

Don't send text as images

#

That's just a waste

vivid cave
#

but i didn't wanna shove the wall of china up your eyes

#

😢

chrome beacon
#

?paste

undone axleBOT
vivid cave
#

mk

vivid cave
#

wait don't mind the CompoundTag stuff (its unrelated to my question)

#

i only talk about sheer protection, not damage/durability

chrome beacon
#

That probably wouldn't enough

#

Armor has protection values by default. I'm not sure if those are included in your calculation

#

Do test and see if it works

vivid cave
#

well my test seems to be pretty satisfying tbh but i feel like i'm coding with the ass rn and fluking stuff you know what i mean

#

till i have no proof this is exact testing won't convince me

#

but for example, each need the same amount of hits till player dies

#

and i fear of not covering every scenarios too tbh

#

maybe it's just a luck that my testing work for the specific armors i took

chrome beacon
#

Then test some other combinations

#

Or write an automated test

vivid cave
#

hm, idk what to test too tbh, i have tested basic armors, armors with same enchants,

#

all that in my manual testing seemed to work fine

chrome beacon
#

Then it's fine

vivid cave
#

mk

#

will prolly move to packets tho tbh

#

idk

chrome beacon
#

Not worth it

vivid cave
#

yeah

#

anywawy thx!

glad prawn
drowsy helm
#

oops

glad prawn
#

wat

slow temple
#

im new to java plugin making, is there a way to create a custom mob class that extends the zombie class

drowsy helm
#

are you new to java in general

slow temple
#

i know c# well and they're basically the same imo

drowsy helm
slow temple
#

i know the basics of java

shadow night
#

they're similar but not the same

slow temple
#

the syntax is similar, so i can read java

#

ty

drowsy helm
#

thats some implementations ive done if you wanna try and decipher it

#

there are a few tutorials on the forums aswell

slow temple
#

where do i get the net.minecraft import

drowsy helm
#

ah yeah that is the remapped jar

shadow night
#

you have to get the api using maven or gradle, you should look at some beginner guides

slow temple
#

ok

keen jolt
#

I have a plugin that's reading some values from my config file, however my title string always comes back as null and is never read properly.
Method loading config:

public static void LoadFromConfig() {
    configTitle = plugin.getConfig().getString("scoreboard_title");
    configEntries = plugin.getConfig().getStringList("scoreboard_entries");
}```
Config:
```yaml
scoreboard_title:
  - §3Title Here§r
scoreboard_entries:
  - " "
  - "§6Phase: §e$phase_display_name"
  - "§e$phase_time_remaining §6Remaining"
  - "  "
  - "$team_player_count"
  - "   "
  - "§2§lBTekGuild Events§r"```
drowsy helm
#

you'll either have to get the remapped jar or use the nms equivalent

drowsy helm
#

just pass the plugin instance

#

and use & instead of §

keen jolt
#

its called from a static method

drowsy helm
#

definitely static abuse

#

it may be calling before getConfig is intializing properly

keen jolt
#

no, i've taken extra care to make sure it's not

drowsy helm
#

does scoreboard_entries load properly?

keen jolt
#

yes

#

every time

shadow night
#

why do people abuse static so often

drowsy helm
#

and where are you debugging it

#

could be in between the loading and debugging where it is messing up

keen jolt
drowsy helm
#

like how are you verifying that it is null

keen jolt
#

It is initialized with a string value in the class, that method is called and should overwrite the value with whatever is in config

drowsy helm
#

can you show full code

#

just do a quick sout(plugin.getConfig().getString("scoreboard_title"))

keen jolt
#

sure hang on

keen jolt
#

maybe the symbol was the problem

drowsy helm
#

yeah just use alternate colourcodes

#

that character can fuck alotta things up

keen jolt
#

shoot it's still the same thing in game, scoreboard title shows up as my predefined string

shadow night
#

could getting and setting persistent data container every tick multiple times heavily mess up performance? Or is it pretty much okay?

slow temple
drowsy helm
#

but sounds like that could definitely be optimised

shadow night
shadow night
drowsy helm
drowsy helm
#

like why are you updating it every tick

shadow night
#

you know the mod ic2?

drowsy helm
#

yup

shadow night
#

basically, I'm trying to remake ic2 machinery using plugins

drowsy helm
#

gotcha

#

well i mean in isolation it wont be bad but if theres hundreds of PDCs updating every tick

#

that could be pretty bad

#

consider batch calculation and on-request calcs

shadow night
#

I rn have a furnace, the fuel slot is for fuel, the cooking time and fuel time is for fuel time and the result will be a glass pane (red, yellow, green) which name is the amount of energy stored from max

drowsy helm
#

name?

#

why name

shadow night
#

like, when you hover over the pane it tells you xxx/xxx (Energy Units) or something

drowsy helm
#

oh gotcha

#

and that has to update each tick

shadow night
#

yeah, checks and stuff

drowsy helm
#

Okay so hear me out, might be much more complex but if you REALLY want perfomance.
Keep track of last interaction with the block, if the player is currently interacting with the block update each tick, if not PAUSE the calculation, and next time they interact get the time between now and last interaction and calculate the energy produced between interactions

#

can be made into a formula, and means you only every have to calculate it once when the block is not being interacted with

#

and every tick only when the player is viewing it

#

idk if that makes much sense

shadow night
#

but if it's connected to anything that takes energy wouldn't that break?

eternal oxide
#

or update ticking machines every second, unless being viewed, then per tick

shadow night
#

hmm

drowsy helm
#

then you can just pass that into others' calculations

#

it can all be reduced to one or two equations and not have to do it per tick

shadow night
#

hmm, makes sense

drowsy helm
#

pretty sure thats how games like factorio and satisfactory do it

#

iterating through every single machine, every tick would add up exponentially

shadow night
#

so, instead of doing stuff every tick, I just calculate a formula to see how much its producing and use that?

drowsy helm
#

yeah, and if its something with limited runtime keep track of how long the fuel will last for example

shadow night
#

you read my mind, I just wanted to ask about fuel

drowsy helm
#

so

lastInteractionMillis = last interaction in time milliseconds
maxLength = how long fuel will last in milliseconds

output = min(lastInteraction - nowMillis, maxLength) * energyPerMillis
#

something like that

shadow night
#

hmm, that makes sense

drowsy helm
#

thats probably the most performant way to do it, but more work to figure out calculations

#

but will be hundreds of times faster than calculating each tick

shadow night
#

couldn't I count the time in a way to know how much fuel is spent if it's more than 1 and if it's more than the total amount of fuel just calculate it at that point?

drowsy helm
#

i dont understand sorry

#

could you rephrase

shadow night
#

its hard to explain

#

hmm

#

I'm confused now

#

oh no

drowsy helm
#

so with your furnace example does is the fuel worth x energy

#

or the furance constantly output x energy and the fuel powers it for x ticks

shadow night
#

🤔

drowsy helm
#

im confused with how the system works

shadow night
#

im generally confused

drowsy helm
#

okay so the furnace has xxx/xxx charge right

pseudo hazel
#

start by just making the machines run at 1 second per tick

drowsy helm
#

so it acts as a battery aswell as a generator

shadow night
#

yes

#

just like in ic2

drowsy helm
#

never played ic2 just know what it is so im pretty fresh on this

pseudo hazel
#

you would almost certainly need something that coordinates all updates

#

if you arent going to be updating every tick

drowsy helm
#

hold up im watching a video lol

pseudo hazel
#

since if you only update every so oftern, you would have to wait for some kther machines output

next stratus
#

Hey, I'm trying to remember the name of something but I can't remember it for the life of me, it allows you to spawn different items with different sizes etc. I think it's a 1.120 thing?

tender shard
#

Item Displays?

#

1.19.4

slow temple
#

im running buildtools.jar but no jar files are created, only java source files

tender shard
#

did it say "BUILD SUCCESS" at the end?

next stratus
drowsy helm
tender shard
#

there's also block displays and text displays btw

pseudo hazel
#

yes

slow temple
drowsy helm
#

ends up making life harder

pseudo hazel
#

but I dont see another way to do it

tender shard
next stratus
#

Thank you for that mfn 🙂

drowsy helm
tender shard
#

np

pseudo hazel
#

unless you have the generator pushing ticks to other machines

slow temple
#

already closed cmd

drowsy helm
#

calculate it on request instead of per tick

tender shard
drowsy helm
#

just calculate averages on request

next stratus
#

You know when you know exactly what you want but you can't work out what it's called? 😅

drowsy helm
#

its one calculation maybe every 10 seconds vs 100 a tick

shadow night
#

true

drowsy helm
#

okay i see how it works now

#

bare with me im gonna write something up

pseudo hazel
#

when is the request though

drowsy helm
#

meaning calculations are only being executed when they are required

pseudo hazel
#

yes I guess

#

but what about something that does not take item input or output

#

but then ither machines rely on it

shadow night
#

solar panels?

drowsy helm
#

the other machiens which rely on it will query it

#

the queries are chained

pseudo hazel
#

okay

shadow night
#

kinda like

  • hey, I need some energy
  • here, take 300 units
    ?
pseudo hazel
#

how does that not result in circular updates

drowsy helm
#
Fuel{
  amount
  energyPerConsumption = energy once fuel is consumed 
  consumptionTimeTicks = time in ticks which it takes to consume
}


lastInteractionTicks = time in ticks when last queried
lastInteractionEnergy = energy amount when last queried
maxEnergy 


on query ->
  currentInteractionTicks = time now in ticks
  
  currentEnergy = min(maxEnergy, lastInteractionEnergy + min(Fuel.amount, floor((currentInteractionTicks - lastInteractionTicks)/Fuel.consummptionTimeTicks)) * Fuel.energyPerConsumption)



#

then amount of fuel used is just

#

min(Fuel.amount, floor((currentInteractionTicks - lastInteractionTicks)/Fuel.consummptionTimeTicks))

pseudo hazel
shadow night
#

holy wheat

pseudo hazel
#

so what about a chain of machines that could run in a circle

shadow night
#

like?

pseudo hazel
#

idk some process

#

but with the recipes you can go back and forth and convert the same item etc

drowsy helm
#

letes say a furnace generates power, which powers a coal miner which feeds back into the furnace

pseudo hazel
#

which will inevitably happen with enough recipes and machines

#

yeah

ionic terrace
#

With making a bungee plugin, I presume you have to put the file in the plugins folder of the server?

drowsy helm
#

each time the miner generates coal, it will update the furnace

#

and queries it befoer it updates it

shadow night
#

lag machines go brrrr

pseudo hazel
#

okay so generators never update on their own

drowsy helm
#

so yeah you would have to have some limiter

drowsy helm
#

yeah thats a hard one steaf

#

i still feel updating every x time can be really detrimental

pseudo hazel
#

and how do you know when item machines should update if not being checked by the player

#

or do you just not

#

and only update retroactively

drowsy helm
#

this makes me want to try and write one of these lmao

shadow night
#

this shits confusing

drowsy helm
#

well the easiest way is updating every tick

shadow night
#

lag machines be like

drowsy helm
#

but performance is going to plummit with more than say 200 machines

#

okay wait

#

wait

#

tick buffer

#

hear me out

shadow night
#

tick buffer?

drowsy helm
#

machiens can only be queried every x ticks

#

meaning recursive queries wont work

#

but the calculations will still work as they will still calculate between last interaction

#

so an infinite loop will work but only update every x ticks which

#

and the buffer queues the query

pseudo hazel
#

okay o one machine querying another that was already queried in that time will just say the result is incomplete?

drowsy helm
#

there has to be some sort of priority to the queries

pseudo hazel
#

lets say you have 2 coal miners and in between a generator

#

teh coal miners need energy so they will query the generator

#

but they cant do it at the same time

#

since the generator can only push every x ticks

#

is that what you mean?

#

priorities will have to work based on direction

drowsy helm
#

yeah you raise a good point

#

raydan i hope you dont mind if i try and code this myself

#

i wanna give it a crack

shadow night
#

who am I to forbid it tho?

pseudo hazel
#

and then make a lib out of it

noble lantern
#

done, made it ||/s||

pseudo hazel
#

xD

drowsy helm
#

nah more like give up after a day

shadow night
#

make an bukkit energy library

noble lantern
#

i wanted to do ae2 in spigot

shadow night
#

thats cool

noble lantern
#

i have a whole idea for it laid out too but... effort

#

and no one would use vanilla energy tbh, at least thats why i never gave it a crack

noble lantern
shadow night
#

maybe if we made the BE library (Bukkit Energy) we'll have more tech plugins(?)

pseudo hazel
#

xD

#

yeah but it would have to be good

shadow night
#

it should implement what we talked about and some abstract classes

noble lantern
ionic terrace
#

Also is it possible to create a Spigot plugin that can also be used on Bungeecord servers? I know they have different API's but it could work with the right file structure?

noble lantern
#

ngl once i finish oraxen support for musepluse i should take a lok into that idea again since block displays are a thing

drowsy helm
#

i will be back in 20 hours

noble lantern
#

block displays for dah pipes

shadow night
#

that scares me

noble lantern
#

i love it

#

fuckin love ae2

drowsy helm
#

i just statrted satisfactory a week ago

#

have 70 hours already

shadow night
noble lantern
#

i wanna give satis a try but myeeeeh

#

gregtech guys

#

nomifactory gtceu trust me

shadow night
#

make sure you don't get fractureiser

#

jk

#

You can get it, I have no problems with that

#

jk

noble lantern
#

4 mins to figure what that was

#

then i forgot cf had that virus a week ago or so lmao

#

damnit now im all motivated to make a new plugin cause i hopped in here smh

shadow night
#

Relatable

noble lantern
shadow night
#

Hmm

noble lantern
#

and you could make it only use referances to blocks (machines), meaning it could almost be entirely async

#

as 9/10 times ur never gonna actually need main thread stuff when a machines processing stuff like making energy

#

i hate myself with these ideas

shadow night
#

🤔

noble lantern
#

its the 4am talkin

shadow night
#

1:27 PM for me lol

#

That's why the internet is cool

native gale
#

?java

#

Hmm

noble lantern
glad prawn
undone axleBOT
gloomy ocean
#

can someone please help, I need a plugin that limits the amount of a certain item someone can have on them at one time, but I can't find one

(Example, you could only have 2 totems or 5 golden apples on you and it won't let you get more than that)

native gale
#

I need to download Java 20 JDK and I kinda forgor

#

Where do I legally get it

noble lantern
#

oracle site :p

#

jdk/jre are bundled together in modern versions of java dont need to download 2 anymore if thats what ur thinking

#

just the one jar from oracles enough for dev + everyday use

#

you need an account iirc

glad prawn
#

i can download it without login

noble lantern
#

oracle scammed me

quaint mantle
#

okay so, im trying to add an ability system to my custom items, for the items i have a custom class that looks like this for example (HeadItem extends the class "CustomItem")

public class HighlightBread extends HeadItem {
    public HighlightBread() {
        super("http://textures.minecraft.net/texture/c86f7f24d45841c658730f5ea60c206663bbbd62ba67cac223d1483911884e45");
    }

    @Override
    public String getDisplayName() {
        return "%%COLOR_RED%%Highlight Bread";
    }

    @Override
    public String getId() {
        return "highlight_bread";
    }

    @Override
    public boolean isStackable() {
        return true;
    }

    @Override
    public EquipmentSlot getEquipmentSlot() {
        return EquipmentSlot.HAND;
    }

    @Override
    public Rarity getRarity() {
        return Rarity.UNOBTAINABLE;
    }

    @Override
    public List<String> getLore() {
        return null;
    }
}

Now what would be the best way to add an ability? I tried using an interface but before the ability gets used i want to do a check where u have enough "Mana" to use the ability, i want that in every ability, but i cant do that check with an interface since u cant have functions with definitions in there.

remote swallow
green plaza
#

use default key word

quaint mantle
#

o

#

then interfaces it is

#

cus thats prob the easiest way to do it

green plaza
#

The easiest way but no the best way is to add method getAbility() that will return Ability object

ionic terrace
# drowsy helm definitely

Is there an easy way of doing it as I've gotten to the point where I'm checking if bungee is installed and then calling completely replaced functions specific to bungee

green plaza
#

And this Ability object can have classes that extends it, for example u can Ability class and then u have WaterAbility instace that allow you to create WaterAbilities

quaint mantle
#

oh yea i could just return null if there is no ability

green plaza
#

or use Optional.ofNullable

quaint mantle
#

the hell is even that

green plaza
#

Optional allows you to check if something is null or not

#

I'll give u an example

#
            Optional<User> optionalUser = UserManager.getUserByUUID(player.getUniqueId()).findFirst();
            if (!optionalUser.isPresent()) {
                return;
            }
            User user = optionalUser.get();
#

And here you are sure that user is not null

quaint mantle
#

but in my customitem class i would add

public Ability rightClickAbility() {
        return null;
    }
    
    public Ability leftClickAbility() {
        return null;
    }

right?

#

cus i can overwrite m

#

or Optional<Ability>

green plaza
#

I dont know the whole project structure

#

So its hard to say

young knoll
#

Optionals are kinda meh

quaint mantle
ivory sleet
#

In java they’re clumsy (hence why the practice is only to return them from methods)

solid cargo
ivory sleet
#

Nope

#

Pathfinding is pretty much server sided

#

Maybe nms ye

tall siren
#

Hio! I'm struggling to configure NMS..

I heard in a forum post that you need to include spigot-server.jar, but I'm unfortunately unable to get it to work?

I keep receiving error: package net.minecraft.server does not exist, even though I'm using the --class-path argument correctly with both spigot-api.jar and spigot-server.jar.

Can anyb'dy please help meeeeeeeeeeeee.. ? ..

eternal oxide
#

?nms

eternal oxide
#

if you don;t want to use maven the easy way...

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

tall siren
#

I don't have Maven.

#

Or CMake for that matter.

chrome beacon
#

Um this is Java so no need for CMake

tall siren
#

I'm just using make.

chrome beacon
#

For Java?

tall siren
#

M'hm. Make as in build-essential/oldstable,now 12.9 amd64.

#

I use it for everything.

quiet ice
#

I'm impressed. People generally don't do that

tall siren
#

Why's it impressive and why don't people generally do it?

quiet ice
#

Because we have maven and gradle. If you want it complicated there is ant

#

But make is very rarely used in java space

chrome beacon
#

I haven't seen anyone use make for Java

quaint mantle
#

wait my math is being dumb, if i wanna draw a line between two points with particles, like from the player's eye to a certain point, whats the best way?

quiet ice
#

Regardless, you don't want to use make in conjunction with NMS. If you really wanted to you'd need to be very aware of the tools you have at your disposal (such as tiny-remapper, mojmap, etc.) but chances are you don't

tall siren
#

Maven and Gradle are bloatware.

#

Sort of like CMake in a way..

tall siren
#

Thus far I've not needed anything other than make?

quiet ice
#

Because otherwise you'll have a LOT of pain going forward

tall siren
#

I technically don't even need make, I could simply use shell scripts like I used to.

quiet ice
#

NMS is obfuscated by default. TR and mojmap helps to get sane names

shadow night
tall siren
#

Couldn't one just use a Java-decompiler?

quiet ice
#

You may (read: you definetely given that you won't use an IDE) also need to use Recaf or if that is bloatware too - Quiltflower and CFR.

tall siren
#

I use vi.

#

Vim is a little to far on the bloated side for my taste honestly.

quiet ice
shadow night
#

that's a pain

#

I've seen and tried that myself

quiet ice
shadow night
quiet ice
#

I haven't seen anyone ship naked vi installs seperately from vim for a while now.

shadow night
#

I haven't seen anybody use anything lower than neovim lol

quiet ice
#

Also, what the hell are you doing with spigot if that is your concern?

#

I'm the nano guy if I really need to change anything in the CLI. Though I can make use of basic vi

shadow night
#

nano is weird imo

tall siren
quiet ice
#

At least I don't have to remind myself of differences between distros

shadow night
shadow night
#

._.

tall siren
#

I used to use Leafpad but honestly gedit is better.

#

In regard to GUI Notepad software.

quiet ice
#

Under fedora using :save && :qa! suffices. However under Windows you need to use :wa && qa! which is just ... why

tall siren
#

:wq ; :w ; :q! is fine.

shadow night
#

I always do :wqwhen I use nvim

quiet ice
#

Won't flush all buffers

tall siren
#

Anyway can you stop judging me for what descendant of ed I use?

shadow night
#

maybe

tall siren
#

I need help including nms.

shadow night
#

sure

tall siren
#

If you don't know how, it's fine.

alpine urchin
#

lol

eternal oxide
#

I already told you how to use nms

tender shard
#

the only official way to use NMS in spigot is using maven

#

the blog post was linked to you above

quaint mantle
#

can i get the endpoint of a raycast without it having hit?

tall siren
#

But maven is bloaattttt!! 😭

quiet ice
#

Either don't (recommended), use maven (next best thing), use gradle with paperweight (if you are really desperate) or follow ElgarL's advice and use the correct (non-bootstrap) jar (if you are suicidial)
Those are your four options. No more no less

eternal oxide
#

I also told you how to use nms without maven

shadow night
#

bruh ._.

tender shard
#

what do you even need NMS for

shadow night
#

I use maven even on my tablet

tall siren
tender shard
#

if you just use NMS without maven or gradle then you'll only have the obfuscated mappings with method names like a(), b(), c() and they will change on every new version

eternal oxide
#

you can read

tall siren
eternal oxide
#

tps?

quiet ice
#

Bruh, this is spigot. The entire world is running at the same tps

tall siren
#

Yes, but what regions are taking the longest to tick?

quaint mantle
#

nice eye direction, game 👍

eternal oxide
#

games fine, your math is bad

quiet ice
#

And you can't modify nms as-is. If you want that while still keep using bukkit you need to use ignite or other similar transform layers
Which means that you cannot run your plugin under bukkit without these (usually external) transform layers

quaint mantle
# eternal oxide games fine, your math is bad

Location endLoc = event.getPlayer().getEyeLocation().getDirection().multiply(getRange()).toLocation(caster.getWorld());
shouldnt that just get 7 blocks away from where the player looks?

eternal oxide
#

no

tall siren
#

I can detect what regions are taking the longest to tick, I just need to get the most TPS. Which I saw in a post on the forum, however I cannot manage to get it to work.

I keep receiving error: package net.minecraft.server does not exist, even though I'm using the --class-path argument correctly with both spigot-api.jar and spigot-server.jar.

quaint mantle
eternal oxide
#

you multplied a unit vector and made it a Location. You basically tried to draw a vector back to near 0,0,0

quiet ice
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

quiet ice
#

Then do /s/1.18/1.20/

quaint mantle
#

im already doing a raycast to check if i hit an entity or block but it returns null when it hits nothing sadly

tall siren
eternal oxide
#

player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(7))

tall siren
#

I'm not a genius, okey..

quiet ice
#

It just means that you need to depend on the ENTIRE contents of the bundler dir

tall siren
#

That's ridiculous.

tender shard
#

imagine asking for help and then ignoring every advice and calling it ridiculous lol

#

I'm out

tall siren
#

I'm asking for it to be done a certain way.. That's all..

#

I don't want to use maven, and I don't want to use eclipse.

tender shard
#

it's mentioned in the ?bootstrap message

quiet ice
#

Alternatively do the maven dependency resolution yourself. The org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT artifact is located under ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT.jar @tall siren

tall siren
#

I've done that. But I can't do it with NMS..

quiet ice
#

Did you run BT yet?

tall siren
#

BT?

#

What on Earth?

quiet ice
#

Oh god.

tender shard
#

?bt

undone axleBOT
quiet ice
#

?bt

undone axleBOT
tall siren
#

I don't want to install anything on my System.

tender shard
#

then you can't do anything on your system

eternal oxide
#

Then stop trying to dev for Minecraft

quaint tapir
#

I have a question about adding lore to items
can I add a line to the lore that is visible and also add a line which is hidden?
to the same item

quiet ice
#

Okay well then. I'll show you how to do it in the gray zone

tender shard
#

the whole purpose of lore is to be visible

quiet ice
#

(what was that repository again?)

quaint tapir
#

to store data about the item

#

I'm making custom durability

tender shard
#

use the PersistentDataContainer to store information

quaint tapir
#

basically

tall siren
#

I heard in a forum post that you need to include spigot-server.jar, but I'm unfortunately unable to get it to work.

#

Why won't it work?

calm robin
#

persistent data is too slow to be useful

quaint tapir
#

so theres no way to do it in the lore?

#

???

tender shard
eternal oxide
quiet ice
tender shard
#

use PDC to store data in items

#

that's what it was made for

young knoll
tall siren
#

When inlcuding the spigot jar I keep receiving error: package net.minecraft.server does not exist, even though I'm using the --class-path argument correctly with both spigot-api.jar and spigot-server.jar.

eternal oxide
#

we already answered this one

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

quiet ice
tall siren
#

You told me to include the entirety of the builder thingy, yes. But I'm asking if there is a way to do this without having to be so ludicrous.

eternal oxide
#

no

tall siren
#

If perhaps you did answer me I might have missed it, and for that I apologise.

eternal oxide
#

stop being obnoxious and you'd have already had a full maven setup going

shut sphinx
#

you dont need maven lol

#

whats she trying to do?

quiet ice
#

Also: Maven is portable. You can just delete maven afterwards

quiet ice
eternal oxide
#

of course you don't, but its easier

tall siren
quiet ice
#

Won't accept using bt and gradle either

tall siren
#

Somebody with a brain.

tall siren
eternal oxide
#

Can;t help then. Buildtools is the ONLY legal way to obtain spigot

tender shard
#

you guys haven't blocked her yet? lol what a waste of time

eternal oxide
#

yes

quiet ice
#

spigot spigot. Not spigot spigot-api

shut sphinx
#

can get it from spigotmc right?

eternal oxide
#

no

shut sphinx
#

just download the spigot jar?

quiet ice
eternal oxide
#

no

shut sphinx
#

or u mean something else?

eternal oxide
#

no

shut sphinx
#

like not the server jar?

#

or the api?

#

or what?

#

lol

eternal oxide
#

there is no legally hosted spigot jar

glossy venture
quiet ice
#

She wants org.spigotmc:spigot:1.20-R0.1-SNAPSHOT

tall siren
#

No I'm gnot.

eternal oxide
#

She wants to use nms so needs the full spigot

quiet ice
#

Spigot only hosts org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT

eternal oxide
#

Only legal way to obtain the full spigot is to run buildtools

tall siren
#

I need NMS.

#

I'm happy to work through obfuscation.

glossy venture
# tall siren No I'm gnot.

two options

  1. run buildtools and install it into maven local/include the produced shit
  2. use gradle and paperweight userdev for the paper api + nms (remapped automatically)
tall siren
#

What's option #3?

quiet ice
glossy venture
#

none

quiet ice
#

But beware: I've shown you how to do it illegally.

glossy venture
#

that might get taken down

#
  • you still need specialsource in maven to remap your code
quiet ice
glossy venture
#

oh

eternal oxide
#

md5 does go after maven repos hosting spigot

glossy venture
#

isnt it illegal

quiet ice
#

Ah huh

glossy venture
#

to host built jars

eternal oxide
#

he has to, legally

tall siren
proud palm
#

hello I've a problem. I've installed a datapack and it's working in localhost with out op, but in the host it's need op

quiet ice
tall siren
#

Because of fractureiser?

eternal oxide
#

?dmca

undone axleBOT
glossy venture
#

some stupid dmca by a salty bukkit dev

quiet ice
#

You are officially trolling

young knoll
#

I mean even without the DMCA

tall siren
glossy venture
young knoll
#

You can't redistribute Mojang code

quiet ice
glossy venture
#

its double illegal

tall siren
shut sphinx
#

klarana lol

glossy venture
#

because u dont know wtf ur doing

quiet ice
shut sphinx
#

i think ik what u need

tender shard
tall siren
tall siren
shut sphinx
#

u trying to include some spgiot.server.jar and not wortking?

#

cos spigot not have net.minecraft

tall siren
#

If that's what package net.minecraft.server does not exist means, then yes.