#help-development

1 messages · Page 1744 of 1

golden turret
#

?paste

undone axleBOT
untold rover
#

Git bash ❌

somber ember
#

can someon answer pls ?

tender shard
#

what's wrong with git bash?

untold rover
#

doesn't work

tender shard
tender shard
somber ember
#

..

#

...

untold rover
#

gives me the same issue in gitbash as in Powershell or cmd

tender shard
#

FFS just rename the directory to a "normal" name and try again

untold rover
#

its not that easy...

tender shard
#

it's one right-click, one left-click, entering the new name and hitting return

untold rover
#

oh yea and then I have to fix like 50 other Projects.

tender shard
#

if you hardcode that path all the time, you messed up biiiig time way earlier

golden turret
#

hello my friends. Im trying to create a custom block with inventory (clay block with inventory 😎) this is my current code: https://paste.md-5.net/ejubacohay.java
when i drop an item to a hopper above my block, it spam my console (print) and the item dont leave the hopper. any help pls

somber ember
#

and it still keep giving money even tho i changed to something else

untold rover
tender shard
untold rover
#

because Gradle is stupid

tender shard
#

although I hate gradle, I wouldnt call it stupid 😄

#

well then just do this:

#

move or copy your current project to any folder without spaces/special chars, try to run the javadocs there and see if it works now

#

if so, we know that the folder name is the issue

#

and then we can find out how to get it working because tbh it should work with ANY valid directory name

#

but it doesn't make sense to spend hours trying to fix it unless we know where the problem is

tender shard
#

ping me there when you opened it and we can have a look

lost matrix
golden turret
#

clay with inventory

untold rover
somber ember
#

and also how do i do the, command for voting list ?

wild marten
#

im tryna use nms for the first time and when I build my jar i get this error
package org.bukkit.craftbukkit.v1_17_R1.inventory does not exist
my 1.17.1 jar is in the libraries in my project structure too

sullen marlin
#

why on earth do you need nms for an inventory

wild marten
#

well its for nbt tags

sullen marlin
#

which you need why?

wild marten
#

trying to store data in the nbt so its much easier to access

sullen marlin
#

PersistentDataContainer

wild marten
#

o wat r they

sullen marlin
#

no nms required

lost matrix
#

?pdc

wild marten
#

does that work in 1.17?

somber ember
#

alright so everytone is ignoring me now okay

midnight crow
#

Hey all, what's the the procedure for going about creating an async method?

#

I'm trying to query my database to update a progress bar (boss bar) and do it async so it doens't slow down my main thread- any thoughts?

#

Here's what I've got right now as a skeleton: ```@EventHandler
public void onPlayerJoin(PlayerJoinEvent ev) {
BossBar bar = Bukkit.getServer().createBossBar("Zombie Quest", BarColor.GREEN, BarStyle.SEGMENTED_10, BarFlag.CREATE_FOG);
bar.removeFlag(BarFlag.CREATE_FOG);
bar.addPlayer(ev.getPlayer());
}

@EventHandler
public void asyncProgressUpdater(Player p) {
    
}```
#

Thanks!

onyx fjord
#

I generally use bukkittask

wild marten
onyx fjord
#

, period, delay

quasi stratus
#

I am having trouble enabling the listeners for my plugin using this code

#
        getServer().getPluginManager().registerEvents(new FLevelChangeEvent(), this);
        getServer().getPluginManager().registerEvents(new FLoginEvent(), this);
#

The first enables, but the second does not. Any ideas as to why?

quaint mantle
#

No human on earth is going to know why if that's the only code you're showing them

quasi stratus
#
public class FLoginEvent implements Listener {

