#help-development

1 messages · Page 718 of 1

upper hazel
#

I just need an NPC to whom I want to add a model and textures

#

or if i has model, texture no need?

solar adder
remote swallow
#

nice

fervent gate
#

https://paste.md-5.net/usezayedit.java
I can't get the npc to rotate. I've tried a lot of things and have been working on this for the past 2 hours and nothing works. It just doesnt do anything.

remote swallow
#

ur doing the same troll you did in paper

#

average troll moment

solar adder
#

leave me alone G

#

don't you have anything better to do with your life

remote swallow
#

no not really

echo basalt
#

biggest bomboclaat

smoky oak
#

real java is a single file that starts with void main(){ :kekw:

solar adder
#

I agree

#

Plugins or addons are not real Java.

remote swallow
#

so using an api isnt real java, got it

echo basalt
#

so writing code in java that works with other code written in java

#

is not real java

#

thanks

#

understood

small current
#

Found out its a troll

solar adder
#

I like your background Imllusion

#

It's cool

smoky oak
#

you should look at mfnalex lol

remote swallow
#

mutli lang dev with no github or alternative in about me

#

sus

smoky oak
#

bah look at my about me

#

im at the 'i dont care anymore' stage

upper hazel
#

help me how to save myself from a terrible technical task

remote swallow
#

morbius

smoky oak
#

f u

solar adder
echo basalt
#

I found a tampermonkey script to bring github back to the old feed

solar adder
#

I do use github tho

small current
#

Morbin time

upper hazel
#

i too

echo basalt
remote swallow
upper hazel
smoky oak
#

im about 95% sure i could write that faster in actual java

echo basalt
#

new feed is just the "for you" page

solar adder
#

or knew a thing about coding

smoky oak
#

are any of those important shortcuts?

#

cuz my hand is not long enough for ctrl f4

remote swallow
#

i dont think any of them you would use in plugin dev

smoky oak
#

k

#

huh there's no 'open recently closed tab'

#

hm

#

there's a reason for that, I'm doing helper methods to apply specific types of values to specific keys

remote swallow
#

one sec

#

public static <T, Z> void applyPDCTag(ItemStack item, String key, PersistentDataType<T, Z>, Z value)
#

i think

smoky oak
remote swallow
#

my generics are in the wrong place

#

goes before return type

#

might be modifier too

smoky oak
#

ah yea wrong place

sullen marlin
#

gosh learn java epic

smoky oak
#

it wants a identifier now

remote swallow
#

i should

#

but i cba

remote swallow
smoky oak
#

ah in the later part

#

it seems to work if i actually add a variable name to the pdc type lol

remote swallow
#

yeah that does help

smoky oak
#

ikr

remote swallow
smoky oak
#

interesting way it recolors this btw

remote swallow
#

dafuck?

smoky oak
#

key already define

#

but I've expected it to keep the syntax higlight and just mark the key as 'error: key already defined in scope'

remote swallow
#

i would also recommend using NamespacedKey.fromString("namespace:" + key)

smoky oak
#

uh

#

thats deprecated aint it

remote swallow
#

other way round

#

the constructor is the deprecated one

smoky oak
remote swallow
#

thats with commas

#

i use a plus

smoky oak
#

is using the plugin thing a bad way somehow?

#

I'd rather not brick something

chrome beacon
#

No use the plugin

remote swallow
#

oh wait the plugin one isnt deprecated its a string one

#

swear the plugin one was deprecated

chrome beacon
#

You want the namespace to be the plugin name

#

So pass plugin instance

smoky oak
#

yea thats what im doing there

#

i figured keeping it in a static variable is faster than doing Bukkit.getPluginManager.getPlugin

chrome beacon
#

DI uwu

smoky oak
#

STATIC method

#

cant pass JavaPlugin instance without requiring it as method arg

remote swallow
#

my brain isnt working so why shouldnt i go jank some stuff together

chrome beacon
lilac dagger
smoky oak
#

ive a package for em

#

if i wouldnt put out some things into final 'library' classes some other classes would get unreadable

chrome beacon
#

Uppercase package name 🔫

smoky oak
#

have some camel_case

#

:D

chrome beacon
#

;c

#

?conventions

smoky oak
#

yea im aware, im just used to doing things this way

#

personal naming conventions sound like a really great idea dontcha thinkg?

#

dont worry the top-level part of my path is lowercase

kindred sentinel
#

How to combine text components and strings in one BaseComponent in order to add page with some clickable text?

peak depot
#

is there a spigot post that just simplyfies Enchaments so it say like DAMAGE_ALL = Sharpness?

kindred sentinel
#

It doesn't works

remote swallow
sullen marlin
#

what are you trying to do

smoky oak
#

not suck

sullen marlin
#

it takes a single string but you have commas

kindred sentinel
#
                        TextComponent withSign = new TextComponent("§2X");
                        TextComponent withoutSign = new TextComponent("§4X");
                        BaseComponent[] result = new ComponentBuilder("[", withSign, "]", "        ", "[", withoutSign, "]").create();
sullen marlin
#

commas denote arguments

smoky oak
#

oh u meant warrio

sullen marlin
#

what arguments are you trying to add

remote swallow
#

seems like a time for a plus

peak depot
kindred sentinel
sullen marlin
#

or .append or whatever actually takes a component

kindred sentinel
#

and i want them to combine

#

with some strings

kindred sentinel
kindred sentinel
#

I want to do something like this:

TextComponent withSign = new TextComponent("§2X");
TextComponent withoutSign = new TextComponent("§4X");
withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign"));
withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign"));
BaseComponent[] result = new ComponentBuilder("[", withSign, "]", "        ", "[", withoutSign, "]").create();
newBookmeta.spigot().addPage(result);
#

but i don't know how to combine text components

#

and strings

sullen marlin
#

?jd

undone axleBOT
chrome beacon
#

Create text components

chrome beacon
#

And append them

kindred sentinel
#

oh

#

thanks

smoky oak
#

public static <T, Z> void applyPDCTag
Is it possible to change this so that 'Z' is a return type?

#

I want to query PDCTags as well

remote swallow
#

public static <T, Z> Z applyPDCTag

smoky oak
#

ah its supposed to be a separate method but thanks

#

do i need to declare what Z is somewhere?

remote swallow
#

its declared in the <T, Z>

#

Z can be anything atm, you can customize what it would be tho

kindred sentinel
#

So i have another problem i have 3 text components 2 with click and hover event and 1 don't, but he extends click and hover event from text component behind it, how to clear click and hover event from this component?

                        TextComponent withSign = new TextComponent("§7[§2X§7]");
                        TextComponent withoutSign = new TextComponent("§7[§4X§7]");
                        TextComponent space = new TextComponent("                     ");
                        BaseComponent[] hoverWithSign = new ComponentBuilder("X1").create();
                        BaseComponent[] hoverWithoutSign = new ComponentBuilder("X2").create();
                        ComponentBuilder result = new ComponentBuilder();
                        result.append(withSign);
                        result.append(space);
                        result.append(withoutSign);
                        newBookmeta.spigot().addPage(result.create());
remote swallow
#

each component handles its own click and hover, you then combine them with the builder

remote swallow
#

TextComponent message = new TextComponent("Click me");
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org"));
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Visit the Spigot website!").create()));


ComponentBuilder builder = new ComponentBuilder();
builder.append(message);

bookMeta.spigot().addPage(builder.create())```
kindred sentinel
#

yeah but i did everything like this

                        TextComponent withSign = new TextComponent("§7[§2X§7]");
                        TextComponent withoutSign = new TextComponent("§7[§4X§7]");
                        TextComponent space = new TextComponent("                     ");
                        withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
                        withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign"));
                        withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
                        withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign"));
                        ComponentBuilder result = new ComponentBuilder();
                        result.append(withSign);
                        result.append(space);
                        result.append(withoutSign);
                        result.append("\n");
                        result.append(page);
                        newBookmeta.spigot().addPage(result.create());
#

but space and "page" extend click and hover events from withSign and withoutSign

remote swallow
#

@young knoll component man wake up

kindred sentinel
#

._.

kindred sentinel
remote swallow
#

knows more than i do

clever lantern
#

i check when player moves and cancel the event:

public void onMove(PlayerMoveEvent e) {
        if (e.getFrom().getZ() == e.getTo().getZ() && e.getFrom().getX() == e.getTo().getX())
            return;

but even if i just look around it gets cancelled

echo basalt
#

floating number operations go boom

clever lantern
#

ahhh

#

so just use getBlockX

#

?

uneven quest
#

I have a problem with my minigame plugin i am trying to create 1 game with:

        System.out.println("Games created");

        if (!gamesCreated) {
            if (GameInfo.getGameByName("PublicGame #1") == null) {
                GameInfo.createGame("Public Game #1");
            }
            gamesCreated = true;
        }
    }

    public static boolean areGamesCreated() {
        return gamesCreated;
    }


    public static void clearGames() {
        games.clear();
        gamesCreated = false;
    }


    public static GameInfo createGame(String gameName) {
        for (GameInfo game : games) {
            if (game.getGameName().equalsIgnoreCase(gameName)) {
                return null;
            }
        }

        int gameId = getNextGameId();
        GameInfo game = new GameInfo(gameId, gameName);
        games.add(game);
        return game;
    }```

OnEnable:

```    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        getServer().getPluginManager().registerEvents(new ClickListener(), this);
        getCommand("points").setExecutor(new PointsCommand());
        getLogger().info("OorlogSimulatie plugin is ingeschakeld!");

        PlayerPoints.loadPointsData();
        if (!GameInfo.areGamesCreated()) {
            GameInfo.createGames();
            getLogger().info("Games created");
        } else {
            getLogger().info("Games are already created");
        }
    }```

But its registers 2 times so it makes 2 games of Game #1
worldly ingot
#

I don't think it does register it two times. But you're logging "Games created" twice

#

Also you're missing a space in your createGames() method. getGameByName() and createGame() are being passed two different strings

uneven quest
#

I have like a GameSelector and in it says Games #1 2x times and also made a system.out.print to check how many times a game is created and it is created 2 times.

#

But thank you 🙂

quaint mantle
#

can somebody help i don't known what event does that if you spash a linger posion like instant damage it will flag it because i want make it so it dosen't hurt you

sterile token
#

I had soe question related with components, why there is a point where colors are not applied anymore?

sterile token
floral drum
#

One thing like that has happened to me before

sterile token
#

On the first line there is no problem, but then i think after the 2nd or after the middle of the 2nd one, the color doesnt appear anymore

floral drum
#

Do you have code where this is broken in?

sterile token
#

What do you mean with it?

#

I simply using player.spigot().send(component) and a normal component from the api

floral drum
#

Could you show me how you're creating this component?

sterile token
#

oh yeah

#

give me 5m i will search it

floral drum
#

Kk

#

Because if you're trying to use ColorCode mixed with components, that's when it breaks.

sterile token
#

Yeahh

#

Exactly i use it with color codes

floral drum
#

You have to set the color using the actual API instead

sterile token
#

oh okay

#

but why? I mean its because something broken inside the api?

floral drum
#

They're just not supported together. Legacy chat api, and the new chat api.

#

They don't mix

sterile token
#

oh okay, so color codes are new chat api

floral drum
#

ColorCodes are old api (Ex. ChatColor.translateAlternateColorCodes('&', "&6Hi")).
To use the new one, you must set the color of the components using -
TextComponent username = new TextComponent("ignPurple");
username.setColor(ChatColor.PURPLE);
player.sendMessage(username);

high pewter
#

This is a question about NMS, I hope this is appropriate here. I'm trying to get a list of all the world features (like the one when you type /place feature ). Looking at the NMS source, I can see that this list is produced by ResourceKeyArgument.key(Registries.CONFIGURED_FEATURE), however ResourceKeyArgument.listSuggestions gets this list from the CommandContext (CommandContext.getSource().suggestRegistryElements(this.registryKey), ...)) which I don't have and that gets it from IRegistry.getTagNames() and I can't find a way to get an IRegistry instance for a ResourceKey either. How can I get a list of registry elements from a ResourceKey?

carmine mica
#

well getTagNames will just get you the tag names, not element names

#

you can get Registry instances from a RegistryAccess which is available on Level

high pewter
#

In fact, I'm confused because ResourceKeyArgument passes a ResourceKey to suggestRegistryElements which takes a IRegistry and ResourceKey doesn't extend/implement anything??

carmine mica
#

the ResourceKey passed to suggestRegistryElements is the ResourceKey for the Registry itself, not an element in the Registry

#

that's why the param type is ResourceKey<? extends Registry<?>>

high pewter
#

Oh strange

#

I still don't understand how that works though. Because even if ResourceKey has a parameterized type of Registry, how can it be passed to a Registry unless it itself extends it or you take the value from that resource key

#

Like, I can't pass a List<String> to a String parameter..?

#

Nevermind I'm dumb, I've just realised there's two suggestRegistryElementss 🤦‍♂️

carmine mica
fervent gate
#

https://paste.md-5.net/usezayedit.java
I can't get the npc to rotate. I've tried a lot of things and have been working on this for the past 2 hours and nothing works. It just doesnt do anything.

high pewter
thin iris
#

how much dedicawted wam should i have for a survur?

echo basalt
fervent gate
echo basalt
#

really stupid

#

but can you change your int yaw to a float

sullen marlin
#

why not just use citizens

echo basalt
#

I wonder if we're having loss

sullen marlin
#

or any other npc library

echo basalt
#

let him play around

sullen marlin
#

also yeah looks like probably a rounding issue

echo basalt
#

if I were to just use libraries instead of making my own stuff over the past 7 years I'd have like half the knowledge I do

sullen marlin
#

that 256/360 is sketch too

echo basalt
#

protocol limitation ¯_(ツ)_/¯

sullen marlin
#

yeah but 256/360.0 is different

echo basalt
#

¯_(ツ)_/¯

lost matrix
#

I mean thats always 0

echo basalt
#

that's the suspected problem

fervent gate
#

I mean, inputting anything into the value changes nothing

lost matrix
#

And multiplying by 0 is also always 0

fervent gate
#

even when the value is indeed like 10 or something

echo basalt
#

multiplaying

sullen marlin
#

because 256/360 is 0 and then you are multiplying by 0

echo basalt
#

lemme open up my test project

fervent gate
#

How should I round it? This is from a video by Kody Simpson iirc

#

works fine on his end

sullen marlin
#

256 or 360 need to be a float

lost matrix
#

No idea what you are doing with your ints

echo basalt
#

it has always been a byte since I started working with packets

thin iris
#

how do i make ppl glow but only i can see them glow

echo basalt
#

magic

lost matrix
#

Wait i thought he was emulating a player

echo basalt
#

I have a class for this shit with protocollib

thin iris
#

rly can i see

fervent gate
#

as the picture is for server I think

lost matrix
#

Ah in that case you need the 1/256 th rotation

echo basalt
#

it's inconsistent and botched together after a coding session that lasted like 3 days

#

but it works and I couldn't care less

fervent gate
lost matrix
# fervent gate What calculation would that be?
    public void look(int npcId, @NotNull Player player, int yaw, boolean onGround, @NotNull ServerPlayer npc) {
        ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
        ps.send(new ClientboundRotateHeadPacket(npc, (byte) ((yaw % 360) / 256.0)));
        ps.send(new ClientboundMoveEntityPacket.Rot(npcId, (byte) ((yaw % 360) / 256.0), (byte) ((yaw % 360) / 256.0), true));
    }
echo basalt
#

can we please reuse variables

lost matrix
#

You are also setting the pitch to the yaw

#

For some reason

fervent gate
#

Yeah ik but that was just for testing

#

left it in there by accident

echo basalt
#
    public void look(int npcId, @NotNull Player player, int yaw, boolean onGround, @NotNull ServerPlayer npc) {
        ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
        byte protocolYaw = (byte) ((yaw % 360) / 360.0) * 255;
        ps.send(new ClientboundRotateHeadPacket(npc, protocolYaw));
        ps.send(new ClientboundMoveEntityPacket.Rot(npcId, protocolYaw, protocolYaw, true));
    }
#

pretty sure we're meant to multiply by 360

#

instead of just dividing

#

as we're downscaling a range of 0-360 to just 0-255

#

that's the correct math

lost matrix
#

Wait bytes only have 8 bit. 127 -> -128
That wont cut it

lost matrix
echo basalt
#

it's how it's intended to work

#

each value in the range corresponds to 1.4deg

lost matrix
#

So you just overflow on purpose

fervent gate
#

this is too confusing for me at 3am lol

echo basalt
#

which is lossy enough

echo basalt
#

we have loss on purpose

#

float deg -> byte (unsigned)

0º -> 0
90º -> 64
180º -> 128
270º -> 192

lost matrix
#

If you have a rotation from 0 - 256 then you need the sign bit in order to represent all values

echo basalt
#

type deal

#

it's a ~1.4 : 1 ratio

#

aka 360 / 256

#

just trust me on this one I've been fucking around with packets since 2020

lost matrix
#

270º -> 192 and how do you imagine 192 would look like as a byte

echo basalt
#

it's just.. unsigned

lost matrix
#

Ah yes. The classic unsigned java byte

#

So we are overflowing on purpose

echo basalt
#

something like that

#

there was something about adding 90

#

for no reason

fervent gate
echo basalt
#

lemme find my fakearmorstand code

#

probably in my gist

#

no clue why I used rotation

#

ppl at work deleted my fakearmorstand class woeisme

#

here we go

lost matrix
#

Old Protocollib send is garbage

echo basalt
#

this is like 3 year old code

#

also yesterday I learned that do-while and while are different things

#

where the do block runs once before running into the condition

echo basalt
#

never using it anyways

#

at least in python that's how it works

ivory sleet
#

do while so nice for atomic impls

echo basalt
#

saw it on russian programming instagram

lost matrix
#

I very, very rarely use head iterations

echo basalt
#

it was a c++ in 5 minutes speedrun

fervent gate
#

Ok so it still doesnt seem to work. I'll try to look at some npc libs

lost matrix
#

Ah yes. The language where you have to implement the big 5 by hand every time and
where there are different files in which you write your implementation depending on
if it is compile time interlaced (fking header files)

echo basalt
#

I barely speak russian but I understood the video perfectly

lost matrix
#

Everything is standard C here besides the insertion operator

echo basalt
#

mm pointers

lost matrix
#

Ah didnt see the class in the end

echo basalt
#

homeboy is casually insane but yeh lemme add c++ to my CV

lost matrix
#

I hate that language. Rust superior

echo basalt
#

analog machines best

lost matrix
#

FPGAs

echo basalt
#

using your brain >>

lost matrix
#

Anyways, i think im gonna write my own game for a while... bb

echo basalt
#

rip

#

it's like 2:30am and I'm tripping about this one project

#

where I gotta project a shape into a wall and I'm dying out here

#

what the fuck is minecraft:__reserved__

opal juniper
#

someone let the python dev make a namespace

dense geyser
#

going off this thread, it's discussed that players can join a bungeecord proxy with a "unix domain socket" which is why ProxiedPlayer#getAddress() is deprecated. if the player joins and the socket returned is not an InetSocketAddress, what other object may it return, or what will the IP look like when printed?

sullen marlin
#

DomainSocketAddress probably

echo basalt
#

You can get the player's ip on a bungee thing through PlayerLoginEvent

#

go figure

dense geyser
dense geyser
dense geyser
high pewter
#

Is there a more concise way to convert a Bukkit Location to an NMS BlockPos? I know it's not that long but just curious :Pjava new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ())

dense geyser
#

thats the best way in terms of avoiding craftbukkits version specific stuff, otherwise CraftLocation.toBlockLocation(location) afaik

high pewter
#

Oh thank you, ye that's better!

naive loom
#

can someone help me with java vectoring i will legit give you $1 if you can help me implement a feature in my code o_o 😦

sullen marlin
#

Just do instance of InetSocketAddress else unknown

naive loom
# echo basalt Just ask your question

This code works perfectly fine and normal, however I want it to place the entire model in that direction the provided face variable.

For example, lets say I'm looking straight down at the model
X X X X X
X X Y X Y
X X Y X Y
X X Y X X
X X X X X

If I am facing EAST (which following the common way of a compass it should look like this.)
X X X X X
X X X X X
X Y Y Y X
X X X X X
X X X X X

Map<Vector, BlockData> blockDataMap = new HashMap<>();
        for (Map.Entry<Vector, BlockData> entry : this.blockDataMap.entrySet()) {
            Vector originalVector = entry.getKey();
            BlockData originalBlockData = entry.getValue();

            int rotations = face.ordinal() % 4; // Limit to 0-3 rotations
            Vector rotatedVector = originalVector.clone();
            for (int i = 0; i < rotations; i++) {
                double tempX = -rotatedVector.getZ();
                rotatedVector.setZ(rotatedVector.getX());
                rotatedVector.setX(tempX);
            }

            BlockData rotatedBlockData = originalBlockData.clone();
            if (rotatedBlockData instanceof Directional directional) {
                BlockFace facingFace = directional.getFacing();
                directional.setFacing((facingFace.equals(BlockFace.UP) || facingFace.equals(BlockFace.DOWN))
                        ? facingFace
                        : getCorrectedBlockFace(face, facingFace));
            }

            for (int i = 0; i < rotations; i++) {
                 if (rotatedBlockData instanceof Rotatable rotatable)
                    rotatable.setRotation(rotateBlockFaceY(rotatable.getRotation()));
            }

            blockDataMap.put(rotatedVector, rotatedBlockData);
        }

        return blockDataMap;
granite olive
#

How do I get the orientation of a jigsaw block? I tried using the same approach used for blocks with a direction Directional blockData = (Directional) block.getBlockData(); blockData.getFacing()
but when I try to use this with Orientable it doesnt work since Jigsaws dont seem to be an instance of that:
Orientable blockData = (Orientable) jsblock.getBlockData();
So how do I get the orientation I see when looking at a jigsaw block with f3 ingame?

peak jetty
#

when i load up my plugin, i get this error from the server console:
[ERROR] [LegacyPluginLoadingStrategy] Could not load 'plugins/PlutoAddon-2.0.jar' in folder 'plugins'
it always worked in 1.19.4 but now that i updated it to 1.20.1 it doesnt work anymore, even if in my IDEA (inteliJ) it doesnt show any errors

peak jetty
# lost matrix Show your exception

here:

17.09 09:28:29 [Server] [ERROR] [LegacyPluginLoadingStrategy] Could not load 'plugins/PlutoAddon-2.0.jar' in folder 'plugins'
17.09 09:28:29 [Server] [INFO] org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:127) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:35) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.entrypoint.strategy.LegacyPluginLoadingStrategy.loadProviders(LegacyPluginLoadingStrategy.java:202) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:39) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.loadPlugins(CraftServer.java:508) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] at java.lang.Thread.run(Thread.java:833) ~[?:?]
17.09 09:28:29 [Server] [INFO] Caused by: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName0(Native Method) ~[?:?]
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName(Class.java:467) ~[?:?]
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:123) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] ... 9 more
17.09 09:28:29 [Server] [INFO] Caused by: java.lang.ClassNotFoundException: com.comphenix.protocol.events.PacketListener
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName0(Native Method) ~[?:?]
17.09 09:28:29 [Server] [INFO] at java.lang.Class.forName(Class.java:467) ~[?:?]
17.09 09:28:29 [Server] [INFO] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
17.09 09:28:29 [Server] [INFO] at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:123) ~[paper-1.20.1.jar:git-Paper-172]
17.09 09:28:29 [Server] [INFO] ... 9 more
lost matrix
peak jetty
#

