#help-development

1 messages ¡ Page 697 of 1

dark jolt
#

I got the json file for the advancement

tender shard
#

e.g.

{
"display": {
  "icon": {
    "item": "minecraft:acacia_boat"},

etc

dark jolt
#

Mine is

{
"display": {
"title": {
"text": "People Mover",
"color": "blue",
"bold": true
},
"description": {
"text": "Description"
},
"icon": {
"item": "minecraft:spruce_slab"
},
"frame": "task",
"show_toast": false,
"announce_to_chat": false,
"hidden": false
},
"criteria": {
"peoplemover": {
"trigger": "minecraft:impossible"
}
},
"parent": "riders:tomorrowland"
}

tender shard
#

yeah so what happens if you just throw that into UnsafeValues#loadAdvancement? it'll give you back an Advancement object

#
        NamespacedKey advKey = NamespacedKey.fromString("test:test");
        Advancement adv = Bukkit.getUnsafe().loadAdvancement(advKey, "{\n" +
                "    \"display\": {\n" +
                "        \"title\": {\n" +
                "            \"text\": \"People Mover\",\n" +
                "            \"color\": \"blue\",\n" +
                "            \"bold\": true\n" +
                "        },\n" +
                "        \"description\": {\n" +
                "            \"text\": \"Description\"\n" +
                "        },\n" +
                "        \"icon\": {\n" +
                "            \"item\": \"minecraft:spruce_slab\"\n" +
                "        },\n" +
                "        \"frame\": \"task\",\n" +
                "        \"show_toast\": false,\n" +
                "        \"announce_to_chat\": false,\n" +
                "        \"hidden\": false\n" +
                "    },\n" +
                "    \"criteria\": {\n" +
                "        \"peoplemover\": {\n" +
                "            \"trigger\": \"minecraft:impossible\"\n" +
                "        }\n" +
                "    },\n" +
                "    \"parent\": \"riders:tomorrowland\"\n" +
                "}");
#

should work just fine

#

it should even automatically update it to players according to NMS PlayerList

dark jolt
#

Alr, lets say I wanna add multiple would I just dupe it

#

Cause I had it create with a command but just having it in already would probably be easier

tender shard
#

You need different namespacedkeys

smoky oak
#

cant you do this in steps?

#

like, add the first advancement, then the next, then the next?

dark jolt
tender shard
#

an advancement

#

sad, this all prints "C" 🥲

    interface A {
        default void print() {
            System.out.println("A");
        }
    }
    abstract static class B {
        void print() {
            System.out.println("B");
        }
    }
    public static class C extends B implements A {
        @Override
        public void print() {
            System.out.println("C");
        }
    }
    public static void main(String[] args) {
        C c = new C();
        c.<A>print();
        c.<B>print();
        c.<C>print();
    }
dark jolt
# tender shard You need different namespacedkeys

Would this be correct

NamespacedKey parentKey = new NamespacedKey(this, "parent_advancement");
        Advancement parentAdvancement = Bukkit.getUnsafe().loadAdvancement(parentKey, "{\n" +
                "  \"display\": {\n" +
                "        \"title\": {\n" +
                "            \"text\": \"Parent Advancement\",\n" +
                "            \"color\": \"green\",\n" +
                "            \"bold\": true\n" +
                "        },\n" +
                "        \"description\": {\n" +
                "            \"text\": \"Description for parent advancement\"\n" +
                "        },\n" +
                "        \"icon\": {\n" +
                "            \"item\": \"minecraft:emerald\"\n" +
                "        },\n" +
                "        \"frame\": \"task\",\n" +
                "        \"show_toast\": false,\n" +
                "        \"announce_to_chat\": false,\n" +
                "        \"hidden\": false\n" +
                "    },\n" +
                "    \"criteria\": {\n" +
                "        \"parentcriterion\": {\n" +
                "            \"trigger\": \"minecraft:impossible\"\n" +
                "        }\n" +
                "    }\n" +
                "}");
        Bukkit.getAdvancement(parentKey).addCriteria("parentcriterion", null);

Only thing is addCriteria says cannot find symbol

tender shard
#

yeah well you cannot just add criterias, they are defined in the json

dark jolt
#

oh so I dont need that last line?

tender shard
#

if you really want to change the criteria, you have to cast the Advancement to CraftAdvancement, call getHandle() to get an NMS Advancement, then you can get the criteria field through reflection, create a new Criteria map, and replace the old field's value

#

alternatively you can turn an NMS advancement back into an AdvancementBuilder with deconstruct(), change the criterias there, unregister the old advancement, then register it again

dark jolt
#

na I just want criteria to be impossible

tender shard
#

well you already got that by using the impossible trigger

dark jolt
#

package com.techwithandrewdev;

import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.advancement.Advancement;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {

    @Override
    public void onEnable() {
        createAdvancements();
    }

    private void createAdvancements() {
        
        NamespacedKey parentKey = new NamespacedKey(this, "parent_advancement");
        Advancement parentAdvancement = Bukkit.getUnsafe().loadAdvancement(parentKey, "{\n" +
                "  \"display\": {\n" +
                "        \"title\": {\n" +
                "            \"text\": \"Parent Advancement\",\n" +
                "            \"color\": \"green\",\n" +
                "            \"bold\": true\n" +
                "        },\n" +
                "        \"description\": {\n" +
                "            \"text\": \"Description for parent advancement\"\n" +
                "        },\n" +
                "        \"icon\": {\n" +
                "            \"item\": \"minecraft:emerald\"\n" +
                "        },\n" +
                "        \"frame\": \"task\",\n" +
                "        \"show_toast\": false,\n" +
                "        \"announce_to_chat\": false,\n" +
                "        \"hidden\": false\n" +
                "    },\n" +
                "    \"criteria\": {\n" +
                "        \"parentcriterion\": {\n" +
                "            \"trigger\": \"minecraft:impossible\"\n" +
                "        }\n" +
                "    }\n" +
                "}");
        

        
        NamespacedKey childKey = new NamespacedKey(this, "child_advancement");
        Advancement childAdvancement = Bukkit.getUnsafe().loadAdvancement(childKey, "{\n" +
                "  \"display\": {\n" +
                "        \"title\": {\n" +
                "            \"text\": \"Child Advancement\",\n" +
                "            \"color\": \"blue\",\n" +
                "            \"bold\": true\n" +
                "        },\n" +
                "        \"description\": {\n" +
                "            \"text\": \"Description for child advancement\"\n" +
                "        },\n" +
                "        \"icon\": {\n" +
                "            \"item\": \"minecraft:diamond\"\n" +
                "        },\n" +
                "        \"frame\": \"goal\",\n" +
                "        \"show_toast\": false,\n" +
                "        \"announce_to_chat\": false,\n" +
                "        \"hidden\": false\n" +
                "    },\n" +
                "    \"criteria\": {\n" +
                "        \"childcriterion\": {\n" +
                "            \"trigger\": \"minecraft:impossible\"\n" +
                "        }\n" +
                "    },\n" +
                "    \"parent\": \"" + parentKey + "\"\n" +
                "}");
    }
}

Works besides child

tender shard
#

print out the childAdvancement with System.out.println

#

what does it show?

warped shell
#

how can I change the health of the ender dragon?

#

EntityAddToWorldEvent wont apply the health

#
    @EventHandler
    public void onSpawn(EntityAddToWorldEvent e) {
        Entity mob = e.getEntity();
        if(!mob.getType().equals(EntityType.ENDER_DRAGON))return;
        EnderDragon dragon = (EnderDragon) mob;
        dragon.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(2500);
        dragon.setHealth(2500);
    }```
tender shard
#

there is no such event in spigt

warped shell
#

ive tried plenty of event listeners

#

that one is from paper

tender shard
#

why not just EntitySpawnEvent?

warped shell
#

tried that

#

same problem

#

it prints a message

#

if i put a broadcast

#

but the health wont change

#

only the max health changes

smoky oak
#

some things take 1-2 ticks to update

#

try making a scheduler with 2 ticks and set the health then

warped shell
#

i tried a delay too

fickle rivet
#

it is better to use armor stand or holographic api?

warped shell
#

im completely baffled

smoky oak
#

yea im out of ideas lol

tender shard
warped shell
#

ItemDisplay and TextDisplay

tender shard
#

EnderDragons are ComplexLivingEntities, maybe it des the health thingy differently

warped shell
#

hm

tender shard
#

after all they can "recharge" themselves and stuff

fickle rivet
tender shard
#

try to disable their AI, see if you can now change their health

smoky oak
#

i dont think thats part of complexlivingentit

dark jolt
# tender shard why not just EntitySpawnEvent?

Idk whats going on but now its added somehow although says this

Error occurred while enabling simplelead v0.0.1 (Is it up to date?)
java.lang.IllegalArgumentException: Advancement simplelead:parent_advancement already exists

fickle rivet
warped shell
#

maybe ill try delay again, i think i used 5 ticks last time

#

maybe 2 ticks will work

#

its very frustrating

smoky oak
#

no it wont

tender shard
#

I'd try to disable their AI and als remove all pathfinder goals and see if that does anything

warped shell
#

but like the max health actually updates is the strange part

#

yet the health wont

#

i wonder if instant health effect would work

tender shard
#

what if you print out the health directly after setting it?

dark jolt
#

How hard would it be to integrate papi into the advancement thing

warped shell
tender shard
#

have you tried to print it out right after setting it though?

#

or setting AI to false

#

or anything?

#

you should at least print it out after setting it

warped shell
#

Ye I will do that, but if the instant health thing works Im giving up on directly setting the health

dark jolt
#

?paste

undone axleBOT
dark jolt
#

It won't set the descripton and says

Error occurred while enabling simplelead v0.0.1 (Is it up to date?)
java.lang.IllegalArgumentException: Advancement simplelead:parent_advancement already exists

https://paste.md-5.net/ikahaharey.java

upbeat fog
#

I need some help getting some information. I'm coding a boss fight right now and I want to store the uuid of the player and the damage they've dealt to the boss. I'm using a HashMap for now, I sorted it and was able to get the top damager's name and damage. How do I get the 2nd and the 3rd element of the hashmap?

rotund ravine
#

How did you get the top?

upbeat fog
#

uuh... with stackoverflow's help I was able to get this:

                    FinalDamages = Damages
                            .entrySet()
                            .stream()
                            .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
                            .collect(
                                    toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e2,
                                            LinkedHashMap::new));

                    Optional<UUID> FIRSTNAME = FinalDamages.keySet().stream().findFirst();
                    UUID topname = FIRSTNAME.get();
                    Double topdamage = FinalDamages.get(topname);
opal carbon
#

personally what i would do is sort it

#

and put the Map.Entry into a list

#

that might be a naive way to do it though idk

compact haven
#

No, that's how I'd do it as well

#

idk why it has you sort the entry set then put it back into a map

opal carbon
#

yeah that feels a bit wierd

#

ngl

compact haven
#

because a map is not guaranteed to be sorted

opal carbon
#

yeah

#

maps dont preserve sorting

#

and you just stream it again anyways???

compact haven
#

also what the fuck is that case convention

#

jesus christ

opal carbon
#

yeah firstname is NOT a constant

compact haven
#

FIRSTNAME, FinalDamages, topname

opal carbon
#

and those variables are NOT camelcase

upbeat fog
#

Don't ask me, it's stackoverlow and it works. Thats all that matters xD

compact haven
#

literally using every style of casing besides properCamelCase lmfao

opal carbon
#

fix the casing

compact haven
#

no stack overflow did not give you that answer with that casing

opal carbon
#

but yeah instead of collecting it into a map

#

just collect it to a list

#

since thats actually meant to preseve order

compact haven
#

^ then you can do, finalDamages.get(0) = highest damager

#

.get(1) = second, etc.

#

it'd be get(x).getKey() == damager, get(x).getValue() == damage

quaint mantle
#

anyone got a LINK To spigot downloading plugin api

opal carbon
#

so in theory it should stay sorted

#

but just being able to use index is better anyways

quaint mantle
upbeat fog
opal carbon
#

no

#

a list of Map.Entry

#

literally just instead of .collect(toMap) collect it to an arraylist

compact haven
opal carbon
#

yeah

#

but still not optimal

compact haven
#

in any case though, what he wants is easier to solve with a List<Map.Entry<K, V>>

opal carbon
#

pretty sure theres either a .toList() you can call directly on the stream or .collect(Collectors.toList())

upbeat fog
#

I just put the UUIDs and doubles into 2 separate arraylists

quaint mantle
#

is there documnetation for the spigot ai

#

the website's apik

#

or a link to where I can read about it

distant wave
#

im getting error while loading my data from file, does this mean World is not serializable?

#

thhe data im saving is a list of objects containing Locations

thin iris
#

how do i change nametags of people

smoky anchor
distant wave
smoky anchor
#

yeah probably

chrome beacon
tall dragon
#

which would store the world uuid

#

thus not needing it to be loaded to deserialize

distant wave
tall dragon
#

that works too

vital sandal
#

PacketPlayOutAdvancements packet = new PacketPlayOutAdvancements(true, advancements, RMTest, advancementDisplays);
can anyone help me with this packet

#

I need to reset player advancement with this

ocean hollow
smoky anchor
#

The error itself would help

ocean hollow
#

problem in tasked.foreach

upper hazel
#

In the process of creating an automine plugin, I ran into a problem with the player - rank - mine connection. Is it a good idea to create 2 tables and link them ? player && rank + object mine

smoky anchor
ocean hollow
#

essentially i remove the player during "for" loop

#

and it gives this error, maybe there is some way to solve it?

smoky anchor
#

Oooh
I see
You kick the player during iterating over the list
which calls remove from tasked

ocean hollow
#

yea

smoky anchor
#

oh you already explained that lul
im a bit slow today

#

well my best guess would be "kick the player a tick later" :D

brazen badge
#

How can I detect if a pressure plate is pressed and when it's pressed increment a variable each second? And when it is not pressed stop to increment the variabile?

smoky anchor
#

(I think, never really tried it but the docs say that)

upper hazel
#

do i need to use hibernate to link 3 objects between each other?

brazen badge
smoky anchor
#

send what you already have

#

?paste

undone axleBOT
brazen badge
quaint mantle
#

Quick fix was using completable future, run a task timer and just check for a few seconds. If It never completes, then world is null

distant wave
tall dragon
smoky anchor
quaint mantle
# distant wave ive never used futures in java, can you give me an example please?

https://github.com/anjoismysign/BlobLib/blob/async-objectmanager/src/main/java/us/mytheria/bloblib/utilities/SerializationLib.java
I used executors since my plugin is a library that allows calling the method, so if multiple plugins wish to call the method multiple times it will kind of queue the requests and not fail, else it would have issues with the futures since they some times be too many.

GitHub

A JavaPlugin framework, data hub and library that extends milkbowl's Vault and lucko's helper. Oriented for the Bukkit, Spigot & Paper environment. - anjoismysign/BlobLib

#

The method you are looking for is deserializeWorld(String, int)

brazen badge
echo basalt
#

.

distant wave
#

i feel like ive used this only once while using netty

#

though netty probably has its own implementation

near mason
#

does anyone know how to spawn models with AquaticModelEngine

upper hazel
#

help me how to link data between each other in the project if I still don't know what to link to what not

#

more precisely, I know but vaguely

#

I wanted to create business logic, but it's hard to know what must be connected and what not

#

are there any criteria?

#

but no all is well

gleaming grove
upper hazel
#

sometimes you need to link classes between each other, but I don't know how to do it well because it's hard to create a good plan

gleaming grove
#

there is solution for that, Dependecy Injection Container library

upper hazel
#

Is this a theme or a library?

gleaming grove
#

have you been ever using Spring framework for java?

upper hazel
#

for bukkit api - why?

gleaming grove
#

you can find there "@Beans" it is one of the implementation of Dependecy Injection Container

gleaming grove
upper hazel
#

i see

#

I just don't think it's necessary the project isn't that big

gleaming grove
#
class UserRepository
{

}

class PlayerListener
{
   private UserRepository repository;

   PlayerListener(UserRepository repository)
   {
     repository = repository;
   }
}

container.register<UserRepository>();
container.register<PlayerListener>();

PlayerListener instance = container.find<PlayerListener>();
``` This is example code how DI container might works. You are not forced to using Spring there are other implementaton of DI container
upper hazel
#

well, then I'll just create a class with a hashmap

gleaming grove
#

In this way you can use in contructor any class that was register to container so it's easy to shader data between classes in project

gleaming grove
upper hazel
#

it's just that the problem is not quite in this, but in what order should it be? object -> object2 -> object3

#

or you can just weave everything

gleaming grove
#

order doens matter as long as you are avoiding cilcular dependecy

upper hazel
#

ok

gleaming grove
#
{
  UserRepository(PlayerListener lisener)
   {
    
   }
}

class PlayerListener
{
   private UserRepository repository;

   PlayerListener(UserRepository repository)
   {
     repository = repository;
   }
}```
#

for example this is invalid

upper hazel
#

what's wrong with the cycle

#

сycle dependecy

gleaming grove
#

stackoverflow exception

upper hazel
#

oh

gleaming grove
upper hazel
#

oh i see

#

hahaha

gleaming grove
# upper hazel well, then I'll just create a class with a hashmap

https://www.youtube.com/watch?v=NSVZa4JuTl8 here is nice video of guy explaiing how DI works under the hood and coding one from scrach

Become a Patreon and get source code access: https://www.patreon.com/nickchapsas
Check out my courses: https://dometrain.com

Hello everybody I'm Nick and in this video I will try to create a dependency injection or DI container from scratch. This is also known as an IoC container or an inversion of control container. I'm going to do that using ...

▶ Play video
upper hazel
#

For example, a chessboard does not need to know what pieces are on it. I just want to create a convenient garbage-free dependency

#

how see this

#

there is simply no clear plan to understand what mandatory data the object needs to be given and which not

gleaming grove
#

but chessboard is not depend of pieces, the pieces are depend of chessboard

#

nvm

upper hazel
#

so you need to understand what depends on what

#

i see

#

ok i try

gleaming grove
#

like you was talking about the buissness logic, so I've assume your plugin will deal a lot with databases, right?

upper hazel
#

I'm writing a plugin and it feels like I'm working on the backend for the site

#

yes

#

this is an automine plugin there is a user service class and so on

gleaming grove
#

Then you can divide plugin code logic to 3 layers ```Layers:

[Spigot]

  • commands listener
  • events liseners

[Buissness]

  • services

[Database]

  • repositories```
upper hazel
#

ok

#

do you think it's a good idea to link it all and write it to the database in the form of tables? Hibernate use etc

#

I don't have a clear plan, so I wanted to link objects and display them in the database

gleaming grove
#

what do you mean by link?

upper hazel
#

playerData - > ranks - > autoMine ID

#

mine depends on player rank

hot panther
#

Hello, can someone help me? I'm working with Services Worker right now and it's just not working. Do I need to implement the class I want to load as a service in my plugin?
I'm using Gradle, so do I need to implement the other plugin's jar then?

Here is part of my code:
ServicesManager servicesManager = Bukkit.getServicesManager(); ErrorManagerService errorManagerService = servicesManager.load(ErrorManagerService.class); if(errorManagerService == null) { getComponentLogger().info("ErrorManagerService is null");

upper hazel
#

ok

sullen marlin
#

Services are so meh

#

You need to register an implementation somewhere

chrome beacon
#

I've never seen anything that isn't Vault use the service api

hot panther
# sullen marlin You need to register an implementation somewhere

I did: ServicesManager services = Bukkit.getServicesManager(); // Plugin startup logic errorManager = new ErrorManager(); errorManager.setError(false); services.register(ErrorManagerService.class, errorManager, this, ServicePriority.Normal); instance = this; fileManager = new FileManager(this); services.register(FileManagerService.class, fileManager, this, ServicePriority.Normal);

hot panther
sullen marlin
#

A getter?

#

Anyway, are your plugins set as dependencies correctly

timber whale
#

Someone knows a script so I can do /pay 1b instead of /pay 1000000000

hot panther
#

I guess
implementation(files("C:/Users/*********/Desktop/MinecraftPlugins/BigBattle/UtilityPlugin/build/libs/UtilityPlugin-1.0-SNAPSHOT.jar"))

chrome beacon
#

Why a jar dependency?

timber whale
#

Can u help me tho?

chrome beacon
#

No

timber whale
#

...

chrome beacon
#

Ask in the right place and have patience

upper hazel
hot panther
chrome beacon
hot panther
chrome beacon
#

Yes and?

#

Gradle does use maven dependencies and can publish to maven repos if you haven't noticed

hot panther
#

How can I install something into my local maven repo?

upper hazel
#

Oh I came up with, I'll just make a HashMap and link the objects through their unique variables

north nova
#

Wow

north nova
hot panther
north nova
#

if gradle just run gradle publishToMavenLocal

#

after u set up ur build.gradle

upper hazel
#

what is the name of the class type that binds a bunch of objects?

north nova
#

huh?

chrome beacon
#

A list?

#

Array?

upper hazel
#

class

chrome beacon
#

Could be many things

upper hazel
#

not list

north nova
#

what class

smoky anchor
#

interfaces ?

chrome beacon
#

ArrayList?

north nova
#

what do you mean by binding

#

lol

upper hazel
#

for example, there is a Model class, there is an event, and how to name a package that stores classes with links

north nova
#

ObjectBinding?

#

lol

upper hazel
#

don't such classes have specific types

#

this is the name of the class i am asking about the type

smoky anchor
#

can you provide other "types" ?

north nova
#

you mean generics...?

kind hatch
#

Class patterns maybe?

upper hazel
#

example:

  1. model - container classes that store data and do not have business logic
  2. events - classes working with game events
north nova
#

bro what

upper hazel
#

this model classes

#

have data but not have logic

drowsy helm
#

So like mvc but for plugins

kind hatch
upper hazel
#

okay, I’ll ask a simpler question - how to name the package where the classes responsible for dependencies will be stored

drowsy helm
#

It’s really up to you. Model is a fine name ig

upper hazel
#

object dependency

north nova
#

emotional rollercoaster conversation

#

wtf

upper hazel
#

Are there no standards?

north nova
#

there are plenty of design patterns if that's what you mean

north nova
#

what ur describing sounds like interfaces but you still make no sense

#

u mean have an interface (the model) that other classes implement, and what you should call your interface?

kind hatch
quaint mantle
#

like i call classes that idk what to call

upper hazel
#

I heard somewhere that they are called deretory

smoky anchor
#

// Todo: name

hot panther
north nova
#

add mavenLocal() to your repositories

#

then

#

compileOnly("ur path")

#

in ur dependencies

#

refresh and you should have it

quaint mantle
upper hazel
#

lol

#

dependency-object - idea name too long?

smoky anchor
#

I personally do my best to avoid having two words in a package name

spare hazel
#

private static final int STARTER_XP = 500;
yeah i dont think thats right tbh

#

is it?

smoky anchor
#

what would be wrong with this ?
I need some context.

hot panther
north nova
#

did you set up publishing in your build.gradle?

upper hazel
spare hazel
#

like static with final? im not really knowledged in java but i know this is wrong... probably

north nova
#

it is not

#

why would it be wrong

quaint mantle
#

it is not

spare hazel
#

alr

smoky anchor
#

you can have something like this

quaint mantle
#

static always should be with final anyways

spare hazel
#
public boolean saveDataToPDC(PersistentDataContainer persistentDataContainer){
        return true;
    }```

will this actually modify the player's PDC if i put anything in there?
smoky anchor
#

this will return true

spare hazel
#

yes i know

north nova
#

have u checked the docs?

spare hazel
#

but what if i do saveDataToPDC(e.getPlayer.getPersis...())

and then modify it there?

north nova
#

yeah

#

u can do that

smoky anchor
#

if you do pdc.set(whatever_belongs_here);
then yes, it will save

spare hazel
#

alr

north nova
#

why is it a boolean

spare hazel
#

yeah a boolean for error handling was dumb

#

i should just put throws ...

wild mica
#

Hi guys

north nova
#

@Builder
public static record PDCChangeResponse(boolean error1, boolean error2) {}

#

return PDCChangeResponse.builder().error1(true).build()

#

is what i like to do

wild mica
#

Is there a way to throw the player back (without bug)?

north nova
smoky anchor
#

without what bug ?

hybrid ledge
#

Hey, I shaded Guice to my bungee plugin and size increased almost by 4 MB. Is there something I can do about that?

remote swallow
#

Set velocity

north nova
#

make a lib loader plugin

wild mica
spare hazel
#

what Exception Should Be Used For Broken Data? in the Method's side not The Caller bcz that would be IllegalArgumentException i believe

hot panther
smoky anchor
hot panther
# north nova for what

For example, I have a PlayerAPI that I access from multiple plugins to ban players, etc.

wild mica
north nova
north nova
wild mica
#

event.getPlayer().setVelocity(event.getTo().toVector().subtract(event.getFrom().toVector()).multiply(-1));

smoky anchor
#

(hey guys, random question but is this the XY problem ? )

smoky anchor
wild mica
#

When the player looks at the ground, he jumps to up, I want it to launch in the opposite direction it is going. So the player can run forward looking at the ground.

remote swallow
wild mica
smoky anchor
#

or change the pitch in the calculation so you don't modify the player when you don't have to

wild mica
#

what is normal? There are 4 directions

smoky anchor
#

wut

#

wdym "4 directions"

#

we live in 3D space, not 4D

wild mica
#

like north, east...

upper hazel
#

will 2 AutoMine objects be the same if their MineData.getID are not equal

north nova
#

yea

#

no

upper hazel
#

a?

north nova
#

no it will compare the uuids

#

but use .equals

#

instead of ==

upper hazel
#

so I can safely shove an AutoMine object into a List?

#

if a class object implements equals, then the class itself will not be the same?

#

if we compare

smoky anchor
#

== compares the memory location iirc
overriting anything will not change it in any way

smoky anchor
#

manually check if the players hitbox collides with that pressure plate
before you increase your variable

smoky anchor
#

in the task you created, check if a plate is still at said location, if it is still powered and if a player is on top of it.

#

if not -> cancel task

hybrid ledge
#

Hello, is there "ChatEvent" but for console in bungeecord? I need to detect commands written by console (making alias plugin).

remote swallow
tender shard
#

wdym

upper hazel
#

@tender shard I liked your tutorials can you give a link to them

tender shard
upper hazel
#

oh you work for a company?

north nova
#

hes a spy

tender shard
#

that's my company

upper hazel
#

oh lol

#

take me to work))

