#help-development

1 messages ยท Page 477 of 1

earnest lark
#

remove the extends JavaPlugin from line 19

weak meteor
#

the one thing is always a semi colon

earnest lark
#

yea but you can usually find that

#

um

#

no

echo basalt
earnest lark
#

should

echo basalt
#

you'll need to change some stuff around

earnest lark
#

i didnt looik through everything tho

#

so yea

echo basalt
#

because you use schedulers and all

#

so

#

?di

undone axleBOT
echo basalt
#

will be useful

earnest lark
#

Entity tnt = target.getWorld().spawnEntity(target.getLocation(), EntityType.PRIMED_TNT);

#

im bieng dumb

echo basalt
#

TNTPrimed tnt = world.spawn(location, TNTPrimed.class);

#

is shorter imo

earnest lark
#

nah

#

bc it returns a EntityType

echo basalt
#

If you only have an entity type, then just cast

earnest lark
#

yea

echo basalt
#

TNTPrimed tnt = (TNTPrimed) world.spawnEntity(location, EntityType.PRIMED_TNT);

earnest lark
#

yea

#

just realized

#

i always forget i can cast things

#

now i feel dumb

echo basalt
#

got some school work to do, would be cool if I could go to bed before 5am skullWazowski

#

That's part of the plugin.yml

earnest lark
echo basalt
#

making a copy of that world, saving it to a database under a name

#

and then loading that world copy and pasting it on a "grid"

jagged monolith
#

Add the api version into your plugin.yml

echo basalt
earnest lark
#

are you using world edit as a base

echo basalt
#

It's one of the serializers

#

I can make my own or use any other

earnest lark
#

oh ok

echo basalt
#

It's just a matter of writing one of these

earnest lark
#

gonna be honest

#

got no idea what any of that is

echo basalt
#

interfaces, javadocs

#

generic types

earnest lark
#

oh

echo basalt
#

My idea is to make future plugin development easier

#

if I want to make an arenas plugin I can just use this as a base

#

and do something like

earnest lark
#

ok can you explain something

#

why use ->

echo basalt
#

They're lambdas

#

Basically code blocks that can be executed at any time

#

Here's an example:

public void doSomethingThen(Runnable runnable) {
  doSomething();
  runnable.run();
}
#

and you can call it like

#

doSomethingThen(() -> /* run code here */);

#

and that code block that you pass as a parameter

#

will be called after doSomething()

earnest lark
#

oh

#

so it takes in a code segment as a paramater bassicaly

echo basalt
#

Yeah pretty much

#

and that code segment will be executed whenever the method I'm calling decides

#

In this case I'm using CompletableFutures, which are basically a chain of actions that will happen

#

They let you do stuff like

#
CompletableFuture<Void> operation = runAsync(() -> {
  // run this code async
  someExpensiveDatabaseOperation();
});

operation.thenRun(() -> {
  // something else (same thread as the operation above)
  ...
});
#

You can pass such futures as parameters, or return futures so other methods can then hook into your action

earnest lark
#

gotcha

#

never understood it

echo basalt
#

here's a technical explanation

#

But here's a more realistic approach

#
public interface StorageDatabase {

  CompletableFuture<StoredData> fetchPlayerData(UUID playerId);
  CompletableFuture<Void> storePlayerData(UUID playerId, StoredData data);
  CompletableFuture<Void> deletePlayerData(UUID playerId);

}
public class MySQLDatabase implements StorageDatabase {

  @Override
  public CompletableFuture<StoredData> fetchPlayerData(UUID playerId) {
    return CompletableFuture.supplyAsync(() -> {
      // SELECT WHATEVER FROM SOME TABLE WHERE PLAYER ID = playerId
      return object;
    });
  }

  ...
}
public class FlatFileDatabase implements StorageDatabase {

  private final File userFolder = ...;

  @Override
  public CompletableFuture<StoredData> fetchPlayerData(UUID playerId) {
    return CompletableFuture.supplyAsync(() -> {
      // get file from folder, read file, get object
      return object;
    });
  }

  ...
}
#

And then to use it

#
StorageDatabase database = plugin.getStorageDatabase(); // whatever

database.fetchPlayerData(playerId).thenAccept(data -> {
  player.sendMessage("Your data is here!");
  // do something with the data
});
#

And this way you guarantee that your data is being fetched async, yet still associate a code block to run when the data is available

#

And we use an interface to standardize our storage operations, so that the process of data serialization is handled by our implementation, and not by the rest of the codebase

true perch
#