i have protocollib 5.1.0 installed, here is my plugin.yml:

name: PlutoAddon
version: '${project.version}'
main: net.plutocraft.plutoaddon.PlutoAddon
api-version: 1.20
authors: [Gizmo0o]
description: Simple addon plugin for PlutoCraft.
website: plutocraft.net
commands:
  daily:
    description: The /daily command.
    permission: plutoaddon.default
    permission-message: You don't have plutoaddon.daily
  store:
    description: The /store command.
    permission: plutoaddon.default
    permission-message: You don't have plutoaddon.store
  discord:
    description: The /discord command.
    permission: plutoaddon.default
    permission-message: You don't have plutoaddon.discord
  nick:
    description: The /nick command.
    permission: plutoaddon.default
    permission-message: You don't have plutoaddon.nick
  hide:
    description: The /hide command.
    permission: plutoaddon.default
    permission-message: You don't have plutoaddon.hide
#

@lost matrix

lost matrix
#

You are missing your dependencies

peak jetty
#

i put all my dependencies in there

lost matrix
#

Not in your pom, in your plugin.yml

peak jetty
#

oh, how do i do that?

lost matrix
quaint mantle
#

GUYS

#

I HAVE HUGE PROBLEMS

#

Why the f... is this not working? The randomizer for the mob drops works perfectly.