brazen badge
near mason
#

why ints, chars, doubles, floats, longs arent nullable

hybrid ledge
tender shard
north nova
#

cause they're primitive types

upper hazel
tender shard
#

Wdym with „write to console“

upper hazel
#

I would like to get a team

hybrid ledge
# tender shard commands "written" by console?

I'm making simple command alias plugin for bungee and I can detect commands executed by players (using ChatEvent).
But for console, the ChatEvent is not triggered when it executes command.

smoky anchor
spare hazel
tender shard
smoky anchor
brazen badge
tender shard
upper hazel
#

I always wondered who came up with the name for spigot and its brand which is associated with a leaky faucet

spare hazel
#

Unboxing of 'persistentDataContainer.get(SkyMineCore.getInstance().getKeyManager().getLevel(), PersistentDataType...' may produce 'NullPointerException'

public void loadDataFromPDC(PersistentDataContainer persistentDataContainer){
        if(!persistentDataContainer.has(SkyMineCore.getInstance().getKeyManager().getBlocksBroken(), PersistentDataType.INTEGER)) return;
        level = persistentDataContainer.get(SkyMineCore.getInstance().getKeyManager().getLevel(), PersistentDataType.INTEGER);
    }
north nova
#

oh my god

upper hazel
#

my eyess

dire bluff
#

