#help-development

1 messages · Page 1768 of 1

ancient plank
#

did you click the import button

sterile token
rotund prawn
#

?

#

wich one do i import?

sterile token
#

That one

quaint mantle
#

im sure it is right

rotund prawn
#

okay

sterile token
#

The first

rotund prawn
quaint mantle
#
    public void connectMySQL() {

        String host = getConfig().getString("mysql.host");
        int port = getConfig().getInt("mysql.port");
        String database = getConfig().getString("mysql.database");
        String username = getConfig().getString("mysql.username");
        String password = getConfig().getString("mysql.password");

        HikariConfig config = new HikariConfig();


        config.setMaximumPoolSize(10);
        config.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");

        config.setJdbcUrl("jdbc:mysql://" +
                host + ":" + port + "/" + database + "?useSSL=false");
        config.setUsername(username);
        config.setPassword(password);


        hikari = new HikariDataSource(config);


    }

this is my final code Conclure
i guess it is right

rotund prawn
#

im getting this error

sterile token
#

if you are on the main class (the one that extends javaplugin), only use

Logger logger = getLogger();

plain helm
#

You need a runTaskTimer method

rotund prawn
#

oohh thanks

#

im getting this rror now onEnable event

sterile token
#

MM

#

Lets talks via dm

#

Its easy

rotund prawn
#

okay

sterile token
#

Here there lot of people talking

quaint mantle
plain helm
#

Bukkit.getServer().getScheduler().runTaskTimer( Your main class instance , () -> {

Code to print timer;

},0, 20);

#

Like this each second you’ll run this task and so if you decrease by one an integer that’ll be the timer you’ll have a timer

foggy estuary
#

Ok thank you

plain helm
#

Then set a runTaskLater(); task that’ll stop the runTaskTimer() task

#

Else it will go negative

little trail
#

how would it be possible to convert an advancement name into the real user readable one

ancient plank
#

^

plain helm
#

That is also true

little trail
#

and how would i get the value then

#

no

#

how would it have any idea what the name is

#

does it just...know somehow or

#

sure

#

also how would i create the hashmap with all of these

#

would it just be loads of puts

#

oh yeah a yml would be good

lean gull
echo basalt
#

Hey, I'm currently having a bit of an issue

I'm trying to detect if an entity attacks another, even if it doesn't do any damage by default (shield blocks an attack, for example)

EntityDamageEntityEvent doesn't fire in the case, how can I go around it?

echo basalt
quaint mantle
#
bloodMoonHelmet.getItemMeta().setUnbreakable(true);```
when i use this line, the helmet which is dropped from the mob isnt unbreakable
echo basalt
quaint mantle
#

I was exporting my plugin to Eclipse but when I export it I get this error

JAR creation failed. See details for additional information.
  Exported with compile warnings: ArpionRP/src/module-info.java
  Exported with compile warnings: ArpionRP/src/xyz/arpionmc/arpionrp/Main.java
  Resource is out of sync with the file system: '/ArpionRP/src/xyz/arpionmc/arpionrp/plugin.yml'.
  Resource is out of sync with the file system: '/ArpionRP/src/xyz/arpionmc/arpionrp/plugin.yml'.
echo basalt
#
ItemStack item = ...;
ItemMeta meta = item.getItemMeta();

meta...

item.setItemMeta(meta);
quaint mantle
#

Oh, thank you!

#
                meta.setUnbreakable(true);
                bloodMoonBoots.setItemMeta(meta);```
#

is this a valid example

echo basalt
#

Yes

spare prism
little trail
#

probably wrong topic but how would i get advancement icon url's, like the completed ones

gray crypt
#

man I'm super confused

#

so I have two locations

#

and just for easy usage I put them in a location array

#

but when I do that randomly their y coordinate changes

#

These two locations have the same X and Z, just one is on top of the other

plain helm
#

Can you send the code?

drowsy helm
#

Probably just a matter of cloning the loc

gray crypt
#

yeah I think I figured it out
apparently if I set one location to another one, if I use the add() method on the 2nd location it adds to both of them

#

I fixed it by doing this:
location2 = new Location(location1.getWorld(), location1.getX(), location1.getY(), location1.getZ())
instead of:
location2 = location1

spare prism
#

Stackoverflow Error

gray crypt
#

err could this just be a misuse of =, when I should use ==?

plain helm
#

No

#

== is equals to

#

= is an assignment

gray crypt
#

yeah that's what I thought

#

hm

#

odd that it works that way ig

plain helm
#

You thought right

gray crypt
#

For instance with:
location2 = location1
If I was to later do:
location2.add(0, 2, 0) it would also add that to location1

plain helm
#

Your issue is that if you make it so location 2 is equal to location1 it changes the y values?

gray crypt
#

I only wanted to change location2, not location1

little trail
#

for my config.yml file to just be a copy of a file in my jar, do i save it in the same location as my plugin.yml before calling this.saveDefaultConfig()

plain helm
#

Put in the resources folder config.yml

little trail
#

thought so ty

plain helm
#

And the config file will be the one in the resources folder

plain helm
little trail
#

so i dont need to call this.saveDefaultConfig() if the user doesnt need to edit?

plain helm
#

No you should call it anyway since it’ll create the folder

#

At least I think/remember so

#

Can some spigot god confirm or disagree?

ivory sleet
#

I’m not a spigot god

#

But it should create the folder

hybrid spoke
#

it will

#

confirmed by a spigot god

graceful oak
#

Hey guys im trying to make a double drop for ores and when I try to add the drops 2 times to a block it still keeps it as the normal 1x drop what am I doing wrong?

            e.getBlock().getDrops().clear();
            for (ItemStack item : e.getBlock().getDrops(player.getInventory().getItemInMainHand())){
                e.getBlock().getDrops().add(item);
                e.getBlock().getDrops().add(item);
            }
vale cradle
#

there is a method called clone for Location objects

wary flume
#
package me.lasse333.chatwebhook;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;

import java.util.Set;

public class ChatWebhook extends JavaPlugin {

    @Override
    public void onEnable() {
        getServer().getConsoleSender().sendMessage(ChatColor.DARK_PURPLE + "[ChatWebhook] plugin is enabled");
    }

    @Override
    public void onDisable() {
        getServer().getConsoleSender().sendMessage(ChatColor.DARK_PURPLE + "[ChatWebhook] plugin is disabled");
    }

    @EventHandler
    public void onPlayerChat(AsyncPlayerChatEvent event) {

        String message = event.getMessage();
        String user = event.getPlayer().getDisplayName();

        getServer().getConsoleSender().sendMessage(user);
        getServer().getConsoleSender().sendMessage(message);

    }

}

#

