#help-development

1 messages · Page 1808 of 1

spiral light
#

out of PlayerConnection

#

right side is obfuscated (like spigot runs the server)

ember estuary
#

where do u get that from

#

but yeah, its a

spiral light
#

from me

ember estuary
#

oh

ivory sleet
#

there's something called minimappings viewer you could use alternatively

spiral light
ivory sleet
#

havent experienced that but probably true

quaint mantle
#

Since there's no runtime mappings anymore i highly doubt it

ivory sleet
#

idk how much love it has as of now so yeah

spiral light
ivory sleet
#

because its name is CompoundTag tho

quaint mantle
spiral light
#

yeah but spigot is NBTTagCompound ... so if you want to translate from spigot back to mojang it will not find this

peak granite
#

how do i print a hashset without []

quaint mantle
#

String.join

peak granite
#

o

vital lotus
#

I just see in the bukkit player class there's sendEquipmentChange,hideEntity,showEntity method. But when I try to use that, the method doesn't exist? (I did try to remove my maven cache)
Sorry for asking twice, because it got buried away 😅

ivory sleet
vital lotus
spiral light
vital lotus
#

👀 Ah flip. Okay thanks

quaint mantle
#

wow equipment change is cool

spiral light
ivory sleet
#

yue

ember estuary
#

@ivory sleet in 1.17 its called sendPacket and in 1.18 its a. What to do about that? Use your filter thing to find the method? any better way?

spiral light
#

i think the filter method should work for every? version ....

ember estuary
#

yeah should

#

but im just wondering if thats overkill

#

if theres an easier way

#

but ill just use that i guess

spiral light
#

once you found the method you could safe it .... so just 1 search after reload ... safes some time

ember estuary
#

type is Method i assume?

spiral light
#

seperate classes for each version ... but the filter is good enought

ember estuary
#

Method savedMethod = ...;

#

ill try it

spiral light
#

smth like this yeah

vital lotus
peak depot
#

how to get the spigot 1.18 api without buildtools

ivory sleet
ivory sleet
peak granite
#

how would i make it so if the list is 2 it does

value1 and value2

if it's 3 it does: value1, value2, and value3

current code: String.join("&f, ", list)

spiral light
vital lotus
spiral light
peak granite
#

join has "and"

#

?

#

by default?

wide galleon
#

How would I do FileUtils.deleteDirectory(world); in 1.18?

#

because I cant import it

ivory sleet
#

it was an apache util

#

which is yeeted now

spiral light
ivory sleet
#

though it wouldn't be too hard recreating that dxkyy

#

just recursively delete all files in all directories

wide galleon
#

how would I do that?😅

spiral light
#

create a method that lists all files and deletes the file if empty or call the method again

ember estuary
#