hello is it possible to make an event do a command?

spare hazel
dire bluff
#

thank you g

tender shard
#

since you do a has(...) check before, just use getOrDefault(..., 0); as you know it won't be null

pine forge
#

Is there a way to listen for vanilla commands after theyve been processed/executed?

tender shard
#

wdym? what would change after the command ran?

#

you'd still only get "player x issued command y"

pine forge
#

I want to listen for the /team command and check the new team members after theyve been changed

tender shard
#

ah, then I'd just wait a tick

pine forge
#

In the preprocess event there are still the old members

pine forge
tender shard
#

why not? I don't think there's a better way except to disable the vanilla team command, and instead write your own

#

that's because there is no such class

#

there is also no such class, neithe rin mojang, nor spigot, nor yarn, nor searge, nor intermediary, nor obfsucated mappings

#

what do you need it for?

#

which component? NMS components, bungee components, adventure components?

#

in mojang: Component.literal("asdasd")

spare hazel
#

i think im doing something wrong here

north nova
#

???

remote swallow
#

use case "something" -> { code }

spare hazel
smoky anchor
#

you don't have to can't break if you return

north nova
#

cause ur not supposed to break what

tender shard
remote swallow
#

wait

tender shard
remote swallow
#

my brain is off still

spare hazel
#

