#help-development

1 messages · Page 1605 of 1

summer scroll
#

and you'll find a discord link

quaint mantle
#

i am there xd

#

i literally cntrl + f "discord"

#

nothing there

summer scroll
#

did they even have discord server?

quaint mantle
#

i actually dont know

#

alr found the packet i think

#

now to find out how to use it?

#

or send

#

thanks you!

#

found out how to use packets but idk which packet it is xD

quaint mantle
#

for example, I want make only certain player to see entity,

#

google spigot personal entity packet

#

or etc

#

i know the packet but idk how to get to it

#

this one

granite stirrup
#

I think protocol lib has packet wrappers

quaint mantle
#

ye

#

but if i go on that page

granite stirrup
#

It might be like PacketPlayOutShootArrowWrapper or PacketPlayOutShootArrow or something but don't ask me

quaint mantle
#

and search either "shoot" or "arrow" or "bow"

#

it doesnt show anything

granite stirrup
#

There's the entity metadata lol

quaint mantle
#

nah its not animation

granite stirrup
#

Yeah but I think you need to use the entity metadata

#

But idk

quaint mantle
#
ProtocolManager pm = ProtocolLibrary.getProtocolManager();
                            PacketContainer packet = pm.createPacket(PacketType.Play.Server.BLOCK_ACTION);
                            packet.getModifier().writeDefaults();
                            packet.getIntegers().write(0, p.getEntityId()).write(1, 5);
#

my code rn

#

not working tho

#

also i get this in chat when i reload?

granite stirrup
#

Make sure u have installed protocol lib on your server

quaint mantle
#

ye i have

granite stirrup
#

And probs make your plugin depend on it

#

Add to your yml depend: ProtocolLib

#

I think

quaint mantle
granite stirrup
quaint mantle
#

oh

#

my yml?

dawn falcon
#

hi im having a problem with packaging my plugin in maven, and its saying that it "cannot access org.bukkit.Bukkit" how can i trouble shoot this?

granite stirrup
#

Pom.xml?

dawn falcon
#

what do i need to have in it?

granite stirrup
#

Can you show it

#

?paste

undone axleBOT
dawn falcon
#

yeah

granite stirrup
#

Try removing the sonatype repo

#

You don't need it rn

dawn falcon
#

all right

granite stirrup
dawn falcon
#

no it did not

#

which line was it?

quaint mantle
quaint mantle
dawn falcon
#

oh

#

ops

granite stirrup
granite stirrup
#

I can't really help much I'm on phone and know nothing about protocol lib

quaint mantle
granite stirrup
#

Like what

quaint mantle
#
ProtocolManager pm = ProtocolLibrary.getProtocolManager();
                            PacketContainer packet = pm.createPacket(PacketType.Play.Client.BLOCK_DIG);
                            packet.getModifier().writeDefaults();
                            packet.getEnumEntityUseActions();
                            packet.getModifier().write(0, p.getEntityId());
                            try {
                                pm.sendServerPacket(p, packet);
                            } catch (InvocationTargetException invocationTargetException) {
                                invocationTargetException.printStackTrace();
                            }
#

CODE

#

This is the error

granite stirrup
#

Hmm weird

echo basalt
#

That packet is fun

quaint mantle
echo basalt
#

What server version are you using?

quaint mantle
#

mc or protocol?

granite stirrup
#

He's using 1.16.5

echo basalt
#

Mc and protocollib

quaint mantle
#

1.16.5 mc

#

4.7.0 protocl

echo basalt
#

Okay

quaint mantle
#

Im trying to make it fire the bow

echo basalt
#

Firing a bow isn't block_dig

quaint mantle
echo basalt
#

Hm ok

quaint mantle
echo basalt
#

Isn't that packet clientside?

#

Like

#

Client -> server

granite stirrup
#

Isn't it entity metadata

visual tide
#

no

quaint mantle
#

ye idk i cnat find it :/

echo basalt
#

Huh

#

The 1st line indicates it's a client type packet

jagged crater
#

it's from client.

echo basalt
#

The client sends that packet to the server whenever it digs a block

jagged crater
#

It's bound to server.

echo basalt
#

So sending that packet to the client makes to sense in the first place

quaint mantle
#

i just cant find the packet to fire the bow

echo basalt
#

You can't force a player to prime a bow iirc

jagged crater
#

I don't think you can

granite stirrup
#

I saw in entity metadata a shoot arrow thing I think

echo basalt
#

There's a hacky workaround

#

Which is creating a fake player that's priming a bow and locking the target to that player in spectator

quaint mantle
quaint mantle
echo basalt
#

Bow pull animation is clientside but the client sends a packet to the server, which is sent to other players indicating <X> entity is pulling a bow iirc

jagged crater
#

if you want to cancel pulling back of the arrow, when you get that packet, check for it's ID, if it's the ID for pulling your bow back, just return or something or cancel the event

#

but it still might pull it back client side actually

echo basalt
#

^

jagged crater
#

so probs no point doing that

echo basalt
#

You can cancel other players viewing the animation

jagged crater
#

but other players wouldn't see you pulling the bow

echo basalt
#

But client might still render it

quaint mantle
#

bc cancelling the PlayerInteractEvent just prevents it from shooting an arrow

jagged crater
#

don't cancel the whole event

quaint mantle
#

im using custom arrows and spawning those

quaint mantle
granite stirrup
jagged crater
#

if you were to try to click an NPC or something whilst trying to shoot a bow, nothing would happen

quaint mantle
#

The thing i want is that it doesnt pull back the bow and doesnt make u slower

echo basalt
quaint mantle
jagged crater
#

I don't think you can do that without a client side mod

quaint mantle
#

also i dont have npc's and i wont

#

it doesnt matter

quaint mantle
#

oh

#

misread it

echo basalt
jagged crater
echo basalt
#

Isn't that just not having an arrow in the inventory?

quaint mantle
echo basalt
#

idk what you're trying to achieve

#

might be XY problem

quaint mantle
#

Im trying to make it not pull back the bow

#

thats it

echo basalt
#

Why

#

Why are you trying to stop a clientside animation?

quaint mantle
#

bc i have a custom code for the arrows

jagged crater
#

He probably doesn't know its client side

quaint mantle
#

I do

#

but idk how to cancel it

#

theres a way

jagged crater
#

The only way of stopping it would be a client side mod.

quaint mantle
#

i just dont know how

#

Nah theres a way

jagged crater
#

I dunno. I've never worked with the Java protocol except for when I fixed cats in Geyser

granite stirrup
#

I mean theres entity metadata?

echo basalt
#

I feel like the effect he's trying to do can easily be done in another way

quaint mantle
#

in what way?

quaint mantle
#

i dont wanna have to use protocolLib

#

I just want something for the effect im trying to get

#

Doesnt matter how

#

i just want it to work xD

granite stirrup
echo basalt
#

Look into Entity Status rather than Entity Metadata

echo basalt
#

Forget your solution

quaint mantle
#

Alr so

echo basalt
#

For example "I want a bow to fire after <x> time"

quaint mantle
#

I have a bow