    @EventHandler
    public void onLogin(PlayerLoginEvent event) {

        Bukkit.broadcastMessage("A player joined, refreshing the firmament.");
        FirmamentPlugin.worldBorder.refresh(false);

        // If the player spawns outside the firmament
        if ((FirmamentPlugin.worldBorder.getRadius() < event.getPlayer().getLocation().getBlockX()) || (FirmamentPlugin.worldBorder.getRadius()< event.getPlayer().getLocation().getBlockZ())) {
            event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, (15 * 20), 4));
            event.getPlayer().sendMessage(ChatColor.BLUE + "You are temporarily invulnerable for 15 seconds.");
            event.getPlayer().sendMessage(ChatColor.BLUE + "Your grace period will end soon; ensure that you are within the firmament's borders.");
        }

    }

}```
#

does this help? sorry im new to this lol

onyx fjord
#

@quasi stratus bro make the player a variable

quaint mantle
#

lol

onyx fjord
#

Player p = event.getPlayer()

quaint mantle
#

Also if youre going to be doing stuff to the player entity use the PlayerJoinEvent

#

You're basically trying to do stuff to the player when they aren't even loaded in yet, this is most likely your issue

#

Also I don't think your location checking is accurate. Might want to rethink your approach on calculating that.

quasi stratus
quaint mantle
lyric jasper
#

How do I import this?

#

I have already tried to add 1.17.1 version as a library

wild marten
#

u need to add the spigot jar not the minecraft launcher jar

sullen marlin
#

& why do you need nbt for this

somber ember
#

how does it show the, links for website ? the nuvotifier?????

#

i putted links doesnt show and doesnt allow to vote for others

subtle folio
#

how do i give the player 1 of what they are holding?

somber ember
#

here u can see it i putted all links and doesnt work still and others cant vote .. when u do /vote its just disappears and nothing happens

sullen marlin
#

fist of all this is a development channel

#

second of all, # is a comment

#
  • Player.getInventory
subtle folio
somber ember
#

so im on wrong think then... where do i ask it then ? on help channel

subtle folio
#

and then gives them one

#

i dont want it to edit their inventory

sullen marlin
#

clone the item before setting the amount

subtle folio
#

thats my question

#

how 2 clone

sullen marlin
#

.clone() ?

subtle folio
#

bet ty

somber ember
#

how i comment in spigot webiste i verifyed my acc but cant see whre to comment in forums for help

#

i cant do it its pain in the head ... no one is showing how to add websites or to use them in game or why others cant do vote ..

lyric jasper
lyric jasper
sullen marlin
#

can you not use Minecraft's native structures?

lyric jasper
#

If I want a compatible plugin i have to work with both formats

fallow merlin
#

How do I force an Illusioner (or any IllagerWizard) to do its spell casting thingy?

midnight crow
#

Hey guys, I'm trying to make boss bars indicate specific player progress. How should I go about this?

#

specific player progress towards a quest goal, essentially. Is there a library that handles this? Or should I stick with the bukkit.bossbar library?

proud basin
#

How would you go about to parse a unicode into an object

waxen plinth
#

That question doesn't make sense

waxen plinth
proud basin
#

What doesn't make sense about it?

#

How would you parse unicode into an object

sullen marlin
#

what unicode into what object

#

I agree the question doesn't make sense

proud basin
#

emoji's

young knoll
#

You have a Unicode representation of an object?

sullen marlin
#

you don't need to parse anything, just put the emoji in

proud basin
#

no?

midnight crow
#

I feel like I need a Player.getBossBar method in order to update the bar as the player completes tasks

young knoll
#

Map the boss bar to a player’s uuid

midnight crow
#

but that doesn't exist. Kind of stumped

noble lantern
#

HashMap<UUID, BossBar>

midnight crow
#

Yeah that makes sense

noble lantern
#

Just make sure that when players leave the server you clear the instance from the HashMap

midnight crow
#

Yeah sure thing

#

Thanks

patent horizon
#

would anyone know why the values of my hashmap are returning null when i do new Class().hashmap().get() from another class

fallow merlin
#

what does PathfinderGoalCastSpell do?
the method inside of it is just empty

young knoll
#

I imagine it’s for casting spells

fallow merlin
#

well yes but it looks like this

protected PathfinderGoalCastSpell() {}
young knoll
#

It probably gets overridden

muted sand
#

How would I save player data into a database-
i found this https://gist.github.com/graywolf336/8153678, but it's throwing java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 41)

#
    @EventHandler
    public void onHi(PlayerJoinEvent event) throws IOException {
        Player player = event.getPlayer();
        Bson filter = Filters.eq("_id", player.getUniqueId().toString().replaceAll("-", ""));
        Document findIterable = collection.find(filter).first();
        if (!(findIterable == null)) {
            System.out.println(findIterable.get("inv"));
            Inventory a = fromBase64((String) findIterable.get("inv"));
            System.out.println(a);
            player.openInventory(a);
        }
    }

It's getting data from mongodb

fallow merlin
#

I get this error when I try to use specialsource
Failure to find org.spigotmc:spigot:jar:remapped-mojang:1.17.1-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigotmc-repo has elapsed or updates are forced

midnight crow
#

How can I make a boss bar without any bar flags?

young knoll
#

Don’t pass any flags?

midnight crow
#

Right now Im initializing it with a flag and then immediately removing the flag lol

#

It's a NonNull

#

Sike

#

big sike I was being dumb

patent horizon
#

player.getInventory().remove(new ItemStack(Material.PUMPKIN_SEEDS, 50));
so i already know this ^ is wrong, but how would i do this if there wasn't an exact stack of 50 seeds and if those seeds had any kind of extra meta?

fallow merlin
#

I think that would work regardless of stack size as long as its more than 50

patent horizon
#

no

#

when i have a stack of 64 seeds it doesn't remove

#

but it does when i have 50

fallow merlin
#

huh

fallow merlin
#

How do I fix this error with specialsource

buoyant viper
#

a little too lazy to test rn, does calling setSprinting fire a PlayerToggleSprintEvent?

#

or is that only fired when a player actually does the action

hardy agate
#

hi, how do you make a tab completer for a second argument?

/<command> <arg 1> <arg 2>
^^^^

young knoll
#

Check the arg length in the tab complete method

hardy agate
#

how?

#
if (args = 1) {
  arguments.add("foo");
} else if (args = 2) {
  arguments.add("bar");
}
#

like that?

young knoll
#

args.length

vernal pier
hardy agate
#

right

#

but that will work?

glad badger
#

missing an =, but on the right track

hardy agate
#

ya know what? I'm used to autocomplete in my ide

#

don't judge

#

well, you can judge a little

#

that would actually be a cool feature for discord to add tho

quaint mantle
#

discord isnt an ide

hardy agate
#

but it could be

glad badger
#

but it shouldn't be

hardy agate
#

yes, but like I said, it could be

#

Imagine an IDE

eternal oxide
#

I have one

#

its not Discord

glad badger
#

My IDE is googling "Online Java Compiler" and crying when it times out on me

hardy agate
#

oof

#

also

#
if (arguments.isEmpty() && args.length == 0) {
             arguments.add("logins"); arguments.add("playerKills");
             arguments.add("deaths");  arguments.add("mobKills"); 
         } else if (args.length == 1) {
             arguments.add("test");
         }
#

this does not work

#

sad

#

but I have no idea why

quaint mantle
#

what are you doing 🤨

eternal oxide
#

args is an array? so has no isEmpty() method

hardy agate
#

arguments is the tab complete menue

eternal oxide
#

ok so a List

hardy agate
#

not to be confused with the args

hardy agate
quaint mantle
#
private final List<String> tabComplete = Arrays.asList("logins", "deaths", "playerKills", "mobKills");

//

if (args.length == 1) {
    return tabComplete.stream()
        .filter(str -> str.startsWith(args[0])
        .collect(Collectors.toList());
}
young knoll
#

Just use copyPartialMatches

quaint mantle
#

whats that

quaint mantle
#

thats so implicit only little people would know the use

#

im sticking with my streams

hardy agate
#

tabComplete in this case is my arguments?

quaint mantle
young knoll
#

I'll stream you

quaint mantle
#

Dont threaten me with a good time

hardy agate
#

and what is private final (I'm new to java)

quaint mantle
#

can only be accessed inside the class
cannot be modified after assignment (unless through reflection)

hardy agate
#

but wouldn't I want to modify it?

glad badger
#

.-. And Java 16 has some funky ways to even stop reflection

quaint mantle
hardy agate
#

to add the second set of tab compeltes?

quaint mantle
#

its all there

hardy agate
#

/<command> <arg 1> <arg 2>

#

how do I make arg 2 have a tab complete

quaint mantle
#
if (args.length == 2) {
    return secondTabComplete.stream()
        .filter(str -> str.startsWith(args[1])
        .collect(Collectors.toList());
}
eternal oxide
#

you do it by the length of args

hardy agate
#

oh so I just make another variable

quaint mantle
#

no?

#

its already made

hardy agate
#

secondTabComplete

quaint mantle
#

yeah thats the private final

eternal oxide
#

lol no

glad badger
#

just...um

quaint mantle
#

and name it better

hardy agate
#

low level languages are scary

#

ok?

quaint mantle
#

java is medium

glad badger
#

Just go to basics.

  if(args.length == 0) {
    // return a list of stuff for the first argument.
  } else if(args.length == 1) {
    // return a list of stuff for the second argument.
  }
hardy agate
glad badger
#

They don't know lambda

quaint mantle
#

im trying to teach them

quaint mantle
hardy agate
#

ok, so this goes back to the whole "second variable"

quaint mantle
#

what do you not understand

#

if 1 argument, return this variable

hardy agate
#

java

quaint mantle
#

if 2 argument, return this variable

hardy agate
#

so there are two variables

quaint mantle
#

for each tab complete

hardy agate
#

ok

hardy agate
#

to tell which tabcomplete to send

buoyant viper
quaint mantle
hardy agate
#
  if(args.length == 0) {
    if (args[0] == "string") {}
  } else if(args.length == 1) {
    // return a list of stuff for the second argument.
  }
quaint mantle
#

its just embedded js and html

glad badger
#

o.o

buoyant viper
#

im aware of electron

hardy agate
#

therefore, every website is an ide 🤯

glad badger
#

Why are you checking for args[0] equaling "string?" Also, == only compares direct instances. Use .equals() or .equalsIgnoreCase

eternal oxide
#
        switch (args.length) {

        case 0:
            return new ArrayList<>();

        case 1:
            return null; //players

        default:
            return whateverYou wantInTheList;
        }```