lost matrix
#

What kind of mess am i reading here?
Which method is this in?
What is CompressedListener?
Why do you create an instance of CompressedListener and then dont do anything with it?`

quaint mantle
lost matrix
#

You dont say. But its an out of context snippet.

peak jetty
quaint mantle
#

I said the other one works perfectly, just read those lines after onBreak

lost matrix
lost matrix
#

Also this is an absolute mess

quaint mantle
lost matrix
lost matrix
quaint mantle
# lost matrix Here are a few. And im actively ignoring that java code style violations.

The last one is actually useful, but if I don't write something else instead of the other ones, the code is going to work perfectly. The instance is not pointless, this entire thing runs in a method, so it is going to increase the readability. Never hold references to player object? Why? These things cannot be triggered without a player so... why not? This doesn't make that much sense actually... to make a separate variable for the block's type. For only two usages, you can clearly see, what is going on.

hazy parrot
#

If you hold reference to player object, is gc able to clear it after player leave server?

quaint mantle
#

So it will clear up

lost matrix
hazy parrot
torn badge
#

Orrr just remove the reference when the player quits

hazy parrot
#

Also Enum#values() might not be really cheap operation

quaint mantle
quaint mantle
hazy parrot
#

Just cache that variable

#

As static field or smth

lost matrix
#

What?

quaint mantle
#

There are tens of types of materials. What do you mean?

hazy parrot
#

Cache Material.values(), don't call it on every event

quaint mantle
lost matrix
#

Or at least just use it once.

quaint mantle
#

Yes.

#

Oh shit I didn't want to this.

quaint mantle
#

Wait... is there some kind of a method, that checks if the material can be threw onto the ground?

#

Nevermind I found it, thanks for the help!

quaint mantle
lilac dagger
#

That class is huge

#

Making copies of it is just not good

#

Ah yes

#

You talked about it

quaint mantle
lilac dagger
#

Random can be cached too

lost matrix
#

It uses a low level array copy in the background. Only takes a few micros.
Once per BlockBreakEvent should be fine. Its even better if you cache it
on the heap instead of the stack, but thats a meticulous optimization.

#

But you shouldnt cache Random. Rather use the Random instance which is assigned to your thread by using ThreadLocalRandom

lilac dagger
#

Why not?

quaint mantle
lost matrix
lilac dagger
#

I always cache my random

lost matrix
#

Why?

lilac dagger
#

Because i don't need a seed

#

I don't see the point of making copies of it

lost matrix
#

Ok but why not just use the Random instance which is always accessible on your thread?

lilac dagger
#

I use secure random myself, it doesn't really mather what i use

lost matrix
#

Especially if you dont need to seed the Random

lilac dagger
#

If you have a reason why i shouldn't use it you can tell me

lost matrix
#

Secure random? Because thats slow as hell.

lilac dagger
#

Is it?

vague oracle
#

Does using this

p.setStatistic(Statistic.TIME_SINCE_REST,0);
``` stop phantoms from attacking you or how do they calculate when to spawn?
sullen marlin
#