#

tthat fires arrows

#

instantly

#

when u left/right click

#

but i wanna make it that if u hold right click

#

it keeps shooting with a delay that i set

#

the only problem rn is

#

that it pulls back the bow and bc of that doesnt keep shooting

jagged crater
#

so like, a gun?

quaint mantle
#

kinda

#

everything works except the right click holding

echo basalt
#

I'd suggest working on the idea of using a bow without any arrows on the inventory

#

It never starts the animation in the first place

#

Although it might be hacky to send fake item packets indicating there's nothing

quaint mantle
#

But ik theres a way to do it WITH arrows

#

but i just dont know how

granite stirrup
#

I saw this

echo basalt
#

Modifying that would stop the packet from being sent to other players

#

But it would still cause the animation client-side

#

One hacky thing possible is sending a packet indicating there's no arrows when the player clicks

#

And handling arrows separately

quaint mantle
#

ye that could work

#

but how 🤔

echo basalt
#

In 1.17 the constructor has the following params
int syncId, int revision, int slot, ItemStack stack

#

Not sure about 1.16

granite stirrup
#

It will probably be the same Lmao

echo basalt
#

Yeah something similar

#

But nms uses ints instead of bytes or whatever

#

And protocollib is a fancy nms wrapper

#

Following the order on the packet

#

SyncId would be 0

#

Revision idk

#

Slot would be where your arrows are

#

And the stack would be air

#

I'm not too familiar with that packet as I'm only using it to make client-side lore

#

On another note

#

Does anyone know what status is sent for Block Dig when a block is insta-broken?

#

It isn't sending the finish break packets

granite stirrup
#

Nope

#

Idfk

#

Xd

quaint mantle
#

how to set default enum?

spiral parrot
#

Help me pls, how to use prepareitemcraftevent, may i see examples, sorry about my English

granite stirrup
granite stirrup
quaint mantle
spiral parrot
granite stirrup
granite stirrup
granite stirrup
spiral parrot
#

Ok

hardy pivot
#

Anyone knows how to change that message?

near crypt
hardy pivot
#

im using try with exception but is not working

narrow vessel
#

You could just runtask lol

#

And somehow cancel the 30s one

grim ice
#

check if a player has won then execute the runtask

quaint mantle
grim ice
#

if u wanna cancel

#

Bukkit.getScheduler().cancelTask();

#

?scheduler

#

yes there is

#

100% there is

#

You can play around with it

#

cancel then runTask same code

#

okay

umbral pagoda
#

Cannot resolve method 'spigot' in 'ItemMeta' ??

#

any one help me

#

meta.spigot().setUnbreakable(true);

quaint mantle
#

remove the spigot()

#

just meta.setUnbreakable(true);

umbral pagoda
#

ok ty

grim ice
#

the Unbreakable thing in the item makes it ugly imo

eternal oxide
umbral pagoda
quaint mantle
umbral pagoda
#

any one know if 8 cores and 24 ram vps good ?

quaint mantle
#

24gb?

umbral pagoda
eternal oxide
#

you only want abstract classes if you don;t want to instance them, only extend

quaint mantle
#

How can i call the CommandManager.register(this) then?

#

without repeating the line over and over

eternal oxide
#

your FlyCommand shoudl not be abstract

umbral pagoda
quaint mantle
#

Then it trows an error related to the onCommand

#

Class 'Command' must either be declared abstract or implement abstract method 'onCommand(CommandSender, Command, String, String[])' in 'CommandExecutor'

#

luke dont bully me i started yesterday ;-;

fallow dragon
#

started Java?

quaint mantle
#

yeah

umbral pagoda
eternal oxide
#

yes, a command executor must implement onCommand

#

or override it

umbral pagoda
fallow dragon
#

Okay, first while is rough but welcome to programming 🙂

quaint mantle
#

i have around 1 1/2 years of experience with Type- and JavaScript

fallow dragon
#

Gotcha

#

Class based JavaScript?

quaint mantle
#

partly

fallow dragon
#

Or more functional style

quaint mantle
#

a mix of both

fallow dragon
#

Java is like 100% fully the class based style as you can see xD

quaint mantle
#

yeah

fallow dragon
#

But with less modern feel

umbral pagoda
#

any one have a code that when player place any block the blocks that player placed it removed after 5 s

quaint mantle
#

Annotations only assign types right?

umbral pagoda
#

@fallow dragon stop react with this emoji

fallow dragon
#

3mk just throw a runnable after 100 ticks set the block at position to air

#

Wym comic?

quaint mantle
#

Do they allow like class manipulation ?

#

Like can you add an annotation and get the target class inside the annotation?

narrow vessel
#

I dont know what you want here, canceling the task would be the same as ”ending the runtasklater”

fallow dragon
#

Uhhh, I haven’t used an annotation for that, or maybe I’m misunderstanding sorry it’s 2:45 am xD

They’re usually for providing extra information for the compiler

quaint mantle
#

ah

#

in TypeScript, a decorator is basically a function which has an target parameter which is the class/parameter/property/method

fallow dragon
#

For what you want, check out dependency injection

#

Oh, hmmm

#

I don’t know type script or much JavaScript but you might find functional interfaces to be more at home

#

For Java, practice encapsulation and dependency injection and you can get your object handles in most cases pretty easily

quaint mantle
#

ah okay, thanks

umbral pagoda
#

Cannot resolve symbol 'SKULL_ITEM'

#

?

fallow dragon
#

Show code please

#

Also what version you programming for

umbral pagoda
#

public final class Head {
public static ItemStack getCustomSkull(String url) {
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
if (url.isEmpty())
return head;

umbral pagoda
fallow dragon
#

Okay, so first off

quaint mantle
#

How can i disable collisions with entities? (1.16.5)

fallow dragon
#

Why are you coding for something so old xD

#

But secondly use player skull

umbral pagoda
fallow dragon
#

Just make it for 1.17 and use via rewind

umbral pagoda
#

ineed to fix head for redstonepvp head

fallow dragon
quaint mantle
#

only for entityCramming

fallow dragon
umbral pagoda
#

and in shop menu heads you can click on head

#

to join like golden apple menu

#

so yah

fallow dragon
umbral pagoda
#

custom heads

fallow dragon
#

I think that code you posted works in 1.8 but I can’t remember the exact material player head is

#

The short data looks right to me

umbral pagoda
#

ok

fallow dragon
#

You should have this special tool called auto complete too that will help you find the material you’re looking for

#

Maybe try seeing what shows up with PLAYER, or SKULL

fallow dragon
quaint mantle
#

uhh

quaint mantle
#

on the spawn event?

fallow dragon
#

Scratch that, as I was reading the forum post people were saying it doesn’t work

#

One sec

quaint mantle
#

tried setting max Entity Collisions in configs to 0 and -1

#

both didnt work

fallow dragon
#

Check out what the scoreboard team can do. There might be a more obvious solution but I think that will work

fallow dragon
dense goblet
#

Asking again in case anyone knows, is there any way to get the power of an explosion from a BlockExplodeEvent or EntityExplodeEvent

random ledge
#

Is someone can help me how to launch wither skull towards player ?

random ledge
quaint mantle
#

ahhh

#

so u just wanna shoot a skull forward?

#

@random ledge

random ledge
quaint mantle
#

1 sec

smoky oak
#

Can someone help me with config crap?

#

I got two static config fields in my main class, but accessing one works fine while accessing the other results in, well, no results

#

but I'm using the exact same methods for both

#

and both files exist and are filled with data

random ledge
eternal oxide
undone axleBOT
smoky oak
#
structure_strings = getBakedConfig("structure.yml");
grimoire_data = getBakedConfig("grimoire.yml");```
```java
private FileConfiguration getBakedConfig(String configFile){
  return YamlConfiguration.loadConfiguration(new InputStreamReader(getResource(configFile)));}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
  return (List<String>) (new ArrayList<>(Echo.structure_strings.getKeys(false)));
}//This is what works
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
    return (List<String>) (new ArrayList<>(Echo.grimoire_data.getKeys(false)));
}//This returns nothing
#

