#help-development

1 messages · Page 259 of 1

misty ingot
#

time to rip off another genre and make it marginally better while claiming to have made it much better

remote swallow
#

?paste the full method

undone axleBOT
iron palm
remote swallow
#

does 1.9 even have titles

iron palm
#

i guess?

remote swallow
#

are you importing the correct api version in maven/gradle

iron palm
#

letme change my api version

remote swallow
#

if you are running this on 1.9, you should be using the 1.9 api

iron palm
#

ikr but the test server is only on 1.9

#

yeah it seems that the method doesnt exist

#

ty

quaint mantle
#

how I can cancal a task in the task ?

zealous osprey
#

return statement?

quaint mantle
#

return what

zealous osprey
#

nothing, just return;

quaint mantle
#

I want to completely shut of the task

#

thats bukkit task ?

#

never used it like that

#

I am using new Runnable

#

what ?

undone axleBOT
quaint mantle
#

why is it bad ?

tardy delta
#

if you instantiate a bukkitrunnable without any reason ill kill you

trim sinew
#

Is there any permissions to make it so I can enable/disable certain gamemodes? I.E enable survival and spectator but disable creative for someone

quaint mantle
#

unreachable code

#

breh

undone axleBOT
quaint mantle
#

oh actually no my bad

#

I fixed it I had an error above

#

yes thx but no shit

tender shard
#

<X>?

#

ah ok

fresh timber
#

how can I basically change the fracture of a block like the way u see how it is fractured or broken for my custom block breaking system?

quaint mantle
#

block.getDamage

#

I believe its smth like that

twilit roost
#

My World#rayTraceEntities isn't precise at all for some reason
heres the code:

//RayTrace
RayTraceResult rtr = player.getWorld().rayTraceEntities(player.getLocation(),
        player.getEyeLocation().getDirection(), 3, 2, new Predicate<Entity>() {
            @Override
            public boolean test(Entity entity) {
                return entity instanceof LootHolder;
            }
        });
if(rtr == null || rtr.getHitEntity() == null)
    return;

It returns the entity only when im 3 blocks away. Not closer not furthet

tardy delta
#

LootHolder.class::isInstance \😢

twilit roost
#

right thx
fixed

but still doesn't return the entity when im closer then 3blocks

tardy delta
#

maybe cuz you pass in 3

twilit roost
#

thats for maxDistance tho

#

ok nvm
just reloaded the server and it picks it up at <= 3

tardy delta
#

combination of 3 and 2 then?

twilit roost
#

thx tho

