#help-development

1 messages · Page 1379 of 1

ivory sleet
#

yeah

dusk flicker
#

put it in a method

crude charm
#

oh

ivory sleet
#

you have to do it in a scope (method, init block, constructor, static init block)

crude charm
#

im so dumb

#

BRUH

#

WTF

dusk flicker
#

.. yes

ivory sleet
#

23490 iq problem solved by Rack

crude charm
#

dont bully its 3am

dusk flicker
#

then go to sleep

young knoll
#

Bullies

dusk flicker
#

xD

crude charm
#

lmfao

fathom timber
#

@dusk flicker where is Room Shoes?

#

I can't find them 😕

dusk flicker
#

wyhat

rain solar
#

Which event is fired when the player right clicks a respawn anchor? (except playerinteract)

young knoll
#

I would imagine only that

hardy valley
#
package standard.plugin.skills;

import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

@SuppressWarnings("ALL")
public class ValorSkill implements Listener {
    public void onHit(EntityDamageByEntityEvent e){
        if (e.getDamager() instanceof Player) {
            if (!(e.getEntity() instanceof LivingEntity)) return;
            Player player = (Player) e.getDamager();
            if (player.hasPermission("bskills.valor")) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, 2));
                player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 60, 2));
                player.sendMessage("Il tuo valore ti conferisce potenza!");
            }
        }

    }
}
``` Why doesn't it give the effect to the player?
#

I don't see anything wrong

ivory sleet
#

lol surppress all warnings

#

gg wp

dusk flicker
#

oh god supresss warnings

#

bet you use eclipse

hardy valley
#

I use IntelliJ

dusk flicker
#

so you added that yourself

hardy valley
#

I did

dusk flicker
#

remove it.

#

Never.
Use.
It.
Again.

#

SupressWarnings is a disease

ivory sleet
#

though I use it sometimes

#

I mean

#

cba to get warning

#

lol

dusk flicker
#

Well if you are experienced

#

for startes

#

never touch it

ivory sleet
#

yeah thats very true

hardy valley
#

alright but

#

why doesn't it give the effect to the player that hits the entity

dusk flicker
#

Well we will find that out

#

but one problem at a time

#

Remove the supress warnings

#

and what warnings is it giving you

hardy valley
#

oh I figured out the problem alone

ivory sleet
#

pro coder

hardy valley
#

anyway the warnings were I wrote in Italian

#

nothing else don't worry

hot silo
#

did you register the event

#

also add @EventHandler above the method

young knoll
#

How do you get warnings for writing a string in another language

ivory sleet
#

its probably unknown vocab word

young knoll
#

Does IJ give warnings for spelling?

late ledge
#

Is there a quick way to get the spectators of a certain entity? (Spectator mode -> left click kinda spectate)

unreal quartz
#

(to Coll1234567 because automoderator): yes

#

and also I don't think so, other than if you track it yourself or iterate through everybody and get their spectator target

late ledge
ornate heart
#

Any easy way to delete the tree trunks of a tree? I'm not too worried about the leaves considering they'll just decay.

young knoll
#

Set them to air?

quiet ice
#

I personally use the BFS algorithm for that, though any flood filling algo will work (provided it is applicable in 3D space)

lost matrix
#

But you def need some limitation for that or else you will decay whole forests.

quiet ice
#

Of course, but you'll realise that as soon as the server OOMs

lost matrix
#

I mean if you step the algorithm each tick you wont have that problem. You will just discover a slow crawling virus that slowly eats through all connected forests ^^

quiet ice
#

even then, you have to be aware of large oak trees

lost matrix
#

Btw i used A* for that which worked quite well

quiet ice
#

As they have disconnected logs as far as I know

young knoll
#

I think they are always touching at least diagonally

#

And you probably won't destroy whole forests as trees rarely have logs touching

noble spire
#

I'm just wondering, is there a way run spigot plugins on a 1.17 snapshot? I've had a look but this is literally the only information I have found, which is very vague.
https://www.spigotmc.org/threads/snapshot-1-17.489818/
How could/would you go about building it for a custom version? Do you need to somehow build spigot using the 1.17 snapshot jar?

young knoll
#

You would need to build it against the 1.17 jar and make all the changes needed for it to work

#

Which is likely a lot

quiet ice
#

Yeah, especially after the last few snapshots that basically changed the entire game

noble spire
#

yeah

young knoll
#

And then changed it back :p

#

Kind of

quiet ice
#

They did not change anything within the code structure back

young knoll
#

Correct

quiet ice
#

I think your biggest bet are the bukkit reimplementations for fabric

#

Just be aware that they are going to run ... not well

young knoll
#

I don't think they would even support 1.17

dusty herald
#

kinda sad the caves and cliffs update was delayed

hardy valley
#
package standard.plugin.skills;

import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

import java.util.List;


public class AuralSkill implements Listener {
    @EventHandler
    public void rightClick(PlayerInteractEvent e) {
        if (!e.getPlayer().hasPermission("bskills.aural")) return;
        if (!(e.getPlayer().getHealth() <= 4)) return;
     /*21 line*/   if (e.getClickedBlock().getType().equals(Material.AIR)) {
            List<Entity> entities = e.getPlayer().getNearbyEntities(10, 10, 10);
            if (!(entities instanceof Player)) return;
            ((Player) entities).addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 70, 2));
            ((Player) entities).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 10));
        }
    }
}
``` Why does line 21 give NullPointerException in console?
quiet ice
#

correct

#

Run java 15+ god damn it

hardy valley
quiet ice
#

Yes, Java 15+ has helpfull NPEs per default, really nice for debugging

#

I would bet absolutely nothing that e.getClickedBlock() is null though

young knoll
#

Yes

#

You should null check it and/or check the click action

#

Also I recommend isAir to account for cave air

dusty herald
#

and would this even work correctly?

List<Entity> entities = e.getPlayer().getNearbyEntities(10, 10, 10);
            if (!(entities instanceof Player)) return;```
entities is a list of Entity
hardy valley
#

I didn't even notice wth

quiet ice
#

also, type signatures are erased at runtime

dusty herald
#

You're also giving a list of entities potion effects

#

don't know if that would work either

young knoll
#

It won't

dusty herald
#

yeah i figured

young knoll
#

The cast will throw a CCE

dusty herald
#

might wanna loop through entities and check if they're a player and give them the effect

hardy valley
#

exactly

dusty herald
#

though entities can be given those effects but I doubt that's what you want to do

young knoll
#

Only LivingEntities

dusty herald
#

right

noble spire
#

/how it works

#

i have no idea

eternal oxide
#

you probably need the switch --generate-source

noble spire
#

is that a buildtools option?

eternal oxide
#

yes

noble spire
#

yeah you're probably right

#

that's the tree with the option

eternal oxide
#

that was run a bit quick

#

no way BT ran in that short of a time

noble spire
#

yeah it did

#

i guess it cached stuff

#

in that dir

eternal oxide
#

yes

noble spire
#

cool i'll see what i can get

#

i guess

thorny orchid
#

Hey, there is a way to create custom advancement with a plugin ?

#

Because datapack is horrible

young knoll
#

Datapacks are probably better

#

Unless someone makes a nice API for it

thorny orchid
#

Yes, but i want to create "unique" advancement with a different name everytime

young knoll
#

You basically just have to write the Json via code

thorny orchid
#

But i don't know how to use it lmao

young knoll
#

It has an example

#

There is also this

thorny orchid
#

thanks you I'm going to see this

past glen
#

hey can someone help me fix a bug?

#

sorry im intruding on a question, I can wait

eternal oxide
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

past glen
#

thx

#

so Im making a life steal sword which should transfer hp from the entity being damaged the the player doing the damage but it wont work, here is my code ```public static void onAttack(EntityDamageByEntityEvent event) {

    if (event.getDamager() instanceof Player) {

        Player attacker = (Player) event.getDamager();

        
        if (attacker.getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.lifesteal_sword.getItemMeta())) {

           attacker.setHealth(attacker.getHealth() + event.getDamage());

        }


    }
}
#