Both files exist and have fields in them. Otherwise apart from the field names everything is exactly the same

#

I also restarted the server

#

No errors in console either

eternal oxide
#

What one works and which is broken?

smoky oak
#

look at the comments in the two @Overrides

#

the upper works the lowers broken

#

the lower one is also the one i added

eternal oxide
#

Yep that makes no sense,

#

?paste both yml files

undone axleBOT
eternal oxide
#

use paste not in channel

eternal oxide
#

ok, first one is a map of arrays

#

grimoir is a map

smoky oak
#

Well does that matter in any way? I am asking for the first layer of keys

#

which returns nothign for that one map

eternal oxide
#

switch teh file names around and see if the config breakgin switches too

smoky oak
#

k

#

found the issue

#

apparantly

#

to get a KEY LIST

#

with getKeys()

#

you need to have a SECOND key

#

behind every key you're getting

#

let me try something else

#

its the values

#

apparantly to get a key

#

it needs to have a legit value behind itself

#

ie a number or a string or another key

#

but not a string without quotes

eternal oxide
#

odd but good to know

smoky oak
#

at least this one didnt take a week to solve lol

ivory sleet
#

Yeah of course you need a legit value

smoky oak
#

to get keys.

#

why would you

ivory sleet
#

Why not? It’s a key to a value

#

If it doesn’t have a value then it’s practically useless

earnest sonnet
#

Hello, is there a way to delay the changes between the states in player fish event? e.g: from caught to failed it's taking 10s (random number) can we change it to 30 secs?

smoky oak
#

update, you can't use 'null' as key in configs

#

isnt that treated as a string

#

ava.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map$Entry.getKey()" is null

quaint mantle
# random ledge OK

u can do smthing like

Player main = p;
                                for(Entity et : main.getWorld().getEntities()) {
                                    if(et.getType().equals(EntityType.PLAYER)) {
                                        if(main.getLocation().distanceSquared(et.getLocation()) < 20 * blocks) {
                                            Location loc = main.getLocation();
                                            Location et_loc = et.getLocation();
                                            double x = et_loc.getX() - loc.getX();
                                            double y = et_loc.getY() - loc.getY();
                                            double z = et_loc.getZ() - loc.getZ();
                                            
                                            WitherSkull skull = (WitherSkull) loc.getWorld().spawnEntity(loc, EntityType.WITHER_SKULL);
                                            skull.setVelocity(new Vector(x,y,z).normalize().multiply(speed));
                                        }
                                    }
                                }
#

speed should be smthing like 0.8

#

and blocks = range

#

should work

#

didnt test tho

random ledge
quaint mantle
#

do u understand it tho?

random ledge
lost matrix
random ledge
lost matrix
# random ledge I've tested it, it seems that wither skull in the beginning will go to another p...

This way you can set the direction the skull will be flying in before it even gets spawned:

  private static final double SKULL_SPEED = 2;

  public void shootWitherSkullAtAllPlayers(final Location start) {
    final World world = start.getWorld();
    final List<Player> worldPlayers = world.getPlayers();
    for (final Player player : worldPlayers) {
      if (player.getGameMode() == GameMode.SURVIVAL) {
        this.shootWitherSkull(start, player);
      }
    }
  }

  private void shootWitherSkull(final Location start, final Player player) {
    final Vector direction = player.getLocation().toVector().subtract(start.toVector());
    start.getWorld().spawn(start, WitherSkull.class, skull -> {
      skull.setDirection(direction);
      skull.setVelocity(direction.normalize().multiply(SKULL_SPEED));
    });
  }
random ledge
#

🙏

iron condor
#

Hey, how would I go about making daily rewards plugin?

lost matrix
iron condor
#

thanks

tardy delta
#

does inventory.getContents().size returns the amount of slots without the armourslots and the second hand etc?

next crater
#

not sure btw

outer sorrel
#

I am getting this error when trying to remove info from a database

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 'group = 'ee'' at line 1
        at JustPermissions//com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
        at JustPermissions//com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at JustPermissions//com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1337)
        at JustPermissions//com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2112)
        at JustPermissions//com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1247)
        at JustPermissions//com.imjustdoom.justpermissions.storage.SQLite.runSql(SQLite.java:51)
        at JustPermissions//com.imjustdoom.justpermissions.commands.subcommands.GroupSubcommand.executeRemoveGroup(GroupSubcommand.java:51)

code is

JustPermissions.getInstance().getSqLite().runSql("DELETE FROM groups WHERE group = '" + group + "'");

and table is

"CREATE TABLE IF NOT EXISTS groups (" +
                "`group` VARCHAR(36) NOT NULL," +
                "PRIMARY KEY (`group`)" +
                ") ENGINE=InnoDB;";
outer sorrel
#

nope

#

server version for the right syntax to use near 'group = ee' at line 1

lost matrix
next crater
#

What can I use Runnable or Threads for?

#

in spigot

eternal oxide
#

delaying code execution

#

moving entities

#

some animations

next crater
#

hmmmmmmmm

#

ok thx, going to search that later

eternal oxide
#

saving

outer sorrel
quaint mantle
#

Hello there!

According to the minecraft wiki:
Every chunk tick, some blocks are chosen at random from each section in the chunk. The blocks at those positions are given a "random tick".

Is there a kind of BlockRandomTickEvent ? If there is not, how can I detect these random ticks?

next crater
#

How do I use multiple classes with listeners (For example: I have 2 classes: | Main.java --- Listeners.java | and I want to register the Listeners in the Listeners.java, so how would I do that?)

#

I know how to do with commands (getCommand("hello").setExecutor(new Commands());) and bla bla bla

#

but with listeners, I dont

hasty prawn
#

It's the same concept

hardy swan
#

server.getPluginManager().registerEvents(Listener, Plugin)

hasty prawn
#

But there are events for specific events, such as crops growing.

next crater
#

Imagine I have 2 classes (Main and Listeners), thats what I do?:


public final class Main extends JavaPlugin {