:(((

#

event doesnt pickup

drowsy helm
#

Implement listener

vale cradle
drowsy helm
#

And register the listener

wary flume
little trail
#

thank u

wary flume
#

ahh

graceful oak
lavish hemlock
graceful oak
#

Do I have to actually make my own custom drop because the only thing I can think of is that im not actually setting the block drops to that but instead making a list with the drops and not actually doing anything with it

lavish hemlock
#

It only works this way with location1 and location2 as they are reference types.

#

Meaning they do not store values but instead references to object instances (e.g. new Location)

#

It actually does make sense if you understand all the logic behind it.

#

(A lot of other languages require references be explicit, as in location2 = &location1, but Java was made for dumbasses security and ease-of-use)

glossy venture
#

c/c++ right

lavish hemlock
#

Yeah, pretty much any low-level language.

glossy venture
#

except assembly

#
MOV %a, %b // ah yes
lavish hemlock
#

I mean technically in Assembly you just reference an address in memory.

#

Right?

glossy venture
#

yeah

#

also maow do you know how to run code after all plugins have loaded

#

like after all plugins have had onLoad called

lavish hemlock
#

Uhh, is there an event for it?

gray crypt
#

ohhh

lavish hemlock
#

Otherwise, probably not possible.

gray crypt
#

Thank you all for the advice, good to know Location#clone exists

#

much easier

glossy venture
#

no i think you can only listen to and dispatch events after onEnable

#

or technically before

#

as it prepares it

#

but whatever

lavish hemlock
#

Unless you were to have a repeating task that checks to see if each plugin registered was loaded (if you can see whether or not a plugin has been loaded), but that may cause some minor to major issues.

glossy venture
#

i could also just call my method in onEnable

#

probably the only solution

quaint mantle
#

immutable locations when

lavish hemlock
#

Then have a method called toMutable().

glossy venture
#

on every set method

quaint mantle
#

not that convenient

lavish hemlock
#

That works too.

#

I mean that is the main point of UnsupportedOperationException.

#

And is also what Guava does for immutable collections.

unreal quartz
lavish hemlock
#

(Plus, for API, deprecate all set methods to show that they shouldn't be used on an immutable type)

lavish hemlock
# lavish hemlock I mean technically in Assembly you just reference an address in memory.

Technically references are already this, they are primitive wrappers around addresses for some location in the heap.
The main difference is that low-level languages like C or C++ will keep the type those references refer to (as it is available information at compile-time) meaning you can dereference rather easily, while something like Assembly would have references as plain 64-bit (unsigned?) integers, and you'd have to fetch from the heap manually.

quaint mantle
#

honestly its just easier to use dumb mutable locations instead of doing wrappers or extending stuff by myself

lavish hemlock
#

(Fun fact: in Java, you can store primitives as pass-by-reference if you use Unsafe, as you can allocate a primitive to off-heap memory and get its memory address as a long in return, then pass that long to other methods which can use Unsafe to dereference the value in off-heap memory)

unreal quartz
lavish hemlock
#

Eventually, I might make a Java-esque JVM lang that uses Unsafe for shit like this though :)

#

&int :)

#

I am demonic :)

quaint mantle
#

ok

lavish hemlock
#

Anyway that was ✨ Maow rambles about memory and Unsafe for half an hour ✨

#

hope you learned something

vestal dome
#

I need help, I'm stuck, I've been trying to map the materials from minecraft and stuff.. and uhh.

#

basically I've been doing this for quite sometime but I've got stuck on banners, does anyone know how a STANDING_BANNER (1.12) gets it's color?

#

it's not by the magical byte value.. somehow that only changes rotation..

sullen marlin
#

BlockState (tile entity) presumably

vestal dome
#

why the hell are banners dfiferent from wool 😂

#

oh well

#

f

young knoll
#

Because they store patterns

wary flume
#

:))) i made a thing work

vestal dome
#

that's nice

regal dew
#

md do u have any plans of releasing spigot prereleases?

#

@eternal night what’s so funny?

eternal night
#

spigot has not published any pre-releases for any of the last versions. Neither snapshot nor pre-release builds. Everytime a version is released people spam for an ETA, so asking for a pre-release is like the nice evolution of that

visual tide
#

they take longer to release the main version than mojang takes to make the snapshots so it would be in no way worth it

regal dew
#

I still don’t see how it’s funny, it was a genuine question if there were plans to share builds which would help speed up plugin upgrades ^^

young knoll
#

No

regal dew
#

Also speeds up development in any of the chains attached to spigot ^^

young knoll
#

People would use them, break stuff, and then complain

mortal hare
#

are netty channel handlers handled asynchrounously

#

if so i would need to send synced task to server's main thread to sync it

#

?

eternal night
#

also how would you ever "update your plugin" if mojang might just release something else

#

e..g what benefit would you have in a version that might just break

regal dew
#

you don’t seem to understand, its pretty much what alpha releases are for. Doesn’t mean you release a new version on spigotmc, it allows you to keep up to date with the latest changes so you don’t have to rush everything at once when the actual release comes out 🙃

young knoll
#

I mean I could maybe see MD releasing them to trusted devs

#

But meh, probably not worth it

eternal night
#

I am fairly certain spigot is already being worked on for 1.18 don't get me wrong

#

but there is no reasonable point in releasing a snapshot build

mortal hare
regal dew
#

but this question was a simple yes/no question for md, i don’t see the point of discussing it here ^^

eternal night
#

okay, answer is generally no

#

at least from what history tells us

mortal hare
#

in order to do something like this, server software needs to follow fabric's path

#

Fabric modloader updates very fast while its fabric api takes more time

#

its still the same.

onyx basalt
mortal hare
#

but it allows the developers to develop mods without using it, thus it allows mod developers to develop things on their own, rather than wait for fabric api to roll out, but that of course is harder to do.

eternal night
#

arrays as 0 indexed in java

#

you should also check that the array even has that many items

onyx basalt
#

it has 1

eternal night
#

yea so your item would be at index 0 👍

mortal hare
#

Java and most of the computer languages count from 0

quaint mantle
#

I wonder if there's some languages that doesnt

eternal night
#

fortran 🙏

onyx basalt
#

bruh just this gives me the same error

if(cmd.getName().equalsIgnoreCase("item")) { player.sendMessage(args[1]); }

onyx basalt
#

oof

quaint mantle
#

oh god

onyx basalt
#

im just so so so so stupid

plain helm
#

Dide

#

Dude

#

Length 1

onyx basalt
#

i know omg

#

im so dumb

plain helm
#

Max args is args[0]

quaint mantle
#

i think ill get confused even more with languages that counts from 1

tidal hollow
#

I wanted to make a discord bot connected to minecraft, but when I put the JDA dependency in the pom.xml it appears "Dependency net.dv8tion.JDA: 4.2.0_208 not found" does anyone know why?

drowsy helm
#

Is it shaded

#

Or the pom.xml itself is saying that?

tidal hollow
#

the pom.xml

drowsy helm
#

Do you have the repository aswell?

tidal hollow
#

repository?

drowsy helm
#

Jda doesnt use maven central

#

So you need the repository

tidal hollow
mortal hare
#

any ideas how can i get ConcurrentIdentityHashmap implementation on java

#

There's only IdentityHashmap implementation

#

ofc i could synchronise my methods

crimson terrace
#

is it smart to store a currency inside a players PDC?

young knoll
#

Probably not

#

Currency should be easily accessible for an offline player

mortal hare
#

guava only provides map maker

#

with weakreferences

mortal hare
#

but cannot instanciate concurrent identity hashmap sadly

eager thorn
#

hola me ayudan soy nuevo como me uno a un pais

