#help-development

1 messages · Page 806 of 1

storm crystal
#

what does it do

hazy parrot
#

it builds some more complex object

weak meteor
storm crystal
hazy parrot
#

not really, but its good to know later on

storm crystal
#

idrk what to learn now tbh

#

havent stumbled upon a mechanic that I wouldnt know how to make currently

weak meteor
#

Can i do smth like: Map<Kit, <UUID, Cooldown>>?

hazy parrot
#

Map<Kit, Map<UUID, Cooldown>> ?

#

you sure can

#

but i wouldn't nest maps

young knoll
#

Make an object to hold stuff instead

storm crystal
#

youll end up like me

river oracle
#

fr stuff like this is cursed as hell
private final Map<ChunkCord, Map<RelCord, WorldboundGenerator>> cache; try to stick to one map at once

young knoll
#

Needs more nesting

river oracle
#

private final Map<UUID, WorldGeneratorCache> serverCache;

#

adding bungee suport be like
private final Map<String, ServerGeneratorCache> networkCache;

young knoll
#

private final Map<String, Map<String, Map<String, Map<String, Map<String, Map<String, String>>>>>>

zenith gate
#

I'm trying to import my library into my project, and I can, I am doing it through jitpack and github. It passed all the tests. IntelliJ does see the library and i do get type sense with it, but when i compile with the library i get a no class found error.

young knoll
#

Are you shading it

zenith gate
#

I've tried with and without.

#

same error

young knoll
#

You have to shade it

#

Make sure it's in the exported jar

zenith gate
#

i can do that with jar tf irc?

zenith gate
remote swallow
#

?paste the error

undone axleBOT
chrome beacon
zenith gate
chrome beacon
#

Wdym it's yours

zenith gate
#

the library that I am using. it's mine. It's Java 17 and my project is also using java 17.

chrome beacon
#

The library you are shading or the shade plugin itself

zenith gate
#

both. they are both Java 17.

chrome beacon
#

sigh

#

Are you using maven or gradle

zenith gate
#

maven

chrome beacon
#

Send your pom

#

?paste

undone axleBOT
zenith gate
chrome beacon
#

Update the maven shade plugin

#

The latest version is 3.5.1

zenith gate
#

maven wont reload...

chrome beacon
#

What happens?

zenith gate
#

had no storage left <:

#

It did fix my issue though thank you.

fleet kraken
#

wrong message

molten hearth
#

If the tool and enchantments immediately exceed the hardness times 30, the block breaks with no delay; otherwise a 6 tick (3⁄10 second) delay occurs before the next block begins to break.
this 6 tick delay is server-side, right?

#

ya i think it is

quaint mantle
#

When it comes to thread safety, if I were to use a thread executor and I have a class to edit stuff in cache

#

should I use consumers

#

so like

#

SomeManager#editConfig(String configID, Consumer<Config> configConsumer);

#

executorservice*

young knoll
#

ShapelessRecipe is a recipe

eternal valve
#

can I do something that can be directed to a special gui with keyboard keys for example: there are 54 slots, I can use the back and forth right and left keys on the keyboard to navigate the slots, that is, I came to the 23rd slot using the back and forth right and left keys on the keyboard and when I press enter, can I command it to enter a different gui....

fleet kraken
#

i want to get the right recipe position in shaped recipe

young knoll
#

Other than the few that are bound to something

eternal valve
#

I mean, logically it can be done, but is it extremely difficult?

#

or is it completely impossible?

young knoll
eternal valve
# young knoll .

ahh now I understand, so when the gui is opened, the keyboard is disabled because the character does not play

young knoll
#

Yes

fleet kraken
young knoll
#

The ingredients array for a shaped recipe is in order

#

From top left -> top right and then down each row

eternal valve
#

I hope they make the plugins more flexible in the future. 😭

river oracle
#

well its likely they're moving towards more data driven registries and stuff so its possible it'll help plugins

#

mostly because they have a small incentive to improve Datapacks and such

young knoll
#

Keybind registry

river oracle
#

near future I'd say its unlikely, but maybe eventually

young knoll
#

Coming 1.69

river oracle
#

exactly

eternal valve
#

I'm confused, I feel like a junior developer. 😅

#

You know the business

river oracle
#

you are a junior developer!

eternal valve
#

the maximum plugin I have made so far is 1920x1080 animated market menu

fleet kraken
#

diamond sword for example:
{a=ItemStack{DIAMOND x 1}, b=ItemStack{DIAMOND x 1}, c=ItemStack{STICK x 1}}

#

i want something like:
(air) (diamond) (air) (air) (diamond) (air) (air) (stick) (air)

young knoll
#

What does the ingredient array for that return

fleet kraken
young knoll
#

There should be a method

fleet kraken
#

what method?

young knoll
#

Ah no you can only get the choice map

#

Well you can use the shape array and the choice map to calculate each slot

fleet kraken
#

how?

young knoll
#

Is the shape array always size 9?

#

Ah wait no it’s 3 strings

#

Which are presumably 3 characters long

fleet kraken
#

i only want to know what slot dont have anything to show the right recipe

young knoll
#

Well technically none

#

A Diamond sword can be crafted in any of the 3 columns

fleet kraken
#

yes

#

i just want to show one

#

Any of them

young knoll
#

Alright, then check the strings in the shape array

#

If each one is only 1 character long then you can just use the middle column

fleet kraken
#

i dont know what method i use to get empty the right shape with empty space char

young knoll
#

?

fleet kraken
#

i want empty space to place the right recipe

#

shape dont return empty char

young knoll
#

You don’t need them

#

If you seed the line is only 1 character long you know it can be in any column

#

Then just pick whichever one you want

fleet kraken
#

the recipe of slab and sword will be the same

young knoll
#

?

fleet kraken
#

[ItemStack{STONE x 1}, ItemStack{STONE x 1}, ItemStack{STONE x 1}]
[ItemStack{DIAMOND x 1}, ItemStack{DIAMOND x 1}, ItemStack{STICK x 1}]

#

same

young knoll
#

This is why you look at the shape array like I said

fleet kraken
#

@young knoll public String[] getShape() ?

young knoll
#

Yes

fleet kraken
#

This is what I'm using, it doesn't return the space characters

#
fun createItemStackList(recipe: ShapedRecipe): List<ItemStack> {
    val shape = recipe.shape
    val ingredientMap = recipe.ingredientMap
    val itemStackList = mutableListOf<ItemStack>()

    for (row in shape) {
        for (c in row) {
            itemStackList.add(ingredientMap[c] ?: ItemStack(Material.AIR))
        }
    }
    return itemStackList
}
young knoll
#

Correct, but it has the shape

fleet kraken
#