  @Override
  public void onEnable() {
    getServer().getPluginManager().registerEvents(PlayerMoveEvent, Listeners);
  }  

}```
#

?

quaint mantle
#

In fact I am trying to add new crops to the game

hasty prawn
lost matrix
quaint mantle
#

Hmm okay, so there is a check for what blocks could get this random tick?

#

Interesting

hasty prawn
#

You should probably create your own random tick implementation for your crops.

lost matrix
quaint mantle
#

Alright, is there a way to get the actual random tick speed?

lost matrix
quaint mantle
hasty prawn
#

World#getGameRuleValue(GameRule.RANDOM_TICK_SPEED) I think

quaint mantle
#

Great

#

I don't know how I could do that without destroying performances

#

I would need to check every blocks of every loaded chunks, right?

hasty prawn
#

Store where all your crops are and just tick those

quaint mantle
#

Wouldn't it be worst if a lot of those blocks are placed?

#

I mean, minecraft doesn't store the crops blocks specifically

#

does it?

hasty prawn
#

No, but that doesn't necessarily mean it's done well either 😂

#

You can scan loaded chunks if you want

lost matrix
hasty prawn
#

But storing them, checking if they're loaded, then ticking will probably be slightly faster, just a little more messy to deal with.

quaint mantle
#

Hmm

#

I'm actually going to use entities (item frames) for the crops

hasty prawn
#

Minecraft may actually know where all the crops are, probably loads/unloads them on Chunk load/unload.

quaint mantle
#

may be I could just loop over all the entities

lost matrix
dense goblet
#

I'm having issues with custom crafting through PrepareItemCraftEvents.

quaint mantle
#

Do you think that would be better than looping over all blocks?

hasty prawn
#

So you can do both, scan chunks when they load in, save them, tick while it's loaded, and then unload them when their chunk unloads.

#

No storing & you're also not scanning every chunk every random tick, seems like a decent compromise

dense goblet
#

I intercept the event and if my custom recipe matches, I use e.setResult(). When I do the recipe with only 1 item in each slot, it works fine. But if there is more than 1 item in the stack, instead of being consumed, its count increases.

white obsidian
#

Hello, i have a bungee plugin that adds spigot servers to the server list dynamically but theres one issue. When I do /server (server name) it says "You are already connected to this server!" even though I am not. I have tried making my own /server command through spigot using plugin channels and also using the bungee api to connect the player but I still get the same issue. Anyone know why?

dense goblet
#
@EventHandler(ignoreCancelled = true)
    public void onTryCraft(PrepareItemCraftEvent e) {
        Bukkit.broadcastMessage("r: " + e.getRecipe());
        ItemInput[] inputs = ItemInput.fromStackArray(e.getInventory().getMatrix());
        CraftingRecipe matching = RecipeManager.matchCraftingRecipe(inputs);
        if(matching != null) {
            e.getInventory().setResult(matching.getCachedOutputs().get(0).getStack()); //craft special item
            return;
        }

        for (ItemStack itemStack : e.getInventory()) {
            if(CustomItem.getFromStack(itemStack) != null) {
                e.getInventory().setResult(new ItemStack(Material.AIR)); //make uncraftable
            }
        }
    }

this is my code

lost matrix
quaint mantle
#

I'm currently using this lib:

lost matrix
dense goblet
#

unless they added pdc for chunks in 1.17

lost matrix
dense goblet
#

in the API?

lost matrix
#

I thought so...

dense goblet
#

not for me

#

chunk does not have getPersistentDataContainer()

#

oh wait it does now?

#

man idk lol

#

swear it didn't have it since I spent a lot of time looking into it

lost matrix
lost matrix
dense goblet
#

welp I might try transfer over my custom block data framework to use chunk PDCs instead of my own files if that's the case

#

though idk how performant it is

#
@EventHandler(ignoreCancelled = true)
    public void onTryCraft(PrepareItemCraftEvent e) {
        e.getInventory().setResult(new ItemStack(Material.TNT));
//
//        ItemInput[] inputs = ItemInput.fromStackArray(e.getInventory().getMatrix());
//        CraftingRecipe matching = RecipeManager.matchCraftingRecipe(inputs);
//        if(matching != null) {
//            e.getInventory().setResult(matching.getCachedOutputs().get(0).getStack()); //craft special item
//            return;
//        }
//
//        for (ItemStack itemStack : e.getInventory()) {
//            if(CustomItem.getFromStack(itemStack) != null) {
//                e.getInventory().setResult(new ItemStack(Material.AIR)); //make uncraftable
//            }
//        }
    }
#

if you have 1 item in the stack, it consumes it

#

if you have 2 items, it doesn't consume any

#

if you have 3 or more items, it adds to the stack instead of subtracting, based on how many items are already in the stack

#

the crafting logic seems broken when the recipe is null but the result is not air

#

I can't use vanilla recipes as they are too limiting, and custom ingredients are not supported

lost matrix
#

With full NBT matching

chrome beacon
#

^^ Just the output item can't have NBT

lost matrix
chrome beacon
#

But that can easily be fixed

dense goblet
#

I may want to check if an nbt tag is between the value of 0.3 and 0.7

chrome beacon
#

Well you can do that too

dense goblet
#

I tried extending the ingredient interface and it wasnt supported

chrome beacon
#

You will need some NMS though

dense goblet
#

any way to do it without NMS?

chrome beacon
#

Probably idk

lost matrix
dense goblet
lost matrix
#

Ill try a mock up

chrome beacon
#

Add recipe without NBT if it matches prepare event will be fired then check NBT

#

Cancel event if needed

dense goblet
#

was thinking that yeah

#

is it possible to match an item by nbt but not by material

heavy escarp
#

I need help getting Java 16 for 1.17 im on debian 9

chrome beacon
undone axleBOT
#
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update

apt-get install -y openjdk-16-jdk

update-alternatives --config "java"```
heavy escarp
#

do i have to copie those first 4 lines?

chrome beacon
#

Copy all of it and run in termimal

heavy escarp
#

everything?

chrome beacon
#

Yes

heavy escarp
#

still the same

chrome beacon
#

What did running those commands tell you

heavy escarp
lost arch
#

Reboot your computer, easiest way to fix that

#

Imo

lost matrix
# dense goblet is it possible to match an item by nbt but not by material
  private void registerCustomRecipe() {
    final ItemStack result = new ItemStack(Material.DIAMOND_SWORD);
    final ItemMeta resultMeta = result.getItemMeta();
    resultMeta.addEnchant(Enchantment.DAMAGE_ALL, 9, true);
    resultMeta.setDisplayName("§9Cool Sword ;D");
    result.setItemMeta(resultMeta);

    final ItemStack exactIngredient = new ItemStack(Material.DIAMOND_BLOCK);
    final ItemMeta exactMeta = exactIngredient.getItemMeta();
    exactMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
    exactIngredient.setItemMeta(exactMeta);

    final ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("cool_sword"), result);
    recipe.shape("S", "S", "S");
    recipe.setIngredient('S', new ExactChoice(exactIngredient));

    Bukkit.addRecipe(recipe);
  }

Results in:

dense goblet
heavy escarp
#