@remote swallow You Wasted My Time A Little Bit

tender shard
drowsy helm
#

Lmao

#

And my dad..

#

Is dead

tender shard
#

F

compact haven
#

epic…

tender shard
#

mine isn't

compact haven
#

ain’t no way

#

you told the bro he didn’t break

tender shard
#

but I dreamt that he was lost in a rocket or sth

compact haven
tender shard
#

but then the rocket was found again

remote swallow
#

leave me alone

drowsy helm
#

Mr amir will get my joke

remote swallow
#

my brain is off'

compact haven
#

it’s okay I still love you

drowsy helm
#

American Dad
Season 13 Episode 02
Census of the Lambs

Stan goes door-to-door as a enumerator, collecting a census on the neighbourhood. One house was a bit more annoying than it should have been.

Stan- How many people live here?
Kid - Me and my mom
Stan- So two
Kid- My dad…
Stan- Three
Kid- …died
Stan- Two, you wasted my time a little bit...

▶ Play video
compact haven
#

However why in the world

#

is that bro using string ids like that

#

literally use constants at that point, wtf

#

either constants to the message or to the string I’d

spare hazel
compact haven
#

but like you don’t even pass properties to the method so they should just be constants

willow yacht
#

Hey everyone, what is the best way to freeze player?

drowsy helm
#