graceful turret
#

?paste

undone axleBOT
graceful turret
ancient plank
little trail
#

if I've done load default config, I can’t add new stuff to the default config right?

#

As it said it wouldn't replace current config

lunar folio
#

Hey there, somebody knows a better optimization way for PlayerMoveEvent? I dont care if this one moves one block, I care if player moves his camera, some suggestion please?

young knoll
#

Check if the x y and z are the same, if they aren’t then ignore the event

eternal oxide
#

blockx etc

young knoll
#

But then you will still process small movements in the same block

#

Probably want to compare the raw values, and make sure to account for percussion errors

#

Yes percussion

eternal oxide
#

most want to limit to teh same block, but allow camera movement

young knoll
#

Mhm

#

Not sure what you would do with camera movement

lunar folio
#

i only want make some very sensitive mechanics when Yaw and Pitch have changes 😄

eternal oxide
#

I doubt you can be very precise with pitch/yaw

#

it doesn;t send that often for camera movement

lunar folio
#

I think i will just create a default List of integers and make checks if yaw and pitch contains these numbers, and ofc optimize it if they are the same as before(cancel the event)

stuck ruin
#

when I am programming, what is the library that I need?

#

buildtools?

#

(for spigot 1.8 server development)

#

did this when I was younger but I forgot a lot of it

ancient plank
#

I recommend using a build system like maven or gradle, it makes it much much easier to manage dependencies

patent horizon
#
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Main.get(), new Runnable() {
  @Override
  public void run() {
  }
}, (ticks));```

is there a better way to do this?
sullen marlin
#

better in what way

patent horizon
#

cleaner code

sullen marlin
#

which part is not clean

patent horizon
#

it's just super chunky

sullen marlin
#

aside from the random () around ticks it's how I would write it

patent horizon
#

can i smoosh it down into like 2 lines

sullen marlin
#

sure, you can use a lambda for the runnable

ancient plank
#

do you consider lambdas clean

#

() -> {}

lavish hemlock
#

ye

#

if it's like

#

() -> singleMethod()

#

but, if you can, use method references

#

this::singleMethod

#

(note: do not make another method just use method references)

echo basalt
#

I'd rather see builder style scheduling

#

I made a util for my private projects as it gets a bit cluttered

sullen marlin
#

builders dont make sense when all the options are required

#

because you're shifting validation to runtime rather than compile time

little trail
#

Is requesting my config fine or is converting to a hashmap better

sullen marlin
#

its basically just a hashmap underneath

little trail
#

Ah nice ty

patent horizon
#

does this destroy the entity packet or just show the entity kill animation?

young knoll
#

What do you mean

patent horizon
#

well i have a method that uses the spawn living entity packet

#

now i need something to destroy that packet

#

but i dont want the kill animation packet, just to remove the packet entity

young knoll
#

Pretty sure remove just removes them

#

Try it

patent horizon
#

the entity.remove() method?

young knoll
#

Are you using a method or a packet

patent horizon
#

packet

young knoll
#

Then why are you asking about entity.remove

patent horizon
#

im not

#
    public void chickenPacket(Player player, Location loc) {
        World world = ((CraftWorld) player.getWorld()).getHandle();
        EntityChicken chicken = new EntityChicken(EntityTypes.l, world);
        chicken.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
        PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(chicken);
        ((CraftPlayer)player).getHandle().b.sendPacket(packet);
    }``` how do i destroy this packet after it's been sent to the player
paper viper
#

you need to send an entity destroy packet

young knoll
paper viper
#

you cant destroy the packet after its sent

#

lol

patent horizon
#

that.... was my question

#

also the wiki mentions an array

#

where would i get an array from since it's just one entity?

paper viper
#

just create an array of one element?

#

it seems that it supports removing multiple entities at once but you can just create an array with the desired entity id you want to remove

patent horizon
#

alr

#

and how do i grab the entity id

paper viper
#

should be a method inside there

#

to get the id

quaint mantle
#

I am doing a plugin on custom enchantments... I want to add the potion effect speed based on the level of the enchantment... this is my code so far ```java
@EventHandler
public void onMove(PlayerMoveEvent e) {
Player player = e.getPlayer();
if(player.getInventory().getBoots() != null
&& player.getInventory().getBoots().containsEnchantment(Enchantment.getByKey(Main.Speed.getKey()))) {

        player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, /*I don't know what to put in here...*/))

    }

}```
young knoll
#

Get the meta of the boots and use getEnchantmentLevel

worldly ingot
#

iirc, you don't really have to fetch the meta unless you're performing more than one call

#

There is a convenience method on ItemStack

ancient plank
#

yes

worldly ingot
#

(though it gets the ItemMeta so if you intend on getting more than one enchantment or performing other ItemMeta calls, just get ItemMeta and operate on it instead)

young knoll
#

Ah I thought the getLevel was only on meta

ancient plank
#

example:

#

may not be the best way to do it but this is what I used in my most recent plugin

worldly ingot
#

Would ideally make a single call to getEnchantments(), but yes

#

but there is also ItemStack#getEnchantmentLevel() that returns 0 if not present

ancient plank
#

SC_ZERO_THINK didn't know about that one

young knoll
#

Yes

ancient plank
#

gonna go do some quick updating slurp

young knoll
#

Custom enchantments via the Enchantment class are still very weird

worldly ingot
#

and really should be avoided

#

Especially now that PDC exists

ancient plank
#
int fortuneLevel = item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);

pog this is nicer

patent horizon
#

so i wanna make a method that throws a fishing rod hook when you right click a carrot on a stick, but how do i specify things like the line/bobber owner and such in the PacketPlayOutSpawnEntity method?

worldly ingot
#

Spawn entity accepts a data int and for fishing rods that int denotes the owner's entity id

patent horizon
#

awesome

#

tysm

young knoll
#

PDC doesn’t apply the enchantment glow

ancient plank
#

just apply a useless enchant and then hide enchants?

#

or smth

worldly ingot
#

Though hopefully Mojang adds something similar to the visual fire NBT tag that they added to entities

young knoll
#

True

twilit wharf
#

my onPlayerConnect event isnt getting triggered, I dont know why. java @EventHandler public void onPlayerJoin(ServerConnectEvent e) { String type = CustomConfigFile.getConfig().getString("config.join-type"); ProxiedPlayer pp = LobbySystem.getInstance().getProxy().getPlayer(e.getPlayer().getUniqueId()); DatabaseUtils.initialJoin((Player) e.getPlayer()); ServerInfo sv; if (type.equals("RANDOM")) { sv = LobbySystem.getInstance().getRandomLobby(); } else { sv = LobbySystem.getInstance().getProxy().getServerInfo("LOBBY2"); } System.out.println(ChatColor.AQUA + "[LobbySystem] >> " + ChatColor.GOLD + "New Player Connected. Sending them lobby " + sv.getName()); e.setTarget(sv); } and yes, it is registered in my onEnable

quaint mantle
#