I have no idea whats wrong

eternal oxide
#

is it annotated?

past glen
#

?

eternal oxide
#

@eventhandler

past glen
#

yes its annotated

young knoll
#

Is it registered

past glen
#

heres the full code ```public class MoreSwordsEvents implements Listener {
@EventHandler
public static void onAttack(EntityDamageByEntityEvent event) {

    if (event.getDamager() instanceof Player) {

        Player attacker = (Player) event.getDamager();

        if (attacker.getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.wither_sword.getItemMeta())) {

            LivingEntity victim = (LivingEntity) event.getEntity();
            //Do something
            victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,100, 3));

        }
        if (attacker.getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.ice_sword.getItemMeta())) {

            LivingEntity victim = (LivingEntity) event.getEntity();
            //Do something
            victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,50, 2));

        }
        if (attacker.getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.lifesteal_sword.getItemMeta())) {

           attacker.setHealth(attacker.getHealth() + event.getDamage());

        }```
eternal oxide
#

have you tested to see if the event is being called?

young knoll
#

Also, comparing meta requires the durability to match

quiet ice
#

Try a few debug Sysouts I guess

past glen
#

how do I do that, total noob here?

young knoll
#

Which probably isn't the case

past glen
#

well the item meta thing works for other items

#

I have 4 swords already

eternal oxide
#

does the wither effect get applied?

past glen
#

yes, for the wither sword the wither effect is applied, and for the ice sword, slowness is applied

eternal oxide
#

k

past glen
#

how do I check if the event is being called?

eternal oxide
#

so its literally just the setHealth thats not working?

past glen
#

I think so

eternal oxide
#

add a sysout just before the setHealth

past glen
#

k

thorny orchid
#

@young knoll, this is a great API, but there is a another, because i need to put NBT tags to the "Material", and i see nothing on the web.

#

Wow, never mind, i click on the documentation button and i saw this so my problem is fixed thanks you

past glen
#

I figured it out, It was the item meta after all

minor fox
#

Does documentation for packet classes exist?

#

(official or unofficial)

young knoll
#

Is the best you will probably find

upbeat yarrow
#

anyone know the method to get a list of entity namespaces?

#

so a list that contains minecraft:arrow down to minecraft:zombie

#

actually wait ill just see how it done in vanilla

gleaming grove
#

EntityType.values() i think

upbeat yarrow
#

yup thats it thanks

past glen
#

anyone know how to check if a player is holding a specific custom item? I need an effect to be applied when the entity damaged by entity event is triggered and the player is holding the item

lost matrix
past glen
#

how do I do that? kinda a noob here srry

past glen
#

I will see if I can figure out what in the world the post is talking about, thx

minor fox
#

Does anyone know what the Vec3D field represents in PacketPlayInUseEntity?