If you want complete frozen make them spectate an armorstand

willow yacht
#

I want like for 3 seconds

remote swallow
#

cancel move event

tender shard
#

cancel move event, or set them as passenger to sth and cancel the unmount event, or give them potion effects, or make them spectate sth

drowsy helm
#

Doesnt cancelling move event bug

tender shard
#

or tell them they'll get cute anime girls if they don't move for 3 seconds

#

that's always the most efficient way

willow yacht
rough drift
#

not it is not

#

easily bypassable

#

just cancel the move event

willow yacht
#

Okey, thanks

tender shard
#

i'd set the walk speed AND cancel the events

rough drift
#

oh fair

smoky oak
#

can you manipulate camera rotatino speed without affecting FOV?

rough drift
#

nope

smoky oak
#

darn

shell robin
#

?paste

undone axleBOT
dark jolt
#

Not sure whats wrong with this, it won't set the descripton and says

Error occurred while enabling simplelead v0.0.1 (Is it up to date?)
java.lang.IllegalArgumentException: Advancement simplelead:parent_advancement already exists

https://paste.md-5.net/ikahaharey.java

smoky anchor
#

Does this happen on server startup ?
Or only on /reload

#

also

#

?main

dark jolt
#

Server start and reload break it too

ivory depot
#
            {
                Bukkit.broadcastMessage("");
            }```  Theres other solution to clear chat? which wont make mess in logs? I know about F3+D
echo basalt
#

Just send a component with a bunch of newlines to each player

smoky anchor
#

"\n".repeat(256)
(if you're on like java 16)

kindred sentinel
#

I had to make this in order to change color of lore depending on the tropical fish color

#

is there any other way?

#

maybe..

north nova
#

what the fuck

smoky anchor
#

ChatColor exists buddy

north nova
#

not even tha

#

t

young knoll
#

And ChatColor.of for rgb

kindred sentinel
kindred sentinel
#

&x hex code

smoky anchor
#

bet you could extend ChatColor and add your own colors there

young knoll
#

Why would you want to use &x&r&r&g&g&b&b when you can use ChatColor.of(“#rrggbb”)

kindred sentinel
smoky anchor
#

one is readable
the other one is not

kindred sentinel
#

why does someone want to read my colors?

#

,_,

robust helm
#

Is it not possible to set map entries on initializing the map?

young knoll
#

It is

kindred sentinel
#

oh

young knoll
#

There’s Map.of

kindred sentinel
#

oh really

young knoll
#

Iirc though it can only do up to 10 entires

robust helm
#

cool

kindred sentinel
#

i'm not very good at using hashmap

smoky anchor
quiet ice
#

varargs

gilded granite
#

how i can get a player head per person

remote swallow
#

you can have 2 var args

#

List.of has E...

robust helm
smoky anchor
young knoll
#

There is however a Map.ofEntries that uses a vararg of Map.entry

gilded granite
smoky anchor
young knoll
#

You could make a janky one with Object…

kindred sentinel
#

Then the other question.. Sooo if I have color in the variable then how to get this color from ChatColor?

robust helm
gilded granite
young knoll
#

Yeah that’s easy

robust helm
#

so just the player head as item

young knoll
#

SkullMeta has a setOwningPlayer

gilded granite
#

ohh

#

thx

kindred sentinel
#

Sorry maybe it's a stupid question but i can't find ChatColor.of("#rrggbb")...

north nova
#

hm

#

where did u find that method

#

i wonder

#

🤔

kind hatch
smoky anchor
#

it is only in the bungee ChatColor

kindred sentinel
#

oh

glad prawn
#

correct import will

young knoll
#

Theres little reason to ever use the bukkit chatcolor anymore

kindred sentinel
#

oh ok

#

why is bukkit chatcolor exist..?

#

bungee one is the same but with .of

remote swallow
#

bungee chat color wasnt always available

#

plus you can run craftbukkit

#

which doesnt include bungee chat api

celest notch
#

!verify RunTellObama

undone axleBOT
#

A private message has been sent to your SpigotMC.org account for verification!

twin venture
#

using 1.20.1 , what is the best way to get the sign attached above clicked block in the oppesite direction

#

so when i click on the door from behind it should do some stuff

smoky anchor
#

get clicked location
get clicked face
move location on the opposite direction of the face
move up
check for block ?

twin venture
onyx fjord
#

you need nms for custom durability right?

kindred sentinel
smoky anchor
#

why do you need it to be string ?

quaint mantle
#

how can i get the TPS of a server?

smoky anchor
kindred sentinel
#

hm

#

ok

remote swallow
#

technically it should be Map<String, String>> colors = Map.of(stuff);

smoky anchor
#

I mean I would say "go for components"
But I guess Chocos PR has not been merged yet

remote swallow
#

or ```java
Map<String, String> colors = new HashMap<>(); {
put(key, value);
put(key, value);
}

smoky anchor
#

? ???

#

that is not valid java

remote swallow
#

i dont remember the format

#

1 sec

smoky anchor
#

I mean it would be if you had a put method

opal carbon
smoky anchor
#

why would you not use components