quaint mantle
young knoll
#

Collections.emotyLis- damnit

quaint mantle
#

Haha

young knoll
#

And I can't spell

quaint mantle
#

Slow

buoyant viper
#

Collections.singletonList("") :smug:

quaint mantle
#

thats dunb

#

dunb

eternal oxide
#

all do the same thing

glad badger
#

new ArrayList<>(Arrays.asList());
Muahahahaha

buoyant viper
#

alternatively: Arrays.asList()

#

fucK

quaint mantle
glad badger
#

Yeah, I know

quaint mantle
#

yes it does

hardy agate
glad badger
#

Arrrays.asList gives a fixed list

#

So you wouldn't want that anyway lol

quaint mantle
#

does it

glad badger
#

Yeah

buoyant viper
#

but itd b empty, just like Collections.emptyList

#

😎

glad badger
#

Yes, but Arrays.asList(); uses a constructor that passes the array

#

Which sets the array inside of array list

#

and it's a funky mess lol

buoyant viper
#

java as a whole

#

is a funky mess

glad badger
#

fair

#

But, yeah

#

That's why I jokingly wrapped my Arrays.asList in a new ArrayList.

buoyant viper
#

still cant tell if i like intellijs new doc display

#

kinda prefer the old raw 1

hardy agate
#
     public List<String> onTabComplete(CommandSender sender, Command cmd, String label,  String[] args) {
         if (args.length == 1) {
             arguments.add("logins"); arguments.add("playerKills");
             arguments.add("deaths");  arguments.add("mobKills"); 
         } else if (args.length == 2) {
             arguments.add("test");
         }
#

ok so that just shows all five

#

and now I'm really confused

young knoll
#

You don't even return anything?

hardy agate
#

I don't need to?

young knoll
#

Yes you do

#

Why do you think it has a return type

hardy agate
#

I have this in my main: java this.getCommand("mystats").setTabCompleter(new StatTab());

#

so I feel like I wouldn't need to

glad badger
#

How does your IDE not error without returning anything

#

Surely you return something

hardy agate
#

eclipse

glad badger
#

null?

hardy agate
#

either way, it works without returning anything

#

and it compiles just fine

glad badger
#

how

hardy agate
#

I don't know

#

I barely understand java

glad badger
#

Okay

hardy agate
#

unpopular opinion: switch to node.js

young knoll
#

That's javascript

hardy agate
#

yes

#

and there's a python spigot compiler

#

soooo

#

js spigot compiler

glad badger
#
accessor returntype methodname(arguments) {

}

The accessor is going to be public, protected, or private.
returntype, if present, requires the method to return something.
#

If you have a returntype, like List<String>

#

You have to return something

#

In this case, a List<String>

hardy agate
#

but why does it work just fine when I dont?

glad badger
#

Can...

#

Can you show us the whole method?

#

I am genuinely curious about this now.

hardy agate
#

I shall show you the whole file

glad badger
#

oh

hardy agate
#
package me.theeyeofthepotato.stats;

import java.util.ArrayList;
import java.util.List; 

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

public class StatTab implements TabCompleter {
    
    List<String> arguments = new ArrayList<String>();
    
     public List<String> onTabComplete(CommandSender sender, Command cmd, String label,  String[] args) {
         if (args.length == 0) {
             arguments.add("logins"); arguments.add("playerKills");
             arguments.add("deaths");  arguments.add("mobKills"); 
         } else if (args.length == 1) {
             arguments.add("test");
         }
         
         List<String> result = new ArrayList<String>();
         if (args.length == 1) {
             for (String a : arguments) {
                 if (a.toLowerCase().startsWith(args[0].toLowerCase())) {
                     result.add(a);
                 }
             }
             
             return result;
         }
         
         
         return null;
     }
}
glad badger
#

You are returning null

young knoll
#

Or result

hardy agate
#

oooh you're right

glad badger
#

^

#

If you return null, it'll tab complete player names.

young knoll
#

On paper

hardy agate
#

but it doesn't do that

glad badger
#

oop

#

lol

hardy agate
#

it works even though I return null

#

why is java like this

#

python was so easy...

young knoll
#
            Set<String> modules = this.plugin.getEnchantmentRegistry().getNames();
            List<String> suggestions = new ArrayList<>();

            StringUtil.copyPartialMatches(args[0], modules, suggestions);

            return suggestions;
        }
        return Collections.emptyList();
hardy agate
#

what is this StringUtil.copyPartialMatches(args[0], modules, suggestions);

#

hell what is this: Set<String> modules = this.plugin.getEnchantmentRegistry().getNames();

glad badger
#

hmm

carmine nacelle
#

alright bois

#

whats the best way to spawn an arrow on each side of a shot arrow?

young knoll
#

Set<String> modules = this.plugin.getEnchantmentRegistry().getNames(); you can ignore that

hardy agate
#

ok then

young knoll
#

copyPartialMatches is a convenience method for copying, well, partial matches

hardy agate
#

I definitely know what that means

young knoll
#

Which will filter your tab complete to strings that match what the user has already typed in

hardy agate
#

so use that instead

young knoll
#

If the user has already typed in fals you don't want to be still suggesting true

hardy agate
#

ok?

#

so replace this:

         List<String> result = new ArrayList<String>();
         if (args.length == 1) {
             for (String a : arguments) {
                 if (a.toLowerCase().startsWith(args[0].toLowerCase())) {
                     result.add(a);
                 }
             }
             
             return result;
         }
#

with that

#

(minus the first line)

#

(I think)

glad badger
#

I'm just doing this all in discord, but I imagine any one of the people here will correct me on this if something is off...

#

But going back to basics a tad bit

#
List<String> arguments = new ArrayList<>();
if(args.length == 1) {
  arguments.add("logins");
  arguments.add("playerKills");
  arguments.add("deaths");
  arguments.add("mobKills"); 
} else if(args.length == 2) {
  for(Player player : Bukkit.getOnlinePlayers()) {
    arguments.add(player.getName().toLowerCase());
  }
}
return StringUtil.copyPartialMatches(args[args.length-1], arguments, new ArrayList<>());
hardy agate
#

what is this... for(Player player : Bukkit.getOnlinePlayers())

young knoll
#

copyPartialMatches is weird and modifies the passed in array

#

It does not return anything

glad badger
young knoll
#

Kinda reminds me of out in C#

#

Wait what

#

Huh, it does return a collection

quaint mantle
young knoll
#

But also modifies the one you pass in, weird

glad badger
#

"collection" argument is just a Collection that it'll add the results to

young knoll
#