I use securerandom so my plugin is safe

lost matrix
vague oracle
lilac dagger
#

I use it cause it's thread safe

dry hazel
#

Random is also threadsafe

lilac dagger
#

Hm

#

I can switch it up then

lost matrix
lost matrix
dry hazel
#

?

#

it is thread safe

dry hazel
#

Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded designs.

lilac dagger
#

Oh, i always assumed thread local is optimized for the thread that makes the instance

#

Guess i was wrong

#

I remember seeing the bounded next int that was cool

#

I'm gonna use it then

#

Thanks

lost matrix
peak jetty
lost matrix
dry hazel
#

contention means lock contention, not race conditions

sullen marlin
#

Sir this is Spigot

lilac dagger
#

So i shouldn't cache it

quaint mantle
lost matrix
lost matrix
lilac dagger
#

This is so cool

lost matrix
keen basin
glad prawn
#

Can anyone tell me the use case of SplittableRandom

peak jetty
#

but this import here works:

        <dependency>
            <groupId>com.comphenix.packetwrapper</groupId>
            <artifactId>PacketWrapper</artifactId>
            <version>1.19.4-2.1.2</version>
            <scope>provided</scope>
        </dependency>
lost matrix
keen basin
lost matrix
peak jetty
#

i just changed 1.19.4 to 1.20

dry hazel
lost matrix
#

Its really just a ThreadLocal<Random>. Just in fancy.

wet breach
# lilac dagger Oh , that's nice

it should be noted that random and threadlocal random uses 48 bits and uses the clock time for its seed generation. SecureRandom uses 128bits and needs a source for its seed generation to be provided. Main difference is that SecureRandom ensures that predictability is not so predictable where as Random and ThreadLocal is not concerned with this, you just need a random number

dry hazel
#

I don't think so

#

that makes different Random instances, so it isn't deterministic anymore

lost matrix
#

Yeah kind of. Just with a few more implementation details like automatic creation on thread forking

#

