#help-development

1 messages · Page 411 of 1

vernal oasis
vocal cloud
#

is that visual studio

river oracle
#

probably vscode

tardy delta
#

Vsc

river oracle
#

He might not have correct repository / not java extension pack

vocal cloud
#

I'd switch to a java IDE. Heck even eclipse would be better

vernal oasis
#

nah, I'm good, just not used to mac

#

I'm at home for a week

#

I've been coding plugin with vscode on my windows pc

rough ibex
#

you're missing the spigot repo

vernal oasis
#

bruh

rough ibex
#

        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>```
#

this is the repository.

vernal oasis
#

w8, did I put my repo where the spigot repo should be...

#

.-.

rough ibex
#

?

#

Just add the above into the <repositories> tag

vernal oasis
#

like so?

rough ibex
#

Yes.

#

I don't know how to reload maven changes in vsc

vernal oasis
#

thank, do I even need my repo there? or should I just remove it?

tardy delta
#

Mvn reload?

vernal oasis
#

nah you just click a button :)

rough ibex
#

you should not need it there, no

#

Since you're not depending on it (you wouldn't be, anyway.)

vernal oasis
#

I missread something somewhere then lol

#

The forum guide is a little outdated so

#

Thank you, and I did not eat your butter.

rough ibex
#

a 7 year old joke

vernal oasis
#

perhap

#

you chose your fate

torn shuttle
#

has anyone run into issues where fireworks that get stuck in weird places will stay alive functionally forever?

fluid river
#

no ig

copper dove
#

so i got a friend that is making a little prison server for him and his friends he asked me to code a custom enchant for 3x3 mining well i have got everything setup but when i add the enchant to the pickaxe and mine it does 3x3x2 and i want it to do 3x3x1 and i cant seem to figure out what i have done wrong in my code so i figured i would come n ask here to see if i could get some help

@EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        Block block = event.getBlock();
        ItemStack item = player.getInventory().getItemInMainHand();
        player.sendMessage(item.getEnchantments().toString());
        if (item.getEnchantments().containsKey(Enchantment.getByKey(Kiki_pick.explodeEnchant.getKey()))) {
            List<Location> locations = new ArrayList<>();
            int locRad = 3;
            int r = locRad - 1;
            int start = r / 2;
            Location sL = block.getLocation();
            sL.setX(sL.getX() - start);
            sL.setY(sL.getY() - start);
            sL.setZ(sL.getZ() - start);
            for (int x = 0; x < locRad; x++) {
                for (int y = 0; y < locRad; y++) {
                    for (int z = 0; z < locRad; z++) {
                        locations.add(new Location(sL.getWorld(), sL.getX() + x, sL.getY() + y, sL.getZ() + z));
                    }
                }
            }
            for (Location loc : locations) {
                loc.getBlock().breakNaturally(item);
            }
        }
    }
tender shard
#

does it do 3x3x3 or 3x3x2?

#

you are looping over x, y, and z. usually you would only want to loop over 2 dimensions instead of 3

copper dove
#

its mining 3x3x2

tender shard
#

does the orientation work correctly? e.g. it always goes 2 in depth, no matter in which direction you are mining?

#

depending on the direction, you should not change the x or z value

#

when looking at positive or negative x, you should only loop over y and z, and when looking in z direction, you should only loop over x and y

copper dove
copper dove
wet breach
#

no

#

you only need to loop half the directions if its even

#

because you can just simply mirror

#

however you should loop over y first

#

since it is the smallest

copper dove
#

well i guess im confused at this

wet breach
#

an example how you can mirror

#

is lets use your above code for an example

rotund ravine
#

Just mirror four times smh.

wet breach
#

locations.add(new Location(sL.getWorld(), sL.getX() + x, sL.getY() + y, sL.getZ() + z));

locations.add(new Location(sl.getWorld, sL.getX() + (x*-1), sL.getY() + (y*-1), sL.getZ() + (z*-1));
#

so the first one is your original, which would go in one way

#

the second, will go the other way at the same time

#

this is the easiest way

#

there are other ways depending how familiar with math you are, to mirror

#

so with that shown and said, you now don't need need to loop for all directions, just half of them 😉

glad prawn
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

tender shard
#

IJ being drunk again

#

you created two instances of your class

tawny remnant
tender shard
#

so the list you access in the command is not the same list as the one you access in the listener

#

use the same instance of your class for both, the command and listener. or, better: do not mix listeners and commands in one class

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

tawny remnant
tender shard
#

did you register the listener? do all the if statements even get executed? add a debug statement to each if statement to see if they actually eveluate to true

#

why that?

#

just use the same List<String> in both classes

#

this was a reply to the "why isnt my anvil working" message

#

as I already said, your List<String> doesn't work because you created two instances of your class

#

yep, that should fix it

tawny remnant
quaint mantle
tender shard
tawny remnant
tender shard
#

yeah because you add the lore to "inputItem"

#

why don't you just use the PrepareAnvilEvent to change the result? And why do you add any lore to the input item in the first place?

#

usually you never change the input items, but only the result item

regal geyser
#

hey, i have a question

#

how can i learn bukkitapi (kotlin)?

icy beacon
#

take a look at the guides, I personally learnt from Kody Simpson on YouTube

#

basic kotlin knowledge is expected

regal geyser
icy beacon
regal geyser
#

ok

#

thanks for your help

icy beacon
#

np

regal geyser
tender shard
#

do you actually need anything from paper api? if no, there's no reason to use it

regal geyser
#

thats it

eternal night
#

you can code a plugin against the spigot-api and still run it on paper

tawny remnant
#

?gui

#

what is the command please?

icy beacon
#

?cc list in #bot-commands

#

?guis

undone axleBOT
icy beacon
#

I do advice to use a gui library

#

because working with raw gui spigot API is masochism

tiny ferry
#
public int getPing(Player p) {        
  int ping = p.getPing();
  return ping;
}

always returns 0 for some reason (not on localhost)

icy beacon
#

first of all, why is this a separate function if you can just call Player#getPing?

tiny ferry
#

it was some old method which i had to redo because of updates, used to do something like this

Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);

#

wait... maybe i know why

#

ah still doesent work if i rename method

dire marsh
#

it takes a while to update

tiny ferry
#

ahh you are right thank you

undone yarrow
#

@eternal oxide you posted this code for the issue I had but that'll always return true. Shouldnt it be checking if the slot from the event is 36?

    @EventHandler
    public void onSwap(PlayerSwapHandItemsEvent event){

        if (slotToLock == 36 || slotToLock == 45)
            event.setCancelled(true);
    }```
#

Seems like an odd piece of code, but perhaps Im too stupid to understand it

eternal oxide
#

no

#

on swap is only for swapping hands so you only prevent it IF you are protecting slot 1

undone yarrow
#

Ohh alright

#

I also added a cancel drop event, Ill be testing it now

eternal oxide
#

one sec I'll pull up the current code

undone yarrow
#

Uhh I think it's broken

eternal oxide
#

?paste

undone axleBOT
undone yarrow
#

Swapping now doesnt work for anything

eternal oxide
#

mine works, apart from drop as thats just sample code

#

mine is using slot 0-8

#

as it doesn;t use raw

#

all you have to do is check it's the correct item

undone yarrow
#

Nevermind it works, although the onSwap prevents me from swapping anything

#

@EventHandler
public void onSwap(PlayerSwapHandItemsEvent event) {

    if (slotToLock == 0)
        event.setCancelled(true);
}
#

and that's not really wanted

eternal oxide
#

I see

#

slot 0 may not be the equipped