Using YamlConfiguration how do you get a list of all the items found in a config file?

  '1':
    Name: Test 1
  '2':
    Name: Test 2```
For example, return a list of `1, 2` from the `items` category.
remote swallow
#
for (Strng key : YamlConfiguration.getConfigurationSection("items")) {
    // do stuff
}
remote swallow
#

oh ture

#

i forgot abou that

#

would there be a better way to store a list in a sql database than making it a single string

echo basalt
#

create 1 row for each element

#

or make a list identifier and then a ton of rows

#

like

#

let's say you have a Map<UUID, List<String>> permissionMap

#

then you have a table

UUID VARCHAR(36) PRIMARY KEY UNIQUE | permission

#

and just a bunch of

#

<uuid> | permission1
<uuid> | permission2

remote swallow
#

only problem is there is no set limit to how many entries could be in said list and i think that it may very large after like 2 weeks

crystal bay
#

making an anticheat is fun lol

#

but also very brutal

steep scroll
#

How do I make the playsound work only for ambient

regal scaffold
#

To create multi-line holograms

#

With display entities

#

Is the approach still use a offset?

#

And have a display entity per line in hologram group?

echo basalt
#

p much

regal scaffold
#

Alright

misty ingot
#

hey so I am looking forward to creating a couple of custom mobs and I have been able to find examples of such on various forum posts but I cannot figure out how to make these mobs spawn randomly around the world, like for example, skeletons or zombies which would automatically spawn all around your minecraft world

echo basalt
#

The most logical approach is to just look at how nms spawns mobs

sullen canyon
sullen canyon
misty ingot
#

yeah I want like

#

very natural spawning of the mobs

#

and be able to configure the spawn chances of certain ones

void skiff
#

how do I execute command as nLogin countdown instead of sending it to actionbar?

#

I wanna make it bossbar

sullen canyon
#

this might be like getting a few chunks around a player and count mobs in them and if it is not enough then you spawn more

misty ingot
#

didnt you just ask that

void skiff
misty ingot
#

the whole idea is kinda like, there are "doge"(s) which can very rarely spawn in your world (they are just renamed wolves) and if you right click them x and y happens

misty ingot
void skiff
#

ok

sullen canyon
void skiff
#

instead of sending a message to actionbar for login countdown

#

I want it to send some command instead

sullen canyon
#

what login countdown

#

what command

#

sorry I don't understand

void skiff
#

if I logged in

#

it will show the timer in actionbar

#

is it possible to change it to execute some commands

#

instead of sending message to actionbar?

misty ingot
#

so you want to edit a plugin

#

to make it execute commands instead of sending a timer in the actionbar you would first have to have the source code of the plugin

#

then go in the class where its happening and change the behaviour of the timer system

vital sandal
#

how do I remove pom.xml from my plugin when compile?

kind hatch
#

You don't? It's not included in the final jar.

vital sandal
kind hatch
# vital sandal

You could probably add an exclusion filter to the shade plugin.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.4.1</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/maven/**</exclude>
                        </excludes>
                    </filter>
                </filters>
            </configuration>
        </execution>
    </executions>
</plugin>
kind hatch
#

I just spent an hour tracking down and dealing with timestamps and getting incorrect values all because I forgot to use the right config path. ๐Ÿ’€

native ruin
#

gamer moment

echo basalt
#

gamer moment

void skiff
# void skiff ok

where does the timer system code located in in openlogin folder?

tardy delta
#

Lol

#

Check their code

true perch
#

I'm saving data for groups within a yml file. Any feedback on the formatting before I move on?yaml groups: 6ae3444c-6921-42fd-baee-5a718fc2487d: // the group's unique ID Name: Test Group Acronym: TG Description: Test Description. Members: 069a79f4-44e9-4726-a5be-fca90e38aaf5: LEADER 4a3f6ed4-153d-424a-858d-5fdd2e78fc54: MEMBER Settings: - OPEN - NPC_LOOT_SHARE Members Permissions: - TELEPORT_TO_STRUCTURES Officers Permissions: - KICK_MEMBER

lost matrix
remote swallow
#

would it be reliable to divide an int by 10 or 100 to keep track of something being true/false relating to that number

#

try to think of ways i can make my life somewhat easier in the future

lost matrix
#
public void doSomething(int ticks) {
  if(ticks % 10 == 0) {
    // Do something
  } 
}

I guess this is what you want?

#

Exevutes every 10th tick

remote swallow
#

not really, im bored so im making suggestion plugin and i have to keep track of what suggestions a player has interacted so to say with and if they upvote or downvote it, and this is most likely gonna be stored sql so i pretty much have to keep track of a map<int,bool> in sql without knowing how big said map could get so cant do infinite collumns

true perch
# lost matrix Roles are enums, right? Then you probably have a``Map<Role, Set<GroupPermission>...

Your feedback is highly appreciated. I have now updated it to your suggestion ๐Ÿ˜„

groups:
  0742798b-d4c8-4122-bb69-73df9f708449:
    Name: Test Group
    Acronym: TG
    Description: Test Description.
    Members:
      069a79f4-44e9-4726-a5be-fca90e38aaf5: LEADER
      4a3f6ed4-153d-424a-858d-5fdd2e78fc54: MEMBER
    Settings:
    - OPEN
    - NPC_LOOT_SHARE
    Permissions:
      MEMBER:
      - TELEPORT_TO_STRUCTURES
      OFFICER:
      - KICK_MEMBER```
lost matrix
remote swallow
#

yeah

#

ill probably end up using 2 tables at the minimum

lost matrix
#

Then create a table
| UUID | SuggestionID | Boolean |

waitwhat

#

With a natural primary key or a composite key of the first two columns

#

| Generated | UUID | SuggestionID | Boolean |

remote swallow
#

i feel really dumb

lost matrix
#

Nah thats not an easy decision. There are multiple ways of handling this with relations.
The main problem here is finding out a diff when saving the data again.

remote swallow
#

i think the thought came from when i didnt realise i had to save what they chose too so was going to store an int list as 1 string, thanks for the help lol

#

been as this would stand the chance to have new data quite often would it be better to be saving it on shutdown + every hour instead of every datachange

lost matrix
#

Yeah dont save it on every data change

hybrid spoke
#

save it on every letter of the data change dankfingers

remote swallow
#

much lag

hybrid spoke
#

but you dont lose nothing on crash

#

very save

remote swallow
#

oh true

#

if you crash im deleting the entire databse

#

start from scratch

hybrid spoke
#

just dont have any persistence at all

torn oyster
#

what part of redis do i use to communicate between servers? is it the subscribe thingy

#

should* not do

misty ingot
#

is there a way to make a config file which the user is not allowed the edit?
(basically need a config file which the plugin can grab data from but I really do not want the user to be able to edit it)

torn oyster
lost matrix
misty ingot
remote swallow
#

JavaPlugin#getResource

#

returns an input stream, convert to input stream reader and you can YamlConfiguration.load it

misty ingot
#

I zee

lost matrix
# torn oyster how would i do that with jedis

Step 1) Change to Redisson
Step 2)

RTopic topic = redisson.getTopic("myTopic");
int listenerId = topic.addListener(SomeObject.class, new MessageListener<SomeObject>() {
    @Override
    public void onMessage(String channel, SomeObject message) {
        //...
    }
});

// in other thread or JVM
RTopic topic = redisson.getTopic("myTopic");
long clientsReceivedMessage = topic.publish(new SomeObject());
misty ingot
#

my solution to the item issue I mentioned is to just create a completely different file for items which are fundamental to the plugin and then grab those from there

#

or actually yk what I think I might just remove the ability for people to have an items.yml at all and just make it easier on me

torn oyster
lost matrix
#

Pros: Better in every way and simpler to use
Cons: Bigger

torn oyster
#

figured it out all good

torn oyster
lost matrix
#

You can send objects through redisson.

#

You can just use String.class if you want to send a simple String

torn oyster
#

ohh

remote swallow
#

if we have primitive and non primitve for a lot of stuff in java why dont we have a primitive string

lost matrix
#

primitives are one word at max

remote swallow
#

but string is 1 word

misty current
#

strings are an array of chars basically

#

an immutable one

lost matrix
#

one word from the architecture

#

So on most systems one word is 64 bit. And the jvm word size is always 64 bits.

#

"In computing, a word is the natural unit of data used by a particular processor design"

remote swallow
#

ahh

lost matrix
#

this makes reinterpret casts really fast

#

Wrapper are garbage in the first place.

#

Thats why valhalla needs to happen

eternal night
#

valhalla prayHalo

remote swallow
#

why do i hear immigrant song

lost matrix
tardy mist
#

but 64 but is by far the most common nowadays

#

btw

#

the word size directly impacts the maximum memory address space a program can access

#

a 64-bit jvm can access up to 264 bytes of memory

#

@misty current what you need to remember is

#

references are 64-bit

#

long and double primitives are 64 bit

#

objects headers contain 64-bit values

#

if the jvm word sizes changes

#

the jvm implementation and all compiled bytecodes would need to change to accommodate that

#

so the word size is static for a given JVM or CPU architecture

misty current
#

i wasnt the one who asked the question, but i appreciate the clarification anyways

remote swallow
#

that'd be me

tardy mist
#

oh than

lost matrix
tardy mist
#

thats what i said

lost matrix
#

Ah ok, wasnt clear to me

#

Generally MMUs can use multiple words to map into a much bigger physical memory iirc

#

But that was like 1st semester so cloudy on that front

tardy mist
#

for example

#