ThreadLocal<T> has seperate instances of T for each thread, same goes for ThreadLocalRandom.

wet breach
#

Splitterator is basically for creating a splittable generator where the generation of the random is split between the threads

#

but the two PRNG's I listed are well balanced in terms of space, speed and period and are used when there is no special requirements needed. There is other PRNG's that exist as well, like a Jump generators or leap generators

lost matrix
#

Out of whos ass did you pull this now? Never heard of L64X128Mix.

#

Ah i see, some apache fkery...

ivory sleet
wet breach
wet breach
#

there is all kinds of PRNG's out there

#

some more secure then others, and others designed for a specific purpose or you can create your own with Java's RandomGeneratorFactory

#

you can create PRNG's based on charasteristics as opposed to just a named one

#
        int NUM_PROCESSES = 100;
        
        RandomGeneratorFactory<SplittableGenerator> factory =
            RandomGeneratorFactory.of("L128X1024MixRandom");
        SplittableGenerator random = factory.create();
       
        IntStream processes = IntStream.rangeClosed(1, NUM_PROCESSES);
        
        processes.parallel().forEach(p -> {
            RandomGenerator r = random.split();
            System.out.println(p + ": " + r.nextLong());
        });

this is an example of L128X1024MixRandom PRNG

#

which is useful just like the one I stated earlier for many dynamic threads, but when you have millions instead

#

but you probably wouldn't reach millions unless you got some fancy server box that could support that lmao

wet breach
#

just have to name them as my code example above

#

if you want to use them

#

Java has like 11 or so prng's predefined

#

ah found the link where my code example in my snippet library comes from for those that want to further read

upper hazel
#

who know is it possible to make such a plugin? https://www.youtube.com/shorts/KjlSb3LWm8E

DMC

Ссылка на сервер - https://taplink.cc/denophine.jar

IP: dmc-minecraft.ru

Наш магазин ключей - https://t.me/dmc_store

Ищешь хороший хостинг? Мы пользуемся этим - https://my.pterohost.com/aff.php?aff=33

  • Это шуточное видео и им мы не хотели кого-либо обидеть или оскорбить
▶ Play video
lost matrix
upper hazel
#

vidio name - how create models no use texturepack

#

i mean how he create this

lost matrix
#

You can use display entities for this

upper hazel
#
  1. create model end give the armorstabd?
#

for model textures no need?

lost matrix
#

You can also use falling blocks for this if you dont need to scale the blocks

#

But im not helping you more than that, for reasons

upper hazel
#

??

quaint mantle
upper hazel
#

how i can check rank in player? i mean use equals or this bad idea

onyx fjord
#

what rank

#

what is a rank

#

and what is in player

upper hazel
#

rank is displayName

#

player well... is player

#

i want check displayName

#

exists rank or not

glad prawn
#

then split 💀

upper hazel
#

all rank plugins check so?

#

or create "group"

#

i use data file end display Name for interact with rank

#

but this bad idea maybe?

keen basin
remote swallow
upper hazel
#

When I give a rank to a player I just update his name and write the data to the data file - this is the essence of the rank but as I understand the others use groups to interact with ranks

kindred sentinel
#

I'm trying to make something like buttons, but i have some problems

     TextComponent withSign = new TextComponent("§7[§2X§7]");
                        TextComponent withoutSign = new TextComponent("§7[§4X§7]");
                        TextComponent space = new TextComponent("                     ");
                        withSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithSign));
                        withSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake sign"));
                        withoutSign.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverWithoutSign));
                        withoutSign.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/pagetake no-sign"));
                        ComponentBuilder result = new ComponentBuilder();
                        result.append(withSign);
                        result.append(space);
                        result.append(withoutSign);
                        result.append("\n");
                        result.append(page);
                        newBookmeta.spigot().addPage(result.create());

but space and "page" extend click and hover events from withSign and withoutSign

lost matrix
remote swallow
#

easier to just use luckperms and their api and or vault api

keen basin
upper hazel
#

But can such a problem arise - the visual part of the rank in the player’s name differs from the real one, how can I check this?

remote swallow
#

you shouldnt add the rank to the players display name

#

use placeholder api or a method for internal messages

upper hazel
remote swallow
#

no

upper hazel
#

this add text in displayName too

remote swallow
#

for me you would make my display name RANK The__Epic, while you shoulnt ever be adding the rank to display name you should create the string as needed to not break most plugins that are expecting it to be a string with no spaces in it

upper hazel
#

wait you mean player.getDIsplayName shold be contains playerName no another text?

remote swallow
#

it should be the playername or a custom name you have applied, you can use it for other stuff if you know it will not break anything else

upper hazel
#

other plugin use player.getName no?

remote swallow
#

not all

#

some may use getDisplayName

upper hazel
#

then how add visual

remote swallow
#

placeholder api or an internal method

upper hazel
remote swallow
# upper hazel "internal method" what you mean

a method inside your plugin that will either return the rank displayname/prefix for a specifed player or something to generate the name string that would then include the rank displayname/prefix

#

dont call updateInventory, its only for if the inventory is desynced

lost matrix
upper hazel
remote swallow
#

yes there is

#

you create an internal expansion and return the rank from offline player

lost matrix
#

No, there is a different method for that

remote swallow
upper hazel
#

then you will still have to change the player’s displayName because there is no other way to display the rank" - sorry but i dont undestand wdym

remote swallow
#

no you wont

#

its like using luckperms

#

they dont modify the display name, plugins hook into luckperms api and provide a placeholder that they will then convert

#

or they support placeholder api, which luckperms can then convert to the rank string

remote swallow
#

your rank plugin should store the uuid to rank identifier in some form of storage, even if its pdc you can still use that to not add it to the display name and let end user decide where they want the rank. Because most people dont want the rank of the player in a tp request for example

upper hazel
remote swallow
#

no it uses a database, it loads the data on player join

#

then uses either a hashmap, a caching lib or even its own caching

upper hazel
remote swallow
#

what

#

it doesnt directly add it to the name because there is a load of different things it could add

#

and it wont hard code it

upper hazel
#

hmm ok

#

i need check it

tender shard
#

yes, it's just a "wrapper" for the actual specialsource tool

#

so basically the most official way of remapping you can get for spigot in gradle lol

eternal night
#

👍 just saw you use it and my brain needed a bit to find the repo

odd pier
#

where spigot javadoc

remote swallow
#

?jd-s

undone axleBOT
odd pier
#

why cannot change nickname??

remote swallow
#

because your nickname wouldbe ur spigot name if you verify

odd pier
#

i want to set like 'ditto (ping me on reply)'

remote swallow
#

you cant

odd pier
#

:/

glad prawn
#

can we use that for displayName

odd pier
#

but if i set my displayName to ditto (ping on reply), then all server's nickname changed

thin iris
#

how do i make my player sit down? like the actual sit pose

jagged thicket
#

so to disable pvp for a "team" should i use hit listener

#

or is there anything else

kindred sentinel
#

pleeeaaase

quaint mantle
jagged thicket
quaint mantle
#

Or minecart

smoky oak
#

its probs the playerinteractevent

quaint mantle
onyx fjord
#

is it possible to generate always the same uuid based on some criteria?

#

like some numbers (seed) or string?

quaint mantle
#

I was only able to do it with the EntityDamageByEntityEvent

quaint mantle
#

Can't you just store it?

smoky oak
#

huh i thought getClass acts like Enum

glad prawn
#

nah

onyx fjord
#

basically random, but with expected value based on X

trim elk
#