Woo 1 less line of code, get ready for some performance

glad badger
#

Oh boy

#

Boo ya

young knoll
#

I mean it could just create the collection itself

glad badger
#

Yeah, but I can imagine a reason for passing an existing array in

young knoll
#

I guess if you want to have some options always show up it may be useful

glad badger
#

^

young knoll
#
 if (args.length == 2) {
            Set<String> modules = this.plugin.getEnchantmentRegistry().getNames();
            return StringUtil.copyPartialMatches(args[0], modules, new ArrayList<>());
        }
        return Collections.emptyList();
    }
round elbow
#

how can I make clickable/hoverable chat messages?
TextComponent acc = new TextComponent("[ACCEPT]");
this piece of code gave me this error in the IDE
'TextComponent(java.lang.String)' is not public in 'java.awt.TextComponent'. Cannot be accessed from outside package

young knoll
#

Wrong import

glad badger
#

Look for net.md_5.bungee.api.chat

round elbow
#

Ye found it

#

thanks

hardy agate
#
List<String> arguments = new ArrayList<>(); //I understand this
if(args.length == 1) { // <command> <args 1> <args 2> I'm going to assume that "args.length == 1" means that the user as gone to <args 1>
  arguments.add("logins"); 
  arguments.add("playerKills"); 
  arguments.add("deaths"); 
  arguments.add("mobKills"); 
} else if(args.length == 2) {
  for(Player player : Bukkit.getOnlinePlayers()) { //I did not know that for loops did this.. whatever that is?
    arguments.add(player.getName().toLowerCase());//this just makes the second argument the playername of ther user... I think?
  }
}
return StringUtil.copyPartialMatches(args[args.length-1], arguments, new ArrayList<>()); // I have no idea what this does what the hell why is there args.length-1
#

correct me if I'm wrong

glad badger
#

You are not, really.

hardy agate
#

ok so at least I have no misconceptions

#

it's just a basic lack of knowledge

glad badger
#

if(args.length == 1 ) is
If the last argument they are working on is the first argument

hardy agate
#

dafuq

carmine nacelle
#

So with this:

shooter.launchProjectile(Arrow.class);

How could I launch a TippedArrow with specific potiondata etc

glad badger
#

The for loop is called a "foreach"

hardy agate
#

which means...

#

oh like for each instance of the type?

glad badger
#

launchProjectile, I believe, returns a projectile instance you can modify. You will also want to use TippedArrow(or whatever is the nondeprecated version of that is)

hardy agate
#

someone really needs to make two help channels

glad badger
#

Also, Potato

#

The foreach loop

carmine nacelle
glad badger
#

It's looping through all the players and adding their names to the arguments

#

I imagine you'd want that

#

and finally

young knoll
#

tipped status depends only on base potion type not being UNCRAFTABLE and effects being empty.

glad badger
#

return StringUtil.copyPartialMatches(args[args.length-1], arguments, new ArrayList<>());

young knoll
#

Looks like tipped arrows are technically normal arrows

glad badger
#

args is an array.

hardy agate
#

oh yeah sorry, I should mention that I'm basically trying to recreate the vanilla commands argument for argument

glad badger
#

So to get the last item in the array

#

You do

hardy agate
#

that example is just some tutorial I found

glad badger
#

array[array.length-1]

hardy agate
#

ah I see

#

I think..

young knoll
#

Since launchProjectile doesn't have a callback option, you will have to modify the arrow right after you launch it

hardy agate
#

than what I'm doing rn

#

which is just going through every single command

glad badger
#

.-.

hardy agate
#

oof that's a no?

glad badger
#

This entire thing has been a giant xy problem

#

lol

#

Why override the default commands argument for argument?

hardy agate
#

soorrry

#

ok

#

here's the entire project I'm working on

#

I'm trying to add variables to minecraft commands

#

the best way, in my mind, to do that is something like the following:

give @s $(variable_name) 64

replace the $(variable_name) with whatever "variable_name" is set to

#

I would first send it to my own parser, do that replace stuff, and then send it to brigadier parser

#

so, I have /varm give @s $(variable_name) 64

#

varm being the plugin command

#

so that is why I need to recreate the entire autocomplete menu

#

and I feel like there MUST be a better way

young knoll
#

You could hook into brigadier

#

But that isn't exactly easier

hardy agate
#