i went with the filter, as that should work in every new version too, unless they completely change the method.

    public static void sendPacket(Player player, Packet<?> packet) {
        try {
            Object handle = player.getClass().getMethod("getHandle").invoke(player);
            Object playerConnection = handle.getClass().getField("b").get(handle);
            Method sendPacket = Arrays.stream(playerConnection.getClass().getDeclaredMethods()).filter(m -> m.getReturnType() == void.class && m.getParameterTypes().length == 1 && m.getParameterTypes()[0] == Packet.class).findFirst().orElse(null);
            if (sendPacket != null) sendPacket.invoke(playerConnection, packet);
        } catch (IllegalAccessException | InvocationTargetException | NoSuchFieldException | NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

Works on 1.17.1 and 1.18.
For everyone who needs a cross-version sendPacket function, feel free to use.

Anything i could improve?

peak depot
#

can someone pls send me the 1.18 spigot api dm?

spiral light
peak depot
#

I wont compile the jar

ivory sleet
#

Check what version then just get the method directly

eternal oxide
ember estuary
#

wait theres a way?

I thought u meant like if version == 1.17 : sendPacket = a; else if version == 1.18 : sendPacket = b

peak depot
ember estuary
#

what do u mean by get it directly depending on version?

eternal oxide
peak depot
quaint mantle
eternal oxide
ember estuary
#

wym modules

quaint mantle
#

Make an Impl for every version, without reflection

ember estuary
#

nah that sucks, then i have to update my plugin every version

#

xD

quaint mantle
#

But you'd have to do the same with reflection..

ember estuary
#

no?

#

my plugin now works fine for 1.17.1 and 1.18

#

same jar

#

thats what the reflection is for in the first place

peak depot
#

?paste

undone axleBOT
quaint mantle
#

no thats not what the reflection is for

ember estuary
#

wym

digital rain
#

whats the error here?

golden turret
#

line 19

#

you welcome

digital rain
#

yes what exactly

spiral light
#

maybe Main.plugin = null ?

#

what is line 19 ?

tardy delta
#

line 19 on that screen is }

digital rain
#

yes thats the line

peak depot
#

@eternal oxide ?

tardy delta
#

why Main.instance and Main.plugin

ivory sleet
#

BiConsumer<Object,Object> packetSender;
switch (Bukkit.getVersion()) {
case "1.18":
packetSender = new BiConsumer<Object,Object>() {
Method method;
{
try{
method = /get method with refl/
catch(ReflectiveOperationException e){
//handle
}
}
@Override public void accept(Object o0, Object o1) {
method.invoke(o0,o1); //try catch same exception
}
};
}
Smtng like that (then o0 would be the connection, and o1 the packet)

#

And then you’d instantiate a slight different consumer for 1.17

#

Where the way of getting the method might be different or such

eternal oxide
quaint mantle
#

🙄

ember estuary
#

i see

digital rain
#

ok yeah right hat

#

thanks

peak depot
digital rain
#

im blind sometimes

eternal oxide
quaint mantle
#

Dont you have to update plugin every version aswell in this case

ivory sleet
#

But yeah a polymorphistic design with version per module is probably cleaner as you get the help from the compiler and such

ember estuary
#

Are there any advantages of this, compared to using a filter

quaint mantle
#

The best way is just not using nms smh

ember estuary
#

spigot is Suuuuper limited

ivory sleet
#

You cache the method, and then invoke it

ember estuary
#

no way to not use nms sometimes

quaint mantle
#

0aper

ember estuary
#

is limited too

ivory sleet
#

So advantageous is that it’s probably a bit faster

ember estuary
#

true

quaint mantle
#

Why so you need packets

ember estuary
#

relative teleporting,
20 fps maps

eternal oxide
ember estuary
#

relative teleporting was even proposed and has like 20 likes, but md_5 was just like "nah, dont need that, dont see the point"

quaint mantle
#

what does relative teleporting mean

ember estuary
#

teleporting without loosing velocity

eternal oxide
ember estuary
#

no way to do that without packets

peak depot
ember estuary
#

unless u set the velocity back one tick later (cant set it back in the same tick, idk why). but that wont work in a 1-tick repeating task scheduler

eternal oxide
peak depot
eternal oxide
#

C:\Users\Philipp\.m2\repository\net\md-5

#

yes you do

peak depot
#

well now it finds it I only have scriptus 0.4.1

eternal oxide
#

delete teh scriptus folder adn rerun buildtools

peak depot
#

it recreates the 0,4,1

eternal oxide
#

yes it will

#

its supposed to

peak depot
#

and its still the same error

eternal oxide
#

exactly the same? scriptus pom?

peak depot
#

yes

ember estuary
peak depot
#

@eternal oxide can you just send me the jar file?

peak granite
#

if i do config.set("Balance", 0) is it in memory until i do config.save

quaint mantle
#

yez

eternal oxide
peak granite
#

and how would i get the value from memory?

eternal oxide
#

the api is in the spigot repository

ember estuary
#

by loading the config and using .get ?

eternal oxide
#

won't work?

tardy delta
#

config.getInt()

quaint mantle
peak granite
peak depot
ember estuary
quaint mantle
#

If spigot doesnt accept the pull request, paper is way to go

tardy delta
#

in a map

quaint mantle
#

(secret)

ember estuary
#

cant use paper if u want ur plugin to work on spigot

peak granite
#

YamlConfiguration config = YamlConfiguration.loadConfiguration(file);

ember estuary
#

why is spigot even a thing, like why not team up with paper and make it one?

ivory sleet
#

It’s quite complicated

tardy delta
#

i'm sure it's cached, i was getting values from config when i wasnt able to save and there was nothing in the file

peak depot
#

@eternal oxide pls send it

ember estuary
#

is there anything that spigot does better than paper?

eternal oxide
ember estuary
#

cuz thats like the only downsite i know about paper

#

breaks redstone filters n stuff

#

oh wait, ill better ask this in general

#

isnt rlly development related

quaint mantle
#

or idk how to call it

open lily
#

Does anyone here has experience with proguard obfuscation? I'm getting lots of errors like

Warning: proguard.gradle.ProGuardTask: can't find superclass or interface org.gradle.api.DefaultTask
Warning: proguard.gradle.plugin.ProGuardPlugin: can't find superclass or interface org.gradle.api.Plugin
Warning: proguard.gradle.plugin.android.AndroidPlugin: can't find superclass or interface org.gradle.api.Plugin
``` and 416 more...
Seems like proguard is trying to obfuscate itself
ember estuary
#

the bigger amount of plugins?

eternal oxide
peak depot
quaint mantle
peak granite
#

i have this:

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        File file = new File(Nucleus.instance.getDataFolder() + File.separator + "playerdata" + File.separator + sender.getName().toLowerCase() + ".yml");
        YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
        config.set("Balance", 500);
        System.out.println(config.get("Balance"));
        return true;
    }```

prints 500, but when i do /bal it doesn't show the same value
ember estuary
tardy delta
#

save it

peak granite
#

ik

tardy delta
#

config.save(configfile)

peak granite
#

it's in memory

#

i want to save it when they leave

tardy delta
#

what when a crash happens?

peak granite
#

saving it on world save

quaint mantle
#

paper is developing their own plugin repository but that would take time to make it popular

spiral light
peak granite
#

then how do i get it

#

from memory

ember estuary
#

use the same config variable

#

i guess?

spiral light
#

just safe it

tardy delta
#

yes

spiral light
peak granite
#

for each player?

tardy delta
#

saving it isnt that hard

ember estuary
#

u could make a HashMap<Player, YamlConfiguration>

ember estuary
spiral light
peak granite
#

no

ember estuary
#

i know a server that saves stuff on command, and by spamming the command with 10 accounts 20 times per sec u can actually crash the server

#

so not a good idea to save on command i guess

vague mason
#

How can I get getAttachedFace() from a sign?

spiral light
ember estuary
tardy delta
#

dont save on command

#

save it when you actually need to save something

eternal oxide
#

save async

tardy delta
#

why that?

ember estuary
tardy delta
#

just dont call it will plenty people

ember estuary
#

idk, i always crashed it for fun

tardy delta
#

lol

spiral light
ember estuary
#

isnt it a simple pointer under the hood??

atomic violet
#

is there a way i can make a race track and code it so i can see where players are on that track, and how many blocks ahead of someone they are?

pastel arrow
#

how can i get the player that shot / threw a projectile?

ember estuary
#

when doing a hashmap it just gets the player and hashes the object, i dont get ur memory point

eternal oxide
#

Players are kept in a WeakHashMap. If you keep a reference to a Player object you will prevent it being GC'd when its due.

spiral light
ember estuary
#

but where or why would you keep a reference after the player leaves

pastel arrow
spiral light
#

projectile.getShooter() ?

eternal oxide
ember estuary
#

hmm alright xD

#

but spigot doesnt keep a reference, right?

#

would have to be an error by myself right

spiral light
#

uuid is safer ^^

eternal oxide
#

^

ember estuary
#

alright

atomic violet
spiral light
tardy delta
#

kinda cringe that i can remove a list of vanished uuids in config and just store the state in the player itself

hexed hatch
spiral light
pastel arrow
vague mason
#

Why is org.bukkit.material.Sign deprecated?

eternal oxide
#

it tells you in the javadoc

#
all usage of MaterialData is deprecated and subject to removal. Use BlockData.
atomic violet
eternal oxide
#

you can spawn particles is all

crimson terrace
atomic violet
#

i mean not a visible line, i mean an imaginary line that i can track in code

crimson terrace
#

you mean a vector?

atomic violet
#

i’m new to coding so idk what that is

#

is that what i would use?

#

i can look into it if so

crimson terrace
#

vector is something to do with math

chrome beacon
#

Vector is a thing you might learn in math too

atomic violet
#

ohh

#

my b, not in a good math class either XDD

crimson terrace
#

basically a defined direction without a starting point

atomic violet
#

so i can use that to calculate block distance?

#

to the end?

crimson terrace
#

ok do you need distance or a line that points towards the end

vague mason
peak depot
#

java.lang.RuntimeException: Error running command, return status !=0: [C:\Windows\system32\cmd.exe, /D, /C, C:\Users\Philipp\Desktop\DEV\BT\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=3353, clean, install] any ideas for solution?

atomic violet
#

a distance but i can prolly compare the distance each player is to the end and place them that way

crimson terrace
#

theres a method for distance

#

hold on

atomic violet
#

i need to see who’s first and so on, and i was gonna translate the block number into seconds depending on how many there are till the player gets to the end

#

and tell the player a time based on that

chrome beacon
crimson terrace
#

this is what youre looking for. replace the entity at the start with the player and the Parameter with the location of the end portal

crimson terrace
#

that gives you the distance between player and portal. it returns a double

atomic violet
crimson terrace
#

depends on how often you do it

atomic violet
#

like is it efficient enough to check everyone individually

vague mason
atomic violet
#

i’m doing it constantly

crimson terrace
#

constantly as in?

atomic violet
#

to update the standings on a scoreboard

crimson terrace
#

twice per second?

atomic violet
#

probably something like that

spiral light
#

every second ok... every tick ... never

atomic violet
crimson terrace
#

shouldnt lag too bad since its basically just subtracting 3 values from 3 other values per player

atomic violet
#

okay that makes sense

#

and it’ll work on a race track? cause the distance isn’t straight

#

like could i change that to work on curves?

crimson terrace
#

that method will return the pure distance

peak depot
#

can anyone send me the 1.18 spigot api

atomic violet
#

oh so cutting corners

#

hmmm

#

i’ll find another way

crimson terrace
#

could do it with checkpoints

#

do the same thing for a checkpoint and track which checkpoint should be compared with the players pos

young knoll
#

distanceSquared is faster if you don't care about displaying the outpit

crimson terrace
#

they want to display the actual distance

#

on a scoreboard on the side

chrome beacon
peak depot
#

can anyone send me the 1.18 spigot api

digital rain
#

oh i think i might found a solution to my previous things but how long does player invulnerability last after an entity getting hit

chrome beacon
tardy delta
#

i'm storing something in the players persistent data container rn, how would i handle restarts and reloads etc? rn in the join event i'm just looking for the data and if i found it, cache it in a map. Should i remove the player data from the map if he leaves the server, as its cache and i dont want it to become to big

vague mason
tardy delta
#

or should i just keep it until the server restarts

#

ah i was planning to implement something like that

peak depot
proud basin
#

How can I get every value from every class using the annotation?

tardy delta
#

also should i return the immutable copies or collections when exchanging them with other parts of my plugin?

visual tide
chrome beacon
visual tide
peak depot
chrome beacon
#

It does

peak depot
#

not for me

chrome beacon
#

Send the error

visual tide
peak depot
#

wait

#

like there is no error it just wont work

atomic violet
atomic violet
tardy delta
#

can 1 == (byte)1?

peak depot
quaint mantle
tardy delta
#

it says its true

crimson terrace
#

well a 1 as byte is just '1'

#

00001 cast as byte should still be 1

tardy delta
#

ah right

crimson terrace
#

but a byte is usually 8 bits so not sure how that works

tardy delta
#

👀

crimson terrace
#

if it says that its true it should be true

tardy delta
#

also wasnt there a way to create a namespacedkey without a plugin instance?

#

yea thanks

crimson terrace
crimson terrace
coral bobcat
#

it’s in your spigot folder after running build tools

crimson terrace
tardy delta
#

NameSpacedKey.fromString("something") seems to use minecrafts' namespace

atomic violet
#

i could prolly have a few checkpoints and just check the distance to the next checkpoint or something idk

crimson terrace
pastel arrow
#

how can i check if a projectile hit a block?

atomic violet
#

but if a player is behind a checkpoint that the person ahead of them has passed, then it’ll be harder to see how far behind the next player they are

#

is there really like no way i can have code memorize a track and see where players are on that track? maybe with checkpoints i can roughly draw out the track for the plug-in?

tardy delta
chrome beacon
crimson terrace
tardy delta
#

e.getHitblock

pastel arrow
atomic violet
peak depot
chrome beacon
#

No

peak depot
#

why not

pastel arrow
tardy delta
#

if (e.getHitBlock() != null or something)

peak depot
tardy delta
#

i dunno if it can be null

pastel arrow
#

i dont think it can be null

tardy delta
#

is it nullable?

sterile token
#

Hi, i want to ask if there is an online api where you give an ip address and it send you back the country and the city? Thanks!

young knoll
#

It can be null

pastel arrow
#

i dont think so

chrome beacon
atomic violet
#

on another note, is there a way to stop people using riptide tridents colliding with each other?

chrome beacon
#

Try figuring out the error instead

tardy delta
#

yes it can chec that

spiral light
peak depot
pastel arrow
peak depot
spiral light
#

yes

pastel arrow
#

okay

quaint mantle
#

how not to take the level when using an anvil?

peak depot
ivory sleet
#

No that’s not how it works

quaint mantle
#

@ivory sleet

#

how not to take the level when using an anvil?

ivory sleet
#

Give the level back maybe? Or manipulate an event like the level event

quaint mantle
ivory sleet
#

Yes I told you a reasonable way of addressing your problem?

quaint mantle
#

I have a code so I can't rename a custom item

#

but the level is taking away from me, and I want to fix it

quaint mantle
#

AnvilInventory anvil = (AnvilInventory) e.getInventory();
anvil.setRepairCost(0);

#

not working(

ember estuary
#

how can i make a prefix using a ComponentBuilder?

using prefix.append(...).create() appends every text following it to my prefix. and there is no clone() for ComponentBuilder.

quaint mantle
ember estuary
#

My Prefix Code:

    private static final ComponentBuilder prefix = new ComponentBuilder().append("[").color(ChatColor.of(new Color(1, 0, 188)))
            .append("Level=Worldborder").color(ChatColor.of(new Color(255, 180, 17)))
            .append("] ").color(ChatColor.of(new Color(1, 0, 188)));

My Usage Code (which overwrites the prefix, which i dont want):

player.spigot().sendMessage(prefix.append(message).color(ChatColor.of(new Color(234, 233, 246))).create());

What to change so it doesnt overwrite the prefix?

grim ice
echo hound
#

how can i get int from class

#

privatte int

grim ice
#

uuid and the xp

echo hound
#
    public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
        Field field = fieldClass.getDeclaredField(fieldName);
        field.setAccessible(true);
        return field;
    }```
#

I have thos

grim ice
#

when he opens an anvil

#

give him lot of xp then when he closes the inv u give him his xp back

quaint mantle
grim ice
#

if u dont know how to do that then

#

?learnjava

undone axleBOT
quaint mantle
spiral light
#

learning java

grim ice
#

^

quaint mantle
#

I figured out how

#

perevod4ik govno

#

thanks

ember estuary
chrome beacon
quaint mantle
ember estuary
#

ooooohhhh

peak granite
#

any way to loop all registered commands and get their descriptions from plugin.yml for a /help command

ember estuary
#

didnt think of that, lemme try that

young knoll
#

I assume that is the mapped name

grim ice
#

show

#

the error

ember estuary
copper scaffold
#

how can i only change the name of a player only in the tablist?

young knoll
#

setPlayerListName iirc

copper scaffold
#

player.setPlayerListName("§b[Vanish] §r" + player.getName());
Like this? i have done that but it isn't changeing

tardy delta
#

heh

Caused by: java.lang.NoSuchMethodError: org.bukkit.NamespacedKey.fromString(Ljava/lang/String;)Lorg/bukkit/NamespacedKey;
young knoll
#

Stop using old versions

tardy delta
#

i'm not

young knoll
#

What version are you using

tardy delta
#

the 1.16 somewhere jar

young knoll
#

Believe that is a 1.17 method

tardy delta
#

and now its

Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.github.FourteenBrush.MagmaBuildNetwork.utils.Keys
left swift
#

is it possible to use custom nms biomes in world generation?

spiral light
young knoll
#

Not easily, but I imagine yes

spiral light
#

sadly you cant use the bukkit methods to set a custom biome (yet).... there are PR's for that to change but it all depends on md_5

left swift
spiral light
left swift
misty current
#
    public static Location getNearestBlockUnder(Location loc){
        loc = loc.getBlock().getLocation();
        while(loc.getBlock().getType() == Material.AIR || loc.getBlockY() > 0) {
            loc.subtract(0, 1, 0);
            Bukkit.broadcastMessage(String.valueOf(loc.getBlock().getType()));
        }
        return loc;
    }

i made this method to get the nearest block location under the location parameter but it's not working and the broadcast sends all blocks down to bedrock

#

am i being stupid or something

young knoll
left swift
spiral light
#

there is an PR to change the enum to allow register new ones so you can use them in bukkit-api too

misty current
spiral light
misty current
#

thanks

smoky oak
#
//in onEnable
instance = this;
//...
if(reload){
  for(Player p : this.getServer().getOnlinePlayers())
                playerDataMap.put(p, new PlayerData(this, p));}

vs

public static void registerPlayerData(Player p){
        instance.playerDataMap.put(p, new PlayerData(instance, p));
    }

Why does, if the bottom function is called, the get(p) command return a null object?

misty current
#

my brain is slow

young knoll
#

I was thinking of doing a custom biome API, but if it's already being worked on that's cool

spiral light
left swift
smoky oak
#

which answers the question not

#

command - reload - command

#

no error

#

and its telling me that the object i try to get from the map is null

spiral light
smoky oak
spiral light
young knoll
#

That's not a part of spigot though :p

spiral light
young knoll
#

Where is the PR for register and use?

pastel arrow
#

i want to check all the time if a player has a bucket in his inv. where can i do that?

spiral light
#

like every second ?

pastel arrow
#

yes

spiral light
pastel arrow
#

is there any other way than scheduling?

young knoll
#

Listen to a bunch of events

spiral light
pastel arrow
#

so only way to do it is scheduling?

smoky oak
#

more like inventory event or something like that

#

iirc there are events for inventory changes

young knoll
#

InventoryClickEvent, PickupItemEvent, etc

spiral light
pastel arrow
#

okay ...

young knoll
#

Don't remember if you can access inventories async, if so that will hlep a bit

warm cloak
#

best way of creating tables in database?

spiral light
#

Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);

warm cloak
#

okay thanks

zealous osprey
#

setPersistent(bool) means that if the bool is true it'll not despawn, right ?
The entity ofc

#

Or should I rather use java .setRemoveWhenFarAway(false) ?

Solved it, all good 👍

pastel arrow
#
    public void onBucketFill(PlayerBucketFillEvent event){

        Player player = event.getPlayer();
        Material bucket = event.getBucket();
        player.getInventory().remove(bucket);
    }```
does someone know why that simple code isn't working?
grim ice
#

does getBucket() return a material

#

i doubt it

#

it prob returns an itemstack

#

so just do player.getInventory.remove(event.getBucket);

zealous osprey
grim ice
#

and get rid of Material bucket

#

and r there errors

#

did u register it

zealous osprey
pastel arrow
#

i registered it and it returns a material @grim ice i will try out that from @zealous osprey

ember estuary
#

is there a way to get the minimum and maximum build height of a world?

pastel arrow
#

still not working :/

ember estuary
#

for example 0 in 1.17 and -64 in 1.18

ember estuary
#

ty

grim ice
#

Unsupported Gradle.
The project uses Gradle 2.7 which is incompatible with IntelliJ IDEA 2021.2.2.

tardy delta
#

lol couldnt send message because it was too big
io.netty.handler.codec.EncoderException: String too big (was 422780 bytes encoded, max 262144)

whole nebula
#

Here I created a menu but the items do not work. in addition it is possible to take the item in the menu. I tested things but none of my solutions succeeded. Does anyone have the solution?

ember estuary
#

why would you cast inventory to event
is that even a thing

tardy delta
#

^^

#

i told him

ember estuary
#

inv.getTitle()

grim ice
#

why is ur CommandExecutor a event listener

#

waht the fuck

ember estuary
#

but thats a bad idea too, as people can rename chests

#

so maybe make it colored

tardy delta
#

class menu

ember estuary
spiral light
grim ice
#

whats ur language level btw

vague mason
#
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event){
        for (BlockFace side : SIDES) {
            final Block b = event.getBlock().getRelative(side);
            event.getPlayer().sendMessage("Scanning for WallSigns in " + side.name());
            if (b.getState() instanceof Sign) {
                event.getPlayer().sendMessage("Sign is detected!");
                WallSign wallSign = (WallSign) b.getState();
                if (b.getRelative(wallSign.getFacing()).equals(event.getBlock())) {
                    event.setCancelled(true);
                }
            }
        }
    }
ember estuary
#

whats the problem with the code?

#

@vague mason

#

cant just post code without context

vague mason
#

class org.bukkit.material.Sign cannot be cast to class org.bukkit.block.data.type.WallSign

echo basalt
#

you probably got the wrong import

spiral light
#

import of sign is wrong

echo basalt
#

also check instanceof WallSign instead of instanceof Sign

grim ice
#

Unsupported Gradle.
The project uses Gradle 2.7 which is incompatible with IntelliJ IDEA 2021.2.2.

#

help pls

vague mason
#

Why was old method even deprecated if there are only problems with new one?

grim ice
#

oh nvm im lagging its solved

echo basalt
#

my man probably needs blockdata instead of blockstate in that case

grim ice
#

both of them are wrong imports

whole nebula
grim ice
#

wat

spiral light
#

and also your forgot to register the Events then!

vague mason
#

Basically I need something like this.

#
private static final BlockFace[] SIDES = new BlockFace[] {
        BlockFace.UP,
        BlockFace.NORTH,
        BlockFace.SOUTH,
        BlockFace.WEST,
        BlockFace.EAST
};

@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
    for (BlockFace side : SIDES) {
        final Block b = e.getBlock().getRelative(side);
        if (b.getState().getData() instanceof Sign) {
            Sign sign = (Sign)b.getState().getData();
            if (b.getRelative(sign.getAttachedFace()).equals(e.getBlock())) {
                e.setCancelled(true);
            }
        }
    }
}
#