@chrome beacon so what do i do?

wispy monolith
#

how to set an item and make it unbreakable

#

?

lost matrix
dense goblet
#

All I really need is for the recipe to match in all the valid cases, and it doesn't matter if there are false positives

lost matrix
wispy monolith
#

thx

dense goblet
#

biggest problem is I have PolymorphicItems, which means that they can be any Material

lost matrix
dense goblet
#

they are identified by an NBT tag

grim ice
#

uh what

dense goblet
#

if there was a way to test that an item of any type has some NBT, then that's all I need I think

lost matrix
dense goblet
#

because when registering my custom recipes I can convert them and register as a vanilla recipe:
Vanilla items are straightforward
Most custom items can just match by material
Polymorphic custom items will have to match by nbt but not by material

#

then do more advanced logic in the prepare craft event

#

I could just have a choice recipe with all materials but that might be laggy?

lost matrix
wispy monolith
# lost matrix ``ItemMeta#setUnbreakable(true)``

hmmmm, I have this

player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD));

where should I add it?
i tried this but it should an error:

player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD).getItemMeta().setUnbreakable(true));
dense goblet
#

honestly why is it so hard for them to support custom predicates .-.

lost matrix
lost matrix
dense goblet
#

fair point I guess xd

fluid cypress
#

can i somehow make a player open a book from his inventory? or even better, make it open one without having to put it in his inventory?

#

and then read it when he finishes writing it

lost matrix
fluid cypress
#

the "without having to put it in his inventory" thing? or the "open a book" thing?

lost matrix
#

Yes. Opening a virtual book might be a bit tricky.

fluid cypress
#

ok, then just open a normal book in his inventory, can i do that?

lost matrix
#

Huh. I think you still need to send a packet to the player for that.

#

Let me check

fluid cypress
#

ok

#

i used protocollib, just once, can i do it with that maybe?

lost matrix
#

Oh nvm. They added it to the API.
So there is Player#openBook(ItemStack) which forces the player to open that book (Even if its not in his Inventory)

fluid cypress
#

thats great, i guess since its an itemstack i can write stuff to it first with some meta data or whatever

#

is there an event for when the player finish writing it?

lost matrix
#

PlayerEditBookEvent

lost matrix
fluid cypress
#

ok thanks

lost arch
#

Could anyone point me at some documentation about registering commands at runtime? I am aware it’s a bad idea.

lost matrix
lost matrix
lost matrix
lost arch
#

I want to dynamically register them, so they won’t exist in the yml

hasty prawn
#

You have to use reflection and directly add them to the command map

lost matrix
hasty prawn
#

Reflection because PluginCommand's constructor is private I believe

hasty prawn
#

Well, it's protected, not private, still inaccessible without Reflection either way lol

tardy delta
#

how can i look for something random in my config.yml file?
I want to lookup a home for a player like "homes." + p.getUniqueId() + someNumber that indicates the amount of homes the player has and idk that value + home name

hasty prawn
#

Why not do something like
"homes." + p.getUniqueId().toString() + ".amount" and store the amount they have there?

#

If that's not what you're asking then I don't know what you mean either

lost matrix
tardy delta
#

well maybe its better to loop through all their homes until i find it

lost matrix
lost matrix
quaint mantle
#

Reading things directly from configs in your code is slow, makes it stringly typed, and easy is to mess up with things like typo's as the IDE can't check whether your strings correspond to valid config entries

tardy delta
hasty prawn
#

Well for starters you need a "." between the UUID and the number

quaint mantle
#

Use a ConfigurationSection.

lost matrix
# tardy delta

You should probably use a List for that instead of having a single incrementing number in your config path.

tardy delta
#

the homes are saved like that and i'm making a command that deletes one with the given name

lost matrix
#

Make your home ConfigurationSerializable and then just throw in a List<Home> in your config which you can later just read as a List<Home>

hasty prawn
#

Might be better if you also let them name their homes. That way you can use that as the home key & they have something they can easily remember

tardy delta
quaint mantle
#

🙈

lost matrix
tardy delta
#

hmm everyone can have two homes and i check home many homes they already have with that number

quaint mantle
#

Key them by name instead. Assuming there can't be duplicate names for a given player.

hasty prawn
#

You can just count the size for how many they have

quaint mantle
#

homes.uuid.homename.yaw, and so on

hasty prawn
#

^

#

Or do what 7smile7 suggested and serialize the whole thing

tardy delta
#

and a number for how many they have?

#

oh just storing on the name i understand

quaint mantle
#

You can tell how many they have by looking at the size of the configuration section.

hasty prawn
#

^

tardy delta
#

ki thanks

dense goblet
#

bruh what

[15:59:55] [Server thread/INFO]: [KaktuszLogistics] SHAPE: [012, 345, 678]
[15:59:55] [Server thread/ERROR]: Error occurred while enabling KaktuszLogistics v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: Symbol does not appear in the shape:0
#

0 is clearly there

fluid cypress
#
ItemStack book = new ItemStack(Material.WRITTEN_BOOK, 1);
BookMeta meta = (BookMeta) book.getItemMeta();
meta.addPage("some\n§cred\ntext\nhere");
book.setItemMeta(meta);
player.openBook(book);

what does it mean

dense goblet
#

is "012", "345", "678" not valid for shaped recipes?

hasty prawn
hasty prawn
dense goblet
#

rip ok

#

is there a way to increment characters like in C

hasty prawn
#

Also I assume you're actually giving 0 a value?

dense goblet
#

yes I'm trying to

hasty prawn
#

How are you doing that

quaint mantle
#

Yes. Char can be treated as a number.

#

char c = 'a'
c++
print(c)

dense goblet
# hasty prawn How are you doing that
//generate shape
        StringBuilder shape = new StringBuilder();
        int num = 0;
        for(int y = 0; y < r.getSizeY(); y++) {
            for (int x = 0; x < r.getSizeX(); x++) {
                shape.append(num);
                num++;
            }
            shape.append("/");
        }
        recipe.shape(shape.substring(0, shape.length()-1).split("/"));
        KaktuszLogistics.LOGGER.info("SHAPE: " + Arrays.toString(recipe.getShape()));
        //set ingredients
        num = 0;
        for(int y = 0; y < r.getSizeY(); y++) {
            for (int x = 0; x < r.getSizeX(); x++) {
                ItemIngredient ingredient = r.getIngredientAt(x, y, 0, 0);
                if(ingredient != null) {
                    recipe.setIngredient((char)num, ingredient.getVanillaRecipeChoice());
                } else {
                    recipe.setIngredient((char)num, Material.AIR);
                }
                num++;
            }
        }

        Bukkit.addRecipe(recipe);
quaint mantle
#

Should print out b

dense goblet
#

ok ty Oculus

quaint mantle
#

Since the unicode code point of b comes directly after a.

#

Also, what you are doing there is not using 012, 345, 678. int 0 does not correspond to the "0" character. The first few unicode symbols are control characters.

dense goblet
#

ayy sweet it seems to work 😄

dense goblet
quaint mantle
#