while doing this I got an error can someone help me with it? [20:30:48] [Server thread/ERROR]: Error occurred while enabling Speedboots v1.0 (Is it up to date?) java.lang.IllegalArgumentException: Plugin cannot be null at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:72) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at com.nerdxd.plugin.speedboots.SpeedEnchantment.<init>(SpeedEnchantment.java:11) ~[?:?] at com.nerdxd.plugin.speedboots.Main.onEnable(Main.java:20) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:514) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:428) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:619) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:266) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3246-Spigot-6c1c1b2-dc764e7] at java.lang.Thread.run(Thread.java:831) [?:?]

ancient plank
young knoll
#

Injecting them also makes supporting other plugins easier

#

Like essentials

ancient plank
#

oh bungeecord probably?

#

disregard

twilit wharf
#

it was working

ancient plank
#

idk bungeecord stuff

twilit wharf
#

but it seems like every time i get something working, when I add the next thing it breaks the other

twilit wharf
quaint mantle
young knoll
#

Main.getInstance is probably null

twilit wharf
#

ye

quaint mantle
#

how can I fix?

twilit wharf
#

are you making the return value of getInstance set to this in your onEnable?

quaint mantle
#

ummm java public static Main getInstance() { return Main.plugin; }

#

this

twilit wharf
#

is Main.plugin being set to this in onEnable?

#

send onEnable

quaint mantle
#

kk

twilit wharf
#

ye

#

ok

#

so

#

in your onEnable, add Main.plugin = this;

quaint mantle
#

k

twilit wharf
#

that should fix it

quaint mantle
#

like this? java public Main plugin = this;

ancient plank
#

sounds like a lot more effort and complexity than needed tbh

young knoll
#

What does

twilit wharf
#

And you already initialized the variable, if you do it again it might cause issues

quaint mantle
#

like this??? cause this throw error java public static Main getInstance() { return Main.plugin = this; }

twilit wharf
#

No no no

quaint mantle
#

holy...

twilit wharf
#

In your onEnable

ancient plank
#

YMa_FelixPensive idk java either

quaint mantle
#

onenable
Main.plugin = this;

twilit wharf
patent horizon
quaint mantle
young knoll
#

They just did

quaint mantle
#

cause now I did this... java Main.plugin = this; litterally in my onEnable

twilit wharf
quaint mantle
#

OH

twilit wharf
#

Try it

ancient plank
#

we got there eventually folks

quaint mantle
#

IN MY ONENABLE

twilit wharf
#

Ye

quaint mantle
#

like this? ```public Main plugin;

@Override
public void onEnable() {
    System.out.println("Speedboots plugin is now activated...");
    registerEnchantment(Speed = new SpeedEnchantment());
    Main.plugin = this;
    Bukkit.getPluginManager().registerEvents(new EnchantmentListener(), this);

}```
twilit wharf
#

Yeah

quaint mantle
#

that thorws error

twilit wharf
#

But put the Main.plug-in = this; as the first thing in the onEnable

#

Try that ^^

quaint mantle
#

plugin = this

#

hello learn java before doing anything pls...

#

?learnjava

undone axleBOT
twilit wharf
#

Put that as the first line

ancient plank
#

what's a java SC_ZERO_THINK

quaint mantle
#

me too

worldly ingot
#

Should handle that for you

quaint mantle
#

ummm what do I return from getInstance?

#

@twilit wharf

#

???

patent horizon
#

return instance

#

public static Main get() { return instance; }

quaint mantle
#

return this?

young knoll
#

No

quaint mantle
patent horizon
#

im not sure what youre trying to do

#

thats the function i use to crab an instance of my plugin

young knoll
#

Crab

#

🦀

ancient plank
patent horizon
# worldly ingot Surely if you have an EntityFishingHook you don't really care about version depe...
    public void rodThrow(Player player, Location loc) {
        World world = ((CraftWorld) player.getWorld()).getHandle();
        EntityFishingHook hook = new EntityFishingHook(EntityTypes.bj, world);
        hook.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
        hook.setShooter(((CraftPlayer) player).getHandle());
        PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(hook);
        ((CraftPlayer)player).getHandle().b.sendPacket(packet);
    }``` no errors are coming back but the fishing rod just isnt showing up
#

and i debugged it to make sure the function was getting executed, and it was

quaint mantle
#

OML

#

pls help meeeeeeeeeeeeeeeeee

undone pebble
#

Due to your impatience, I'm not helping you

ancient plank
#

unlucky

twilit wharf
quaint mantle
#

I am so sorry... I know Java... I just have been concentrating on tests that I had today... I am very sorry... I fixed the problem with this... ```java
public Main plugin = this;

@Override
public void onEnable() {
    System.out.println("Speedboots plugin is now activated...");
    registerEnchantment(Speed = new SpeedEnchantment(this));

    Bukkit.getPluginManager().registerEvents(new EnchantmentListener(), this);

}

@Override
public void onDisable() {
    try {
        Field keyf = Enchantment.class.getDeclaredField("byKey");
        keyf.setAccessible(true);

        HashMap<NamespacedKey, Enchantment> byKey = (HashMap<NamespacedKey, Enchantment>) keyf.get(null);
        if(byKey.containsKey(Speed.getKey())) {
            byKey.remove(Speed.getKey());
        }

        Field nameField = Enchantment.class.getDeclaredField("byName");

        nameField.setAccessible(true);

        HashMap<String, Enchantment> byName = (HashMap<String, Enchantment>) nameField.get(null);
        if(byName.containsKey(Speed.getKey())) {
            byName.remove(Speed.getName());
        }

    } catch(Exception e) {

    }
}