hushed pawn
#
public BotObject bot;

    @Override
    public void onEnable() {
            bot = new BotObject(this);
            
        Bukkit.getPluginManager().registerEvents(new BotEvents(bot.plugin),this);


        getCommand("bot").setExecutor((sender, command, label, args) -> {
            Player p = (Player) sender;
            bot.moveBot(p.getLocation());
            return true;
        });
#

why this command create new object?

twilit roost
#

?paste BotObject

undone axleBOT
hushed pawn
#

this is so wired

remote swallow
#

?details

undone axleBOT
#

Please provide your server version, relevant server logs ( https://paste.md-5.net/ ), a list of plugins, and what you've already tried doing.

hushed pawn
#

i dont thing more ditales will make things clearly

remote swallow
#

what are you trying to do and whats not working

hushed pawn
#

i call some function in my BotObjct, like this, but it recreate object somehow

remote swallow
#

so you want a new Bot, which im guessing is an NPC, to spawn at that players location when they run /bot

hushed pawn
#

no it have to tp existing one, but instead it creates new BotObject, like all the vars in object changes to default

tender shard
remote swallow
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
tender shard
remote swallow
#

your code would not be making a new bot on the cmd being ran

hushed pawn
tender shard
#

the code you sent will only ever create exactly one bot object

remote swallow
#

^^

hushed pawn
remote swallow
#

if you call new BotObject you are creating a new object, not getting the one that already exists

#

?basics

undone axleBOT
tame bay
#

Thanks

undone axleBOT
remote swallow
#

?di this is for me dontmindit

undone axleBOT
hushed pawn
red sedge
#

that website has a limit?

#

huh

remote swallow
#

if your code is over that limit refactor it

#

i dont ever see a reason for it to be over the limit

hushed pawn
#
public class Bot extends JavaPlugin implements Listener {
    public BotObject bot = new BotObject(this);

    @Override
    public void onEnable() {

        Bukkit.getPluginManager().registerEvents(new BotEvents(bot.plugin),this);

        getCommand("bot").setExecutor((sender, command, label, args) -> {
            Player p = (Player) sender;
            bot.moveBot(p.getLocation());
            return true;
        });

i even created it like this, but im pretty sure this command creates new object

red sedge
#

what even is the limit

remote swallow
tender shard
#

what even is "BotEvents"?

#

you however do have 2 different objects

hushed pawn
tender shard
#

you create one in the <clinit> block, and another one in onEnable

#

in onEnable(), just use "bot" instead of "new BotEvents(...)"

remote swallow
#

unless BotObject#moveBot creates a new instance of BotObject somehow, that command does not create a new instance

tender shard
#

yeah the command doesn't, but still they have 2 different objects. one in the field, and another as local variable in onEnable

remote swallow
#

oh yeah

fading spindle
#

is there any way i can change the texture of a custom item (made in a plugin) using a resource pack

remote swallow
#

custom model data

tender shard
#

yes

fading spindle
#

anyone got a tutorial

#

like a youtube video

hushed pawn
tender shard
#

?paste

undone axleBOT
tender shard
#

also:

#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

hushed pawn
#

Bukkit.getPluginManager().registerEvents(new BotEvents(bot.plugin),this);

#

in this

orchid gazelle
#

hmmmm.. any idea what the most efficient way is too check if a player would see a trail of my bullet?

#

(iterating over 1000 players to check if they are seeing every single location of every single particle would be very bad)

tender shard
#

and also:

#

?learnjava

undone axleBOT
wary harness
#

Inventory.containsAtLeast
will that work for checking if palyer has specific amount of someitme

tardy delta
#

unchecked casts \🤔

shell trench
#

I'm trying to get an item from a string(eg. "minecraft:dirt" or "minecraft:oak:log") with Material.getMaterial but this returns me null

remote swallow
#

you would need to strip the minecraft: iirc

night sapphire
# fading spindle anyone got a tutorial

I don’t know if you found one yet but here ya go. https://www.youtube.com/watch?v=XGxn_Mb8VzI

Wooo! Custom textures finally :) Since this is my first custom textures video, I made it pretty simple. There is definitely a lot we can do with textures as well as multiple ways to apply it to a player but first, we need to learn the basics. In this video, I explain how a texture pack works, how we make our own, and finally how to apply it to a...

▶ Play video
remote swallow
#

not coded red PepeCryHands

night sapphire
#

Lol why

tender shard
#

then do getMaterial(String, int) on that

tender shard
remote swallow
#

is that actual naming?

tender shard
#

i have no clue, that's what they sent

remote swallow
#

if they use the names in the file desc, its minecraft:oak_log

quiet ice
#

if it is, it was a horrible idea

tender shard
#

if you wanna go the API way: replace all ":" with "_" and make it all uppercase and completely remove the "minecraft:" part

tender shard
#

either the dude who asked this was mistaken, or mojang fucked up again

quiet ice
#

uppercasing and removing the material:-part is not needed once you use Material#getMaterial with the proper strings as input

tender shard
#

according to the docs, uppercasing IS needed

#

maybe you are confusing it with matchMaterial(String) ?

#

@shell trench use Material#matchMaterial, this seems to be doing what you are looking for

quiet ice
tender shard
quiet ice
#

This is just a glorified version of #valueOf

tender shard
#

I'm already glad that they removed all those numeric IDs though

shut field
#

Cannot invoke "org.bukkit.Server.getOfflinePlayer(String)" because "org.bukkit.Bukkit.server" is null ? what is that

#

why is that null

rotund ravine
shut field
#
Bukkit.getOfflinePlayer("CrotaPlague").getUniqueId().toString()
#

(my own username)

rotund ravine
#

Where are you running that

shut field
#

onEnable

quiet ice
rotund ravine
#

?stadh

#

?stash

undone axleBOT
rotund ravine
#

Sec

eternal oxide
rotund ravine
shut field
rotund ravine
shut field
#

or package or smth

rotund ravine
#

?paste

undone axleBOT
eternal oxide
#

"org.bukkit.Bukkit.server" is not bukkit

shut field
rotund ravine
#

True

rotund ravine
undone axleBOT
rotund ravine
#

Your class here and we’ll point out your issue

#

A full stack trace would be nice too

shut field
#

mk

rotund ravine
#

Why did you remove the public void from on enable?

#

Is this just to get your uuid?

shut field
#

oh oops it iss missing that

shut field
rotund ravine
shut field
#

I wanted to see if I could get my UUID while I was offline

rotund ravine
#

If you have joined the server before you can.

shut field
#

also I have "import org.bukkit.plugin.java.JavaPlugin;" in my code

#

ofc.

rotund ravine
#

Yeye

shut field
#

but yeah, nothing else, just the test of the offline player

#

my username

rotund ravine
#

There shouldn’t really be an issue, try using getServer().getOfflinePlayer instead of Bukkit.getOfflinePlayer

#

Also getServer().broadcastMessage (or whatever)

shut field
#

that worked, thanks

frank kettle
#

does anyone know how commands add the "sub commands" "usage" info on the chat?

LIke this:

#

i don't know what those are called, not sure what to search on google for threads

remote swallow
#

its called tab complete

frank kettle
#

is it an event or per command?

remote swallow
#

per command

#

one sec ill grab you an example

#

would look like this

tardy delta
#

mate return a switch instead

frank kettle
#

that sounds very confusing looking at it at first

quaint mantle
#

how can I create an npc ?

remote swallow
#

use citizens api

tardy delta
quaint mantle
tardy delta
#

you check the args.length to see at which position you are, so f.e. args[0] would have to return some root args

#

and that stringutil methods just ensures that whenever you type /test a you get all the completions starting with an a and not all the other ones too

quaint mantle
tardy delta
quaint mantle
#

-> when was that added to java

#

bruh

rotund ravine
river oracle
#

Java 8

#

Well earlier than that prob

quiet ice
#

not J8

river oracle
#

I forgor when they added lambda

quiet ice
#

You can't fool me there

quaint mantle
#

on tf version were I coding

quiet ice
#

That ain't lambda

worn perch
#

So sometimes I like to review some of the more popular plugins just to find out how they're made. This is a pretty dumb question but do I need to add anything to code when I put my classes in different folders.

For more context my current project structure is

  src/
    me/ 
      david/ 
        LearningSpigot/
          Main.java
          (different command classes are also here) 
          generators/
``` Would  I need to add anything for my code to find the classes located in the generator classes?
rotund ravine
quiet ice
#

That is the improved switchcase, but certainly not lambdas

river oracle
#

Java 11 that was added iirc

rotund ravine
#

J12 added switch expressions according to google.

quiet ice
#

I mean you can also add break; on a single line 😉

river oracle
#

But ywa ig

quiet ice
#

Yeah I doubt that it is J11, at least I don't recall using it

quaint mantle
#

or how tf it works

river oracle
#

But wait

river oracle
#

Spigot is an api

remote swallow
#

but no

worn perch
#

I did Main because that's what the spigot wiki said

remote swallow
#

what page

#

im gonna scream at someone

quaint mantle
worn perch
remote swallow
#

thanks

worn perch
#

np

remote swallow
#

the reason you shouldnt name your pluign main class main

quaint mantle
#

me naming it Main

#

built diffrent

worn perch
#

I just changed my main class to my plugin name and updated plugin.yml

quaint mantle
#

ye and

#

what happend

balmy valve
#

Anyone know a way to get a servers view distance inside the plug-in.

worn perch
quaint mantle
#

or I dont understand ur question

balmy valve
#

I mean the view distance option. How many chunks the server will load around the player

quaint mantle
#

ye what with that

#

oh you want to pre load it in the plugin ?

balmy valve
#

No

#

I just need to get the number for the view-distance*

quaint mantle
#

the players

#

?

balmy valve
#

Ah ty

#

I couldn’t find it because I kept trying to use render distance not view distance whoops

eternal oxide
#

?jd-s is your friend

undone axleBOT
balmy valve
#

I’m assuming that’s in chunks (it doesn’t say)

naive bolt
#

whats the chest open event

#

is it a player event or a block event

sour tundra
smoky oak
#

a tragedy in four steps: anyone a clue whats happening here?
Like
I restarted the server, manually copied the file, and recompiled cuz i wasnt sure if i maybe copied too early.
But it isnt loading the new plugin even after i restarted the server after making sure the new version is in the plugins folder

#

wait
it no longer reaches that part of the code even though i havent changed anything else
urgh

#

uuuuuuuuummmmm
i think the javadoc's wrong

remote swallow
#

whats up with it

smoky oak
#

or incomplete at the very least

org.bukkit.configuration.ConfigurationSection
@NotNull  String  getName()
Gets the name of this individual ConfigurationSection, in the path.
This will always be the final part of getCurrentPath(), unless the section is orphaned.
Returns:
Name of this section

HOWEVER
if you have, in that level, a string entry with the name <path>.name it takes that one instead

#

wtf

#

like

#

one spits out tt and one spits out the actual last part of the path

kind hatch
#

That seems right to me. If you have an input of "my.path.to.value", the return should be "value"

#

With that specific method.

#

If you want the actual value, you have to use the #getX() methods.

smoky oak
#

yea but that isnt working

#

uuuurgh

#

do i do regex on the full qualified path then

#

actually

kind hatch
#

What are you trying to get?

smoky oak
#

well the last part of the path of the configurationsectino

kind hatch
#

The name of the section or the value?

smoky oak
#

name

#

you know

#

getname

kind hatch
#

Then use ConfiguratIonSection#getName()

smoky oak
#

ah

#

im dumb

covert yacht
#

Hello, i was wondering if mysql was a good option for storing plugin data ? Is it viable ?

smoky oak
#

eh most people go with that cuz it can be done internally though i dont recall how

covert yacht
#

Yaml and JSON are not viable 😅

river oracle
#

I'd say it's viable since yk it's a database

#

Mongo is viable sqlite even is viable

covert yacht
river oracle
#

I hate when people use yaml and json for databases

#

Just use a real database

#

Like at minimum sqlite

covert yacht
#

xD, some says it's the easiest to use for beginners, uhhhh actually no, hard to config a database but when you have it it goes way faster and you don't ever need to bother about json corruption lul

echo basalt
#

amazon s3 is the real thing

raven fern
#

I have a small problem

#

everything is working fine until I tried adding PDC onto my item

#
public CustomMelee  (String itemName,
                         ArrayList<EnchantmentPlus> itemEnchantments,
                         ArrayList<String> itemLore,
                         Material itemMaterial,
                         String e1, String e2, String e3)  {
        this.itemName = itemName;
        this.itemEnchantments = itemEnchantments;
        this.itemLore = itemLore;

        itemItemStack = new ItemStack(itemMaterial);

        itemItemMeta = itemItemStack.getItemMeta();

        PersistentDataContainer itemData = itemItemMeta.getPersistentDataContainer();

        itemData.set(new NamespacedKey(Main.getPlugin(), "e1"), PersistentDataType.STRING, e1);
        itemData.set(new NamespacedKey(Main.getPlugin(), "e2"), PersistentDataType.STRING, e2);
        itemData.set(new NamespacedKey(Main.getPlugin(), "e3"), PersistentDataType.STRING, e3);
kind hatch
raven fern
#

so it was working before. i could get the item with lore/enchants and the items name

#

but after i introduced PDC doesnt work

remote swallow
#

?paste the full method

undone axleBOT
raven fern
remote swallow
#

why is all of that in a constuctor

raven fern
#

idk

#

i thought that if i was gonna type it once might aswell

remote swallow
#

?paste how you are getting the pdc

undone axleBOT
raven fern
#

im not even getting the pdc

#

i cant even get the item

remote swallow
#

what doesnt work

#

any errors

raven fern
#

lemme check console

#

14.12 22:28:15 [Server] [INFO] _nitey issued server command: /pdc
14.12 22:28:15 [Server] [ERROR] null

remote swallow
#

and that null is from?

raven fern
#

i also tried getting the item with AsynchPlayerChatEvent and it also doesnt work

raven fern
remote swallow
#

how is it being sent to console without an NPE

#

?paste the full method of where you run the CustomMeele class

undone axleBOT
raven fern
#

whats an NPE

remote swallow
#

?npe

undone axleBOT
#

The NullPointerException, (commonly referred to as NPE), is thrown in the following cases, but not sealed to: 1. null is passed into a method or constructor which does not allow it; 2. When trying to access a field on an object pointing to null; 3. Casting null to a primitive. See https://stackoverflow.com/a/3988794/17047120 for information on how to debug NPEs.

raven fern
remote swallow
#

your main problem seems that you arent ever returning that material

#

unless you have a getter somewhere else

#

im heading to bed so you'll probably need to wait for some other people to get more help

torn oyster
#

did 1.19.3 change much nms stuff

orchid gazelle
#

No

#

Just a bit

toxic haven
#
    @EventHandler
    public static void update_mob_name(EntityDamageEvent event){
        if(event.getEntity() instanceof Entity){
            String[] entity_name = event.getEntity().getName().split(" ");
            String final_name = String.join(" ", Arrays.copyOfRange(entity_name, 0, entity_name.length - 1));
            String display_to_mob = final_name + " " + ChatColor.GREEN + Math.round(((LivingEntity) event.getEntity()).getHealth() * 10.0) / 10.0 + ChatColor.WHITE + "/" + ChatColor.GREEN + ((LivingEntity) event.getEntity()).getMaxHealth() + ChatColor.RED + "❤";
            event.getEntity().setCustomName(display_to_mob);
    }
}``` Why does the first hit on a mob not update there hp?
eternal oxide
#

if(event.getEntity() instanceof Entity){ pointless

echo basalt
eternal oxide
#

will always be true

echo basalt
#

this really just sounds like a python developer converting to java

balmy valve
#

anyone know what event is fired when a player converts dirt to mud

orchid gazelle
#

What does the player do to convert it?

#

Probably PlayerInteractEvent and then check for what happened

balmy valve
#

thats what I was thinking but wasnt sure

#

a player right clicks a dirt block with water bottle

orchid gazelle
#

Yeah

#

Then just check if the item is a water bottle and the target is dirt

faint sedge
#

Hey, i'm struggling so hard to spawn some banners, could i get ur help ?
The code for now:

public static void turnIntoBanner(int x, int y, int z, World world, BlockFace direction) {
        System.out.println("1");
        Block block = world.getBlockAt(x, y, z);
        System.out.println("2");
        block.setType(Material.BANNER);
        System.out.println("3");
        Banner banner = (Banner)block;
        System.out.println("4");
        ((Directional) banner.getData()).setFacingDirection(direction);
        System.out.println("5");
        banner.update();
    }

[00:07:09 ERROR]: Could not pass event PlayerInteractEvent to pluginOneCube v1.0
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-21fe707-741a1bd]

orchid gazelle
#

Nvm

faint sedge
#

I can show you the context maybe ?

orchid gazelle
#

Nono its fine

faint sedge
#

okok

orchid gazelle
#

You cannot just cast the block to a banner

#

Or can you?

#

At this point im not sure /;

faint sedge
#

I've seen some people saying that it works :')

orchid gazelle
#

Hmm it should

#

Yeah sorry no idea then

brave sparrow
#

You cannot cast Block to Banner @faint sedge

#

You have to get the BlockState from it and cast that to Banner

faint sedge
# brave sparrow You cannot cast Block to Banner <@324153640216428548>

like this ?

public static void turnIntoBanner(int x, int y, int z, World world, BlockFace direction) {
        System.out.println("1");
        Block block = world.getBlockAt(x, y, z);
        System.out.println("2");
        block.setType(Material.BANNER);
        System.out.println("3");
        Banner banner = (Banner)block.getState();
        System.out.println("4");
        ((Directional) banner.getData()).setFacingDirection(direction);
        System.out.println("5");
        banner.update();
    }```
brave sparrow
#

Indeed

faint sedge
#

Doesn't work :(

brave sparrow
#

You’re going to have to be more specific

faint sedge
#

I've tried like this in first place

brave sparrow
#

What does “doesn’t work” mean

faint sedge
#

1
[00:28:25 INFO]: 2
[00:28:25 INFO]: 3
[00:28:25 ERROR]: Could not pass event PlayerInteractEvent to pluginOneCube v1.0
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-21fe707-741a1bd]
at

#

Same error

brave sparrow
#

That’s not the whole error

#

Send the whole error

faint sedge
#

It's too long :')

brave sparrow
#

?paste

undone axleBOT
faint sedge
#

can you read it ?

eternal oxide
#

copy/paste link here

faint sedge
#

sorry, i didn't know how it worked

#

is there a way to see the whole error ?

eternal oxide
#

it says that block location is not a banner

faint sedge
#

but i just turned it into a banner ?

#

Oh should i update it ?

#

Theres no update method for a Block

eternal oxide
#

there is no banner at the location you are passing

faint sedge
#

??? ofc theres no banner, there is air and i want to turn the air into banner ?

#

block.setType(Material.BANNER);

eternal oxide
#

you cant cast air to a banner

orchid gazelle
#

He is setting the Air to a banner

faint sedge
#

i think i can cause i'm printing the 3 before crashing

orchid gazelle
#

And then casting it

faint sedge
#

so the block.setType(Material.BANNER); is fine

orchid gazelle
#

Yes sure

faint sedge
#

the problem is here Banner banner = (Banner)block.getState();

#

But i don't know how to fix it

#

Cause Banner extends BlockState so it should be OK

#

Omg i think I know

tame bay
#

Hey I got an Idea which I would love to get an opinion on.
I want to make a home plugin. The plugins are stored in a database. When a user uses the /homes command a Investory should open containing a wool block for each home in the database.
Now I was thinking about saving the inventory as a hashmap value. So when the user uses the command it would just load the inventory from the hashmap and spare the request from the database aswell as creating a new inventory

#

Ist that a good solution or would that actually be worse for the Server?

eternal oxide
#

no need. store home locations in pdc

#

build ui when required

faint sedge
#

Ok my problem comes from the fact that there is org.bukkit.block.Banner and org.bukkit.material.banner

#
public static void turnIntoBanner(int x, int y, int z, World world, BlockFace direction) {
        System.out.println("1");
        Block block = world.getBlockAt(x, y, z);
        System.out.println("2");
        block.setType(Material.BANNER);
        System.out.println("3");
        Banner banner = (Banner)block.getState();
        System.out.println("4");
        ((Directional) banner.getData()).setFacingDirection(direction);
        System.out.println("5");
        banner.update();
    }```
#

so idk what to do :'(

#

cause i need both

eternal oxide
#

cast to the correct Banner

faint sedge
#

But i need both xD

#

cause

eternal oxide
#

use long format

faint sedge
#

?

#

what do u mean ?

#

oh

eternal oxide
#

org.bukkit.etc

faint sedge
#

yeah got it

tame bay
faint sedge
#

I fixed it, tysm for helping @eternal oxide @orchid gazelle

toxic haven
#

String display_to_mob = final_name + " " + ChatColor.GREEN + Math.round(((LivingEntity) event.getEntity()).getHealth() - event.getDamage()) + ChatColor.WHITE + "/" + ChatColor.GREEN + Math.round(((LivingEntity) event.getEntity()).getMaxHealth()) + ChatColor.RED + "❤"; Most effective way to display 0 if the mob's health is a negative number?

drowsy helm
#

Math.max(0, number);

#

please use proper naming conventions aswell

hazy parrot
#

someone came from python

eternal oxide
#
string name = final_name + " " + ChatColor.GREEN + (finalHealth <= 0 ? 0 : finalHealth);```etc
sterile token
fossil lily
#

Is there a better way hide little client icons with people when they're nicked? From my understanding I need to change their entire uuid!

ancient topaz
#

I'm trying to make a flag system like vulcan

#

and

#

idfk know how

#

or where to start

indigo iron
#

my command /shop works on 1.19 but doesnt on 1.19.2 has there been a chance in jar?

vocal cloud
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

indigo iron
vocal cloud
ancient topaz
#

?paste

undone axleBOT
river oracle
#

this.voidbox.onBreak(new BlockBreakEvent(block, player));
I'm surprised I actually got the opprotunity to ever instanciate a command class

#

never think I've done this before

ionic dagger
#

Does anyone know how much of a task creating a rpg type plugin would be?

#

Custom classes, world events, bosses and shit

#

J basing it off current rpg type plugins, is it a high complex thing?

jolly creek
#

im using joystack with spigot... is there a way to allow for tnt duping?

raw prairie
sullen marlin
#

what about it doesnt work

delicate lynx
#

that's a lot... I would print some debug statements

sullen marlin
#

is there an error

delicate lynx
#

to see where it doesn't work/fire

red sedge
#

how would i go about creating a new section with pdc?

#

like yeah i can prefix all the ids with soemthing

#

but i would rather have all of them grouped yk

eternal night
#

TAG_CONTAINER type

#

allows you to store a PDC inside a PDC

red sedge
#

interesting okay thanks!

#

okay um how am i supposed to get an empty pdc?

eternal night
#

create one from the adapter context of an existing pdc

#
final PersistentDataContainer container = itemMeta.getPersistentDataContainer();
final PersistentDataContainer inner = container.getAdapterContext().newPersistentDataContainer();
red sedge
#

alright thank you

fierce whale
#

I used this code to change the font of string message but it doesn't work 😦
Is there anyway to solve that?

TextComponent text = new TextComponent("\uF000\u0001");
text.setFont("custom");
Msg.send(player, text.getFont());
eternal night
#

I mean

#

What even is that

#

Why is Msg not just taking the component

tender shard
#

I heavily use that stuff for MorePersistentDataTypes lol

#

oh and also, components suck

echo basalt
#

the adventure components?

tender shard
#

both suck

echo basalt
#

eh

#

it's hard to make a nice message system

#

without going full MessageBuilder

tender shard
#

noone ever though "oh yeah let's use this weird component builder instead of just using a &c&lSTRING

echo basalt
#

I mean our system is legacy

#

but it works

#

and quite strong

tender shard
echo basalt
#

gotta love the lack of a code sample on the readme

tender shard
tender shard
#

but it works well

echo basalt
#

I mean

#

I just have a message file system

#

that does shit for me

#

then I just do

#

messages.sendMessage(sender, "no-permission");

tender shard
#

does it support adventure?

echo basalt
#

uh

#

it could very easily support adventure

tender shard
#

then go for your current stuff

echo basalt
tender shard
echo basalt
#

ew kotlin

#

the k word

eternal night
#

legacy works until it doesn't

#

¯_(ツ)_/¯

#

minedown is a pretty good alternative if you want to stick to the legacy syntax

#

which I don't mind tbh, while a bit of a harder learning curve for the colour codes it is very condensed

onyx fjord
#

Did somebody say legacy

eternal night
cold field
#

Hi guys, I'm experimenting entity velocities, I've found a strange behavior. I've set to an arrow (without gravity enabled) a velocity but this velocity with the time tend to reach 0

#

Does anyone know why this happens?

tender shard
#

air friction

#

you have to set the velocity on each tick, otherwise it will of course slow down again

#

best class ever

cold field
acoustic widget
#

Hello, i'm using a custom GUI inventory and InventoryClickEvent to cancel and prevent items to be taken

But when I use SHIFT + click, item appear and flickering on the right bottom of inventory (first animation) and if I set the gamemode at the same time, item stay in user inventory but disapear when I select it. (snd animation)

How can i prevent that ?

peak depot
#

update inventory?

tender shard
#

Player#updateInventory() or sth like that

acoustic widget
#

ok i'll try thanks

tender shard
#

however it will probably still look like they took the item for like 0.1 seconds or so

#

I don't think you can prevent that

acoustic widget
#

ok it works, thanks

tender shard
#

great

echo basalt
#

ghost item moment

tender shard
#

it's just an Illusion

compact haven
#

@tender shard holy shit

tender shard
#

hm?

compact haven
#

new pfp

#

do u like it

tender shard
#

you haven't seen it yet?

compact haven
#

Nope

tender shard
#

I got it since like 1.5 weeks or so

compact haven
#

Not very active here

tender shard
#

I fucking love it

compact haven
#

Last talked to you it was the insult thing in ur discord lol

tender shard
#

I asked that person to also draw logos for all my plugins

compact haven
#

it does look really nice

tender shard
#

thanks :3

compact haven
#

Was it the person I sent you?

tender shard
#

yowza

compact haven
#

ah okay

tender shard
#

I got 21 resources on spigotmc

#

12$ * 21

#

that'll be over 250 $

compact haven
#

😏

#

it’s okay with that commission rate in the about me I think it’s possible

#

how has it gone up 50 dollars since you last mentioned it lmfao

#

saw it when I clicked in to the pfp xd

tender shard
compact haven
#

:c I need to establish a presence like you

tender shard
#

I already got 10+ open comissions

compact haven
#

such deterrence would only work far against me lmao

tender shard
#

also, never underestimate your own worth

#

when someone sees "oh this dude charges 125€ per hour?" then they think "damn that dude must know his shit"

#

noone ever said "that's too expensive"

compact haven
#

Nah I agree

#

With the first part at least

#

but everyone I think I give a fair price to doesn’t take the quote xd

tender shard
#

also you always have to think about the taxes that go off from the hourly price

#

75€ is like 50€ after taxes

native ruin
#

You pay taxes on that?

compact haven
#

He’s a business

tender shard
#

ofc I do, I have to

compact haven
#

like legally established

native ruin
#

Oh

compact haven
#

and of course it’s illegal not to pay taxes

tender shard
compact haven
#

even as an individual kek

tender shard
#

would be funny if I didnt pay taxes lol

native ruin
#

I am not a buidiness so no taxes for me ig

tender shard
#

you always gotta pay the income tax

#

unless you're from afghanistan or sth, idk

native ruin
#

Welp guess the irs is coming for my kneecaps

tender shard
#

are you from the US?

#

if so, yeah, you have to declare EVERYTHING you make to the IRS

native ruin
#

No, but the irs is very persistant at being annoying

tender shard
#

ah ok

#

yeah the IRS is a huge jerk

#

same thing for germany

native ruin
#

Not from us just saying it because it's what most people recognize

tender shard
#

the general rule is - if you earn money, you gotta declare it. doesn't matter if it's only 20$ from some random discord member

compact haven
#

it’s called the IRS in other nations as well?

tender shard
#

you always have to declare everything

tender shard
#

in germany this jerk is called FINANZAMT

compact haven
#

ah y’all are confusing this American here

tender shard
native ruin
#

We have the fps

compact haven
#

talking about the IRS when not actually meaning the IRS, liars!

tender shard
#

I was talking about IRS

#

for example:

#

if you are a US citizen but you live in germany, and you make all your money in germany, and actually have nothing to do with US besides citizenship:

#

then the IRS is still trying to fuck you

#

that's why we have a DOPPELBESTEUERUNGSABKOMMEN with the US

native ruin
#

Anyway, time for the help portion of this channel

tender shard
#

noone asked a question yet

native ruin
#

How would one turn a colour into a block?

tender shard
tender shard
compact haven
#

it’s all one word in german?

tender shard
compact haven
#

ah shit yk I learnt a German word in English class a bit ago

#

Fervhenguan, definitely spelt it wrong though

tender shard
#

ughm

native ruin
tender shard
#

no idea what that is supposed to mean

tender shard
compact haven
#

ah fuck me

tender shard
native ruin
tender shard
native ruin
#

Unfortunate I can't use all blocks

tender shard
#

well ofc you can

compact haven
#

it might not have been German

tender shard
#

but remember, people could have their own resource pack

kind hatch
#

There’s a program called SpriteCraft that does this and I believe it has texture pack support.

native ruin
#

Ty for all the help boys and girls

remote swallow
#

whats going on in here

native ruin
#

Running from the irs don't worry

tender shard
# native ruin So?

that means, what you consider to be "red" might as well be "orange" or "yellow" on someone else's resource pack

native ruin
#

Fair

near citrus
#

how can i fix this

#

same thing happens with any entity class

red sedge
#

        
        PersistentDataAdapterContext pdcAdapter = meta.getPersistentDataContainer().getAdapterContext();
        PersistentDataContainer pdc = pdcAdapter.newPersistentDataContainer();
//stuff
meta.getPersistentDataContainer().set(ItemNamespacedKey.INTERNAL_CATEGORY.nsk, PersistentDataType.TAG_CONTAINER, pdc);```
remote swallow
red sedge
#

but theres no trace of the pdc in the item in game

remote swallow
#

what are you trying to add

worn tundra
#

Apply (reapply) the meta to the item

tender shard
#

it's because you create a new PDC

remote swallow
#

also that is so jank

red sedge
#

so um any ideas?

tender shard
#

you are never supposed to create a new PDC unless you know exactly what you're doing

worn tundra
remote swallow
#

alex wheres you pdc link

tender shard
#

just use ItemMeta#getPersistentDataContainer

red sedge
tender shard
tender shard
worn tundra
tender shard
red sedge
#

idk does it make sense?

tender shard
#

I see, but

remote swallow
# red sedge i do
PersitantDataContainer pdc = meta.getPersistentDataContainer();
pdc.set(NameSpacedKey, Type.STRING, "among us");
item.setMeta(meta);
tender shard
#

hm

#

yeah paste your full code

remote swallow
#

so why are you making a new pdc

tender shard
#

because he wants to have a new "section"

#

makes sense

worn tundra
#

But yeah give full code pls

tender shard
#

?paste

undone axleBOT
red sedge
#

that is kinda the full code tho

#

except the item parsing but like

worn tundra
#

Didn't have the item.setItemMeta tho

red sedge
#

alr

tender shard
#

I don't see you ever calling ItemStack#setItemMeta though

worn tundra
#

xd

red sedge
near citrus
# tender shard use mojang mappings

ok i have added mojang mapping to my maven dependency but some of the classes from nms are gone like the EntityCreature. did i do anything wrong or there is a replacement for that?

remote swallow
#

you dont return item meta so you cant be setting the meta

red sedge
#

wdym

remote swallow
# red sedge wdym

you are running this, then dont return item meta but you are trying to set the item meta

tender shard
#

?switchmappings

red sedge
near citrus
#

alr ill check it out

red sedge
#

since like im not creating a clone of it

#

it should be using the same object

remote swallow
#

is that not what you want to do

red sedge
#

it is

remote swallow
#

?learnjava

undone axleBOT
red sedge
#

but its not workingggggg

#

i do know java thank you very much

remote swallow
#

because you are trying to set item meta to something you dont have

red sedge
#

what? now im confused

remote swallow
#

you run compileStats then not returing anything or setting stuff outside of the method, then in compileItem you are trying to set the meta to what you have in compileStats

red sedge
#

well yeah because in compileStats i owuld be modifying the meta i passed in in compileItem

near citrus
tender shard
#

great

remote swallow
tender shard
#

actually it does?

remote swallow
#

they dont return anything or use the result from compileStats so how are they changing the meta to something else

tender shard
#

but that's not needed

#

when you change the ItemMeta object, it.... erm.. "keeps being changed" lol

remote swallow
#

so your saying that by settings the meta in compileStats, it somehow just changes the base meta

tender shard
#

ofc you have to set it back using setItemMeta

#

but otherwise - yes

remote swallow
tender shard
#

idk I didnt invent this class

red sedge
#

uh because its still the same object

#

when you ass it to a method you dont create a new object for that value

#

its all a mess 😭

remote swallow
#

jnak

red sedge
#

yup

arctic moth
#

when spawning dragons in the overworld, they seem to hate moving unless they take kb in some weird way. any way to force them to do the b-lining that they normally do?

#

i noticed that if you push them they suddenly gain AI

#

should i try that with a vector?

remote swallow
#

i would guess they only move around there "perch" point so you would need to simulate that im guessing

red sedge
#

so the only way to make them work the way you want would be completely remaking it

tender shard
#

the dragon code is a huge mess

remote swallow
#

?nms

#

we need an nms command

#

wheres imajin at

tender shard
#

he's online

#

ping him

remote swallow
#

@quaint mantle give us ?nms

red sedge
#

nms

remote swallow
#

make the response something like

NMS also know as net.minecraft.server is the base minecraft server code, it can be used in plugins to use things not in the api. To use NMS go to https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
tender shard
#

or that

remote swallow
#

gives an explanation and a link

tender shard
#

@quaint mantle ADD IT

#

ADD IT

#

ADD IT

#

ADD IT

#

NOW

#

pls

remote swallow
#

@quaint mantle weed boy, add the command

opal juniper
tender shard
#

ughm

remote swallow
#

jeff already has links here

tender shard
#

it's my blog

#

not theirs

remote swallow
#

?switching

tender shard
#

and we already have links to blog here anyway

#

e.g.

#

?switchmappings

tender shard
#

or the pinned post in #general

#

and that website has no ads so I guess it's fine

remote swallow
#

also that link is used by most people to show how to use nms

faint sedge
#

Hey, in 1.8.9 (minecraft) i want to set a head in some specific directions (North, East etc). It works for the cartesian ones, but it doesn't for SOUTH_WEST or NORTH_EAST for example. There's no error, it just doesn't work. Can u help me ?


        Block b = world.getBlockAt(blockToChange);

        BlockState skullState = b.getState();
        ((Directional) skullState.getData()).setFacingDirection(facing);
        skullState.update();```
the block is 100% a playerhead
tender shard
#

idk abuot that. all I know is that I don't earn anything when people visit the blog, so I don't think there's any reason to NOT send it

remote swallow
#

i wonder if optic knows how to add commands

tender shard
remote swallow
#

?1.8

undone axleBOT
faint sedge
#

HAhahahah

remote swallow
#

it can buy alcohol at 8?

tender shard
#

switch to 1.19 then ask again

faint sedge
#

But theres a lot of minecraft servers that are running in 1.8

tender shard
#

no

faint sedge
#

And I have to stick to it

#

Well, the servers that are interesting to me are all in 1.8

tender shard
#

nobody uses 1.8 except for like 6% of servers

remote swallow
#

fuck he beat me to it

faint sedge
#

But it's 100% of my servers :)

arctic moth
remote swallow
#

@vagrant stratus do you know how to add custom commands

tender shard
remote swallow
#

we need ?nms

tender shard
remote swallow
#

hes in away mode

#

so probably like passed out or something

tender shard
#

I think that optic doesn't have the perms to add commands

arctic moth
#

He was just talking in general yesterday

remote swallow
remote swallow
red sedge
tender shard
#

sure

red sedge
#

i mean

remote swallow
#

wtf is going on in germany

red sedge
#

i was drinkin it when i was 6

#

but buying?

tender shard
#

it's not allowed to sell booze to young people, but they are allowed to buy it

#

the law only applies to shpo owners, but not to customers

red sedge
#

i mean

tender shard
#

§ 1 BGB

red sedge
#

dont tell me you didnt buy it at like 12?

#

i cant be the only one

#

i mean

#

i was buying them for my dad but still

#

yuh

tender shard
#

lol well that's still illegal

red sedge
#

not illegal if they dont get caughtttt

tender shard
#

cigarattes are for 18+ only unless you bought them in the 60's

hushed pawn
#

how to teleport player without closing chest GUI?

red sedge
#

teleport them

tender shard
#

just reopen the inv after teleporting

fluid river
#

reopen the gui after teleport

red sedge
#

without closing their gui

fluid river
#

would be flashy but

hushed pawn
#

okay tanks

red sedge
#

no problem fellow tank

hushed pawn
#

how to make location1 be 0.5 blocks closer to location2

tender shard
red sedge
#

i mean

#

location1.add(location2.normalised().multiply(0.5))
eh? too overkill?

hushed pawn
#

i mean how to calculate

tender shard
#

what exactly are you trying to achieve?

fluid river
#
Location newLoc = location1.add(location2.toVector().subtract(location1.toVector()).normalize().multiply(0.5));``` i guess
#

or smth similar

quaint mantle
#

@remote swallow

#

@tender shard

#

?nms

river oracle
#

Good command 🔥

remote swallow
#

nooooo

#

PepeCryHands @quaint mantle

eternal oxide
#

poor english

remote swallow
#

its fine (totally)

eternal oxide
#

known, not know

echo basalt
#

oh shit I gotta work on the nms tutorial

remote swallow
#

i didnt even see that lmoa

eternal oxide
#

it can be used in plugins to use things not in the api reads better as it can be used by plugins to access things not in the api

remote swallow
#

fixed it

tardy delta
#

to access things that are not present in the api

eternal oxide
#

much better

tardy delta
#

;-;

remote swallow
#

now we just need @quaint mantle

eternal oxide
#

?nms

tardy delta
#

my comments are getting worse and worse

remote swallow
#

why comment stuff what you can just not

eternal oxide
#

comments are great

remote swallow
#

but they take effort to write

#

and time

#

which we can spend coding

eternal oxide
#

yep, worth while though

#

ooh, new keyboard is nice

#

got a ducky keyboard (brown keys)

remote swallow
#

damn

eternal oxide
#

feels very different to my old MasterproS

orchid gazelle
echo basalt
#

mf cant make gun code

orchid gazelle
#

lol

echo basalt
#

here's gun code

#

take some inspiration idc

tardy delta
#

why would you want to send the particles to players that arent even in that world tho?

echo basalt
#

and here's how you render a line

orchid gazelle
#

since then it will just return no points and therefore do not draw any particles

tardy delta
#

:o

orchid gazelle
echo basalt
#

your logic all wacky

orchid gazelle
#

why?

echo basalt
#

.normalize.multiply(16)

#

this must makes the offset 16 blocks long

orchid gazelle
#

I need to draw projections for every players, since otherwise the range of the particles is 31

echo basalt
#

just use a mutable vector and add a pre-defined direction

orchid gazelle
#

uhhh

edgy knot
#

Scoreboard How will I find him

remote swallow
#

Bukkit.getScoreboardManager().getMainScoreboard();

orchid gazelle
#

thats why im doing it like that

lyric tulip
#

Guys I have a hardcore world with change to the difficult, I want to add PotionEffects (like speed, streght, etc) to mobs with a plugin how I add that?

orchid gazelle
tender shard
#

?nms

tender shard
#

great

remote swallow
orchid gazelle
#

time for some Jägermeister?

tender shard
#

now I only have to install some ads and phishing plugins and then I can live in a mansion like md_5 does

remote swallow
#

it could be that

tender shard
remote swallow
#

why

orchid gazelle
#

ahhh thats also good

lyric tulip
#

Guys I want to add PotionEffects (like speed, streght, etc) to mobs with a plugin how I add that?

tender shard
#

why?

#

do you maybe need glasses?

#

that fucking template costed 120€

orchid gazelle
#

lol

tender shard
#

maybe you need to get them adjusted

#

Glasses: Fielmann

orchid gazelle
#

hahwahaha

tender shard
#

it was a few months ago

#

naaaah

#

buying it is way less expensive than recreating it

lyric tulip
#

Guys I want to add PotionEffects (like speed, streght, etc) to mobs with my plugin how I add that?

remote swallow
#

alex can i borrow your gun

tender shard
undone axleBOT
orchid gazelle
#

ok screw this now im confused

tender shard
muted crest
tender shard
orchid gazelle
#

I am currently trying to get a List of Locations to spawn particles on, depending on a Location it starts + the length of it

#

but..

muted crest
orchid gazelle
#

I gotta use some raytracing shit lol

tender shard
#

what's line 324

muted crest
tender shard
#

what's "sto"?

orchid gazelle
#

fake bullet?

tender shard
#

can I dm it to you?

remote swallow
#

ye thats fine

orchid gazelle
#

you mean just using an arrow with another texture huh

#

no that does not work for what I need

#

Max Velocity of Entities is 60m/s

#

and I need 900

#

because its how mojang coded it lol

#

if you go over 4.1, the client will no longer have the right velocity and it will be buggy displaying

#

guns

#

RayTraces

#

because that is slow as shit

#

and then it is garbage gun system

tender shard
#

ahaha when you google "dead dog" it actually shows pics of dead dogs lmao

orchid gazelle
#

oh yes it is, I tested it

rotund ravine
#

not really

orchid gazelle
#

no it is 144

#

40*3.6 = 144

#

but max is 60

#

so thats 220

lyric tulip
#

Guys I want to add PotionEffects (like speed, streght, etc) to mobs with my plugin how I add that?

orchid gazelle
#

and a gun has a lot more

lyric tulip
#

How I put the code?

orchid gazelle
#

well now imagine my players driving a car to get away from bullets lol

#

which is 1. bugged asf and 2. laggy asf

muted crest
rotund ravine
#

"Add potion effects to mobs, spigot"

undone axleBOT
lyric tulip
rotund ravine
muted crest
# tender shard what's "sto"?

Basicly:

DrawerStorage sto = new DrawerStorage();
sto.setAmount(Integer.parseInt(am));
sto.setLocation(e.getBlock().getLocation());
sto.setMaxamout(2068);
sto.setMat(Material.getMaterial(mat));
sto.setOwner(p.getName());```
twilit roost
#

I have ArmorStand inside some blocks
But I want to move it a bit back, without teleporting, so its nice and smooth

But setting its velocity doesn't do anything at all

#

I do get MOVED in Console

remote swallow
#

what is moveByForce

twilit roost
#

accidentally left it out from the snippet

#

this being velocity when souted

#

these are all modifications made on that ArmorStand

tender shard
tardy delta
#

mutable stuff aaaaa

tender shard
#

or make all fields public

remote swallow
#

what actually is the protected type

tender shard
#

protected means it can only be changed from within the class or subclasses

tardy delta
#

that subclasses can access it too

#

fuck

tender shard
#

it's like package-protected except that it doesnt care about the package

remote swallow
#

is it actually good

tender shard
#

it has it's usecases ofc

#

in 99% of cases you will not need it though

#

example: the health field in the CraftEntity class

#

you don't want people to access it directly, but if you now have CraftZombie, it's supposed to have access to it

muted crest
tender shard
#

it should work then

#

if it still doesn't, you need a custom TypeAdapter class

muted crest
remote swallow
#

new GsonBuilder().registerTypeAdapter(...).build()

#

if you use gson

muted crest
#

Ok lil test that later

sage patio
#

how i can reload gradle dependency loading (downloading) in intellij?

tender shard
remote swallow
tender shard
echo basalt
#

this one :)

sage patio
#

ow thanks

tender shard
#

this is for maven, but gradle should have a similar button in intellij

tender shard
#

looks like you forgot a } in your build.gradle lol

sage patio
remote swallow
#

?paste ur build.gradle

undone axleBOT
tender shard
#

?switch to maven

remote swallow
#

no

echo basalt
#

no

sage patio
tender shard
#

what happens when you run gradle build anyway?

remote swallow
#

use gradlew build

tender shard
#

gradle 🥲

#

"Oh I need to download myself, because version 3.4.1 is not compatible with 3.4.0 anymore"

remote swallow
sage patio
tender shard
#

File -> Invalidate Caches -> Check every box and click on "Invalidate & Restart"

sage patio
tender shard
#

then get a beer because it'll take like 3 minutes before it starts working again

remote swallow
#

thats not a gradle issue

tardy delta
#

tf is val

tender shard
#

yeah it's an IntelliJ issue