#help-development

1 messages Β· Page 80 of 1

worldly ingot
#

Did he say to you "gluten tag" in the morning?

tender shard
#

lmao

#

okay choco

#

get out

#

git out

worldly ingot
tender shard
#

or Ill commit a murder

grim ice
#

lol tht meme

tender shard
#

what meme? that's chocos real life face

ornate patio
#

I'm dividing up my code into different files based on features. For example everything in TwitchBot.java has to do with twitch integration, meaning it has to listen to minecraft chat. Sometimes the bot needs to be reloaded though so I dont want the old listener to still be active

tender shard
ornate patio
#

this is more of a temporary thing ill come up with something better later

tender shard
#

but I dont think so

worldly ingot
tender shard
grim ice
#

oh right we're supposed to actually talk about coding

agile anvil
grim ice
#

i completely forgot that

tender shard
chrome beacon
ornate patio
#

im gonna fix it later

tender shard
#

pls dont cross post. also I have no idea what you're talking about

agile anvil
young knoll
#

Yes

#

HanderList has several static methods to do so

tender shard
agile anvil
#

Sounds great

tender shard
#

and that seems like a bad idea

young knoll
#

Ah

#

Yes it does

#

I would just toggle it with a Boolean

ornate patio
#

only when an admin reloads

tender shard
#

oh I confused you with someone else then, sry

agile anvil
#

I think it's cool, the goal is to have the lowest TPS isn't it?

tender shard
#

someone else had a similar question today

tender shard
#

you can just Thread.sleep() to get low TPS

agile anvil
ornate patio
#

mmm

agile anvil
tender shard
#

if you wanna get really low TPS, just do Unsafe.putAddress(0,0);

agile anvil
#

Unsafe is always a good idea

grim ice
#

o right

#

what are unsafevalues

#

and stuff

tender shard
#

tbh the Bukkit unsafe class is awesome

agile anvil
#

Dark magic

grim ice
#

i wanna make malware

#

please teach!

tender shard
#

fun fact: the actua implementation is called CraftMagicValues or sth

grim ice
#

(jk for legal reasons)

tender shard
#

a few days ago, I was bored

eternal night
#

CraftMagicNumbers smh

agile anvil
tender shard
#

oh mb. it's CraftMagicNumbers

agile anvil
ornate patio
#

Priority.HIGHEST is executed last right?

#

or is it the other way around

tender shard
#

HIGHEST ist second last, yes

#

LOWEST, LOW, ... HIGHEST, MONITOR

ornate patio
#

idk if my use case belongs in highest or monitor

young knoll
#

Does it modify things in the event

tender shard
#

do you change anything related to the event itself?

ornate patio
#

I'm just trying to broadcast some minecraft chat to twitch

tender shard
#

then use monitor

ornate patio
tender shard
#

and do ignoreCancelled = true

ornate patio
#

alright thanks

sterile token
#

Is posible to get a InetSocketAddress?

worldly ingot
#

From a player you mean?

#

player.spigot().getRawAddress()

#

Oh actually that was migrated into Bukkit now. player.getAddress()

sterile token
#

No, from vanilla Java

#

Because InetAddress.getLocalHost() exists, but it cant be constructed into a InetSoketAddress

lime jolt
#

anyone know how to change a players name tag

worldly ingot
#

Sure you can. InetSocketAddress has multiple constructors

#

One of those even has a string hostname for you. new InetSocketAddress("play.myserver.com", 25565)

sterile token
#

Hmn ok but still in troubles because of my constructor

#

Hmn i think i will have to redisign that

#

😑

tender shard
#

oh

#

hit return too early

#

I wish it woud be possible to provide an IP (or at least a fallback IP, when DNS fails) for a HTTPUrlConnection in java

#

and then it would use 9.8.7.6 as IP but still provide "myWebsiteThat..." as vhost

sterile token
#

Hi i need some help to invoke a method via reflection

vocal cloud
#

is it a private final method?

sterile token
#

No no

#

I have done a custom listener class

#

My goal is to loop over each method and invoke an event

lost matrix
#

So you mean like a separate event system? Independent of the spigot one?

sterile token
#

Yeah

#

Something like that

vocal cloud
#

Why not just use spigots? What does it lack

sterile token
#

Its for vanilla java

lost matrix
#

Any reason why you dont juse use the one provided by spigot?

#

Ah.

sterile token
#

Its specific for the socket library im doing

#

πŸ˜‚

#

I really like spigot event system so i have recreated

tiny solar
#

hey, I'm looking for a free plugin that will allow you to set custom drops for blocks or give you the option to execute a command after destroying a block

lost matrix
sterile token
#

Yeah i have already done that

#

Im inside the invoke part

sterile token
#

I dont really know how to do it

tiny solar
sterile token
#

Also sorry for pinging

lost matrix
#

Are you using Method or MethodHandle objects?

#
    Method method = ...;
    method.invoke(theInstanceContaingTheMethod, theParameter);
sterile token
#

Method

#

Thanks smile i have finalyl fixed it

pine lake
#

Hello, is there a method to stop/disable the plugin?

vocal cloud
#

Yes there is

#

?jd-s

undone axleBOT
pine lake
#

setEnabled(boolean enabled)?

vocal cloud
#

In the docs type disableplugin

#

In the search field

pine lake
#

Ow I forgot there was a search field

#

Thanks, found it!

sterile token
#

I finally figure it

vocal cloud
#

There you go

sterile token
#

idk why they are un oordered

#

I will have to implement priorities, async

atomic swift
#

is there a way to add a section before a section

wet breach
#

only if it isn't the root one

#

well technically you can do it if it is the root one just more involved is all

#

if it is the root one, you would need to hold the config entries in memory, clear everything and then put your section where you want it

lime jolt
#

anyone know how I get a string from a command that the player types
for example
if the player typed
/name
I want the player to be able to write whatever they want after that command
like
/name potato
and I want to be able to store the word "potato"

