#help-development

1 messages · Page 1699 of 1

somber hull
#

this is where the player sits with setmarker true

#

on an armorstand

#

hopwever

#

gravity is disabled for the armorstand

#

and that breaks everything

#

Cause if i dont make setmarker true

#

then the player is hovering over the ground

#

rather than being on the ground

dry forum
#

how would i get a number between for example 3 and 7? ive tried Random random = new Random(); return random.nextInt(lower +(upper)); which i found on a forum but its just giving me numbers that i didnt define

quaint mantle
#

:DDDDD

#

just joking lol

dry forum
#

👾

quaint mantle
#
    @EventHandler(priority = EventPriority.HIGHEST)
    public void onPlayerInteract(ExpBottleEvent e) {
        Projectile ent = e.getEntity();
        ThrownExpBottle b = (ThrownExpBottle) ent;
        ProjectileSource s = b.getShooter();
        Player p = (Player) s;
        
        if(!(ent instanceof ThrownExpBottle))
               return;
        if(!(s instanceof Player))
               return;
            
        e.setExperience(0);
        
        p.sendMessage("Тут может быть ваша реклама");

    }
#

is it possible to check here with what name the player threw a bottle of experience?

shut wave
#

hey, how is called an item on the floor?:o

quaint mantle
#

Item

#

@quaint mantle

#

hi

quaint mantle
#

are you making a custom bottle of xp

quaint mantle
#

?

#

get name

#

from inventroy

#

You make custom item?

#

Compare the distances between the previous location, which u checked and the new location

quaint mantle
#

how do I check which bottle I'm throwing?

#

are translators that bad

#

how do I check which bottle I'm throwing?

#

okay

#

one sec

#