private void registerEnchantment(Enchantment enchantment) {

    try {
        Field f = Enchantment.class.getDeclaredField("acceptingNew");
        f.setAccessible(true);
        f.set(null, true);
        Enchantment.registerEnchantment(enchantment);


    }catch (Exception e) {
        e.printStackTrace();
    }```
#

I am just being dumb

twilit wharf
#

Alright

#

Also, use paste bin next time 🙂

quaint mantle
#

yes I probably should... BUT NOT NOW I AM GOING TO SLEEP SO I CAN MAKE MORE PLUGINS TOMORROW BYE YALL!!!!!!!!!

silk tiger
#

how can i display the balance of a player from shop gui using the vault plugin to the scoreboard of deluxe hub

quaint mantle
#

please. dont spam it

#

@silk tiger

#

There... Ctrl + F find vault please.

drowsy helm
#

Do you have to spam every channel

silk tiger
#

yes

#

cuz no one was replying

#

and i am in a hurry

quaint mantle
#

then you should get mute

silk tiger
#

i dont fkin care anyways im leaving

drowsy helm
#

Lmao

#

I can guarantee you it’s not that important

ebon siren
#

how would i get the display name of an item? ItemMeta.getDisplayName() and getLocalizedName returns an empty string for an item without any kind of changes to its name

waxen plinth
#

The simplest way is to get the material and convert it to title case

drowsy helm
#

Doesnt account for name changes though

#

They want display name

waxen plinth
#

Yeah you would have to also account for if it has a display name in the meta

drowsy helm
#

ItemMeta#GetDisplayName shouldnt be returning empty though

ebon siren
#

got it

#

it is for me

drowsy helm
#

So maybe you’re getting yhe wrong meta

ebon siren
#

i try broadcasting it and all i get is ""

ebon siren
#

and try getting the display name from that meta

waxen plinth
#
public String getDisplayName(ItemStack item) {
  if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
     return item.getItemMeta().getDisplayName(); 
  }
  StringJoiner out = new StringJoiner(" ");
  String[] split = item.getType().toString().split("_");
  for (String s : split) {
    out.add(s.charAt(0)).add(s.substring(1).toLowerCase());
  }
  return out.toString();
}```
#

This should do the trick

ebon siren
#

huh

waxen plinth
#

Assuming >1.13

ebon siren
#

okay

#

yeah i'm on 1.16.5

waxen plinth
#

👍

ebon siren
#

i just thought this would work though

ItemStack item = plr.getInventory().getItemInMainHand();
ItemMeta meta = item.getItemMeta();

assert meta != null;
Bukkit.broadcastMessage(meta.getDisplayName());
#

anyways thanks

waxen plinth
#

getDisplayName will be null if the item has no name

tranquil viper
drowsy helm
#

Should be a runnable instead

#

Or cache their pos and if it’s no longer in acid dont damage them

#

Also your class and method names are super ambiguous

smoky tinsel
#

guys

#

i was code in 1.16.5

#

but the almost of all codes are updated

#

so cant code in 1.17 any more

#

im so sad

#

pls help me

#

for ex

#

CraftPlayer disappear

#

disapear

echo basalt
#

net.minecraft.world.entity.player or something

#

nms changed

smoky tinsel
#

so bad

#

im so mad

#

T^T

quaint mantle
#

Write normally, not one or two words on each line😐

smoky tinsel
#

sorry

tranquil viper
#

Is this using a String array or something

young knoll
#

String list

smoky tinsel
#

what did equalsIgnoreCase change to???

sullen marlin
#

I can assure you String.equalsIgnoreCase has not changed

#

try coding your plugin against the API, not nms

waxen plinth
#

no it's true they changed equalsIgnoreCase in java 17 now it only checks for uppercase numbers instead of letters

quaint mantle
#

woah?

#

uppercase numbers?!?!11!!?!

#

never heard about that before.

sullen marlin
#

LXIX

#

tfw no one responds 😦

smoky tinsel
waxen plinth
#

Elaborate please

solid cargo
#

yo why does the economy reset on my server every now and then. is it caused by my plugin or the server?

waxen plinth
#

we're gonna need slightly more details

solid cargo
#

such as?

drowsy helm
#

What eco plugin would be a good start

solid cargo
#

vault

#

for money itself EssentialsEconomy

smoky tinsel
waxen plinth
#

shocking

quaint mantle
#

LoL

solid cargo
quaint mantle
solid cargo
#

i wrote that cause of the capitalization

hasty dove
#

https://paste.md-5.net/vazesulalo.bash I always get theses errors when i start my server. From what i can see it tries to load 1.17 items even tho my server is 1.16.5 is there a way to fix this?

sullen marlin
#

did you install a 1.17 datapack or something

#

also this is a development channel

hasty dove
#

so possibly my friend might have installed a datapack

hasty dove
#

also i found the datapack thanks!

visual tide
#

how can i get the true target block of a player? since player.getTargetBlock(transparentBlocks, 5) returns the glass pane in a situation like this:

sullen marlin
#

.rayTrace

#

or .getTargetBlockExact

#

handy

quaint mantle
#

.getTargetBlockExact is better

visual tide
#

oke ty!

solid cargo
visual tide
solid cargo
#

good luck

visual tide
#

custom mining times with slow_dig

#

it already kinda works

solid cargo
#

have the mining system already implemented?

visual tide
solid cargo
#

nice!

visual tide
quaint mantle
#

Kill him

solid cargo
#

btw im still figuring out why the economy resets on my server every now and then, I use Vault and EssentialsEconomy and i believe its my plugins' fault

#

but idk what part of it

pastel carbon
#

the TabComplete event is broken in 1.17.1 it never gets called

glad badger
#

Does anybody know why PlayerItemHeldEvent might trigger twice?
I have debug printing right when the listener is registered, and debug when the event is triggered. Register debug plays once, itemHeld plays twice.
The version of nms I'm looking at shows that canceling that event doesn't call the event again, so I am a little baffled

solid cargo
#

who me?

drowsy helm
sullen marlin
#

Its only called for command arguments

#

The rest is client side

drowsy helm
glad badger
#

Fair, fair. Did not expect for it to call PlayerItemHeld for the offhand every time, but makes sense

#

Actually, wait

sullen marlin
#

Not sure thats right, I think buobuoo is confusing with interact event

glad badger
#

Yeah

drowsy helm
#

Oh wait held

#

Yeah read that wrong

solid cargo
#

are economy resets mostly server-side or my-plugin-side

#

well not server-side

sullen marlin
#

Is your plugin an economy plugin

drowsy helm
solid cargo
drowsy helm
#

If you send through your code id be happy to comb over it

solid cargo
#

it only fetches if a player has enough money to buy the certain thing

#

i can send you the tutorial i followed

drowsy helm
#

Code would be better

solid cargo
#

ok sure

drowsy helm
#

Im not gonna watch through a tutorial lol

solid cargo
#

its a text tutorial

#

ok lets move this to dms?

drowsy helm
#

Why?

#

Can post here

sullen marlin
#

Smooth dm slide :p

solid cargo
#

so.

#

this is the class variable(?)
private static Economy econ = null;

#
    private boolean setupEconomy(){
        RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
        if (economyProvider != null) {
            econ = economyProvider.getProvider();
        }

        return ( econ != null );
    }

    public static Economy getEconomy(){
        return econ;
    }
}
#

this is the setupeconomy thing