guys, why not work? ``` listOf(
BlockEvent(),
DropEvent(),
InteractAdminEvent(),
JoinAndQuitEvent()
).forEach {
PluginBase.instance.server.pluginManager.registerEvents(it, PluginBase.instance)
}

quaint mantle
trim elk
#

In this case, it's not registering the events

quaint mantle
trim elk
#

no

#

there is no error in the console

quaint mantle
#

Okay. You need to create a new instance from these.

#

From every listener.

#

new BlockEvent() etc.

trim elk
#

So, but I'm doing it in kotlin, so it's already instantiated

glossy venture
#

or BlockEventListener

#

anyways are you sure the code runs?

trim elk
#

Yes, before I was using KOIN, but I saw that it wouldn't be good to use KOIN, so I took it out and instantiated it the normal way, but it doesn't work lol

lost matrix
thin iris
#

im trying to make a thing that lets a player sit like in gsit but i cant figure out how to do that

lost matrix
thin iris
#

is that what they did in gsit

lost matrix
#

Probably

trim elk
#

[10:34:42 INFO]: com.choice.admin.view.event.BlockEvent@2a565388 -> Instance
[10:34:42 INFO]: com.choice.admin.view.event.BlockEvent -> Class name
[10:34:42 INFO]: com.choice.admin.view.event.DropEvent@1e5875f1
[10:34:42 INFO]: com.choice.admin.view.event.DropEvent
[10:34:42 INFO]: com.choice.admin.view.event.InteractAdminEvent@5deb3791
[10:34:42 INFO]: com.choice.admin.view.event.InteractAdminEvent
[10:34:42 INFO]: com.choice.admin.view.event.JoinAndQuitEvent@20b74f47
[10:34:42 INFO]: com.choice.admin.view.event.JoinAndQuitEvent

trim elk
#

now my problem is, I'm instantiating the events in the normal way, but for some reason the events aren't working

lost matrix
#

What do you mean by that?

#

Show one of your Listener classes

trim elk
#

I put a logger in the forEach of the events, to find out what's going on there and it looks like it's being instantiated.

opal juniper
#

?paste one of the listener classes please

undone axleBOT
trim elk
#

class JoinAndQuitEvent : Listener {

private val admin by lazy {
    AdminManager.instance()
}
private val adminEvent by lazy { AdminEventManager.instance() }

@EventHandler(priority = EventPriority.HIGHEST)
fun joinEvent(event: PlayerJoinEvent){

    val player = event.player

    adminEvent.hideForNewPlayers(player)

    admin.removeAdminMode(player)
}
lost matrix
trim elk
#

no exceptions

lost matrix
#

Did you make sure the events are fired? log msg

smoky oak
#

Does PlayerItemHeldEvent have a simple way to obtain the previous and current item, similar to PlayerSwapHandItemsEvent? I can only find the slot ID

lost matrix
smoky oak
#

i always feel iffy using inventory.getbyslot

#

cuz it always changes

#

like do i add 36 or not

#

bleh

lost matrix
ancient plank
#

huh

lost matrix
#

I cant figure out what you are trying to tell me

smoky oak
#

that i do not like using the raw slot IDs because i still do not know off the top of my head how inventories are structured

#

im fairly sure that without inventory view its hotbar, then the other three rows top to bottom, then armor, crafting, crafting result, offhand

lost matrix
#

Ah, i never had to add "36" to any slot, ever

smoky oak
#

but im not sure

lost matrix
#

But in this case you dont have to worry where the items are because you just have two unknown slots 👍

smoky oak
#

yea

#

want to delete temporary items if focus is lost on them

#

unfortunately there's no uniform itemFocusChangeEvent

#

leading to this monstrosity

#

?paste

undone axleBOT
smoky oak
#

the 'change' method in the abstract class is my focus point for that event

#

leads to some 'if event instanceof PlayerItemSwitchEvent' but at least ist ONE access point

lost matrix
#

What is focus? Thats not a concept im familiar with in the minecraft context.

smoky oak
#

like

#

if the item held changes in any way

#

stupidly enough ItemHeldEvent does not account for all those possible changes

#

hence the mess above

lost matrix
#

Why do you pass an generic Event to your change method?
I wouldnt do that. This just leads to a bunch of instanceof entanglement... Super dirty

smoky oak
#

again the idea was to have one singular access point

#

i know its not the best solution but its good enough

lost matrix
#

Its too generic. Specialize it more.

smoky oak
#

cant

ancient plank
#

can(t)

smoky oak
#

the only common superclass(interface) of those events is Event

lost matrix
#

Why do you need to pass an event in the first place?

smoky oak
#

to remove a item that's tagged as temporary, if it gets removed from the main hand

#

again no uniform event exists for that

#

for SOME reason

lost matrix
#

How about you pass the items or slots to your change method?

smoky oak
#

that might work, i still need to pass the event itself thorugh

#

cuz in other cases i might need to cancel it

#

this is just my current problem

lost matrix
#

Let the method return a boolean and cancel the event in the listener

#
if(change(player, items, etc)) {
  event.setChancelled(true);
}
#

Or create an enum if you need a more granular result:

if(change(player, items, etc) == ItemFocusChangeResult.SWAP) {
  event.setChancelled(true);
}
trim elk
smoky oak
#

yea i can see how that would work. Should i make one change method with all args, or multiple if i only need specific arguments rarely?

#

probably one large method

lost matrix
# smoky oak probably one large method

You can create overloads if your change method with default values:

public boolean change(@NotNull Player player, @Nullable ItemStack previous, @NotNull ItemStack next) {

}

public boolean change(@NotNull Player player, @NotNull ItemStack next) {
  return this.change(player, null, next);
}
smoky oak
#

ah i meant that in the class with all the listeners, i would probably call multiple methods

ancient plank
#

I criminally underuse method overloading

smoky oak
#

like if i do multiple methods with signatures, i need to call the one with all args, in that the one with less args etc

lost matrix
ancient plank
#

I always forget it exists

lost matrix
#

Anyways i cant skip leg day again PES_Cry gtg

smoky oak
#

k

trim elk
#

the events are ok, what is not ok is not my class manager, strange, thanks guys

ancient plank
#

oh I miraculously don't have any methods that need it

upper hazel
#

customModelData exists in entity?

remote swallow
#

no its for item

upper hazel
#

armorStand

remote swallow
#

no

#

still just for items

upper hazel
#

but for npc model exists

remote swallow
#

because its items scaled?

upper hazel
#

what

remote swallow
#

its an item display that is transformed to be huge

upper hazel
#

lol

#

but armorstand has display too

remote swallow
#

it has a hand

#

that can hold items that have large models

#

it also has a head

upper hazel
#

I mean, somehow changing the name of an object can change the model.

remote swallow
#

yeah

upper hazel
#

bruh how

remote swallow
#

resource pack

upper hazel
#

i need use customModelData?

remote swallow
#

to change by name? no

upper hazel
#

no i mean customModelData load model too no?

remote swallow
#

Basically, a tutorial where Minecraft player/pack maker ShadowStrength teaches you how to rename items to change their models or textures depending on their name
This requires Optifine or the Optifabric mod to make, or else it MIGHT not work
I believe you replace the Optifine folder with Mcpatcher if you're doing earlier versions
If you have any...

▶ Play video
upper hazel
#

thenks

onyx fjord
upper hazel
remote swallow
#

correct

#

thats why you use custom model data

upper hazel
#

3d model can be load?

remote swallow
#

what

upper hazel
#
DMC

Ссылка на сервер - https://taplink.cc/denophine.jar

IP: dmc-minecraft.ru

Наш магазин ключей - https://t.me/dmc_store

Ищешь хороший хостинг? Мы пользуемся этим - https://my.pterohost.com/aff.php?aff=33

  • Это шуточное видео и им мы не хотели кого-либо обидеть или оскорбить
▶ Play video
hushed spindle
remote swallow
hushed spindle
#

how can a property change without it being interacted with

upper hazel
remote swallow
#

there are

upper hazel
#

how is name

remote swallow
#

learn to use blockbench and then just lookup any custom model data tutorial

upper hazel
#

oh ok

#

and it’s difficult to make such a plugin like in this video, how many days will it take?

remote swallow
#

at your current stage that plugin would take you months to make

remote swallow
#

i do

upper hazel
#

I just haven't worked much with textures

remote swallow
#

because you have to decode the data and convert it to the custom model data, and you have to deal with vectors and movement

upper hazel
#

well i will just use api

#

just tell me how long it takes on average

remote swallow
#

for you to make it from scratch it would take multiple months, if i was to do it it wouldnt take half as long because i have practise with a lot of the concept and i wouldnt be learning java along with making it

hushed spindle
#

wait is the question if its possible to turn items into 3d models

#

because that answer is yes, easily

remote swallow
#

probably only 1

#

or even less if i didnt get side tracked

hushed spindle
#

if your goal is to make custom mobs just use conxept model engine

upper hazel
#

I thought it was just loading the armor stand model

remote swallow
#

the video you sent wouldnt be

#

because you can move it and position it, which would require a lot of teleporation and transformations

upper hazel
#

i se

#

cities support models for npc?

#

plugin

tender shard
#

what

upper hazel
#

Citzens

sage patio
#

i'm loggin items into discord like this

#

but only move and pickup works, place doesn't

#

any idea why?

hushed spindle
#

placing items is more prone to cause InventoryDragEvents over InventoryClickEvents

#

if you move your mouse even a little bit while placing the item, it's a drag event

#

even if only 1 slot is affected

sage patio
#

thanks. lemme try with other events

#

still nothing

hushed spindle
#

show

sage patio
hushed spindle
#

oh

#

your click event isnt going because you're returning if the clicked item is null

#

that means if you're dropping an item, for which the clicked item has to be null, your logging stuff doesnt run

sage patio
#

ow

#

so what should i do to prevent null errors in this case

hushed spindle
#

check if clicked item is null and if so take the cursor instead

#

if the cursor is also null you can return

sage patio
#

so a && null check should be fine right?

hushed spindle
#

and by the way, you should make a method checking if an item is null or air because this is sometimes different depending on server type

#

i believe spigot uses AIR for empty slots sometimes instead of null

sage patio
#

yes

hushed spindle
#

and you should make an itemstack variable for the item in question

#

ItemStack item = e.getCurrentItem();
if (item is null or air) item = e.getCursor();
if (item is null or air) return;

#

something like that

#

you can make it more compact if you want but eh

sage patio
#

yea thanks

hushed spindle
#

seriously though does anyone maybe have a clue on what i could be doing wrong

#

i just dont understand how the wrapper variable could have this property change when it's not being interacted with

#

at least not in a way that i understand

#

making a clone of it worked though i still have no idea where it got that edit

eternal oxide
#

check your getCharges() code

hushed spindle
#

its just a simple getter

#

and the getStoredEffects() method only fetches newly created wrappers from metadata so it shouldnt be getting any updates from there

eternal oxide
#

just a getter? no other code in there at all?

hushed spindle
#

nope

#

literally just a getter lol

#

charges is just an integer property and all this bit of code is meant to do is
get wrapper from persisted data
reduce charges by 1 on potion effect wrapper
update changes on persisted data

eternal oxide
#

why are you storing it anywhere else than the PDC?

hushed spindle
#

wdym?

#

it's not being stored in the wrapper, thats just a data object

eternal oxide
#

ok

hushed spindle
#

i get the wrappers from the persisted data, i change the properties of those wrappers, then those wrappers are persisted back on the item

eternal oxide
#

its increasing in your sysout so somewhere you must be increasing/decreasing the value

hushed spindle
#

i should mention this output implies the change didnt reflect at all, the code is meant to decrease charges by 1 so it went from 8 to 7 in the method before

#

by the end of this method the amount of charges is 7 like expected

#

so its weird why it jumps back to 8 in setStoredEffect

#

the whole wrapper copy stuff fixed it, i guess

lilac dagger
#

you're making a copy

hushed spindle
#

even though that should be unnecessary

lilac dagger
#

i don't know if the copy operates on your item meta anymore

hushed spindle
#

because getStoredEffect already makes copies of those wrappers

eternal oxide
#

what does .copy() do? as it's not clone

hushed spindle
#

it only reads data

#

its basically just clone

#

just done manually

eternal oxide
#

why?

hushed spindle
#

because i dont understand or wanna deal with clonenotsupportedexceptions lol

eternal oxide
#

you shoudl not be cloning at all

#

theres no need for clone nor copy

hushed spindle
#

well yeah i shouldnt need to here

#

but for some reason doing that "fixed" the issue

#

i know its just a bandaid but still

#

why's clone/copy bad though

eternal oxide
#

because you have no need to operate on a copy.

#

metadata is always a clone so you cloning your data is already a copy

hushed spindle
#

oh like that, no no

#

im reading/writing on one metadata here

#

the metadata is placed back on the item once all those edits are done

quasi berry
#

Is there any real negative to using PlayerChatEvent as opposed to AsyncPlayerChatEvent? I need synchronicity to run an InventoryOpenEvent

hushed spindle
#

my plugin does a lot of individual item edits so this is done to reduce on the amount of getItemMeta() calls

eternal oxide
#

yes it's put back, but metadata is always a clone so you shoudl not be .copy() your own data, just work with the object you have and ALWAYS put the meta back

hushed spindle
#

i dont really understand your point

#

im confused because copying this property fixed the issue

eternal oxide
#

its not a fix, its a hack

hushed spindle
#

even though the fetched wrappers from the item's meta are already copies of their own

#

i know thats why i called it a bandaid lol

eternal oxide
#

then remove it and find where the real issue is

#

somewhere you are not putting the meta back before you get a new copy

hushed spindle
#

im... im asking for second opinions here

#

im not saying my "solution" was a good one

#

just to have extra thoughts on where the issue might be lying

eternal oxide
#

we've not seen enough code to tell you what the fix is. we can only tell you what is not a fix

granite olive
#

what did you mean by this? I'm not sure what I could set to empty

eternal oxide
#

In your first section of code you pass both the meta and a wrapper. MY guess is your getStoredEffects is changing your wrapper reference

#

meta contains the unmodified value

#

your wrapper contains teh modified value

#

your first sysout displays 7 from yoru wrapper

#

you call getStoredEffects on the meta (NOT wrapper) and then wrapper is 8, so somewhere in your getStoredEffects you are altering the wrapper from the meta

chrome beacon
hushed spindle
#

turns out i was wrong when i said it was making copies of the effect when this data is fetched from the meta, so all these property edits were done on the registered effects rather than the copies

#

i am a fool and a fraud

wary remnant
#

i am more confused about your pfp

hushed spindle
#

ignore it if you value not being pea'd on

wary remnant
peak jetty
#

why am i getting this error?

[17:45:43 ERROR]: Error occurred while enabling BowDuel v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.gizmo0o.bowduel.BowDuel.getCommand(String)" is null
        at me.gizmo0o.bowduel.BowDuel.onEnable(BowDuel.java:11) ~[BowDuel-1.0.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-193]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-193]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:640) ~[paper-1.20.1.jar:git-Paper-193]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:551) ~[paper-1.20.1.jar:git-Paper-193]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.20.1.jar:git-Paper-193]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.20.1.jar:git-Paper-193]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-193]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.20.1.jar:git-Paper-193]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-193]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
eternal oxide
#

no command in plugin.yml

peak jetty
#

why is this not working?

    public void onPlayerDeath(PlayerDeathEvent e) {
        if(e.getEntityType().equals(EntityType.PLAYER)) {
            Location hubLoc = new Location(e.getEntity().getPlayer().getWorld(), 20, 200,10);
            // Winner
            Player winner = e.getEntity().getKiller().getPlayer();
            winner.getInventory().clear();
            winner.setHealth(20);
            winner.teleport(hubLoc);
            winner.sendTitle("You won!", "GGs", 1, 1, 1);
            // Looser
            Player looser = e.getEntity().getPlayer();
            looser.sendTitle("You lost!", "GGs", 1, 1, 1);
            // Queuing system
            first = false;
            second = false;
        }
    }
eternal oxide
#

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

peak jetty
grave plover
#

and put an @EventHandler annotation above it

subtle folio
#

how come i’m unable to set a variable in class from a different maven module

peak jetty
#

why is one of my lines like this?

eternal oxide
#

just a comment, onlinePlayers is never going to equal 0

peak jetty
#

i thought that would be when no players are connected to the server..

eternal oxide
#

0 is a primitive value where onlinePlayers is a Collection of Players

peak jetty
#

ohh

eternal oxide
#

try .size()

peak jetty
#

ok

eternal oxide
#

or isEmpty()

signal kettle
#

How do I get rotation of entity?

peak jetty
wary remnant
#

you should also explicitly specify the generic type when introducing the variable

river oracle
#

I don't think that would work anyways. Isn't the player still technically online during PlayerQuitEvent

eternal oxide
#

yep

river oracle
#

so you'd want to do onlinePlayers.size() <= 1

remote swallow
lost matrix
subtle folio
#

im trying to mess around with mutli maven module projects, how do I share variables like Function<> throughout another module?

lilac dagger
#

create another module

lost matrix
lilac dagger
#

that holds the interfaces

peak jetty
#

how do i get the player?

lilac dagger
#

or if you can do that ^^

thin iris
#

i did some math to make a small circle at the players chest, i want to like move it up gradually to be like a halo so it goes from the chest to above the head in an amount of seconds, how can i do that? java Location loc = player.getEyeLocation().subtract(0, 0.3, 0); for (double i = 0; i <= Math.PI * 2; i += Math.PI / 5) { double x = Math.cos(i) * haloRadius; double z = Math.sin(i) * haloRadius; loc.add(x, 0, z); player.getWorld().spawnParticle(Particle.REDSTONE, loc, 1, new Particle.DustOptions(org.bukkit.Color.fromRGB(214, 180, 252), 1)); loc.subtract(x, 0, z); }

subtle folio
#

I tried getting the instance of the other plugin via getPlugin() but that's returning a cast exception

subtle folio
lost matrix
subtle folio
#

lemme share some code

lost matrix
peak jetty
#

oh

thin iris
#

if engetentity(getshotore isntatnoef palyer

#

oops

lost matrix
# peak jetty like this?

And pls cache your variables:

ProjectileSource source = event.getEntity().getShooter();

if(...) {
  Player shooter = (Player) source;
}
lilac dagger
#

type matching is even better if you can do java 17

lost matrix
#

*pattern

lilac dagger
#

that

subtle folio
#

I have two classes that are actually important, the FartManager and joinEvent, fart manager just has the variable, and JoinEvent uses the variable. ```java
@EventHandler
public void onJoin(PlayerJoinEvent p_playerJoinEvent) {
Bukkit.getLogger().info("Player joined");

    if (FartManager.getMfw() != null) {
        Bukkit.getLogger().info(FartManager.getMfw().apply(p_playerJoinEvent.getPlayer().getName()));
    }
}```

The event fires, but when I set said variable in the core's onEnable, the variable is still null. ```java
@Override
public void onEnable() {
// Plugin startup logic
FartManager.setMfw(p_s -> "DUDDE, " + p_s + " farted");
}

