#help-development

1 messages · Page 1438 of 1

sage swift
#

^

onyx shale
#

also what exactly are you trying to do?

sage swift
#

he's making npcs

onyx shale
#

i could lend him some snippets but i think its more fun to find out

sage swift
muted idol
#

yo i like that nobody knows how to fix my issue

sage swift
#

you dont have an issue

onyx shale
#

tru

muted idol
#

yea not really

#

trying to do something that's a little out of the ordinary

gaunt eagle
#

yes but does this not translate into code for different purposes?

onyx shale
#

what you mean?

muted idol
#

it's just that i never have used the bungeecord messaging system so i really don't know how to use it

onyx shale
#

thats how you pass the normal world into nms

#

if it ever requires a World thats it

gaunt eagle
#

i mean Look what I'm trying to do here

#

we equate it to different things

sage swift
#

what

onyx shale
#

the way i sent you its how you should do it

#

also dont expect to have PlayerInteractEnittyEvent here

#

you have to connect to the pipeline and catch interact packets

gaunt eagle
#

so I tried to synchronize the 'worldServer' variable to the 'server' variable, but you created a completely independent variable.

onyx shale
#

dont you see something similar in the name?

gaunt eagle
#

I may have described it as a bit confusing, I'll try this way and come back xD

onyx shale
#

WorldServer is the currently loaded world from the server

#

however your likely to use a command to spawn the npc

#

so you should use that with a player location

#

wich isnt much different than using what i posted just with world changed to player.getWorld()

#

also for your own sanity

gaunt eagle
onyx shale
#

more important part

#
if(pack.c()==EnumHand.MAIN_HAND) {
                if(pl.npc.getEntityId()==id) {
                    pl.qhandler.startQuest(p);
                }
                }
#

what will happen if you right click the npc

#

working with npc is no easy job as you will see

gaunt eagle
#

Did you write these to me? Because I mentioned another problem with NPCs xD

onyx shale
#

yep

#

the first one is how you will need to handle

#

the interaction with the np

#

npc

#

eq. right clicking it

gaunt eagle
#

oh wait

#

The events above were not related to NPCs

#

fake tablist only

fierce salmon
#

im getting an error here for some reason

onyx shale
#

so no interaction?

gaunt eagle
#

yeap

onyx shale
#

in that case ignore them

paper viper
#

look at the method header

gaunt eagle
#

Speaking of it, I want to talk about that as well.

severe folio
# muted idol it's just that i never have used the bungeecord messaging system so i really don...

do you mean something like this? ```java
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();

    ByteArrayDataOutput output = ByteStreams.newDataOutput();
    output.writeUTF("SomeCustomBS");
    
    player.sendPluginMessage(somePlugin, "BungeeCord", output.toByteArray());
}
```java
    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equals("BungeeCord"))
            return;
        
        ByteArrayDataInput input = ByteStreams.newDataInput(message);
        String action = input.readUTF();
        
        if (action.equalsIgnoreCase("SomeCustomBS")) {
            // execute some method.
        }
    }
    ```
onyx shale
#

so you need to construct a location

#

before teleporting

gaunt eagle
#

@onyx shale
NPC is creating as it should, but I still get this error. I do not understand

#

can u have idea?

onyx shale
#

think ur missing the serializer on the datawatcher

gaunt eagle
#

I can see there is a problem with (byte) but whatever I do I couldn't change it

muted idol
gaunt eagle
#

my version is 1.16.5

muted idol
#

also i have heard some from some people that there always has to be a player in each server for it to work and from other people i have heard vice verca

fierce salmon
severe folio
#

and yea you need a player to send the plugin message from

muted idol
#

alright so if there was a player on server 1 but no player on server 2 would that work?

#

or does there have to be a player on both servers for it to work?

hollow canopy
#

@sage swift

#

your code working but there is a issue

sage swift
#

ischoo?

hollow canopy
#

it insta kills

sage swift
#

bless you

severe folio
muted idol
#

amazing, thanks for all the help man!

onyx shale
#

you dont rly interact with the npc,datwatcher is more of a metdata thing

#

to set armor skins or shit

severe folio
quaint mantle
#

So I have a location and an Entitytype, how do I spawn the entitytype at the location

severe folio
#

Location#getWorld()#spawnEntity

hollow canopy
#

@sage swift how can I run it only 1 time?

onyx shale
quaint mantle
#

Thank you Konjiki

hollow canopy
#

I put a break; but it didnt work

#

@sage swift this is my last question

#

please bro

severe folio
#

oh someone already replied my bad lmao

onyx shale
#

still bit redundant

#

considering you can directly use clickedblock location

#

rather than building a new one

severe folio
#

or that ^

#

i didnt read the entire thing lol

onyx shale
#

but i guess good practice?

severe folio
#

🤷

fierce salmon
#

so i have this now how would i tp them to the area

sage swift
#

set it to a variable

#

new Location... creates the location but you need it as a Location variable to use it

onyx shale
#

sadly once we go into java basics ima head out

fierce salmon
#

got it

sage swift
#

also you really dont need to create a whole new location

#

event.getPlayer.getLocation.add(0, 1, 0) should do it

#

or if you want to teleport them on top of a block event.getPlayer.teleport(event.getClickedBlock().getRelative(BlockFace.UP))

fierce salmon
#

@sage swift any way i could add the pitch and yaw

quaint mantle
#
        double num = Math.random();

        if (num < .5) {
            if (event.getEntity().getType() == EntityType.PIGLIN) {
                Location loc = entity.getLocation();
                event.setCancelled(true);
                EntityType zilly = EntityType.ZOMBIE_VILLAGER;
                loc.getWorld().spawnEntity(loc, zilly);```
onyx shale
#

a block doesnt have a pitch or yaw

quaint mantle
#

whats up with this not working

onyx shale
#

i guess you can use the players one

fierce salmon
#

true im dumb

sullen marlin
#

code looks ok pringle

#

is it actually running

#

did you register and annotate it

quaint mantle
#

oh i forgot the listener in onEnable

#

sorry about that haha

manic phoenix
#

How can I send pictures in here?

sage swift
#

link with spigot account

eternal night
#

you wanna verify your- 😦

fierce salmon
#

so im trying to get the pitch and yaw of before the player gets teleported to the block

gaunt eagle
slim magnet
#

how do prioritise right clicking a block over right clicking an item in hand? Like it right clicking the item opens inventory A and right clicking the block opens Inventory B, I want inventory B to open if the player right clicks the block with the item.

onyx shale
gaunt eagle
onyx shale
#

test it out

#

it should

severe folio
gaunt eagle
#

oh yea, this worked, really thank you xD

#

Do you know a little about scripts? I want to ask a simple question

severe folio
#

oh do you mean a block in the inventory?

onyx shale
#

depends what type of scripts