a typical modern system may have 4TB to exabytes of physical memory

#

but map that into a 64 bit user address space

#

the MMU performs address translation between the virtual addresses

#

used by programs and the physical addressed mapped to RAM chips

#

btw

#

MMU can expand the addressable memory space beyond the natural limits of the word size

#

so for example

#

a 64-bit CPU with 4-level page tables can support up to 256 petabytes

#

thats 252 bytes

#

of mapped memory using 4KB page sizes

#

like

green falcon
#

does spigot (or any forks) have an API for nms.Brain?

tardy mist
#

@lost matrix imagine some systems uses larger pages like 2MB, 1GB... to support even bigger virtual memory spaces

#

into the exatbyte and zetabyte ranges

lost matrix
#

Huh?

#

Oh i see. Topics are pretty much that.

hushed thunder
#

hey i need help

misty ingot
hushed thunder
#
package me.auxillated.fun;

import org.bukkit.plugin.java.JavaPlugin;

public final class Fun extends JavaPlugin {

    public static void main(String[] args) {
        onEnable();
    } 
    
    @Override
    public void onEnable() {
        PrintStartup("The plugin has started up!");
    }
    
    public String PrintStartup(String Message) {
        System.out.println("The plugin has started up!");
        return Message;
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}

Why is IntelliJ saying "Non-static method 'onEnable()' cannot be referenced from a static context" on line 8

jagged monolith
#

You don't need the main method. Remove it.

hushed thunder
#

No I need it

jagged monolith
#

No, you don't

hushed thunder
#

It won't work otherwise

#

Why do I need to remove

jagged monolith
#

You never need to add it with Plugin Dev

hushed thunder
#

Ok let me try that

misty ingot
#

people these days

hushed thunder
#

Also how do I define a list

#

I want to store all player in the server's names

misty ingot
#

?learnjava

undone axleBOT
hushed thunder
#

I aint reading all that

misty ingot
#

too bad

#

cant help you then

hushed thunder
#

Just tell me how to make list please

#

๐Ÿฅบ

jagged monolith
#

If you don't know how to do the basics like create a list. We won't be helping. You need to know basic java before making a plugin

hushed thunder
#

I know Java please help me

misty ingot
#

@hushed thunder that was very ๐ŸŠ ๐Ÿ”ฎ ๐Ÿ”ฎ of you

jagged monolith
#

If you know java, then you should now how to declare a new list

hushed thunder
#

๐Ÿคช

misty ingot
#

@jagged monolith is right

hushed thunder
#

it's this right

jagged monolith
#

Creating a list, is very low level basic stuff

hushed thunder
#

StringList = new StringList()

#

right?

misty ingot
#

idk you tell us

jagged monolith
#

Nope, that wouldn't work. Plus, StringList is not really used. There's better ways to making a list.

misty ingot
#

nooo you're not supposed to tell him

hushed thunder
#

Oh I know it now

#

It's List<String> = new List<String>;

misty ingot
#

congratulations, you can come back when you have an actual issue which is not spoonfeed related

hushed thunder
#

Nevermind chatgpt told me

misty ingot
#

god save you

hushed thunder
#

It's List<String> stringList = new ArrayList<String>();

misty ingot
#

im atheist but I pray to god every day for programmers who rely solely on chatGPT

hushed thunder
#

Chatgpt is good

#

It helped me more than you guys

misty ingot
#

it makes a lot of sense considering the fact that we refuse to spoonfeed but it doesnt

#

now please, you can come back any time that you have a different issue but for other stuff use #general

jagged monolith
#

Also, relying on ChatGPT to make a plugin = disaster waiting to happen.

hushed thunder
#
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class FireworkPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        // Register the event listener
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        // Create a firework entity at the player's location
        Firework firework = (Firework) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.FIREWORK);
        
        // Create a random firework effect
        FireworkEffect.Type[] types = FireworkEffect.Type.values();
        FireworkEffect.Type type = types[new Random().nextInt(types.length)];
        FireworkEffect effect = FireworkEffect.builder()
                .withColor(Color.RED)
                .withFade(Color.YELLOW)
                .with(type)
                .trail(true)
                .build();
        
        // Set the firework's metadata to the random effect
        FireworkMeta meta = firework.getFireworkMeta();
        meta.addEffect(effect);
        meta.setPower(1);
        firework.setFireworkMeta(meta);
    }
}```
#

Will that work

#

ChatGPT told me

#

I wanted to make firework plugin

jagged monolith
#

I bet you don't even understand 1 thing from that code.

#

Or what it even does

hushed thunder
#

I know what public void means

misty ingot
#

bro

hushed thunder
#

It means when the firework explodes it gets sent to the void

misty ingot
#

we have a new gif for all these situations

hushed thunder
#

Right?

misty ingot
#

test it yourself

#

and see if it works

hushed thunder
#

Why can't you just tell me

#

Stop gatekeeping

misty ingot
#

why?

hushed thunder
#

๐Ÿ™„

jagged monolith
#

Why can't you just lean java just a normal person and not rely on ai

hushed thunder
#

๐Ÿ˜„

misty ingot
#

rolling your eyes is not going to force us into spoonfeeding you

hushed thunder
#

AI is the future of everything

misty ingot
#

it CAN however make the mods mute you if you refuse to follow the rules enough

#

*WILL

hushed thunder
#

How do I make it code that for me

#

I want a mute command plugin too

misty ingot
#

I know how

#

its very simple

#

?learnjava

undone axleBOT
hushed thunder
#

Ok fine anything to mute players

#

My friend keeps spamming the n word I want to mute him

misty ingot
#

have you considered not being friends anymore?

hushed thunder
#

No

#

He won't play anymore if I am not his friend

misty ingot
#

ok listen man

#

we do not care

#

we will not spoonfeed you

#

go and learn java

hushed thunder
#

I know

hushed thunder
#

I am going to learn it

misty ingot
#

ok, good

#

you dont need this channel for now then

hushed thunder
#

Why Gif not work

misty ingot
#

because you are not verified

hushed thunder
#

How verify

misty ingot
#

@ancient plank sorry for the ping but could I get some "assistance"

hushed thunder
#

Whatever I'll go learn Java

misty ingot
#

good for you

lost matrix
#

?verify

#

?image

#

Hm

misty ingot
#

this guy is even worse than the ones who came before

#

he really really wants to be spoonfed

lost matrix
#

didnt read

jagged monolith
#

?img

undone axleBOT
lost matrix
#

Yeah, not quite what i wanted

rough drift
#

Does spigot have mappings for methods and stuff?

lost matrix
#

Thats all the mappings we have

eternal oxide
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

lost matrix
#

This one

misty ingot
#

@quaint mantle you need to set display name to " " not ""

#

you need a space in there

somber night
#

ive been trying to make a custom item plugin, that when used, gives potion effects
ive been looking for how to do it but what i got doesnt work, how can i make it work?

quaint mantle
#

"Dont ask to ask just ask."

somber night
#

im entirely new to this

misty ingot
lost matrix
misty ingot
undone axleBOT
somber night
#

alr ty

somber night
eternal oxide
#

clearly a chatGPT incoming

somber night
misty ingot
#

then just...

#

censor it

somber night
lost matrix
#

Wait, since when does anybody care about a written drug word?

kind hatch
#

Since people became afraid of words.

somber night
lost matrix
#

Nice. But implementing the crafting logic is the actual hard part

somber night
#

should i just send it then?

lost matrix
#

Just whiff it

#

?paste

undone axleBOT
kind hatch
#

?paste it if you would

undone axleBOT
somber night
lost matrix
#

Out of all the drugs, why this? XD

echo basalt
#

you gotta create a fake crafting table tile entity

lost matrix
#

Breaking bad i suppose

echo basalt
#

to trigger the craft events so you can have full plugin compat

somber night
kind hatch
#

Eh, the only thing it can't really do well is recipes that require items with an amount greater than 1. It handles everything else pretty well.

lost matrix
#

How about you add cocaine that makes you run faster instead of meth that just fks you up for no reason.

echo basalt
#

PrepareItemCraftEvent

misty ingot
#

copying hypixel anyone? lol

somber night
lost matrix
#

Anyways. First of all:

#

Delete this. It does nothing

misty ingot
#

hypixel has that for its skyblock gamemode

kind hatch
#

Can't say I've had this problem. If I had the item, the recipe book would act accordingly, even with custom items.

misty ingot
#

exact design

earnest lark
#

is there a way to give a Sheep the noAI tag

misty ingot
#

it was only joke bro why you have to be mad ;-;

lost matrix
misty ingot
#

isnt it like, ultra painful to program all the recipes into it tho?

somber night
kind hatch
lost matrix
lost matrix
somber night
#

What ends up happening is that the item isnt craftable at all after i added the onPlayerInteract

earnest lark
somber night
earnest lark
#

nvm it was in inherited section

lost matrix
somber night
#

It wont let me build the plugin

lost matrix
#

Then send the build log

misty ingot
#

croc and balls anyone?

#

wc

lost matrix
#

Your IDE should tell you exactly whats wrong

somber night
kind hatch
#

Where do they say it's intentional? That bug isn't marked as Won't Fix.

somber night
lost matrix
#

How would you know if the plugin doesnt even compile?

echo basalt
somber night
earnest lark
#

how do i make it so that my commands have the values you need to input auto input?

misty ingot
#

do you mean that they just have default values if someone doesnt enter args?

earnest lark
#

like

misty ingot
#

well you can either use acf and bang your head against the wall or make use of โœจ if statements โœจ and set arg values if none is entered

lost matrix
#

Just write your own crafting logic then

earnest lark
#

yea i thinkl

misty ingot
#

it took 2252 lines of code to make MineMemer (in its current state)

#

good for you

#

ok fine

#

its basically DankMemer but in mc (and with more stuff because mc has less limitations than discord in that matter)

kind hatch
#

Probably a redundant question, but if I already have per player configuration files, wouldn't it be smarter to put cooldown information inside of their file instead of a separate file that would keep track of everyone's cooldowns?

#

Already do, but I'm talking about persistent cooldowns. That data has to be stored somewhere.

#

Hmm, guess I'll redo my implementation then. :p

misty ingot
#

I am thinking of having something like that for MineMemer just so we could have some textures for the custom items but it will require ever user to download the resource pack seperately and all

#

*and ofc add a config option to disable that

terse ore
#

?dontowkr

#

?dontwork

#

which is the cmd?

misty ingot
#

what are you trying to do

terse ore
#

?doesntwork

misty ingot
#

will still require the admin to set that stuff

#

what doesnt work bud?

kind hatch
#

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

terse ore
#

ShadowMaster used the cmd I was looking for

cinder abyss
#

Hello, what is the instant heal potion ItemStack ?

kind hatch
#

PotionMeta

cinder abyss
young knoll
#

All potions are Material.POTION

cinder abyss
kind hatch
#

That's where PotionMeta comes in.

#

Specifically PotionMeta#setBasePotionData()

young knoll
#

Yep

pale pulsar
#

hello, when I want to drop the plugin on the server there is an error message that appears can you help ?

13:12:13] [Server thread/ERROR]: Could not load 'plugins/Questplugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
    at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R3.CraftServer.loadPlugins(CraftServer.java:422) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3736-Spigot-e4265cc-10f8667]
    at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3736-Spigot-e4265cc-10f8667]
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3736-Spigot-e4265cc-10f8667]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3736-Spigot-e4265cc-10f8667]
    at java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
    ... 7 more```