lost matrix
gleaming grove
#
    {
        Bukkit.getScheduler().runTaskAsynchronously(Main.instance, () ->
        {
            final String url = "jdbc:mysql://"+database_entity.server+"/"+database_entity.database+"?autoReconnect=true&useSSL=false" +
                    "&autoReconnect=true&useUnicode=true&characterEncoding=utf-8"; //Enter URL w/db name
            try
            {
                Class.forName("com.mysql.jdbc.Driver"); //this accesses Driver in jdbc.
            }
            catch (ClassNotFoundException e)
            {
                System.err.println(ChatColor.RED+" jdbc driver unavailable!");
                result.accept(null);
                return;
            }
            try
            {
                Connection connection = DriverManager.getConnection(url,database_entity.user,database_entity.password);
                if (connection!=null && !connection.isClosed())
                {
                    result.accept(connection);
                    return;
                }
                result.accept(null);
            } catch (SQLException e)
            {

                result.accept(null);
            }
        });


#

try this

#

and swap "database_entity" varables with your sql data

young knoll
#

Oh no

young knoll
#

I would recommend a connection pool like HikariCP

#

?paste

queen dragonBOT
cunning cloak
young knoll
sour rampart
#

should this work: utils.createItemByte(inv, "terracotta", 14, 1, 45, "Confirm", "Click here", "to create", "your recipe!");
(14 is the byte id (color), 1 is the amount of the blocks and 45 is the slot of the inv its in)

young knoll
#

I mean we don't know what your utils method is

sour rampart
#

here ill paste md it

young knoll
#

Why do you pass a string rather than a Material

#

Also you can do meta.setLore(Arrays.asList(loreString));

#

Also you can do meta.setLore(Arrays.asList(loreString));

sour rampart
#

@young knoll where

young knoll
#

Where what

sour rampart
young knoll
#

In place of the loop you currently use

sour rampart
#

thx

bright jasper
#

Alright so basically, I need to get the first ChatColor from a string, this would usually be easy with regex but i would also like to support hex colors

#

so its a bit difficult

outer crane
#

looks c#-rpy

gleaming grove
#

@outer crane yes i've started my programing adventure with C# so now i'm struggle with switch to Java naming

#

to me the most weird thing with java naming is start method name with small letter

#

but this chunk of code i've send is pretty old, so my varables are not longer eyebleeding

outer crane
#

you can also start with capital letter if you want to

#

as long as its consistent in your project

#

lowerPascalCase is the most common one, yeah

unreal quartz
#

well there is a reason for is

#

if you see PascalCase.camelCase() then you know it’s invoking a method

#

if you see someVariable.field then you know it’s a property of that object

hybrid spoke
#

UserType.I.like(this);

minor fox
#

Whats the default reach distance on multiplayer?

wet breach
#

3 blocks

#

4-5 blocks in creative

minor fox
wet breach
#

yes, because the scenario changes those numbers as they are not exactly constant

#

when in combat you can have a reach of 6 blocks sometimes

summer scroll
#

i don't think it's an estimates.

unreal quartz
#

this is what the wiki says

drowsy helm
#

It negotiates with the server

hybrid spoke
#

server, movement, hackclient...

minor fox
#

why do most (hacked) clients care so much if it's 3.05 or 3.06 then?

wet breach
#

it doesn't negotiate, just it depends on the scenario you are in. Building wise, yes it is 3-4 blocks, combat it is a bit different, and this is just assuming we are not including equipment being in the players hands

unreal quartz
#

that is for blocks

minor fox
unreal quartz
#

for breaking blocks

minor fox
#

oh sorry I should've been clearer, I meant combat reach

unreal quartz
#

within my 7 seconds of googling I was unable to find a reach distance for players, although I recall hypixel making a thread about it

#

maybe find that and take a look

wet breach
#

combat reach can be as far as 6 blocks in some situations

hybrid spoke
#

hight ground, low ground etc

#

but normal, without any movement on an equal y etc. its 3

dusk flicker
#

not exactly 3

#

but basically 3 when rounded

hybrid spoke
#

3.4 was the highest i could reach without any ado

summer scroll
#

So I have a few custom config, Is it better to handle them in different class, so each custom config has different class or on the same class? Using enums like this https://paste.md-5.net/dasiruzono.java.

unreal quartz
#

if you're gonna use that approach then you may want to consider storing by <ConfigType, File> instead rather than writing giant switch statements and adding more fields the more configs you write

#

not to mention you're also missing breaks in your switches

young knoll
#

I made a wrapper class for the configs that uses direct map access

#

Not really sure if a second copy of the data is worth the slight speed increse

fickle helm
#

is there a way I can create a custom creature spawner than spawns a mob with certain keys in it's PersistentDataContainer?
i've tried adding the keys to the PDC on the spawner and the spawn egg but any spawned mobs don't have the keys

#

or any kind of tag I can use on the spawner that is carried over to the mobs spawned from it

young knoll
#

You would have to use the spawn event

#

To copy the data over

fickle helm
#

is there a way to know from that event that the mob came from a particular spawner?

young knoll
#

yes

fickle helm
#

other than SpawnReason.Spawner?

fickle helm
#

I can determine if it came from any spawner from the event, but is there a way to see which spawner it came from if there are multiples? I basically want to store custom data in the spawner that will effect the mob that is spawned

fickle helm
#

ah sorry I see it now. Perfect event

summer scroll
ancient sierra
#

item = new ItemStack(Material.GOLD_SWORD, 1);
List<String> lore = item.getItemMeta().getLore();
lore.add(CustomItemId);
item.getItemMeta().setLore(lore);

#

why

#

is thiis broken

#

am i stupid

#

CustomItemId is a string

torn oyster
#

how would i sort a hashmap<OfflinePlayer, Double> in descending order

#

im trying to make a /bounty top command

ancient sierra
#

can u sort thatttttt

#

idk

summer scroll
young knoll
#

getItemMeta is immutable

#

You need to get it once, modify it, and then setItemMeta

lost matrix
torn oyster
#

how do i do that

eternal oxide
#

use a TreeMap

torn oyster
#

what do i do with a treemap

eternal oxide
#

You can specify a comparator

lost matrix
lost matrix
#

Oh nvm. Its a comparator that accesses the map and links the key to its value. Looks expensive.

eternal oxide
#

Not really as you only call teh comparator when you want to sort. Not much different to teh Collections.sort

lost matrix
#

Still add and remove is O(log(n)) . Not terrible but not great either. And each time a value us changed it has to be resorted.

#

But its probably the simplest solution.

torn oyster
#

?paste

queen dragonBOT
torn oyster
#

i get this error

#

this is the line 60

#

bounties.put(to, bounties.getOrDefault(to, 0.0) + amount);

eternal oxide
#

Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer cannot be cast to java.lang.Comparable

torn oyster
#

what

#

how do i fix that

eternal oxide
#

your treemap is defined incorrectly it seems

torn oyster
#

public static TreeMap<OfflinePlayer, Double> bounties = new TreeMap<>();

#

probably so bad

#

huh

eternal oxide
#

um, looks ok

#

is that the only bounties you have defined?

torn oyster
#

yea

eternal oxide
#

You don;t also have one in the local scope?

torn oyster
#

nope

eternal oxide
#

will need to see code

torn oyster
#

ill just send the whole class

#

?paste

queen dragonBOT
torn oyster
eternal oxide
#

not related but line 62 should be Player top = to.getPlayer();

torn oyster
#

oh ok

eternal oxide
#

lastly to fix your error stop storing the whole OfflinePlayer object and only store their UUID

torn oyster
#

how would i get the name of an uuid

eternal oxide
#

you would get teh offline player object when you need it

obtuse anchor
crude charm
#
    public void joinMessage(Player player) {

        Events.subscribe(PlayerJoinEvent.class)
                .handler(e -> {

                    CompletableFuture<Integer> globalPlayers = bc.getPlayerCount(server1() + server2() + server3());


                    player.sendMessage(ambientColour() + CC.STRIKETHROUGH + "-----------------------------------");
                    player.sendMessage(mainColour() + "Welcome to " + serverName() + "there are currently" + globalPlayers);
                    player.sendMessage(mainColour() + "Discord" + secondColour() + discordLink());
                    player.sendMessage(mainColour() + "Teamspeak" + secondColour() + teamspeakLink());
                    player.sendMessage(mainColour() + "Twitter" + secondColour() + twitterLink());
                    player.sendMessage(mainColour() + "Store" + secondColour() + storeLink());
                    player.sendMessage(CC.GRAY + CC.STRIKETHROUGH + "-----------------------------------");


                });
    }

this is all im trying to do using helper but for NO reason its not working

https://github.com/lucko/helper

dusty herald
#

That supports lilypad?? 👀 that's a fuckin surprise

crude charm
#

yeah

#

its really good I use it in all my projects, makes stuff alot cleaner

#

*all my projects as of late

dusty herald
#

I think that you're not supposed to call it like that, I think you're supposed to call it like you register events

cinder thistle
dusty herald
#

like e.getPlayer()

cinder thistle
#

Make the left type Map

#

I don’t remember what that law/rule is called but it’s a thing

dusty herald
#

that helper thing is neat though kekwhyper

crude charm
#

yeah

#

commands are also really clean

cinder thistle
#

Law of Demeter I think

#

Oh yeah helper is great

crude charm
#

hmm its still not working :/

#

    public void joinMessage() {

        Events.subscribe(PlayerJoinEvent.class)
                .handler(e -> {

                    CompletableFuture<Integer> globalPlayers = bc.getPlayerCount(server1() + server2() + server3());


                    Player player = e.getPlayer();

                    player.sendMessage(ambientColour() + CC.STRIKETHROUGH + "-----------------------------------");
                    player.sendMessage(mainColour() + "Welcome to " + serverName() + "there are currently" + globalPlayers);
                    player.sendMessage(mainColour() + "Discord" + secondColour() + discordLink());
                    player.sendMessage(mainColour() + "Teamspeak" + secondColour() + teamspeakLink());
                    player.sendMessage(mainColour() + "Twitter" + secondColour() + twitterLink());
                    player.sendMessage(mainColour() + "Store" + secondColour() + storeLink());
                    player.sendMessage(ambientColour() + CC.STRIKETHROUGH + "-----------------------------------");


                });
    }
#

this one isn't working either

    public void onJoin() {
        
        Events.subscribe(PlayerJoinEvent.class)
                .handler(e -> {

                    Player player = e.getPlayer();
                    
                    player.getInventory().clear();
                    player.getInventory().setItem(4, selectorItem());
                });
    }
ivory sleet
#

You need to register?

crude charm
#

no

cinder thistle
#

Not law of Demeter

#

I don’t remember

#

Just learned about law of Demeter tho

#

Pretty cool

ivory sleet
#

I mean it’s a pretty weird principle sometimes

cinder thistle
#

Indeed

#

But I see why it makes sense

ivory sleet
#

Hmm I guess it’s a good way to protect you from yourself just like normal getters and setters

#

Arguably loosely couples your code but rly I just access fields sometimes tbf

crude charm
#

can someone please help me

quaint mantle
#

What would be the best way to restrict int? Using Math.min/max, break the loop on to high input ? String s = response.getInput(1); int in = Integer.parseInt(s); if (response.getDropdown(0) == 0) { for (int i = 0; i < in; i++) {

ivory sleet
#

Do you call that method ZoiBox? Because the EventSubcriptipnBuilders aren’t something you wouldn’t just put in a method precisely

crude charm
#

wdym, the method is called when an event happens

ivory sleet
#

No shit, but not if you never introduce it in the first place

crude charm
#

but I do

ivory sleet
#

So you do call your method onJoin?

crude charm
#

but it doesent

ivory sleet
#

Depends

crude charm
#

it should

ivory sleet
#

If you don’t call your method joinMessage() then there’s no way it would work

crude charm
#

ok where do you want me to call it

ivory sleet
#

It’s not like the spigot event handler methods where they automatically get called though even that requires registering. Try to call that method joinMessage() in onEnable or smtng

crude charm
#

ok

ivory sleet
#

After all you need to make sure the subscription is actually introduced not only declared in code

crude charm
#

it works

#

WTF

#

why is that not in the docs

#

I worked with another event api and you dont do that

dusty herald
#

it's common sense though, code doesn't run if it isn't called

crude charm
#

u do exactly what I have and it jus tworks

crude charm
#

but another I worked with its legit the exact same

#

but it does it for you

#

so I assumed

ivory sleet
#

Another one yeah, well maybe if Luckos helpers would visit all of your classes with some bytecode manipulation or reflection/smtng then maybe it could get itself aware of never called methods but unfortunately it doesn’t

crude charm
#

ik I just thought better of it

ivory sleet
#

No it’s common sense as jochyoua said

crude charm
#

IK

ivory sleet
#

Just saying you shouldn’t be expecting that in libs

#

Well unless it’s actually explicitly mentioned somewhere

sharp dove
#

how do i make another config file thats json for a plugin?

ivory sleet
#

Could use gson

crude charm
#

does scanner work in spigot console? or is it only used for java console

ivory sleet
#

It works for any InputStream I think?

crude charm
#

aight thanks

fair parrot
hardy valley
#

use maven

fair parrot
#

i am

ivory sleet
#

you could add spigot server jar as a dependency

fair parrot
#

but i need the depend for it

ivory sleet
#

as opposed to the api only

fair parrot
#

i dont know where to find any of them

ivory sleet
#

well actually authlib is a mvn dependency on its own

#

just google it and you'll find the details

fair parrot
#

ive tryed everything on google i cant find it could u send a link

ivory sleet
#

it was the first alternative that came up when I googled

#

maven repo authlib

fair parrot
#

dones not work

ivory sleet
#

you have to reload the maven project

fair parrot
#

same thing

ivory sleet
#

did you add the repo?

fair parrot
#

i dont even see one

ivory sleet
#

I sent u it

#

bruh

fair parrot
#

i click on it and it still dont see it

ivory sleet
#

dude you add it to ur pom.xml

fair parrot
#

the link

ivory sleet
#

?

fair parrot
#

oml

#

ok i click on it it shows this

ivory sleet
#

whats this?

fair parrot
ivory sleet
fair parrot
#

add what

#

oml

fair parrot
#

ok what abt this

ivory sleet
#

idk

#

I cant see anything except that red method call

#

kinda hard to tell

fair parrot
ivory sleet
#

Base64.getEncoder().encode(..)

#

iirc

fair parrot
#

id kmy friend told me to use this code

#

it worked for him

ivory sleet
#

Well Idk but why not use the Base64 encoder provided by java itself

quaint mantle
#

how to vanish players from non admins?

crude charm
#

why is line 24 (getting an instance of bungeechannelapi) throwing a null pointer exception?


dusty herald
#

plugin is null

crude charm
#

i'm aware of that but how can I fix it?

dusty herald
#

make it not null

crude charm
#

ok

quaint mantle
#

hey how do i check if player has written alias or command?

ivory sleet
#

PlayerPreProcessCommandEvent I think or smtng

quaint mantle
#

oh so no CommandExecutor class

tribal sparrow
ivory sleet
#

The executor is the command processor but that event is fired before any executor has the chance to deal with the command input

quaint mantle
#

oh ty @tribal sparrow

crude charm
#

@ivory sleet

tribal sparrow
#

anyone about to help me out with armorstands and rotating blocks with cursor?
how would i get the blocks (armorstands) to move in a straight line and not just rotate

crude charm
#

can you please help me with the api thing, the way you said, on enable, works fine but when its a different event then it doesent work because its not "on enabke"

tribal sparrow
#

@crude charm
change it to this

    public SelectorManager(Hub plugin){
        this.plugin = plugin;
         bungeeChannelApi = new BungeeChannelApi(plugin);
    }
        
crude charm
#

I fixed it

#

its something else

#

but I debugged

#

and its my shit code

#

lmfao

#

@tribal sparrow

drowsy helm
tribal sparrow
#

i don't know how to work with cos function, is there a good way to learn how the location xyz works?

vivid cave
#

question: if I do:

Bukkit.getServer().getScheduler().runTaskLater(plugin, code, 1)
Am I sure that the code will be executed AFTER the event finished triggering? (and applied all the changes on the environment; e.g: if it's an PlayerItemDropEvent, the dropped item will be on the floor, if it's a PlayerItemDamageEvent, the item will already been received the damage, etc)

And how about:

Bukkit.getServer().getScheduler().runTaskLater(plugin, code, 0)
Same question than above

#

I wanna do "after hooks" for events

drowsy helm
#

you can't schedule a task 0 ticks after

vivid cave
#

soonest as possible tho

drowsy helm
#

the scheduler just queues the task to run on the next tick

vivid cave
#

well, it could be scheduled at the end of the current tick no?

drowsy helm
#

no, the tick has already been called

vivid cave
#

well both calls work, with 0 and with 1

#

u sure there ain't any difference

drowsy helm
#

you can time it it should be the same

vivid cave
#

ok

#

thx for this info, it doesn't really answer my first question tho

weak adder
#

So Im trying to make is when an player kills a cow he gets poison and blindness for 1 mins i tried but coding is new for me and im learning

drowsy helm
#

i dont completely understand the question

#

oh sorry i see now

#

yes it will execute after the event has been processed

vivid cave
#

okay cool, thanks!

weak adder
#

ok just a sec

vivid cave
drowsy helm
#

the schedular only works on the main thread

vivid cave
#

uhm no

drowsy helm
#

unless you have your own implementation, then it's up to how you code it

vivid cave
#

this ain't correct

#

i don't have any specific implementation and yet it works

drowsy helm
#

show code

weak adder
#

@EventHandler public void onEntityKill(EntityDamageByEntityEvent) { if (event.getEntityType() == EntityType.COW) {

drowsy helm
#

you need to name your parameter

weak adder
#

I have got this much so far

drowsy helm
#
 public void onEntityKill(EntityDamageByEntityEvent event)
#

so the EntityDamageByEntity is the type, you need to have a name for the actual instance of that

weak adder
#

OH ok

summer scroll
#

Use EntityDeathEvent instead maybe?

weak adder
#

Ok I will try both

#
    public void onEntityKill(EntityDeathEvent event) {
        if (event.getEntityType() == EntityType.COW);
        event.getEntity().getKiller();```
#

so I have got the killer

rain flint
#

Hello

summer scroll
weak adder
#

how do I detect that it is a player or other entity

rain flint
#

I'm checking the velocity on the 3 axis + the length of an arrow dispensed, it's always the same, however it never shoots to the same place, does anyone know which parameter affects the randomness of the arrow ?

summer scroll
#

event.getEntity().getKiller(); already return Player, and will return null If it's not Player I guess.

weak adder
#
    public void onEntityKill(EntityDeathEvent event) {
        if (event.getEntityType() == EntityType.COW) {
        event.getEntity().getKiller();
        return Player```
#

Like this?

#

and type

#

send.message and all

quaint mantle
#

No

rain flint
#

You can't return something

quaint mantle
#

learn java

summer scroll
#

Oh, I suggest you to learn java first.

weak adder
quaint mantle
#

yes, dont start with bukkit or mc tutorials

#

start with actual java programming basic tutorials

summer scroll
#

No sorry, I usually use website or something.

weak adder
#

ok

quaint mantle
#

whether its video format or interactive (i recommend), or text

dense quail
#

Udemy has great courses on Java

quaint mantle
#

i recommend interactive stuff because you can actual experiment and do stuff hands on

weak adder
quaint mantle
#

indian men on youtube are your friend

#

never forget

#

or women*

weak adder
quaint mantle
#

LOL

dense quail
#

The free Java class by Rob Percival is very good

summer scroll
#

hahaha

rain flint
#

xD

weak adder
#

ty

#

all

vivid cave
#

oh and if you wonder why some syntax ain't pure java, it's because it's beanshell, but it compiles to java with reflection and stuff, it worked in my java code as well (was lazy to restart whole server, recompile everything etc)

hardy valley
#
package standard.plugin.skills;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

public class AdrenalineSkill implements Listener {
    @EventHandler
    public void onProvoque(EntityDamageByEntityEvent e){
        if (!(e.getEntity() instanceof Player)) return;
        if (!(e.getEntity().hasPermission("bskills.adrenaline"))) return;
        if (!(((Player) e.getEntity()).getHealth() <= 10)) return;
        ((Player) e.getDamager()).setNoDamageTicks(0);
    }
}
``` Why does the damager don't get the "combo duel" thing?
drowsy helm
#

thus why it's a scheduler

vivid cave
#

i know

#

that the point of my thing

#

being able to call sync stuff from async

#

anyway it doesn't answer my question tho

drowsy helm
#

I never said you couldnt, I'm just saying it still executes on the main thread

vivid cave
#

yeah ik that

#

but i still wonder now

#

whether there is a diff between scheduling in 0 or scheduling in 1 ticks from a thread has a difference

#

i think it does, because if you schedule from the thread, the current tick hasn't necessarily finished processing

#

right @drowsy helm

drowsy helm
#

afaik when the tick has happened, the scheduled tasks are executed. You cant execute it on the same tick if the scheduled tasks have already been done

#

I'll have to do some testing though

hardy valley
quaint mantle
#

how can I check if a Block is a falling block?

#

anyway better than this ?

        switch (block.getType()){
            case SAND:
            case GRAVEL:
            case ANVIL:
            case CONCRETE_POWDER:
                return true;
            default:
                return false;
        }
    }```
gleaming grove
#

block.getType().hasGravity(); @quaint mantle

quaint mantle
#

cheers

tacit drift
#

how do i check if clicked block is a chest?

#

tried e.getClickedBlock instanceof Chest

gleaming grove
#

block.getType().equals(Material.CHEST)

quaint mantle
#

how would I get the location of a falling block when it lands then?

tacit drift
#

yeah, also i need to get the chests contents

quaint mantle
# quaint mantle how would I get the location of a falling block when it lands then?

Im using this

    public void onFallingBlockLand(EntityChangeBlockEvent e) {
        if (e.getEntity().getType() == EntityType.FALLING_BLOCK) {
            REMOVAL_BLOCKS.put(e.getBlock(), System.currentTimeMillis());
            log("Scheduled " + e.getBlock().getType().toString() + " to be removed after " + DURATION + "s");
        }
    }```

the problem is that it adds it to the map when its placed and then puts air block when it lands
#

but I wanna only wanna add the location of the block when it lands

gleaming grove
#

try this

tacit drift
#

it gives an exception

#

this is how i do it

#

if (event.getAction() == Action.LEFT_CLICK_BLOCK && block.getType().equals(Material.CHEST)) {
Chest chest = (Chest) block;
for(ItemStack chestitem : chest.getInventory()){
if (chestitem.getType() == Material.TNT){
tnt = tnt+chestitem.getAmount();
chestitem.setType(Material.AIR);
}
}

gleaming grove
#

Chest chest = (Chest) block.getState();

#

try like this

tacit drift
#

works, thanks

quaint mantle
#

how do I get location of falling blocks when they land

tacit drift
#

if you know what block you need to see where landed, wait a bit then get location of block

#

oh wait

#

hm

gleaming grove
#

@quaint mantle those falling block are creating by plugin?

tacit drift
#

check if it's still falling block and get coords

#

last coords is the landing position

quaint mantle
#

Hello is it possible to remove .0 from health points?

cinder thistle
#

First of all

#

I don’t remember how bukkit ips work but I would sure as hell not show it

#

Two try a decimal format

quaint mantle
cinder thistle
#

Alr

quaint mantle
cinder thistle
#

Google Java decimal format

#

I’m low on data

quaint mantle
#

Okay

quiet ice
#

String#format

quaint mantle
eternal oxide
#

if its a string just use String.format

cinder thistle
#

You could also split it by . and only keep the first value in the array

eternal oxide
#

or if its a double/float cast to an int

cinder thistle
#

^ this

earnest junco
#

DecimalFormat decimalFormat = new DecimalFormat("0.##"); .... decimalFormat.format("20.0"); should work just fine too.

quaint mantle
#

It's too much writing I'm trying to make code cleaner and easier to read

ivory sleet
#

wat

#

DecimalFormat would make it easier to read

quaint mantle
#

Mhm

earnest junco
quiet ice
#

String.format("%02d", number) is easier to read

quaint mantle
#

Okay

tacit drift
#

how do i remove an item from an inventory

#

tried setting the item type to air

eternal oxide
#

set amount to zero

tacit drift
#

Chest chest = (Chest) block.getState();
for(ItemStack chestitem : chest.getInventory()){
if (chestitem != null && chestitem.getType().equals(Material.TNT)){
tnt=tnt+chestitem.getAmount();
chestitem.setType(Material.AIR);
}
}

tacit drift
#

doesn't work

quaint mantle
eternal oxide
#

sure it does. probably need to update inventory

tacit drift
#

oh

ivory sleet
#

make sure its the itemstack from the inventory and not a clone

eternal oxide
#

You are getting the state of the block so you are not operating on the chest in world. You are operating on a clone

tacit drift
#

trying to operate on the chest was throwing an exception

eternal oxide
#

if you make changes to teh state you must perform an update when done update(true)

tacit drift
#

chest.update(true); ?

eternal oxide
tacit drift
#

yeah, it's still not working

#

i saw that if i add an item to an inventory, the inventory will update

#

i will try that

quaint mantle
#

how do I find the landing location of a falling block

quaint mantle
#

like if I have

    public void onFallingBlockLand(EntityChangeBlockEvent e) {
        if (e.getEntity().getType() == EntityType.FALLING_BLOCK) {
            // Stuff
        }
    }```
do I just do an else ?
tacit drift
#

yeah so to remove an item from an 1.8 chest, you need to remove the item and then add an air item, and that will update the inventory

#

lol just duped tnt

sour rampart
#

(Possibly a noob question) how would you allow players to add items from their inventory to a custom gui?

tacit drift
#

if you open an inventory for them

drowsy helm
#

really depends on how your inventory implementation is structured

tacit drift
#

they will be able to remove/add items to it

sour rampart
#

ye but I used a java tutorial to make a custom gui and for some reason I couldn't add any blocks to the custom gui

ivory sleet
#

I mean normally you'd disallow player manipulations for your GUI

tacit drift
#

maybe he wants to make a sellgui

#

or edit menu

#

¯_(ツ)_/¯

sour rampart
#

kinda, ye

#

so how would u allow the player to add and remove items from the gui?

quaint mantle
#

Any better ways to get the uuid from an offline player ?

ivory sleet
#

First of all Player extends OfflinePlayer, not the other way around

#

but I mean you could use OfflinePlayer#getUniqueId

quaint mantle
#

Okay so, the block change event activates once when it begins to fall and a second when it lands, how do I get the second location?

quaint mantle
ivory sleet
#

also if you use getOfflinePlayer(String) wrap it in a future because it will make a request to mojang services

earnest junco
ivory sleet
#

alternatively use uuids and dont bother to use getOfflinePlayer(String) instead use getOfflinePlayer(UUID) because the latter wont make a request

quaint mantle
#

Yea I already store uuid name reason and time on database I did not want o use any more MySQL since that class will be heavy as hell

eternal oxide
#

Always use UUID when you can. Names are volatile

earnest junco
ivory sleet
#

yeah maybe he should write a uuid cache then

#

or whatever u call it

quaint mantle
#

Players will always be banned on uuid tho so no problemo on that :p

eternal oxide
#

Bukkit.getOfflinePlayers() will return every known player to the server. No lookups

#

theres your cache

quaint mantle
#

🙃😅

ivory sleet
quaint mantle
#

Would it make sense to get uuid from database to compare to uuid in database to delete itself ? :p

ivory sleet
#

uh wym?

tacit drift
#

idk why, but it detects all the tnt in the chest, deletes it and it counts only a small amount

#

like for 1000 tnt it counts 104

timid rose
#

Hi

#

Can someone help me make this plugin 1.16 compatible?

ivory sleet
#

sure

tacit drift
#
                for(ItemStack chestitem : chest.getInventory()){
                    if (chestitem != null && chestitem.getType().equals(Material.TNT)){
                        tnt=tnt+chestitem.getAmount();
                        chest.getInventory().remove(chestitem);
                        chest.getInventory().addItem(new ItemStack(Material.STONE));
                    }
                }
#

tnt is initialized with 0 before for

drowsy helm
#

code block pls

outer crane
drowsy helm
#

you're concurrently modifying

timid rose
#

and the custom item doesnt grow

ivory sleet
#

sounds like an easy tweak

outer crane
#

custom items?

#

if its not using PDC's good luck

timid rose
ivory sleet
#

yeah I mean do you have the code?

timid rose
#

I have the jar file

quaint mantle
outer crane
#

dont use outdated versions

quaint mantle
#

me?

outer crane
#

yes

quaint mantle
#

i literally use 1.12.2?

cinder thistle
#

you heard of 1.16.5?

drowsy helm
#

lmao what

outer crane
#

1.12.2 is outdated AF

quaint mantle
#

well yea but

drowsy helm
#

they didnt ask for an update they asked for help

quaint mantle
#

then what 1.8 is

ivory sleet
#

1.12.2 quite stable tho ngl

drowsy helm
#

just apply velocity to their direction

ivory sleet
#

1.8 is ancient

quaint mantle
#

still popular

cinder thistle
#

still outdated

outer crane
#

automod stroke

quaint mantle
#

1.12.2 on top

cinder thistle
#

popularity doesn't mean it should be supported

outer crane
#

^

quaint mantle
cinder thistle
#

also, add y velocity

quaint mantle
#

i did here

#

Vector vector = player.getLocation().getDirection().setY(8).multiply(2);
player.setVelocity(vector);

cinder thistle
#

try adding y rather than setting

#

I haven't worked with vectors in a while tho

quaint mantle
#

wait what

#

oh i see

ivory sleet
quaint mantle
#

only set is there no adding

eternal oxide
#

1.8 is 7.9% of servers. 1.12 is 6.2% of servers. Not really high numbers to support

quaint mantle
#

well okay but i asked for help not for telling me that 1.12.2 is outdated

ivory sleet
#

7.9% too much and 6.2% too much arguably lol

#

yeah

tacit drift
outer crane
#

will never give help to people on fossils

ivory sleet
#

pavlyi tbf the api hasnt had any significant changes altho the api isnt as rich

cinder thistle
#

we told you 1.12.2 was outdated

#

we gave you things to try

outer crane
#

if someone asks you for support on a app you made ages ago you wouldnt help them, you would tell them to update

#

using 1.12.2 is like using windows 7 in 2021

#

but its stabler!1!11

quaint mantle
#

omg

ivory sleet
#

pavlyi what is the issue

eternal oxide
#

lol, I use win7 😍

ivory sleet
#

like

outer crane
#

cursed

ivory sleet
#

what doesnt work in code

quaint mantle
#

when i step on the gold pressure plate it just boosts me a 1-3 blocks forward but not up or forward more

drowsy helm
#

did you try adding instead of setting y

ivory sleet
#

how do u currently handle the velocity?

quaint mantle
cinder thistle
#

have you tried it

quaint mantle
#

i have only an add(vector) method available

outer crane
#

well then add the vector?

#

its kinda simple primary school maths

quaint mantle
#

but i just wanna add the y

outer crane
#

as i said, primary school maths

#

create a vector with x and z to be 0

#

and y to be whatever you want

quaint mantle
#

okay it works ty

timid rose
#

can someone make this plugin 1.16 compatible

cinder thistle
#

ok so I assume that this plugin is UltraSuperCompatibleAnticheat b84928

#

so I shall make it k0mp@t1b3

#

you have to let us know what plugin lmao

outer crane
#

@timid rose please tell us

pure glacier
distant fern
#

Hi. Im just have 1 question. Why my plugin is on red?

public class RybakNPCListener implements Listener {

    @EventHandler
    public void onClick(PlayerInteractAtEntityEvent e){

        Player p = e.getPlayer();

        Location loc = e.getRightClicked().getLocation();

        if(e.getRightClicked().getType()== EntityType.VILLAGER) {
            if (loc.getY() == 64) {
                    e.getPlayer().sendMessage("Witaj. Jestem rybakiem");


                Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        
                    }
                }, 20L * 5);

                }
            }

    }

}
outer crane
#

on red?

distant fern
#

Error

outer crane
#

also thats some pathetic formatting

#

what kind of error

#

```java
use this formatting
```

distant fern
#

:25:75
java: cannot find symbol
symbol: variable plugin
location: class me.NeVwer.EdycjaCzilCraft.RybakNPCListener

outer crane
#

you have an invalid symbol somewhere

#

what line is it on

distant fern
#

you have a pic on dm

eternal oxide
distant fern
#

how do i do it?

outer crane
#

you didnt define plugin

eternal oxide
#

you need to pass an instance of your main class to this event class to use as thr plugin field.

distant fern
#

so in main i what write?

outer crane
#

pass an instance

#

learn java, we arent here to spoonfeed

eternal oxide
#

You learn about dependency injection

#

Oh good news Oracle lost to Google that the Java API can be copied as "fair use".

sleek pond
#

lmao

cinder thistle
#

search oracle v. google

#

oracle was a dick and sued google bcuz they use java for android

eternal oxide
#

Finally the courts recognised that an API is just a set of ideas not a copyright-able set of code.

cinder thistle
#

if the supreme court ruled in favour of oracle android OS would've essentially been illegal

#

and that's pretty bad

eternal oxide
#

It means you can use an API without being in breach of copyright.

#

You are only affected by the implementation

sleek pond
#

api is different from source code of smthn tho

#

right?

eternal oxide
#

yep, teh API is just how you use something

#

no implemented code

sleek pond
#

mhm

eternal oxide
#

Its really good news actually. It means Bukkit is not copyright-able. CB is but not Bukkit

hardy valley
#
package standard.plugin.skills;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

public class AdrenalineSkill implements Listener {
    @EventHandler
    public void onProvoque(EntityDamageByEntityEvent e){
        if (!(e.getEntity().hasPermission("bskills.adrenaline"))) return;
        if (!(((Player) e.getEntity()).getHealth() <= 10)) return;
        ((Player) e.getDamager()).setNoDamageTicks(0);
    }
}
``` Why is this not working?
sleek pond
#

you need to register the event

hardy valley
#

you mean in main class? Already did

sleek pond
#

and you don't need the triple parenthises either

#

in the first if statement

#

and second

eternal oxide
#

you need to check if the entity is a player before casting

sleek pond
#

also

#

that is so ugly

#

ok let me fix it real quick

hardy valley
#

alright

distant fern
#

ok. I think i repaired that but the Runnable doestn work

Listener:

public class RybakNPCListener implements Listener {

    private Main plugin;

    @EventHandler
    public void onClick(PlayerInteractAtEntityEvent e){
        this.plugin = plugin;
        Player p = e.getPlayer();

        Location loc = e.getRightClicked().getLocation();

        if(e.getRightClicked().getType()== EntityType.VILLAGER) {
            if (loc.getY() == 64) {
                    e.getPlayer().sendMessage("Witaj. Jestem rybakiem");


                Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        Bukkit.broadcastMessage("1");
                        Bukkit.broadcastMessage("2");
                    }
                }, 20L * 5);

                }
            }

    }

Main:

public class Main extends JavaPlugin {


    public Main plugin;
    
    @Override
    public void onEnable() {


        getServer().getPluginManager().registerEvents(new RybakNPCListener(), this);
        getServer().getPluginManager().registerEvents(new SideBarListener(), this);

    }

}
#

Can someone help?

outer crane
#

wheres the constructor in the Listener class

ivory sleet
sleek pond
#
public class AdrenalineSkill implements Listener {
    @EventHandler
    public void onProvoque(EntityDamageByEntityEvent e){
        Entity entity = e.getEntity();
        if(!(entity instanceof Player)) return;
        Player player = (Player) entity;
        if (!player.hasPermission("bskills.adrenaline")) return;
        if (!(player.getHealth() <= 10)) return;
        
        Entity damager = e.getDamager();
        if(!(damager instanceof Player)) return;
        Player playerDamager = (Player) damager;

        playerDamager.setNoDamageTicks(0);
    }
}
#

there

eternal oxide
sleek pond
#

@hardy valley

hardy valley
#

thanks

bright jasper
#

Im thinking about maybe trying to replicate some of the hypixel skyblock architecture. Aka, do some of the shit but not all of the shit because im not hundreds of developers getting paid for full time work

#

Open source, of course

quiet ice
#

and?

quaint mantle
#

Got my plugin fully working with MySQL, now planning to make it SQLite compatible to since they do not differ than much would I copy paste the whole class or reuse the same class that MySQL is working with ?

eternal oxide
#

Create an abstract SQL class, then extend and override

bright jasper
#

I read about their slime format for storing things. Made me question if i can have multiple people in one physical spigot server and they just cant see traces of each others existence unless they are in the same world

quaint mantle
#

That works to I guess 🙂 ty

cerulean valley
#

i'd like to replace farmland with dirt when a piston moves it, however the events ignore all block changes that happened within it and moves whatever existed there before - is there any way i can accomplish that?

bright jasper
#

One person per server no worky for 30k players

#

so its probably compacted

#

and the worlds are loaded with namings based on player name/uuid most likely

stray halo
#

hello, i was wondering if the "player.setCooldown" method could be used with an ItemStack and not with a Material

#

That would be super useful

bright jasper
sleek pond
#

yes

#

but not hundreds

bright jasper
#

is it 12 on skyblock or 12 total?

#

altho at this point skyblock is basically all they work on but

ashen agate
#
Scoreboard scoreboard = player.getScoreboard();
Objective object = scoreboard.getObjective("mh-health");
if (show) {
  if (object==null) {
     object = scoreboard.registerNewObjective("mh-health","dummy", "§8(§f" + health + "§8) §6❤");
  }
  object.setDisplaySlot(DisplaySlot.BELOW_NAME);
  object.setDisplayName("§8(§f" + health + "§8) §6❤");
}
``` Hey guys I got this piece of code that shows the player's health below their name, but it displays with a `0` in front (probably the score int). Is there a way to hide this (I know there is).
sturdy elk
#

Seconds in long xd?

lyric grove
#

what should i do? i think i messed up my project

#

everything is red

ivory sleet
#

rip

sleek pond
quaint mantle
sleek pond
#

and I think like 4 in bedwars and 4 in skywars

unreal quartz
bright jasper
#

how would you guys feel about an openskyblock project dedicated to remaking hypixel skyblock in open source

#

as in, the plugins, architecture, and premade spigot layouts/containers

ivory sleet
#

we could do it in kotlin 😄

bright jasper
#

We could we could, i still would prefer java due to the amount of people who know it

#

more contributions

unreal quartz
#

isn't hypixel skyblock basically an mmorpg at this point

ivory sleet
#

yeah it was kinda like a joke rku

unreal quartz
#

mostly story driven

ivory sleet
#

yeah lmbishop

vague mason
#

Kotlin is Skript on steroids 😂

ivory sleet
#

🥲

bright jasper
lyric grove
unreal quartz
#

if you're serious at actually recreating it then you're gonna have to come up with your own plot or events or whatever you call it

lyric grove
#

its green now

unreal quartz
#

that means you staged it and it's new

bright jasper
#

CC seems a bit generic dont you think?

bright jasper
lyric grove
#

its for chatcolor

#

cc.translate("")

bright jasper
#

call is ChatColor or YourPluginChatColor

ivory sleet
#

ew

unreal quartz
#

so, why not ChatColorX where X is what the purpose is

bright jasper
#

CC is too short

#

yeah

ivory sleet
#

ColorUtil maybe or smtng

bright jasper
#

yeah that works too

vague mason
#

SuperPowerfulChatColorWhichEveryoneWouldLikeToCopyIt

#

this isn't to short ^ 😉

bright jasper
unreal quartz
#

that is how hypixel do it, they have 10 a server

bright jasper
#

Yeah thats what i was thinking too

#

I was speculating thats how they do it

#

The issue is what if someone joins their home and leaves really fast and joins back

#

S3 is in the process of writing but its fetched before it can by another server

#

Ratelimits can work so ill go with that because its way more simple than caching worlds

#

At that point everything is stateful and i might aswell have it all be kubernetes(many proxies are needed to support large player counts, plugin messaging and bungeecord state does not matter)

rotund knot
#

i am running it through git for windows

bright jasper
#

your permissions are messed up or that file LICENSE couldnt be found

#

run in admin

rotund knot
#

tried that

bright jasper
#

or see if the folder is read only

quiet ice
#

Use your regular cmd

rotund knot
#

tried that too

bright jasper
sleek pond
#

dude

#

bruh

#

wait till people stop talking

quiet ice
#

Or powershell, the git bash is broken at best

unreal quartz
#

uninstall git and let it use portablegit

#

your git install might be broke

rotund knot
#

even when it uses portablegit, it still happens

sleek pond
rotund knot
#

before i installed git i was running it thru cmd prompt and was still giving the error

quiet ice
#

Then just spin up WSL I guess ¯_(ツ)_/¯

rotund knot
#

WSL?

bright jasper
#

windows subsystem for linux

#

aka, run linux in windows

eternal oxide
bright jasper
#

not a vm though

unreal quartz
#

are you actually the user whose desktop that belongs to?

stray halo
rotund knot
sleek pond
#

I would assume that without messing with nms, no

rotund knot
#

just everything in the BT Folder?

#

because i have tried that already

sleek pond
#

but try doing it with a regular item just the same you woulc do with a sword

eternal oxide
rotund knot
#

ok

lost matrix
rotund knot
#

is it possible that github desktop is screwing up the process?

eternal oxide
#

why are you using github desktop?

rotund knot
#

im not using it

#

i just have it installed as well

eternal oxide
#

Does anyone actually use that?

bright jasper
unreal quartz
#

GH desktop should have nothing to do with the process, either run it on a different machine (or WSL) or nuke it and try again

ashen agate
unreal quartz
#

last time I used GH desktop I nearly called it malware because of how terrible it was

ornate heart
#

Git bash ftw

bright jasper
#

the only acceptable git client is sourcetree, and thats because of its nice features to split up commits easily for company environments

lost matrix
# rotund knot i just have it installed as well

This is a pure permission problem. Run your powershell/cmd as administrator and run build tools with it (In a clean folder)
And make sure this folder is not opened by another program. So better create a new folder with the jar

unreal quartz
bright jasper
#

i only use source tree for company/work environments (i will die if i make mistake lmao)

#

otherwise i say fuck off and use git cli

rotund knot
#

also im using amazon corretto, would that mess anything up?

bright jasper
#

no i use that one too for dev

rotund knot
#

oracle is evil

bright jasper
#

My CI compiling with the fast java compiler

#

the optimizing one

bright jasper
rotund knot
#

eh idk

lost matrix
#

I would got for HotSpot (openjdk)

rotund knot
#

my dad uses a bunch of amazon stuff for his work so he recommended i use corretto

rotund knot
bright jasper
#

It could also be a problem with the temp file never getting created

#

some file not exist error somewhere

eternal oxide
#

show us exactly how you are running BT

rotund knot
#

C:\Users<redacted>\Desktop\Build Tools>java -jar BuildTools.jar

quaint mantle
#

hey how do i check if i can add item to player inventory's

lunar wigeon
#

you mean if players inventory is full?

quaint mantle
#

yes

eternal oxide
rotund knot
#

yeah

lunar wigeon
#

public boolean isInventoryFull(Player p)
{
return p.getInventory.firstEmpty() == -1;
}

rotund knot
#

i am just running java -jar BuildTools.jar

quaint mantle
#

ty

rotund knot
#

is it possible that my firewall is screwing this up?

eternal oxide
rotund knot
#

yeah

lost matrix
bright jasper
#

Yk my recommendation if this really isnt working well. Pull a jar artifact from the CI system that is the latest for buildtools

quaint mantle
#

okay so what should i do?

rotund knot
#

what is the CI system?

eternal oxide
bright jasper
#

System auto builds when source code updates

rotund knot
#

ok

lost matrix
quaint mantle
#

okay

rotund knot
#

thanks guys, sorry for the trouble

lost matrix
# quaint mantle okay

I think this might work:

  public boolean canFit(final Inventory inventory, final ItemStack itemStack) {
    int itemsLeft = itemStack.getAmount();
    final int maxStackSize = itemStack.getMaxStackSize();
    for (final ItemStack slotItem : inventory) {
      if (slotItem == null) {
        return true;
      } else if (slotItem.isSimilar(itemStack)) {
        itemsLeft -= maxStackSize - slotItem.getAmount();
        if (itemsLeft <= 0) {
          return true;
        }
      }
    }
    return false;
  }
#

Not sure if you need to check for air... Probably also check for air in the first if statement

quaint mantle
#

okay

#

ty

#
    @EventHandler
    public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
        Player p = (Player)event.getPlayer();
        if(!p.hasPermission("tntwars.bucket")) {
            p.sendMessage("test");
            return;
        }
        if(event.getBucket() == Material.WATER_BUCKET) {
            p.setItemInHand(new ItemStack(Material.WATER_BUCKET, 1));
        }
    }``` why this wont work breh 😦 i feel like i forgot something xD
#

how do i tp a player back to spawn if he has reached certain coordinates?

sleek pond
#

player.teleport 0 0

#

or world.getspawnpoint

quaint mantle
#
package me.configz1.spawnleave;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public final class SpawnLeave extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {

        getServer().getPluginManager().registerEvents(this, this);

    }

    public void OnLeave()



    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
#

what do i put in the public void onLeave()?

quaint mantle
elfin minnow
#

whats the difference between running a task asynchronously and synchronously

ivory sleet
#

async doesnt run on server thread if we're talking bukkit scheduler, it runs on a separate thread meaning you can do stuff concurrently

elfin minnow
#

so less lag?

ivory sleet
#

depends

lost matrix
ivory sleet
#

well you could download a file without making the entire application freeze

lost matrix
quaint mantle
#

ig

ivory sleet
#

or similar stuff that may take a while to perform

elfin minnow
#

hmm ok got it

quaint mantle
lost matrix
# elfin minnow so less lag?

There are some things you can do async like checking a bunch of block materials or spawning particles.
The thumb rule is: If it doesnt alter the game state you can try it async.

elfin minnow
#

huh?

lost matrix
quaint mantle
#

ok

lost matrix
quaint mantle
elfin minnow
#
public ItemStack getPlayerHead(String player) {
        Material type =Material.PLAYER_HEAD;
        ItemStack head = new ItemStack(type);
        SkullMeta meta = (SkullMeta)head.getItemMeta();
        meta.setOwner(player);
        meta.setDisplayName(player);
        head.setItemMeta(meta);
        return head;
    }

I am using this to get player heads, but it causes a lot of lag, how do I fix that

ivory sleet
#

wrap it with a future and then add a callback that posts a task on the server thread or something

#

I assume SkullMeta#setOwner specifically causes the lag

elfin minnow
#

yh I think so

lost matrix
gleaming grove
#

@quaint mantle float distnace = 500; Location spawnLocation = new Location(Bukkit.getWorld("world"), 0,50,0); @EventHandler public void playerMoveEvent(PlayerMoveEvent playerMoveEvent) { if(playerMoveEvent.getPlayer().getLocation().distance(spawn_location) > distnace) { playerMoveEvent.getPlayer().teleport(spawn_location); } }

ivory sleet
#

Make PlayerMoveEvent#getPlayer into a variable? and also java naming conventions 👀

quaint mantle
#

and java conventions

#

a {

}

not c style

#

a
{

}

lost matrix
#

And use distance squared if you dont want to fry your cpu with 15 users online

ivory sleet
#

java conventions says nothing about disallowing allman style tho

lost matrix
quaint mantle
#

who the hell wants to have a software developer that uses that, when the rest of the company uses the normal

ivory sleet
#

I mean yeah when working in teams you should follow 1 style ofc

#

but that doesn't imply you should avoid allman style in java

quaint mantle
#

thats what they call it?

ivory sleet
#

mhm

quaint mantle
#

disgusting

ivory sleet
#

¯_(ツ)_/¯

opal juniper
#

Wow, this better portals plugin looks really cool. I wonder how they did it.

oh lmao

quaint mantle
#

lol

lost matrix
# quaint mantle tysm

Not trying to be rude to Jacek but you should maybe consider this instead

  private static final int MAX_DISTANCE_SQ = 500 * 500;

  @EventHandler
  public void onMove(final PlayerMoveEvent event) {
    final Location worldSpawn = event.getPlayer().getWorld().getSpawnLocation();
    final Location targetLocation = event.getTo();
    if (targetLocation == null) {
      return;
    }
    if (worldSpawn.distanceSquared(event.getTo()) > MAX_DISTANCE_SQ) {
      event.setTo(worldSpawn);
    }
  }
gleaming grove
#

yes, this is much better approach

cinder thistle
#

cleaner and simpler

lost matrix
#

Because that would xor 500 and 2 in binary...

cinder thistle
#

hUH