slim magnet
#

Nooo

#

nvm ill try something out

gaunt eagle
#

Do you know of an option like on world enter?

severe folio
#

ok what am i not understanding

onyx shale
#

define scripts idk what your talking about

gaunt eagle
#

actually this not about plugins, just the basic script question

i mean this: https://dev.bukkit.org/projects/skript
Sorry, a question completely unrelated to the channel content: /

I want to send a message like "hi" when someone is in the "oneblock_world" world

onyx shale
#

ahh you mean skript

gaunt eagle
#

oh

onyx shale
#

in that case nope,i only code in java

gaunt eagle
#

yeah xD

#

understood thanks ^^

fierce salmon
#

does anyone know how to lower the attack speed of an item

slim magnet
#

^ i have the same question ngl

#

never searched it tho

manic phoenix
#

Somehow the zombies dont give me the effect
Can somebody see an issue?

severe folio
#

is this expected behaviour?

#

20 ticks = 1 second

manic phoenix
#

Ah ok I'll change it

#

Yeah it works now Ty

muted idol
#

is it necessary?

severe folio
#

oh right

#

public class SomeListener implements PluginMessageListener

#

implement the PluginMessageListener interaface

muted idol
#

yep looks like it worked

hoary tiger
#

How do I get all Player locations from a Mob event?

severe folio
#

did you take a look at the link i replied with earlier? You also have to register the listener in onEnable(). It;s shown how to in that wiki article @muted idol

severe folio
#

alright cool

manic phoenix
#

Why do zombies still drop items?

muted idol
hoary tiger
dusty herald
manic phoenix
dusty herald
#

show

manic phoenix
dusty herald
#

🤷 try debugging

fierce salmon
#

what is the name of the event when a player pops a totem

severe folio
fierce salmon
#

are u sure

dusty herald
#

when people use totems they don't drop them avaeyes

fierce salmon
#

is it PlayerItemConsumeEvent

dusty herald
#

EntityRessurectEvent

severe folio
#

^ that if you mean use the totem

severe folio
#

i need sleep i think lol

manic phoenix
fierce salmon
dusty herald
#

show latest.log

manic phoenix
severe folio
sullen marlin
#

pretty sure getDrops().clear() is right

manic phoenix
severe folio
#

it probably is but 🤷

#

idk, i dont see anything else that could be the problem

manic phoenix
#

Maybe its bcs I code for 1.7 👀

dusty herald
#

you're kidding

manic phoenix
#

Unfortunately not

dusty herald
hoary tiger
#

How do I get all Player locations from any Mob Death event?

cobalt lagoon
#

Bukkit.getOnlinePlayers?

hoary tiger
#

then how do I get the location?

sage swift
#

what is your goal

sleek pond
#

to be cool 😎

sage swift
#

cant help you with that

turbid ridge
#

Hey! Im trying to create a plugin where you can click with a enchanted book on other item and it enchants it but for some reason it is super buggy. It dupes and is being weird
my code:

if (event.getCursor().getType() == Material.ENCHANTED_BOOK) {
            event.setCancelled(true);
            event.setCursor(new ItemStack(Material.AIR));
            
            // Enchant
}```
#

Its an inventory click event*

#

I tried ```
if (event.getCurrentItem().getType() == Material.ENCHANTED_BOOK) {
event.setCancelled(true);
event.setCurrentItem(new ItemStack(Material.AIR));

        // Enchant
    }``` but it seemed to to less
sage swift
#

use setCursor but delay it

#

thats how i did it and it works perfectly

#

even though setCursor is deprecated

hoary tiger
#

this lines of code =>

    @EventHandler
    public void onSpawn(EntityDeathEvent event) {
        
        if (event.getEntity() instanceof EntityCreature) return;
        if (event.getEntity().getType() == EntityType.PLAYER) return;
            
        EntityType type = event.getEntity().getType();
        
        event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type);
                event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type);
        
        return;
    }```
Litterally overloads the server. Is there something that keeps dying or what's wrong with it?
sage swift
#

if thats overloading the server maybe it needs better hardware

#

or to get out of the 1970s

#

also youre checking whether a bukkit entity is an instanceof an nms EntityCreature

royal trout
#

I have a lore tag on an item that makes it green "&a" but i want it green and bold

#

what do i put after &a

ivory sleet
#

&l

fierce salmon
#

for some reason in this plugin the text will be sent but the heath will not be set to 20 and the potion effects do not work.

ivory sleet
#

Maybe delay it

fierce salmon
#

how?

sullen marlin
#

its cause right after the resurrect vanilla adds its own effects

ivory sleet
#

Bukkit.getScheduler().runTask(plugin, () -> {
//potion effects here etc
}); or smtng

sullen marlin
#

cancel EntityPotionEffectEvent where CAUSE = Cause.TOTEM

hoary tiger
fierce salmon
sage swift
#

huh

#

evt.getCause

#

probably

fierce salmon
#

i dont see event.getCause on the list

sullen marlin
#

you need to make a new method listening to EntityPotionEffectEvent

#

and run getCause on that

turbid ridge
sage swift
#

dont need a time

#

use the one that doesnt take a number

turbid ridge
#

👍

#

Still clones it

if (event.getCurrentItem().getType() == Material.ENCHANTED_BOOK) {
            event.setCancelled(true);
            Main.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(Main.getInstance(), new Runnable() {
                public void run() {
                    event.setCursor(new ItemStack(Material.AIR));
                }
            });

            // Enchant
}```
sage swift
#

why would you set it to air

#

set it to null

turbid ridge
#

Aight

sage swift
#

are you in creative mode? make sure you're testing this in survival

turbid ridge
#

Ah sheeesh works now. Danke danke

drowsy helm
#

What's the best way to disable all commands for a player

quaint mantle
#

So I'm having an issue with tab completion where only one option will show up for tab completion. Heres my code ```java
public class TabCompletion implements TabCompleter {
List<String> arguments = new ArrayList<String>();
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
arguments.clear();
arguments.add("day");
arguments.add("night");
arguments.add("afternoon");
arguments.add("midnight");
arguments.add("morning");
arguments.add("noon");
arguments.add("sunrise");
arguments.add("sunset");

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

You return inside the loop

#

Also don’t remake the list every time

quaint mantle
#

ah

young knoll
#

Also also StringUtils.copyPartialMatches

quaint mantle
#

could you give me an example please?

#

I know how to change the list

hollow river
#

hey so i have an entity parent class, which would have things like ZombieMob extending it. now i also have a function that requires a child class (ZombieMob, SheepMob etc.. which all extend the main Entity class) how would i invoke a new instance on the given class? this is my current code which throws the InvocationTargetException exception

quaint mantle
#

How would I change the StringUtils.copy?

hollow river
#
public void spawnMobs() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        if(maxcount <= 5) {
            Constructor<? extends RPGEntity> constructor = rpgEntity.getConstructor(Location.class);
            RPGEntity entity = (RPGEntity) constructor.newInstance(spawnLocation);
            EntityManager.SpawnEntity(entity);
            maxcount++;
        }
    }