river oracle
opal carbon
#

for the chatcolor?

river oracle
#

put it after the anonymous class

#

then its fine

smoky anchor
remote swallow
kindred sentinel
ivory depot
#
   @EventHandler
    public void onDamage(EntityDamageEvent e){
        if(!(e.getEntity() instanceof Player)) return;
        if(e.getCause() == EntityDamageEvent.DamageCause.VOID){
            World world = Bukkit.getWorld("world");
            Location loc = new Location(world, -6, 67, 12);
            e.getEntity().teleport(loc);
            e.setCancelled(true);
        }
    }``` I coded this, but im still die after teleport
remote swallow
#

bc you have more than 10 entries, no

smoky anchor
bleak nacelle
#

public class LeaveHandler_v1_20_R1 implements LeaveHandler {
private final Player toNull;

public LeaveHandler_v1_20_R1(Player toNull) {
    this.toNull = toNull;
}

public void nullGameProfile() {
    CraftPlayer player = (CraftPlayer) this.toNull;
    EntityPlayer entityPlayer = player.getHandle();

    try {
        Field gameProfile = entityPlayer.getClass().getDeclaredField("gameProfile"); // Field adını güncelleyin eğer değişmişse
        gameProfile.setAccessible(true);
        gameProfile.set(entityPlayer, null);
    } catch (NoSuchFieldException | IllegalAccessException e) {
        e.printStackTrace();
    }
}

}

#

I cannot import craftplayer for spigot 1.20.1

river oracle
#

this will error

static <K, V> Map<K, V> of(K k1, V v1) {
    return new ImmutableCollections.Map1<>(k1, v1);
}
smoky anchor
bleak nacelle
remote swallow
#

no

#

for nms you need 1 module per version you want to support

river oracle
# kindred sentinel So is this one better

what you really should be doing in this case if you want these colors like this is to have a final static map and set it up in a static block

public class ColorClassExample {

  private static final Map<String, ChatColor> colors

  static {
    colors = new HashMap<>();
    colors.put("BLUE", ChatColor.BLUE);
  }

}```
bleak nacelle
#

can you give example i dont understand what i need to do

#

i need support for 1.19.3+ including 1.20.1

remote swallow
kindred sentinel
#

one time

river oracle
#

I mean theoretically its not a huge deal because you really should only ever instanciate the event once

#

but I'd reccomend properly structuring it as some form of Utility so it can be used elsewhere if you need it in the future

kindred sentinel
#

like i'm using it only once

river oracle
#

if you don't really give a fuck just make a map like above but use the constructor instead of a static block

opal carbon
#

still cant putAll

#

map.of creates a immutable map iirc

kindred sentinel
#

I'm scared how many similar errors I missed while writing the rest of the code

#

I'm not really good at this, because i started learning java about month ago

smoky anchor
#

I don't believe you changed anything
This will still throw an error

smoky anchor
#

oh right, I see now

kindred sentinel
#

i changed to hashmap

bleak nacelle
#

It says CraftPlayer cannot be resolved to type in 1.19.4+

remote swallow
#

did you run nms for that version

bleak nacelle
remote swallow
#

?nms

remote swallow
#

read that

bleak nacelle
#

if i add multiple spigot versions

remote swallow
#

you have to create a multi module project then

#

or use reflection

bleak nacelle
#

there is already 1.11 1.12 and 1.13 support using reflection

spare hazel
#

Dependency 'me.clip:placeholderapi:2.11.3' not found
why?

remote swallow
#

you dont need to use jefflib, that was an example of a multi module library

remote swallow
spare hazel
#

i did but its stuck on resolving dependecies

remote swallow
#

wait then

spare hazel
#

its taking ages

#

oh nvm

remote swallow
bleak nacelle
remote swallow
#

i already decompiled

#

you also have to obsfucated back anyway

#

otherwise servers wont understand it

#

its just way easier in higher versions

bleak nacelle
# remote swallow you also have to obsfucated back anyway

I'm not native speaker sorry if i cant understand you but did you check the LeaveHandler classes i dont see any obfuscation there import net.minecraft.server.v1_13_R1.EntityPlayer;
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; for example

remote swallow
#

EntityPlayer is spigot mappings

#

and craftbukkit isnt obsfucated

#

in mojang mappings EntityPlayer is ServerPlayer

bleak nacelle
#

so i need to convert it to serverplayer in order to make it work or use jefflib?

remote swallow
#

no

#

you DO NOT need to use jefflib

#

that is an example of how multi module maven projects work

river oracle
tender shard
#

What do you even need NMS for?

bleak nacelle
# remote swallow no

should i copy their maven entirely and will be ready to go and import CraftPlayer?

river oracle
#

I do mine slightly different from alex, but same idea

river oracle
#

no configure maven as you need

remote swallow
#

use it as an example

river oracle
#

don't just copy a configuration blindly

remote swallow
#

im pretty sure this stuff is in api now anyway

tender shard
#

Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...

bleak nacelle
river oracle
#

not really what I mean but okay

#

@tender shard I've wondered why don't you use the versions-maven-plugin

tender shard
#

Its on the todo list for ages now but i never really did it lol

bleak nacelle
river oracle
bleak nacelle
river oracle
#

no

#

learn instead of asking people to do it for you

tall dragon
#

mfnalex only charges like 100 dollars an hour

#

ur finee

river oracle
#

I charge 20 an hour if you're interested

#

setting up all the build files will only take around that

#

at most

tender shard
remote swallow
#

id do that for free probably

river oracle
#

lol

tender shard
#

Let epic do it

bleak nacelle
#

thank you

remote swallow
#

@river oracle you got kofi or something

river oracle
#

nah

remote swallow
#

smh

river oracle
#

not old enough yet

#

I will set up a bunch of finance stuff after I turn 18

remote swallow
#

how do you do comissions with no paypal

tall dragon
#

they ship an envelope with cash

remote swallow
#

@bleak nacelle what versions do you want

tall dragon
#

😂

bleak nacelle
river oracle
remote swallow
#

what the fook

#

this plugin is setting ping to null for somer eason

#

wait

#

wrong mapping

#

wait

#

yeah

#

they set ping to null

spare hazel
#

how can i send an ActionBar to a player?

remote swallow
#

Player#spigot().sendMessage

bleak nacelle
#

i was using it

remote swallow
#

oh its auth me support for nms

remote swallow
bleak nacelle
kindred sentinel
#

To add NMS remapping i should replace by this something or just add it to the main information in pom.xml?

remote swallow
spare hazel
#

wtf is a base component?

remote swallow
#

a component

bleak nacelle
remote swallow
#

im guessing something to do with not figuring out whos who

#

bc thats all it uses nms for

#

setting ping to null if authme support is enabled

spare hazel
#

how can i create a base component

remote swallow
#

component builder

bleak nacelle
remote swallow
#

it will work, do you require authme support though

#

auth me support isnt required for the plugin to function

bleak nacelle
#

if it works without it

river oracle
#

how tf is this even possible its my own project

#

all of the versions are the same

#

oh wrong groupId

#

fucking dumb

spare hazel
#

player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new ComponentBuilder().append(ChatColor.DARK_AQUA + "Level " + account.getLevel() + " | XP " + account.getXp() + "/" + (account.getStarterXp() * account.getLevel())).getCurrentComponent());