undone yarrow
#

yeah

#

I can't find something to do with slots when ccalling event.

wraith cipher
#

PlayerInteractEvent fires EquipmentSlot.HAND twice when RIGHT_CLICK_BLOCK

eternal oxide
undone yarrow
#

True, Ill do that instead

eternal oxide
#

else ```java
@EventHandler
public void onSwap(PlayerSwapHandItemsEvent event) {

    if (event.getPlayer().getInventory().getHeldItemSlot() == slotToLock)
        event.setCancelled(true);
}```
#

but noit neded for you as you can just check for your specific item

#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
eternal oxide
#

@wraith cipher ^

undone yarrow
# eternal oxide but noit neded for you as you can just check for your specific item

Right now Im using java @EventHandler public void onSwap(PlayerSwapHandItemsEvent event) { if (event.getMainHandItem().getType() != Material.NETHER_STAR || !event.getMainHandItem().hasItemMeta()) return; if(event.getMainHandItem().getItemMeta().getCustomModelData() != 1) return; event.setCancelled(true); }
But it still allows me to switch to my offhand, but it doesnt allow me to switch it back to my main hand

eternal oxide
#

check offhand too

#

like java if (yourCustomItem.equals(event.getMainHandItem() || yourCustomItem.equals(event.getOffHandItem()) event.setCancelled(true);

#

I'm assuming your custom item is unstackable adn they will only every have one

#

if not

#
if (yourCustomItem.isSimilar(event.getMainHandItem() || yourCustomItem.isSimilar(event.getOffHandItem()) event.setCancelled(true);```
undone yarrow
#

It is stackable but players wont be able to obtain multiple

#

hopefully

eternal oxide
#

then use isSimilar as that ignores quantity

undone yarrow
#

Should yourCustomItem just be the Itemstack with a custom itemmeta?

eternal oxide
#

its also easier than checking the type and model data separately

#

it shoudl be the item you give to the player

undone yarrow
#

k

eternal oxide
#

in yoru code you should create it once (probably static) and keep it available

#

so MyCustomItems.NETHER_STAR

undone yarrow
eternal oxide
#

create a private method

#

then your field would be static ItemStack NETHERSTAR = getStar();

undone yarrow
eternal oxide
#

yep. make the method private so it can only be called inside your items class

weak meteor
#

If i make a constructor from the Listener Class to another class, i can manage the event from the other class?

eternal oxide
#

naming conventions also say thi sis a constant so shoudl be all upper case

#

same as an enum

weak meteor
#

Just wanna know bcause i have to listen to like 7 inventories

eternal oxide
#

Yes, just add a method in the other class to accept the event

weak meteor
#

Okay

#

Thanks

#

To cancel properly the inventory click event in a custom inv should be like this:

  • all the listener stuff and that *
    if (e.getView().getTitle().equalsIgnoreCase("inv title)){e.setCancelled(true)}

Or
(e.getView().getTitle.equals("Inv title)){ e.setCancelled(true)}

#

just confused because any of that works

eternal oxide
#

don;t compare inventories by title, use their instance

undone yarrow
#

But it also doesn't say rightclicked if I check if the item == netherStar in onPlayerInterct

eternal oxide
#

not != use .isSimilar in swap

undone yarrow
#

what is that sentence

eternal oxide
#

err in drop

weak meteor
eternal oxide
#

in drop java if netherStar.isSimilar(event.getItemDrop().getItemStack()) event.setCancelled(true);

undone yarrow
#

So I think item.getItemMeta().setCustomModelData(1); isnt working

eternal oxide
#

your logic is reversed

undone yarrow
#

or that

eternal oxide
#

you no longer need those checks

#

all you do is java if (netherStar.isSimilar(item)

#

no checking meta nor the model data

undone yarrow
#

But how is that going to fix my issue

weak meteor
#

@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Inventory clickedInventory = event.getClickedInventory();

if (clickedInventory != null && clickedInventory.equals(inventory)) {
  e.setCancelled(true)
}

}

eternal oxide
#
public void onPlayerInteract(PlayerInteractEvent event) {

    Player player = event.getPlayer();
    ItemStack item = player.getInventory().getItemInMainHand();
    if (netherStar.isSimilar(item)) {
        Bukkit.broadcastMessage("Clicked");```
weak meteor
#

Smth like that?

eternal oxide
#

use == to compare instance

#

so clickedInventory == inventory

lost matrix
#

If you create a Listener for every GUI or you check for every GUI inventory by name or with equals/== then you
are doing something wrong. This scales poorly and you are just repeating your code for every new inventory.

undone yarrow
#

Im checking if it has custommodeldata so idk what's happening

weak meteor
#

@lost matrix can you answer me a doubt?

lost matrix
#

Sure

eternal oxide
#

I showed you the swap method.

#
if (yourCustomItem.isSimilar(event.getMainHandItem() || yourCustomItem.isSimilar(event.getOffHandItem()) event.setCancelled(true);```
weak meteor
# lost matrix Sure

Here ur only indexing stuff into the Map for the inventories right?
And the handler is the same from the InvetoryHandler interface for every onClick, onOpen and stuff?

undone yarrow
# eternal oxide I showed you the swap method.

Yes, but it didn't work. The entire thing revolving around defining netherStar = getStar broke the entire piece of code. I didn't feel like fixing everything over so I stuck with the code that did work and only had 1 little issue

#

Now I fixed that issue and it has 1 even tinier issue

eternal oxide
#

that code I just posted will work for swapping

#

if either hand is one of your custom stars it will cancel

undone yarrow
#

Yes but that doesnt fix the other 3 functions that broke

lost matrix
eternal oxide
#

ok your interact is still using bad/old code

#

you don;t have to check meta nor model data anymore

undone yarrow
#

Why not

eternal oxide
#

thats what your item is for

undone yarrow
#

The item that broke everything?

#

and which i thus removed

lost matrix
lost matrix
#

Always use the PDC to check for custom items

eternal oxide
#

the item is fine

undone yarrow
lost matrix
echo basalt
#

also modeldata only stores like

#

1 single number

#

PDC stores a lot more

undone yarrow
#

Why would I want it to store more

echo basalt
#

Let's go back to ooga booga time and store a single number for every time we need data

undone yarrow
echo basalt
#

PDC is basically an NBT wrapper type thing

#

You can store custom objects, binary data

#

And it's not limited to just items

#

?pdc

undone yarrow
#

I get it, PDC is cool, but you're missing my point

#

Why would I need to store more info

#

I just need 1 number

#

to identify what item it is

lost matrix
echo basalt
#

future expandability pretty much

#

What if in the future, you want to have multiple tiers to your nether star?

undone yarrow
echo basalt
#

Well whatever I'm not going anywhere by suggesting good practices to someone that's in denial

undone yarrow
#

Why am I in denial

#

Im just wondering why I should use PDC if I only want to store 1 thing

lost matrix
#

For why:
What if you wanted to have 2 items which use the same model
but do different things. For example one is a mildly upgraded
version of the other. Then you need to check for the model data
and something else. Extrapolate this idea and you will have a horrible
mess.

eternal oxide
#

You may onl;y want one thing today. Tomorrow you may expand

undone yarrow
#

Hmm let me think

#

1 sec

echo basalt
#

aren't you vaccinated?

undone yarrow
#

Vaccinations actually give you a higher chance of sideeffects compared to non-vaccinated nowadays

#

But let's leave that out of the chat

lost matrix
#

That violates the open closed principle. Your code should always be open to
to extension but closed for modification. This automatically makes your code
more modular without having to put extra time into it.

undone yarrow
#

before we start a war

echo basalt
lost matrix
#

You dont lose time when writing scalable code if you just always follow the SOLID principles.

echo basalt
#

Dependency inversion is a bit of a pain

#

rest is cool

ivory sleet
#

None of the principles should be followed religiously to the fullest

lost matrix
#

Well yeah. Take them a bit softer

undone yarrow
#

k I think pdc might work for this seeing as I do want to store "spells"/powers in the netherstar (I think?)
Basically what I want to do is:
Every player has their own netherstar that, when they right click, opens up a new hotbar containing "spells". I think it might be useful to store those spells inside the pdc instead of inside a different function that stores them for each player. But that also means that if the player loses that one netherstar for some reason, all of the spells inside are gone right? If I store the spells inside a different object that is assigned to a player, it won't ever disappear (unless someone deletes the config)

ivory sleet
#

They’re guide lines to make your code as future proof as possible towards changes

echo basalt
#

regardless, you shouldn't really store data in configs

#

SQLite or literally any other database works better

undone yarrow
#

We were talking about how great PDCS are and now you go to UUIDs

#

whatever those are

eternal oxide
lost matrix
#

And finding out which ones need to be is usually part of the project planning phase.
But nobody here uses a Waterfall or Agile approach when they write their plugins.
They just write it and add a bunch of stuff over the years.

ivory sleet
#

Scrum :D (/s)

eternal oxide
#

so your item never had custom model data

undone yarrow
#

oh

#

I thought the .setcustommodeldata would do that

lost matrix
ivory sleet
#

Not inherently

#

You need to set the modified meta back

undone yarrow
#

So it should be

    private ItemStack getStar(){
        ItemStack item = new ItemStack(Material.NETHER_STAR);
        item.setItemMeta(item.getItemMeta().setCustomModelData(1));
        return item;
    }```
ivory sleet
#

Almost

#

store the itemmeta in a variable
modify it
set the meta back to the item by using the variable

echo basalt
#

I've been coding for a while and even I had to rewrite an npc system 3x this week

undone yarrow
#

Yes but thats like 3 lines. Why not make it 1 line

echo basalt
#

dw the interface:actual class ratio is like 3:1 now

lost matrix
ivory sleet
#

I mean scalability is more of a point when we talk about capacity, that is concurrency often. Else it’s just maintainability, quite the difference

echo basalt
#

uhh It's a fancy wrapper for citizens

#

but if you want to learn about making them look at a location

#

you just send packets with the npc's entity id

lost matrix
#

Eh. I wrote this so that i can get away from the citizens mess of a plugin.

echo basalt
#

Citizens does so by calling NMS.lookAt(npc.getEntity(), yaw, pitch)

ivory sleet
echo basalt
#

It delegates to PacketPlayOutHeadRotation

ivory sleet
#

idk

echo basalt
#

or ClientboundWhatever

ivory sleet
#

Design choice from api designers justin

echo basalt
#

lemme find you the packet

#

first time I help someone I look up to

hybrid spoke
#

are gambling plugins allowed on spigot

echo basalt
#

don't think so

#

time to wait 5 years for my IDE to index

hybrid spoke
#

yeah ik but free ones? couldnt find anything about it

echo basalt
#

actually there's a PlayerNPC thing that uses packets

echo basalt
#

@lost matrix if you're using an EntityPlayer internally

eternal oxide
#

fixed

lost matrix
undone yarrow
echo basalt
#

Uhh

#

let's see

#

I had some way to make regular entities move around

eternal oxide
#

yes that on click code is only to lock a specific hotbar slot

echo basalt
#

But yeah just send both packets

#

and it should worky

wispy wyvern
#

hello guys, i'm trying to create a custom block, and i would like to use something like /mycmd give user 4 but i dont know how to pass my args in the command usage.

public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
    if (!(sender instanceof Player)) {
        sender.sendMessage("Only players can use this command.");
        return true;
    }

    Player player = (Player) sender;

    ItemStack item = new ItemStack(Material.GOLD_BLOCK, 1);
    Inventory inv = player.getInventory();

    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName("&6Gold Machine");
    item.setItemMeta(meta);

    inv.addItem(item);

    return true;
}
undone yarrow
eternal oxide
#

it will only protect a specific slot, doesn;t matter what item it is

undone yarrow
#

I know

#

but as I said, it doesnt protect the slot

eternal oxide
#

it works as I tested it

undone yarrow
#

Assuming the slot is the first slot in hotbar

eternal oxide
#

yes

echo basalt
undone yarrow
echo basalt
#

new discord update killed imags :/

eternal oxide
#

your issue is you are testing currentItem

undone yarrow
#

Ah I see

lost matrix
eternal oxide
#

so hovering over a slot and pressing 1 does not return slot 1 contents for getCurrentItem. it returns the item ion the slot you are hovering

#

you need to player.getInventory().getItem(event.getHotbarButton())

#

if event.getHotbarButton() != -1

undone yarrow
#

👍

echo basalt
#

make sure it doesn't look like this

lost matrix
#

Thats just the gif resetting

undone yarrow
# eternal oxide so hovering over a slot and pressing 1 does not return slot 1 contents for getCu...

I changed it to this so that players can still drop items in their first slot if it's not a netherstar, which works, but now swapping doesn't work correctly

    @EventHandler
    public void onClick(InventoryClickEvent event) {
        if ((event.getSlot() == slotToLock && event.getSlotType() == InventoryType.SlotType.QUICKBAR)
                || (event.getHotbarButton() != -1 && event.getHotbarButton() + slotToLock == slotToLock)) {
            if (!netherStar.isSimilar(event.getCurrentItem())) return;
            event.setCancelled(true);
        }
    }```
eternal oxide
#

you no longer need any slotToLock code

#

you have an item to test

undone yarrow
#

Hmm true

eternal oxide
#

you are not using any of the code I just told you

undone yarrow
#

The
player.getInventory().getItem(event.getHotbarButton())
if event.getHotbarButton() != -1
part?

eternal oxide
#
    @EventHandler
    public void onClick(InventoryClickEvent event) {
        if (event.getHotbarButton() != -1 && netherStar.isSimilar(event.getPlayer().getInventory().getItem(event.getHotbarButton()))) {
            event.setCancelled(true);
    }```
#

probably

undone yarrow
#

Only problem now is when I use /give me nether_star{customModelData:1} it gives me 2 instead of 1

eternal oxide
#

nothign to do with any of that listener code

undone yarrow
#

No that's what I thought

#

but what else would it be

#

Perhaps there's an event being triggered

#

causing it to duplicate..., somehow?

wispy wyvern
#

why is this not working as it should?

command file

public class Machine implements CommandExecutor
{
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
    {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can use this command.");
            return true;
        }

        Player player = (Player) sender;

        if(args.length == 0) {
            player.sendMessage(ChatColor.RED + "Correct usage: /machine <amount>");
            return false;
        }
        if (args.length >= 1) {
            ItemStack item = new ItemStack(Material.GOLD_BLOCK, Integer.parseInt(args[0]));
            Inventory inv = player.getInventory();

            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(ChatColor.GOLD + "Gold Machine");
            item.setItemMeta(meta);

            inv.addItem(item);
        }
        return true;
    }
}

plugin.yml

commands:
    machine:
        description: Machine command.
        usage: /machine
        aliases: mcn
        permission: machines
        permission-message: You do not have permission to execute this command.
lost matrix
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

wispy wyvern
#

it doesn't reply with the correct usage, neither give me the custom item

tender shard
#

what does it reply with

wispy wyvern
#

/machine

tender shard
#

you didnt register the command executor

wispy wyvern
#

true

#

but should it work?

tender shard
#

only if you register the command

#
public void onEnable() {
  getCommand("machine").setExecutor(new Machine());
tawny remnant
#

I need help. I want to check for the item in slot 10 and 12 and if they match with what i want then after clicking slot 14 you get a result in slot 16. After clicking slot 14 nothing happens! please help
https://paste.md-5.net/igadosobas.java

tender shard
#

what's CSTMItems?

wispy wyvern
#

it worked now, but it still send /machine

tender shard
#

you mean when no amount is entered?

#

that's because you "return false"

#

return false = "show usage"

tawny remnant
tender shard
#

ah ok, I thought it was your main class

wispy wyvern
#

if i dont return, it wont send /machine?

tender shard
#

you gotta "return true"

wispy wyvern
#

oh ok

tender shard
wispy wyvern
#

should i use ChatColor.COLOR + "Gold Machine" when setting the display name or use some different method?

tender shard
#

yes

wispy wyvern
#

ok

tender shard
#

if you wanna make it configurable, yu can use ChatColor.translateAlternateColorCodes

#
String name = "&cGod Machine";
String transatedName = ChatColor.translateAternateColorCodes('&', name);
#

that turns "&c" into red

wispy wyvern
#

yea i know the color codes

#

that's interesting

#

thanks

tender shard
#

np

lost matrix
tender shard
#

what is 5 & 6?

tawny remnant
wispy wyvern
#

can i check if my custom item was placed?

tender shard
#

it does print "here4", but neither "here5" nor "here6"?

#

because that actually can't be

wispy wyvern
tender shard
#

however rather use PDC tags

#

you should never rely on names to identify your custom things

wispy wyvern
#

i can create custom tags?

tender shard
#

yes

#

PDC can store basically any data

#

you could e.g. store a boolean "isMyCustomGoldBlock", or a string like "myCustomItemId" if you have more than one custom item, etc

ivory sleet
#

Tom2 :0

#

Where’s Tom1

lost matrix
#

Spawned at another location to test it out. But he doesnt have a cool skin so i spawned Tom2 XDD

tender shard
#

and where's Tom0

ivory sleet
#

🥲

lost matrix
#

Oh dang there is propr. info in that vid...

#

Nobody ask about those multiple lines in the action bar pls

undone yarrow
# eternal oxide nothign to do with any of that listener code

I tried doing this to fix it, but now whenever I interact with any item that has more than 1 just gets set to 1.

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        ItemStack item = player.getInventory().getItemInMainHand();
        int count = 0;
        for (ItemStack i : player.getInventory().getContents()) {
            if (i != null && netherStar.isSimilar(i)){
                count += item.getAmount();
                if (count >= 2) {
                    item.setAmount(1);
                    break;
                }
            }
        }

        if (event.getAction().name().contains("RIGHT") && netherStar.isSimilar(item)) {
            Bukkit.broadcastMessage("Rightclicked netherstar");
        }
    }```
I'm checkiing if it's the right netherstar though? Why is this happening
ivory sleet
lost matrix
#

Ah yeah you know how its done 😄

ivory sleet
#

:>

undone yarrow
#

I saw them and I thought they looked pretty cool

eternal night
eternal oxide
undone yarrow
#

Couldnt find it though :/

eternal oxide
#

then keep looking

#

you are either using the give command incorrectly or you have some code doubling it up

undone yarrow
#

This is literally the only code Im using

#

And an onenable that instantiates it

#

but that's it

eternal oxide
#

?paste unreadable for long pastes in Discord

undone axleBOT
undone yarrow
eternal oxide
#

nothing in that code is causing multiple items

undone yarrow
#

Exactly

eternal oxide
#

then it's not that class. look elsewhere

undone yarrow
#

It's the only class in my plugin

#

apart from main

eternal oxide
#

so whats in main

undone yarrow
#

Bukkit.getPluginManager().registerEvents(new EnableHotbar(), this);

#

that's it

eternal oxide
#

do you get duplicates if you remove your plugin?

undone yarrow
#

Im testing that now

wispy wyvern
tender shard
#

you can check the PDC tags of your item in your main hand by doing

/data get entity <yourUsername> SelectedItem
#

then check for the part that says "PublicBukkitValues"

undone yarrow
#

Perhaps it had to do with me reloading the server a billion times

#

using /reload sometimes breaks stuff

eternal oxide
#

nothing in your code that you have shown would cause duplicates

#

yes

undone yarrow
#

Still duplicates it

#

...

#

/give JustinS_2006 minecraft:nether_star{CustomModelData:1} 1

wispy wyvern
undone yarrow
#

It always gives 1+ the amount specified in the command

#

So it doesn't duplicate it @eternal oxide

#

It just adds 1

tender shard
eternal oxide
#

I've never use teh MC give command so can't comment

tender shard
#
ItemStack item = event.getItemInHand();
if(!item.hasItemMeta()) return;
PersistentDataContainer pdc = item.getItemMeta().getPersistentDataContainer();
if(pdc.has(myKey, PersistentDataType.YOUR_DATA_TYPE)) {
  // It's your item
}
undone yarrow
# eternal oxide I've never use teh MC give command so can't comment

Here's chatgpt's fix
To fix this, you can simply remove the 1 from the CustomModelData tag in the command, like this: /give me nether_star{CustomModelData:} amount. This will ensure that the game interprets amount as the number of Nether Stars to give, rather than the maximum stack size.

tender shard
#

chatgpt drunk again

undone yarrow
#

Ill just not use /give

echo basalt
tired star
#

Hey, Anyone know what repo I should be using in my pom.xml file when trying to include mcMMO?

tender shard
#

they don't mention it anywhere. I'd just compile it from source, then mvn install it

#

then you have it in your local repo and don't have to declare any external repo

tired star
#

so could I use those as repos or should I still create the local repo for it?

tender shard
#

you can use those repos

cobalt thorn
#

Code: https://sourceb.in/wPjBqh6rP2
Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null

This code is for a sieve and when i pick like
Sieve:
Gravel:
...
SAND:
...

flint coyote
#

Depending on what's below Gravel or Sand it is not a ConfigurationSection.

Sieve:
  Gravel:
    - example: exampleValue
      example2: exampleValue2

is not a configurationSection but a List of Objects

flint coyote
#

Then what is below Gravel or SAND?

cobalt thorn
tawny remnant
regal scaffold
#

How can I make my plugin handle reloads? As in, I want to keep some data over from before the reload and after

#

What are some good practices

eternal oxide
#

PDC, database or config

tawny remnant
#

huh?

flint coyote
tawny remnant
#

== instead of equals?

#

it works tho

#

that isnt the problem

#

the lore is not being added

lost matrix
#

If he only has one instance of this inventory then == is fine

vital sandal
#

Do spigot/paper plugin work in Velocity/Pufferfish ?

glossy venture
#

dont think CraftInventory overrides .equals() so it does the same thing anyways

lost matrix
regal geyser
#

how can i make a custom command in a plugin?

lost matrix
regal geyser
#

thanks!

regal geyser
lost matrix
#

Its the same. Just with kotlin syntax...

regal geyser
#

i am still a beginner, so i am note rlly good in converting

flint coyote
#

IntelliJIDEA will convert it for you, if needed

lost matrix
#

I feel like you should learn Java first to really grasp the benefits and caveats of Kotlin

flint coyote
regal geyser
#

and not that much even in java tho

regal geyser
flint coyote
cobalt thorn
#

So for itemsName

flint coyote
#

Put it before line 10 and check what's the result

flint coyote
#

???

cobalt thorn
flint coyote
cobalt thorn
#

I added it but it gives the error from the Set<String> called items

flint coyote
#

You will still receive the error obviously. What's relevant is what is printed

cobalt thorn
flint coyote
#

But isn't the error thrown at this line?
ConfigurationSection itemConfig = plugin.getConfig().getConfigurationSection("Sieve." + itemsName);

cobalt thorn
lost matrix
#

Whats this about? You can store and load ItemStacks from configs by simply using

    FileConfiguration configuration = ...;
    ItemStack itemStack = configuration.getItemStack("path.to.itemstack");
flint coyote
#

He's trying to get a ConfigurationSection but it states that it isn't a configurationSection

unique sable
regal geyser
lost matrix
# cobalt thorn .

Looks like you are trying to get a key which is not in your config

regal geyser
#

is it right like this:

package eu.lostgamers.AdvancedPlugin

import org.bukkit.Bukkit
import org.bukkit.Material
import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.block.BlockBreakEvent
import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.inventory.ItemStack
import org.bukkit.plugin.java.JavaPlugin


class Main() : JavaPlugin() , Listener, CommandExecutor {

    init {
        print("This got called before everything else!")
    }

    override fun onEnable() {
        Bukkit.getLogger().info { "Advanced plugin started!" }
        Bukkit.getPluginManager().registerEvents(this,this);

        this.saveDefaultConfig();
    }

    override fun onDisable() {
        Bukkit.getLogger().info { "Advanced plugin stopped!" }
    }

    @EventHandler
    fun onPlayerJoin(e: PlayerJoinEvent) {
        e.player.sendMessage("Welcome to our network, ${e.player.name}")
    }


        fun onCommand(sender: CommandSender, cmd: Command, label: String, args: Array<out String>) {
            if (sender is Player) {
                sender.health = sender.maxHealth
                sender.sendMessage("You have been healed")
            }

    }


    @EventHandler
    fun onBreakBlock(e: BlockBreakEvent) {
        val block = e.block
        val blockMaterial = block.type
        logger.info("${e.player.name} broke a $blockMaterial at ${block.x}, ${block.y} ${block.z}")
    }
}
lost matrix
cobalt thorn
regal geyser
#

ok 1 min

#
class Heal() : JavaPlugin() , CommandExecutor {
    override fun onCommand(sender: CommandSender, cmd: Command, label: String, args: Array<out String>) {
        if (sender is Player) {
            sender.health = sender.maxHealth
            sender.sendMessage("You have been healed")
        }
} 
lost matrix
regal geyser
#

the ide tells me that i have to change the return type to boolean, why tho?

lost matrix
regal geyser
lost matrix
unique sable
# hasty prawn Show where you're adding it

You meant this?

    public defaultskill(Rpg plugin) {
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        if (player.hasPlayedBefore()) {
            player.sendMessage(ChatColor.GREEN + "Welcome Back!");
        }
        else {
            strength.StrengthMap.put(player.getUniqueId(), 0);
            speed.SpeedMap.put(player.getUniqueId(), 100);
            crafting.CraftMap.put(player.getUniqueId(), 0);
            husbandry.Husbandrymap.put(player.getUniqueId(), 0);
            max.stmax.put(player.getUniqueId(), 5);
        }
    }
}```
lost matrix
regal geyser
#

so i just put CommandExcuter?

hasty prawn
#

So it's returning null, and then when you call intValue() on a null object... well there's your NPE.

unique sable
#

ahh, completely overlooked that. Thanks!

undone yarrow
#

How can I replace the players inventory with a different inventory upon command, then change it back to the old inventory too

outer raft
#

Hi, does anyone know what type of problem is this? java.lang.NoClassDefFoundError: net/minecraft/world/entity/monster/Zombie
im using remapped mojang jar, maybe i should attach remapped jar somewhere?

pliant blaze
#

hello

#

can someone help me ?

flint coyote
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

pliant blaze
#

someone doing bot attack on my server hoow i canfix

hasty prawn
flint coyote
outer raft
hasty prawn
#

Wdym? The server is using the obfuscated JAR

#

So by not remapping you're making them all different.

#

Which is why it can't find that Class.

tardy flame
#

How can I build my project (using jitpack) while having nms as dependency?

tender shard
#

you could run buildtools using the maven-exec-plugin but that sounds like a dirty solution

#

why don't you just use a proper repo instead?

tardy flame
onyx fjord
#

yeah most likely youd have to run buildtools

tardy flame
onyx fjord
#

probably as some kind of maven task

tender shard
#

it'd be way easier to just build it locally and then publish it to some repo

hybrid spoke
tardy flame
#

it would

#

Wait I think I'm creating the XY problem

tender shard
tardy flame
#

Do I need nms for creating heads from these textures? eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzNhOTZlOTU0YmQyNTRhOTFhNDE1NTIwNDQ2Y2Y3OGE4OGNlM2VmNTM5ODY3M2JjZTRiODQ3NzUzMzRjZGQzOCJ9fX0=

tender shard
#

no

hybrid spoke
#

no

tardy flame
#

._.

tardy flame
#

Well, that solves my issue

#

Danke

pliant blaze
#

hlo

#

i wanna stop bot attack on server, how i can ?

hybrid spoke
#

by providing more information

warm galleon
#

does Spigot provide a way to manage I/O files other than config.yml? Or should I just do it in plain java

icy beacon
#

JavaPlugin#saveResource

jagged briar
#

hey

#

So i got an issue that you guys might be able to help me with

#
        @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
        public void onLastDamageEntity(EntityDamageEvent e) {
            if (!(livingEntity instanceof ArmorStand) && livingEntity.getHealth() - e.getFinalDamage() > 0)
                return;
}
undone yarrow
jagged briar
#

sorry someone texted me

#

had to respond to that first

#

anyways

#

the issue i have is that its not always triggering im not 100% if its the event, i rather think that somethings wrong with the if statement

#

or is it possible that the event doesnt get triggered?

#

any ideas whats wrong with it?

tall dragon
#

what ru tryna achieve

jagged briar
#

its not me trying to achieve

#

im working with an api and i found a dupe on it

#

im trying to replicate it but its not consistent

quartz basalt
#

am i doing smthn wrong with my code, when the guardian spawns its just a beam of bubbles, no laser

this.location = location;
        this.guardian = (Guardian) location.getWorld().spawnEntity(location, EntityType.GUARDIAN);
        this.squid = (Squid) location.getWorld().spawnEntity(location.clone().add(0, 0.01, 0), EntityType.SQUID);

        scheduler = Bukkit.getScheduler().scheduleSyncRepeatingTask(SAdd.getInstance(), new Runnable() {
            @Override
            public void run() {
                guardian.setTarget(squid);
            }
        },0,2);

        guardian.setInvisible(true);
        guardian.setGravity(false);
        guardian.setSilent(true);
        guardian.setInvulnerable(true);

        squid.setInvisible(true);
        squid.setGravity(false);
        squid.setSilent(true);
        squid.setInvulnerable(true);```
tall dragon
jagged briar
tall dragon
#

ur doing checks on the same livingentity regardless of the entity that was damaged

jagged briar
#

h

#

ah

tall dragon
#

wdym whats the issue wiht that xd

jagged briar
#

LivingEntity livingEntity = (LivingEntity) e.getEntity();

tall dragon
#

not sure what that piece of code is going to do tho. since u just return, unless thats not all the code

warm galleon
#

i think he means to set it to cancelled

#

i think he jsut mixed up return and setcancelled

#

@jagged briar

#

?

tall dragon
#

that would stop him from damaging any entity that's not an armorstand and has sufficient health

#

not sure thats the end goal here

jagged briar
#

let me send you a pastebin

#

one sec

warm galleon
#

okay so maybe he does not want to do anything to things thatr are armorstands or things that wont die

jagged briar
#

this code is very stripped out

warm galleon
#

cacheEntityEquipment(livingEntity);

jagged briar
#

there is some more check in the original code

#

the caching works

warm galleon
#

also are armor stands considered living entities?

jagged briar
#

no

#

oh wait

#

yes i think

echo basalt
#

ye

warm galleon
#

take my opinion with a grain of salt because im also bad at programming but

#

shouldnt it be ||

tall dragon
#

na

warm galleon
#

im so confused :)

#

ill shut up

jagged briar
#

you get whats supposed to happen right?

tall dragon
#

hes caching equipment if the entity is not an armorstand and the entity will die after that event

#

checked with the health

jagged briar
#

sometimes the entity quipment doesnt get cached thus causing the plugin to multiply the donkey loot

warm galleon
#

and what is the problem

jagged briar
#

therefore youre able to dupe

tall dragon
jagged briar
#

its not my code as i said

#

im using an api

#

and i want to fix the dupe myself since the actual dev is lazy

tall dragon
#

i am very confused as to where this livingentity is coming from

jagged briar
#

and thats the version that has the dupe in it

tall dragon
#

ah

warm galleon
warm galleon
jagged briar
#

yep

tall dragon
#

did u strip that out?

tender shard
jagged briar
#

ye since i tried to cut it down for discord

tall dragon
#

u shoulnt do that tbh

#

should just put it all in a paste

#

much easier to understand

jagged briar
#

should i create another one?

warm galleon
tall dragon
#

yea why not

jagged briar
#

aight

tall dragon
#

and regarding the problem. you should add some debug messages, so you can see whats being ran when the donkey dies

jagged briar
tall dragon
#

then you will know if the event is being called etc.

tender shard
#

you should definitely use monitor for this

jagged briar
#

hmm

#

it isnt my plugin as i said

#

that could be the solution

warm galleon
#

is there a way to make my plugin load after everything else? so I can override any other plugins with the same command names

tender shard
#

I also wonder what's the "cache" for anyway, why not just get the equipment directly in the death event?

hazy parrot
#

You can set it to pre world ig

tender shard
warm galleon
#

i have it on startup

warm galleon
tender shard
quartz basalt
tender shard
warm galleon
#

need what

#

also yes its 1.8.8 and 1.12.2

#

what happens in later versions

quartz basalt
#

yeah im doing it myself

warm galleon
#

oh

#

what about in legacy versions

#
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
    getCommand("<name>").setExecutor(new CommandNameThing());
});
#

would that work

tender shard
#

no, that only works for your own plugin's commands

warm galleon
#

darn

#

do commands take priority based on who loads last or who loads first

tender shard
#

you can loop over the command map to get all commands

        final CommandExecutor myExecutor = new MyExecutor();
        final SimpleCommandMap commandMap = ((CraftServer) Bukkit.getServer()).getCommandMap();
        for(final Command command : commandMap.getCommands()) {
            if(command instanceof PluginCommand pluginCommand) {
                pluginCommand.setExecutor(myExecutor);
            }
        }
river oracle
#

I'm wondering what the impact of saving a json file not during server start or stop would be. It shouldn't be a super large file definitely wouldn't even hit a mb

echo basalt
#

hmm what's the cleanest way of making such a scripting system

warm galleon
tender shard
#

I'd create a BiConsumer<Context, String[]> for each "command", then have them in a map.
E.g. Map<String, BiConsumer<Context, String[]>>. Then for the first, you get the "npcselect" consumer and throw the args {"npc-one"} at it. The context class could hold information like "which npc is selected" etc bla bla

echo basalt
#

thing is

#

I'd probably base it off my command system

echo basalt
tender shard
#

I still wonder what's the purpose of overriding other plugin's commands

echo basalt
#

thinking npcselect.* -> args do whatever

#

and then have to do some fancy ass validation

#

it'd be fun

ivory sleet
tender shard
#

or maybe a BiFunction that would return SUCCESS or FAILURE or sth or whatever

#

idk it's the first thing that came to my mind

ivory sleet
#

I dont like that design

#

Just throw an exception if the command somehow fails, no?

quaint mantle
#

Hey I'm trying to make a Vigenere Cipher encryption but when I put in as the user input "in a land far far away" with the key being "test" it's not encrypting correctly. I'm getting dZs\tX[i_e`\me`\me[r\e when I should be getting bXsZtVYg]e^Zke^ZkeYpZc java @Override public String encrypt(String input) { StringBuilder sb = new StringBuilder(); int keyIndex = 0; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); int shift = key.charAt(keyIndex) - START_CHAR; char encrypted = (char) ((c + shift - START_CHAR) % RANGE + START_CHAR); sb.append(encrypted); keyIndex = (keyIndex + 1) % key.length(); } return sb.toString(); }

tender shard
#

what's RANGE and what's START_CHAR?

quaint mantle
#

start_char is the first valid character for the range of string characters which would be a space character and the range is the number of valid string values which is the difference between the two previous values plus one

#

The two previous characters would be start_char and end_char

vital sandal
#

what is entities type of ArmorStand?

#

on 1.19.3

chrome beacon
vital sandal
#

forgot how to mapped it @@

chrome beacon
#

?nms

vital sandal
#

:l got this issue

opal juniper
#

read it

vital sandal
#

oh right

vital sandal
#

what to input in this :l?

mental nymph
#

How i can get craftbukkit sources? Buildtools gave me only builded jar

undone axleBOT
undone yarrow
#

I have an item in a players hotbar which should activate a different inventory when rightclicked. So for example:
The player has its normal inventory with all its items (let's call this x) and he has the rightclickable item. If he right clicks it, it should replace x with a new inventory and hotbar (but the rightclickable item should still be there in the first slot). This new inventory contains different custom items which the player can move around in the inventory and select. When the player right clicks again, x goes back with all the items in their previous locations.

#

How would I do this?

echo basalt
#

just a couple interfaces

mental nymph
echo basalt
#

and a couple registries

hazy parrot
#

I mean no major changes

opal juniper
#

not true

#

version bump from .2 -> .3

hazy parrot
#

Oh yeah

tawny remnant
#

how do i return a damage dealt to an entity that is not player?

tardy delta
#

LivingEntity#damage

mental nymph
quaint mantle
pure dagger
#

What's the best way to make that player can place items only in 1 slot? I can check if the slot index is 13 and then cancell or not event, but how to make that for only one inventory?

#

Any way to mark these slots or inventorys?

#

or something

tender shard
#

Store your inventory in a Set when you open it

#

Or when you create it

grand magnet
#

Hey I just switched from Eclipse to IntelliJ. However, now all § characters have become such a character �. How can I fix this without replacing each character individually?

alpine narwhal
#

switch the font

#

i think lmao don't come after me if doesnt work

tender shard
#

and next time, don't hardcode § but use the ChatColor class

analog thicket
#

I need some help here. Would any one know how I could compare an armor stand head to a head texture link?

tender shard
worldly mountain
#

How do I use an interface to allow for multiple storage options (config, SQL, mongo, ...)

#

?config

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

eternal oxide
#

you have a class per storage option which all implement your interface

#

then at startup you instance whichever class you need

worldly mountain
#

Okay thanks

tender shard
#

please paste it with java highlighting

desert tinsel
#

Why PlayerInteractEvent is called twice when you right click a block?

remote swallow
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
tender shard
#

Why does nobody ever read the javadocs

#

Isnt it explained in the first sentence lol

fluid river
#

you can try adding a custom holder tho

#

so you don't need a collection for storing invs

river oracle
fluid river
#

well you didn't have 2 hands before

#

in 1.5.2 at least 😉

river oracle
#

oh yeah back in the day

#

:P

#

?1.8.8

#

?1.8

undone axleBOT
river oracle
#

I'm surprised people haven't caught on after 7 and a half years

tender shard
#

well they paid 12$ to a 13 year old 7.5 years ago for a custom plugin that only works in 1.8 so they "can't update"

river oracle
tender shard
fresh timber
#

I didnt play mc 7.5 years ago xd

tender shard
fresh timber
#

ok

terse ore
#

One question guys, is there any way for setting all blocks over y = n to a specified block for all the pregenerated chunks in a world?

eternal oxide
#

yes

#

on generation or on load

terse ore
eternal oxide
#

its quite a heavy work load so spread it out

terse ore
eternal oxide
#

ChunkLoadEvent

terse ore
#

nono I mean

#

I pregenerate until 10k

#

with chunky

#

when it is finished, is there a way to set all blocks over y = n to be deepslate?

#

idk if that makes any sense

eternal oxide
#

yes, load each chunk and loop over

terse ore
#

okok

#

imma try it

fluid river
#

write own worldgen for chunky/minecraft spigot

terse ore
#

the thing is

#

I've been investigating but haven't found any info on it

#

the generator: in bukkit

#

how could I make it so it is only a single biome

fluid river
#

class Cringe extends ChunkGenerator()

fluid river
terse ore
#

is there any docs

#

for that

#

this was the most info I could get

fluid river
#

oh

fluid river
#

stomachine

terse ore
#

is there any way of making this in the generator in bukkit

fluid river
#

idk

terse ore
#

there's little to no info

#

f

#

hmm

#

wait, if I use my world save and upload it to the server it will still work right?

fluid river
#

wait you want your world to have 1 biome

tawny remnant
#

how do i reduce damage do to the player from a certain Entity?

fluid river
#

or what

terse ore
fluid river
#

just use my post above

tender shard
fluid river
#

but it's only for new worlds

#

^^

#

you just check the entitytype of entity which hit the player

#

and reduce the damage based on the type

tawny remnant
fluid river
#

bruh

#

i guess you need final damage tho

#

not just a damage

#

and what is mc version you are coding for

tawny remnant
#

1.19.3

tawny remnant
#

never done it before

fluid river
#

event.getFinalDamage()

#

?jd-s

undone axleBOT
fluid river
tender shard
#

it's not complex at all

fluid river
#

also don't nest ifs

tender shard
#
private final NamespacedKey MY_CHESTPLATE_KEY = new NamespacedKey(myPlugin, "isMyChestPlate");

// aply tag:
myItemMeta.getPersistentDataContainer().set(MY_CHESTPLATE_KEY, PersistentDataType.BYTE, (byte) 1);

// check if it has the key:
if(myItemMeta.gerPersistentDataContainer().has(MY_CHESTPLATE_KEY, PersistentDataType.BYTE)) {
weak meteor
#

if i make a constructor (1st image) for my class and i wanna use it in another method (2nd image) it would work?

delicate lynx
#

variables are awesome to use

hazy parrot
#

that is not constructor

weak meteor
#

well that stuff

#

just wanna know if it works

hazy parrot
#

constructor must have same name as class

fluid river
#

bruh

weak meteor
#

bcause isnt working

fluid river
#

constructor is a method which runs when class instance is created

delicate lynx
#

what does the 2nd picture have to do with the first

fluid river
#

not a method

hazy parrot
#

?learnjava

undone axleBOT
tender shard
#

this is a constructor:

public class MyClass {
  public MyClass() { }
}

this is NOT a constructor, but just a method you called "constructor":

public class MyClass {
  public void constructor() { }
}
hazy parrot
#

?conventions

weak meteor
#

its the same

hazy parrot
#

its literally not

tawny remnant
weak meteor
#

but im just importing 2 var

fluid river
#

event.setDamage?

weak meteor
#

that matters?

fluid river
#

bruh

#

you need

#

free java lessons

#

(checkmybio)

tawny remnant
tender shard
#

if you don't cancel the event, yes

fluid river
#

damage is only applied if the event is not cancelled

#

it's applied after the code you write in the eventhandler

tawny remnant
#

it should right?

tender shard
#

Probably

#

Try it

tawny remnant
tawdry echo
#

how can load users from database, i mean avoid SELECT * due to numbers of users, or it dont make difference?

tender shard
hazy parrot
tender shard
#

Yes

#

There you apply the pdc tag

tawny remnant
#

thanks man

tawdry echo
quaint mantle
#

Okay im getting closer but this still isn't doing the trick for vigenere cipher java @Override public String encrypt(String input) { StringBuilder result = new StringBuilder(); for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c >= START_CHAR && c <= END_CHAR) { // only encrypt printable characters int keyIndex = i % keyLength; // handle key that is not the same length as input int keyShift = key.charAt(keyIndex) - START_CHAR; c = (char) (START_CHAR + (c - START_CHAR + keyShift) % RANGE); // handle wraparound } result.append(c); } return result.toString(); } I'm trying to output bXsZtVYg]e^Zke^ZkeYpZc with the input being "in a land far far away" and the key being "test" but it's not printing that

tawny remnant
#

how do i create the tab completion thigy

quaint mantle
#

1.633s makes it so BlobExecutor can be constructed with just the JavaPlugin and the command name you provided in plugin.yml inside commands section.
I am also going to test MongoCrudManager since I just added it. I don't expect it to work without further testing but I will ensure to provide 100% functionality in 1.634s for it.

https://github.com/anjoismysign/BlobLib/packages/1784566

GitHub

A library that extends milkbowl's Vault and lucko's helper. Oriented for the Bukkit, Spigot & Paper environment. - Package us.mytheria.bloblib · anjoismysign/BlobLib

tender shard
#

Then do myCommand.setTabCompletor(…)

tender shard
remote swallow
#

you dont need to set Tab if you set executor

quaint mantle
tender shard
#

Then i dont understand the problem. You say it doesnt print ANYTHING?

quaint mantle
#

I didn't say that

tender shard
#

I dont think your % math is correct btw

#

I‘ll write a vigenere when im outta the bathtub in 20 mins or so

quaint mantle
#

Okay, I'm receiving dZs\tX[i_e`\me`\me[r\e

weak meteor
#
case DIAMOND_SWORD:
                    e.setCancelled(true);
                    Player p = (Player) e.getWhoClicked();
                    p.closeInventory();
                    Inventory inventory = Bukkit.createInventory(p, 45, ChatColor.translateAlternateColorCodes('&', DTAnvilRPG.enchanterName));

                    ItemStack wool = new ItemStack(Material.LIME_WOOL);

                    ItemMeta woolMeta = wool.getItemMeta();
                    woolMeta.setDisplayName(ChatColor.GREEN + ChatColor.BOLD.toString() + "Agregar Encantamiento.");
                    wool.setItemMeta(woolMeta);

                    inventory.setItem(25, wool);
                    for (int i = 0; i < inventory.getSize(); i++) {
                        if (inventory.getItem(i) == null) {
                            ItemStack glass = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
                            ItemMeta glassMeta = glass.getItemMeta();
                            glassMeta.setDisplayName(" ");
                            glassMeta.addEnchant(Enchantment.DURABILITY, 10, false);
                            glass.setItemMeta(glassMeta);
                            inventory.setItem(i, glass);
                        }
                    }
                    inventory.setItem(19, null);
                    inventory.setItem(23, null);
                    inventory.setItem(25, wool);
                    e.getWhoClicked().sendMessage("asdasd");
                    p.openInventory(inventory);```

Why the second inv isnt opening but i get the asdasd message :(
undone yarrow
#

or the name of the inventory if possible

#

It's probably opening the wrong inventory

tardy delta
#

does anyone knows how i fix this, ive never used gradle before

#

tried switching these but the 2nd doesnt work at all

tender shard
# quaint mantle That's because it's printed in another method...
public class Vigenere {

    private static final char LOWER_START = 'a';
    private static final char LOWER_END = 'z';
    private static final char UPPER_START = 'A';
    private static final char UPPER_END = 'Z';

    public static String encrypt(String plainText, String key) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < plainText.length(); i++) {
            char c = plainText.charAt(i);
            if(Character.isLetter(c)) {
                char start = Character.isUpperCase(c) ? UPPER_START : LOWER_START;
                char end = Character.isUpperCase(c) ? UPPER_END : LOWER_END;
                int offset = c - start;
                int keyOffset = key.charAt(i % key.length()) - LOWER_START;
                int newOffset = (offset + keyOffset) % (end - start + 1);
                sb.append((char) (start + newOffset));
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }

    public static String decrypt(String cipherText, String key) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < cipherText.length(); i++) {
            char c = cipherText.charAt(i);
            if(Character.isLetter(c)) {
                char start = Character.isUpperCase(c) ? UPPER_START : LOWER_START;
                char end = Character.isUpperCase(c) ? UPPER_END : LOWER_END;
                int offset = c - start;
                int keyOffset = key.charAt(i % key.length()) - LOWER_START;
                int newOffset = (offset - keyOffset) % (end - start + 1);
                if(newOffset < 0) newOffset += end - start + 1;
                sb.append((char) (start + newOffset));
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
tardy delta
#

dunno if it says that my version is outdated or that that one is

tender shard
#

@quaint mantle seems to be working fine

#

obviously the code is pretty shitty but it works

tardy delta
#

ok gradle version of minestom goes brr

quaint mantle
#

That's not the correct output

quaint mantle
tender shard
#

usually it only uses a-z A-Z

#

show the full text of the assignment

zealous osprey
rough drift
#
var entityLoc = entity.getLocation();
var playerLoc = player.getLocation();

var entityVec = entityLoc.toVector();
var playerVec = playerLoc.toVector();

var angle = entityVec.angle(playerVec);

var x = Math.cos(angle) * this.distance;
var y = playerLoc.getY() + this.orbitHeight;
var z = Math.sin(angle) * this.distance;

var loc = new Location(entity.getWorld(), playerLoc.getX() + x, y, playerLoc.getZ() + z);

var diff = playerVec.clone().subtract(loc.toVector());
loc.setDirection(diff);
entity.teleport(loc);
entity.setRotation(loc.getYaw(), loc.getPitch());
```Am I stupid, or should this teleport the entity around the player?
quaint mantle
terse ore
#
        for (int minX = 0; minX < 10; minX++) {
            for (int minZ = 0; minZ < 10; minZ++) {
                Chunk chunk = world.getChunkAt(minX * 16, minZ * 16);
                chunk.load();

                int startX = chunk.getX() * 16;
                int chunkY = 51;
                int startZ = chunk.getZ() * 16;

                for (int y = chunkY; y < 320; y++) {
                    Material material = y == 51 ? Material.BEDROCK : Material.AIR;

                    for (int x = startX; x < startX + 16; x++) {
                        for (int z = startZ; z < startZ + 16; z++) {
                            world.setType(x, y, z, material);
                        }
                    }
                }

                chunk.unload();
            }
        }```
#

hwo could I make so my server doesn't crash?

terse ore
#

[21:43:05 WARN]: Timed out waiting for world statistics
[21:43:09 ERROR]: --- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH - git-Purpur-1918 (MC: 1.19.3) ---
[21:43:09 ERROR]: The server has not responded for 15 seconds! Creating thread dump

#

thanks

tardy delta
#

uhh what is this crap?

tender shard
tardy delta
tender shard
#

and get rid of the if/else for lower/upper case

echo basalt
#

my animation scripting system works first time sunglasses

quaint mantle
tender shard
#

it starts at space you say, but where does it end?

quaint mantle
#

at the character z

#

the range is start - end + 1

tender shard
#

so space to z?

quaint mantle
#

yes

copper scaffold
#

can someone help me to fix that only i get the package, but the otherplayers need that package too

@Override
                        public void onPacketSending(PacketEvent e) {
                            Config config = new Config();
                            Player p = e.getPlayer();
                            Main.getInstance().log("1");
                            if(config.getPlayerVanishedList("de.command.vanished") != (null)){
                                Main.getInstance().log("2");
                                if(config.getPlayerVanishedList("de.command.vanished").contains(p)){
                                    Main.getInstance().log("3");
                                    onEventCancel(e);
                                    Packet packet = (Packet) e.getPacket();
                                    CraftPlayer cp = (CraftPlayer) e.getPlayer();
                                }
                            }
                        }
tawny remnant
tender shard
#

I get the same when using space and z as bounds

quaint mantle
#

Clearly it's not because I should be getting the other output

tender shard
#

clearly it is correct when one only has access to the assignment text you sent, plus the statement that the "boundaries" are space and z

#

either you didn't send the full assignment, or the proposed encrypted text is not correct

tardy delta
#

man i understand why people hate gradle

tender shard
#

I am pretty sure you didnt send the whole assignment as it was already missing the definition of what the boundaries are of the allowed characters

tender shard
tardy delta
#

im only getting errors

tender shard
#

that's normal

tardy delta
tender shard
#

people rather spend 5 hours getting their gradle build to work than watching maven take 2 seconds to compile

tardy delta
#

true

#

and nobody wants to help me

tender shard
#

what did you run?

#

gradle build?

tardy delta
#

some dude told me i should run gradle wrapper --gradle-version 8.0.2 --distribution-type all

tender shard
#

is this a repo you cloned?

#

if so, you shouldn't run ANY wrapper commands

#

you should just use the wrapper that was included in the repo

#

gradle breaks itself on updates

tardy delta
#

uhh i cloned it from github and im running that command in a terminal yes

tender shard
#

that's why every repo includes the huge 150 mb wrapper because if you use a different gradle version than the build script was written for, everything goes wrong

tardy delta
#

well ye i wanted to try the wrapper but

tender shard
#

delete everything, clone the repo again, then enter gradlew build

#

gradlew, not gradle

tardy delta
#

ok

rough drift
#

Just making this a thread in case anyone wants to help

tender shard
#

it says "complete range of printable ascii characters", not just space to z

heavy mural
#

Can entities that are passenger of a player clientside only (packets) block teleports?

rough drift
#

What?

#

oh

#

I get that

#

They shouldn't no

#

Also a quick FYI it's packets

#

not packages

heavy mural
#

Can they be hit through by a player if its clientside only?

quaint mantle
#

Changing it still doesn't give me the output I should be getting

tender shard
rough drift
#

but it won't do anything

heavy mural
#

So they can block a hit for example if I want to hit a player behind it?

rough drift
#

Technically yes iirc

#

but the server should just ignore and hit anyways

#

I don't exactly remember how it works