#
   if (!setupEconomy()) {
            System.out.println("Disabled due to no Vault dependency found!");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
#

and this is in onEnable

drowsy helm
#

How about where you interact with the economy

#

The fetching wont be the issue

pastel carbon
# drowsy helm You’re doing something wrong then

i just made the event with eventhandler on a class thats registered. But it never gets called also the supervanish plugin uses it to remove vanish people from tab-completions which doesnt work in 1.17.1 probably because the event is broken

solid cargo
#

Economy economy = FastWands.getEconomy(); The way i get the economy

sullen marlin
#

@pastel carbon

solid cargo
#

double playerBal = economy.getBalance(e.getPlayer()); this is the player bal

pastel carbon
#

i made a command like /msg then tab-completed and it didnt get called

drowsy helm
pastel carbon
#

im using viaversion tho idk if that might cause it

solid cargo
sullen marlin
#

Yeah no idea what viaver does

drowsy helm
solid cargo
#

?pate

#

?paste

undone axleBOT
drowsy helm
#

When were tab completions implemented in mc?

solid cargo
#

since 1.13

drowsy helm
#

Id assume any ver before wont send the packet

sullen marlin
#

Current ones were 1.13

#

Older ones was like 1.7

pastel carbon
#

yeah its caused by viaversion :/

drowsy helm
#

What version client are you on?

#

I have 0 issues with viaversion tab and completions

solid cargo
#

wait @drowsy helm what you need paste of?

drowsy helm
#

Just the class where you interact with the economy

pastel carbon
#

1.12.2 on a 1.17.1 server and the event doesnt get called but it still sends all the tab completions

#

in 1.17 client it gets called

solid cargo
#

so the place where i make the player balance variable?

drowsy helm
#

Yeah I guess

#

Im not sure what your plugin does so im not sure

solid cargo
#

ok can i explain? thats faster

drowsy helm
#

Wouldnt help much

#

Straight code is easiest to analyze

solid cargo
#

pretty much, i made custom items (kinda custom), which you can get by buying them.
So because you have to buy it you need to setup economy

#

ok i will

#

lets move this to a thread

drowsy helm
#

Sure

solid cargo
#

help

visual tide
#

get true target block pre-flattening

pastel carbon
#

how would u block a username from tab-completion as using viabackwards sends it using some custom packet or something so none of the events get called. Maybe like hide the user from the server so using any method of getting online users wont return it

smoky tinsel
#
else if (a == Action.RIGHT_CLICK_AIR)
            {
                EntityPlayer player = ((CraftPlayer) p).getHandle();
                PlayerConnection connection = player.playerConnection;
                PacketPlayOutAnimation armSwing = new PacketPlayOutAnimation(player, 3);
                connection.sendPacket(armSwing);
                connection.a(new PacketPlayInArmAnimation(EnumHand.OFF_HAND));
            }
#

um

#

what do i have to use instead of playerConnection;

#

;-;

sullen marlin
#

What are you doing

#

Also isnt there Player.swingHand or something

#

No packets required

crude charm
#
event.getClickedInventory().getName()

how do I do this on 1.17?

sullen marlin
#

getView.getName or something

smoky tinsel
#

i found

crude charm
#

aight

sullen marlin
#

getView.getTitle idk

smoky tinsel
#

um the answer was b

crude charm
#

thanks

smoky tinsel
#

xD

crude charm
#

Did you remove the need for a null check?

sullen marlin
#

Documention suggests so

crude charm
#

wow nice

broken hare
#
public class Bossbar {
  
  private final BossBar bar = Bukkit.createBossBar("Progress", BarColor.BLUE, BarStyle.SOLID);
  private final String ENDPOINT = "https://assets01.teamassets.net/json/donation_total.json";

  private final Listener listener;
  private final Runnable timerTask;

  public Bossbar() {
    listener = new BossbarListener();
    timerTask = new BossbarTimerTask();
  }

  public Listener getListener() {
    return listener;
  }

  public Runnable getTimerTask() {
    return timerTask;
  }

  private class BossbarListener implements Listener {
    /**
     * Adds player to the scoreboard map when player joins.
     */
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
      bar.addPlayer(event.getPlayer());
    }

    /**
     * Removes player from scoreboard map when player quits.
     */
    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
      bar.removePlayer(event.getPlayer());
    }
  }

  private class BossbarTimerTask implements Runnable {

    @Override
    public void run() {
      HttpResponse<JsonNode> response = Unirest.get(ENDPOINT).asJson();
      if (response.getStatus() == 200) {
        Integer count = Integer.parseInt(response.getBody().getObject().getString("count"));
        bar.setProgress(count / 30_000_000);
      }
    }
  }
}``` Boss Bar not updating.
#
    // Bossbar
    Bossbar bossbar = new Bossbar();
    pluginManager.registerEvents(bossbar.getListener(), this);
    getServer().getScheduler().runTaskTimer(this, bossbar.getTimerTask(), 0, 3 * 20);```
glossy venture
#

oh

#

shit that was so long ago

sullen marlin
#

lol

glossy venture
#

yo md5 is there a way to run code after all plugins have loaded

sullen marlin
#

yes

#

server something event

glossy venture
#

so after all onLoads have been called

sullen marlin
glossy venture
sullen marlin
glossy venture
#

wait cant you only register listeners in onEnable

sullen marlin
#

what do you want to do

glossy venture
#

load extensions

sullen marlin
#

most things should be done onEnable

glossy venture
#

i mean i could put it in onEnable

sullen marlin
#

extensions for what

#

there's PluginEnableEvent

glossy venture
#

but ill do it in onEnable i guess

sullen marlin
#

it'd help if you explained what you want to do

#

but onEnable is probably the correct choice

glossy venture
#

i basically have a library plugin

#

and it has components which would be useful to have per plugin

#

for safety and stuff

sullen marlin
#

shouldn't the plugins just depend: library, and then tell the library what to do?

#

Seems like you're having the library try and do things on its own

glossy venture
#

at least it should be

sullen marlin
#

I'd probably use PluginEnableEvent then in the library

#

because the library should be reacting to each plugin, not all plugins

#

alternatively switch it around and have the plugins call into the library, that would be more normal use of a library

glossy venture
#

but its supposed to run before all onEnables

drowsy helm
#

make the plugins using the lib depend on it

sullen marlin
#

well the library onEnable will run before the onEnable of plugins which depend on it

glossy venture
#

it enables/loads before the others

#

but it iterates over all loaded plugins in onEnable

sullen marlin
#

sounds like dependency inversion, I guess is the word

glossy venture
#
protected List<Ingredient> ingredients = new ArrayList<>(9);
``` also why is this giving me an index out of bounds exception at index `0`?
sullen marlin
#

because you didnt put anything in the list

glossy venture
#

oh

#

i have to fill it?

sullen marlin
#

yes

glossy venture
#

how would i do this?

#

they are supposed to be null

#

initially

drowsy helm
#

use an array then

sullen marlin
#

Arrays.asList(new Ingredient[9]) or something

glossy venture
#

just new ArrayList<>(Arrays.asList(new Ingredient[9]))

sullen marlin
#

ye that

glossy venture
#

oh lmao

#

ill try

#

ty

quaint mantle
#

Lists.newArrayList(new Ingredient[9]); 🙂

glossy venture
#

i tried but it didnt work

#

well i tried this new ArrayList<>(Arrays.asList(new Ingredient[9]))

drowsy helm
#

your still getting out of bounds?

glossy venture
#

now im just using simple for loop

glossy venture
#

i was first doing new ArrayList<>(9)

#

then tried new ArrayList<>(Arrays.asList(new Ingredient[9]))

#

and now im filling it with a for loop

drowsy helm
#

just use Arrays.asList(new Ingredient[9])

quaint mantle
glossy venture
#

idk

#

should work

quaint mantle
#

same err?

glossy venture
#

it seems like im doing something terribly wrong because the collection filling doesnt work either

#

im using set(int, T)

#

of ArrayList

drowsy helm
#

where are you iterating over it?

glossy venture
#

?

drowsy helm
#

like where its throwing the error

glossy venture
#
    public static <T> ArrayList<T> defaultedList(T t, int c) {
        ArrayList<T> list = new ArrayList<>(c);
        for (int i = 0; i < c; i++)
            list.add(t);
        return list;
    }
``` this was my attempt
#

to create list

quaint mantle
#

Idk maybe collections just wasnt intented to work with nulls

drowsy helm
#

no the area where you actually iterate over it

glossy venture
#

im using set(int, T)

drowsy helm
#

where was it throwing the index out of bounds error then

glossy venture
#

on it

drowsy helm
#

if you're not iterating over it

#