im doing something wrong here

remote swallow
#

.build probably

spare hazel
#

but theres no errors

#

but im sure im doing something wrong

remote swallow
spare hazel
#

i never get it first try

river oracle
#

ComponentBuilder#create

spare hazel
#

alr

#

thanks

distant wave
#

does blowing up tnt cauesse BlockBreak events

lilac dagger
#

no

#

blockbreak is a player event

distant wave
spare hazel
#

will playerKickEvent trigger PlayerLeaveEvent?

distant wave
#

prevent destroying blocks inside the area

eternal oxide
#

check teh explode event and remove any blocks you don;t want broken

spare hazel
distant wave
eternal oxide
#

yes there is

#

in the correct event

distant wave
#

its probably BlockExplode right?

#

im dumb

river oracle
eternal oxide
#

BlockExplode is for things like beds in the nether

distant wave
#

ohh ok

distant wave
eternal oxide
#

as I already said

gilded granite
#

what is the code that give unmapped and mapped jars?

eternal oxide
#

you get the blocks in teh event and check each one to remove the ones you want protected

distant wave
eternal oxide
#

no

distant wave
#

then how?

eternal oxide
#

I already told you twice

distant wave
#

you cant cancel it for a specific block

eternal oxide
#

you remove the block from the list

distant wave
#

oh my fucking god

bleak nacelle
#

@remote swallow are you doing it? Please tell me when you are done

remote swallow
#

yeah, ill tell you when im done

remote swallow
#

instead of relying on outdated plugins

bleak nacelle
remote swallow
#

did you enable unlimited name tag mode plus install teh correct placeholder api expansions

#

im not getting paid so i only changed the nms

eternal night
#

you are getting paid in experiennce

remote swallow
#

got to read some disgusting code too

eternal night
#

hmmm my fav

bleak nacelle
remote swallow
#

whats a website script

bleak nacelle
remote swallow
#

oh

#

im good

bleak nacelle
#

i'm selling it for 20$ 5 people bought it you might want to check the code

remote swallow
#

i dont own a server or know php

gilded granite
#

any1 knows what is ClientBoundPlayerInfoPacket but in newer version?

bleak nacelle
gilded granite
#

which are?

remote swallow
#

ClientboundPlayerInfoRemovePacket and ClientboundPlayerInfoUpdatePacket

gilded granite
kindred sentinel
#

I have been blocked from chatgpt

#

💀

north nova
#

its better

#

this way

remote swallow
#

true

north nova
#

"how do i make skyblock plugin in spigot 1.19.3 do it for me"

north nova
#

mfw

remote swallow
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.

gilded granite
#

I got error Cannot interact with self when i use it

remote swallow
#

what

gilded granite
#


import java.util.UUID;

public class NpcCommand implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {

        if (sender instanceof Player player) {

            String name = args[0];

            CraftPlayer craftPlayer = (CraftPlayer) player;
            ServerPlayer sp = craftPlayer.getHandle();
            MinecraftServer server = sp.getServer();
            ServerLevel level = sp.serverLevel();
            GameProfile gameProfile = new GameProfile(UUID.randomUUID(), name);
            ServerPlayer npc = new ServerPlayer(server, level, gameProfile);

            ServerGamePacketListenerImpl packet = sp.connection;

            packet.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));


            packet.send(new ClientboundAddPlayerPacket(sp));

        }


        return false;
    }
}
trim creek
#

This is what one of my "friends" made:

package levis.murdermystery;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class a implements CommandExecutor {

public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
    if (sender instanceof Player) {
        sender.sendMessage("Ezt a parancsot csak jĂĄtĂŠkosok hasznĂĄlhatjĂĄk");
    } else {
      Player p = (Player)sender;
      if (p.hasPermission("mm.*")) {
          sender.sendMessage("Nincs jogod");
    } else {
          sender.sendMessage("Teszt");
    }
  return false;
  }
}

"Ezt a parancsot csak jĂĄtĂŠkosok hasznĂĄlhatjĂĄk" means that only players can use the command
"Nincs jogod" means "No permission"
"Teszt" means "Test"

I guess most of the advanced developers know what the issue is... 💀

remote swallow
#

missing !, bad classname, no override, missing return statements

ivory sleet
#

what the

remote swallow
#

no

#

other guy

trim creek
#

The code is not mine

trim creek
#

I just sent it in for y'all to suffer :]

ivory sleet
trim creek
#

He made another shit 💀

gilded granite
#

Required type:
Collection
<net.minecraft.server.level.ServerPlayer>
Provided:
ServerPlayer

trim creek
#
package hu.deshy.tesztplugin;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener, CommandExecutor {
    public void onEnable() {
        this.getServer().getPluginManager().registerEvents(this, (this));
        getCommand("teszt").setExecutor((CommandExecutor)this);
        getLogger().info("plugin sikeresen elindult!");
        getLogger().info("Developed by DeShy");
        getLogger().info("Helped by Roland882");
        }
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if ((sender instanceof Player)) {
            Player p = (Player)sender;
            p.sendMessage("Ezt a parancsot csak jĂĄtĂŠkos hasznĂĄlhatja");
        } else {
            Player p = (Player)sender;
            if (p.hasPermission("teszt.admin")) {
                p.sendMessage("Nincs jogod ehhez!");
                return true;
            }else {
                p.sendMessage("Üdv"+ p.getName());
                return true;
            } 
            
        }
        return false;
    }
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        Bukkit.broadcastMessage(p.getName() +"csatlakozott");
        p.sendMessage("Üdvözöllek a szerveren"+ p.getName());
    }
    public void onDisable() {
        getLogger().info("plugin leĂĄllt");
    }

}

I swear this guy can't even make plugins 💀
He just claims he can, but in reality, he can't. 💀
Permissions are yet again fucked up, missing seprators, and why would you put a command into the loader itself?!

ivory sleet
gilded granite
bleak nacelle
#

i have a question if java is consuming this much memory why mojand didn't rewrite minecraft in c++ so even older pcs can run it?

#

or others

tender shard
#

notch chose java because that was the language he was best in

gilded granite
#

@tender shard ```java
public class NpcCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {

    if (sender instanceof Player player) {

        String name = args[0];

        CraftPlayer craftPlayer = (CraftPlayer) player;
        ServerPlayer sp = craftPlayer.getHandle();
        MinecraftServer server = sp.getServer();
        ServerLevel level = sp.serverLevel();
        GameProfile gameProfile = new GameProfile(UUID.randomUUID(), name);
        ServerPlayer npc = new ServerPlayer(server, level, gameProfile);

        ServerGamePacketListenerImpl packet = sp.connection;

        packet.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));


        packet.send(new ClientboundAddPlayerPacket(sp));

    }


    return false;
}

}```

#

please help me to fix

bleak nacelle
trim creek
#

Notch is not even in Mojang anymore.

gilded granite
#

what's the point of recreating it in c++

trim creek
#

If you want a more optimalized Minecraft, use Minecraft: Bedrock Edition

hasty prawn
#

Minecraft was already remade in C++

#

That's exactly what Bedrock edition is.

trim creek
trim creek
trim creek
#