The digit zero is only at u0030.

lost matrix
# tardy delta ki thanks

Let me show you a quick mock up i wrote. Location implements ConfigurationSerializable on default.

dense goblet
#

casting int to char converts it to the symbol

#

(char)0 == '0'

lost matrix
# tardy delta ki thanks
@Data
@AllArgsConstructor
public class Home implements ConfigurationSerializable {

  private String name;
  private String owner;
  private final Location location;

  @Override
  public @NotNull Map<String, Object> serialize() {
    final Map<String, Object> data = new HashMap<>();
    data.put("name", this.name);
    data.put("owner", this.name);
    data.put("location", this.location);
    return data;
  }

  public static Home deserialize(final Map<String, Object> map) {
    final String name = (String) map.get("name");
    final String owner = (String) map.get("owner");
    final Location location = (Location) map.get("location");
    return new Home(name, owner, location);
  }

}
  @SneakyThrows
  public void savePlayerHomes(final UUID playerID, final File playerFile) {
    final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(playerFile);
    final List<Home> playerHomes = homeManager.getHomes(playerID);
    configuration.set("homes", playerHomes);
    configuration.save(playerFile);
  }

  public List<Home> loadPlayerHomes(final File playerFile) {
    final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(playerFile);
    final List<Home> homes = (List<Home>) configuration.getList("homes");
    return homes;
  }
quaint mantle
#

I quite doubt that

lost matrix
#

This aint javascript

quaint mantle
#

sup

dense goblet
dense goblet
quaint mantle
#

And what if you were to cast int 23 to a char?

dense goblet
#

no idea for double digits

fluid cypress
dense goblet
#

im not saying its right, im saying thats what Java did

quaint mantle
#

I'll have to test it later

dense goblet
#

oh actually I may be wrong

#

I didn't cast it

#

I let it auto-convert

lost matrix
fluid cypress
hasty prawn
#

Yeah I don't think it's possible to open a writable book 😦

dense goblet
#

yeah my bad so maybe it was working same as in C

#

but its weird that doing setIngredient((char)num) complained about symbol '0' instead of the ascii symbol at index #0

fluid cypress
#

if i have an itemstack in my hand i store the reference to that object, then i drop it and another player grabs it, the reference is still the same? what if the item gets destroyed? any way of knowing that? or at least a way to know if that item went out of the player's inventory somehow

quaint mantle
#

yeah

fluid cypress
#

yea what

gleaming grove
fluid cypress
#

then how do i know, at any point, if that item still exists?

hollow sand
#

Hello, I opened up Intellij today, with alot of errors. But, the yesterday, my IDE was working fine. No errors. these are my errors

hasty prawn
#

Seems like your IDE was on break yesterday

hollow sand
#

How could I fix the issue?

hasty prawn
#

Those are syntax errors, it gives you the line number & whats wrong

#

So you need to go back and fix them

hollow sand
#

im using intellij 2021.2

#

the new build

hasty prawn
#

Should've been errors, not sure why your IDE didn't show them

quaint mantle
#

hello i am trying to create reload command
but when i do

Bukkit.getPluginManager().disablePlugin(PVP.plugin);
Bukkit.getPluginManager().enablePlugin(PVP.plugin);

it doesnt works
any help?

stone sinew
gleaming grove
#

use OnPluginDisableEvent to check if your code works

hollow sand
quaint mantle
#

so how i do plugin reload like
/pvp reload

fluid cypress
#

how can i get the itemstack of the edited book inside PlayerEditBookEvent?

stone sinew
hasty prawn
quaint mantle
gleaming grove
stone sinew
quaint mantle
gleaming grove
#

i made for my purpose /disableplugin (pluginName)

#

but u to not complicate stuff

dusk flicker
#

Most plugin reload commands just reload the configuration files, not actually restart the plugin

gleaming grove
#

why dont you trigger method OnEnable and OnDisable

#

PVP.getPlugin(PvP.class).OnEnable(); PVP.getPlugin(PvP.class).OnDisable();

dusk flicker
#

Yeah don't do that

stone sinew
worldly ingot
#

Well, calling onEnable() and onDisable() isn't going to consider your plugin enabled/disabled

#

It's just dumb lol

#

If you were to do PluginManager#disablePlugin(this), however, then yes you're correct

#

Really though, there is no reason whatsoever for you to be enabling/disabling your plugin at runtime.

static anchor
#

bungeecord question: is it possible to send a player to a specific server right after auth through a plugin? I need to have a fully dynamic configuration, so I'd like to send a player to a specific server without having to have an empty server just for the purpose of rerouting.

smoky oak
#

I want to check if an inventory contains a shulker box, is there a easier way to check than to loop through every item stack and check if its one of the 17 Material.<Shulker box here>?

dusk flicker
#

just get the inventory contents and check if it contains

smoky oak
#

issue

#

there isnt just one kind of shulker box

#
inventory.contains(new ItemStack(Material.SHULKER_BOX),1);```
does not work
dusk flicker
#

Hmm

shut field
smoky oak
#

what if its renamed

stone sinew
smoky oak
#

is that better or worse than this?

for(ItemStack i : inv.getContents()){
  if(shulkerset.contains(i.getType())){
    player.sendMessage("Shulkers cannot be stacked thrice.");
    return;
 }
}```
with shulkerset being enumSet ShulkerBox to BlackShulkerBox
shut field
#

so you can get the item's material, turn it into a string, and do if string contains "shulker_box" or "shulker box"

minor garnet
#

people, I have a method that generates a random number with a minimum and maximum value, after that I will use a lerp to make these numbers smooth, after that I add them up to give this random value, after reaching this value, it will be decreased to 0, but I want to make it have a balancing effect that goes to the negative numbers, then goes up again and goes down and stays stopped at 0, as if it were moving, so someone know how i can do this ?

smoky oak
#

How is that a bukkit question

stone sinew
smoky oak
#

fair lol

minor garnet
smoky oak
#

there are dedicated java help servers though

shut field
#

does anyone know how to use deserialize staticly?

smoky oak
lost matrix
smoky oak
#

now it makes more sense

lost matrix
next crater
#

guys

shut field
#

I am trying to save a class var to a file and then get it back

next crater
#

should I use IntelliJ or eclipse? Which is better?

shut field
lost matrix
#

You lucky i just wrote an example for someone:

@Data
@AllArgsConstructor
public class Home implements ConfigurationSerializable {

  private String name;
  private String owner;
  private final Location location;

  @Override
  public @NotNull Map<String, Object> serialize() {
    final Map<String, Object> data = new HashMap<>();
    data.put("name", this.name);
    data.put("owner", this.name);
    data.put("location", this.location);
    return data;
  }

  public static Home deserialize(final Map<String, Object> map) {
    final String name = (String) map.get("name");
    final String owner = (String) map.get("owner");
    final Location location = (Location) map.get("location");
    return new Home(name, owner, location);
  }

}

Just let the class have a static method named "deserialize" which takes a Map<String, Object> and returns the class which it is in.

lost matrix
next crater
#

🧐

#

ok thx

smoky oak
#

um new issue