oh set(0, x) did it?

glossy venture
#

in ArrayList#set(int, T)

glossy venture
drowsy helm
#

does Arrays.asList(new Ingredient[9]) not work?

glossy venture
#

i need it to be mutable

#

doesnt that return an immutable list?

quaint mantle
glossy venture
#

ill try that

drowsy helm
#

no it returns a list

#

its mutable

quaint mantle
#

not expandable

glossy venture
#

oh

drowsy helm
#

interesting didnt know it was fixed size

glossy venture
#

i know from experience

quaint mantle
#

Its like a proxy for array

glossy venture
#

i always wrap it in new ArrayList()

drowsy helm
#

yeah

glossy venture
#

still doesnt work

glossy venture
#

neither

#

tf

quaint mantle
#

OutOfBounds?

glossy venture
#

yeah

drowsy helm
#

are you sure you're referencing the same list

glossy venture
#

yeah

drowsy helm
#

could we see code

#

sort of guessing rn

glossy venture
#

yeah

#

ill send it

#

and the error

#
        /**
         * The list of ingredients (shaped).
         */
/* 27 */ protected List<Ingredient> ingredients = Lists.newArrayList(new 
Ingredient[9]);

     /* ... */

/* 70 */ public Craft ingredient(int i, Ingredient ingredient) {
            ingredients.set(i, ingredient);
            return this;
         }

``` code
#

its a bit messy

#

added in line numbers

#
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
        at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
        at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
        at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?]
        at java.util.Objects.checkIndex(Objects.java:359) ~[?:?]
        at java.util.ArrayList.set(ArrayList.java:441) ~[?:?]
        at io.orbyfied.bucket.craft.Craft.ingredient(Craft.java:71) ~[?:?]
        at test.BucketCoreTest.lambda$onEnable$1(BucketCoreTest.java:42) ~[?:?]
        at io.orbyfied.bucket.craft.CraftRegistry.craft(CraftRegistry.java:48) ~[?:?]
        at test.BucketCoreTest.onEnable(BucketCoreTest.java:39) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:505) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:419) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:604) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:266) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:995) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303) ~[spigot.jar:3203-Spigot-18c71bf-aa69d1c]
        at java.lang.Thread.run(Thread.java:831) [?:?]
#

error

quaint mantle
#

wouldnt it be easier to use a Int2Object map here

acoustic pendant
#

hello! how do i register a placeholderapi class?

#

it's supposed to be like this but give an error

quaint mantle
#

Or replace nulls with Some sort of Ingredient.EMPTY

glossy venture
#

yeah

#

thats what im going to do

drowsy helm
#

yeah im a bit lost maybe List.newArrayList trims nulls?

drowsy helm
glossy venture
#

empty ingredient

ivory sleet
drowsy helm
#

strange

#

print the contents of the list and see whats in it

ivory sleet
visual tide
chrome beacon
#

Write your own getTargetBlockExact

visual tide
chrome beacon
#

Yes or find if Vanilla has an NMS implementation

visual tide
chrome beacon
#

Oh well write your own system then

#

Or you know... update

visual tide
visual tide
drowsy helm
#

consequences of supporting old versions lol

visual tide
#

i guess

tardy delta
#

is there no replacelast on a string?

quaint mantle
#

there's no

#

I guess you'd have to do pattern matching manually

tardy delta
#

hmm

#

why is this unreachable tho?

quaint mantle
#

Because the code ezexutes only if you have 2 args

glossy venture
#

^

tardy delta
#

ah that way

glossy venture
#
} else if (args.length == 2) {
#

at the top

tardy delta
#

struggling with args length for a tabcomplete

glossy venture
#

lmao

tardy delta
#

about 20 lines now

acoustic pendant
tardy delta
#

pick the right constructor

#

t needs a PointsDelivery instance

acoustic pendant
#

got it

#

ty

quaint mantle
tardy delta
#

nawh

#

its only the tabcomplete which goes brr

#

nearly making a switch in a switch

glossy venture
#

writing a crafting system is such a pain

#

matching sort of works

#

but when you craft it the ingredients multiply?

#

it is fast tho

quaint mantle
#

what

#

the most pain of recipes is shape bruteforcing IMO

crude charm
tacit drift
#

Spawn short term particles constatly at player's feet

crude charm
drowsy helm
#

theres a duration variable when you spawn them

tacit dagger
spare prism
quaint mantle
tardy delta
#

if a player has permission to execute a command (example /chatchannel) but the subcommand (example moderate) also has a permission that that player doesnt have, is a tabcomplete for /chatchannel moderate triggered?

humble heath
#

can any one help

#

i need the maven repository for luck perms i have the dependency for the pom.xml but not the repo]

quaint mantle
#

ask them ^^

ivory sleet
#

Or look at the gh repo

#

Or even the documentation

humble heath
tardy delta
#

it has no repo

humble heath
#

that is all it gives

quaint mantle
#

well it looks like they use normal maven repo

tardy delta
#

i only have a dependency and it works

humble heath
#

so how do i fix my dependency

spare prism
tardy delta
#

i have ```yml
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.3</version>
<scope>provided</scope>
</dependency>

ivory sleet
quaint mantle
humble heath
spare prism
humble heath
#

how

quaint mantle
#

(another reason to use command framework)

tardy delta
spare prism
#

At the right corner

#

Same values

humble heath
#

thank you

spare prism
granite burrow
#

Hey how can I set a specific line in an itemstacks lore

spare prism
quaint mantle
#

set not get lol

spare prism
silk tiger
#

hello guys

#

i needed a bit of help

#

when i give permission to deop players to open shop.all of shopgui they can open the shop but they are unable to open the shop sections please help me with this issue

onyx fjord
#

wrong channel

spare prism
silver shuttle
#

String ownerName = Bukkit.getOfflinePlayer(owner).getName()
Why does this return me a uuid?

eternal oxide
#

it willl return a name or null

silver shuttle
#

it reutrns a uuid.

eternal oxide
#

it can't

silver shuttle
#

well it sure does though

eternal oxide
#

not unless you have a player with a UUID as a name

#

that owner

silver shuttle
#
                   String name = setX.getString("name");
                    String owner = setX.getString("owner");
                    final String[] bound = setX.getString("bound").replace("[", "").replace("]", "").replace(" ", "").replace("\"", "").split(",");
                    String locked = "false";
                    if(setX.getInt("locked") == 1) {
                        locked = "true";
                    }
                    final String lockedFinal = locked;
                    BukkitScheduler scheduler = Bukkit.getScheduler();
                    scheduler.runTaskAsynchronously(myPlugin, task2 -> {
                        String ownerName = Bukkit.getOfflinePlayer(owner).getName();
                        String[] successful = getString("messages.info.successful").split("\n");
                        for(String s: successful) {
                            sender.sendMessage(s.replace("%owner%", ownerName).replace("%locked%", lockedFinal).replace("%name%", name).replace("%x%", String.valueOf(posX)).replace("%y%", String.valueOf(posY)).replace("%z%", String.valueOf(posZ)).replace("%world%", world));
                        }
                        if(getString("values.show-bound").equals("true")) {
                            for(String s: bound) {
                                String p = Bukkit.getOfflinePlayer(s).getName();
                                sender.sendMessage(getString("messages.info.bound").replace("%name%", p));
                            }
                        }
                    });
                    return true;