quaint mantle
#

ty

hollow river
#

the rpgEntity variable is ZombieMob.class

#

oh shit i fixed it, found a nullpointerexception in my stack trace which let me know i forgot to assign the location of the mob i was trying to spawn, silly me

quaint mantle
#

good job

hollow river
#

got a quest system, dialogue system, mobs/spawning system ready looking good so far

quaint mantle
#

Good luck

#

I have no idea what I'm doing

#

Still not working. Here's my updated code ```java
public class TabCompletion implements TabCompleter {
List<String> arguments = new ArrayList<String>();
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
if (arguments.isEmpty()) {
arguments.add("day");
arguments.add("night");
arguments.add("afternoon");
arguments.add("midnight");
arguments.add("morning");
arguments.add("noon");
arguments.add("sunrise");
arguments.add("sunset");
}

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

You still return inside the loop

sage swift
#

doesnt look very updated

quaint mantle
#

so remove the return?

sage swift
#

put it outside the loop

quaint mantle
#
public class TabCompletion implements TabCompleter {
    List<String> arguments = new ArrayList<String>();
    public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
        if (arguments.isEmpty()) {
            arguments.add("day");
            arguments.add("night");
            arguments.add("afternoon");
            arguments.add("midnight");
            arguments.add("morning");
            arguments.add("noon");
            arguments.add("sunrise");
            arguments.add("sunset");
        }


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











        return null;
    }
#

like this?

#

This is my full cde

#

I forgot to add it

#

oops

young knoll
#

Nice new lines

quaint mantle
#

ty :D

#

Anyyway

sage swift
#

it wouldnt work

#

it requires at least 30 new lines before return null;

quaint mantle
#

lol

#

I'm dumb but not that dumb

#

But ty for the help

hollow river
#

well this is the result so far (just gotta add spawnradius tomorrow) working pretty solid

hoary tiger
#

for event.getEntity().getWorld().spawnEntity(event.getEntity().getLocation(), type); How do I add PDC?

young knoll
#

Save the returned entity to a variable

#

And then use variable.getPersistantDataContainer

sage swift
#

||do it in one line||

hoary tiger
#

? ok I'll try

young knoll
#

I mean yes you can do that too

wispy fossil
#

hey i was reading that

hoary tiger
#

I wanted to try to figure it out my self before I ask sorry...

wispy fossil
#

np lol

#

thats good practice

sage swift
#

i've always wondered... does BukkitScheduler#runTask run at the end of that tick? or on the next tick? i've gotten some mixed responses about this

hoary tiger
#

next thick

sage swift
#

do you like

#

have proof

hoary tiger
#

Sorry i was trying to screenshot

sage swift
#

and if this is true why does it even exist if you can do runTaskLater(plugin, task, 1)

hoary tiger
#

run task does it on the next frame only

sage swift
#

no... runTaskLater does it once after a certain time

#

so runTaskLater(1) is equivalent to runTask

hoary tiger
#

yes I think

#

depends if 0 on the runTaskLater is the next frame already or if 0 is the dame frame

#

Acctually, yes you are right

sage swift
#

i wonder what happens if you put 0 in runTaskLater

#

there's no advertised exception for a non-positive delay

hoary tiger
#

I don't know how the method works but i think it will just run at the same frame or, return an error

young knoll
#

I assume it’s just a connivence method

sage swift
#

is there any way to run the task at the end of the tick then? ive had a lot of cases where i would want that

jade perch
#

What you need this for

sage swift
#

just thinking about exploits that it could be used for :D

hoary tiger
#

lol

eternal oxide
sage swift
#

but, as @waxen plinth said, No, it shouldn't matter even then Think about it The server must run through all the events for the tick Then all the tasks for the tick Either that, or it must run through the tasks, then the events Either way If you schedule a task during an event It will be run before the events for the next tick

#

unless events are done before tasks

#

then the task is scheduled for after another iteration of events

somber hull
#

if you modify the users inventory
do you have to do an updateinventory thing
i have heard someone say that somewhere

waxen plinth
#

In some cases

#

Not always

somber hull
#

Ok, how do you do that

waxen plinth
#

Player#updateInventory

somber hull
#

hmmm

#

on an inventoryclickevent

#

event.getwhoclicked

#

should give player right?

waxen plinth
#

Gives a HumanEntity

#

Just cast it to Player

#

It will always be a Player, I have no idea why it returns a HumanEntity

somber hull
#

Got it

#

thank you

sage swift
#

yeah if events run before tasks in a tick then scheduling a task for the next tick will run more events before the task

somber hull
#

is this messy?

waxen plinth
#

Yes

somber hull
#

How would i fix it

waxen plinth
#

Early return

#

Functional decomposition

sage swift
#

make the first few return

waxen plinth
#

^

jade perch
somber hull
#
if (item == null) continue;
if (NBTEditor.getBoolean(item, "ischecked")) continue;
waxen plinth
#
if (!condition1) {
  return;
}
if (!condition2) {
  return;
}```
somber hull
#

these?

waxen plinth
#

Instead of nesting if statements

somber hull
#

why?

waxen plinth
#

It keeps your code flat

sage swift
#

better readability

waxen plinth
#

Instead of marching to the right of the screen it stays in one place

#

And it reduces scope changes

somber hull
#

Alright

#

anything else i should look out for

waxen plinth
#

Break it down into more functions

somber hull
sage swift
#

return;

waxen plinth
#

Do it for returns too

#

You can make another method for sending the webhook

#

Also I would be careful with that

#

Looks like you're doing a synchronous web request

somber hull
#

and thats bad why?

waxen plinth
#

It will pause the server until the request completes

somber hull
#

oop-

sage swift
#

also haha discord.setTts

somber hull
waxen plinth
#

The easiest solution is to just spawn a new thread when you want to execute a web hook

jade perch
#

Nice lib for async workflow

waxen plinth
#

The next easiest is to just make a new thread and a queue of web hooks to execute

#

Second one is gonna be much easier on performance since there is overhead to spawning threads

somber hull
#

Well the webhook only gets sent when a player has the specified item

waxen plinth
#

But if you're not gonna be expecting this to be called a ton then the first way would work too

somber hull
#

so it should be pretty rare for it to be ran

waxen plinth
#
new Thread(() -> {
  //Code to be executed async here
}).start();```
somber hull
#

Should i just do that anyway

waxen plinth
#

Probably

#

Web requests can be slow

#

Server's got bad ping to discord? Oops, just froze the whole server for 200ms

somber hull
#
                            new Thread(() -> {
                                  //Code to be executed async here
                                
                            try {
                                webhook.execute();
                            } catch (IOException e) {
                                plugin.getLogger().log(Level.WARNING, "Could not send webhook. Please check your webhook link.");
                            } 
                            }).start();
#

like his?

#

this*

waxen plinth
#

Yeah but indent it properly please

somber hull
#

Idk how

#

to easily do it

waxen plinth
#

Select the code you want to indent

#

Hit tab

#

It will indent the whole section at once

#

Same trick with shift + tab to reduce the indentation level

sage swift
#

you should also do this Runtime.getRuntime().halt(69);

waxen plinth
somber hull
waxen plinth
#

No, in your IDE

#

Discord isn't smart enough to let you block indent like that

somber hull
#

oh, but the indentation is fine right?

eternal oxide
#

Someone needs to slip a cyanide pill into geckos milk.

sage swift
#

what

jade perch
#

Don't understand why you're telling him to spawn a new thread

waxen plinth
#

I mean

jade perch
#

Instead of just using the scheduler

sage swift
#

automod just deleted that i wonder why

waxen plinth
#

Oh true

sage swift
#

hmmmmmmmmmm

#

yep

waxen plinth
#

I forgot about that lol

sage swift
#

lmao

waxen plinth
#

Yeah instead of doing thread.start just do like

jade perch
#

-.-

somber hull
#

b lackspigot

waxen plinth
#
Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, () -> {
  //Code here
});```
#

Is that a banned word or something

somber hull
#

thank you

somber hull
sage swift
#

🅱️lackspigot

waxen plinth
#

Great

somber hull
#

its a website for fake spigopt plugins

unkempt peak
#
damageable.setDamage(damageAmount);
this.setItemMeta(damageable);```
why can't i set the damage of this? i am getting this error:
```The method setItemMeta(ItemMeta) in the type ItemStack is not applicable for the arguments (Damageable)```
waxen plinth
# jade perch -.-