#

that lambda operator makes it a method

#

so return does not 'return' from the super method

#

can i somehow do a double return or something?

stone sinew
smoky oak
#

annnd we're where we started XD

#

i wanted to know if i can do it somehow without that

lost matrix
quaint mantle
#

Iterating over a List of materials and checking one by one if an inventory contains items of that type is significantly slower than iterating over the slots of an inventory and checking if a set contains the material of that slot.

stone sinew
smoky oak
#
for(ItemStack s : inv.getContents()){
  if(shulkerset.contains(s.getType())){
    player.sendMessage("You can't stack shulkers trice!");
    return;
  }
}

IE return when the inventory contains a shulker

#

where shulkerset is the 17 enums that make up the shulker boxes in the game

stone sinew
smoky oak
#

dude

#

theres more than one kind of shulker box

#

thats why im doing this in the first place

stone sinew
quaint mantle
#

No. Do not use inv.contains(). Like I just said, that would be an order of magnitude slower.

next crater
stone sinew
#

You iterate through the list of shulker box materials and check if the inv contains that material

lost matrix
#

There is a Tag for shulker boxes

    for (final ItemStack itemStack : inv) {
      if (itemStack != null && Tag.SHULKER_BOXES.isTagged(itemStack.getType())) {
        player.sendMessage("You can't stack shulkers trice!");
        return;
      }
    }
quaint mantle
#

This is the ideal solution. ^^

lost matrix
#

And Inventory implements Iterable<ItemStack>

smoky oak
#

thats interesting

#

thanks

#

imma try

#

isnt that iterating tho?

#

wheres the difference between ItemStack itemstack : inv and ItemStack itemstack : inv.contains()

quaint mantle
#

The difference is that an inventory is effectively a List. Calling contains on it is suboptimal.

smoky oak
#

aaah

quaint mantle
#

You want to iterate over the List-like collection, because that is what Lists are good for.

smoky oak
#

since youre basically doing it twice

quaint mantle
#

Hello, spigot ! I made a custom recipe with prepareItemCraftEvent with custom itemstack with custom amount, but when I craft item with 2x+ item matrix, the matrix doesn't remove.;
I tried to clear inventory, but it occurs many erros (in my case.). how can I solve this?

#

And you want to call contains on the Set-like collection, because that is what Sets are good for.

#

So, you iterate over the inventory (the list), and call contains on the Tag (the set).

lost matrix
quaint mantle
#

What yapperyapps suggested was the reverse: Iterating over the set, and calling contains on the list. Which is backwards.

smoky oak
#

explains a lot. On a similar note though, can you somehow get the inventory of a shulker box without doing this mess?

Inventory inv = Bukkit.createInventory(null, 27, "Shulker Box");
BlockStateMeta bsm = (BlockStateMeta) e.getCursor().getItemMeta();
BlockState bs = bsm.getBlockState();
ShulkerBox sb = (ShulkerBox) bs;
inv.setContents(sb.getInventory().getContents());```
proud basin
#

How can I get a specific row from sql

quaint mantle
#

Not that I know of. The inventory is stored in the item meta. So you'll have to go through the standard itemmeta steps to get it.

quaint mantle
stone sinew
lost matrix
next crater
#

is it okay if I use JDK 1.8?

lost matrix
#

Selects all rows from this table where a certain condition is met. For example to select the row that contains a certain name:
SELECT * FROM homes WHERE owner='bob'

lost matrix
lost matrix
quaint mantle
#

by myself

next crater
next crater
#

hmmmm

#

like 1.16.4, yeah

#

Almost every plugins are for 1.16.4

lost matrix
next crater
#

do I need to unistall java 1.8?

lost matrix
next crater
#

sorry

#

unistall java 1.8*

lost matrix
#

You can just download and install jdk 11 or 16. It will set itself as default jdk. Having multiple jdk versions install doesnt harm you in any way (usually)

next crater
#

ok thx

#

and btw when you say "Java 11 is currently the golden standard", you are talking about java 11 or JDK 11?

smoky oak
#

well you cant build without jdk

#

but its functionally the same

#

difference is that the jdk includes the compiler

next crater
#

hmmmm ok, thx :D

smoky oak
#

since you're in a developement channel tho Imma guess you need the jdk

next crater
#

and what about java?

#

not JDK, but java

smoky oak
#

usually newer is better but remember that depending on the minecraft version you build you have to code in either 1.8, 11 or 16 java

next crater
#

alright, fine

#

thx ❤️

quaint mantle
# next crater not JDK, but java

Not JDK, but JRE*

Jdk is for development, it includes JRE and extra stuff for development
Jre is for just running Java programs

Both are Java

next crater
#

oooooh

proud basin
next crater
#

alright then...

lost matrix
#

This query would yield the same result:

SELECT * FROM users WHERE age=12

But only because there is one user in this table that is 12 years old

#

For fast lookup times you usually want to define one column with unique entries and index it.
In Spigot the UUID is most suitable for most tables.

next crater
#

man wtf

#

I tried to create a new spigot project

#

and then it doesnt created everything

dusk flicker
#

it created a basic java project?

#

Just create everything else yourself

#

not that hard

next crater
#

im lazy

dusk flicker
#

too bad

next crater
#

I like to create from the spigot project

#

😔

proud basin
lost matrix
proud basin
#

but that displays the age too

#

oh wait

#

hold up this is nothing i want to do

#

idk what im talking

lost matrix
hardy swan
#

Or have a boilerplate...

lost matrix
next crater
#

im creating a spigot project from that plugin

#

and then it is creating errors

lost matrix
proud basin
#

Is there some way I can do something like PreparedStatement#getString("Cooldown").size()

next crater
#

yeah

#

im going to reinstall that plugin

hardy swan
#

Or resultset

proud basin
#

yea meant resultset

proud basin
hardy swan
#

This cooldown thing, is it nullable

next crater
#

@lost matrix btw I think the error is: "Could not find the pom.xml file"

#

can I fix it?

hardy swan
#

Create one

lost matrix
proud basin
#

I figured it out

#

I got it

next crater
#

btw I think where this error is coming from

lost matrix
# proud basin I figured it out

If you want to get the cooldown of the user with a certain uuid then you can get it with

SELECT cooldown FROM cooldowns WHERE UUID='some_user_id'
hardy swan
proud basin
#

No

#

I just did ```java
for (int i = 1; i <= data.getColumnCount(); i ++) {
if (data.getColumnName(i).equalsIgnoreCase("Cooldown")) {
System.out.println(res.getString("Cooldown"));
}
}

proud basin
#

That's what have though...

lost matrix
proud basin
#

"SELECT * FROM kitCooldown WHERE UUID = ?

#

I've already figured out what I wanted

lost matrix
lost matrix
#

-.-

proud basin
#

nah nah nah what I mean is I've already completed what I wanted

#

I just did it another way

hardy swan
lost matrix
#

Eh...

proud basin
#

Did i confuse you 7smile7

hardy swan
#

And res.getString("Cooldown") is already what you want, dun get why you are iterating through columns anyways