wet breach
#

that is what args[] is in onCommand()

#

args[] contains everything they typed after the command name

lime jolt
#

so in

#

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

#

to retrieve what was typed after

wet breach
#

String[] args is what you want

lime jolt
#

all I have to do

#

is

#

alr

wet breach
#

args[0] is the first argument after the command and so forth

lime jolt
#

So it is possible to do this ```String something = "";
for(int i = 0; i < args.length; i++){

something += args[i] + " ";
}```

lime jolt
#

alr thanks

wet breach
#

but you could just do this though

lime jolt
#

for each loop

#

i know

#

i like my regular for loops though

wet breach
#
for(String arguments : args[]) {
arguments;
}
lime jolt
#

yeah

prime sandal
#

Hello, I would like to know if it was possible in 1.8 to recover the durability lost by each piece of armor when a player is attacked (org.bukkit.event.entity#EntityDamageEvent) ?

lime jolt
#

thx

tawdry python
#

If I'm constantly checking the config, will it generate lag?

wet breach
#

no

#

config.yml files are always loaded in memory

atomic swift
#

can i use this to create a file and paste the contents of the old config into that file

if (!getConfig().getString("config-version").equals(configver)) {
  getConfig();
  createOldConfig();
  getOldConfig().setDefaults(getConfig());
  saveConfig();
}
prime sandal
mighty aurora
#

Quick Question. So I am trying to check for items with names that are formatted and such and I was using ChatColor.Bold.Red + "Chat to be formatted" but then that stopped working and it won't detect items that fit the correct syntax anymore... I tried using minimessage but that also does the same thing and doesn't work even with nonformatted text... Does anyone know how I can fix this?

golden turret
#

yo

atomic swift
golden turret
#

1.19 = v1_19_R1

#

what about 1.19.1 and 1.19.2?

mighty aurora
atomic swift
mighty aurora
atomic swift
#

ChatColor.translateAlternateColorCodes('&', "&l&5TEXT")

mighty aurora
#

ah

#

ok

wind tulip
#

Does anyone know how to get a container inventory from a location?

drowsy helm
#

then Container has .getInventory()

wind tulip
#

thanks

mighty aurora
eternal oxide
mighty aurora
eternal oxide
#

then strip color and check the result

#

unless teh color means somethin

drowsy helm
#

or just use java File utils to copy and rename the file

atomic swift
#

no

#

it is fileutil

drowsy helm
atomic swift
ivory sleet
eternal oxide
#

are you actually trying to copy a file, or are you trying to extract a resource to a file from inside your jar?

atomic swift
#

so config -> OldConfig

#

but getConfig() is FileConfiguration not File

ivory sleet
#

Yes

#

But thats because it does only resemble the content of the file

#

Not the file attributes, location on the drive etc

#

Thats up to File

mighty aurora
eternal oxide
#

if you used the pdc it would be impossible for anyone to make it

#

Most used SQL? I have H2, MySQL, SQLite. Any others I should consider?

drowsy helm
#

everyone i know uses mysql or postgresql

river oracle
#

I use mongo :P

ivory sleet
#

Especially in enterprise

river oracle
#

they have really nice java compat

ivory sleet
#

NoSQL πŸ’€

river oracle
#

NoSQL πŸŽ‰

#

I've never used any form of SQL lol

ivory sleet
#

Would be nice if it wasn’t so unscalable when it comes to relation based data

worldly ingot
#

If not just straight MySQL due to legacy

drowsy helm
#

mongo is super scalable wdym?

river oracle
#

have never had issues with scaling mongo

ornate patio
#

mango

#

πŸ₯­

lime jolt
#

anyone know how to make change the name tag of a player

#

like the box above their head

#

with their username

#

Player#setDisplayName() does not work 😦

torn shuttle
#

oh ffs

#

my plugin is too large due to the translations files

#

3250kb of text

#

why is nothing ever easy

tulip nimbus
vocal cloud
vital sandal
torn shuttle
#

it pushed it over the limit

#

the main problem is that I have about 50% of my storage taken up by cloud commands seemingly

torn shuttle
#

so I either host off-site, rewrite all commands or start using something like proguard just to compress the plugin

vocal cloud
iron glade
#

Thereβ€˜s a file size limit on spigot?

torn shuttle
#

yep

iron glade
#

How much?

frosty tinsel
drowsy helm
#

wait i didnt even know that

#

guess i have to modularize my plugin

ornate mantle
#

what version of nms do yall use

#

and do you use spigot mappings or mojang mappings

drowsy helm
#

mojang mappings

#

most people have moved to moj mappings aswell

crisp estuary
#

What's the best coding website

hybrid spoke
crisp estuary
#

Ok

quaint mantle
#

any1 need server developement

vocal cloud
#

Unverified with black PFP. Lol

reef lagoon
#

Racist ^

drowsy helm
#

Time to refactor 14k LOC :DDDDD

iron glade
scarlet sun
#

Hello. I finished java lessons, i know basics and more about java and I want to make a plugin but I don't know which part i should start making first

vocal cloud
#

Start from the bottom and work your way up.

#

Not talking about the image

onyx fjord
#

πŸ‘

#

its Player#hasPlayedBefore() iirc

scarlet sun
zealous osprey
wet breach
#

don't quite understand that

#

that method is reliable regardless of the plugin. What makes it unreliable is if the user data gets cleared out

#

that method returns true if it can find in the player data directory the corresponding data file for a given uuid/player

zealous osprey
#

doesnt player#hasPlayedBefore() only check against the "userchace.json" file?
So if you played on the server before, it would be "true", irrelevant of if your plugin was enabled at that time or not.

wet breach
zealous osprey
#

but let's say the plugin does something when a new player joins for the first time since the plugin was enabled, like set some PDCs or smth, that wouldn't happen if you only use player#hasPlayedBefore(), cause that could be true, even though you rather want to know if the player has played before the plugin was enabled

wet breach
#

well, that is just people mis-understanding the method

#

doesn't make it unreliable

zealous osprey
#

I just wanted to note it, as it seems that what Igneliukolaumas wants is just that, when a player has joined prior to the plugin being enabled

grim ice
#

I don't think so

zealous osprey
grim ice
#

It completely makes sense

#

The naming cant be any simpler

wet breach
#

that isn't the issue we discussed lol

#

more of people learning to use the API simply not understanding that method πŸ˜›

#

since you know people don't read lol

grim ice
#

How would you misunderstand the functionality of it

#

It literally spells it out for in the method name lol

zealous osprey
#

I just wanted to note something, how has this become such a problem of naming schemas suddenly ?

wet breach
grim ice
#

Well anyway gm

zealous osprey
#

gm 2Hex

wet breach
#

it would be easy for someone new not actually think that a player could have played on the server before their plugin existed on the server πŸ˜›

shadow zinc
#

Why isss snakeyaml adding all this crap to my data?

#

head, serialVersionUID, tail and accessOrder

#

these things don't exist in the config file

undone axleBOT
shadow zinc
wet breach
#

because it isn't coming from the data

#

its coming from your code

#

guaranteed serialVersion exists in one of the classes

shadow zinc
#

only 450 lines, thats alright

wet breach
#

you serializing any data?

shadow zinc
#

I would assume so

#

oh shoot

#

there is more code hang on

#

in here

#

ah its probably the reflection?

glossy venture
wet breach
shadow zinc
#

nice, but now I need an alternative

#

and im not using jackson

wet breach
#

not sure what you use the reflection on, but in the first code paste I noticed you are using an itemstack as a test I suppose?

#

if that is the case, ItemStack contains that data as it is required for objects to be serializable

shadow zinc
#

which class and what line are you referring to

shadow zinc
#

thats not a test, thats part of building the gui

wet breach
#

ok...not really concerned on the purpose

#

just informing where that data is coming from, and not quite sure how you are using the reflection as I don't have my IDE opened

#

but in Java for something to be serializable one of the things the class needs to have is SerialVersionUID

#

ItemStack is one of those that is serializable

shadow zinc
#

its my attempt to get the config sec for the yaml

#

wasn't entirely sure how to do it

glossy venture
#

?paste

undone axleBOT
wet breach
#

anyways, your project is too large for me to go through to see if any of your class files contains it

#

especially without my IDE

shadow zinc
#

The other way is Jackson, but screw Jackson

wet breach
#

it is a way you can do it

glossy venture
#

important code from the Npc class: https://paste.md-5.net/eqakafimuc.java
code for spawning the npcs (just for testing)

    int n = 0;

    @EventHandler
    void onPlayerInteract(PlayerInteractEvent event) {
        Location loc = event.getPlayer().getLocation();

        Npc npc = new Npc(this, "npc-" + (n++))
                .create(NmsWorld.getHandle(loc.getWorld()))
                .move(loc);

        npc.setSkinSignature("...")
                .setSkinTexture("...")
                .updateSkin();

        npc.spawn();
    }

but when right clicking, it only adds the players to the tablist, they dont show in front of me

shadow zinc
wet breach
#
        Object x = new HashMap<Integer,String>();
        HashMap y = (HashMap<Integer, String>)x;
glossy venture
#

spawn() goes over every player and calls spawn(ServerPlayer) on them

shadow zinc
#

I don't like warnings

wet breach
#

yes a warning

shadow zinc
#

don't say supress

glossy venture
shadow zinc
#

die

glossy venture
#

supress

wet breach
#

Yep

#

but it is just a warning

#

not even an error

glossy venture
#

how are you gonna do it otherwise

shadow zinc
#

🀨

#

fine

#

I will blame you if someone calls me out on this

wet breach
#

even if you don't suppress the warning it won't prevent it from compiling

shadow zinc
#

ik but its a public plugin and I got all 5 stars

#

can't ruin the grind

wet breach
#

it won't

glossy venture
wet breach
#

the reason your IDE gives you a warning and the compiler is just to make you aware of something that you may not be wanting to do

glossy venture
#

bruh i do @SupressWarnings({ "unchecked", "rawtypes" }) like everywhere when i do any type of generic fuckery

wet breach
#

but if it is what you want to do and are aware of the ramifications if misused then no need to pay attention to it

glossy venture
#

the stupid capture of ? is annoying as fuck

#

so i dont use <?> but just nothin

shadow zinc
#

Java is a good way to fuck your brain up if you feel like it

glossy venture
#

yeah

shadow zinc
#

but I still love it

glossy venture
#

same

#

only programming language i could say im fluent in

#

i started with python

shadow zinc
#

same lol

glossy venture
#

then moved

shadow zinc
#

I started with c++

glossy venture
#

to make mc stuff

#

damn

shadow zinc
#

no lol

#

viruses

#

not even joking

glossy venture
#

exposed

iron glade
#

reported to fbi

tender shard
#

seems like your viruses sucked, otherwise you'd be in jail lol

glossy venture
#

but installing Mingw64 or some shit on windows is a fucking pain

shadow zinc
glossy venture
#

so i was never able to really code c++

shadow zinc
#

one person at school

tender shard
#

two person at school

glossy venture
shadow zinc
#

yeah

#

their av sucked ass

glossy venture
#

nicee

tender shard
shadow zinc
#

πŸ˜‰

tender shard
#

always important to add this part when saying that sth sucks

iron glade
#

Something funny too is screenshotting the desktop and setting it as wallpaper, then removing all icons from the desktop

glossy venture
#

got 130 npcs but idk where they are

shadow zinc
#

lol

iron glade
#

My teacher was kinda dumb not getting it

glossy venture
#

they dont spawn as entities for me

shadow zinc
#

making more won't fix it

glossy venture
#

nah i was fighting mobs and shit for bored but i forgot it makes 2 every time i click

shadow zinc
#

oh yeah player interact event is wacked

#

doesn't it call for each hand or something?

glossy venture
#

i am adding the entity with packets

shadow zinc
#

uhh packets

#

have you read this?

#

quoted from it

#
playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER));
you never add the entityPlayer id to the packet, and since is a vararg it does accept this anyway.```
glossy venture
#

i do do this ClientboundPlayerInfoPacket infoPacket = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, nmsPlayer);

#

included the nmsPlayer

shadow zinc
#

what version are you using?

glossy venture
#

1.19

shadow zinc
#

I believe this is correct

#
public void addNPCPacket(EntityPlayer npc, Player player) {
    PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
    connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, npc)); // "Adds the player data for the client to use when spawning a player" - https://wiki.vg/Protocol#Spawn_Player
    connection.sendPacket(new PacketPlayOutNamedEntitySpawn(npc)); // Spawns the NPC for the player client.
    connection.sendPacket(new PacketPlayOutEntityHeadRotation(npc, (byte) (npc.yaw * 256 / 360))); // Correct head rotation when spawned in player look direction.
}```
#