I've barely touched the spigot API in nearly a month cut me some slack

unkempt peak
#

there is no method to get the Damageables meta

waxen plinth
#

You cast to Damageable

jade perch
#

Bukkit.getScheduler().runTaskAsynchronously(plugin, runnable)

waxen plinth
#

Gotta cast back to ItemMeta

somber hull
waxen plinth
#
this.setItemMeta((ItemMeta) damageable)```
somber hull
#

oh wait

#

no

unkempt peak
#

ok thanks

jade perch
somber hull
#

thank you 😄

sage swift
#
while (true) {
  Bukkit.broadcastMessage(" ");
}```
#

but make sure you do it async so it doesnt interrupt the server

waxen plinth
#

dos the players

jade perch
#

Post your memes in general

sage swift
#

these arent my memes

#

you wanna see my memes

jade perch
#

Not really

#

Sorry

somber hull
wispy fossil
#

while (while true())
{

}

somber hull
#

🤯

#
    plugin.getConfig().getConfigurationSection("blocks").getKeys(false).forEach(key ->{
#

how do i get the value of said key

sage swift
#

config.getWhatever("blocks." + key)

somber hull
#

thank you

wispy fossil
#

it worked!

quaint mantle
#

How would I change to clear weather

young knoll
#

?jd

clear iris
#

is there a more effective/efficient way of spawning different types of the same mob instead of using random and a bunch of if statements

eternal oxide
#

types of the same mob?

clear iris
#

yeah so right now I have a random number gen and a bunch of if statements to spawn specific types of the same mob like a fast zombie or a strong zombie, etc

#

but is it possible to do it mroe efficiently

wispy fossil
#

so there is a random number gen

and based on the value it returns, you have a series of if,else statements that execute depending on the value?

clear iris
#
        {
            Skeleton skeleton = (Skeleton) event.getEntity();
            Random r = new Random();
            int min = 0;
            int max = 101;
            int randomSec = r.nextInt(max-min) + min;
            AttributeInstance attackAttribute = skeleton.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
            AttributeInstance healthAttribute = skeleton.getAttribute(Attribute.GENERIC_MAX_HEALTH);
            AttributeInstance followAttribute = skeleton.getAttribute(Attribute.GENERIC_FOLLOW_RANGE);
            if (randomSec >= 0 && randomSec <= 19)
            {
                attackAttribute.setBaseValue(1);
                healthAttribute.setBaseValue(15);
                followAttribute.setBaseValue(50);
                skeleton.setHealth(15);
                skeleton.setCustomName("Weak Skeleton");
                skeleton.getEquipment().setItemInMainHand(new ItemStack(Material.AIR));

            }
            else
            {
                if (randomSec >= 20 && randomSec <= 70)
                {
                    healthAttribute.setBaseValue(25);
                    followAttribute.setBaseValue(50);
                    skeleton.setHealth(25);
                    skeleton.setCustomName("Skeleton");
                    Random random = new Random();
                    ItemStack weapon = new ItemStack(weapons.get(random.nextInt(weapons.size())));
                    skeleton.getEquipment().setItemInMainHand(weapon);
                }
                else
                {
                    healthAttribute.setBaseValue(25);
                    followAttribute.setBaseValue(50);
                    skeleton.setHealth(25);
                    skeleton.setCustomName("Armed Skeleton");
                }
            }

        }```
wispy fossil
#

if there is a limited combination of possible entities (say strong zombie, fast skeleton) I would store them as individual entities in a collection, then use the random method to pick one of those to summon.

if there is an unlimited combination (random combo of potion effects + mobs) then I would store effects and mobs as separate collections, and pick one of each, then apply the selected effect to the selected mob

wispy fossil
# clear iris ```if (event.getEntityType() == EntityType.SKELETON) { Skele...

some things

  1. you have a nested if statement that doesnt need to be nested
  2. Random.nextInt(int a) the int a is the bound, where 0 is the min. So no need for max + min
  3. see above message for optimization. is this code just for the skeleton, or is it for every mob?

if you only need these effects applied for the skeleton, then clean up the nest and it isn't too bad code.
if it's for every mob, then try the solution above

clear iris
#

Alright ty bro

wispy fossil
#

excited to see what you do with it!

#

i always like beefier mobs

clear iris
#

Im trying to make something similar to H3M

#

but with more variety and attacks with the mobs

somber hull
#
                            if(config.getString("punishment").toLowerCase() == "delete" || config.getString("punishment").toLowerCase() == "both") {
                                item.setType(Material.AIR);
                                plr.updateInventory();
                            }
                            if(config.getString("punishment").toLowerCase() == "nothing") {
                                NBTEditor.set(item, true, "ischecked");
                            }
                            if(config.getString("punishment").toLowerCase() == "command" || config.getString("punishment").toLowerCase() == "both") {
                                Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), config.getString("command").toString().replace("%player%", plr.getName()));
                                try {
                                    NBTEditor.set(item, true, "ischecked");
                                } catch(Exception e) {
                                }
                            }
                        }