lilac dagger
#

interesting plugin idea

subtle folio
#

im just trna learn maven modules

subtle folio
#

im pulling words outta my ass

lilac dagger
#

literally

lost matrix
lost matrix
subtle folio
lost matrix
#

Then make sure you dont shade one plugin into another.

#

<scope>provided</scope>

subtle folio
#

Oh is that what im doing?

remote swallow
#

kek

subtle folio
#

its always that

#

i knew that

#

i remember already having this same problem with that solutino

#

UGHUEHGUAEH

lost matrix
#

Your problem kind of smelled like that.

subtle folio
#

pun intended

lost matrix
#

lol no

#

XD

subtle folio
#

and that fixed it

lost matrix
#

It just reminded me of the classic ProtocolLib problem where the static getter of ProtocolManager returns null.
Happens if ppl shade ProtocolLib.

thin iris
#

i figured it out

echo basalt
#

well shit I'm late

thin iris
#

it's ok

thin iris
echo basalt
#

sure whatever go for it

thin iris
#

im not selling the code or anything its just for fun

#

ok thank u ❤️

echo basalt
#

I feel off not having a pic of myself as my pfp

#

I'm surrounded by ppl with their selfies

lost matrix
echo basalt
#

lmfao

#

2$

river oracle
agile edge
#