comment out your current packet stuff and give that a go, keep in mind I know shit about packets

glossy venture
#

i have different remappings, and i dont have ClientboundNamedEntitySpawn either

shadow zinc
#

npc stuff

glossy venture
#

spawn an npc

shadow zinc
#

its not showing up

#

needs to send packet correctly

wary harness
#

well there is a site to compear mapping that could help

#

@glossy venture here

tender shard
#

?switchmappings

glossy venture
#

i am on paper mappings idk if thats mojang

glossy venture
shadow zinc
#

paper? are you using gradle?

glossy venture
#

ye

shadow zinc
#

I remember the time when I was using grad;e

#

I regret it tbh

glossy venture
#

nah i like my mojang mappings but idk what the equivalent to PacketPlayOutSpawnNamedEntity is

#

BRUH

#

its ClientboundAddPlayerPacket

#

why is it called NamedEntity

shadow zinc
#

πŸ€·β€β™‚οΈ

glossy venture
#

still dont see shit

#

bruuh

#
        // construct packets
        ClientboundPlayerInfoPacket infoPacket = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, nmsPlayer);
        ClientboundAddPlayerPacket entityPacket = new ClientboundAddPlayerPacket(nmsPlayer);
        ClientboundTeleportEntityPacket posPacket = new ClientboundTeleportEntityPacket(nmsPlayer);
        
        // send packets
        ServerPlayerConnection connection = target.connection;
        connection.send(infoPacket);
        connection.send(entityPacket);
        connection.send(posPacket);