#

i have both, and it doesnt seem to be working

#

in the config i have punishment set to both

#
# Valid options are delete, command, both, nothing.
# Delete: Deletes the item.
# Command: Runs a command on the player.
# Both: Runs Both.
# Nothing: Does nothing.
punishment: "both"
#

wait

#

leme print that exception

#

hmm no print

#

it shows up correctly on my yaml editor

#

(ignore the fact that it says delete there)

eternal oxide
#

Strings are never compared with ==

split panther
#

^

#

unless you're my professor

somber hull
#

fuck

#

your right

#

sorry

#

equalsIgnoreCase

eternal oxide
#
String s = "test";
if (s == s) would return true
if (s == "test") would return false
if (s.equals("test")) would return true```
clever sequoia
#

you still here

#

i was searching for help in 2020

somber hull
#

lol

clever sequoia
#

xd

#

so i have a question: how can i structure my project?

#

im starting from 0 again

#

i forgot everything lol

sage swift
#

click the x in the top right

#

that should get you started

wraith rapids
#

since test is a compile time constant that'd return true

clever sequoia
#

no not this

#

like

#

to build my plugins

sage swift
#

yes

eternal oxide
clever sequoia
#

ill have to build only 1 jar file that contains all the code (all plugins)

wraith rapids
#

myeah, fair

#

what

clever sequoia
#

or ill have to build 1 jar file for each plugin

#

like a ban plguin

wraith rapids
#

one jar per plugin

clever sequoia
#

wow

#

lot of jar files

#

but i got it

#

thx

eternal oxide
#

Depending on design you should really use one Plugin per purpose.

clever sequoia
#

ok

sage swift
#

no you should definitely just modify essentials to your liking

eternal oxide
#

ie, one plugin for all chat related features.

wraith rapids
#

here comes the craftbook crew to give a lecture on how monoplugins are better

sage swift
#

what even is craftbook

wraith rapids
#

an ancient megaplugin that does 4000 million things

somber hull
#

so i might be dumb

#
    item = NBTEditor.set(item, true, "ischecked");
#

Local variable item defined in an enclosing scope must be final or effectively final

sage swift
#

rip

somber hull
#

but idk how to fix this

wraith rapids
#

make it final

#

or effectively final

somber hull
#

wouldnt that mean i cant change it?

wraith rapids
#

or don't use a lambda/local class

drowsy helm
#

whats the context

sage swift
#

no context thats the whole plugin

drowsy helm
#

helps to see the rest of the class

eternal oxide
#

you can change its contents, but not reassign it if final

somber hull
#

its messy

#

please dont yell at me

edgy igloo
#

When someone buys a vip on a Minecraft server, I want them to give an automatic discord role thanks to the automatic discord server plugin, how can I do that.

eternal oxide
drowsy helm
#

youll need a discord bot for that

sage swift
#

but he's developing a minecraft server bro

somber hull
#

lol

wraith rapids
#

use some paste site

clear iris
#

hey @wispy fossil how would I go about with storing the custom mobs in the collection?

eternal oxide
#

I'll punch you gecko 🙂

somber hull
#

?paste

queen dragonBOT
somber hull
sage swift
#

dont setType air on an item

somber hull
#

why

sage swift
#

set it to null

#

because checking for null AND getType AIR is annoying

edgy igloo
somber hull
#

then i run into the same error with the final thing

wraith rapids
#

don't swallow Exception

somber hull
#

what?

#

where?

wraith rapids
#

use switch instead of a million if elses

somber hull
#

i said its messy

#

i just need to figure out how to change the item while in the expression

wraith rapids
#

don't swallow IOException either

somber hull
wraith rapids
#

you do

somber hull
#

It tells you smthng is wrong

wraith rapids
#

you're not printing the stack trace

somber hull
#

Yea, if somethinggoes wrong there its because of user error in the config

wraith rapids
#

it is impossible for anyone to tell why the exception was thrown

#

IOException and Exception can be thrown for nearly any reason

#

print the stack trace after or in the message

somber hull
#

ok

#

but how do i make NBTEditor.set(item, true, "ischecked"); be
item = NBTEditor.set(item, true, "ischecked");

wraith rapids
#

for the finl shit, don't use forEach but rather use a for loop

#

makes life easier

wispy fossil
# clear iris hey <@!603793855980109834> how would I go about with storing the custom mobs in ...

In this case let's use an ArrayList
You have some entities right? With some attributes? (Sorry I don't have much experience withAttributeInstance class)

You would define an ArrayList where the <Type Paramter> would be <Skeleton>

Each item in the list would be one of the combinations of skeletons (or other mobs) that you have.

So for example, one item in the ArrayList would be the skeleton with low health, high damage - and another item would be the skeleton with medium health and medium damage, etc.

Then, you would select a random item from the arraylist.
This can be done using something like:
Skeleton theSkeletonToChoose = YourList.get(r.nextInt(YourList.size())
(i dont know if thats exactly right it's 2 am and im pulling that from my head)

This would allow you to:

  1. Customize each possible combination in an easy to access list
  2. Group everything in one object to get around some coding traps

BUT! I see you have different rarities for each type of skeleton.
One way to do this would be to have multiple ArrayList for each rarity of skeleton, and select which arraylist to choose from (An ArrayList of ArrayLists? 😮).

Or, store each type of Skeleton in a HashMap<a,b> and have a be the skeleton object with all of its attributes, and b be the rarity between 1 and 10.

Then, you can do a random roll between 1-10 for each skeleton, and if the random roll value is greater than or equal to the skeleton's rarity, then you pick that skeleton. If not, you try and select another one until one is matching. That's how I would do it.

But of course, all of this is overkill if you only have 3 skeleton types. There's no problem using a few if,else statements if there is only 3 or 4. If there are many more, then one of these is viable.

sage swift
#

holy moly

wispy fossil
#

wow thats alot

sage swift
#

thats a lotta text

wispy fossil
#

im tired

#

i dont know if any of it is right

somber hull
#

wow

wispy fossil
#

thats a wiki article

#

isnt it

clever sequoia
#

how can i have a package inside another package

#

bcz when i try to move my package

#

inside another package

clear iris
#

Alright alright thank you, this is very helpful

wispy fossil
#

i probably worded it very poorly

#

lmk

clever sequoia
#

it renames the main package lol

wispy fossil
#

intellij 😎

clever sequoia
#

ye im using this ID

#

IDE*

#

so how can i do it:

wispy fossil
#

i have no idea i use eclipse

clever sequoia
#

vc eh do brasil>:

wispy fossil
#

i barely know how to work around the bugs of eclipse, let alone intellij

clever sequoia
#

your brazilian?

wispy fossil
#

nope i gotta get my name changed 🤣

clever sequoia
#

lol

wispy fossil
#

im gonna go donate $10 now

somber hull
#

how would i get the slot an item is in?

wraith rapids
#

an item may be in multiple slots at once

somber hull
#

im already in a loop, of every item in the players inventory

somber hull
wraith rapids
#

two identical items are for all intents and purposes the same item

somber hull
#

well

#

no

wraith rapids
#

get the contents as an array and iterate over its indices, rather than its elements

somber hull
#

since im applying an NBT tag

#

for (ItemStack item : event.getClickedInventory().getContents()) {

wraith rapids
#

yes but two identical items are for all intents and purposes the same item

somber hull
#

how do i get what slot im on

wraith rapids
#

yes, that is you iterating the elements

#

you can't, that way

#

you need to iterate over the indices

#

ItemStack[] contents = getContents()

#

for int i = 0;i < contents.length;i++

eternal oxide
#

iterate the array and set the contents back to the inventory when done.

wraith rapids
#

alternatively, you may search the inventory for a matching item each time but that is retarded

somber hull
#

im just replacing one item

#

with the same item

#

but this time with NBT

#

aight fuck it, it doesnt matter. Im just gonna slap it into the players inventory

#

doesnt matter the slot

eternal oxide
#

then Inventory#first(Material/ItemStack)

#

that will give you a slot

wraith rapids
#

but again that is retarded

somber hull
#

but im lazy

wraith rapids
#

i wish there was a flag or something to disable the 'effectively final' shit for lambdas and local classes

somber hull
#

this means the inv is full right?

#

plr.getInventory().firstEmpty() != -1

wraith rapids
#

literally just change the for loop to the one i gave and you have the index always

drowsy helm
#

yep

somber hull
#

how do i drop an item on the players location?

#

i know theres a dropitemnatuallr

eternal oxide
#

?jd

somber hull
#

thanks

wraith rapids
#

also just use the inventory addItem method

#

it'll do all of the space checking and slot finding for you and will return you the itemstacks it couldn't fit in

#

which you can then drop or whatever

somber hull
#

ok

sage swift
#

is there a more specific event than BlockDispenseEvent for when a shulker box is placed from a dispenser?

#

please tell me there is, please tell me there is, plea

wraith rapids
#

um

sullen marlin
#

yes there is

#

oh more specific

#

what more specific do you need

sage swift
#

i mean i guess i can get the adjacent block a tick after

#

just need to get the block that was placed

wooden warren
#

how do i make a 2 set bonus ability

sage swift
#

huh

sullen marlin
#

DispenseBehaviorShulkerBox is where to look if you have ideas of what to add

rotund pond
#

?paste

queen dragonBOT
wooden warren
#

how to check if the player has a chestplate

sullen marlin
#

getInventory().getChestplate or something

#

I'm sure you can figure it out

tardy delta
#

does someone has an idea how to add items to inventory?

storm oasis
#

inv.additem(); or player.getinventory().additem(ITEM);

clear iris
#

is there a way to have any entity in super ocnstructer

#

instead of 1 set entity

wraith rapids
#

what

severe folio
#

If you mean every material, there's a method that contains all enum values. Material.values()

wraith rapids
#

just remember to cache it

#

because processing and formatting it each time is going to be expensive

#

there are like a billion materials

severe folio
#

^

wraith rapids
#

and the event is fired every time the player writes a new character in the textbox

severe folio
#

I'd do a bit of filtering to remove the LEGACY_ materials but

wraith rapids
#

there's also a bunch of other materials that you should never have as items

#

like wall banners and wall signs

#

piston heads and shit

severe folio
#

I think there's a Material#isItem

clear iris
#

when you use EntityCreature, EntityAnimal, EntityMonster, etc it requires the super() and you have to specify which entity, is there a way to set the EntityTypes to a variable or something like that?

#

like I want the specific function to be able to change entities so im not making duplicates of the same function/class to change the entity

#

idk if this makes sense

clever sequoia
#

hey guys

#

i want to register that event here

ivory sleet
#

What’s the name of the class containing the method onBlockBreak?

clever sequoia
ivory sleet
#

then pass new RankEvents(), this

severe folio
#

Implement the listener interface

ivory sleet
#

That also lol

clever sequoia
ivory sleet
#

Yeah but look what Konjiki said

wraith rapids
#

the registerEvents method takes an object that implements Listener, looks through the methods its classes declare, and hooks every method annotated with @EventHandler into the event bus

#

therefore your RankEvents class should implement Listener, and you need to instantiate that class to create an object which you can then pass to the method

clever sequoia
#

oh ok

#

thanks @wraith rapids

clear iris
#

Random include 0 correct?

dense kestrel
#

yes

wraith rapids
#

the default minimum range of 0 is inclusive, yes

wooden warren
#

is there a reson why:

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerToggleSneakEvent;

public class cTable implements Listener {

    @EventHandler
    public void cTable(PlayerToggleSneakEvent event) {

        //try {
        Player player = event.getPlayer();
            if (player.isSneaking()) {
                String name1 = player.getInventory().getHelmet().getItemMeta().getDisplayName();
                String name2 = player.getInventory().getChestplate().getItemMeta().getDisplayName();
                String name3 = player.getInventory().getLeggings().getItemMeta().getDisplayName();
                String name4 = player.getInventory().getBoots().getItemMeta().getDisplayName();
                if (name1.contains("CraftingTable Helmet") && name2.contains("CraftingTable Chestplate") && name3.contains("CraftingTable Leggings") && name4.contains("CraftingTable Boots")) {
                    System.out.println("ERROR2.EXE");
                    player.openWorkbench(player.getLocation(), true);
                    System.out.println("ERROR.EXE");
                }
            }
        //} catch (Exception e1) { }
    }
}``` wont work
solemn shoal
#