if (!item.getItemMeta().getDisplayName().equals("123))
return;

quaint mantle
#

Location#distance(Location)

#

yea man but then how to save them into a variable if i do this?

#

wait arraylist?

shut wave
quaint mantle
#

put them into an array or an hashmap... seems kinda good

#

let me think

#

are you saving by name

quaint mantle
quaint mantle
#

put them into an hashmap... compare them...

#

Map<String, Location> (HashMap)

#

hmmm

#

oh thanks everyone i think hashmap still the best option

quaint mantle
shut wave
#

how is called when an item falls down on the ground?

#

or how can i know if an item is on the ground?

shut wave
#

i'm using that event, but i wanna get the location when it hits the ground

quaint mantle
shut wave
#

i just can get the location when it drops

shut wave
#

it throws me the location where the item is right after the player presses Q

#

that's why i'm searching a way to get the items on ground

quaint mantle
#

is this conditional or is it for all items

#

are the items gonna be dropped regularly?

shut wave
#

nope

#

oh, is like hoppers

#

just like hoppers

quaint mantle
#

use a set instead

#
Set<Material> BREAKABLE = Set.of(Materials...);
desert ferry
#

hello i just wanted to know how could i add tab completion to a plugin's command

quaint mantle
#

google "spigot plugin tab complete"

#

there should be a wiki on it

#

hi

#

if (BREAKABLE.contains(block.getType())

desert ferry
#

try this maybe @quaint mantle


@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
  event.setCancelled(UNBREAKABLE.contains(event.getBlock().getType()));
}```
quaint mantle
#

Wow

#

1 sec lyrad

undone axleBOT
quaint mantle
#

?paste

#

you can use simplechunk to store the chunk/itemschedule

#

if the chunk isnt loaded, remove it

#

when an item is dropped, if its in a custom hopper chunk, (SimpleChunk) add it to the itemscheduler associated with it

shut wave
#

wait, did you just do this?

stone sinew
#

You realize Location has Location.distance(Location) right?

quaint mantle
#

yea?

#

i created new code nvm dont ask me about that messy thing again lol

stone sinew
#

👍

#

In code use command executor. In file, use commands.yml

last ledge
#

someone help me making configurable gui from config.yml pls

quaint mantle
last ledge
quaint mantle
last ledge
#

true

#

thanks

quaint mantle
#

btw

#

if you copy, you need to make sure that you understand it

ivory sleet
#

Obviously he didn’t mean going to some open source code and steal everything with a copy pasta (:

echo basalt
#

Instead of copying I generally prefer transcribing

#

like looking at the code and typing it myself

tardy delta
#

running server on school wifi goes brr

#

?paste

undone axleBOT
tardy delta
vast kelp
#

it's a paste

tardy delta
#

it's something with an ssl certificate

vast kelp
#

Everyone, is there a de facto update-checker snippet/library? What do you use?

opal juniper
#

choco has a gist

opal juniper
tidal skiff
#

anyone know why this code

    public static HashMap<UUID, Zombie> zombiePets;

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        Player p = (Player) sender;
        Zombie z = (Zombie) p.getWorld().spawnEntity(p.getLocation(), EntityType.ZOMBIE);
        zombiePets.put(p.getUniqueId(), z);

        z.setTarget(p);

        return true;
    }

is giving me this error?

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.HashMap.put(Object, Object)" because "instarespawn.instarespawn.zombiepet.ZombiePetCommand.zombiePets" is null
    at instarespawn.instarespawn.zombiepet.ZombiePetCommand.onCommand(ZombiePetCommand.java:25) ~[?:?]
#

line 25 is zombiePets.put(p.getUniqueId(), z);

#

wait

#

it might be cuz i didnt initialise the hashmap

#

oh my god

#

it is

#

lesson learnt LOL

echo basalt
#

pro tip: don't make your map static

tidal skiff
#

y tho

echo basalt
#

A static variable implies it will always be accessible and loaded in memory (and potentially cache)

tidal skiff
#

o

#

aight

echo basalt
#

People often just see it as "I can access it from anywhere" while in reality it's meant for stuff like constant values (Example: TICKS_PER_SECOND = 20;)

#

So just follow common design patterns like dependency injection

#

and make getters

tacit drift
#

i think

echo basalt
#

PersistantData

#

The PersistantDataContainer API is a lot more recent

#

And generally made for persistant stuff

#

metadata might not save correctly

naive jolt
#

Hey so I am trying to create a mob corpse but then its super hard for me because I dont think mobs use craft player https://pastebin.com/N3XF41u8 this is my player corpse code

torn oyster
#

does this check if a player is using their firs

#

fist

#

if (p.getInventory().getItemInMainHand() == null) {

#

also how do i check if a block is a crop

#
System.out.println(e.getBlock().getType());
        if (e.getBlock() instanceof Ageable) {
            System.out.println("is a crop");```
#

only prints "WHEAT"

#

am i missing something

#

i've imported the right ageable

ivory sleet
#

a Block will never be an instanceof Ageable

torn oyster
#

oh yea

echo basalt
#

block.getBlockData

torn oyster
#

i need to checks tate

ivory sleet
#

look what interface Ageable is deriving from

torn oyster
#

yea mb

echo basalt
#

it's blockdata

torn oyster
#

if (e.getBlock().getBlockData() instanceof Ageable) {

#

will that work

echo basalt
#

should do

torn oyster
#

alright thanks

#

ill see how it goes

#

works

#
                    if (crop.getAge() == 7) {
                        b.getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(crop.getMaterial()));
                    }
                    e.setCancelled(true);
                    crop.setAge(0);```
#

crop is an Ageable

#

why doesnt that work

quaint mantle
#

hey I need some help
I am making a plugin and this is my first plugin
what the plugin does is that it stores all player chat in a file
named chatlog

#
        String message;
        message=(e.getMessage());
        String finalmsg;
        finalmsg=((e.getPlayer().getDisplayName())+": "+message);
        write("chatLog",finalmsg);
}```
#
        try{
            String content = msg;
            File file = new File(System.getProperty("user.dir")+"\\"+filename+".txt");

            // If file doesn't exists, then create it
            if (!file.exists()) {
                file.createNewFile();
            }

            FileWriter fw = new FileWriter(file,true);
            BufferedWriter bw = new BufferedWriter(fw);

            bw.write(content+"\n");

            bw.close();
        }
        catch(Exception e){
            System.out.println(e);
        }```
#

but this doesnt work

chrome beacon
#

So what doesn't work

#

Be specific

naive jolt
#

does anyone know how to make actions work on 1.17 heres the vid looking for that (I put a time stamp) https://youtu.be/sdHi5N7-Yqk?t=247 ||answer previous question from Lenny first||

quaint mantle
#

I am not sure is the event correct?

#

does it fire when I send a message

chrome beacon
#

Did you register the listener?

quaint mantle
#
        System.out.println("=================================\nDiscord bot plugin has been detected and enabled successfully!");
        System.out.println("Updating you if it is running or not, give me a second.");
        getServer().getPluginManager().registerEvents(this, this);
    }```
#

umm ig

jovial abyss
#

Did you add @EventHandler

quaint mantle
#

wait I didnt add that

#

alr lemme try

naive jolt
#

yeah then the "implements Listener"

#

i think

naive jolt
quaint mantle
naive jolt
#

Uhh is there a way to give an NPC armor?

#

(craftplayer)

#

cause I only have "getArmor()"

#

not set

#

I want to set the armor

quaint mantle
chrome beacon
#

He doesn't want Protocollib

quaint mantle
#

oh hmmm

torn oyster
#

if the action in a PlayerInteractEvent is == phyiscal

#

is e.getClickedBlock() gonna have the thing that u trampled/pressed

quaint mantle
#

I'm trying to modify log levels programatically (for hibernate (an ORM) and c3p0 (a connection pool tool)) :

What I've done :

    private void modifyLogLevels(Level logLevel) {
        Properties p = new Properties(System.getProperties());
        //c3p0 connection pool logging level redefinition
        p.put("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
        p.put("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", logLevel.getName());
        //hibernate logging level redefinition
        p.put("log4j.logger.org.hibernate.SQL", logLevel.getName());
        System.setProperties(p);
    }

It works for c3p0 but not for hibernate. How to define hibernate log level in the context of a spigot plugin ?

My test is simply to start my server and to check if those "[INFO]" are still visible

naive jolt
#

Uhh is there a way to give an NPC armor?
(craftplayer)
cause I only have "getArmor()"
not set
I want to set the armor

naive jolt
#

Thank you

stark schooner
#

hi can i ask a little help? i am trying to code a plugin like discordsrv but when i try to run the plugin it says invalid plugin.yml but i have it

quaint mantle
stark schooner
#

um ok

quaint mantle
#

Second option: your plugin.yml file is not included in the final jar file. Open your jar file using zip/7Zip/ another tool to check that it is there.

stark schooner
#

this is my plugin.yml

name: XDDCraft-Discord-Plugin
description: This is xddcrafts discord linking with minecraft plugin!
author: Hasibix
main: net.hasibix.xddcraftdiscord
version: 1.0

and the file is located in src/net/resources/plugin.yml

quaint mantle
#

I personally always use /src/java/ressources/plugin.yml. The fact you have /net/ may underline another issue.

stark schooner
#

oh

#

can you send me a example plugin of hello world so i can fix my plugin

quaint mantle
#

First, did you check that your built MyPlugin.jar contain the plugin.yml file ?

eternal oxide
#

Is this actually your plugin class? net.hasibix.xddcraftdiscord

stark schooner
eternal oxide
#

so yoru main is actually net.hasibix.xddcraftdiscord.xddcraftdiscord ?

stark schooner
#

uh

#

maybe

eternal oxide
#

use java naming conventions.

quaint mantle
#

If plugin.yml contains:

main: net.hasibix.xddcraftdiscord

Your class should be:
src/main/java/net/hasibix/xddcraftdiscord.java

But please use CammelCase as it is an important part of the good practices:

"XddCraftDiscord.java"
so in your plugin.yml
"main: net.hasibix.XddCraftDiscord"

eternal oxide
#

classes start upper case

stark schooner
#

something like this i did

eternal oxide
#

packages are all lower case, classes are capitalised.

#

?paste the full error and we can tell you instantly what your real issue is

undone axleBOT
quaint mantle
stark schooner
eternal oxide
#

are you building with maven?

stark schooner
#

no?

eternal oxide
#

then generally exporting will not export the resources folder

#

thats a maven/gradle thing

#

if you are building with Artifacts in InteliJ your yml files should be in the src folder I believe

stark schooner
#

oh how can i export resouces with eclipse

eternal oxide
#

you are using eclipse?

stark schooner
lavish hemlock
#

Ftr, IDEA works better than Eclipse most of the time.

naive jolt
eternal oxide
#

Pick whatever IDE you want/prefer to use then get help here when you are stuck

#

We recommend you use a built tool such as Maven or Gradle though. Both are built into Eclipse and InteliJ

stark schooner
# lavish hemlock Then what are you using rn??

secret thing for coding purpose because i dont have visual studio and my laptop cant handle visual studio or visual studio code my laptop can handle but not for much time my laptop crashes

eternal oxide
#

We can;t help you with a "Secret" IDE

naive jolt
#

this fine?PacketPlayOutEntityEquipment am = (PacketPlayOutEntityEquipment) player.getInventory();

#

cause it doesnt seem to work

stark schooner
#

ok i use replit just to code then i will push it to my github then i will download the project and export it to the main plugin from my laptop (i am comepletely not sure that my laptop can even handle eclipse or InteliJ)

#

i will push in github after its done all coding thing then download in laptop because when i download the project directly from replit it removes some important files but when i use github it keeps the important files of the project

paper geyser
#

how would I go about detecting what files are in a folder?

stark schooner
#

help i cant find eclipse 32 bit version ;-;

paper geyser
#

OHHHh

#

i forgot about that-

eternal oxide
stark schooner
#

yes ;-; thats why i always cri

eternal oxide
#

yeah good luck with that, 32bit is mostly dead

stark schooner
#

yes ;-; also windows 7 which is completely out of support

eternal oxide
#

I'm on win7 (64) best windows OS

stark schooner
#

oh

quaint mantle
#

@eternal oxide

#

@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(ExpBottleEvent e) {
Projectile ent = e.getEntity();
ThrownExpBottle b = (ThrownExpBottle) ent;
ProjectileSource s = b.getShooter();
Player p = (Player) s;

    if(!(ent instanceof ThrownExpBottle))
           return;
    if(!(s instanceof Player))
           return;
        
    e.setExperience(0);
    
    p.sendMessage("Тут может быть ваша реклама");

}
#

is it possible to check here with what name the player threw a bottle of experience?

eternal oxide
#

e.getPlayer()

stark schooner
#

i have a win10 64 bit pc but its destroyed my pc motherboard have short circuit problem so sometime my pc starts and sometime it does not the problem is from like march-april and its still not fixed

quaint mantle
eternal oxide
#

its an ItemStack so get the name from its meta (probably)

echo basalt
quaint mantle
#

This entity

eternal oxide
#

are you trying to get this name from an item in your inventory or the bottle in the world?

naive jolt
#

corpse.getBukkitEntity().getInventory().getArmorContents();

#

but like I wanna assign it to my Player player

#

it needs a itemstack

stark schooner
#

is InteliJ available for 32 bit?

ivory sleet
#

Afaik no

naive jolt
#

an item stack only contains items

#

so i get it

#

but then how do i get the item stack of the players armor

ivory sleet
#

Wat

eternal oxide
naive jolt
#

but apparently thats not a item stack

#

cause it doenst work

eternal oxide
#

contents is an array

naive jolt
#

will do!

#

well then i think the get armor contents will be array

#

I recall that from command blocks

naive jolt
stark schooner
onyx shale
#

bruh tf ur doing on a 32 bit system

stark schooner
#

my pc is ded

#

so i am forced to use 32 bit

onyx shale
#

you cant rly run much development related under 4gb ram

naive jolt
naive jolt
quasi flint
#

sad life

#

but 16bit cooler

onyx shale
#

even intellij loves eating like 2gb ram

naive jolt
#

i see that

#

bc it has an inv

stark schooner
naive jolt
onyx shale
#

go ham and install a 64 os

#

if it even lets you anymore..

#

a boy needs to buy a ram stick theyr cheap af

eternal oxide
#

its a 32 bit laptop, not a lot of point in upgrading it.

onyx shale
#

you can install manually a 64bit os yourself

stark schooner
#

ik

onyx shale
#

its just.. torture for the laptop unless you buy ram

eternal oxide
#

not if the CPU is 32 bit

stark schooner
#

i know to upgrade win7 32 bit to win10 64 bit

onyx shale
#

The 32-bit processor was the primary processor used in all computers until the early 1990s.

#

wut

#

i doubt ur laptop is 32bit locked

eternal oxide
#

What make/model is the laptop?

naive jolt
onyx shale
#

why are you converting a nms entity?

#

tho

naive jolt
#

its an npc

onyx shale
#

its not packet based right?

naive jolt
#

so it doesnt have getEquipment

naive jolt
onyx shale
#

yeah.. that wont work

naive jolt
#

it does

#

just not render

#

the armor

onyx shale
#

and my point..

stark schooner
onyx shale
#

you cant just getbukkitentity on a inexistent entity

naive jolt
#

wdym

onyx shale
#

you have to send the armor through packet

naive jolt
#

oh that...

#

lets just say i dont know how to use it

#

u mean this right?

onyx shale
#

1 sec

naive jolt
#
PacketPlayOutEntityEquipment```
#

ok

onyx shale
#
public static Packet sendEquipment(int entityId,EnumItemSlot slot, org.bukkit.inventory.ItemStack item){
        List<Pair<EnumItemSlot,ItemStack>> equipment = new ArrayList<>();
        Pair<EnumItemSlot,ItemStack> pair = Pair.of(slot, CraftItemStack.asNMSCopy(item));
        equipment.add(pair);
        PacketPlayOutEntityEquipment equip = new PacketPlayOutEntityEquipment(entityId,equipment);
        sendToAll(equip);
        return equip;
    }
naive jolt
#

gosh

#

is this for

#

all the armor

onyx shale
#

1 piece of item it should have yes

#

want full armor just call it 5 times

#

however this returns a packet so just send it after

#

thats sendToAll method

naive jolt
#

uh I am very new to packets

#

so let me try it out first

onyx shale
#

remove sendToAll method then call the method itself while sending

#

playerConnection.sendPacket(sendEquipment(....))

naive jolt
#

oh ok

#

I have a bunch more problems here

#

let me try to fix them first

#

btw on "pair" shoudl I import it from minecraft or bukkit?

onyx shale
#

mojang.datafixer

#

also are you using protocollib for the npc?

naive jolt
#

what?

#

umm my code incase

#

(unmodified)

onyx shale
#

just comment it in the ide?

naive jolt
#
                ((CraftServer) Bukkit.getServer()).getServer(),
                ((CraftWorld)player.getWorld()).getHandle(),
                gameProfile);
        corpse.setPosition(player.getLocation().getX(),player.getLocation().getY(), player.getLocation().getZ());

        Arrays.stream(player.getInventory().getContents()).forEach(itemStack -> {
            corpse.getInventory().pickup(CraftItemStack.asNMSCopy(itemStack));
        });```
quaint mantle
#

why when i use dropItemNaturally method, if item has any enchantments it wont get applied

onyx shale
#

nvm i saw the code your going nms route

onyx shale
quaint mantle
#

let me try adding it to inventory

stark schooner
#

guys can i install gradle in 32 bit windows 7?

quaint mantle
#

it doesnt get added

#

what is wrong ?

onyx shale
#

as i said.. are you properly setting the enchant?

eternal oxide
#

you will get limited support for gradle.

onyx shale
#

post the code

round finch
#

i can't spot any difference but it doesn't act the sameaThinkingIntensifies
i'm trying to analyse it

onyx shale
#

oh boy the statics

round finch
#

i should make it cleaner woops

stark schooner
onyx shale
#

eclipse may let you

quaint mantle
onyx shale
#

go through meta

#

to add it

quaint mantle
#

wait

round finch
#

ItemMeta

quaint mantle
#

bruh worked thanks

stark schooner
#

what should i use to make plugin in a 32 bit windows 7?

eternal oxide
#

32 bit was dropped by almost everyone long ago

stark schooner
#

ik

#

pls say

drowsy helm
#

probably a legacy version of eclipse

#

you can upgrade to win10 64bit for free you know

stark schooner
#

yes but i dont have permission to

eternal oxide
#

the newest 32 bit version I can see is from 2010

onyx shale
#

then dont code if its not your own hardware..

eternal oxide
#

will not support maven

trail flume
#

Hiya, I'm using 1.8.8 and the Player#sendTitle() method does nothing. Am I doing something wrong?

eternal night
#

using 1.8.8 might be what you are doing wrong 👍

drowsy helm
#

javadocs says its deprecated in 1.8.8

#

still should work though

naive jolt
#

uhh

#

any other way?

round finch
onyx shale
#

its likely changed in 1.17 for the name

drowsy helm
round finch
#

my apology

#

i should have checked doc

#

.

i made some code there looks very similar but
it does different things
how do i spot the tiny difference in my code?

trail flume
trail flume
drowsy helm
#

looks fine to me

#

whats the error?

trail flume
#

It just doesn't send the title

drowsy helm
#

hmm thats strange

round finch
#

will Title packet work for you maybe?

naive jolt
trail flume
#

But examples of that I've seen can't do that

round finch
#

it is possible yes

trail flume
#

Could you send me a code example?

round finch
#

hmm thinkW

trail flume
#

?

drowsy helm
#

gonna be hard to find a code example for 1.8.8

onyx shale
#

+1

drowsy helm
#

almost 7 years old lol

onyx shale
#

im surprised spigot didnt fully drop 1.8 yet like paper

drowsy helm
#

like the dependency?

onyx shale
#

the version itself

#

you cant ask for suport deving on 1.8

drowsy helm
#

oh yeah

quasi flint
#

because 1.8 should be dead

quaint mantle
#

Everyone what is the most prefer way to make command?

onyx shale
#

the normal way?

trail flume
#

I've found this:

IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + text + "\",color:" + ChatColor.GOLD.name().toLowerCase() + "}");

PacketPlayOutTitle title = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
PacketPlayOutTitle length = new PacketPlayOutTitle(5, 20, 5);


((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);

How can I create the IChatBaseComponent from just a string?

onyx shale
#

that.. was cringe..

drowsy helm
#

very

quasi flint
#

acf makes it too easy for me

#

i want me to suffer

lavish hemlock
#

I'd've made my own compile-time-based framework by now but I'm too lazy.

quaint mantle
drowsy helm
#

ACF basically does everything and anything you need

lavish hemlock
round finch
#

IChatBaseComponent chatTitle = ChatSerializer.a( String here?);

lavish hemlock
#

No dependency on an external library?

#

Simplicity and customizability as it is your own code?

drowsy helm
#

eh

quasi flint
#

i hate depending on shit

#

thats not mine

drowsy helm
#

negligible to me

#

atleast

lavish hemlock
#

I'm a bit of a performance junkie so like, reflection is the bane of my existence sometimes.

#

Which is why annotation processors are beautiful ❤️

#

(For another example: Dagger > Guice)

drowsy helm
trail flume
quasi flint
#

there js everything h need xd

#

where the fuck do u need jdon for that?

lavish hemlock
#

It might be SNBT :)

chrome beacon
#

^^

round finch
#

gimme a sec to test
to be 100% sure

trail flume
lavish hemlock
#

AKA
"Mom can I have JSON?"
"We have JSON at home"
JSON at home: SNBT

chrome beacon
#

So why not use the api

drowsy helm
#

just make a function

drowsy helm
trail flume
chrome beacon
#

Oh well dead versions

trail flume
#

For this particular thing

chrome beacon
quasi flint
#

?java

chrome beacon
#

I mean you have most of the code already

quasi flint
#

oi

#

work bot

#

work

chrome beacon
#

It's learnjava

drowsy helm
#

99% of the code is there you just have to wrap it in a function

trail flume
chrome beacon
#

Just put a variable in a string of json

quasi flint
#

that is a func

chrome beacon
#

(Snbt)

drowsy helm
#
public sendTitle(Player player, String text, ChatColor color, int a, int b, int c){
  IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + text+ "\",color:" + color.name().toLowerCase()+ "}");

PacketPlayOutTitle title = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
PacketPlayOutTitle length = new PacketPlayOutTitle(a, b, c);


((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);

}```\
#

simples

quasi flint
#

stromg

trail flume
#

What about for multiple colors? I'd have to modify my function for every ChatColor

quasi flint
#

stronk

drowsy helm
#

you just include chatcolor in the parameter?

chrome beacon
#

With translateColor or what ever thats called

trail flume
chrome beacon
#

You're on a legacy version so use legacy stuff

trail flume
drowsy helm
#

oh colour is a thing in the snbt

trail flume
#

yes

chrome beacon
quasi flint
#

do i smell 1.8.8

trail flume
chrome beacon
#

Chat messages are snbt too ya know

trail flume
#

Ok I've had an idea:
Can I just add a , to the SNBT to add more or is it more complicated than that?

drowsy helm
#

can't you just use colour codes

chrome beacon
#

You can

trail flume
#

no

quasi flint
#

?learnjava

undone axleBOT
chrome beacon
#

why send that ._.

trail flume
#

Unless I can just remove the color part from the SNBT and then add the color codes to the text string?

drowsy helm
#

thats what we've been saying

trail flume
#

ok well thank you I well test it now

#

*will

#

It works, thank you!

ivory sleet
formal prawn
#

org.bukkit.plugin.AuthorNagException: No legacy enum constant for FIRE_CHARGE. Did you forget to define a modern (1.13+) api-version in your plugin.yml?

#

Getting this error when I try to start my plugin

eternal night
#

isn't the error pretty self explanitory

formal prawn
#

idk what to do i am new

#

api version: <spigot_api_version>
I put this in plugin.yml?

eternal night
#

yea

#

tho only the major version

formal prawn
#

ok

eternal night
#

e.g. 1.16.5 would be api-version: '1.16'

formal prawn
#

oh ok

#

Error occurred while enabling SimpleHeal v1.0 (Is it up to date?)

eternal night
#

well what is the error

formal prawn
#

java.lang.IllegalArgumentException: Plugin already initialized!

#

it doesn't show any other error

formal prawn
eternal night
#

are you create a new instance of your main class

#

in your code

eternal oxide
#

new SimpleHeal()

#

or main, or whatever your class is called

formal prawn
eternal oxide
#

You don't. you already are

round finch
#

PacketPlayOutTitle in 1.17?

stone sinew
round finch
#

i want to use packet!

#

🙂

stone sinew
kindred path
#

How would I be able to override a custom inventory from opening?

stone sinew
slow quail
#

hey so i couldnt find any player event that removes set amout of levels from player there is only set can some1 tell me how to remove

#

just send part of the code please

round finch
#

what EnumTitleAction.TITLE changed to in 1.17?

slow quail
#

yes

quaint mantle
#

What are you trying to do exactly??

slow quail
#

when player click in gui (already done) it removes like 5 levels off the player

#

or xp

quaint mantle
#

Plugin Version?

slow quail
#

What do you mean?

quaint mantle
#

What Minecraft version is your Plugin for?

slow quail
#

1.17.1

quaint mantle
#

?jd

quaint mantle
#

This is for the Player Interface

formal prawn
#

[14:44:00 WARN]: Nag author(s): '[]' of 'SimpleHeal' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[14:44:00 ERROR]: Error occurred while enabling SimpleHeal v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: Plugin already initialized!

quaint mantle
#

@formal prawn uhh need help? 😂

formal prawn
#

yeah 😦

undone axleBOT
quaint mantle
candid galleon
#

It’s a pretty simple warning

#

You’re using System.our/err when you should be using the Logger

#

Like it literally spells it out

formal prawn
#

whats System.our/err and loggers

#

don't mind but i am pretty noob 😦

candid galleon
#

Is it your plugin that you coded?

eternal oxide
#

ignore that, its not your issue

formal prawn
quaint mantle
#

Your issue is you’ve seen to initialised your plugin twice

slow quail
quaint mantle
#

If you’re free to call I can help? Just easier to explain

slow quail
#

my bad thanks

formal prawn
quaint mantle
#

No worries

vale ember
#

how to make player shoot arrow just like from bow but without bow?

quasi flint
#

get his looking location

#

and summon an arrow

eternal oxide
#

Player#launchProjectile

vale ember
quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

I'm sorry to ask again but I can't find a solution to this issue:

I'm creating a lib I will use in multiple plugins and that connects to Hibernate : DatabaseLib.
I've made a simple plugin to test this lib: DatabaseLibTest.

Now I try to configure the log levels programatically (for hibernate (an ORM) and c3p0 (a connection pool tool)) :

I used System Properties and it works for c3p0.
I tried to do the same with hibernate. It does not work. https://paste.md-5.net/gesoqapuhu.java

How to define hibernate log level in the context of a spigot plugin ?

#

I don't even know on which logger hibernate based himself at runtime :/

#

I'm really lost with this issue :/

slow quail
#

This is more of a Code editor thing but how do i selecet text and replace every like number in it with another

vale ember
# eternal oxide Player#launchProjectile

i got a few problems:

  1. right click not works when i clicking air with empty hand (i am using PlayerInteractEvent)
  2. It's kinda too fast, how to make it like normal arrow (i mean what is normal bow's arrow velocity)
quasi flint
#

Use another PlayerClickEvent

quaint mantle
#

what editing software do you use ?

quaint mantle
slow quail
#

it replace it with ’

quaint mantle
quaint mantle
# slow quail it replace it with ’

With ALT + J

  1. Select the part of the text you want to replace in one line
  2. Press ALT + J as many time as required to select the text in every lines you want
  3. Write the new text
  4. Press escape to finish multiple edition

With CTRL + R in this file

With CTRL + SHIFT + R in multiple files

slow quail
vale ember
#

i am canceling EntityShootBowEvent but draw animation still playing

lost matrix
slow quail
#

nvm

lost matrix
vale ember
lost matrix
vale ember
vale ember
# lost matrix Cancel the PlayerInteractEvent.

still not working:

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        ItemStack item = player.getInventory().getItemInMainHand();

        if (item.getType().equals(Material.BOW)) {
            event.setCancelled(true);
            player.launchProjectile(Arrow.class);
        }
    }
slow quail
#

How do i give player item or take item from player

#

from/in inv

lost matrix
lost matrix
lost matrix
vale ember
lost matrix
#

Hm. Maybe drawing a bow is client side.
Workarounds

  1. Set the bow to a different item for one tick
  2. Cancel the bow shooting instead of the drawing
vale ember
lost matrix
quaint mantle
#

is there a method that checks the number of players on the server?

vale ember
lost matrix
vale ember
shadow gazelle
#

There seems to be some issue with colored displaynames being "seen" right

#

When I try to find this item in an event it doesn't "see it"

ItemStack sv = new ItemStack(Material.GLASS_BOTTLE);
ItemMeta svMeta = sv.getItemMeta();
sv.setAmount(1);
sv.addUnsafeEnchantment(Enchantment.LUCK, 1);
svMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&5Soul Vial"));
svMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
sv.setItemMeta(svMeta);
#

I have an exact replica in my inventory

#

But it never detects it as the same item

#

I'm pretty sure it's an issue with the naming because just checking the enchant, flags, and material works

hasty prawn
#

Guess you can start printing values and see what's different

zealous osprey
#

Is there a way to get all the metadata a player has ?
I've tried protocollib to make an eventlistener, but that didnt seem to work

shadow gazelle
hasty prawn
#

How are you comparing them

shadow gazelle
#

If ItemStack in hand isSimilar to ItemStack

maiden briar
#

Is there any inventory event if a player changes slot?

#

If they go from slot 9 to 0 for example

shadow gazelle
# hasty prawn Guess you can start printing values and see what's different
[17:12:09 INFO]: Player: Elephant_1214
[17:12:09 INFO]: Clicked Entity: ENDERMAN Age: 219
[17:12:09 INFO]: Item: ItemStack{GLASS_BOTTLE x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"dark_purple","text":"Soul Vial"}],"text":""}, enchants={LUCK=1}, ItemFlags=[HIDE_ENCHANTS]}}```
hasty prawn
#

Send the other item too

shadow gazelle
#

The ItemStack that it's supposed to look like?

hasty prawn
#

Yeah, the one you're comparing it with.

shadow gazelle
#

The stack size can be ignored because isSimilar is there

hasty prawn
#

Print it in the same format though, that's how you should compare.

shadow gazelle
#

Okay

#

I have the feeling that it'll have §d in the name or something stupid that should have been translated

quaint mantle
hasty prawn
maiden briar
#

Yes thanks

#

I also need to know what the previous item was

worldly ingot
maiden briar
#

Ok thank you

worldly ingot
#

#getNewSlot(), #getPreviousSlot()

maiden briar
#

Perfect

hasty prawn
#

Oh Thonk

#

That's a silly event

worldly ingot
#

Can't think of a valid use case for it tbh but it exists

hasty prawn
#

I also feel like PlayerItemHeldEvent could be named a little better but 🤷‍♂️

odd falcon
#

does anyone knows static method of ClassLoader -> registerAsParallelCapable()? what does it do? and also in the java docs its says register as parallel capable 🙄 (i admit sometimes java docs are useless)
since i seen the class PluginClassLoader in bungeecord source code does have it in static block

// taken from bungeecord source code
 static
    {
        ClassLoader.registerAsParallelCapable(); # <----- THIS!
    }

    public PluginClassloader(ProxyServer proxy, PluginDescription desc, File file, ClassLoader libraryLoader) throws IOException
    {
shadow gazelle
#

Your TPS would drop every time you got it if you got all of it

zealous osprey
#

that's another issue, but I'm wondering if there isnt a method that I could use to just get the meta of one specific player.
And the docs are confusing aswell, since they say that metadata is stored within nbt, but then it isn't ...

shadow gazelle
#

I don't see anything other than adding a custom meta tag and pulling it

#

It seems like Player has getMetaData

#

Nope, not there anymore

#

Wait

zealous osprey
#

the player has #getMetadata(String s) and that "String s" part is the annoying bit, since I need to specify the name of the metadata, but then I'd need to make a listener for when the player gets metadata assigned (that was the Protocollib thing I was trying) and just store the name for later use, or get it some other way.

shadow gazelle
#

My dumbass is looking at player events

zealous osprey
lost matrix
worldly ingot
#

No no I meant the switching of main hands

lost matrix
#

Ah

shadow gazelle
shadow gazelle
#

It's there

lost matrix
wispy monolith
#

is this loop gonna check for every player on the server?

for (Player player: Bukkit.getServer().getOnlinePlayers())
shadow gazelle
#

Yes

#

player would equal whatever player it's on in the loop

lost matrix
wispy monolith
#

actually how can i send a command in server console?

lost matrix
#

Bukkit.dispatchCommand

quaint mantle
lost matrix
zealous osprey
shadow gazelle
#

lol

quaint mantle
lost matrix
quaint mantle
#

ok

#

butoˇ

lost matrix
#

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say hi");

quaint mantle
#

Server is better idk

wispy monolith
#

thx

lost matrix
# quaint mantle Server is better idk

How? It is literally doing exactly the same.
This looks like a waste of time to me:
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "say hi");
instead of just
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "say hi");

wispy monolith
#

@lost matrix they should give you the helper role

shadow gazelle
#

When no `` code blocks on mobile

wispy monolith
#

i want to make a command to activate a specific class and another one to deactivate the class

#

how can i do that

shadow gazelle
#

A class with events or something?

shadow gazelle
#

Either way, you could make a command register and unregister an event/command

wispy monolith
shadow gazelle
#

That doesn't really make sense

wispy monolith
shadow gazelle
#

So what are you trying to make?

visual tide
#

what's the best way to prevent a player from joining and displaying a message on their screen if they try?
im kicking the player in PlayerJoinEvent rn, which is not ideal, since a join message is still dissplayed and some other plugins go crazy if the player is kicked in joinEvent

shadow gazelle
#

I also can't think of any use for that since you have to call a function in it to use it anyway

wispy monolith
shadow gazelle
#

So code for what?

#

An event or something?

wispy monolith
#

specificly a class that have a timer and a timerTask

shadow gazelle
#

Read the docs

#

You can pause/stop timers

elder oyster
#

How do you retrieve the key/value pair from the Configuration (Bungeecord)?
Currently I'm retrieving the section I need, like this:

commands = configuration.getSection("commands");```
but I can't get specific key/value pairs/ iterate through them
shadow gazelle
#

Activating and deactivating a whole class doesn't even make sense

#

Nothing in there is being run until you call it

ancient plank
#

#setLoginResult() and #setKickMessage()

quaint mantle
#

so the getEntity().getKIller() method doesn't return null ?

#

in EntityDeathEvent

worldly ingot
#

It does return null

#

getKiller() only returns a Player so if a Creeper or natural causes killed the entity, it's null

quaint mantle
#

thanks

elder oyster
quaint mantle
#

you mean getting something like

hello: "hi"
#

?

#

ore a section

#

and loop through it

elder oyster
#

I have this yaml file

commands:
   - discord:
      command: /discord
      types:
      - TEXT
      text:
      - 'Click here to join our Discord server!'
      hover:
      - 'linktodisc'
      link: 'linktodisc'```
I would like to retrieve all the commands inside "commands" and their details
quaint mantle
#

i guess the method getKeys will work

elder oyster
#

Haven't used strict languages in a while so I'm confused 😄

#

I tried getKeys but when I try to iterate, I get
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class net.md_5.bungee.config.Configuration (java.util.ArrayList is in module java.base of loader 'bootstrap'; net.md_5.bungee.config.Configuration is in unnamed module of loader 'app')

worldly ingot
#

Object lists are always awkward to work with.

#

There should be a getList() method, though I'm not entirely familiar with Bungee's config API

#

A List<?>

quaint mantle
#

i remember intellij turning this in to other symbols and making it cool
was there a theme or something doing it that is removed ?

#

is there any method to add xp or i should just get the current xp and + it ?

#

put there player.getExp + amount

elder oyster
worldly ingot
#

👍

quaint mantle
quaint mantle
naive jolt
#

so Im going to make a revive plugin
after u die u are put in crawling mode for 10 seconds
if no one revives u die
to revive u sneak near downed player

#

but how do I set a player to crawling mode

#

like is it

#

player.setanimation

#

oh wait ill use the "internet"

lost matrix
lost matrix
dull whale
#
'1':
  PosX: 54345.0
  PosZ: 4999.0
  Border: 100
  LetPlace: false
  LetBreak: false
  LetHurtMobs: false
  LetHurtPlayers: false
  LetHurtTeamMembers: false
  LetOpenDoors: false
  LetInteractAllBlocks: false
  Exceptions:
    c2c9cf65-4ccf-4733-a0c0-d2378a5bd5f5:
      LetHurtMobs: true
      LetHurtPlayers: true
      LetHurtTeamMembers: true
      LetOpenDoors: true
      LetInteractAllBlocks: true
``` is it better to have keys for each value or convert '1' to a map
naive jolt
#

is there a way to force a plyer to swim with no blocks needed

quaint mantle
#

just use lists

#
  • CAN_PLACE: false
#

etc

dull whale
#

you mean maps right

quaint mantle
#

i mean dont make flags like that for regions

dull whale
#

I dont really understand anything from that

quaint mantle
#

ok

#

idk then

dull whale
#

is it ok

lost matrix
lost matrix
dull whale
#

I will only change or get the values wont add any

#

or should I use boolean[] idk

lost matrix
#

Ok lets take a step back. What are you trying to achieve here?
Protecting areas?

dull whale
#

yes

lost matrix
#

Ok how do you check if a certain Location is within an area?

dull whale
#

Math.abs(blockLoc.getX() - borderBeaconData.getInt(key + ".PosX")) <= 100 && Math.abs(blockLoc.getZ() - borderBeaconData.getInt(key + ".PosZ")) <= 100)

#

thought this would be better than vectors

lost matrix
#

Very first thing you should do:
Dont use FileConfigurations on runtime.
When the server starts -> Load all data into variables and use those instead of getting values from the config over and over again.

#

Do you have more than one area?

dull whale
#

yes, a file per world ```java
File[] perWorldFiles = {x};
FileConfiguration[] perWorldData = {YamlConfiguration.loadConfiguration(perWorldFiles[0]), YamlConfiguration.loadConfiguration(perWorldFiles[1]), YamlConfiguration.loadConfiguration(perWorldFiles[2]), YamlConfiguration.loadConfiguration(perWorldFiles[3]), YamlConfiguration.loadConfiguration(perWorldFiles[4])};
public FileConfiguration getWorldData(int i) { return perWorldData[i - 1]; }
public void saveWorldData(int i) {
try {
perWorldData[i - 1].save(perWorldFiles[i - 1]);
} catch (IOException e) {
getLogger().severe("WORLD DATA SAVE ERROR");
}
}

#

this is in the main class

#

I use these everywhere

lost matrix
#

Yes. Dont do that.

dull whale
#

whats the main problem

#

i mean you said it

#

how should I do that

quaint mantle
#

:/

lost matrix
#

Performance. Maintainability. Readability. Key veracity. There are a lot of problems when working with configs on runtime.

quaint mantle
#

Is there another place than system properties where I should define logging levels ?

lost matrix
quaint mantle
#

Will try

lost matrix
# dull whale how should I do that

Object orientation. Create new classes.
For example
Create a class called Area which has fields like Location middle and int borderX etc. Then use proper Objects instead of
rummaging around in your config all the time.

lost matrix
#

Using NMS?

chrome beacon
#

Yes

#

And 1.15.2

lost matrix
# chrome beacon And 1.15.2

I dont know about 1.15 but the general Idea is:

  1. Tag the ArmorStand as invisible
  2. Get its DataWatcher
  3. Create MetaData packet
  4. Send it to player
        EntityArmorStand entityArmorStand = ...
        entityArmorStand.setInvisible(true);
        boolean forceFullUpdate = true;
        PacketPlayOutEntityMetadata metaPacket = new PacketPlayOutEntityMetadata(
            entityArmorStand.getId(),
            entityArmorStand.getDataWatcher(),
            forceFullUpdate
        );
        // Send packet to a player

@quaint mantle

lost matrix
quaint mantle
proud basin
#

how could I access a getter without filling in the values for the constructor?

#

since they are already set

minor garnet
chrome beacon
#

(Assuming they aren't static)

proud basin
#

yes

#

well what I have is an interface

#

which holds ```java
String name();

String description();

Category category() default Category.UTIL;
quaint mantle
opal juniper
#

Guys can we all just stop pinging 7smile7

#

he is amazingly helpful

proud basin
#

who?

quaint mantle
opal juniper
#

but deserves a break lol

quaint mantle
#

Since he is the only one trying to answer my painful question he is a light in darkness 😄

chrome beacon
proud basin
#

well im trying to get the name

chrome beacon
#

So you have an instance

#

If not there is no name

proud basin
#

well you see this is how I am doing in, in the class I have @Module(name = blablabl.NAME) and that's how I am setting the name

chrome beacon
#

Well get the instance of that annotion

#

I'm not sure how they work but you would need it

unkempt peak
#

Hey so this is probably a dumb question but i can't seem to figure out why this recipe isn't working

                ShapedRecipe recipe = new ShapedRecipe(key, item);
                recipe.shape(" S ", " T ", " T ");
                recipe.setIngredient('S', Material.STICK);
                recipe.setIngredient('T', Material.SMOOTH_STONE);
                Bukkit.getServer().addRecipe(recipe);```
when i sysout Bukkit.getServer().addRecipe(recipe) i get true and in the docs it says that it returns true if the recipe was added but when i try to craft it ingame nothing happens
#

if your wondering item is stone sword and material is also stone sword

proud basin
lost matrix
# quaint mantle Since he is the only one trying to answer my painful question he is a light in d...

Try setting those system properties:

# This is only for decoration
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n

# This is will make log4j only log errors
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate=error

Also try to set those properties as early as possible.
So in your JavaPlugin#onLoad() method.

quaint mantle
#

Thank you very much. Will try that !

cyan bolt
#

my IP got banned for something i'm not sure all i ever did was download buildtools is there any appeal form i can submit?

#

nvm i was using my VPN thats why

tardy delta
#

is it possible that this prevents a player from moving?

public static void setCantPush(Player player) {
        Team team = player.getScoreboard().getTeam("NoPush");
        if (team == null) {
            team = player.getScoreboard().registerNewTeam("NoPush");
            team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
            team.addEntry(player.getName());
        }
    }
worldly ingot
#

No, not at all

tardy delta
#

i only changed some things in my plugin

naive jolt
#

how do i check if a player is near another player

tardy delta
#

cringe

#

well i think it was this

Player player = event.getPlayer();
        player.setCollidable(false);
#

you mean the permission.

#

uhh use luckperms i would say :kekw:

naive jolt
formal prawn
#

how do i add more explosiveness to fireballs?

ivory sleet
#

First step would be not to use pex but lp 😛

formal prawn
#

e.getEntity().getWorld().createExplosion(e.getEntity().getLocation(), 10);

I tried this but doesn't work

ivory sleet
#

though I believe you can use the vault api to manipulate permssions for both plugins

formal prawn
formal prawn
tardy delta
#

goggle?

eternal oxide
#

increase yield

formal prawn
# eternal oxide increase yield

@EventHandler
public void onThrow(PlayerInteractEvent fbt)
{
if(fbt.getAction().equals(Action.RIGHT_CLICK_AIR) || fbt.getAction().equals(Action.RIGHT_CLICK_BLOCK))
{
Player thrower = fbt.getPlayer();
if(thrower.getItemInHand() != null && thrower.getItemInHand().getType().equals(Material.FIRE_CHARGE))
{
Fireball ball = thrower.launchProjectile(Fireball.class, thrower.getLocation().getDirection());
}
}
}

How do I do it

plain oxide
#

Is it possible to cancel the Packet completely when I hit the player?

I want to avoid the sound and particles when hitting the player
I don't want the Sprint to be interrupted

#

e.setCancelled(true);
With this, I can only prevent damage ...

patent wadi
#

How do you get/set facing direction on a banner using the blockdata method so not to use depreciated methods?

lost matrix
patent wadi
exotic obsidian
#

hello

tardy delta
#

hewwo

velvet minnow
#

Hello ! 🙂

patent wadi
velvet minnow
#

Hi, I need an advice 🙂
What method would you use to store data on a player such as new attributes, a custom leveling system, etc...
"Persistent Data Holder" or an external database such as MySQL ? Or may be a combination of these two ? 😛

unkempt peak
#

If you want to permanently store player data I would reccomend MySQL

tardy delta
#

Wew

eternal night
#

^^ pdc is sweet for small things, like flags etc. Complex data structures like a leveling system should be in an external database

tardy delta
#

:UwU:

#

Please add an UwU emote

formal prawn
#

How do I do it so that the Fireball gives knockback to entities when hitting to any entity

unkempt peak
#

ProjectileHitEvent

formal prawn
velvet minnow
#

Ok thanks for your advices, I will go with an external database 😉

unkempt peak
#

Projectile is fireball > set power or launch player

formal prawn
unkempt peak
#

I'm not going to spoonfeed you
Use the ProjectileHitEvent check if the entity is an instance of Fireball then launch the player

lost matrix
unkempt peak
#

If you have a more specific question feel free to ask

formal prawn
unkempt peak
#

You can set the velocity

#

Player#setVelocity

lost matrix
formal prawn
#

oh ok

unkempt peak
#

I would highly recommend learning basic java before you continue if you haven't already

#

?learnjava

undone axleBOT
formal prawn
#

Alright thanks

formal prawn
quaint mantle
#

Thank you for your help anyway !!

unkempt peak
#

Also why are you using new Vector(0, 100, 0)?

#

that would just yeet the player up 100s of blocks

#

unless thats what you want...

formal prawn
#

which is not happening

lost matrix
#

*This approach only works if your directly hit an entity with the FireBall

formal prawn
formal prawn
ornate heart
#

Is it possible to make a player look like he's doing the bow drawing animation, but they don't have a bow in their hand?

trail flume
#

Hiya, I'm getting the java.lang.IllegalStateException: Asynchronous player tracker clear! error when running this code p.teleport(spawnLocation);

old cloud
trail flume
#

I'm using a TimerTask because what I'm doing is precise

onyx shale
#

you cant run any bukkit api method outside the main thread

trail flume
#

Oh.

trail flume
#

What can I do then?

old cloud
#

run it as a bukkit task

onyx shale
#

indeed

trail flume
#

I can't do that though as it's a time-specific operation

onyx shale
#

Bukkit.getScheduler().runTask

#

you cant link main thread timing to ur own timing

trail flume
#

.-.

onyx shale
#

the operation will get processed at the next tick

exotic obsidian
#

Bukkit.getScheduler().runTaskTimer(Main.getinstance(), new Runnable() {

            int count = 0;
            
            @Override
            public void run() {
                if(count == 1)
                   count = 0;
                
                switch(count) {
                case 0:
                    wardrobemenu2.setItem(2, Items.dark_blue_helmet(p));
                    wardrobemenu2.setItem(11, Items.dark_blue_chestplate(p));
                    wardrobemenu2.setItem(20, Items.dark_blue_leggings(p));
                    wardrobemenu2.setItem(29, Items.dark_blue_boots(p));
                    wardrobemenu2.setItem(3, Items.dark_gray_helmet(p));
                    wardrobemenu2.setItem(12, Items.dark_gray_chestplate(p));
                    wardrobemenu2.setItem(21, Items.dark_gray_leggings(p));
                    wardrobemenu2.setItem(30, Items.dark_gray_boots(p));
                    wardrobemenu2.setItem(4, Items.blue_helmet(p));
                    wardrobemenu2.setItem(13, Items.blue_chestplate(p));
                    wardrobemenu2.setItem(22, Items.blue_leggings(p));
                    wardrobemenu2.setItem(31, Items.blue_boots(p));
                    wardrobemenu2.setItem(5, Items.gray_helmet(p));
                    wardrobemenu2.setItem(14, Items.gray_chestplate(p));
                    wardrobemenu2.setItem(23, Items.gray_leggings(p));
                    wardrobemenu2.setItem(32, Items.gray_boots(p));
                    wardrobemenu2.setItem(6, Items.black_helmet(p));
                    wardrobemenu2.setItem(15, Items.black_chestplate(p));
                    wardrobemenu2.setItem(24, Items.black_leggings(p));
                    wardrobemenu2.setItem(33, Items.black_boots(p));
                    wardrobemenu2.setItem(7, Items.white_helmet(p));
                    wardrobemenu2.setItem(16, Items.white_chestplate(p));
                    wardrobemenu2.setItem(25, Items.white_leggings(p));
                    wardrobemenu2.setItem(34, Items.white_boots(p));
                    break;
                    case 1:
                    wardrobemenu2.setItem(2, Items.dark_gray_helmet(p));
                    wardrobemenu2.setItem(11, Items.dark_gray_chestplate(p));
                    wardrobemenu2.setItem(20, Items.dark_gray_leggings(p));
                    wardrobemenu2.setItem(29, Items.dark_gray_boots(p));
                    wardrobemenu2.setItem(3, Items.dark_blue_helmet(p));
                    wardrobemenu2.setItem(12, Items.dark_blue_chestplate(p));
                    wardrobemenu2.setItem(21, Items.dark_blue_leggings(p));
                    wardrobemenu2.setItem(30, Items.dark_blue_boots(p));
                    wardrobemenu2.setItem(5, Items.blue_helmet(p));
                    wardrobemenu2.setItem(14, Items.blue_chestplate(p));
                    wardrobemenu2.setItem(23, Items.blue_leggings(p));
                    wardrobemenu2.setItem(32, Items.blue_boots(p));
                    break;
                }
            }

count++;

            }
        }, 0, 10);
#

any help xd?

unkempt peak
#

...

old cloud
#

...

unkempt peak
#

?paste

undone axleBOT
exotic obsidian
#

...

trail flume
#

Actually I think the best thing I can do is have my time-specific thing set a variable when it can execute and then have a bukkit task

unkempt peak
#

use a paste bin or code block

formal prawn
#

Is there any way I can set a radius for the Fireball to launch the player?

onyx shale
#

hmm you might be able to listen to explosionprimeevent

unkempt peak
#

You would have to get nearby entites when the projectile lands

#

ProjectileHitEvent would work for that

trail flume
#

It works, thank!

unkempt peak
#

loop through the list check if the entity is player then launch

waxen plinth
#

Have you ever heard of loops? Arrays? Come on

formal prawn
#

public void onProjectileHitEvent(ProjectileHitEvent e)
{
if(e.getEntity() instanceof Fireball)
{
List<Entity> hitEnt= e.getEntity().getNearbyEntities(5, 5, 5);
if(hitEnt instanceof Player)
{
((Player) hitEnt).setVelocity(new Vector(0, 100, 0));
}
}
}

Still doesn't work 😦

hasty prawn
#

Did you register the listeners and add @EventHandler

unkempt peak
#

sysout in the event and see if its running

formal prawn
#

alright lemme try that

naive jolt
#

uh how do i check if a player is near a npc

formal prawn
unkempt peak
naive jolt
#

player.getNearbyEntities?

#

op i see it

#

thx

unkempt peak
#

try that

naive jolt
#

get(1,1,1)

#

right?

#

and then

unkempt peak
#

get as list and loop through it

#

1, 1, 1 would be all entities 1 block or less from the player

naive jolt
#

oh

unkempt peak
#

that is the x y and z range

naive jolt
#

oh got it

naive jolt
#

player?

unkempt peak
#

List<Entity> entities = player.getNearbyEntities(x, y, z);

#

then loop through entities

naive jolt
#

ahh the list part confused me thanks!

formal prawn
#

@EventHandler
public void onProjectileHitEvent(ProjectileHitEvent e)
{
if(e.getEntity() instanceof Fireball)
{
List<Entity> hitEnt = e.getEntity().getNearbyEntities(5, 5, 5);
if(hitEnt instanceof Player)
{
((Player) hitEnt).setVelocity(((Player) hitEnt).getVelocity().setY(100));
}
}
}

Still doesn't work ahhhhhh

unkempt peak
#

put a sysout in right under the set velocity line

#

see if its running

formal prawn
#

ok

eternal oxide
#

hitEnt is a List. its never going to pass on the instanceof test

unkempt peak
#

oh wait

#

lol

#

you need to loop through the list

formal prawn
eternal oxide
#

no

#

iterate the list

formal prawn
# eternal oxide iterate the list

if(e.getEntity() instanceof Fireball)
{
List<Entity> hitEnt = e.getEntity().getNearbyEntities(5, 5, 5);

         ListIterator<Entity> player = hitEnt.listIterator();
        if(hitEnt instanceof Player)
        {
            ((Player) hitEnt).setVelocity(((Player) hitEnt).getVelocity().setY(100));
            System.out.println("WORK PLUGIN WORK");
        }
    }

Now what

eternal oxide
#

No, sorry but learn java

quaint mantle
#

?learnjava

undone axleBOT
mellow edge
#

is there any way to detect player collision because the event for that does not exist?

wild reef
#

Hey quick question. I want to get the "Killer" of an player. I am using the PlayerDeathEvent.
Right now I am using this:

event.getEntity().getLastDamageCause().getEntity()

But this Entity seems to be the player who died, so is there any easy way to get the actual killer entity?

chrome beacon
#

Returns a player though if that's what you want

wild reef
#

Ah alright, thank you

mellow edge
lost matrix
mellow edge
#

I want to detect if a player collides with a block of any kind not with other players if that's what you meant

drowsy helm
#

i dont think theres any event for that

mellow edge
#

not it doesnt exist

#

yet?

fossil lily
#
package me.loudbook.testingplugin.commands;

import me.loudbook.testingplugin.Main;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.Inventory;

public class Commands implements CommandExecutor {
    private Main plugin;

    public Commands(Main plugin) {
        this.plugin = plugin;
        plugin.getCommand("spawnskeleton").setExecutor(this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player p = (Player) sender;
        Location loc = p.getLocation();

        for (int i = 0; i < 20; i++) {
            World w = p.getWorld();
            w.spawnEntity(loc, EntityType.SKELETON);
        }
        return false;

    }
}

Anybody see anything wrong with this?

drowsy helm
#

well there wouldn't be any packet sent out for it

#

so it will never exist

mellow edge
#

it is a client side feature I think and server cant do anything I think

drowsy helm
#

i mean you could check for sudden velocity change between ticks

#

but thats probably the best way you can do it

#

still super hacky though

mellow edge
#

lol maybe

mellow edge
fossil lily
#

No error

quaint mantle
#

Just to be sure; you are creating an instance of your commands class in the main class, right?