misty ingot
#

persistent data container is the best thing to come since the creation of minecraft itself

#

not negotiable ^

shadow zinc
#

na its the 1.19.1 update

misty ingot
#

nay

shadow zinc
#

yay

misty ingot
#

thou shall not disobey the laws of thy universe

#

whats nms for again?

shadow zinc
#

ten commandments of minecraft

shadow zinc
misty ingot
#

I see

#

packets stuff

onyx fjord
#

what should i use to make unique item that cannot be fabricated by player?

#

nbt?

misty ingot
#

probably

#

chuPAPImunanyo

onyx fjord
#

pdc is for blocks right?

#

or not only

shadow zinc
#

mfnalex, you're german right?

#

I got a 50 line yml of messages, wondering if you could look over it and make sure it makes sense

glossy venture
#

lets gooo

#

finally

shadow zinc
#

nice

#

?paste

undone axleBOT
shadow zinc
quaint mantle
#

I use it for custom items

#

storing id and other stuff

tardy delta
#

For tilestates chunks world's and itemmeta

#

And maybe i forgot smth

shadow zinc
#

😒

#

I'll get a bank loan

wet breach
# shadow zinc 😒

Lol, have no idea if he charges for translations. But I am sure he will do it for you πŸ˜›

#

there is a person here though who does in fact do translations as a job for a few languages

shadow zinc
#

I mean its already translated, he just needs to look over it

wet breach
#

yes

#

that is part of translation jobs

#

not only to actually translate but proof reading translations as well

wet breach
#

they did

#

its at the link above

hybrid spoke
#

where

hybrid spoke
#

wasnt there a site where you could just upload it and let people "PR" the translations

shadow zinc
#

no idea

#

I just run it through google translate

#

seems to work alright because people use the translations

tall dragon
shadow zinc
#

2.6% of servers I mean

shadow zinc
hybrid spoke
shadow zinc
#

yeah it didn't add an 'a'

#

but whatever

rich inlet
#

Hey :)
Which way is more common/better to use when sending messages?

Let's say I have a waiting queue on my server and in the plugin, I am putting the player who calls some command into a List of UUIDs. I have a method addNewPlayerToList(Player player) and the original onCommand method in some class JoinQueueCommand which implements CommandExecutor of course. After the player calls the command, a message like "You have been added to the queue." should be sent.
Now I have two options.

  1. Send the message in the onCommand method, after I call addNewPlayerToList(Player player):