okay so, say i have a BufferedReader

#

how can i get a String[] out of it?

#

this throws an ArrayStoreException because it fails to cast Object[] to string?

#

guess imma stick to while loops

tulip lodge
#

hi all

#

you can help?

#

pls download to see all logs

#

?paste

queen dragonBOT
tulip lodge
#

pls help i need

#

plsssssssssssssssssssssssssssssssssssss

eternal oxide
#

what error? as you havnt; asked an actual question

tulip lodge
#

i can't run command

eternal oxide
#

have you registered the command?

tulip lodge
#

yes

eternal oxide
#

CommandException: Cannot execute command 'kit' in plugin MyItemBuilder v1.0 - plugin is disabled.

tulip lodge
#

wait

#

to check

#

my plugin is mykit

#

i was delete the myitembuilder in folder plugin

#

wait for restart the server

#

?paste

queen dragonBOT
eternal oxide
#

the kit command will not run because its registered with MyItemBuilder which is disabled

tulip lodge
#

ok

#

i was delete the myitembuilder

tardy delta
#

Is there a way I can send a message to console when my plugin is loaded?

eternal oxide
#

Kit.java:27

tardy delta
#

?

eternal oxide
#

something is null, probably the command isn't in your plugin.yml

tulip lodge
#

String displayName = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Starter.Item-1.Display-Name")); = 27