kind hatch
#

Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
Idk gradle, but I'd check your compiler settings.

young knoll
#

Make sure you are actually building with gradle

pale pulsar
#

how can we change idk gradle

#

because my gradle bug

misty ingot
#

everyone using IntelliJ should have the MinecraftPlugin extension can we just make a PSA of that or something?

pale pulsar
#

when i create project i said this but i dont know how change the gradle

kind hatch
eternal oxide
#

Only if you have oodles of memory.

#

only use plugins to save time when you already know how to do it all yourself.

lost matrix
kind hatch
#

Workdistro?

lost matrix
#

Yeah it uses the concepts of it ^^
Ive created a compressed schematic format. Thats why the different block types
are pasted in succession

kind hatch
#

I was wondering about that. It looks pretty cool though.

#

Have you considered looking at the litematica format? I think it can do subregions and that would be a really cool feature to have.

lost matrix
#

No i havent looked into that... I should give it a read.
But i need the format to copy quite a few extra things like quest triggers
and custom spawn locations etc

young knoll
#

Spigot api to write to NBT files when

lost matrix
#

PR it ๐Ÿฅฒ (plox)

kind hatch
lost matrix
#

Non blocking world loading when?

flint coyote
young knoll
#

I mean PDC is an NBT wrapper so ig I could just add a saveToFile method to that

kind hatch
river oracle
#

Is md against possibly modifying vanilla data?

kind hatch
#

Likely

young knoll
#

Directly yes

#

Thatโ€™s what the api is for

#

But this would be targeted at custom NBT files

#

Would also need a reader

#

NBT is a pretty cool format tbh

#

Not the most compact but easier to work with than raw binary files

supple island
#

can someone tell me what's wrong with this

kind hatch
#

Well it's roots are in JSON, sooo.

supple island
#

hold on

#

it's from quality armory

#

i was doing some config and when i did /qa reload in game an external error came up

young knoll
#

I doubt MD would go for it though

cobalt thorn
#

im having some problem for calculating the maxPage and getPaginableItems
https://sourceb.in/LMvuDpipQZ

the item don't appear because the getPaginableItems is made wrong and maxPage is the same even changing items or size

young knoll
#

If anything that would just encourage people to avoid the api

#

Which is kind of counterproductive

cobalt thorn
#

probably even i calculated wrong the page and items im sure about that

icy beacon
#

while compiling, what takes the most load, ram or cpu?

kind hatch
#

CPU

icy beacon
#

well that explains why my compile time is shit