But this code is from 2019

opal juniper
#

looks like you already have it

vague mason
#

and sign.getAttachedFace don't exist anymore.

echo basalt
#

does this answer your question

vague mason
#

is getFacing the same as getAttachedFace?

echo basalt
#

attachedFace = getFacing().opposite

chrome beacon
grim ice
#

cool

opal juniper
vague mason
#

wait

opal juniper
#

he is back again

grim ice
#

ziga>?

opal juniper
#

yes

visual tide
#

make a custom holder

grim ice
#

oli help

#

Unsupported Gradle.
The project uses Gradle 2.7 which is incompatible with IntelliJ IDEA 2021.2.2.

visual tide
#

otherwise players could just rename a chest

tardy delta
#
Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.github.FourteenBrush.MagmaBuildNetwork.utils.Keys
vague mason
grim ice
#

ok

visual tide
#

to newer version

grim ice
#

i just clicked solution in intellij

#

(btw the dumb me went on and gave up on intellij cuz first time didnt work)

whole nebula
grim ice
#

and installed eclipse

visual tide
grim ice
vague mason
#

Casting WallSign don't work.

visual tide
#

plus other plugins could interfere

vague mason
#

It output an error

grim ice
visual tide
whole nebula
#

I see

visual tide
#

so you should just always check for holder instead of name