executor.sendMessage("You have been added to the queue.");```
2. Send the message in the `addNewPlayerToList(Player player)` method itself and then just calling that.

Which way is more common?
hybrid spoke
hybrid spoke
reef brook
#

how do I send a message from my bungee plugin and get it back to my spigot plugin?

shadow zinc
#

Because that sounds like either a plugin channel or database problem

#

Unless its a text message in chat, then you can use the standard api for that

opal juniper
#

oh i might have been beaten to it ;)

iron glade
#

Has someone here already done something like making an entity unable to move but look at the player when he is close?

#

So far I used to disable the entities' AI, but this also disables looking at the player

chrome beacon
#

nms or paper api can be used for that

iron glade
chrome beacon
#

Sure DMs are open

reef brook
shadow zinc
shadow zinc
native mason
#

Does anyone know about deployment via Sonatype (Jira)?

drowsy helm
native mason
shadow zinc
#

what file writer should I use when dumping yaml?

#
                        yaml.dump(data, new FileWriter(file));
#

what I am currently doing

#

I saw different ones

#

I don't know the type of the data

onyx fjord
#

how do i get items that drop from BlockBreakEvent?

#

the entity

#

actually i found it lmao

#

is getDrops() relative to the tool used?

#

or i need to use the method that accepts tool

opal juniper
#

^

onyx fjord
#

gotcha

#

that is getItemInUse()?

shadow zinc
ivory sleet
#

with sth like

#
try (var writer = Files.newBufferedWriter(file.toPath().toAbsolutePath(),StandardCharsets.UTF_8)) {
  yaml.dump(data,writer);
}
onyx fjord
#

how do i cancel BlockBreakEvent item dropping default behaviour?

opal juniper
#

well it implements cancellable

#

or, BlockBreakEvent#setDropItems(false)

onyx fjord
#

W

eternal oxide
#

I really dislike shading libs. mysql dependency is so large, but if you want older servers to be able to use current MySQL 😦

#

makes my plugin 15 times the size it should be

rare flicker
#

it it possible to make no item display absolutely nothing when hovered in an inventory?
setting it to an empty string makes it display the default item's name
a space will display a space
a chatcolor with nothing after makes an even smaller space display, which is better but it still displays something

eternal oxide
#

yep, not on older versions though 😦

onyx fjord
#

skill issue for them

#

this (might) work

reef brook
#

can I put a spigot plugin and a velocity plugin in the same jar? so that we can put it on velocity or spigot without having a different file

opal juniper
#

you have to modularise your plugin

eternal oxide
#

well, its ok for older versions

#

it might be

#

its just doing what I already did in other plugins

#

No good since the new java security changes

reef brook
#

i use java 11

glossy venture
#

they suck

#

i wanted to make a runtime packager manager but fucking java pussy security fucked it

drowsy helm
#

Creative mode group iirc

#

Like which section they are in

shadow zinc
onyx fjord
#

1.19 api compared to 1.12 is like heaven and hell

quaint mantle
#

Hey, so, what I want to do is make an armor stand move in a circle using the player input packet (aka steer vehicle packet). I can't quite get the hang of it. When you press D I want it to go right following the guide of the circle. It's the same with A but it goes left when you press A.

drowsy helm
#

Eait no im wrong

#

According to javadocs getGroup isnt a method

#

There is getCreativeCategory

#

Yeah you ccant change it

drowsy helm
#

Are you sure it’s part of Material?

#

Or itemstack

drowsy helm
shadow zinc
#

how tf am I meant to save with snakeyaml without it completely destroying a config file?

#

look at what it did

#
  explosionCap: 50, heartBeatRate: 20}
drowsy helm
#

Your explanation is vague

shadow zinc
#

how?

reef brook
#

on which version of minecraft can my plugin work if I use java 11?

tardy delta
#

Check bukkit wiki

drowsy helm
shadow zinc
#

I'm not using spigot config

#

Its snakeyaml

#

its completely different

ivory sleet
shadow zinc
#

there is a reason I am using snakeyaml over spigots config

drowsy helm
#

Theres a reason hes using snakyaml

shadow zinc
#

thank you

reef brook
shadow zinc
#

buoobuoo could probably explain it better

drowsy helm
shadow zinc
ivory sleet
#

idk

#

depends on you

drowsy helm
#

Only thing that matters is if your server is running at ir above the compiled version of your plugin

reef brook
ivory sleet
#

but u can look at spigot source

shadow zinc
#

ScalarStyle looks nice

ivory sleet
#

if u wanna copy that

shadow zinc
#

actually yeah

quiet ice
drowsy helm
#

Compilation version of the plugin wont have effect on your client

#

It’s dependant on your server

#

And java is backwards compatible doesnt really make sense

reef brook
drowsy helm
#

Ah mb

#

If it’s a public plugin your best bet is java 8

reef brook
drowsy helm
#

A lot of people are still using it

tardy delta
#

Java backwards compatible so wondering why that doesnt work

quiet ice
#

Such as IKnowWhatIAmDoing?

drowsy helm
#

Yeah but some people just dont update. It sucks

#

IReallyKnowWhatIAmDoinfISwear iirc

reef brook
#

without adding a flag, from which version can I use java 11?

drowsy helm
#

Listen to the item craft event

tardy delta
drowsy helm
#

And evaluate the matrix yourself

reef brook
#

I wonder how many version I will lose if I switch to Java 11 that's all

agile anvil
#

Get the matrix, check the items and send the craft yourself

sacred mountain
#

wrong chat

onyx fjord
#
            magnetMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(
                            NamespacedKey.minecraft(config.getString("magnet-enchant")))),
                    config.getInt("magnet-enchant-level"), true);
#

what it might be caused by?

#
magnet-enchant: "DURABILITY"
magnet-enchant-level: 3
#

there are config values

#

oh wait

agile anvil
#

Just check for each position if it's the good material

#

and then add the result to the event

#

look post above

onyx fjord
#

do commands must be in plugin.yml or na?

#

can i create empty lore if one is equal null and then just add elements to it?

#

(im gonna try and see first lol)

ornate mantle
#

i have committed a misdemeanor

#

Could not resolve dependencies for project me.giorno:Balls:jar:1.0-RELEASE: org.spigotmc:spigot:jar:remapped-mojang:1.19.2-R0.1-SNAPSHOT was not found in https://repo.citizensnpcs.co/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of everything has elapsed or updates are forced

#
<repositories>
        <repository>
            <id>everything</id>
            <url>https://repo.citizensnpcs.co/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
        <dependency>
            <groupId>net.citizensnpcs</groupId>
            <artifactId>citizens-main</artifactId>
            <version>2.0.30-SNAPSHOT</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    ```
#

why is maven looking for org.spigotmc in the CitizensNPC repository