#

ty

kind hatch
#

If you didn't know, CPU benchmarks include both chrome and firefox compile times as a marketing factor now.

icy beacon
#

oh

#

lol

#

good to know

lost matrix
# cobalt thorn probably even i calculated wrong the page and items im sure about that

Let me share some from my impl

  protected boolean hasNextPage() {
    int lastPageIndex = (int) Math.ceil(contentList.size() / (double) elementsPerPage) - 1;
    return pageIndex < lastPageIndex;
  }

  protected boolean hasPreviousPage() {
    return pageIndex > 0;
  }
    int startIndex = pageIndex * elementsPerPage;
    int endIndex = Math.min((pageIndex + 1) * elementsPerPage, contentList.size());
    List<GuiButton> currentPageButtons = contentList.subList(startIndex, endIndex);
    for (int i = 0; i < currentPageButtons.size(); i++) {
      GuiButton button = currentPageButtons.get(i);
      setButton(i, button);
    }
  protected void nextPage(Player viewer) {
    if (hasNextPage()) {
      pageIndex++;
      this.decorate();
      this.renameFor(viewer, getCurrentTitle());
    }
  }
cobalt thorn
lost matrix
# cobalt thorn In theory what i need is the start index and endIndex with the math.max i have t...

You just put all possible items in one big list.
Then you create a pageIndex which stores your current page index.
Then to calculate which sub-list of your content list you need:

    int startIndex = pageIndex * elementsPerPage;
    int endIndex = Math.min((pageIndex + 1) * elementsPerPage, contentList.size());

This defines a part inside your whole content list.

Afterwards you want to break out a part of the content list

List<GuiButton> currentPageButtons = contentList.subList(startIndex, endIndex);

Those are the items on the current page

cobalt thorn
#

Should be what i need to do for calculsating them

kind hatch
#

Your max page will be dependent on how many things you are showing in your GUI.

kind hatch
#

You may need to round up, but that's how you get your total pages.

icy beacon
#

for some reason i had obs on

#

after turning it off my compile time got 20 seconds faster

#

inspirational

young knoll
#

Jeez what are you compiling

vocal cloud
#

Based compile times?

icy beacon
#

though it's in kotlin so compile time is bound to be exhausting

#

but 1 minute is painful

#

without obs it's 40 seconds

young knoll
#

I donโ€™t even think it takes me that long to compile spigot

icy beacon
#

what are your specs

#

because mine are fucked

vocal cloud
#

Really bad single core

icy beacon
#

hmmm

#

i'm at i5-6500 with 16gb ram

vocal cloud
#

This ram is 1333 ECC

icy beacon
#

hm?

vocal cloud
#

So while I have 197GB of it, it's slow as hell

icy beacon
#

wait you have 197gb of ram

#

lmao

vocal cloud
#

Yes

icy beacon
#

why though

vocal cloud
#

Why not?

icy beacon
#

fair enough

kind hatch
#

DDR2 or DDR3?

vocal cloud
#

DDR3

#

ECC 1333

kind hatch
#

I didn't know DDR3 could go that low. :p

icy beacon
#

btw did you deliberately pick slow ram or did it just happen somehow

kind hatch
#

ECC is typically slower due to the correction code, but for servers slower ram can be better than extremely fast ram.

icy beacon
#

how come?

vocal cloud
#

I checked it's actually 2133

#

give or take

#

It's pretty bad regardless. I got it for free

icy beacon
#

o

vocal cloud
#

The guy I bought it from sells used servers he said I could either have 64GB or for no charge 197

icy beacon
#

this looks like pain

kind hatch
# icy beacon how come?

I think the biggest factor is power consumption. Servers need to be efficient to run at scale. Otherwise your wallet will burn quickly.

icy beacon
#

is your name Tantalus by chance

remote swallow
vocal cloud
#

It's pretty dope to have. Running an MC server with 150GB of ram

remote swallow
#

Does it actally do anything perf wise

icy beacon
#

probably just allows for more players?

vocal cloud
#

Besides causing the GC to have an aneurism when it needs to collect?

icy beacon
#

lmao

vocal cloud
#

Bets on when it'll be done?

icy beacon
#

bro are you compiling minecraft the game

vocal cloud
#

A mod. Locally this would take a minute or so

#

My server has nowhere to be

kind hatch
#

I bet 2hrs

vocal cloud
#

Allocated 50G. We'll see if that fixes my issue

kind hatch
#

You could just use Inventory#contains()

remote swallow
#

also i dont get the point of the item stack array just to make it a list

#

stream it directly

lost matrix
#

Or call Inventory#all(ItemStack) to even find where those items are

remote swallow
#

yeash

#

no need for the item stack array if you only use it once

lost matrix
#

...

#

Arrays.stream(content).anyMatch(someItem)

#

Anyways none of those make sense for you Scallop

vocal cloud
#

while loop like that looks dangerous

lost matrix
#

Infinite while loop

#

nice

kind hatch
#

Woah, while loop?

eternal oxide
#

dead server

vocal cloud
#

Sewer side the server in 1 easy check

remote swallow
#

i just though of the most cursed if check

lost matrix
#

Just call
inventory.contains(item)

somber night
#

is there any way to hide chat with code? Ive been looking but can only find a way to "mute" players

kind hatch
#

Depends on what you mean by hide.

lost matrix
#

And stop them from being sent

remote swallow
#
while(string.equals("amongus")) {
    System.out.println("funny");
    break;
}
river oracle
#

Sounds like a job for packet events

somber night
lost matrix
remote swallow
#

number 1

#

the while loop

lost matrix
kind hatch
remote swallow
#

why do you check if it equals it just to check if it contains an item

#

shouldnt that be an event#getInv

eternal oxide
kind hatch
#

Ayo, when did that become a thing?

eternal oxide
#

Since async ๐Ÿ™‚

lost matrix
kind hatch
remote swallow
lost matrix
#

Thats just another if statement

#

Poorly done

remote swallow
#

oh god its also infinite

lost matrix
#
    for (;name.equals("harald");) {
      System.out.println("funny");
      break;
    }

This works as well

lost matrix
remote swallow
#

ohh

#

my brain works

#

totally'

eternal oxide
kind hatch
vocal cloud
#

while loops are only if the amount of iterations are unknown

kind hatch
#

I can only think of one time I've actually had to use one.

vocal cloud
#

Example, you're receiving data from a stream.

lost matrix
vocal cloud
remote swallow
lost matrix
remote swallow
#

is there any "easy" so to say way to tell when the server is crashing

eternal oxide
#

too many variables

remote swallow
eternal oxide
#

not always

#

apart from you'd have no way to get the TPS if it's crashing

remote swallow
#

if i can always get it while it is running, when i cant get do stuff

eternal oxide
#

you can only tell if it HAS crashed, not if it's crashing

remote swallow
#

im guesing there is no way to run code once it has crashed

eternal oxide
#

Somethign akin to watchdog

#

not unless you are running your own process

young knoll
#

I usually just run Bukkit.getServer().disableCrashing