grim ice
#

also mrpuce

#

maybe learn uhhh

#

java conventions

chrome beacon
vague mason
#

So that was the problem

mighty pier
#

how do i make a header and footer for a player? i tried this p.setPlayerListHeaderFooter("§e§lPP.NET", "§b§lJOIN NOW"); but it didnt work

vague mason
#

finally it's working thanks you so much

opal juniper
#

olivo ftw

grim ice
#

olivo best

vague mason
#

This was like really confusing as how do you know when to cast a getState or getBlockData

quaint mantle
#

How do you think, should builders have getter methods as well?

chrome beacon
#

You check if the interface implements BlockState or BlockData

spiral light
whole nebula
spiral light
#

if you dont know how to code this you should learn java instead ?

#

?learnjava

undone axleBOT
visual tide
#

and there youre passing in null as the inventoryholder

echo hound
#
    public static Field getField(Class<?> fieldClass, String fieldName) throws NoSuchFieldException {
        Field field = fieldClass.getDeclaredField(fieldName);
        field.setAccessible(true);
        return field;
    }
#

Can i cast this to int??

#

and how can i change field value?

indigo cave
#

learn reflection

echo hound
#

-.-

visual tide
spiral light
tardy delta
#

mmmm yes

visual tide
#

pass an instance of that instead