how to add code here

echo basalt
#

anime pfp woeisme

#

?code

#

bruh

river oracle
echo basalt
#

?paste

undone axleBOT
lost matrix
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
echo basalt
river oracle
#

ik

echo basalt
thin iris
undone axleBOT
river oracle
echo basalt
#

joe

agile edge
#
public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
#

looks good

echo basalt
lost matrix
echo basalt
#

5$

agile edge
#

min 19.99$

echo basalt
#

I do

#

it's just that I have a template for those

agile edge
#

justified

lethal python
#

is there an event for when a hopper checks if the block above it contains an inventory (if that's how hoppers work)? i want to make a custom block which hoppers can take items out of

#

i can't find one, only the inventorymoveitemevent

lost matrix
agile edge
#

central asia

lost matrix
#

Thats rare

echo basalt
#

7smile7 about to start flexing his 2 words he learned in uni

agile edge
#

at current time im in almat

#

y

lost matrix
#

Was just seeing your flag ^^

lilac dagger
#

marhaba

echo basalt
#

if it makes you happy I'm portuguese originally from moldova thumbsup

agile edge
echo basalt
lethal python
#

:O IT EXISTS???

#

this is going to make my life so easy

lethal python
#

thank you 7smile7

echo basalt
#

sure

tranquil beacon
echo basalt
#

same way moldova is just romania

agile edge
#

and ukraine

#

u are in moldova now?

echo basalt
#

nope, portugal

#

Might visit moldova one day

#

it was a shithole last time I was there

lost matrix
#

I would wait a bit with that. A bit close to a certain conflict right now.

agile edge
lost matrix
#

Gosh, shouldnt think about that. Makes me sad and mad already...

echo basalt
#

uhh

#

it's fine p sure that ukraine is still safe down here

agile edge
#

for that reason

lost matrix
echo basalt
#

¯_(ツ)_/¯

#

it's a tiny village in the middle of nowhere

#

no wifi, no roads

#

nothing to bomb

lost matrix
#

Sounds like a perfect location for them. Civilians are the prime target it seems.

echo basalt
#

each bomb costs more than the whole net worth of the village