timid jetty
#

With float getAttackCooldown() does the attack cooldown go to 0 before or after the execution of EntityDamageEvent?

quaint mantle
#

you can use it, it's not reset before the event (because if you cancel it it wouldn't have to be reset)

timid jetty
ornate mantle
#

not the spigot api

#

i have the nms dependency locally

timid jetty
#
    <repository>
        <id>everything</id>
        <url>https://repo.citizensnpcs.co/</url>
    </repository>

you have this you need to add another one that does this
<repository>
<id>spigot</id>
<url>spigot version</url>
</repository>

ornate mantle
#

oh my god πŸ’€

#

the error was the remapped mojang classifier

onyx fjord
#

wat is dis

#
magnetMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(
                            NamespacedKey.minecraft(config.getString("magnet-enchant")))),
                    config.getInt("magnet-enchant-level"), true);
#

this is the code

#

magnet-enchant equals UNBREAKING

#

and level equals 3

tardy delta
#

Objects.requireNonNull only gets rid of the warning for you

onyx fjord
#

its because it was uppercase

#

okay umm

limber owl
#

how can I play chest opening animation

onyx fjord
#

/something 1 2
---------------^^ this is arg[1] right?

tardy delta
#

args[0] == 1 and args[1] == 2

#

"something" is command name

onyx fjord
#

and empty argument is null?

#

or empty

tardy delta
#

you cant pass in empty arguments

onyx fjord
#

i wanna check if argument [1] isnt provided

tardy delta
#

check if args.length is 2 then

glossy venture
#

you check the length of the array

#

ye

tardy delta
#

meaning you have an args[0] and 1

onyx fjord
#

ur smart

quaint mantle
#

How can I teleport an entity from an async thread without any delay?

tardy delta
#

go back to main thread

#

async teleportation isnt safe

quaint mantle
tardy delta
#

why not

quaint mantle
#

I'm using a packet listener called PacketEvents

ornate mantle
#

guys whats a redstone diode πŸ’€

#

browsing through a 1.8 project

tardy delta
#

hmm default reload operation for a plugin is to call onDisable followed by onEnable right?

quaint mantle
#

What if I just use a bukkit runnable and set the delay to 0 ticks?

tardy delta
#

thats what i told you, to go back to the main thread

#
// async stuff
// go back to main thread
Bukkit.getScheduler().runTask(plugin, () -> { System.out.println("booo"); })```
quaint mantle
#

It still has a 1 tick delay even if you set it to 0 I think

tardy delta
#

i believe so

quaint mantle
#

I don't want to have any delay though

#

Even if it's one tick

timid jetty
#

In EntityDamageEvent you have Damage Modifier which is deprecated. Is there something else that is being used to calculate final damage or are these events just utilizing the deprecated modifiers.

Follow up to that, is there a way to bypass and instead set final damage and calculate modifiers on your end

timid jetty
#

there is get yeah

#

but no set

slate mortar
#

so what is your goal? what do you need to calculate exactly

timid jetty
#

im setting health of nearby entities on damage event. I want to be able to then modify the health reduction based on the individual resistances of each nearby enemy

#

and i need to do this in varying instances so im wondering if i can bypass the modifiers in EntityDamageEvent and write my own util for it and set the final damage to entities

slate mortar
timid jetty
#

alright thanks

round finch
#

would not just be possible to store last damager entity?

timid jetty
#

elaborate?

round finch
#

if damage from the entity is more then the heath
you dead

#

stores entity

#

idk if my idea is useful

timid jetty
#

thanks, but not entirely what im asking here unless im misunderstanding

round finch
#

ah sorry miss conversion for 1 sec

timid jetty
#

all good

round finch
tawdry python
#

Which one is better for performance? have multiple yml files with small data each or just one huge file?
I want to do constant searches in the files and I want to know which is the best

onyx fjord
#

can i make item normally unstackable?

#

or i just need to make meta unique

ornate mantle
#

is there a way to get all full blocks

#

by full blocks i dont mean chests

tardy delta
#

stream thro the materials enum filtering on Material::isBlock

ornate mantle
#

no

#

chests arent full blocks

#

but they do come in isBLock

#

and so do enchanting tables

tardy delta
#

then remove those manually lol

ornate mantle
#

bruh

#

i need to write every single block in minecraft

onyx fjord
#

copy enum and make ur own

ornate mantle
#

to edit this project

onyx fjord
#

u cna just copy the enum

#

and edit it

ornate mantle
#

there are a massive fuckton of blocks

#

half of them arent full blocks

tardy delta
#

dunno what this is

ornate mantle
#

yeah i saw it rn

#

lemme try

echo basalt
onyx fjord
#

maybne this

#

yea

timid jetty
round finch
timid jetty
round finch
#

Bottom text explains the point

#

some rpgs Monster increase heath if more players is near

onyx fjord
#

what type is universal for anything that can receive message?

#

(player, console)

round finch
#

broadcastmesage?

onyx fjord
#

no no i mean like

round finch
#

ahh receive

onyx fjord
#

someone.sendMessage()

round finch
#

yeah Sender type

#

i know what you mean

onyx fjord
#

CommandSender?

round finch
#

ConsoleSender for Console

onyx fjord
#

ye ye but whats universal for Player and Console

round finch
#

idk confused

onyx fjord
#

i basically wanna send message thru function

#

so Player or Console or anything else

iron glade
hybrid spoke
#

its CommandSender

onyx fjord
#

both are instanceof it right?

tardy delta
#

yes

round finch
#

CommandSender returns different instances

#

Player or console

hybrid spoke
#

either way just require the CommandSender

onyx fjord
#

ye ye gucci

#

i removed like 200 lines of code πŸ˜„

round finch
#

do you still mean receive?

onyx fjord
#

all resolved man

#

thanks for help yall

#

Bukkit.getPluginManager().getPlugin(instance.getName()).onDisable()
Bukkit.getPluginManager().getPlugin(instance.getName()).onEnable()

edit fuck no i found something better

hard socket
#

how can I use same command for multiple classes?

onyx fjord
#

this is good for restart command right?

round finch
#

BlockCommandSender

ConsoleCommandSender

ProxiedCommandSender

RemoteConsoleCommandSender

timid jetty
onyx fjord
tawdry python
#

Which one is better for performance? have multiple yml files with small data each or just one huge file?
I want to do constant searches in the files and I want to know which is the best

round finch
round finch
#

-Chunking

#

plus the sake of organizing

glossy venture
#
[15:43:03 WARN]: could not determine a constructor for the tag tag:yaml.org,2002:java.util.UUID
[15:43:03 WARN]:  in 'reader', line 2, column 17:
[15:43:03 WARN]:       profile-uuid: !!java.util.UUID '2ea7a15b-8309- ...
``` idk what this means
https://paste.md-5.net/sitapoputi.yaml
undone axleBOT
tardy delta
#