whole nebula
indigo cave
spiral light
visual tide
spiral light
echo hound
#

and how can i get int of field

manic furnace
#

I have a file with an ü in the name, but when i want to to read it, i become a exception, that the file can't be found and the ü is replaced with ├╝ in the exception. What can i do?

indigo cave
#

set it to UTF-8

manic furnace
#

How?

tardy delta
#

StandardCharSet.UTF_8?

#

not sure how to do that with api

manic furnace
#

In behind the filepath in the FileReader() mehtod?

indigo cave
#

encoding

mighty pier
#

how do i make a header and footer of a tablist on 1.8?

spiral light
echo basalt
spiral light
mighty pier
#

ty

buoyant viper
peak depot
#

how to register a new command in spigot 1.18

ember estuary
#

Why is it
WorldBorder#setSize(double newSize, long seconds)
when the Packet actually allows for Milliseconds?

grim ice
#

ngl

#

starting with bukkit plugins instead of forge mods is way better

#

forge mods are too hard to start with

ember estuary
#

and easier

#

yea

grim ice
#

but if ur some type of genius and start with forge and actually master it

#

ur gonna drink bukkit like water

ember estuary
#

how can i re-obfuscate specific parts of the code?

#

or everything

#

was it buildtools that deobfuscated it?

spiral light
#