how would one do that (abstractly, I'm to tired to actually read through code)

young knoll
#

Lots of builder pattern

#

If you really want to use Brigadier you should research it

hardy agate
#

I have no idea what that means so we're just gonna go with the manual option

hardy agate
young knoll
#

Tab completing items probably isn’t too hard

#

You can just use the Material enum

hardy agate
#

yeah

#

just tedious

#

and kinda inefficient?

worldly ingot
#

Not necessarily

#

calculate the material keys once

#

Re-use the set

#
private static final List<String> ITEM_KEYS = Arrays.stream(Material.values()).filter(Material::isItem).map(m -> m.getKey().toString()).collect(Collectors.toList());

// in the tab complete
StringUtil.copyPartialMatches(args[0], ITEM_KEYS, new ArrayList<>());```
young knoll
#

Is a set or list better in this case

#

Or does it even matter

worldly ingot
#

List. No purpose in using a Set because the elements are all being iterated in copyPartialMatches(). No contains() operations being performed

young knoll
#

Yeah

#

Makes sense

hardy agate
#

wait so does this work?

#
package me.theeyeofthepotato.stats;

import java.util.ArrayList;
import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;

public class StatTab implements TabCompleter {
    
    List<String> arguments = new ArrayList<String>();
    
     public List<String> onTabComplete(CommandSender sender, Command cmd, String label,  String[] args) {
         
         if(args.length == 1) {
              arguments.add("logins");
              arguments.add("playerKills");
              arguments.add("deaths");
              arguments.add("mobKills"); 
            } else if(args.length == 2) {
              for(Player player : Bukkit.getOnlinePlayers()) {
                arguments.add(player.getName().toLowerCase());
              }
            }
            return StringUtil.copyPartialMatches(args[args.length-1], arguments, new ArrayList<>());

         
         
     }
}
glad badger
#

You'll be in for a rude awakening

#

When every time a tab complete is made

#

more and more strings appear in the list

hardy agate
#

oh fuck

#

ruh roh

#

how do I not do that?

young knoll
#

Since the list is an instance variable and allows duplicates that will add more entries to it each time

glad badger
#

Put arguments into the scope of the method

#

Move the list into the method

young knoll
#

Populate the list in the constructor, or move the list into the method

glad badger
#

Or clear it at the beginning of the method

hardy agate
#

I have no idea what that means

hardy agate
glad badger
#

Move the arguments list declaration above the if(args.length == 1)

hardy agate
#

what is the arguments declaration

glad badger
#

List<String> arguments = new ArrayList<String>();

hardy agate
#

it is above

glad badger
#

Move it below the
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {

#

and above the if(args.length == 1) {

carmine nacelle
#

Is there a way to get ItemMeta of a landed projectile on projectile hit event?

hardy agate
#
package me.theeyeofthepotato.stats;

import java.util.ArrayList;
import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;

public class StatTab implements TabCompleter {
    
     public List<String> onTabComplete(CommandSender sender, Command cmd, String label,  String[] args) {
         
        List<String> arguments = new ArrayList<String>();
         
         if(args.length == 1) {
              arguments.add("logins");
              arguments.add("playerKills");
              arguments.add("deaths");
              arguments.add("mobKills"); 
            } else if(args.length == 2) {
              for(Player player : Bukkit.getOnlinePlayers()) {
                arguments.add(player.getName().toLowerCase());
              }
            }
            return StringUtil.copyPartialMatches(args[args.length-1], arguments, new ArrayList<>());
     }
}
#

that's code 2.0 (or more like 200.0 but whatevr)

#

so that will work?

glad badger
#

ProjectileHitEvent#getEntity will return the projectile.
If you know what type of projectile it is, you can cast that.

#

e.g. (Arrrow) e.getEntity()

young knoll
#

Not sure if the meta is saved to the entity

#

I doubt it

glad badger
#

It isn't

#

But you can at least get stuff like potiondata, color, and whatnot

#

and, I suppose, recreate it lol

worldly ingot
#

Can then just fetch it from the Metadata when picked up

glad badger
#

I guess that can solve the issue xD

carmine nacelle
#

I was thinking Metadata or an array of uuids

worldly ingot
#

Ehm, sure. If that's what you need

carmine nacelle
#

I just need to make it so when my special arrow lands, it does something

#

which is defined in its object class

worldly ingot
#

In which case I'd opt for a Set<UUID> or a Map<UUID, YourObject>

young knoll
#

Pdc tag could be nice

worldly ingot
#

That as well

#

You have options ;p

young knoll
#

Will presist restarts, which is nice

glad badger
#

I'd personally keep metadata, as it's less cleanup.

carmine nacelle
#

yeahh, ill have to figure out how to use metadata for that

worldly ingot
#

Metadata really isn't meant as a data store though

young knoll
#

What would you need to clean up

worldly ingot
#

It's meant to share data with other plugins without actually having to depend on it

young knoll
#

Arrows don’t tend to stick around

glad badger
#

That's the point

worldly ingot
#

(e.g. VanishNoPacket has a vanish metadata on players :D)

carmine nacelle
#

I just need it to last for the duration the arrow is in flight

last ledge
#
            skeleton.setMaxHealth(skeletonHealth);```

after i added these lines, my plugin started misbehaving helpp
young knoll
#

Metadata and a set will last the duration unless there is a restart

glad badger
#

Arrows will yeet out of existence... and same with their metadata

young knoll
#

Pdc will always last

#

Well, until the arrow is removed

glad badger
#

If you use an array, map, or set... You'll be listening to despawning and a bit more to keep your map clean

young knoll
#

True

last ledge
carmine nacelle
young knoll
#

Yes

young knoll
#

?pec

#

Dangit

#

?pdc

last ledge
glad badger
#

pdc is so useful lol

last ledge
#

vex stopped spawning

carmine nacelle
#

i think im just gonna use a set of uuids

#

whats the diff between a list and set..?

#

i always use lists

young knoll
#

Set is faster for contains

#

List is faster for a lot of add and remove

young knoll
carmine nacelle
#

whenever I try to make a set of my custom object it makes me implement all its functions..?

last ledge
#

until i added those line

carmine nacelle
#

nvm its new HashSet..

#

for some reason.

young knoll
#

Yes

#

Just list you can make an instance of List

young knoll
last ledge
#
    Display-Name: "&cSaviour"
    Max-Health: "300"
    Messages:
      Attack-Block: "§c§lYour attack was blocked!"
      Punched-Player: "§4§lYou were punched into the air!"```
#

i have Max-health in config as String ig

#

thats why not working?

young knoll
#

Probably

#

Remove the quotes

last ledge
#

yes it works

#

but the hit damage is same

#

skeleton gets killed in 10 shots in 300 max health

#

also

#

skeleton gets killed in 10 shots in 1000 max health

#

how do i fix it

young knoll
#

You need to set the health as well

last ledge
#

ah got it

#

so do i set health also to 1000? or

young knoll
#

Set it to whatever the max health is

hardy agate
#

ok so I'm trying to make a tab complete thingy

#

well, more specifically, I'm trying to recreate the minecraft syntax tab complete

#

don't ask why

torn shuttle
#

is there a way to modify the duration of how long a particle is displayed for using only the spigot api?

hardy agate
#

hang on

torn shuttle
#

?paste

undone axleBOT
torn shuttle
#

get rid of that

hardy agate
#

why?

torn shuttle
#

because if 1416 people posted this every time they want someone to take a look at their code this room would be unreadable

hardy agate
#

so how do you propose I ask said question

torn shuttle
#

direct your eyes to the command I ran 2 seconds before saying what I said

hardy agate
#

ah

#

I see

#

thank you

torn shuttle
#

seeing is believing

hardy agate
#

ok

#

so

#

I'm trying to make a tab complete thingy
well, more specifically, I'm trying to recreate the minecraft syntax tab complete
don't ask why

#

now, at line 107

torn shuttle
#

are you aware that a bunch of frameworks exist that do this for you?

hardy agate
#

I

#

am very new to java

#

so you're gonna have to explain to me what a framework is

#

because I have no idea

torn shuttle
last ledge
#

how do i use color codes in wither's boss bar

#

i set withers name &cYouDad

#

works fine

torn shuttle
#

same way you'd use them elsewhere

last ledge
#

but the boss bar

#

shows

#

&c too

torn shuttle
#

which is not &c

last ledge
#

ye ok

#

no

#

i am trying to change from config.yml

#

directly

#
            wither.setCustomName(withername);```
torn shuttle
#

&c is already parsed, §c is the actual value used internally

buoyant viper
#

u gotta use ChatColor.translateAlternateColorCodes

torn shuttle
#

same as for any other color code

#

you can also hardcode it by using the color or chatcolor class

#

it's one of the two

#

ChatColor

hardy agate
last ledge
#
            wither.setCustomName(ChatColor.translateAlternateColorCodes('&', withername));```
#

hope this will work

hardy agate
torn shuttle
hardy agate
#

which function

torn shuttle
#

how it functions

carmine nacelle
#

bruhhh..

hardy agate
#

in the features section?

carmine nacelle
#

arrow UUIDs change after they hit??

#

what the FFF

torn shuttle
torn shuttle
#

I doubt it

young knoll
#

In the ground? Yes

#

They have an inGround NBT tag

hardy agate
#

*onGround

torn shuttle
#

so does that mean I can untag them and give them a new velocity even after they get stuck?

young knoll
#

No, inGround

hardy agate
#

really?

torn shuttle
#

wow what functionality

#

that'd be an entertaining meme

young knoll
#

Also I just realized saying NBT tag is like saying ATM machine

hardy agate
#

oh you're right

#

then why is every other entity onGround

carmine nacelle
young knoll
#

That’s an interface

#

Not an entity type

carmine nacelle
#

this is dumb af bro

#

im trying to see if the arrow i pick up's UUID is in my list

#

I added the uuid of the arrow to the list when it fires

#

then it changes

young knoll
#

That doesn’t make any sense

carmine nacelle
#

exactly idk why they coded it that way.

young knoll
#

Anyway, why are you looking for the uuid when you pick it up

carmine nacelle
#

custom arrows

young knoll
#

So you want to get the proper item back

carmine nacelle
#

Correct.

young knoll
#

I’d still say pdc

#

Hopefully that doesn’t change when it hits the ground

carmine nacelle
#

nopeee..

#

persistent my ass

eternal oxide
#

arrows don't change UUID

carmine nacelle
#

idk bout that one chief...

eternal oxide
#

There are two arrows on teh floor when you pick it up

carmine nacelle
#

right

#

its a multishot bow

#

i figured out a work around

eternal oxide
#

then you have two UUIDs

carmine nacelle
#

but i found another way

young knoll
#

3 actually

eternal oxide
#

UUIDs do not change, end of. Thats the point of a UUID

midnight crow
#

How can I send a link to a user?

young knoll
#

I think minecraft automatically makes links clickable

midnight crow
#

Ok, but I want to do something like a url tag

#

Any way to do that?

midnight crow
#

Right now I'm doing: TextComponent message = new TextComponent( "Click me" ); message.setClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, "https://localhost:3000" ) ); Bukkit.getPlayer(id).spigot().sendMessage(message);

#

But this doesn't seem to work

#

I'm not getting the message

eternal oxide
#

are you getting the correct player?

carmine nacelle
#
    public Optional<CustomArrow> getCustomArrow(ArrowType arrowType) {
        return getCustomArrowList().stream().filter(customArrow -> customArrow.getArrowType().equals(arrowType)).findFirst();
    }
        Optional<CustomArrow> customArrow = archery.getCustomArrowManager().getCustomArrow(arrowType);
        customArrow.ifPresent(arrow -> arrow.performLand(shooter, landedArrow));

First time using streams, is this the proper way to do it? (code works fine)

#

Basically finding the first CustomArrow in my CustomArrowList that has the ArrowType equal to the ArrowType of the item that lands

#

then performing the landing code on it

midnight crow
carmine nacelle
#

im having a weird ass issue rn, might require screenshare or something

#

theres very clearly 3 arrows there right

#

pick them up and it gives me 2.

#

wait..it seems to just be a bug while in creative..? wot

prime leaf
#

Delay between searching and checking world entities
is this a good optimization ?

carmine nacelle
#

How could I make it so my potion data effects don't apply potions to the hit targets?

carmine nacelle
#

but..

#

I mean I guess I could but

#

anyone know of a really good per-player scoreboard tutorial video..?

midnight crow
#

Is there any way to set up a listener to a mySQL database in spiggot? I want something to run when a value in my db is updated. Thoughts?

fallow merlin
fallow merlin
#

oohh that makes sense

carmine nacelle
fallow merlin
#

thats cool

carmine nacelle
#

tyty

#

now just gotta make a scoreboard system to keep track of the player's points

young knoll
#

Can you not just set the color like you can with potions

#

You can

fallow merlin
#

AbstractArrow.setColor(Color.GREEN) etc

fallow merlin
#

just don't set it to null

carmine nacelle
#

bruh wottt..

#

woahhhhh

young knoll
#

Works for potion items too

#

Full RGB

carmine nacelle
#

:OOOOO

#

ayo

#

hex too..?

fallow merlin
carmine nacelle
#

im on 1.17.1 so

#

we good there

quaint mantle
#

1.16.5+

young knoll
#

Rgb chat is 1.16

fallow merlin
#

oh

young knoll
#

But this isn’t chat

quaint mantle
#

Idk how it's in potions, but chat 1.16

fallow merlin
#

omg i just thought rgb arrow that cycles thru colors

quaint mantle
#

I think potions too

carmine nacelle
#

GAMER ARROW

#

LFG

young knoll
#

Now I need to make custom arrows

#

Meh, project for another day

quaint mantle
#

Unlucky

young knoll
#

Could add it to the enchantment plugin I guess

carmine nacelle
#

BROOO IT CHANGES THE TRAIL COLOR TOO

fallow merlin
#

epic

carmine nacelle
#

i love u guys

#

yes homo

fallow merlin
pine island
#

Any way to clear someone's E chest?

fallow merlin
#

edit their data file

#

oh wait this is development not server lol

quaint mantle
#

i think you can just

#

uhhh

#

use resource pack

fallow merlin
#

and some people might not want to

mighty burrow
#

I'm trying to hook into the vault api. I have essentialsx and vault installed on my server.(they're both also set as soft dependencies for my plugin). However, essentials doesnt seem to be registering an economy provider.

#

Does anyone know what could be going wrong?

pine island
mighty burrow
#

Yeah

#

It's not exactly what's there in the tutorial

pine island
#

Are u running a compatible version?

mighty burrow
#

But It does everything

pine island
mighty burrow
#

Only the getregsitration(economy.class) returns null

mighty burrow
pine island
mighty burrow
#

It's all the latest

pine island
#

Ok

#
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
         econ = rsp.getProvider();
        return econ != null;
    }
    public static Economy getEconomy() {
        return econ;
    }```
#

Copy it & paste it down below the lisners

midnight crow
#

How would I go about giving an item a description/title with coloring?

#

Thanks

#

Specifically an "Item Stack"

pine island
#

§?

#

Just find code color

#

Also

#

?google

undone axleBOT
mighty burrow
# pine island Can u send the code where this is
public class DepositHandler {
   private static RegisteredServiceProvider<?> service = null;

   public static boolean depositPlayer(Player player) {
      if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
         return true;
      } else if (!Bukkit.getPluginManager().getPlugin("Vault").isEnabled()) {
         return true;
      } else if (!Main.getPlugin().getClanConfiguration().isVaultEnabled()) {
         return true;
      } else {
         if (service == null) {
            service = Bukkit.getServicesManager().getRegistration(Economy.class);
         }

         if (service == null) {
            return true;
         } else {
            Economy economy = (Economy)service.getProvider();
//Rest
#

Wait ugh

#

Weird on phone

fallow merlin
fallow merlin
#

put it in the item meta

#

it works

#

ive used it before

#

it works for any text

pine island
#

Meta?

fallow merlin
#

yea?

#
ItemMeta meta = item.getMeta();
meta.Name = ChatColor.RED + "bruh";
pine island
#

Ok i only use it for chat

midnight crow
pine island
#

Otherwise i just use a color plugin that uses §

#

Anyway to clear a E chest?

mighty burrow
pine island
mighty burrow
#

Hm

pine island
#

Send code?

mighty burrow
#

Sorry for the formatting

#

Currently on phone and nothing displays correct ly

pine island
#

Hm

mighty burrow
# pine island Hm

All I have to do to get essentials x to register the provider is install it on the server right?

#

Currently v2.19.0

pine island
mighty burrow
#

Kay thanks

midnight crow
#

How can I combine two chatcolor attributes?

#

Like underline and white

fallow merlin
#

uh

#

ChatColor.UNDERLINE + ChatColor.WHITE + "bruh"

#

i think that works

midnight crow
#

It dont

fallow merlin
#

flip it around maybe?

midnight crow
#

Nope

fallow merlin
#

hm

#

ChatColor.BOLD + "" + ChatColor.BLUE + "Your message here"

#

because java is dumb like that

midnight crow
#

I'll see if that works

quaint mantle
fallow merlin
#

and if that doesn't work theres always ChatColor.translateAlternateColorCodes

quaint mantle
#

or maybe the bukkit itself 😭

fallow merlin
pine island
#

Yeah java has some flaws

#

Altho they should have been fixed by now but whatever its easier than python & is stackable

quaint mantle
midnight crow
#
        ItemMeta swordMeta = sword.getItemMeta();
        swordMeta.setDisplayName(ChatColor.WHITE + "" + ChatColor.UNDERLINE + "Nike:" + ChatColor.RED + " Zombie Quest");
        List<String> zList = new ArrayList<String>();
        zList.add("\nThis quest will " +
        "require you to " + ChatColor.RED + "fight 10 zombies " + "\nin order to get" + 
        ChatColor.GOLD + " 100 CartCash");
        swordMeta.setLore(zList);
        sword.setItemMeta(swordMeta);``` For some reason, my sword itemstack is showing no lore in game. Thoughts?
pine island
#

Any help?

wide flicker
pine island
#

So alt enter would fix it?

fallow merlin
#

oh you fixed it lol

pine island
#

getCommand("SelfDP").setExecutor((CommandExecutor) new SelfDP()); so this?

wide flicker
#

e.g. java public class SelfDP implements CommandExecutor { ... your code here ... }

chrome beacon
#

No

wide flicker
#

Your class SelfDP has tp implement CommandExecutor

pine island
#

Oh yeah shit i forgot

wide flicker
#

If you want tab completion processed in the same class, implement TabCompleter as well (separate them with a comma) and use public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) { ... } for that. Make sure to register it as the tab completer for the command as well

pine island
#

Hmm ok!

clever whale
#

quick question, hopefully I'm not interrupting,
how do I add an option for a player to use a command on other players?

This is my code rn

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

        if (cmd.getName().equals("sharkheal"));
            if (sender instanceof Player) {
                Player player = (Player) sender;
            if (player.hasPermission("shark.heal"));
            player.setHealth(20.0);
            player.setFoodLevel(20);


            } else {
                System.out.println("You cannot use this command through Console!");
                sender.sendMessage(ChatColor.RED + "You are lacking the permission " + ChatColor.GRAY + "shark.heal");
            }



        return false;
    }
}

So how would I do something like /sharkheal {otherPlayer}, and add the permission shark.heal.others to it for example?

wide flicker
#

check arguments and permissions as necessary

fallow merlin
crude hound
#

hey, I looked in all spigot (not spigot api) jars and I idn't found one with the deobfusced nms (without a, b, c) I used the remapped arg with the buildtool so can you help me?

pine island
#
Player player = Bukkit.getPlayer(args[0])
}
crude hound
#

1.17.1

wide flicker
#

e.g.java if (args.length > 0) { if (sender.hasPermission("shark.heal.others")) { Player target = Bukkit.getPlayer(args[0]); if (target != null) { // do your stuff to the player here } else { // player could not be found, alert player } } else { // tell the user they don't have permission? } }

chrome beacon
clever whale
#

Thank you all! 😄

crude hound
#

oh yes I missed that I have overwritten my pom and didn't added it back

fallow merlin
#

Failure to find org.spigotmc:spigot:jar:remapped-mojang:1.17.1-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigotmc-repo has elapsed or updates are forced

quaint mantle
quaint mantle
#

maybe i will need to register it if it is different class

fallow merlin
pine island
#
        getCommand("ClearEco").setExecutor(new ClearEco());
        getCommand("SelfDP").setExecutor(new SelfDP());```

Command Dosnt show up in mc even tho its registered 

*Code:*

package me.lumina.hardcorepurge.commands;

import me.lumina.hardcorepurge.HardcorePurge;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class SelfDP implements CommandExecutor {

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

    if (cmd.getName().equalsIgnoreCase("SelfDP")){

        if (args.length == 1) {
            Economy economy = HardcorePurge.getEconomy();
            Player player = Bukkit.getPlayer(args[0]);

            economy.depositPlayer(player.getName(), 1000000);
            sender.sendMessage(ChatColor.RED +  "Proudly created EasterEgg/Exploit/Bully By LuminaEXE");
        }


    }
    return true;
}

}

wide flicker
quaint mantle
#

good...

pine island
#

Yeah lol messed up

quaint mantle
chrome beacon
fallow merlin
#

which parts broken

#

i accidentally deleted the classifier in this file but in the real file the classifier for spigot is there

wide flicker
# pine island ```getCommand("purge").setExecutor(new purge()); getCommand("ClearEco")....

Personal preference, but I generally recommend doing if (args.length > 0) { ... } or if (args.length >= 1) { ... } instead of if (args.length == 1) { ... } (unless handling multiple argument lengths and you specifically need it to have only 1 argument), since if a user enters /command john doe, that's two arguments, so now it won't run that code for targeting another player.

chrome beacon
#

Hm looks okay then

pine island
#

Why doesnt the plugin show up?

crude hound
#

it's this one right? xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <id>attach-sources</id> <phase>verify</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin>

chrome beacon
#

No

#

Read developer notes

crude hound
#

my build worked but vs code still give me errors

chrome beacon
#

Try using an IDE like Intellij or Eclipse

onyx fjord
#

vscode is good for plugins as well

crude hound
#

yes I do that normaly but I like the vs code graphics so rip vscode

onyx fjord
#

just get java addons

crude hound
#

I already have a lot of java extansion xd

chrome beacon
#

Yeah

#

If that doesn't work try an IDE

crude hound
#

I got these from the start of my plugin

lavish hemlock
#

(also how come setting up run configs is so much weirder in VSCode?)

crude hound
#

but I hate intelliJ I prefer eclipse xd

#

(and JetBrains in general)

lavish hemlock
#

Eclipse is terrible.

crude hound
#

and I got the same error from vs code to eclipse

lavish hemlock
#

are you suggesting that IDEA gives different errors? lmao

crude hound
#

nop but what can I do

#

because it's false errors

robust forge
#

What is the difference between Bukkit#getOfflinePlayer and Bukkit#getPlayer? Which one should I use?

chrome beacon
#

One gets a offline player and the other one gets an online player

#

Use the one you need

robust forge
#

Oh ok

#

So if the player isnt online #getPlayer wont work?

crude hound
#

and the online player can be an offline player but an offline is not always an online player

robust forge
#

Ok

#

Thanks

crude hound
#

so how can I do

#

keep these?

quaint mantle
chrome beacon
#

Yes

carmine nacelle
hazy rock
#

is it possible to create a command block ItemStack with a command already in it?

quaint mantle
#

default minecraft already have that

hazy rock
#

ah wait nvm ill just google it

#

thanks

vernal pier
#

nbt needs nms

#

just use block state meta

wide creek
#

another ez question, if a player isnt specified, how can I stop Java from going through?
This is my current code, but it doesn't work

if (args.length == 1) {
            player.sendMessage(ChatColor.RED+"Please Specify a player");
            return;
        }
        Player target = Bukkit.getPlayer(args[1]);
stone sinew
little trail
#

What lib do you guys recommend for websockets

#

And do I need it on a separate thread

chrome beacon
#

No need for a lib

#

Also yes use another thread

wide creek
#

I have a variable target, how can I make it a Player variable if a given player is online or a OfflinePlayer variable if a given player is offline?

chrome beacon
#

Get OfflinePlayer then check isOnline

mystic tartan
#

are plugins generally more performant than command blocks?

crude hound
#

yes

#

but really

quiet ice
#

There are a lot of stupid plugins out there

crude hound
#

hey it's me again, this wasn't some false errors, when I tryed to see what was the compiled code and in reality it replaced my nms code by an error saying that he didn't found all the classes so how can I do?

quiet ice
#

Using the eclipse compiler?

crude hound
#

nop maven

#

it's an problem with the mappings

#

(in 1.17.1)

lost matrix
#

Well... it depends. There are a ton of horribly written plugins out there.

crude hound
#

like I wanted to don't use the obfusced mappings but the mojang ones, but I needed to change mappings when I compile it to use it in a spigot server I need to change the mappings to the obf ones so I put a plugin to remap all of that (clearly not ctrl+c ctrl+v) and it don't work

quiet ice
#

Remapping is complicated in maven from what I know

#

but sadly I cannot help you

crude hound
#

so I saw in my decompiler this :

stone sinew
lavish hemlock
#

...who the fuck throws Error?

#

is that a custom type or literally java.lang.Error?

crude hound
#

java.lang.Error

stone sinew
crude hound
#

nop the compiler

lavish hemlock
#

I don't see how a decompiler could do that

#

especially when it's easier to make that work than not

crude hound
#

like maven did some weird things

lavish hemlock
#

considering exception tables specifically state their exception type in bytecode actually this is in regards to try/catch, but it still holds up since throwing is a new then an athrow

#

so legit

#

for some fucking reason, someone is throwing Error

#

(ftr, Exception or RuntimeException are better)

crude hound
#

say that to maven xd

lavish hemlock
#

(Error represents a RuntimeException that should not be caught, e.g. with a try/catch)

#

(it's mainly used to handle errors on the JVM's side, e.g. OutOfMemoryError)

crude hound
#

the base code look like that

lavish hemlock
#

(self-explanatory name btw)

crude hound
glossy venture
#

io.netty

#

its also what minecraft uses

lavish hemlock
#

Either use java.net or Netty.

wide creek
#

whats the "ding" sound that everyone use ?

glossy venture
lavish hemlock
#

I once implemented a webserver with just java.net lol.

little trail
#

i do kinda want it to not be so complicated however

glossy venture
#

i used java's HttpServer

lost matrix
glossy venture
#

to make a webserver

little trail
#

ill check out netty

lavish hemlock
#

Well I implemented mine by scratch.

glossy venture
#

nice

lavish hemlock
#

Although it only handles basic GET requests.

#

Maybe one day I'll return to it.

lost matrix
#

Just use Spring or Quarkus. Literally 3 lines and you have a web socket, rest endpoint or http server.

little trail
#

on netty where is websocket

#

oh?

#

links for them?

lavish hemlock
#

well Spring is an entire framework, is it not?

glossy venture
#
case HEAD:
case PUT:
case DELETE:
case CONNECT:
case OPTIONS:
case TRACE:
case PATCH:
``` what there are more http requests than just `GET` and `POST`?
lost matrix
#

Quarkus example:

@ServerEndpoint("/chat/{username}")         
@ApplicationScoped
public class ChatSocket {

    @OnOpen
    public void onOpen(Session session, @PathParam("username") String username) {

    }

    @OnClose
    public void onClose(Session session, @PathParam("username") String username) {

    }

    @OnError
    public void onError(Session session, @PathParam("username") String username, Throwable throwable) {

    }

    @OnMessage
    public void onMessage(String message, @PathParam("username") String username) {

    }

}
silver cove
#

u can't use spring in mc if that's what u want

lavish hemlock
#

But most of them are really unused lol.

little trail
#

i kinda want a websocket i can keep alive and send and receive messages thats pretty much it

lavish hemlock
#

You might just want java.net then.

little trail
glossy venture
#

oh

lavish hemlock
#

I think HEAD is also an efficiency thing.

lost matrix
little trail
#

basically it just describes its deleting or updating something on the server

lavish hemlock
#

but idk.

little trail
#

i use head for uptime checking on something

lavish hemlock
#

That requires having multiple JVM instances open.

lost matrix
silver cove
#

doesn't mean u should

little trail
#

im confused about all this

lost matrix
little trail
#

mc server opens the socket to the server and keeps it alive and sends and receives messages

glossy venture
little trail
#

websockets not just sockets

lavish hemlock
#

ANY LANGUAGE?

#

I CAN MAKE MINECRAFT SERVER IN RUST?!

glossy venture
#

server yeah

lavish hemlock
#

that's what I said :)

lost matrix
#

client too

lavish hemlock
#

totally :)

glossy venture
#

._.

lost matrix
#

As long as you properly implement the protocol

lavish hemlock
#

wouldn't be too hard

#

you're looking at a binary professional

  • Maow, someone who is terrible at visualizing bitwise operators.
glossy venture
little trail
#

ok java.net.http.websocket looks good ty

glossy venture
lost matrix
#

There is for example a nodejs app that implements the protocol so you can have virtual clients or "bots". Its called PrismarineJS

lavish hemlock
lost matrix
lavish hemlock
#

cool

#

also I've heard of Prismarine

lost matrix
#

And you could just implement both server or client in lets say C++ if you really wanted to.

lavish hemlock
#

epic Minecraft moment

#

I

#

I kinda wanna implement a Minecraft server in Rust now.

#

lol.

glossy venture
#

but i like Java

lavish hemlock
#

I'd probably fall flat on my face immediately though.

glossy venture
#

there are like 100+ packets

lavish hemlock
#

I'm like... barely alright at Rust, I just learned how to do idiomatic error-handling or whatever.

glossy venture
#

and you would have to implement the logic too

lavish hemlock
glossy venture
#

entity processing