eternal oxide
#

then probably plugin is null

tulip lodge
#

how to a set unnull?

#

😐

wraith rapids
#

lol

tulip lodge
#

this is a it tutorial with config

eternal oxide
tulip lodge
wraith rapids
#

try learning java first

tulip lodge
#

i was try 1 years

wraith rapids
#

lol

dense kestrel
#

wdym

wraith rapids
#

you have been trying to learn java for 1 year, but you don't know what null means

#

very impressive

tardy delta
#

and can I set the "prefix" of my plugin in the console, for example [TestPlugin] ?

dense kestrel
#

If you dont know what null is after 1 year, you may want to choose another hobby. No offense

eternal oxide
tulip lodge
#

@wraith rapids

wraith rapids
#

@tulip lodge

opal juniper
#

Is there a way of making falling blocks not turn to a solid block immediately on landing?

tulip lodge
#

you have been trying to learn java for 1 year, but you don't know what null means
very impressive

#

؟

wraith rapids
#

listen to the appropriate event and cancel it

#

i don't remember what the event is

#

blockformevent maybe

opal juniper
#

EntityChangeBlockEvent

wraith rapids
#

yeah sounds about right

opal juniper
#

but that just removes the block outright

dense kestrel
#

oh shit, really?

wraith rapids
#

mmmm i don't think there is a good way of going about that

opal juniper
#

i would like it to remain on the ground for a bit

#

hm

wraith rapids
#

the server will try to form it into a block every tick it's there

dense kestrel
#

maybe if you continually spawn a new one or something

wraith rapids
#

protocol fucknuggetry might suit you better

tulip lodge
#

But I do not know how to fix it

wraith rapids
#

you learn java

opal juniper
dense kestrel
tulip lodge
#

fix the null plugin

tardy delta
wraith rapids
#

maybe in 1 more year you'll know how to make things not null

#

or know what null is to begin with

tulip lodge
#

ok

tardy delta
#

lol

tulip lodge
#

thanks for nothing Help XD

wraith rapids
#

you're welcome

dense kestrel
#

You cant ask for help if you wouldnt even understand what we tell you....

eternal oxide
tardy delta
#

owh

opal juniper
wraith rapids
#

maybe just place them down

eternal oxide
# tardy delta owh

Create a class LogHandler extends ConsoleHandler and @override the publish method.

dense kestrel
wraith rapids
#

spawning a new entity will create flicker most likely

dense kestrel
#

Probably #2 then

eternal oxide
#
Logger logger = this.getLogger();
logger.setUseParentHandlers(false);
logger.addHandler(new LogHandler);```
opal juniper
#

also, what entity would you spawn there?

wraith rapids
#

iirc the block doesn't need to be squarely on the floor to form a block either

#

it just needs to be in the general vicinity of the floor or something

opal juniper
#

yeah

dense kestrel
#

oh

wraith rapids
#

so they'd need to float like half a block midair

#

only solution i see is through protocol fucknuggetry

#

drop the outgoing entity destroy packet after cancelling the event and the entity will stick around

#

then resend it later to destroy it for realsies

#

or just leave it there forever

#

realistic debris

opal juniper
#

could work

dense kestrel
#

@wraith rapids This is completely unrelated, but whats up with that username XD

wraith rapids
#

alternatively just let the block be placed down

#

it's from a random string generator

dense kestrel
#

ahh lol

opal juniper
#

mf was like why can't i use protocollib. dumbass hadn't imported it

dense kestrel
#

smh

plain quest
#

what is the minimum possible pitch and yaw for a player?

#

are they 360

#

?

hollow canopy
#

guys I made a scythe ability that can only works on items which have "Tırpan" lore but there is a error this is the code.

eternal oxide
hollow canopy
#

how can I fix this? I put a break to end of the code line but it didnt stop

plain quest
eternal oxide
eternal oxide
#

Yaw is 360

plain quest
#

0?

eternal oxide
#

    A yaw of 0 or 360 represents the positive z direction.
    A yaw of 180 represents the negative z direction.
    A yaw of 90 represents the negative x direction.
    A yaw of 270 represents the positive x direction. 

Increasing yaw values are the equivalent of turning to your right-facing, increasing the scale of the next respective axis, and decreasing the scale of the previous axis.```
#

this is all in teh javadocs

#

?jd

plain quest
#

👍

hollow canopy
#

@eternal oxide amount = event.getFinalDamage(); lastDamage = amount; like this?

eternal oxide
#

so you are not doubling up damage on the target

hollow canopy
#

okey thanks I will try

tardy delta
#

how can i fix this?

This is the constructor of EventListener (2nd)

severe folio
#

Put this in the brackets

eternal oxide
wraith rapids
#

you are trying to call a constructor that wants a parameter without giving it any parameters

tardy delta
eternal oxide
#

then this

severe folio
#

Also aren't you registering the events twice there

wraith rapids
#

yes he is

opal juniper
#

Ok, i have these entities that are not getting destroyed:

    @Override
    public void onPacketSending(final PacketEvent event) {
        Player player = event.getPlayer();

        PacketContainer packetContainer = event.getPacket();
        int id = packetContainer.getIntegerArrays().read(0)[0];

        if(this.plugin.newBlocks.containsKey(id)) event.setCancelled(true);
        
    }

however they should not be in the hashmap to be cancelled

tardy delta
#

I have two classes for eventhandlers how do i register them both then?

wraith rapids
#

normally

eternal oxide
wraith rapids
#

right now you are registering the same event listener twice

#

once in the constructor

#

and a second time in the main class

tardy delta
#

oh think i fixed it

#

wait so can i remove the constructor?

#

it gives no errors when i do

hollow canopy
#

@eternal oxide

#

its not worked

#

double amount = evt.getFinalDamage();

#

I add this

#

if (amount > 2) return;

#

and this

#

whats wrong

eternal oxide
#

why are you returning?

wraith rapids
#

return monke;

hollow canopy
#

because I want to deal the damage only 1 time

eternal oxide
#

Get rid of your return

#

add event.setDamage(0);

#

then you apply the amount as damage in your loop

hollow canopy
#

if (amount > 2) {
evt.setDamage(0);
}

#

like this?

eternal oxide
#

no

#

stop testing amount. it doesn;t matter

#

just evt.setDamage(0)

hollow canopy
#

but we didnt use getFinalDamage

eternal oxide
#