He gets kicked for "Can't interact with self"

#

or something

gilded granite
#

Yes

#

its updating the current player instead of creating another one

eternal night
#

new ClientboundAddPlayerPacket(sp)

#

sp

gilded granite
#

oh i fixed

bleak nacelle
#

ServerLevel level = sp.serverLevel(); what is this btw i never see this before(was coding when 1.13-)

hasty prawn
#

It's NMS

gilded granite
#

how i can send packets to every players

hasty prawn
#

That sounds like a question for Google to me

quaint mantle
#

Idk if spigot has audiences built in but maybe you can do it through that

#

((CraftPlayer) p).handle.connection.send

#

I don’t remember what the obfuscated version is

#

You can use that mappings website

proven jay
#

Hey, I have a question, if I post a paid plugin on SpigotMC, am I allowed to make the customer go into my Discord server to get a license key for it after they get it?

lilac dagger
#

the plugin has to work without any intervention

#

what happens if someone buys and you're not there for 2-3 days?

#

he can't use the plugin

willow yacht
#

Hello everyone, what's the best way to make a sheep follow a player? Because setTarget not working on friendly animals

spare hazel
#

Operator '==' cannot be applied to 'int', 'null'
why?

eternal oxide
#

a primitive can;t be null

spare hazel
#

oh

#

i should use Integer

#

alr fixed

#

dont use chatgpt

kindred sentinel
#

Good idea!

spare hazel
#

or atleast if youre just prototyping you can but not for actuall plugins used on public servers

kindred sentinel
#

oh sorry

tender shard
kindred sentinel
#

So is there any way to simplify this code?

#

P.S. this one is changeHookedEntity func

lilac dagger
#

very rarely you'll need Integer anyway

tender shard
# kindred sentinel So is there any way to simplify this code?
private static final Map<Material, EntityType> ALLOWED_MATERIALS = new HashMap<>() {
  {
    put(Material.COD, EntityType.COD);
    // ...
    // or get them automatically by name
    for(Material mat: Material.values()) {
      try {
        EntityType entity = EntityType.valueOf(mat.name());
        put(mat, entity);
     } catch (IllegalArgumentExceptionignored) { }
  }
};

//...
if(ALLOWED_MATERIALS.containsKey(material)) {
  changeHookedEntity(event.getHook(), caught, ALLOWED_MATERIALS.get(material));
kindred sentinel
tender shard
#

yes

#

but that only takes at most 10 things

kindred sentinel
#

that's why you can use putAll too

remote swallow
#

usually you wouldnt stack that

kindred sentinel
#

Like this

remote swallow
#

the way alex did it would be the prefered way

kindred sentinel
#

yeah?

tender shard
#

doesn't really matter at all

#

my point was to just use a map

quaint mantle
#

why not already do Map.of

kindred sentinel
tender shard
quaint mantle
#

oh well

smoky oak
#

I've been trying for the past half an hour to figure this out - is there a (not NMS) way to trigger code when a player blocks damage? I can't just use a runnable that checks shield cooldown/damage blocked statistic because i need the attacking player to check the item they attacked with
It doesn't trigger any kind of InteractEvent afaik aside from the right click on the shield after the fact
I'm trying to stop the shield disabeling under certain circumstances

remote swallow
#

block damage event

tender shard
#

BlockDamageEvent is for damage done to blocks

tender shard
#

or what exactly do you want to do

smoky oak
#

seeee heres the thing, far as i can tell that doesnt get triggered

remote swallow
#

oh i read player blocks damage and player damage blocks

#

why mongo gotta be so different

smoky oak
#

huh

#

must've messed up something

remote swallow
#

anyone here good at googling

smoky oak
#

does it not count as a EntityDamageByEntity event?

echo basalt
#

yes hello

#

professional googler here

remote swallow
#

find me a hibernate dialect class for mongodb

echo basalt
#

fuck off and use jdbc

remote swallow
#

im using jdbc

#

but i need a dialect

lilac dagger
#

is there anything you need duckling?

remote swallow
#

get a yellow error

remote swallow
smoky oak
#

is it possible to query the current log level?

remote swallow
#

of what

abstract spindle
#

If I smelt two IronOres in a Furnace with a coal and listen to the FurnaceSmeltEvent - For the fist ore there is no recipe if I try to get it with this code:

@EventHandler
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
  Furnace furnace = (Furnace) event.getBlock().getState();
   if (furnace.getRecipesUsed().isEmpty()) {
    logger.log("FurnaceSmeltEvent No Recipe");
  }

}

The same applies if I listen to the FurnaceBurnEvent
Dose anyone know why and how do I fix it ?

smoky oak
#

like the part that's usually INFO

#

i want to print stuff to chat if the log level's set to fine

remote swallow
#

something getLogger

#

might be bukkit

tender shard
smoky oak
#

Is CraftPlayer part of remapped?

#

yea it is

river oracle
#

It's a craftbukkit class

smoky oak
#

whyd it only appear as import after i enabled remapped then

river oracle
abstract spindle
river oracle
#

CraftPlayer is the nms implementation of player

eternal oxide
#

Its the implementation of Player so not API

smoky oak
#

this import only exists if i enable mojang-remapped

remote swallow
#

it should work with plain spigot too

smoky oak
#

:/

upper hazel
#

I forgot how can I get flags from config.yml and add to region?

eternal oxide
#

no, you are using Spigot instead of spigot-api

tender shard
#

it should even work with craftbukkit

smoky oak
#

well its just be like 'this doesnt exist'

tender shard
#

show your pom

smoky oak
#

?paste

undone axleBOT
eternal oxide
#

god no

smoky oak
remote swallow
#

have you actually ran buildtools no --remapped

smoky oak
#

uh

tender shard
#

use spigot, not spigot-api

smoky oak
#

no

eternal oxide
#

you need to learn what is API, what is implementation and what is NMS

tender shard
eternal oxide
#

spigot-api only cony contains the spigot/bukkit API.
spigot contains everything, API, inplementation and NMS

smoky oak
#

wrong one

#

EntityDamageEvent on CraftPlayer{name=Moterius}

#

there

#

cuz APPARANTLY

tender shard
smoky oak
#

entityDamageEvent isnt player

tender shard
#

CraftPlayer implements Player?!

eternal oxide
#

its LivingEntity probably

tender shard
#

if something is instanceof CraftPlayer is ALWAYS will be instanceof Player too

smoky oak
#

hm

eternal oxide
#

or just Entity

glad prawn
#

hm wat it's not wrong

eternal oxide
#

Do not use anythign that starts "Craft" unless you are heading to NMS

smoky oak
#

noetd

#

where's the javadocs again

#

its still not building em

eternal oxide
#

?jd-s

undone axleBOT
smoky oak
#

thx

#

no

#

the jar lol

eternal oxide
#

jar?

smoky oak
#

the javadoc jar for the javadoc dependency

eternal oxide
#

if you are using spigot-api as a dependency just click the download button for javadocs in Intelij/maven tab

smoky oak
#

i have that one

#

does it work the same with just spigot?

eternal oxide
#

you are not using spigot

river oracle
smoky oak
river oracle
#

Not sure the confusing

tender shard
tender shard
river oracle