i want this: [ItemStack{AIR x 1}, ItemStack{DIAMOND x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{DIAMOND x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{STICK x 1}, ItemStack{AIR x 1}]

not: [ItemStack{DIAMOND x 1}, ItemStack{DIAMOND x 1}, ItemStack{STICK x 1}]

How can I do this?

young knoll
#

You can analyze the size of the array and the size of each entry to determine where items should go

fleet kraken
#

but it will conflitch, same recipes is "equal" in the return

#

slab and sword

young knoll
#

It shouldn’t be

#

The slab should be a 1 length array with a 3 length string

#

Where the sword should be a 3 length array with a 1 length string

fleet kraken
#

the shape size of sword and slab is equal 3

young knoll
#

That doesn’t seem right

fleet kraken
#

yes, but you can try it

#

I've been trying for hours, maybe I'm doing it wrong

river oracle
#

for reference I don't need to map actual java code I just need to read the mappings Ig

#

ig I should just make my own reader

young knoll
fleet kraken
#

can you show me the code?

young knoll
#
  NamespacedKey key = NamespacedKey.fromString(args[0]);
  ShapedRecipe recipe = (ShapedRecipe) Bukkit.getRecipe(key);

  System.out.println(key);
  for (String s : recipe.getShape()) {
      System.out.println(s);
  }
#

Ignore the unsafe code I was lazy

fleet kraken
#

really worked, I was doing logic the opposite of that

fleet kraken
young knoll
#

I mean I can show you some code I guess

#

?paste

undone axleBOT
young knoll
#

Again, bad code but I’m lazy

fleet kraken
#

i will try it

#

@young knoll its working nice! thank you!

lean linden
#

Can I code a plugin that can execute commands of other plugins from console?

eternal oxide
#

yes

#

but it's better to use a Plugins API if it has one

lean linden
eternal oxide
#

plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command);

lean linden
#

Got it, thx

weak adder
#

the method is executed it sends me a msg of starting the edit mode it's ig something to do with the isInEditMode() method

river oracle
#

Is there a way to make TextDisplays rotate to a player?, idealistically without events

sullen marlin
#

isnt that just setBillboard(true)

#

or something

eternal oxide
#

yep

river oracle
#

billboard is an enum

#

ig i'll look at docs

#

ahh yeah BillBoard.CENTER

#

thx

river oracle
#

lol should not have overlapped names with my lib and bukkit

            final sh.miles.ironpipe.api.inventory.item.ItemStack betterStack = IronPipe.newItem(Material.AIR);
            betterStack.setName(MineDown.parse("[Close](color=red format=!italic)"));
            return betterStack.asBukkitCopy();
``` end up with stuff like this
slate tinsel
#

Someone who knows how to make a display entity go smoothly upwards with a player as a passenger

quaint mantle
#

Ok

#

I have been trying to fix this issue for hours and finally came here

#

I have followed the Create a Simple Command wiki page on spigotmc.org to the T

#

But i constantly no matter what i do always get
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "dev.allusive.mulesmp.MuleSMP.getCommand(String)" is null

#

I have watched multiple videos and tried everything

#

I looked through a few spigot threads aswell and applied the solutions but it did not work

eternal oxide
#

command is not in your plugin.yml

quaint mantle
#
name: MuleSMP
version: '${project.version}'
main: dev.allusive.mulesmp.MuleSMP
api-version: '1.20'
authors: [Allusive, allusive-dev]
description: MuleSMP plugin, coded by Allusive provided under Creative Commons
website: https://allusive.dev
commands:
  pick-hunters:
    description: Select hunters with a 5 minute timer
#

I have done absolutley everything i could find

#

Here is my command and main class

eternal oxide
#

open your final jar with any archiver and look at it's plugin.yml

quaint mantle
#

Ok, everything looks fine

eternal oxide
#

?paste your main class

undone axleBOT
eternal oxide
#

remove the - from the command and try without

quaint mantle
quaint mantle
#

I also confirmed after extracting the jar that both the plugin.yml are the same

eternal oxide
#

if the plugin.yml is as you have posted there is no reason for your error

quaint mantle
#

Thats why i came here

#

It makes no sense

eternal oxide
#

drop your jar in here

quaint mantle
#

I can't upload files in this channel

eternal oxide
#

verify

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

eternal oxide
#

I linked that top show you the verify command

quaint mantle
#

so i need a spigot forums account?

river oracle
#

!verify if youw ant

undone axleBOT
#

Usage: !verify <forums username>

eternal oxide
#

if I use it it goes on cooldown

#

yes

quaint mantle
#

i didn't even use the command before and it says Rate limited

eternal oxide
#

yeah Y2K used it 😦

quaint mantle
#

oh

#

There we go

eternal oxide
#

delete the paper-plugin.yml

quaint mantle
eternal oxide
#

odd

#

try adding a blank line before commands in the plugin.yml

quaint mantle
eternal oxide
#

thern the jar on your server is not the one you posted here

quaint mantle
#

uh

#

What

#

it just worked

#

How

eternal oxide
#

I'm going to guess you have been trying to update the jar on your server with it still running

quaint mantle
#

And also delete the world files everytime (i know i dont need to btw)

eternal oxide
#

Ghosts

quaint mantle
#

anyway

#

back to work i guess

#

thanks for your help

eternal oxide
#

np

slate tinsel
#

How do I use "Interpolation" to teleport a display entity smooth?

upper hazel
#

block.getDrops() this metod just for read?

river oracle
#

yes

upper hazel
#

who dug into the states of a note block in a json file? In addition to notes, can you change the tone? Because in the bukkit api it’s possible

lost matrix
clever lantern
#

somebody knows why i get this when opening a book to a player by doing

BookMeta meta = (BookMeta) book.getItemMeta();

assert meta != null;
meta.setTitle("Enter reason");
meta.setAuthor(playerName);
eventPlayer.openBook(book);```
eternal oxide
#

you didn;t set teh meta back to the book

clever lantern
#

lol ty

#

XD

#

i still get this

remote swallow
eternal oxide
#

yeah no pages

clever lantern
#

yeah it works when i added a page

#

but i cant write in it

eternal oxide
#

you created a written book

#

try writable book if you want to be able to write

clever lantern
#

yeah i see

#
Open a Material.WRITTEN_BOOK for a Player``` yeah but i cant open writable to a player i think
remote swallow
#

iirc writable books are client side

clever lantern
#

any other way to enter a bug description in gui

#

?

remote swallow
#

could type in chat or use an anvil

slate tinsel
#

Hello! I'm trying to get a player to fly up as a passenger on an ItemDisplay, right now I'm teleporting the ItemDisplay every tick to make it come up with the player as a passenger, but how can I make it a smoother experience for both the player and the ItemDisplay? Therefore right now the player cannot move freely as they are teleported every tick.

upper hazel
#

how can you cancel the blokBreak event and then place another block there?

upper hazel
subtle folio
#

Hello! I'm trying to detect when a player is duplicating items via the creative menu, for some reason I don't think inventory click event is getting fired when I middle click on the item, I've attached a video of my current state, heres my code:

@EventHandler
    public void onInventoryClick(InventoryClickEvent p_inventoryClickEvent) {
        if (!(p_inventoryClickEvent.getWhoClicked() instanceof Player p_player)) {
            return;
        }

        getLogger().info("1");

        if (p_inventoryClickEvent.getAction() != InventoryAction.CLONE_STACK) {
            return;
        }
        getLogger().info("3");

the logger 3 statement never reaches the console, any help?

lost matrix
#

And its fked

subtle folio
#

of course it does

#

of course it is

subtle folio
lost matrix
#

Let me double check

subtle folio
#

yep it is

#

no need for any changes code wise it looks, just bc its a subclass of the same event i was previously using

#

still doesn't seem to pick up the action or get called during clone :/

lost matrix
#

Print out the actions to check

subtle folio
#

why is every action PLACE_ALL

#

the event doesn't even get called when i duplicate/middle click the item

lost matrix
#

Quite a bit of creative stuff is completely client authoritative. The server doesnt have a saying in it.

shadow night
#

That's why you should use my plugin for beta 1.7.3 that adds a completely server dependant creative inventory!

subtle folio
#

yeah I get that, seems like there is no remorse for this

lost matrix
shadow night
#

Believe me, it's really cool actually

#

And the server starts in moments

lost matrix
#

And programming for that version would be an absolute, complete nightmare for me

#

Like, why would you ever do that?

shadow night
subtle folio
#

bleh

upper hazel
#

will the code still work after the event is canceled?

#

i try but how i undestand not

lost matrix
upper hazel
#

?paste

undone axleBOT
upper hazel
twin venture
#

Hello , iam having a problem with stats system i made .. a map with String (Type of stats ) , and int (value)
but it keep telling me null every time i tried to get the stats

#

so for example i can do

#

SWuser.getStats().put("SWKill",+1);

lost matrix
twin venture
#

but the map is always null

upper hazel
#

oh

lost matrix
twin venture
lost matrix
#

Is your map final? -> if not, make it final

twin venture
#

map = new concu... hashmap

#

i dont think so no

#

oh oky

#

Gonna try that

#

but isnt final mean its not editable?

lost matrix
#

The variable wont be editable. The object itself is not impacted.

twin venture
#

oky great

lost matrix
# twin venture oky great

Another very important thing:
Under no circumstances should you have a setter or getter for mutable objects.
So never for Lists, Sets, Maps, etc.
They should never leave your class. This is very important to write robust code.

twin venture
#

so i need to make a method , like public void addStats(String type,Int amount) ?

lost matrix
#

You got it 🙂

twin venture
#

and use the map?

#

ok thats cool

clever lantern
#

or custom class for stats

#

with whatever implementation behind it

lost matrix
#

Nesting the encapsulation is also a decent idea. Depends a bit on your schema.

upper hazel
#

i gess block paste/break not can be changed?

lost matrix
upper hazel
#

sound

#

paste/break sound

lost matrix
# twin venture SWuser.getStats().put("SWKill",+1);

Ah i think we already talked about this, but make your stat types not a String but an Enum.
It will save you problems which can easily emerge from typos, where you get nothing from your
Database because the name has a typo in it.

lost matrix
upper hazel
#

really?

#

doesn't the whole process happen on the client?

robust helm
upper hazel
#

for custom block

lost matrix
#

A sound packet is sent to the player. Not 100% sure if the client predicts it and plays a sound on his side instead.

subtle folio
lost matrix
robust helm
#

then whats better?

#

using clear and putAll which is basically the same?

lost matrix
#

brb

subtle folio
#

hiding your collections means creating methods and functions that act as the inbetween from your code and the collection

#

If I had a hashmap that stored the uuid of a player in relation to their currency, I would make functions removeAllBalance addBalance etc, and not just interact directly with the hashmap.

robust helm
#

and for saving getAllBalances?

#

but thatd means exposed

subtle folio
#

Yes sure that could work.

#

not if you return a clone. or something of that sort

slate tinsel
#

Hello! I run "cancel" on the Entity Damage Event as the player can take damage from FireRocket explosion but the player still takes damage even though I run cancel

robust helm
lost matrix
robust helm
lost matrix
#

In this case you need to introduce a standard for serialization. There are multiple approaches to this.
Either an interface which returns an intermediate object (Like spigots ConfigurationSerializable interface which returns a Map<String, Object>)
Or an external intrusive approach with reflections.

robust helm
#

i mean the map is just UUID, String

#

String is the name of the selected particle

#

and it will probably be stored in an sql table

lost matrix
# robust helm and it will probably be stored in an sql table

Then this is probably the way to go:

public class ParticleSelectionManager {

  private final Map<UUID, String> particles;

  public ParticleSelectionManager() {
    this.particles = new HashMap<>();
  }

  public String getSelectedParticle(UUID playerID) {
    return this.particles.get(playerID);
  }

  public Set<UUID> getPlayersWithSelections() {
    return Set.copyOf(this.particles.keySet());
  }

  ...
}

It allows you getting all data from within your class without exposing the internal structure.
*This is the solution that doesnt require you to introduce a serialization standard.

robust helm
lost matrix
#

I kind of dislike initializing non-primitive object fields with their declaration because an exception there can be quite nasty.
Its also for consideration for possible future changes. Thats also the reason why i always create brackets for each new scope.
So

if(something) {
  return;
}

Instead of

if(something) return;

Its for code consistency as well.

lost matrix
# robust helm smart. Tysm

This would be a possible future change

  private final Map<UUID, String> particles;

  public ParticleSelectionManager() {
    this(true);
  }
  
  public ParticleSelectionManager(boolean syncSafe) {
    if (syncSafe) {
      this.particles = new HashMap<>();
    } else {
      this.particles = new ConcurrentHashMap<>();
    }
  }

And i would be annoyed if the fields where initialized without a constructor then 🙂

subtle folio
#

perefence until logic is needed

wispy flicker
#

Hi, please @ me once this support has finished :)
I have a question to ask but dont want to interrupt

lost matrix
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

wispy flicker
#

Help with making variables per player

slate tinsel
#

Hello! Am I stupid, or why does the Entity Damage Event not work, but the PlayerQuitEvent works correctly?

public class PopListener implements Listener {
    @EventHandler
    public void onPlayerDamage(EntityDamageEvent e) {
        if(e.getEntity() instanceof Player){
            Player player = (Player) e.getEntity();
            if (PopManager.getPopPlayers().stream().anyMatch(r -> r.getVictim().equals(player))) {
                e.setCancelled(true);
            }
            System.out.println(PopManager.getPopPlayers().stream().anyMatch(r -> r.getVictim().equals(player)));
        }
    }
    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent e) {
        if (PopManager.getPopPlayers().stream().anyMatch(r -> r.getVictim().equals(e.getPlayer()))) {
            System.out.println(PopManager.getPopPlayers().stream().anyMatch(r -> r.getVictim().equals(e.getPlayer())));
            PopManager.removePopPlayer(e.getPlayer());
        }
    }
}```
subtle folio
#

you should compare UUIDs and not direct Player objects

#

e.g. r.getVictim().getUniqueId().equals(player.getUniqueId())

slate tinsel
#

oh

#

Thanks 🙂

sullen marlin
#

I feel like that's not the issue

hazy parrot
#

doesn't players have reference equality ?

sullen marlin
#

Yeah

subtle folio
#

since when?

hazy parrot
#

forever afaik

subtle folio
#

:? I've always had issues of comparing player to player in the past and using uuids instead solved it

subtle folio
lost matrix
twin venture
#

hi , still having the same issuse

#

am i doing it wrongly?

slate tinsel
subtle folio
# twin venture

side note, the m_ thing for your variables should be omitted from your getters

subtle folio
slate tinsel
subtle folio
#

Right, but what's the end goal of the entity damage event

slate tinsel
#

The player should not take damage from rockets

subtle folio
#

so why don't you check the entity type?

#

or the damage cause

slate tinsel
#

I want to check for a certain player not for all players

subtle folio
#

So you want to disable firework damage from a certain player?

subtle folio
#

Well you can store a list of player's uuids who a currently immune to firework damage, then if that list contains the player in the entity damage event and the cause of the damage is a firework, cancel the event.

slate tinsel
#

I already have my "private static final List<PopTask> popPlayers = new ArrayList<>();"

subtle folio
#

iirc firework sends entity explosion as the type?

slate tinsel
subtle folio
slate tinsel
subtle folio
#
final List<UUID> convertedPopList = PopManager.getPopPlayers().stream().map(popTask -> popTask.getVictim().getUniqueId).toList();

if (convertedPopList.contains(e.getPlayer().getUniqueId()) {
  // run logic
}
#

once again as 7smile7 said, you should probably make a method or store a list of uuids alongside your pop task so you dont expose collections

bright spire
#

Hey guys so you have seen this error where exploit clients send a container click packet with -1 slot and cause a server crash.

I am trying to fix it from NMS checks but I cannot seem to be able to achieve this.

glossy venture
#

i think you can intercept the packet before it gets to mc with protocollib or just using netty pipeline injection

bright spire
#

I am not sure what exactly I have to check, because -1 is a legit slot, I check for -1 and non-valid actions, but this does not seem to work

#

@glossy ventureMy problem is not about injection or order

glossy venture
#

oh k

#

ic

bright spire
#

But I don't now what exactly I have to check to fix that exploit

glossy venture
#

never heard about that exploit, have you checked wiki.vg?

#

it says the action table there

#

of valid shit

bright spire
#

it was fixed 1 month ago in latest spigot

chrome beacon
#

A crash report would be useful

bright spire
#

but I am trying to fix it from a plugin

chrome beacon
#

oh

bright spire
#

I thought you guys knew it because its popular

#

I will search for the original github issue

wispy flicker
#

Is someone able to quickly explain the difference between these 2?

       ` Map<Player, ItemStack> playerItemStackMap = itemInSlot;`
       ` playerItemInSlotMap.put(player, (ItemStack) itemInSlot);`

To me they do the same thing but im not sure

chrome beacon
#

Just block the packet like orbyfied said

#

should work

glossy venture
#

hes trying that

bright spire
#

@chrome beaconI dont know what to block

glossy venture
#

yeah

bright spire
#

-1 Is a legit slot unless its combined with something else that I dont know

glossy venture
#

they dk what to check

bright spire
#

That makes the crash happen

glossy venture
#

i know that window id -1 and slot id -1 is the cursor

#

in a set slot packet

#

im pretty sure thats the only valid use

dry hazel
bright spire
#

oh wait I dont check for window id

glossy venture
#

maybe check if the window is != -1 then cancel it

bright spire
#

let me try that

glossy venture
#

note that some actions, at least in 1.8 i think, use slot id -999 im pretty sure

#

like a click outside the inventory window

chrome beacon
#

Yeah

#

Clicking outside would be -999

glossy venture
#

yh

bright spire
#

i think the problem is the window id

#

which i havent checked

glossy venture
#

probably then

#

i think -1 is the only window where slot -1 is valid

bright spire
#

This is the error tho

#

-1 is being used as literal slot for some reason

glossy venture
#

i see

#

goofy

#

yeah ig just check

private boolean cancelPacket(...) {
  int mode = ...;
  int slot = ...;
  int window = ...;

  if (slot < 0) {
    if (mode == MODE_CLICK_OUTSIDE) return false;
    return window != -1;
  }

  return false;
}
#

in the 1.8 mappings the mode field is called shift for some reason

bright spire
#

the problem is not with 1.8 tho

#

look

#

pickup quickmove and clone are valid with -1

#

there is no such thing as click_outside in my case

glossy venture
#

oh true

#

wait is action a part of the packet?

#

isnt there some kind of mode field

dry hazel
bright spire
bright spire
#

I see

#

but this is for 1.8 only

glossy venture
#

nah this is latest

bright spire
#

there is no such thing as "button" in PacketPlayInWindowClick

#

only in 1.8

glossy venture
#

tf

bright spire
#

look

glossy venture
#

action isnt even a field in the network packet

#

maybe minecraft deserializes the mode and button data into an action enum

bright spire
#

im using the already decoded object

#

not redecoding

glossy venture
#

ik but id think it contains raw data

#

like button and mode

bright spire
#

it doesnt

#

wait i think e is button

glossy venture
#

isnt that just bc you dont have mappings

#

yeah arent b c d and e ints

#

?mappings

undone axleBOT
glossy venture
#

1 sec

dry hazel
#

c is the button

glossy venture
dry hazel
#

in a 1.8.8 context

bright spire
bright spire
#

the one i sent is for 1.20

#

for 1.8 i use button

glossy venture
#

ah ok

bright spire
#

seems this checks will do fine

glossy venture
#

so
d = slot
e = button
f = mode (click type)

bright spire
#

i had check for mode but not for button

#

hopefully this works

#

thx man

dry hazel
#

you can also cross-check someone's implementation, like grim or paper

glossy venture
#

true

bright spire
#

i did check paper implementation but ididnt know the mappings tbh

glossy venture
#

there you dont get the click type or action tho u have to decode it manually from the integers which sucks

bright spire
#

thx man

glossy venture
#

are you making an anti exploit or anticheat type thing?

#

looks cool

bright spire
#

I will add you as friend so we can collaborate in anything we need

#

are you cool with that?

glossy venture
#

sure

#

yeah

green plaza
#

How to spawn ArmorStand only for one player and sense if this player is interacting with it

eternal oxide
#

packets

#

you doin;t get events for packet based AS

green plaza
eternal oxide
#

sending packets is easier in remapped, but you have to do a packet listener to listen for interactions

green plaza
weak meteor
#

but doesnt seem to work

past terrace
#

Hey, is there any API for updating resources? If no, why not?

rotund ravine
#

Depends

#

What type of API are you looking for

past terrace
#

Ideally a rest endpoint which would allow me to post an update to my resource

#

what are the available options?

#

My current idea is to act as an user updating the resource. However, I'm afraid I will have issues with Cloudflare and authentication

#

So I'm looking for a simpler way

eternal oxide
#

updating requires 2fa, so a simpler way via an API would not be possible

past terrace
#

Not necessarily

#

I can spoof the xf_tfa_trust cookie

#

I mean, if other platforms can have an update API, why can't spigot?

past terrace
#

:<

young knoll
#

The spigot site is just kinda

#

old

past terrace
#

it is very old

#

while being very popular, unfortunately

young knoll
#

And no-one that works on spigot is really a web dev

past terrace
#

So I have no other option than trying to reverse engineer the mechanism?

young knoll
#

As far as I know, yes

past terrace
#

ewwwww

zenith gate
#

?paste

undone axleBOT
zenith gate
#

https://paste.md-5.net/ugiveposox.xml

java.lang.NoClassDefFoundError: shaded/pine/toast/toastrpg/ToastRPG

Had this issue last night it was fixed, but now this morning when I go to work on it again it's not working.

I am shading my library it does say

But why aren't the classes actually in the jar file

near mason
#

why does instructions like aload_index, astore_index exist why dont they just use the default one with index?

quaint mantle
#

wtf us that

minor junco
#

ASM

quaint mantle
#

is it hard to learn asm

minor junco
quaint mantle
#

u can read and write to memory

#

is that enough

glossy venture
#

aload_0 is the this instance in instance methods so its referenced often

quaint mantle
#

how does bro know what

minor junco
#

What you mean

glossy venture
#

ive worked with bytecode a lot for some project

minor junco
quaint mantle
#

idk i think its a fun project to learn asm

glossy venture
#

idk i just read some tutorials and got started

#

code was dogshit at first

#

but now i think i understand how it works

quaint mantle
#

isn't there multiple asm versions

#

too

glossy venture
#

also to learn about java bytecode decompile java code into bytecode and read that or reference the official jvm specification

glossy venture
river oracle
near mason
quaint mantle
#

so does that mean

glossy venture
#

oh wait i thought u were talking about objectweb asm

#

nvm

near mason
#

java instructions

quaint mantle
#

ryzen and intel have different asm versions

river oracle
slender elbow
#

x86 is x86

river oracle
#

CPU architecture would be x86-64 ARM

glossy venture
#

nah they both usualy use x64 or x86 standard

quaint mantle
#

oh

#

wait so is that what that means

#

like when u install an installer

#

it has some random x64 and x86

minor junco
#

Yeah it isn't it's bytecode

river oracle
#

Yes it's your cpu architecture

quaint mantle
#

oh that's nice to know

minor junco
#

I mixed up bytecode and ASM lol

quaint mantle
#

i think i understand assembly now

river oracle
quaint mantle
#

yeah

#

if I learn asm to a good extend will i be knowledgeable abt the cpu

river oracle
#

I'd highly reccomend an understanding of binary and your cpu before you start

#

Binary is especially important

river oracle
quaint mantle
#

how hard is it to send an http request with asm

river oracle
#

No clue never tried its not trivial though I can send you my hello world code in a bit

quaint mantle
#

my friend

#

did advent of code

#

in asm

#

lol

#

well just one problem

#

it took him like a month

river oracle
#

this is pretty meh asm but its the Hello World code

section .data
    text db "Hello, World!",10,0

section .text
    global _start

_start:
    mov rax, text
    call _print

    mov rax, 60
    mov rdi, 0
    syscall

; input: rax as pointer to string
; output: print string as rax
_print:
    push rax
    mov rbx, 0

_printLoop:
    inc rax
    inc rbx
    mov cl, [rax]
    cmp cl, 0
    jne _printLoop

    mov rax, 1
    mov rdi, 1
    pop rsi
    mov rdx, rbx
    syscall
    ret
#

that's pretty trash implementation though imho you can really shorten it

%macro print 2
    mov rax, SYS_WRITE
    mov rdi, STDOUT
    mov rsi, %1
    mov rdx, %2
    syscall
%endmacro
quaint mantle
#

are you basically moving something into a stream

river oracle
#

no

quaint mantle
#

buffer

river oracle
#

you're moving stuff into a CPU registry

quaint mantle
#

oh

#

for my networking class I got registries

#

as a little thing to teach the class abt

#

aren't those like

#

memory sockets kinda

river oracle
#

then you can take user input

%macro input 2
    mov rax, SYS_READ
    mov rdi, STDIN
    mov rsi, %1
    mov rdx, %2
    syscall
%endmacro
quaint mantle
#

but faster than the ram

slender elbow
# quaint mantle how hard is it to send an http request with asm

most of the "actual" "work" is going to be handled by the kernel anyway through syscalls, you aren't going to be interacting with the hardware because of privileges and stuff the kernel won't let you, you'll ask the kernel to open a socket, you'll ask the kernel to connect to an address, you'll ask the kernel to read from/write to the socket etc, what you'd be doing most is just moving values between memory and registries to adapt for the syscall parameters and return types without losing the data you're handling

river oracle
#

yeah there are so many syscall instructions I can't keep em straight xD

minor junco
#

Keep in mind you shouldn't program big projects in ASM if it isn't out of "fun"/niche reasons. Use C or C++ instead which compiles to ASM

#

ASM is just the lowest programming language there is besides ones and zeros (if you count that in)

slender elbow
#

punchcards tho

#

that's pretty neat

river oracle
slender elbow
#

punchcards through powerpoint

minor junco
#

Lmao

worldly ingot
#

Please don't punch cards

#

They don't deserve it

slender elbow
#

beat them to death

worldly ingot
inner mulch
#

does somebody know if i can stop inellij to combine empty packages with parent packages?

quaint mantle
#

has anyone made anything in bytecode

slender elbow
inner mulch
#

can i set it as default so every project has this?

slender elbow
#

no clue

#

i have trapped a fly between my window and the storm screen

minor junco
# quaint mantle lmao bytecode

Bytecode is intermediary and used for the VM it's the lowest programming language for the JVM, but ASM is the overall lowest language I know of

worldly ingot
#

People have made plenty in ASM though. Rollercoaster Tycoon was infamously made in ASM

minor junco
#

yup games back in the 90s were made with ASM

quaint mantle
#

oh that makes sense

#

yeah I heard abt the rollercoaster game

#

idek how u organize code in asm atp

minor junco
#

ASM for a long time was the only thing there is

river oracle
#

Roll coaster Tycoon

minor junco
#

But then people catched the drift of making higher level languages as soon as the tech sdvanced

river oracle
#

An impressive asm game

#

No one rights raw asm either there are usually plenty of macros involved

minor junco
#

yeah or just C, C is actually a fun language imo

eternal oxide
#

I used to and it was fun, but annoying too

minor junco
#

People dislike C but I like the low-level access without the low level ASM code

green plaza
#

Could someone explain me why sending these 2 packets make one of them not getting interpeted by client?

                NMSPacketWrapper.PlayOutEntityLook.of(
                        armorStand.getHandle(),
                        (fW),
                        armorStand.getHandle().getBukkitYaw(),
                        true,
                        PacketData.of(PacketSendType.SINGLE_PLAYER, player)
                ).sendPacket();

                NMSPacketWrapper.PlayOutEntityRelMove.of(
                        armorStand.getHandle(),
                        (short) (dX * 32),
                        (short) (dY * 32),
                        (short) (dZ * 32),
                        false, PacketData.of(PacketSendType.SINGLE_PLAYER, player)).sendPacket();
#

In this example client totally ignore PlayOutEntityLook packet

#
                NMSPacketWrapper.PlayOutEntityRelMove.of(
                        armorStand.getHandle(),
                        (short) (dX * 32),
                        (short) (dY * 32),
                        (short) (dZ * 32),
                        false, PacketData.of(PacketSendType.SINGLE_PLAYER, player)).sendPacket();

                NMSPacketWrapper.PlayOutEntityLook.of(
                        armorStand.getHandle(),
                        (fW),
                        armorStand.getHandle().getBukkitYaw(),
                        true,
                        PacketData.of(PacketSendType.SINGLE_PLAYER, player)
                ).sendPacket();

But in this example the PlayOutEntityRelMove is ignored

minor junco
#

I assume RelMove may have the possibility of having 2 floats representing the rotation thus leading to the look packet being ignored

#

At least it's the case for client's LOOK, LOOK_POS and POS

lost matrix
#

You either send rot, pos or both

green plaza
#

So i should use PacketPlayOutRelEntityMoveLook?

#

Instead of sending 2 separate?

minor junco
#

yeah try that

green plaza
#

Again another wrapper 😕

#

Pain is my ass

silent topaz
#

how would I get an entitytype's id, nms question

#

in 1.16 I used to do it with IRegistry but now idk how, IRegisstry.ENTITY_TYPE doesnt exist anymore pretty sure

river oracle
#

are you using mojmaps

silent topaz
#

im using the ones that have weird chars idk what its called exactly i keep mixing them up

#

but yeah instead of words its chars

river oracle
#

you should probably switched to mojang mappings

#

it'll make your life easier

#

?nms

river oracle
#

@silent topaz what version are you on

silent topaz
river oracle
#

alr one sec

dry hazel
#

(registries moved to nm.core.registries.Registries by the way)

river oracle
#

yep Registries.ENTITY_TYPE

lost matrix
#

The ResourceKey should just be Registries.ENTITY_TYPE

silent topaz
#

thank you

silent topaz
torn shuttle
#

alright time to finalize this custom model plugin, finally

naive loom
#

Does anyone know if the enchantment table only lets in certain items for inputs?

#

It's not letting me insert regular items that should be enchantable.

rotund ravine
#

I mean

#

You tried and it said no.

#

The obvious answer to your question is yes it does filter

storm crystal
#

should I do methods to manage stuff and then commands that use them or just make commands that manage stuff and use those commands in code

rotund ravine
#

Methods

worldly ingot
#

Preferably you shouldn't be executing commands to invoke logic

shadow night
#

guys, is there some guide on how to run a mc server with my plugin right from ij idea so I can hotswap or something?

serene sigil
#

does anyone know if reading the persistentdatacontainer of a chunk requires a lot of cpu power?

#

basically, i made a very fast rail item that if placed down and ridden, the minecart checks if the rail below it has the persistentdatacontainer tag and if yes it will go very fast

shadow night
serene sigil
#

so its not read from the disc?

shadow night
#

well, if the chunk is in ram, why would it read from disc

serene sigil
#

i see

#

so i dont need to try to cache it

#

in a list or sth

#

its basically the same then

shadow night
#

yeah ig

wet breach
# serene sigil so its not read from the disc?

well if the chunk that the pdc belongs to isn't loaded, you will need to load it to do anything further. How useful your cache is depends on whether the data needs to be live for prolonged periods of time or not. But you will need to have the data live if you intend to write to it.

wet breach
shadow night
wet breach
#

not entirely sure, let me see if I can find you a link

wet breach
#

on the left it seems they have a guide on how to use it with intelliJ

#

hopefully this works out for you, so have fun 🙂

rotund ravine
#

Will probably be funky working with a live server if ur testing stuff on it

storm crystal
#

any better way to set enemy health bar colour based on their missing health?

#

or would those 4 ifs suffice?

ornate patio
#

Hello, I have a small problem with the meta data in 1.7.10 spigot when the item is corrupted and there is a meta data (id) getDurabilty() and item.getData().getData() it returns the durability but I don't see how to recover the meta data (id)

#

Can you help me please thank you in advance

hazy parrot
#

1.7.10? 😳

river oracle
#

whats the ip 😈 there is definitely no exploit with logging on that version

river oracle
#

I never got a chance to play with log4j it'd be fun come on man I can just run rm -r on your server folder or something

scenic onyx
ornate patio
river oracle
#

Guys!!! its only 10 years old give him a break!

#

the PVP worked better!!!

#

come onnn

#

have a positive attitude

#

the logging exploits worked better back then too 😈 still waiting for that IP

river oracle
#

I mean saying you'll get good help for 1.8 is really generous too

ornate patio
#

Okay

river oracle
#

Does C have any kind of generics? I'm trying to make a linked List implementation so I can make a HashTable for my project

hazy parrot
#

Only generic pointer

#

void *

#

But it's 0 typesafe

dry hazel
#

preprocessor macros are your friend

river oracle
dry hazel
#

you can make typed variants of your linked list

river oracle
#

expound please

dry hazel
#

(project is irrelevant, it just has good lists)

rotund ravine
river oracle
#

this stuff goes way above my head xD

#

like wat

#define DLIST_LINK_T(T)           \
  typedef struct DLIST_LINK (T) { \
    T prev, next;                 \
  } DLIST_LINK (T)
#

I thought C didn't have generics

#

what is this header file magic

dry hazel
#

that's a macro lol

river oracle
#

I've heard macros can be cursed is this true xD

#

tbf all this code looks cursed asf

river oracle
#

I thought the point of header files was to not do implementation

dry hazel
#

macros are not really implementation, they just define, well, macros

#

to use in other files

#

I sent that way too early, sorry

river oracle
#

yeah but would woukd T even be since generics do not exist

dry hazel
#

if you do DLIST_LINK_T(int), the preprocessor replaces it for

typedef struct DLIST_LINK_int {
    int prev, next;
} DLIST_LINK_int;

iirc

grim hound
#

called health

#

make them all else if's

river oracle
#

I kinda just want a simple linked list 🥲

grim hound
river oracle
#

didn't think it'd be this hard

dry hazel
storm crystal
river oracle
#

maybe I'll do both

rotund ravine
storm crystal
grim hound
storm crystal
#

if damage dealt makes their hp less or equal than 0 then just 0 / max health

grim hound
rotund ravine
grim hound
#

but do the else if thing fr

#

like why do you even check for all 4?

storm crystal
#

because I couldnt find a better method?

storm crystal
# rotund ravine Show me
if (healthLeft > 0.66* entity.getHealth()) entity.setCustomName(ChatColor.DARK_RED + enemy.getName() + ChatColor.GREEN + " " + healthLeft + ChatColor.DARK_GRAY + "/" + ChatColor.GREEN + enemy.getMaxHealth());
        if (healthLeft > 0.33*entity.getHealth() && healthLeft <= 0.66*entity.getHealth()) entity.setCustomName(ChatColor.DARK_RED + enemy.getName() + ChatColor.YELLOW + " " + healthLeft + ChatColor.DARK_GRAY + "/" + ChatColor.YELLOW + enemy.getMaxHealth());
        if (healthLeft <= 0.33*entity.getHealth()) entity.setCustomName(ChatColor.DARK_RED + enemy.getName() + ChatColor.RED + " " + healthLeft + ChatColor.DARK_GRAY + "/" + ChatColor.RED + enemy.getMaxHealth());
        if (healthLeft <= 0) entity.setCustomName(ChatColor.DARK_RED + enemy.getName() + ChatColor.DARK_RED + " 0" + ChatColor.DARK_GRAY + "/" + ChatColor.DARK_RED + enemy.getMaxHealth());
rotund ravine
#

You do repeat quite a lot

storm crystal
#

like what

rotund ravine
#

What’s healthLeft btw

storm crystal
#

health left?

grim hound
#

and the very custom name syntax

rotund ravine
grim hound
#

as well as the diabolic if statements

storm crystal
rotund ravine
#

Okay.I am assuming ur if statements are meant to use maxhealth then?

storm crystal
#

I was asking if there is a better way to handle checking whats the value of it, not how to make it sound better in case a 8 year old decides to read my source code

#

I dont get the point of making separate variable for entity.getmaxhealth()

#

its like a few letters difference

grim hound
#

give me a sec

#

amma format this

#

cuz this is

#

eye-hurting

storm crystal
#

dont forget to mention how awful it is again

rotund ravine
#

is enemy and entity the same?

grim hound
#
ChatColor color;
        
        if (healthLeft > 0.66 * health) color = ChatColor.GREEN;
        else if (healthLeft > 0.33 * health) color = ChatColor.YELLOW;
        else if (healthLeft <= 0) {
            color = ChatColor.DARK_RED;
            healthLeft = 0;
        }
        else color = ChatColor.RED;

        entity.setCustomName(ChatColor.DARK_RED + enemy.getName() + color + " " + healthLeft + ChatColor.DARK_GRAY + "/" + color + enemy.getMaxHealth());
        
    
rotund ravine
#

I am cofnused is enemy and entity the same?

grim hound
#

it works exactly the same

#

but better

#

and faster

#

and stronger

rotund ravine
#

Why is entites name set based on enemies hp/maxhealth?

storm crystal
#

relevance?

rotund ravine
#

So i can make sense of what i need to write

grim hound
#

use this

#

please

rotund ravine
#

        double healthLeft = enemy.getHealth() - damage;

        var maxHealthAttr = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH);
        if (maxHealthAttr == null) {
            return;
        }
        var maxHealth = maxHealthAttr.getValue();

        var color = healthLeft > 0.66*entity.getHealth() ? ChatColor.GREEN
                : healthLeft > 0.33*entity.getHealth() ? ChatColor.YELLOW
                : ChatColor.RED;
        entity.setCustomName(color + enemy.getName() + " " + color + healthLeft + ChatColor.DARK_GRAY + "/" + color + maxHealth);
#

we love var

grim hound
#

your using this

rotund ravine
#

just start the variable as red

grim hound
#

ye

rotund ravine
#

Also getMaxHealth is deprecated over the use of the attributes api

storm crystal
grim hound
#

so don't care

rotund ravine
grim hound
rotund ravine
#

Nomnomnom

#
    private void bar(LivingEntity entity, float damage){
        double healthLeft = enemy.getHealth() - damage;
        var maxHealth = retrieveMaxHealth(entity);

        var color = healthToColor(healthLeft);
        entity.setCustomName(color + enemy.getName() + " " + color + healthLeft + ChatColor.DARK_GRAY + "/" + color + maxHealth);
    }
    
    private ChatColor healthToColor(double health) {
        return health > 0.66*enemy.getHealth() ? ChatColor.GREEN
                : health > 0.33*enemy.getHealth() ? ChatColor.YELLOW
                : ChatColor.RED;
    }
    
    private double retrieveMaxHealth(Attributable attributable){
        var maxHealthAttr = attributable.getAttribute(Attribute.GENERIC_MAX_HEALTH);
        if (maxHealthAttr != null) {
             return maxHealthAttr.getValue();
        }
        return 0;
    }
storm crystal
#

lol

rotund ravine
#

Why are you doing

#

entity.setCustomName(color + enemy.getName() + " " + color + healthLeft + ChatColor.DARK_GRAY + "/" + color + maxHealth); then?

storm crystal
#

because I can

rotund ravine
#

Ur useless then sigh. Well whatever, try not to repeat ur self so much.

grim hound
#

NO

rotund ravine
#

I wrote that java code with so many vals and syntax errors at the start

storm crystal
#

enemy has stored values of name, type, max health, static statistics

hazy parrot
#

You use kotlin and u don't cringe when write var in java xd

rotund ravine
storm crystal
#

because, as the name suggests, its a fucking dao lol

rotund ravine
#

It doesn't make sense though ur setting the name of "entity" to something releated to enemy

storm crystal
#

anything that happens to entity happens to that entity that is living right now

rotund ravine
#

Okay, so entity and enemy represent the same thing?

storm crystal
#

enemy is a row taken from enemyStats db

grim hound
storm crystal
#

entity is that particular entity that's living and happens to have stats of said enemy

rotund ravine
#

Alright, name it enemyEntity then

storm crystal
grim hound
#

"Why did you kick that pregnant woman?"
"Cuz I can"

rotund ravine
#

and the enemy to enemyStats

storm crystal
#

dont expect me to take you seriously after that lol

storm crystal
rotund ravine
#

We want to be able to know what is going on based on naming

storm crystal
#

you can just ask

#

xd

rotund ravine
#

It wasted my time

#

Like 5 minutes

#

maybe 3

#

to get a proper answer from you

grim hound
storm crystal
#

you said that you enjoy helping people

#

so dont guilt trip me

#

about me supposedly wasting your time, it was your conscious decision

rotund ravine
#

Instead of wasting our time do something productive with ur code so we can help you instantly instead of needing wayy too many followup questions.

bitter rune
#

always good to name your variables something people understand; common practice and however you learned coding; it should have stated that as well

storm crystal
#

im not going to post all of my classes as context everytime I ask for help in a piece of code

#

its like

#

totally, completely irrelevant

rotund ravine
#

We do not need that.

storm crystal
#

what they mean

#

they might as well be named variable1 variable2

#

I wasnt asking for that at all

bitter rune
#

with variabels and methods that are named in a way people understand what they do you dont need everything

rotund ravine
#

My followup questions were.
What is healthleft? We didn't see a declaration.
What is ... for the setCustomName? Cause we didn't see ur methods setting them.
What is enemy? Cause apparently entity was set to something related to enemy?

#

These three would have been answered if first, ur questions was asked properly.

storm crystal
#

you didnt need anything because I was asking about something else

#

execution of checking if a numbers is between X1 and X2

#

thats it

rotund ravine
#

any better way to set enemy health bar colour based on their missing health? Image or would those 4 ifs suffice?

#

Was your original question.

storm crystal
#

which was literally what it meant

rotund ravine
#

Which isn't really the best question, but we got there.

storm crystal
#

4 ifs that compare numbers

rotund ravine
#

For that we needed to know what healthleft was.

#

Since you were comparing it to entity.getHealth

storm crystal
#

not really

rotund ravine
#

We certainly did.

storm crystal
#

what happens if you dont know it

rotund ravine
#

Then we would be thinking that it is some arbitrary number that can't be compared to getHealth

#

healtLeft and getHealth sortof means the same.

storm crystal
#

ifs are literally made out of if (var1 >/</>=/<= var2)

#

would you assume they are strings

#

or arrays

rotund ravine
#

I could assume you're comparing the current health to the current health.

#

Which is why my first question was what is healthLeft

#

A perfectly valid assumption might i add.

#

Then i would assume you mixed up entity and enemy cause they're so close together in spelling in ur setCustomName.

#

Perfectly valid assumption again.

storm crystal
#

not at all

#

you assume that comparing var1 and var2 means comparing var1 to var1

rotund ravine
#

And it could be, cause we don't know they were different variables.

storm crystal
#

why would I write 4 ifs to compare same numbers

#

next time ill throw entire jar and make variable names entire paragraphs in case someone might think otherwise, if only it was any relevant lol

rotund ravine
#

To enhance clarity and streamline your code, consider the following suggestions:

Variable Naming: Instead of using generic names like "entity" and "enemy," differentiate between them for clearer understanding. For example, use "enemyEntity" for the entity with stats from the enemyStats database and "enemyStats" for the row from the database.

Method Refactoring: Break down your logic into separate methods to improve readability and maintainability. Your bar method could be split into smaller methods, such as healthToColor and retrieveMaxHealth, making the code more modular.

Use Attributes API: While getMaxHealth may work, consider using the Attributes API for better practices. Since getMaxHealth is deprecated.

Document Your Code: Add comments to explain the purpose of your methods and any unconventional coding decisions, making it easier for others (or yourself) to understand your code.

These changes aim to enhance code readability, maintainability, and adherence to best practices.

storm crystal
#

im doing solo code and I get what I write

rotund ravine
#

Then don’t ask us for help.

storm crystal
#

also you are overexaggerating

rotund ravine
#

You’ve now been told how to somewhat make it readable.

storm crystal
#

by a lot

#

as if I was doing naming such as var1 var2 var3 varn

rotund ravine
#

I am a little. But explaining it now versus later is better.

storm crystal
#

you're telling me for like 10th time that you wont help me

#

make your mind

rotund ravine
#

Aren’t i nice?

storm crystal
#

bipolar a little, not really nice lmao

rotund ravine
#

I wish i was bipolar when dealing with this.

#

It appears you may have encountered some challenges with accessing online resources for learning Java. Allow me to guide you without providing specific links; it should be sufficient unless, of course, you're operating on zombie mode.

storm crystal
#

I had my problem resolved so I dont need anything else lol

#

pretty funny how it could've been answered with "no, if/else is good enough for that"

grim hound
#

to that

grim hound
storm crystal
rotund ravine
#

@young knoll He called me bipolar, can i get such a role?

grim hound
#

a formatted version

bitter rune
#

you get what you write but obviously java, and spigot does not understand what you write

grim hound
#

of your code

rotund ravine
#

It’d be funny to roleplay as bipolar

grim hound
#

so that you can understand

#

why it was awful

#

and how you can learn better coding hazards

storm crystal
grim hound
#

and by exagerrating I made sure you'd remember

storm crystal
#

but I guess you like overexaggerate whatever I say

grim hound
#

but I didn't know you were so

storm crystal
grim hound
#

how can I say this

#

uncooperative

storm crystal
alpine urchin
#

hey

proud badge
#

what would sender.getName() be equal to if I used console?

#

"Server"?

alpine urchin
#

so good you mentioned you are developing a ban command

grim hound
#

the man himself

alpine urchin
#

you probably wanna deal with arguments in commands

#

/ban <player-name> right?

rotund ravine
alpine urchin
proud badge
#

and <reason>

alpine urchin
#

then the player name you wanna get is an argument, no>

#

why do you want the command sender's name?

glossy venture
#

prob for notifications

proud badge
#

broadcasts to all online staff the ban reason and who banned them

glossy venture
#

yeah

#

i just use sender instanceof Player ? ((Player)sender).getDisplayName() : ChatColor.AQUA + ChatColor.BOLD + "CONSOLE"

#

usually

rotund ravine
#

Ohoh, what about when a Zombie does it

alpine urchin
#

XDD

glossy venture
#

lmoa

alpine urchin
#

are you sure that code compiles

proud badge
#

hmm wait I just realised

clever musk
#

Method to get player forward vector for ray tracing?

glossy venture
#

im too lazy to add a "" inbetween the chatcolors tho

proud badge
#

args[1] wont work for my ban reason if my ban reason is multiple words long

#

as it will only take the first word

glossy venture
#
StringBuilder reasonBuilder = new StringBuilder();
for (int i = 1; i < args.length; i++) {
  reasonBuilder.append(args[i]).append(" ");
}

String reason = reasonBuilder
  .deleteCharAt(reasonBuilder.length() - 1) // remove trailing space
  .toString();
proud badge
#

ok thanks

hazy parrot
#

String.join exist

rotund ravine
#

Imagine using stringbuilder

river oracle
#

StringBuilder is great!

hazy parrot
#

String.join(args, " ")

#

Or smth like that

river oracle
#

though in this case oyu probably should do String#join

rotund ravine
#

Need to skip the first one

glossy venture
#

use copyOfRange ig

#

idk the signature for String.join tho so thats pseudocode

#

possibly

river oracle
#

if you're going to skip the first one your best off just using a for loop then

#

if you copy it you're doing extra unecessary work

glossy venture
#

doesnt really matter when its run on a command but just showing different options

#

id join it using the loop yeah then u can also process potential flags or smth

rotund ravine
#

Totally

#

String result = list.stream().skip(1).collect(Collectors.joining("")

#

Well

glossy venture
#

100% compiles yes

rotund ravine
#

With an arraysaslisg

alpine urchin
#

lol

glossy venture
#

i love arraysaslisgs

rotund ravine
#

Close enuf

glossy venture
#

also isnt there supposed to be a space in the string arg to joining() and another closing paren

proud badge
#

also can I not combine two colours?
ChatColor.WHITE+ChatColor.BOLD

glossy venture
#

colorA + "" + colorB

#

kinda sucks

proud badge
#

Ok thanks

remote swallow
#

to string one of them or add a string

glossy venture
#

but you cant concat two objects

#

like that

wet breach
#

even that won't work well as the second color would take affect unless you have a character to show the first color

remote swallow
#

ChatColor.WHITE.toString() + ChatColor.BOLD

glossy venture
#

toString is even longer tho

remote swallow
#

i mean yeah but it looks better

glossy venture
#

ig

storm crystal
#

how do I make enemy ai

rotund ravine
#

That’s a loaded question

storm crystal
#

not chatgpt ai type deal lol

rotund ravine
#

Ur asking without context

storm crystal
#

enemy ai, thats the context

#

idk what context you want