vocal cloud
#

if(crash) dont();

brave sparrow
#

try {
server.tick();
} catch (Exception e) {}

remote swallow
#

while (true) {
server.tick();
}

#

real representation of how the server tics

young knoll
#

I mean

#

Pretty much

brave sparrow
#

Thatโ€™s essentially how it should tick to be fair

flint coyote
young knoll
#

That's part of the loop

flint coyote
#

Sure is but it's probably not part of the tick() method

remote swallow
#

real representation of folia

while(true) {
    new Thread() {
        chunk.tick();
    }
}
#

i wonder if paper would ban me for that

brave sparrow
#

Lol

cinder abyss
#

Hello, how can I get the max health of a player ?

young knoll
flint coyote
cinder abyss
flint coyote
cinder abyss
remote swallow
#

do you have mc dev

#

are you on ij ultimate

#

most likely mc dev

tardy delta
remote swallow
#

how many terminals do you need

icy beacon
#

at least 3 it seems ๐Ÿค 

remote swallow
#

300 you mean

prisma steeple
#

how do I place a block at a certain location?

eternal oxide
#

location.getBlock().setType(material)

prisma steeple
young knoll
#

yes

#

or if you want drops breakNaturally

prisma steeple
#

yep figured it out, but thx anyways

prisma steeple
young knoll
#

mhm

tardy delta
young knoll
#

You don't make your language with pure machine code?

prisma steeple
#

naw i use electrical currents

young knoll
#

I prefer billiards callouts

#

Address #45AF into corner pocket

stable dawn
#

anyone know if itโ€™s possible to set the playerโ€™s attack indicator

worldly ingot
#

I don't think you can set it, no

#

You can get it though

#

That's about it

misty ingot
#

queen to D5

flint coyote
#

You can still use nms and reflection to set it

worldly ingot
#

It won't update the client

#

If it did, we'd have a setter for it in API lol

flint coyote
#

Oh it's about the client. I thought he just wanted no cooldown

stable dawn
#

yeah was hopping to set it to display a current attack cooldown for some custom attacks iโ€™m making

flint coyote
#

You can set an item cooldown if those attacks require a specific weapon/staff (any item)

worldly ingot
#

Yeah, the same cooldown that ender pearls use

stable dawn
#

that sounds like a great idea thanks

#

itโ€™s per material right?

young knoll
#

It's per material

worldly ingot
#

I think it's Player#setCooldown(Material)

#

Yes

prisma steeple
#

how do I set per se, the X coordinate of a Location data type variable?

young knoll
#

Location#setX?

flint coyote
#

Keep in mind that setting the cooldown won't prevent the usage. It's just the visual so you have to implement that yourself.

prisma steeple
#

why use the hash?

young knoll
#

To indicate it's an instance method

worldly ingot
#

Javadoc notation

#

You would do location.setX(0)

prisma steeple
#

Ahh, I see what i'm doing wrong

stable dawn
#

currently doing a skill system which uses custom model data on a singular item so wouldnโ€™t be useful for that
but the cooldown on the main weapon for cast time sounds like it would work well,
thanks again guys

prisma steeple
#

jesus thats stupid, instead of doing

location.setX(expression) 

I was doing:

location.setX() = expression

lol

flint coyote
stable dawn
#

currently using that to display buffs with negative space ๐Ÿ˜‚ could definitely work though if i put in the time

flint coyote
#

yeah or multiple (shorter) bars like this (maybe using the | character instead)

#

Stole that image from some spigotmc thread

stable dawn
#

neat idea thanks ๐Ÿ™

misty ingot
#

or well actually everything is easier with a bunch of maths

young knoll
#

Maffs

flint coyote
pallid escarp
#

NoClassDefFoundError: org.bukkit.Translatable
any ideas why?

worldly ingot
#

Likely need to update your server

#

It was introduced in 1.19.3 iirc

cobalt thorn
#

Hi, the List is empty and so no items even if i add the items but seems like its not called even if it is
Paginable: https://sourceb.in/cvFx9xbYiC
Gui: https://sourceb.in/sTlQaeafk9
setIconsPage(iconsMaker()); seems to not be called and so it can't calculate nothing an everything is 0 (not the size) and arrays empty

worldly ingot
#

It's not really an easy list to maintain. We have a feature flag/datapack API in the works I think which should cover that

misty ingot
#

sad acf doesnt have anything for that

#

I have to actually use my brain for this one

flint coyote
kind hatch
#

I might be overthinking this, but I currently have a per player configuration setup and I've come across the need to store cooldown information so that they will persist across restarts. The way I'm currently managing the files is through an interface so that I can switch between my storage solutions, but the interface is massive. There's methods for everything that can be stored in the file and some QOL methods as well.

The potential issue I am seeing is that in order to add the cooldowns to their player file, I need to not only write the data to the file, but also apply the cooldown immediately after. Now, I have a CooldownManager class that can assign cooldowns to people and it stores that info in a List<Cooldown>, but if I want this class to actually be the manager, I have to call upon it through the interface implementation.

This seems weird to me because up until this point, I haven't needed to call upon another class in the interface implementation up until now. I'm worried that I'm creating coupling between these classes when there probably shouldn't be. However, I don't currently see a better way to keep both the player files and the cooldown list in sync.

misty ingot
kind hatch
flint coyote
# kind hatch I might be overthinking this, but I currently have a per player configuration se...

If I'm understand this right, you have

  • An interface with an implementation to manage user files
  • A cooldown class
  • A cooldown manager class to set cooldowns (and maybe keep track of them)
  • Whatever classes that use the cooldown

Basically what you want to do is to let your manager have an instance of your Interface to interact with and the necessary functions you need inside your other classes that utilize the cooldown.

So for example a command with a cooldown would require the manager in it's constructor (or any other DI way)
Then when the command runs it would call something like cdManager.hasCooldown(Player, command). Therefore the manager would do return interfaceImpl.getCooldown(Player, command).isStillValid() or however your cooldown class is built

prisma steeple
#

can someone explain why any code under the green line doesn't get executed?

flint coyote
#

it should get executed. Maybe you exported your .jar wrong or forgot to restart/reload the server

kind hatch
desert spade
#

i assume that's a mistake

prisma steeple
vocal cloud
#

Not to mention the fact that you're setting and modifying the same variable to itself

placid tangle
#

Can anybody help me with set home plugin??

vocal cloud
prisma steeple
desert spade
# prisma steeple huh?

blocklocation and blocktobreak are referencing the same thing. you probably want to be doing blockToBreak = blockLocation.clone() to stop blockLocation being affected

vocal cloud
#

I'm not sure it's doing that

prisma steeple
#

i'm aware

#

i'm trying to fix it

cinder abyss
#

Hello, how can I remove 1 durability of an ItemStack ?

prisma steeple
#

What you're saying makes sense, thats my issue, it's like it keeps building itself on what it was told before,but i thought anything after the equals operator doesn't get effected

desert spade
#

both blockToBreak and blockLocation reference the same object. if you change the value of one, the value of the other will also be affected. you're not creating a new location object by just equalling them