do you use maven ?

ember estuary
#

yeah

spiral light
#

those settings and you can code in mojang but it remapps to obfuscated/spigot

pastel arrow
#

how do i unregister a listener?

ember estuary
#

oh that would be great, ill try it

#

can you send it as text? xD

spiral light
ember estuary
#

ty

pastel arrow
spiral light
#

and deactivate it with another cmd ?

#

you can just use a global variable that toggels

pastel arrow
#

can you send me the code for that?

spiral light
#

no

#

?learnjava - use this & you will code it yourself easy

undone axleBOT
pastel arrow
#

okay

spiral light
#

and the problem is that you dont know how to send a packet ?

tacit drift
#

a crafting recipe should be created in onEnable?

spiral light
tacit drift
#

k

spiral light
mighty pier
#

kty

ember estuary
# spiral light

I just get Failure to find org.spigotmc:spigot:jar:remapped-mojang:1.17.1-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ :(

#

does it not exist for 1.17.1 ?

spiral light
#

hmmm i think the remapping stuff was there before ... works fine for 1.18

ember estuary
#

weird :/

young knoll
#

Did you run buildtools with --remapped

ember estuary
#

nope

#

will do that

#

dont need to delete anything right?

#

just run it

young knoll
#

No

#

That will put the remapped jars in your maven local

ember estuary
#

should i change java -jar BuildTools.jar --rev %Input% to java -jar BuildTools.jar --remapped --rev %Input%

#

is that how?

spiral light
#

java -jar BuildTools.jar --remapped
will work i think

ember estuary
#

(i got a bat file for build tools)

#

oh ok will just do it by hand then

#

whats the rev for

copper scaffold
#

i got problems at changing player name with this
p.displayName(Component.text("test" + p.getName()));
and this
p.setDisplayName("test" + p.getName());
and this
p.setCustomName("test" + p.getName());
what can i do?

young knoll
mighty pier
ember estuary
#

ah

civic apex
#

how do I make players not get pushed by entities (any entity)
I tried player.setCollidable(false) but it didnt work

young knoll
#

I think you have to set it on the other entity too, not sure

ember estuary
#

Am i supposed to use MyPlugin-1.0-remapped-obf.jar then? is that the file?
cuz that throws an error which i have no idea of

civic apex
young knoll
spiral light
# mighty pier i still dont understand anything
IChatBaseComponent bottom = new ChatMessage(bottommsg);

PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(top,bottom);

((CraftPlayer)p.getHandle()).sendPacket(packet)```

Its rly simple
civic apex
#

imagine Entity A, Entity B and Player. Player wouldnt get pushed by neither of the entities but the entities A and B would be able to push each other

mighty pier
#

ok thanks

civic apex
#

how do I do that?

young knoll
#

That one

ember estuary
#

ah ok

#

java.lang.NoSuchMethodException: net.minecraft.world.level.border.WorldBorder.i()

#

weird

#

double size = (double) worldborder.getClass().getMethod("i").invoke(w);

#

does the unmapping not work with reflections?

spiral light
#

nms

ember estuary
#

does it do reflections at compiletime?

mighty pier
#

k

young knoll
#

Reflection strings will not be remapped

ember estuary
#

thats great, but then why do i get an error

#

its just that in my IDE its remapped to .setCenter

#

but i thought that would unmap it, so i can use it with reflection

young knoll
#

I believe methods are still spigot mapped in 1.17

ember estuary
#

oh, so spigot has a default mapping?

#

is that why some methods are like ".setCenter()", but others are like ".a()"

spiral light
stone sinew
#

@sullen marlin I found the issue... In 1.18 player skull skins don't get updated in the armorstands hand. When given to the player they don't update until you open your inventory.

if(Core.isLegacy()) {
    armorstand.setItemInHand(heldItem);
}else {
    armorstand.getEquipment().setItemInMainHand(heldItem);
}
if(Bukkit.getPlayerExact("yapperyapps") != null) {
    Bukkit.getPlayerExact("yapperyapps").getInventory().addItem(heldItem);
}
spiral light
ember estuary
#

^

stone sinew
ember estuary
#

ah

spiral light
stone sinew
spiral light
#

had to change smth because SkullOwner does not allow a UUID anymore ...

young knoll
#

They mean the skull owner NBT tag

stone sinew
#

I didn't know it ever allowed UUID's

spiral light
young knoll
#

The NBT tag used take a uuid string

lavish hemlock
#

then use the 4 int array

young knoll
#

Now it takes most and least significant bits

ember estuary
# spiral light yes ... but in 1.18 they dont use spigot mappings for methods/variables ... just...

so I am making a Plugin, where a single jar should work for 1.17 and 1.18
I am using reflections, but as you can tell by the error, stuff doesnt work. i'm coding with spigot 1.17.1, but the plugin only works in 1.18. probably because of spigots default mappings in 1.17.1, which dont allow me to use reflections. any idea how to get rid of the default mapping, or am i doing somethign else wrong?

stone sinew
#

Well I don't use that. I use Gameprofile

quaint mantle
#

why tf mojang

spiral light
quaint mantle
#

why not long array or byte array

spiral light
#

why not just uuid

ember estuary
young knoll
#

Because uuid isn’t a primitive type

quaint mantle
#

You mean uuid string? Well it takes more space

spiral light
#

still a meaningless change they did ... just to safe some more bytes .... they dont even use custom skulls in minecraft by them self

young knoll
#

So what?

#

It’s free storage saving

spiral light
#

yeah but there are better things to change then saving some bytes because of the uuid change in skulls

young knoll
#

Sure, but those take more effort

spiral light
#

true

stone sinew
#

Its possible the option wasn't suppose to be available if it was added only in 1.17

lavish hemlock
#

"There's better things to do than finishing the rest of the update" :)

#

and maybe

#

maybe there is

#

maybe there's a dupe that's gone undetected for a while

#

but are you really going to skip out on making a good change?

#

just because "there's something better to do"?

#

(plus, chances are it was an old issue in their workflow that they weren't doing for that exact reasoning until now so they could get it out of the way)

spiral light
#

they could at least support both 🧐

lavish hemlock
#

makes reading more complex (you have to check if it's a string or array before doing anything)

#

when writing isn't made that much more complex

#

I'm pretty sure UUID allows you to get its MSBs/LSBs easily

young knoll
#

Yes

lavish hemlock
spiral light
#

yes and you can cast them to int and int >>32 ... and then create the 4 int array

young knoll
#

Seems weird to split them in half

lavish hemlock
#

agreed

#

especially since there is a TAG_Long type in NBT iirc

spiral light
#

we are still talking about skullowner id in 1.18 right ?

young knoll
#

Mhm

misty current
#

what is the difference between lastx and locx in nms entity classes?

worldly ingot
#

Writing two longs is less data than a string of 36 characters

misty current
#

do they have a point and should i change both to change an entity's position

worldly ingot
#

It looks like it's more, but it's represented by less bits

#

lastX would be the player's last x location, locX would be their current location

#

Key distinction there lol

young knoll
#

Yeah but it’s 4 ints

#

Which is just weird

worldly ingot
#

The choice of using 4 ints was strange to me but I'm sure they have a technical reason for it

tacit drift
#

Does spigot have anyway to get the max stack size of an item material?

worldly ingot
#

Material#getMaxStackSize()

tacit drift
#

thx

young knoll
#

How about 16 bytes

misty current
young knoll
#

Yes

misty current
#

kk thanks

young knoll
#

Well, lastX should be their last pos

#

Why are you teleporting with NMS

misty current
#

packets

#

not really teleporting

spiral light
#

then you dont need to update locx

young knoll
#

Their lastX probably doesn’t matter then

#

Nothing will be reading it

misty current
#

aight thanks

peak granite
#

if(Core.getInstance().playerConfigMap.get(Bukkit.getPlayerExact(name).getName()).isSet()) {

#

doesn't work

spiral light
#

ok cool

peak granite
#

'isSet(java.lang.String)' in 'org.bukkit.configuration.MemorySection' cannot be applied to '()'

hybrid spoke
#
    private UUID[][][] getUuid() {
        
        String[][][][][][][][][][][][][][] strings = new String[][][][][][][][][][][][][][] {{{{{{}, {}, {}, {}, {{{{{{{{{"", "ff1c8284-91ca-4d35-9bfd-17c417223c77", "", ""}}}}}}}}}}}}}};
        return new UUID[][][] {{{UUID.fromString(strings[0][0][0][0][4][0][0][0][0][0][0][0][0][1])}}};
    }

any more efficient way to get a UUID?

misty current
#

what the

wide coyote
#

what

spiral light
#

what the hack

young knoll
peak granite
#

i wanna see if

hybrid spoke
#

am i unclear?

peak granite
#

they have a playerConfigMap

#

set

#

tto them

spiral light
young knoll
#

Also don’t use the player name for data storage

hybrid spoke
peak granite
#

my server is cracked

young knoll
#

Gross

peak granite
#

ur gross

spiral light
quaint mantle
#

Piracy is not supported here 🙂

young knoll
#

I wonder if we could get MD to just ban all cracked users :p

peak granite
#

i have a prem acc tho

hybrid spoke
peak granite
#

it's just my playerbase has cracked players

worldly ingot
hybrid spoke
young knoll
spiral light
#

^^

spiral light
#

[]

hybrid spoke
#

i followed a youtube tutorial and drifted away a little in the beginning

spiral light
young knoll
#

Stroke of genius

hybrid spoke
quaint mantle
#

What the actual fuck

spiral light
#

at this moment i dont know if your just trolling .

quaint mantle
#

Why

hybrid spoke
#

so there is no better way? fine

misty current
#

what is the last parameter of the PacketPlayOutPosition for?

spiral light
#

dismountVehicle

regal lake
#

With the 1.18 update,something has changed on the Attribute..
How i can get org.bukkit.attribute.Attribute from net.minecraft.world.entity.ai.attributes ?

#

I can't figure it out.

spiral light
#

CraftAttribute would be smth

regal lake
#

There is no CraftAttribute or i don't see it

spiral light
regal lake
#

Oh with the suffix Map, like this:

org.bukkit.attribute.Attribute attr = CraftAttributeMap.fromMinecraft(attribute.toString());

?

spiral light
#

could work

#

maybe there is a MinecraftKey in the nms-attribute you have to use

regal lake
#
net.minecraft.ResourceKeyInvalidException: Non [a-z0-9/._-] character in path of location: minecraft:net.minecraft.world.entity.ai.attributes.AttributeRanged@5feddb6c
spiral light
#

.getDescriptionId() instead of toString()

regal lake
#

I also tried that, but then null will be returned

spiral light
#

i dont think so :/

regal lake
#

getDescriptionId returns attribute.name.generic.armor

org.bukkit.attribute.Attribute attr = CraftAttributeMap.fromMinecraft(attribute.getDescriptionId());

attr is null

spiral light
#

in nms-Attributes they get registered with names like "attribute.name.generic.attack_knockback" and they get are used by the nms-Attribute-Constructor which sets the output of .getDescriptionId()

#

could be bukkit hasnt changed name or the name is just generic_armor

#

bukkit has it just like this:

regal lake
#
System.out.println(attribute.getDescriptionId() + "!!!");
                    org.bukkit.attribute.Attribute attr = CraftAttributeMap.fromMinecraft(attribute.getDescriptionId());
                    if(attr == null) {
                        System.out.println("attr is null");
                    }

=>

[21:19:36 INFO]: [VR] attribute.name.generic.armor!!!
[21:19:36 INFO]: [VR] attr is null
regal lake
spiral light
regal lake
#

Is there no better way ? 😮

spiral light
#

dont think so

regal lake
#

Sometimes i hate spigot for that 😅

#

Let me try it

#

Seems working, i guess

sullen marlin
#

why cant you use the API

spiral light
#

because the worldcreator does not have generatorseetingsbase or worlddimension implemented yet

#

oh wrong conversation 😉

misty current
#

how does PacketPlayOutRelEntityMove work?

sullen marlin
spiral light
misty current
#

to move an entity

#

should i use another packet?

regal lake
spiral light
misty current
#

packets yea

sullen marlin
#

well there's an entire and complete attribute API

#

so I am unclear why you need NMS for attributes

spiral light
#

the PacketPlayOutRelEntityMove just describes the xdif, ydif and zdif from the entity to move (but not xdif = 1 means 1 block ...)

full sparrow
#

why I can't use event.getPlayer().getDisplayName() as if statment

young knoll
spiral light
full sparrow
#

likle I cant do playe.getDisplayName() == "myname"

misty current
spiral light
spiral light
spiral light
regal lake
#

nms attribute

misty current
#

oh well

#

thanks a lot

spiral light
#

well... RelEntityMove looks smoother if you know the calculation behind it

narrow perch
#

Latest 1.17 version for maven

misty current
#

uh yea i kinda need packets just for smoothness

#

tryna do armorstand animations

full sparrow
spiral light
misty current
#

is xdif the difference between the target loc and the original location?

spiral light
#

yes... but its limited in its range ...

misty current
#

yea since it's a byte

#

i looked a bit on google and it's around 4 blocks?

fast onyx
#
 ItemStack casco = e.getPlayer().getInventory().getHelmet();
        if(casco.getType() == Material.DIAMOND_HELMET) {
            e.getPlayer().sendMessage("It works!");
        }
#

what?

misty current
#

what happens if it exceeds the value?

spiral light
civic apex
#

how do I prevent a player from getting pushed (by anything)

spiral light
#

if its bigger you should use teleport

misty current
#

nah it's not

#

i need small movements so it's good

spiral light
fast onyx
#

Mmm

#

what do you mean

misty current
#

probably getHelmet is nullable

spiral light
#

not just probably

misty current
#

^

fast onyx
spiral light
#

what code ?

fast onyx
#

when a player interacts with another thing

#

same code

spiral light
#

check if a itemstack is null ...

fast onyx
#

so.. i've to put a if helmet is null condition?

civic apex
civic apex
#

yes

#

i tested setcollidable(false) on a player

#

but it can still collide with everything

fast onyx
#

lol

civic apex
#

i want a specific player to completely ignore the collision (getting pushed by entities) while the other entities interact normally between each other

misty current
#

another thing, can you make a craftarmorstand marker

spiral light
quaint mantle
misty current
#

the method is probably obfuscated

#

can't find it

civic apex
spiral light
#

no not with teams

civic apex
#

??

#

alr ill try it

#

and btw if they have collision disabled they can still get knockback right?

spiral light
#

yes

civic apex
#

kk

#

so do I create the team onEnable, configure it and on Player join/leave i add/remove them from the team?

spiral light
#

i think

sullen marlin
#

jiposeaijfosijdo;fijko;asdjk;fjiks;df

#

sdaiuhfhio;sadi;hfi;sdfi;jsdj;f

#

you will all kill me

misty current
#

:c

#

it's a stand spawned in with packets

spiral light
tardy delta
#

poor md_5

quaint mantle
#

Then Entity Metadata Packet

#

why do you need nbt

stone sinew
spiral light
#

there is no question asked at all^^

stone sinew
misty current
#

if you want to use nbt, i'd suggest using nbtapi

#

so you don't have to deal with nms pain

quaint mantle
#

pdc 😀

spiral light
#

"So I have this method for adding NBTTags. It works fine but in 1 spot of my plugin it doesn't work for some reason..."

there isnt a single question

sullen marlin
#

you know there's an API for setting all this

stone sinew
stone sinew
spiral light
#

thought just a identification

sullen marlin
#

well no one here is going to help you use nms to do what the API can do forever

#

stop writing shit code

eternal night
#

but how to support 1.7 🙃

stone sinew
eternal night
#

contrary to yours it at least works 🙂

sullen marlin
#

oof, burn

stone sinew
eternal night
#

"my code accessing unexposed internals no longer works because, even tho while the project exposes backwards compatible api, they decided to change internals around"

#

"but this isn't my fault"

jade grove
#

how exactly would i send a message to every player in a bungee instance for example?

eternal night
#

if you want to use internals on multiple versions you will have to have multiple modules

#

you cannot expect this to be backwards comaptible in the slightest

stone sinew
eternal night
#

you are literally depending on internals

sullen marlin
stone sinew
eternal night
#

start properly creating modules for different versions like any proper plugin

jade grove
sullen marlin
#

huge lengths

stone sinew
sullen marlin
#

its why you can literally run well-coded 1.7 plugins on 1.18

#

@stone sinew YOU ARENT USING THE API

eternal night
#

dense af

#

ngl

jade grove
#

md_5 is on heat

misty current
stone sinew
sullen marlin
#

can you point to a single bug report about the API you need being 'shit' or 'laggy af' ?

stone sinew
#

I like how my question still hasn't been answered

spiral light
# stone sinew clearly not xD

of course ... but this is sadly the reason why new stuff (generatorsettingbase + worlddimension) needs longer time to get added

stone sinew
sullen marlin
#

on JIRA

#

not you droning on discord about something that probably isn't even the API