that it doesnt find a UUID(String) constructor

glossy venture
#

hm

tardy delta
#

i'm just manually doing UUID.fromString(config.getString("uuid"))

glossy venture
#

yeah

#

ima do that then

#

thanks

misty ingot
#

E

glossy venture
#

yes

misty ingot
#

I wanna make a plugin like the DankMemer bot and give it a global database if possible

#

its my dream plugin

glossy venture
#

pretty sure dank memer uses the reddit api

#

on like r/dankmemes or smth

#

like that

misty ingot
#

I meant the economy and fun commands side of dankmemer

#

cant really show memes in minecraft chat now can I?

glossy venture
#

titles

#

you do have algorithms to allow display of images with boxes in chat

#

or use a map

tardy delta
#

rendering kinda sucks

misty ingot
#

I prefer my memes in 4k ultra hd lcd full retina display

#

also yeah rendering is hell

sterile token
#

What the diff between Executor
#exefute() and Executor#submit()

misty ingot
#

Ctrl+Q

#

if on IntelliJ

#

die if on Eclipse

sterile token
#

I mean when im writing thru the client socket the server listen the request but then doesnt send it back to client

tardy delta
#

execute executes immediately where submit only pushes a new task to the queue iirc

#

read the docs

sterile token
#

submit runs a fture task right?

#

Also some docs are really shity

tardy delta
#

submit returns a future iirc

sterile token
#

I have read 10 diff tutoriales about multi threaded

#

And i didnt fixed it

#

Because the client send the message and the sever receive it, but then it doesnt allow me to send it back to the client

#

Im really sure that is a problem related to threads

#

Lmao i really hate async and threaded things

#

You literally burns your few brains

iron glade
#

you have more than one brain?

timid jetty
#

who doesn't?

rapid aspen
#

This isnt working, i want when some player dies remove permanently one heart and the killer gets one heart

public class onPlayerDeath implements Listener {

    Main plugin;

    public onPlayerDeath(Main plugin) {
        this.plugin = plugin;
    }