#

clone() creates a new location object, which means the original location object will not be modified

prisma steeple
flint coyote
# kind hatch So if I'm following correctly, the manager class is kinda like a middle man? To ...

Yes the manager will be used to keep track of active cooldowns and will be your only way of setting/updating them.
Think of it as a helperClass aswell.

So basically if your interface just has setCooldown(player, command, time) which sets the cooldown to the given time, then your manager could have helper methods like setCooldownRightNow(player, command) that would simply call interface.setCooldown(player, command, System.currentTimeInMillis()); or getRemainingCooldown(player, command) that would then return storedTimestamp - currentTimestamp. Obviously those are super simple examples (and not the best method names either) but that way you can make it as complex as you want without ever touching the interface that should only be used to store/read the data and does not do any processing.

Therefore you are also following the single responsibility principle of SOLID. Interface does the file handling, manager does the delegation+translation and command talks to your manager.

prisma steeple
#

so,

int v = x;

makes x also equal to v?

desert spade
#

not for ints no

prisma steeple
#

ah i see

#

only bukkit data types

desert spade
#

uh i wouln't say that

prisma steeple
#

u want me to delete it?

kind hatch
desert spade
# prisma steeple only bukkit data types

iirc most objects are passed by reference in java, meaning it'll be the same instance whichever reference you use. primitive data types (int, float, etc) don't do that though. it's not just a bukkit thing. ignore that im dumb

but that's besides the point tbh, just whenever you're modifying location it's a good idea to clone the original one if you want to keep the original location for the future.

misty ingot
#

there are limitations to custom mobs, you can really only change mob behaviour without use of mods

flint coyote
# kind hatch Ok cool, so I just needed to adapt my manager class then. Ty. I think I'll be ru...

It's a common concept. You want to build your class hierarchy in a way that you can replace each part. Technically you could even make an interface for your manager (although you'll only have one so it doesn't make sense). Following this concept you can implement your interface for flatfiles and databases since both just read/write data. You manager could be used for cooldowns in ticks or cooldowns in seconds - or you could even create a completely different manager that handles other things, like storing and receiving player inventories while offline. That depends on how deep you abstracted your interface.

misty ingot
#

you can start off by looking for samples of code on forums or stackoverflow if you are that desperate

#

in that case you could listen for when said mob is spawned and just give them the items and effects

misty ingot
#
    private void loadItemsResource() {
        InputStream is = getResource("items.yml");
        InputStreamReader isr = new InputStreamReader(is);
        items = YamlConfiguration.loadConfiguration(isr);
    }

why the hell does this still generate an items.yml in the folder

#

basically yeah

misty ingot
ivory sleet
#

you need to actually close it

#

(with try with resources if possible)

misty ingot
#

readmy second message lol

#

it wasnt a mem leak it was a brain leak

ivory sleet
#

that produces a memory leak also

misty ingot
#

technically

ivory sleet
#

practically

misty ingot
#

not for every part of the brain

ivory sleet
#

depends on whose brain, but for the jvm's brain it does

desert spade
#

oh wait

#

yeah

#

my bad lol

ivory sleet
#

well in theory ur argument isnt wrong

eternal oxide
#

Its odd to get your head around until you realize it's almost all pointers

ivory sleet
#

but semantically java is strictly pass by value

desert spade
#

i just fully got mixed up about what those two were lmao. my bad

ivory sleet
#

ye all good

flint coyote
#

It's easy to mix it up. Pass by value basically means that you are handing over the value of a variable instead of a pointer to that variable.
If you store an object in a variable (in java) your variable holds a reference to that object. By passing the variable that holds a reference, you are still passing the value of the variable (which in this case is a reference).

#

?nms

ivory sleet
#

or well in js iirc its called call by sharing so not exactly the same but roughly

small lynx
#

what database file is locked in SQLite means

#

it is error in the code?

glossy venture
#

probably that another handle is open to the file

#

or it can just not access it i guess

small lynx
#

it is my fault or host fault?

glossy venture
#

host fault

kind hatch
#

Probably yours since SQLite is local.

small lynx
#

i will ask him to delete .db file. it is does not get fixed i will attempt to fix

glossy venture
#

well its the fault of whoever set it up

#

not the developer

#

no dont delete the db file

kind hatch
#

I was under the assumption that he is the programmer.

glossy venture
#

yeah he is

#

but hes helping someone else

glossy venture
kind hatch
#

It also doesn't hurt to double check that you are actually closing connections after your queries.

quaint mantle
#

How do I make net.minecraft defined in intellij? Would anyone happen to know?

kind hatch
#

Your main path looks wrong.

kind hatch
eternal oxide
#

?nms @quaint mantle

quaint mantle
kind hatch
#

It's cause you need to run BuildTools, The link above will help get you setup.

eternal oxide
#

all package names should be lowercase

#

Classes camel case

quaint mantle
#

Ah alright thank you, also is there any possible way to add enchantment glows to items without actually enchanting them without the use of NMS swear I saw a function for it but am not quite sure

green prism
#

I am creating a plugin that I am going to sell, in your opinion, should I also add the ability to change the lore/displayname of the gui items through configuration?

ivory sleet
#

Yes

#

If I were you Iโ€™d use a library to parse that also

#

So u dont have to reinvent the wheel

green prism
#

I'm using MiniMessage actually

ivory sleet
#

Good

green prism
#

Thank you so much for your answer

kind hatch
ivory sleet
#

Well I always think the taste of the consumer is right @green prism

#

like โ€œthe consumer is always right when it comes to tasteโ€ and providing customizability is a good way of extending/addressing various tastes consumers may have

quaint mantle
abstract sorrel
#

can anyone help me i want to change the block break animation for a block using nms?

eternal oxide
#

what do you want to change?

abstract sorrel
#

the stage of the animation

eternal oxide
#

then you don;t need nms

abstract sorrel
#

what i'm trying to do is make blocks decay over time, which requires the plugin to show the block break animation event when a player is not mining that block, is that more helpful?

eternal oxide
#

there is an api method to set the block damage but I forget it's name

quaint mantle
#

Also last question I use this code:

package com.kunosyn.synmc;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.attribute.AttributeModifier.Operation;

import java.util.ArrayList;
import java.util.List;

public class NetherStarSword {
    public static ItemStack sword;
    public static void init() {
        createSword();
    }

    public static void createSword() {
        sword = new ItemStack(Material.WOODEN_SWORD, 1);

        ItemMeta meta = sword.getItemMeta();
        meta.setDisplayName("Nether Star Sword");

        List<String> lore = new ArrayList<>();
        lore.add("You can hear the Wither\'s whispers...");
        meta.setLore(lore);

        AttributeModifier modifier = new AttributeModifier("generic.attackDamage", 50, Operation.ADD_NUMBER);
        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, modifier);
        meta.setUnbreakable(true);
        meta.setCustomModelData(125879);