hardy swan
proud basin
#

oh yea

next crater
#

@lost matrix Fixed it, I had "hidden" the pom.xml file in the settings, so when creating a spigot project, it wasn't finding the pom.xml file

ebon badge
#

Hey! :3
I am new to plugins, could you tell me how and where I can use this commands?

hardy swan
ebon badge
#

): ok

hardy swan
hardy swan
next crater
#

If I want to use multiple classes with commands, thats how I would do it? (just to confirm)

Main.java

public final class Main extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("hi").setExecutor(new CommandClass());
    }
}```

----------------------------------------------------------------------------------

**CommandClass.java**
```java
public class CommandClass implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        return false;
    }
}```
lusty cipher
#

well... yes?

next crater
#

ok thx

royal hawk
#

Guys how change color glow player?

#

i have this code

paper viper
#

You need to use NMS iirc

hasty prawn
#

You can add them to a Scoreboard Team and set the Team's color

paper viper
#

Yeah you could do that too

royal hawk
#

Okay i'm probably try create scoreboard team

#

create only team yes?

#

this not work

maiden briar
#

Bukkit.getWorld fails, but the world is in the server folder

quaint mantle
#

is it the correct name

maiden briar
#

Yes

lost matrix
maiden briar
#

I don't know

#

How to do that?

quaint mantle
#

it should be loaded by default if its vanilla

lost matrix
maiden briar
#

Ok, I did not see a method .loadWorld() or smth

lost matrix
#

createWorld() reads from an existing world file.

maiden briar
#

Ok then well do that

#

new WorldCreator("") what is the name?

#

Just how I find the map named?

lost matrix
maiden briar
#

Ok

iron condor
#

how can I remove the bed spawn point from player and set it to world spawn (I set the world spawn to the radius of 1000 so they spawn randomly)

#

I cannot null the setRespawnLocation

gleaming grove
# maiden briar Ok

you can run this code to see worlds that are loaded Bukkit.getWorlds().stream().forEach(w -> Bukkit.getConsoleSender().sendMessage(w.getName()));

maiden briar
#

Good idea, but I would like it doing like this:

World world = Bukkit.getWorld(args[0]);
        
if(world == null)
    world = Bukkit.getServer().createWorld(new WorldCreator(args[0]));
lost matrix
gleaming grove
#

good to know, since what version of Java?

lost matrix
#

Since lambdas got introduced. So 1.8 i suppose

maiden briar
#

Works very good

hasty prawn
#

Weren't Streams introduced in 8?

quaint mantle
#

hey 7smile7 did you perhaps have some time to look into what we talked about yesterday? I did some testing on my own when I had time but nothing really came out of it

hasty prawn
#

So they were obsolete to being with? Lol

lost matrix
lost matrix
quaint mantle
#

the structure of containers was a mess for me to look at lmao

hasty prawn
lost matrix
# hasty prawn big brain

I mean the streams arent obsolete but calling foreach on a stream instead of a collection actually produces overhead.

hasty prawn
#

Yeah I couldn't come up with anything Dan, from what I saw the way they handle registering is a disaster

lost matrix
hasty prawn
quaint mantle
#

sad well I guess I will look into the older versions to see where it was changed

lost matrix
#

Even with packets its not possible. The client only knows these registered inventory types:

quaint mantle
#

yeah I see, welp it would have been cool to do

#

if that was fixed before 1.15 then sadly I can't do what I was thinking to do

hasty prawn
#

What exactly are you trying to do anyways?

#

Even if you get it working it's super ugly

quaint mantle
#

so pretty much with the unicodes you can create guis how you want

#

How do u make custom attributemodifiers

quaint mantle
hasty prawn
#

Interesting, didn't know that was possible.

quaint mantle
#

yeah it's pretty cool

#

I was testing with some stuff yesterday and the chest bug came back to my mind

vestal dome
#

DoEs AnYoNe KnOw FmL pRoToCoL?

lost matrix
lost matrix
quaint mantle
#

I know

#

I am just saying that it would open up more possibilities

quaint mantle
#

but how would it work with custom stats

lost matrix
quaint mantle
#

having more slots would enable for some less common looking stuff

gleaming grove
#

When it comes to mods. Do you know a way to refresh Forge mod in the runtime?

lost matrix
quaint mantle
#

well i have a GamePlayer class

#

for each player

#

that has custom stats in it

#

how would i make it add to that?

quaint mantle
lost matrix
quaint mantle
#

I mean yeah I know

#

I have done some custom menus yeah, just more possibilities with bigger gui sizes

lost matrix
#

But you want more custom buttons at the bottom

#

I see

hasty prawn
#

Does it require texture packs to do that?

lost matrix
#

Ofc

quaint mantle
#

it's not that I have something in mind specifically, just in general more creative freedom

hasty prawn
#

I figured

quaint mantle
#

yeah yeah resource packs are required

#

I forgot but you actually could open 2 double chests at the same time too

#

so much space lmao, sadly it can't be used

lost matrix
#

Me want

lost matrix
quaint mantle
#

wait how does minecraft get the gui sizes actually? because of the not used sizes it wouldn't make sense for them to hard code the ones they don't use

quaint mantle
#

oof no custom emoji

waxen plinth
#

:otDan:

quaint mantle
#

1.12 still has it hmm

#

yeah 1.13 fixes the physical version to open it up, idk if it changes it too

lost matrix
quaint mantle
#

yeah fr

quaint mantle
cold tartan
#

is there a way to build an api dependecy into the plugin with maven, rather than having it required in the plugins folder?

lost matrix
cold tartan
quaint mantle
cold tartan
lost matrix
cold tartan
#

but i could do it with gradle i think

lost matrix
lost matrix
lost matrix
# cold tartan but i could do it with gradle i think

You cant load another plugin into your own because the spigot classloader wont realise there is another plugin withing a plugin. So the onEnable() and onDisable() of that shaded plugin will never get called.
If you however just have a plugin with a bunch of utility classes in them and that doesnt need to be loaded/enabled then you can just shade it in with maven like you would do with every other depenency.

quaint mantle
tacit drift
#

is there an event that gets triggered when an item breaks or loses durability?

tacit drift
#

name?

lost matrix
#

?javadocs

quaint mantle
#

PlayerItemDamageEvent

#

yea

lost matrix
#

?docs

#

hm...

#

?gelp

tacit drift
quaint mantle
#

cancelling doesnt work if u wonder that

lost matrix
#

?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.

**__CustomCommands:__**

customcom Base command for Custom Commands management.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.

**__ModLog:__**

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

**__Permissions:__**

permissions Command permission management tools.

tacit drift
#

thx

quaint mantle
#

u have to se the damage to 0

tacit drift
lost matrix
#

?customcom

undone axleBOT
#
CafeBabe Help Menu
Syntax: ?customcom 
Alias: ?cc
Base command for Custom Commands management.

**__Subcommands:__**

list List all available custom commands.
raw Get the raw response of a custom command, to get the proper...
search Searches through custom commands, according to the query.
show Shows a custom command's responses and its settings.

lost matrix
#

?help cc