show your damage line

#

yes you did, above

eternal oxide
hollow canopy
#

double amount = evt.getFinalDamage(); I wroted it but we didnt use amount

quaint mantle
#

Hello spigot ! is there any Furniture tutorials?

eternal oxide
#
double amount = evt.getFinalDamage();
evt.setDamage(0);```
quaint mantle
#

Source code is hard

wraith rapids
#

just spawn some armor stands

eternal oxide
#

Then in your loop where you apply damage to the entity you apply amount

hollow canopy
#

ohh

#

okey

#

I got it now

#

@eternal oxide

#

it wont oneshot now

#

but still damage so much

#

when I hit a error occurs in the console

#

line 46

eternal oxide
#

too small text, can;t read

onyx shale
#

com.destroystokyo.paper

eternal oxide
#

lol, another screenshot

#

?paste

dusty herald
#

?paste

queen dragonBOT
tardy delta
#

should this work?

package io.github.FourteenBrush.MagmaBuildNetwork;

import org.bukkit.ChatColor;
import org.bukkit.event.Listener;

import java.util.logging.ConsoleHandler;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

public class LogHandler extends ConsoleHandler implements Listener {

    @Override
    public void publish(LogRecord logRecord) {
        Logger log = Logger.getLogger("Minecraft");
        log.setUseParentHandlers(false);
        log.info(ChatColor.translateAlternateColorCodes('&', "[&cMagmaBuildNetwork&r] &2[INFO]: Loading MagmaBuildNetwork"));
        log.info(ChatColor.translateAlternateColorCodes('&', "[&cMagmaBuildNetwork&r] &2[INFO]: Done!"));
    }
}
#

the last method

hollow canopy
dusty herald
chrome beacon
hollow canopy
hollow canopy
dusty herald
#

but Spigot already handles plugin enabling and disabling messages

#

it's useless expecially when Done! means nothing in this case

wraith rapids
#

no, just use Bukkit.getConsoleSender().sendMessage()
no

hollow canopy
#

((LivingEntity) entity).damage(amount, player);

wraith rapids
#

do not send messages to the console

hollow canopy
#

this is the line 46

wraith rapids
#

use the logger

dusty herald
#

if they want colors they have to

wraith rapids
#

they don't have to

#

the console processor supports colors

#

the way how the message ends up in the console is irrelevant

chrome beacon
wraith rapids
#

use your plugin's logger; that is the dedicated logger for your plugin and everything you print should go through it

wraith rapids
#

not doing so will make it impossible to configure/filter your plugin's messages properly by the end user

eternal oxide
#

that way you can add yoru color to your prefix

wraith rapids
#

isn't there like a prefix value in plugin.yml or something anyway

eternal oxide
tardy delta
dusty herald
#

that's not a listener class so no

tardy delta
#

well maybe i registred LogHandler wrong..

eternal oxide
tardy delta
#

yea

#

i have a problem in the main class now

eternal oxide
tardy delta
#

after i removed the implements

dusty herald
#

because you're trying to register an event?

wraith rapids
#

why are you trying to register your log handler as a fucking listener lmao

dusk flicker
#

This is a new level

dusty herald
#

rack no

wraith rapids
#

rack yes

eternal oxide
#
if (entity instanceof Damageable) {
    ((Damageable) entity).damage(amount, player);```
dusk flicker
#

:p

eternal oxide
tardy delta
#

inside the onEnable?

#

trying it atm

hollow canopy
#

@eternal oxide should I change all the (livingentity) to Damageable?

eternal oxide
#

only where you are applying damage

hollow canopy
#

but now there is no damage

eternal oxide
#

then you did something wrong

hollow canopy
#

I am so confused

eternal oxide
#

probably imported the wrong damageable

hollow canopy
#

import org.bukkit.entity.Damageable;

eternal oxide
#

thats correct

#

?paste your listener

queen dragonBOT
hollow canopy
eternal oxide
#

looks fine, except move evt.setDamage(0); outside your loop

opal juniper
#

I keep getting this error:
java-util-concurrentmodificationexception
with this code i believe:

                for(Map.Entry<Integer,Integer> entry : plugin.blocks.entrySet()){
                    int id = entry.getKey();
                    int timeLeft = entry.getValue();

                    if(timeLeft > 0) {
                        timeLeft = timeLeft - 1;
                        plugin.blocks.put(id,timeLeft);
wraith rapids
#

you are modifying the map while iterating over it

opal juniper
#

i know it is the plugin.blocks.put(id,timeLeft); but i do not know what to replace it with

#

yeah

wraith rapids
#

which is concurrent reading and modification

#

use the iterator

tardy delta
#

@eternal oxidewhat is this doing?

if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) {
            System.err.println(message);
        } else {
            System.out.println(message);
        }
wraith rapids
#

use the entryset's iterator instead of a regular for loop

eternal oxide
wraith rapids
#

or actually

opal juniper
wraith rapids
#

just call entry.setValue

#

instead of put

opal juniper
#

yeah ok thanks

eternal oxide
hollow canopy
#

knockback works but damage is kinda weird

eternal oxide
#

It should now be applying the exact damage you would normally do to one entity to all of them in range

stiff topaz
#

Im getting this error and I cannot fix it
https://pastebin.com/YuUt2Cjb
Main File: https://pastebin.com/jxfseUwA

wraith rapids
#

you are trying to instantiate your main class

#

at BlockBreak.java:17

#

don't do it

hollow canopy
#

now my weapon damage is gone without aoe is gone because we used evt.setDamage(0);

eternal oxide
wraith rapids
#

you can not instantiate your main class, you can not call its constructors

#

there must only ever be one instance of it

hollow canopy
#

I tried

wraith rapids
#

and that instance is created by bukkit

eternal oxide
hollow canopy
#

okey lemme try

tardy delta
#

I have this but the color codes on the console does not work

@Override
    public void publish(LogRecord record) {
        String message = ChatColor.translateAlternateColorCodes('&', "[&cMagmaBuildNetwork&r] &2[INFO]: Loading MagmaBuildNetwork");
        if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) {
            System.err.println(message);
        } else {
            System.out.println(message);
        }
    }
hollow canopy
#

still same @eternal oxide

#

no damage

#

also it looks like a combo

eternal oxide
#

both entities showed a hit damage animation

tardy delta
eternal oxide
#

so you must be doing very minimal damage with whatever weapon you are using

hollow canopy
#

My problem is damage so much

#

like nohitdelay

eternal oxide
#

I've no idea what you are saying

hollow canopy
#

did you see the video

wraith rapids
#

vidya

eternal oxide
#

I did

hollow canopy
wraith rapids
#

unintelligible

hollow canopy
#

Did you hear the hit sound

eternal oxide
#

as you set damage to zero you are going to have to play the hit sound yoruself