        sword.setItemMeta(meta);

        ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("nether_star_sword"), sword);
        recipe.shape(" S ", " S ", " N ");
        recipe.setIngredient('S', Material.NETHER_STAR);
        recipe.setIngredient('N', Material.NETHERITE_SWORD);
        Bukkit.getServer().addRecipe(recipe);
    }
}

The issue with this is that the "+50 attack damage" shows up as like while on head, torso, etc instead of only when on main hand. Is there any way to specify in the item meta that I only want it applied to the when on main hand?

glossy venture
#

show plugin.yml and project file structure

#

aight nice

quaint mantle
#

Hi , why my plugin is not found in the console ?

#

with not errors

#

yes

#
name: firstplugin
version: 1.0
description: This plugin does so much stuff it can't be contained!
api-version: 1.12
author: MRDXO```
quaint mantle
#

I tried using the bat file script to automate the process for getting the build file and the directory it created is empty after it said done

#

Did I do something wrong?

tardy mist
#

this will make the damage bonus only apply to the main hand slot

quaint mantle
#

(replyed to the wrong message mb)

#

Would you be able to provide an example of implementing and registering an enchantment?

chrome beacon
#

There's methods for each slot ^^

undone axleBOT
quaint mantle
#

my plugin is not loading

eternal night
#

the api-version does not take minor versions

#

1.19 instead of 1.19.4

quaint mantle
#

so I have to upgrade the spigot?

eternal night
#

no

quaint mantle
#

or the whole project?

eternal night
#

you update the api-version in your plugin.yml

#

from 1.19.4 to 1.19

quaint mantle
#

let me check

#

nice

#

im using maven btw

#

Found this in pom.xml

#

maybe the <version> has something to do with it?

chrome beacon
#

No

quaint mantle
#

idk if it is the same thing tho

chrome beacon
#

The problem is in the plugin.yml

quaint mantle
#

interesting

green prism
#

How can I parse Strings using MiniMessage and get back a Parsed String object (not a component)?

quaint mantle
#

al has ben typing for a while

#

lmao

somber night
green prism
# green prism How can I parse Strings using MiniMessage and get back a Parsed String object (n...

I mean, I'm actually doing like this but I'm hoping for a better way

    public static Component translate(String string) {
        return MiniMessage.miniMessage().deserialize(string).decoration(TextDecoration.ITALIC, false);
    }

    public static String translate(Component component) {
        return LegacyComponentSerializer.legacySection().serialize(component);
    }


    public static String legacyTranslate(String string) {
        return translate(translate(string));
    }
quaint mantle
prisma steeple
#

anyone know how I can find the direction/side of the block which was being destroyed in a block break event

#

if it helps to make sense, i'm trying to make a type of drill plugin

eternal oxide
somber night
quaint mantle
#

you can only turn your face fast enough so it shouldn't be possible to get it wrong

eternal oxide
#

you can;t get it accurately

#

they could be hitting the side of the block

prisma steeple
#

as in up down, left right, front back

quaint mantle
#

coords from the event and then direction from the player

prisma steeple
#

the direction doesn't matter though,

#

you can still hit 3 possible sides

#

from a certain angle

quaint mantle
#

good point

#

ray cast?

somber night
eternal oxide
#

A player could be hitting any one of 3 BlockFaces to break a block. No way of telling which

prisma steeple
#

There is a way.

quaint mantle
#

ray cast

prisma steeple
#

pft yeah

#

as if

eternal oxide
#

Still no

quaint mantle
#

I do that with datapacks

#
  • it works like garvage so I only use it for projectiles tho *
prisma steeple
#

you sure theres no way?

eternal oxide
#

You can only trace to teh block, you can;t tell which face they hit

quaint mantle
#

Idk, I'm still trying to open my first plugin but something's wrong and you guys aren't reading my thing

prisma steeple
#

add this to the api

eternal oxide
#

could be any one of three

quaint mantle
#

so I'm just waiting

eternal oxide
undone axleBOT
quaint mantle
somber night
prisma steeple
#

with nothing else, try that

eternal oxide
#

in the logs folder on your server

quaint mantle
#

bro can't read I wanna die

#

I sent a screenshot

#

it literally says 1.19

prisma steeple
#

Not that one you imbicile

#

to the one i replied to

quaint mantle
#

ok give me a sec

somber night
quaint mantle
prisma steeple
#

Do

#

1.0-SNAPSHOT

eternal oxide
quaint mantle
quaint mantle
#

changing what

#

its already in 1.19

prisma steeple
eternal oxide
#

The error you posted clearly says you are trying 1.19.4 in your plugin.yml

prisma steeple
quaint mantle
eternal oxide
#

You either didn;t save the changes or didn;t update the jar on your server

prisma steeple
#

yeah

#

try rebuild it

quaint mantle
#

it doesn't get more saved than this

prisma steeple
#

from the artifacts

eternal oxide
#

stacktrace never lies

quaint mantle
#

so I just make the whole project from scratch? it only had a println either way

tawny remnant
eternal oxide
# somber night https://paste.md-5.net/eqilogehox.md

You didn;t update the plugin on your server java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.methsmp.liveplugin.LivePlugin.getCommand(String)" is null

somber night
#

how do i do that

eternal oxide
#

fix your plugin.yml to say "commands:" instead of "command:" then rebuild and update the plugin on your server

eternal oxide
#

what?

prisma steeple
#

Huh?

eternal oxide
tawny remnant
#

an itemstack

quaint mantle
eternal oxide
quaint mantle
#

oh

#

good thing I didn't do it then

#

anyone know how to fix it?

eternal oxide
tawny remnant
eternal oxide
#

looks fine, but you need to compare with java if (!empty().isSimilar(e.getCurrentItem())

#

no clue if your logic is correct though

#

do you actually want to run that code if it's not your empty ItemStack?

#

Your next line will also fail

tawny remnant
#

if the item is not empty() or bottom inventory then yes

eternal oxide
#

if(e.getView() == e.getView().getBottomInventory()) { wqill never pass

#

you are comparing an Inventory to a View. Two completely different objects

tawny remnant
#

so e.getView.getBottom == player.getInventroy?

eternal oxide
#

possibly

#

it's a check that will be true at some point#

somber night
eternal oxide
#

then loop over all recipients and remove any you don't want to see chat

quaint mantle
#

SORRY IF I'M BEING ANNOYING (repost)
last time in case someone hasn't seen it 'cuz I really don't know what to do anymore.
plugin.yml says 1.19
And Spigot-API 1.19.4-R0.1-SNAPSHOT API is the newest bukkit version

#

last time I'm asking for this one btw, like at this point why would I even

eternal oxide
#

you are using maven, what IDE?

quaint mantle
#

IntelliJ IDEA

eternal oxide
#

are you using artifacts to build or the correct way in the maven window for lifecycles?

quaint mantle
#

Hi Sorry , how to fix the trouble ?

quaint mantle
chrome beacon
quaint mantle
#

And I've done it

chrome beacon
#

Then restart

quaint mantle
#

that's the default

#

I changed nothing

#

.-.

#

it is the right one and still doesn't work