    @EventHandler
    public void onPlayerKilled(PlayerDeathEvent event) {

        Player victim = event.getEntity();

        if (victim.getKiller() instanceof Player) {

            Player killer = victim.getKiller();
            if(killer != victim) {

                double vHealth = victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
                double kHealth = killer.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();

                victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(vHealth - 2);
                killer.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(kHealth + 2);

                if(victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 0.0) {
                    victim.kickPlayer("Tu foste banido do servidor por teres 0 coraΓ§Γ΅es!");
                }
            }
            event.setDeathMessage(ChatColor.YELLOW + victim.getName() + ChatColor.RED + "(" + victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() + " CoraΓ§Γ΅es) " + ChatColor.WHITE + "foi morto por " + ChatColor.YELLOW + killer.getName() + ChatColor.RED + "(" + victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
        } else {
                double vHealth = victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();

                victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(vHealth - 2);

                if (victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 0.0) {
                    victim.kickPlayer("Tu foste banido do servidor por teres 0 coraΓ§Γ΅es!");
                }
        }

    }

}```
iron glade
#

Anything in console?

#

is the event firing?

undone axleBOT
rapid aspen
#

there is nothing in console

sterile token
#

Bruh

#

You literally spammed al chat

#

Hahaha

tardy delta
#

class naming conventions gone?

sterile token
#

Agree

tardy delta
#

the java knowledge here is sometimes worser than in a coding server dedicated to java :/

#

method naming conventions gone too

iron glade
#

stream for each

tardy delta
#

put return on the same line

sterile token
#

If the Listener doesnt work its because its not registered or doesnt contains the @EventHandler annotatiom

#

Use a lovely stream

tardy delta
#

if (foods == null) return;

#

streams slow asf

mossy flume
#

that isnt a real suggestion

#

its just his preference

#

streams are slower but you arent going to notice

sterile token
#

I dont really like normal fors I mainly prefer stream

iron glade
#

same

sterile token
#

They take too much lines

#

πŸ˜‚

rapid aspen
sterile token
tardy delta
#

streams unncessecary here

sterile token
#

Because we can see name conversions problems...

rapid aspen
sterile token
#

Not wondering to soundrude

tardy delta
rapid aspen
mossy flume
#

streams are basically never necessary, often used for simplicity

tardy delta
#

we have a ?learnjava command for a reason

mossy flume
#

removing boilerplate loop shit

iron glade
sterile token
#

If you havent learn java before you cant expext getting helped because they will explain you things that you wont understand

#

That one of the main Arguments

#

But meh I dont care you do what you like

mossy flume
#

so debug it

rapid aspen
#

ok

sterile token
#

Pd: no wondering to be rude, just make you realize that you wont really be sucessfull on plugins without knowing the lang itself

iron glade
#

Verano wondering is the wrong word

#

I guess

sterile token
#

My bad english

#

Its really bad

mossy flume
#

put some log messages in between to see if the value is changing as you expect

sterile token
#

You know haya

iron glade
#

no, language?

mossy flume
#

Cant expect others to help you if you havent really tried to isolate the issue

rapid aspen
iron glade
#

Do what @mossy flume suggested

#

Your event is registered, right?

rapid aspen
#

yes

mossy flume
#

are you sure

sterile token
#

@rapid aspen does your event has @EventHandler annotatiom on the method?

tardy delta
#

put sysouts and youll see

mossy flume
rapid aspen
#

Im the dumbest person in the world im sorry for spending your time i register it but it didnt save

sterile token
#

πŸ˜‚ πŸ˜‚ πŸ˜‚ πŸ˜‚ πŸ˜‚

timid jetty
#

Is there such a thing as a set of Material (class Material) so that I could just set a value for all axes instead of needing to do it for each axe type individually

tardy delta
#

no

#

create your enumset yourself

quaint mantle
#

this doesn't necessarily have to do with arrayList?

agile anvil
#

What is foods ?

tardy delta
#

why cancelling the event so many times?

#

lets not expose collections

quaint mantle
#

you should return when you cancel

#

because it is already cancelled

#

because it will go on with the loop

agile anvil
#

Cause you're looping the whole list

iron glade
#

you're cancelling in loop

tardy delta
#
@EventHandler
    public void HeadPlace(BlockPlaceEvent event) {
        for (ItemStack items : foods.itemStacks) {
            if (event.getItemInHand().isSimilar(items)) {
                event.setCancelled(true);
                break;
            }
        }
    }```
iron glade
#

to exit the loop

tardy delta
#

same effect

iron glade
#

didn't even know you could use a return in loop

#

good old break

#

Timar you okay?

quaint mantle
#

Mental breakdown

#

yes

#

I am

#

xD

#

a loop will loop

#

because you don't exit it

iron glade
#

cause you are in a loop

#

it makes sense when you think about it

quaint mantle
#

It only stops when there are no more items

#

no

iron glade
#

nah

agile anvil
#

No

quaint mantle
#

it will stop when there is no more items

agile anvil
#

A loop with loop all over its content it you don't stop it

#

So the code will be over AFTER looping everything

iron glade
#

if you e.g. want to find the first item just grab it and exit early instead of keeping the loop alive

lime jolt
#

anyone know how to get Color from text
like when the user types /name &ePotato I want to print the word potato in the chat but in yellow
but when I do
/name &ePotato
it returns
&ePotato
instead of just
Potato
but yellow

iron glade
#

or a specific item, then you got what you want and don't have to check the other items

quaint mantle
#

so it returns with the color code

lime jolt
#

any example?

agile anvil
#

ChatColor#translateColorCode or something very similar

lime jolt
#

so ChatColor.translateColorCode("&e")?

tardy delta
lime jolt
#

ok thanks

#

I will try that

tardy delta
#

yes

iron glade
#

Might just wanna take args[0]

ancient plank
#

But why

onyx fjord
#

how do i generate some randomass string

lime jolt
onyx fjord
#

impossible to replicate

lime jolt
#
                                        t.setPrefix(ChatColor.translateAlternateColors('&', name));```
#

says translateAlternateColors does not exist

quaint mantle
agile anvil
ancient plank
#

It's translatealertnatecolorcodes iirc

#

Use the javadocs

#

?jd-s

undone axleBOT
quaint mantle
lime jolt
#

alr thx

ancient plank
#

javadocs aren't witchcraft

onyx fjord
#

actually

#

well

#

idk whats better

#

having long that increases every time, or random string generated

#

how big can long be

agile anvil
#

Very long

tardy delta
#

just tabcomplete that method lol

onyx fjord
#

or maybe, there is other way to make item not stackable

ancient plank
#

Can't you set stack size

#

Isn't there a method for that

#

Like max size

quaint mantle
#

:P

agile anvil
#

No

onyx fjord
#

nms

#

@ancient plank

agile anvil
#

Bro I'm sorry but

#

?learnjava

undone axleBOT
ancient plank
# onyx fjord nms

There's a method to set max stack size for the whole inventory but idk if that's what you want

onyx fjord
quaint mantle
#

it's not performant, if you don't wanna learn good Java it's your choice

ancient plank
#

Ic

quaint mantle
#

You did however say you don't give a shit about using breaks, while using a break in this case is proper Java

#

Saying you don't give a shit makes me not want to help no

iron glade
#

Someone literally posted the right solution earlier

ancient plank
#

Your loop will break after the first run, you need to put the break inside the if statement after you cancel the event

tardy delta
#

break just stops the loop and continues with the code after it

onyx fjord
#

you know what

quaint mantle
#

lmao what is this

onyx fjord
#

ima add player uuid + some random numbers

#

for uniqueness

tardy delta
#

yes because if multiple items from your list match , you will cancel the event multiple times, which isnt needed

iron glade
#

You would check only the first item in that case

agile anvil
#

You will stop after the first check, it's like checking the first item

iron glade
#

and if it's not correct you break anyway without checking the other items

onyx fjord
#

wait i can use unix milis

ancient plank
#

I think the "performance decrease" is negligible but good design is good to have

onyx fjord
#

lol

iron glade
#

You break outside the if, so it breaks after checking the first item regardless it being the one ur looking for or not

#

in that case you never get to check all other items

#

yes

#

correct

#

you have to put the break inside the if

agile anvil
#

#0 actually

ancient plank
#

index starts at 0

quaint mantle
#
@EventHandler
    public void HeadPlace(BlockPlaceEvent event) {
        for (ItemStack items : foods.itemStacks) {
            if (event.getItemInHand().isSimilar(items)) {
                event.setCancelled(true);
                break; // Don't check any further, we have found an item that matches
            }
        }
    }
agile anvil
#

And please never start a Java method with a capital letter πŸ™

iron glade
#

I think today is "Ignore java naming conventions" day

quaint mantle