#

See for yourself

#

mysql data

#

  info:
    usage: "usage"
    not-player: "not-player"
    invalid-block: "invalid-block"
    not-point: "not-point"
    successful: "Owner: %owner%\nLocked: %locked%\nName: %name%\nPos: %x% %y% %z%\nWorld: %world%" # %owner%, %locked%, %name%, %x%, %y%, %z%, %world%
    bound: "&6%name%"

values:
  min-name-length: 3
  max-name-length: 10
  create-cost: 100
  bind-cost: 20
  lock-cost: 1000
  transfer-cost: 500
  icon-cost: 100
  distance: 20
  delay: 3
  parse-names: "true"
  show-bound: "true"
```Config
#

mc output

celest isle
#

how do I stop the armorstand I spawned in from appearing for a split second before the armorStand.setVisible(false); kicks in?

silver shuttle
celest isle
#

wtf is that method

eternal oxide
young knoll
silver shuttle
celest isle
#

i read on the forms and they said use somethign like overloaded method with consumer and i dont get it

old cloud
#

Hello, is there a way to increase the stack size of a specific material?

eternal oxide
#

your code is quite messy and you are probable displaying some other data and confusing yourself as to what is being displayed

silver shuttle
#

it is correct

eternal oxide
#

It litterally impossible for an OfflinePlayer to return a UUID as its name. For one its too long to even be accepted as a name

#

names are limited to 32 characters

young knoll
#

16

old cloud
eternal oxide
#

16 even

silver shuttle
eternal oxide
#

You are displaying some field from your sql and not teh OfflinePlayer name

silver shuttle
#

no I am not

eternal oxide
#

ok

silver shuttle
#

String ownerName = Bukkit.getOfflinePlayer(owner).getName()

eternal oxide
#

yes, very good, but your sysouts are all over the place

silver shuttle
#

oooooooooooooh hold on

#

wait no that doesnt explain it

eternal oxide
#

I'm betting your are printing name and not ownerName or somethign like that

#

what you are describing is literally impossible.

silver shuttle
#

I get the string that is the UUID from the MySQL
String owner = setX.getString("owner");

I turn it into the playername
String ownerName = Bukkit.getOfflinePlayer(owner).getName();

I print that ownerName
sender.sendMessage(s.replace("%owner%", ownerName));

#

you can not deny that this is corect

eternal oxide
#

yes, you also do lockedFinal).replace("%name%", name)

silver shuttle
#

name is the name of the warp point

eternal oxide
#

name being the uuid?

#

ok

silver shuttle
#

no

eternal oxide
#

well I'm not going to dig thorugh every bit of yoru code, but the answer to your question... No it is impossible for an OfflinePlayer#getName() to return a UUID string instead.

silver shuttle
#

those ar ethe only references done to it

eternal oxide
#

read what I said. its impossible

silver shuttle
#

can getOfflinePlayer be run async?

eternal oxide
#

probably yes

#

no guarantees

silver shuttle
#

seems like it

young knoll
#

Only the version that takes a string is blocking

silver shuttle
#

is blocking?

eternal oxide
#

can perform a Mojang lookup

silver shuttle
#

WAIT

#

i didnt define the uuid as uuid, i defined it as string

#

hold up

#

-.-

eternal oxide
#

then its doing a name lookup with a string not a UUID

silver shuttle
#

kill m.e.

#

it works now

#

is it still recommended to perform the getOfflinePlayer with UUID's asynchronously?

eternal oxide
#

not for a single player

silver shuttle
#

there might be hundreds

#

Thanks for the help though Elgar

eternal oxide
#

getting an OfflinePlayer by UUID is going to cause less lag than displaying the details in a message

#

getting the actual player will not be the cause of a performance drop

silver shuttle
#

kk

eternal oxide
#

if you are processing hundreds at once then yes it could be laggy

chrome beacon
eternal oxide
#

teh current amount, the maximum amount?

old cloud
#

I want to make minecarts stackable

young knoll
#

Yeah you can do it with NMS

silver shuttle
young knoll
#

But it’s still buggy

silver shuttle
#

it is very configurable and works really well for survival mode, not for creative

chrome beacon
#

Well yeah for creative you'd need a mod

old cloud
ivory sleet
chrome beacon
young knoll
#

Change the max stack size of the Item using reflection iirc

old cloud
chrome beacon
old cloud
#

Because who knows if its just editing one field

#

it could mess up somewhere else too

chrome beacon
#

Then you look at the refrences

old cloud
chrome beacon
#

NMS Item

old cloud
#

Ok, and how do I get a instance of that?

young knoll
#

Items.X

old cloud
#

Thanks 👍

mortal hare
#

is this packet still active

#

i can't find it inside nms

solid cargo
#

is there any skript java guy?

#

im making a method, which includes fetching stuff from a skript(ed) skript

#

so how can i fetch stuff and send the variable to a player (for debugging)

mortal hare
#

hook into skript plugin i guess

#

and parse data

solid cargo
#

well i have imported the skript thing

mortal hare
#

we don't use skript here in development, you need to reverse engineer things yourself.

#

just research the source code of the skript

#

and see what you need to hook into

#

it does have addon support

#

so it shouldn't be that hard to hook into

#

its not as if skript doesn't have any API for addon developers

solid cargo
#

yeah true

tardy delta
#

ew skript

mortal hare
#

talking about it in this server is cursed

tardy delta
#

scary

#

?paste

undone axleBOT
tardy delta
#

forgot to remove it but yea

old cloud
#

The field just not changes

#

Anyone knows how I can fix that?

visual tide
#

is there an event to detect when the player stops mining a block?

old cloud
#
public class Test {

    static class A {
        private final int CONST = 20;
    }
    
    public static void main(String[] args) throws Exception {
        
        A a = new A();
        
        Field field = A.class.getDeclaredField("CONST");
        field.setAccessible(true);
        field.set(a, -20);
       
        System.out.println(a.CONST);
    }
    
}
```This prints out 20, makes no sense 🙄
opal juniper
#

seems, unlikely

old cloud
#

ikr

#

Could it be that java 16 removed that?

paper viper
#

thats the reason why retrooper was fussing over packets not being able to made over reflection

#

cause there was the constructor and you have to use it cause the fields are final

#

The other way, of course, is to use Unsafe to modify it

ivory sleet
opal juniper
ivory sleet
#

so even if u could modify it at runtime it wouldn't help

paper viper
#

yeah its cause they are moving to "safety"

old cloud
#

I changed my project compiler to java 8 but that doesnt change anything

misty current
#

is there any particular reason to why an enum's constructor can't access static objects of the enum?

ivory sleet
#
class SourceVersion {
  static final int l = 321;

  static void print() {
    Sytem.out.println(l);
  }
}
class CompiledVersion {
  static final int l = 321;

  static void print() {
    Sytem.out.println(321);
  }
}``` @old cloud
#

idk if is during compile time or jit time

#

but regardless, the value is inlined

#

before any reflection thingy is able to do something about it

misty current