#help-development

1 messages · Page 1643 of 1

native nexus
#

Going to use this for all me exceptions from now on

torn shuttle
#

pull a Myth II and uninstall your OS when you uninstall a plugin

#

I wish myth 2 got a remaster

native nexus
#

Where can I see the source again for spigot?

#

nvm I am stupid

quaint mantle
#

Bukkit.shutdown();

sacred ice
#

Hi, invisibles ItemFrames were introduced with 1.16, there is a built in method with the API to set an ItemFrame has invisible?

lost matrix
sacred ice
#

okay thx

torn shuttle
#

wait what there's a setArrowsInBody?

lost matrix
torn shuttle
#

infamously v1.0 was bugged

#

where if you uninstalled it it uninstalled the entire directory it was in

lost matrix
#

Aaah i fondly remember seeing something about that

torn shuttle
#

meaning if you installed it on root it would wipe your hard drive

#

good game

lost matrix
#

XD

torn shuttle
#

only rts I've ever played where you'd leave your best units way, way back and out of the combat for as long as possible because most of the time they would kill your own dudes

quaint mantle
#

public static boolean canFit(Inventory inventory, ItemStack itemStack) {
int amountToAdd = itemStack.getAmount();
int spaceForItem = 0;
int maxStackSize = itemStack.getType().getMaxStackSize();

    for (ItemStack slotItem : inventory) {
        
        if(itemStack == null || itemStack.getType() == Material.AIR);
        
      
    }

    return false;
lost matrix
torn shuttle
#

actually the fact artillery was best at killing your own units made that game more like a warhammer 40k rts than any warhammer 40k rts that has ever come out

undone axleBOT
torn shuttle
#

ok I think I'm giving up on boss bars

#

anyone happen to know if there is a way to cancel the creation of portals using the spigot api?

#

when you kill the dragon that is

lost matrix
torn shuttle
#

there's a generate portal but there doesn't seem to be a "don't" generate portal

quaint mantle
#

return itemStack == null || itemStack.getType() == Material.AIR;?

torn shuttle
torn shuttle
#

fantastic

lost matrix
#

I once almost gave up on all my public plugins because of such a review

ivory sleet
#

Cant you report them or something if it’s untrue

torn shuttle
#

I think the only negative review I ever got is because I was sleeping when a dude asked for support, he couldn't even wait for a couple of hours before he posted a 1 star review saying I only did support for people who gave me money

#

just 10/10

tight sluice
# torn shuttle ok I think I'm giving up on boss bars
        ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this,PacketType.Play.Server.BOSS) {
            @Override
            public void onPacketSending(PacketEvent event) {
                event.setCancelled(true);
            }
        });

This may or may not work for removing any boss bar
note that this will prevent any boss bar from being sent so you may need to tinker with this a bit if you have other bossbars

torn shuttle
#

yeah the thing is that I very specifically want to remove the boss bar from a dragon

#

I think I have a solution though, thanks for the help

reef wind
torn shuttle
#

better review moderation would go a long way in making devs not ragequit, I keep seeing that happen over bunk reviews

lost matrix
#

I actually made a PR for that. Block should have the method isPreferredTool(ItemStack)

quaint mantle
#

1.17 or 1.16-?

#

@lost matrix

#

1.17 has a few tags for that

#

Ah then, idk

#

I myself use large lookup enumsets - but that is not what you want

lost matrix
#

What spigot version do you use?

reef wind
#

did you use it on the block or material?

reef wind
lost matrix
#

F then

#

write a GIGANTIC switch case for every tool 😄

reef wind
#

@quaint mantle can’t you update version?

lost matrix
#

In a plugin from the past i just made a config and let the user add all the Materials he wants. Then put them in an EnumSet and check contains on it.

reef wind
#

wait can you or not?

#

why? maybe there work a workaround for why you need 1.15.

lost matrix
#

Then you are the user that can have fun adding all the entries to your List 😄

#

If you want to use 1.15 and dont plan on updating then you can use NMS for that.

reef wind
#

I mean you can import all tools automatically but you have to write the code for every case

#

what is the reason you need 1.15?

dire marsh
reef wind
#

it’s forwards compatible

dire marsh
#

what version was your pr added for

lost matrix
#

1.16

#

Wait. Let me check

#

Should be 1.16

quaint mantle
#

@lost matrix

#

public static boolean canFit(Inventory inventory, ItemStack itemStack) {
int amountToAdd = itemStack.getAmount();
int spaceForItem = 0;
int maxStackSize = itemStack.getType().getMaxStackSize();

    for (ItemStack slotItem : inventory) {

        return itemStack == null || itemStack.getType() == Material.AIR;

        
        }
    return false;
}

}

lost matrix
# quaint mantle public static boolean canFit(Inventory inventory, ItemStack itemStack) { ...

Here again. Step by step explanation:

While iterating over all slots:
Check if the slotItem is null or air. If it is then add the maxStackSize to the spaceForItem variable.
If the slotItem is not null: Check if slotItem is similar to itemStack. If it is similar to itemStack then add the (maxStackSize - slotItem.getAmount()) to spaceForItem.
After you checked all slots:
If the spaceForItem is bigger than amountToAdd you return true. Return false otherwise.

quaint mantle
#

I didn't understand

#

2

#

and 1

lost matrix
#

ItemStack has a method called isSimilar(ItemStack) which returns true if two ItemStacks are similar and can be stacked.

quaint mantle
#

You can do it like the JavaDocs are saying it:

Check for the firstEmptySlot. If it returns -1 the inventory is full.

#
if (inv.firstEmpty == -1) // full inv
lost matrix
quaint mantle
#

br

lost matrix
#

You got 5 Apples and want to add 3 more -> no slot is empty but you could still add the apples

quaint mantle
#
int slot = p.getInventory().firstEmpty();

if (slot == -1) return;
#

Wouldn't that suit him?

#

he does not need to add a new item

#

But if you have 5 apples and want to add 3 more, they should add

lost matrix
quaint mantle
#

why 20

#

I need if there is no space in the inventory, do not perform

lost matrix
#

Ugh. It can fit 252 more apples -.-

quaint mantle
#

but if there is a similar item that I want to give, perform

quaint mantle
quartz valley
#

Hi. I've got a question
You know the "⚙️ preparing" sign that appears as the player count when an aternos server is starting up
Is it possible to add that to an apex-hosted or localhosted server?

lost matrix
#

You can write whatever you want here

quartz valley
#

do you know if there's any plugin that can do that?

lost matrix
rigid otter
#

I have a problem while removing item from chest, it doesn't work.

Chest chest = (Chest) block.getState();
chest.getBlockInventory().remove(SOME_ITEM);
chest.update();

Is it wrong?

brittle nova
#

when I change the facing of a block the block drops itselfs. So when I change the facing of a powered piston the piston drops. Can I disable that?

lost matrix
lost matrix
quartz valley
brittle nova
rigid otter
#

I want to reduce item, and it not remove

quaint mantle
dire marsh
#

might need to use snapshot inventory

rigid otter
#

Opp

lost matrix
rigid otter
#

Why yields the result? It should remove from the chest instead of giving me

#

.setItem() also doesn't work

lost matrix
rigid otter
#

So, what?

lost matrix
#

What do you mean So, what?. If you change Inventory A and then look at Inventory B you wont see the changes you made to Inventory A for obvious reasons.

rigid otter
#

What to do then? If my above code isn't working, can you give me a working one?

#

I think this is enough to work

Chest chest = (Chest) block.getState();
chest.getBlockInventory().setItem(0, SOME_ITEM);
chest.update();```
quaint mantle
#

@lost matrix

#

how to do it?

fluid cypress
#

doing this Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {}) will use a different thread, right? and the thread is "random", its not just 1 parallel thread, right?

#

but, whats the best way of doing something in a different thread, to avoid blocking the main thread, but always use the same thread?

hybrid spoke
fluid cypress
#

specifically sql queries, but sqlite only allows 1 connection at a time, so, using the bukkit scheduler, it throws an sql error sometimes

hybrid spoke
fluid cypress
#

by "the same thread" i dont mean the main thread, i mean doing all the connections with the same thread, but it doesnt have to be the main thread

#

i mean using a different thread, but always the same thread, not just any available thread at the time

vague oracle
#

This is what you need if you want to see if an inventory can hold something you are trying to add.

vague oracle
#

add the max size of the itemstack then

#

to the space value

#

I don't think so but you can use Block.isPrefferedTool() if you have a list of tools

#

oh is that new new

#

😦

#

ngl i skipped from 1.8 to 1.16

#

and my god

#

my life got 10x easier

#

the only reason why people should stay on 1.8 is for pvp

#

and I think its because people are lazy to learn the new type of pvp they stick to 1.8

brittle nova
# lost matrix Try to unpopwer the piston before updating the block state

This is my code:
int x = Integer.parseInt(s[1]),y = Integer.parseInt(s[2]),z = Integer.parseInt(s[3]);
Material mat = Material.valueOf(s[4]);
Block b = world.getBlockAt(x,y,z);
b.setType(mat);
BlockData blockData = b.getBlockData();
try {
if(blockData instanceof Directional) {
BlockFace blockFace = BlockFace.valueOf(s[5]);
((Directional)blockData).setFacing(blockFace);
}
}finally {
b.setBlockData(blockData);
}

#

The piston drops but I don't want that

quaint mantle
#

@lost matrix

#

public static boolean canFit(Inventory inventory, ItemStack itemStack) {
int amountToAdd = itemStack.getAmount();
int spaceForItem = 0;
int maxStackSize = itemStack.getType().getMaxStackSize();

    for (ItemStack slotItem : inventory) {

        if(itemStack == null || itemStack.getType() == Material.AIR) {
             spaceForItem = maxStackSize;
        
        if(slotItem == ) {
            
        
        
        
            }
        }      
    }
    return false;
}

}

#

I do not know how to proceed

hardy swan
#

Are there any ways to apply potion effect on an abstract player

tame coral
#
HashMap<Integer, ItemStack> map = event.getWhoClicked().getInventory().addItem(new ItemStack(Objects.requireNonNull(event.getCurrentItem()).getType()));
                if (map.isEmpty()) {
                    event.getWhoClicked().sendMessage("You bought a " + event.getCurrentItem().getType() + " for " + buyprice + " coins");
                }
                else {
                    event.getWhoClicked().sendMessage("You don't have enough space in your inventory !");
                }
#

For example

quaint mantle
#

@tame coral

tame coral
#

Ye ?

quaint mantle
#

you russian?

tame coral
#

Nah, why ?

quaint mantle
#

how do I check if there is free space in the inventory?

tame coral
quaint mantle
#

I need to issue an item to the inventory. how to make an item be issued to the inventory, if the same item is in the inventory

restive tangle
#

do you mean player.getInventory().addItem?

tame coral
quaint mantle
#

I need to issue an item to the inventory. how to make an item be issued to the inventory and if the same item is in the inventory issue it. if there is no place in the inventory and there is no similar item, do nothing

tame coral
#

You want to add an item in the inventory ?

summer scroll
quaint mantle
#

Where?

quaint mantle
#

Oh, thank you, I'll try

vague oracle
#

Just need to add a else if statement where if the item in the loop is air or null add 64 to space

tame coral
#

That's

#

Not an optimal solution

vague oracle
#

How

brittle nova
#

How can I get all the specific data of an entity like name, inventory, color, ...?

tame coral
#

There's literally a method in order to add an Item and handle the ones that couldn't be added ??

vague oracle
#

That’s not what he wants

#

Lol

brittle nova
tame coral
#

Are you using an IDE ?

vague oracle
#

Entity needs to implement InventoryHolder

tame coral
#

because that's where autocompletion is very useful

tame coral
#

I don't get what you mean by color though

austere cove
#

how can I make a number format configurable?

brittle nova
tame coral
#

Oh

#

You first need to check if the entity is a sheep

#

Or if it's an instance of Colorable

#

in that case you can type cast it and use getColor()

fluid goblet
#

can some1 test my plugin

tame coral
#

Can't you just test it yourself

fluid goblet
#

my cumputer is bad so nah

tame coral
#

bruh

fluid goblet
#

and i want another persons pov

vivid temple
#

is this a correct if statement to check if someone is in a world?

if (player.getWorld() == Bukkit.getWorld("survival"))
summer scroll
lost matrix
vivid temple
#

okay

vivid temple
brittle nova
tame coral
#

There is no such thing as a method that return all of an entity's data

summer scroll
tame coral
#

^

brittle nova
#

ok. thanks

cunning ermine
#

is there a tutorial for setting up a debug for intelij and gradle

#

currently the ones in spigot are different

tame coral
tardy delta
#

does this work to remove the provided itemstack from the inv?

private void sell(boolean sell, int amount, Material material) {
        if (sell) {
            ItemStack item = new ItemStack(material, amount);
            if (player.getInventory().containsAtLeast(item, amount)) {
                player.getInventory().removeItem(item);
            }
        }
    }
cunning ermine
#

that tutorial doesnt support build systems I think

tame coral
#

Eeeeeh i dunno

#

Did you try it ?

tame coral
#

But i believe doing like so is better

cunning ermine
tame coral
# tame coral But i believe doing like so is better
            HashMap<Integer, ItemStack> map = event.getWhoClicked().getInventory().removeItem(new ItemStack(event.getCurrentItem().getType()));
            if (map.isEmpty()) {
                event.getWhoClicked().sendMessage("You sold a " + event.getCurrentItem().getType() + " for " + sellprice + " coins");
            }
            else {
                event.getWhoClicked().sendMessage("You don't have any of that item in your inventory");
            }
cunning ermine
#

but doesn't rlly work, I think I probably did smthing wrong imma try again

tame coral
#

Okay

cunning ermine
#

is there a gradle plugin that allows debugging?

young knoll
#

That tutorial should work fine

tame coral
#

Ye

tardy delta
# tame coral ```java HashMap<Integer, ItemStack> map = event.getWhoClicked().getI...

uhh i kinda expended it

private void sell(boolean sell, int amount, Material material, double price) {
        if (sell) {
            ItemStack item = new ItemStack(material, amount);
            if (player.getInventory().containsAtLeast(item, amount)) {
                player.getInventory().removeItem(item);
            } else {
                player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 6, 1);
                return;
            }
        } else if (Main.eco.has(player, amount * price)) {
            Main.eco.withdrawPlayer(player, price);
            player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_CELEBRATE, 6, 1);
            Utils.giveOrDropFor(player, new ItemStack(material));
        } else {
            player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 6, 1);
            return;
        }
        Utils.message(player, (sell ? "§a+§b " : "§c-§b ") + price + " §3coins");
    }
cunning ermine
#

um isnt remote now like remote jvm debug?

tardy delta
#

but the itemstack alreasy contains the amount of items so when i do .containsAtLeast(item, amount) doesnt that check if the inventory contains like 4 * 4 items? instead of just 4?

young knoll
#

No

tardy delta
#

oh oke

cunning ermine
#

so debug mode is supposed to update everytime I do changes to the code?

silver shuttle
#

How do I play a sound that is audible from enourmous distances? Like up to 128 blocks away

true perch
#

What's a good way to test the efficiency of a method? Time taken to run it? if so, how?

tardy delta
#

if i'm modifying an inventory with already custom name with this method, will the custom name stay?

true perch
#

oh cool! thank you

tardy delta
#

anybody?

quaint mantle
#

🤸 🏌️

ivory sleet
#

Yes

#

The title will stay

#

However titles really don’t belong to inventories

#

They belong to the view

#

You see Bukkit kinda hides the concept between the interface/menu and the container

#

Well it used to

#

Now getTitle is long gone from Inventory

tardy delta
#

oke

silver shuttle
#

How do I play a sound that is audible from enourmous distances? Like up to 128 blocks away

tardy delta
#

within the distance

silver shuttle
#

is there an easier method than that? Or just a modification i can do to the syntax of playsound?

#

Not that its too hard, I just want to know if theres another way

tardy delta
#

is it possible to have itemstack with more than 64 items?

#

sounds weirrd but yea

#

oh np then

#

but will it throw an error when i try item.setAmount(item.getAmount() + 64) ?

#

or will it just stay by 64

#

ah
The inventory has ha check if the itemstack over 64. If is over 64 than its sets to 64 😉

silver shuttle
#

is there a way to process a string as code? I know the security risks behind it...

#

if you understand what i mean by that

ivory sleet
#

Uh sure

#

Tho why?

silver shuttle
#

for quicker testing of stuff

#

how do you do it then

ivory sleet
#

check out javax.tools package

#

and ftr you can use google for this one

rigid hazel
#

Error while building pom.xml:

#

pom.xml:

ivory sleet
#

but if u just wanna run some code, something like jshell is adequately what you want

silver shuttle
#

needs to be ingame ^^

rigid hazel
ivory sleet
silver shuttle
#

ok ty

tardy delta
# rigid hazel https://pastebin.com/VSLw7qCq
[WARNING] 'dependencies.dependency.systemPath' for org.geysermc:floodgate-bukkit:jar should use a variable instead of a hard-coded path D:/Workspace/Lib/floodgate-bukkit.jar @ line 43, column 25
ivory sleet
#

or use something like javassist

tardy delta
#

make it a string variable or something

#

and use that variable instead of the path who knows

craggy cypress
#

How can i check how many numbers there are after a . in a string

#

like 100.23

#

2 numbers after the .

ivory sleet
#

regex would be one way

silver shuttle
#

whats the easiest way to get the direct line of sight distance between 2 players?

#

like simpler than using .getLocation and some calculations

eternal night
#

LOS distance would be a lot more complicated o.O

#

Like, blocks obstructing the line of sight etc

#

Or are you talking about just plain old distance

silver shuttle
#

plain distance

rigid hazel
tardy delta
#

wut

silver shuttle
#

sorry, i just meant direct distance by it

rigid hazel
#

I didn't work with xml before

tardy delta
#

String str = "your path here";

#

smh

#

oh xml

eternal night
#

player.getLocation().distance(otherPlayer.getLocation())

tardy delta
#

uhh

eternal night
#

Tho use distanceSquared

#

For anything that doesn't have to be displayed

#

To save yourself a sqrt call

silver shuttle
#

wait why

eternal night
#

Because they are the most expensive part of the calculation

#

And if you perform them a shit load of times, you'll slow down

#

Hence, if you can, compare to the squared distance

silver shuttle
#

sorry, I don't understand fully

#

I'm trying to get a list of all players and their distance around another player, which I do like this:

        Player player = Bukkit.getPlayer(args[0]);
        //String sound = args[1];
        //double volume = Double.parseDouble(args[2]);
        int range = Integer.parseInt(args[1]);
        ArrayList<Player> nearby = new ArrayList<Player>();
        for (Player p : player.getLocation().getNearbyPlayers(range, range, range)){
            nearby.add(p);
            sender.sendMessage(String.valueOf(player.getLocation().distance(p.getLocation())));
eternal night
#

Yeah in this case you are displaying the distance so you need the actual value. The Location#distance call is fine

#

But it is more expensive (CPU wise)

#

So in places where you can avoid it you should use distanceSquared

silver shuttle
#

ok

tardy delta
#

assuming they're all numbers

#

and you only have one .

true perch
#

Will there be any performance issues with creating an average of 50 objects per second as long as the server is running?

ivory sleet
#

what objects?

#

I mean objects are expensive ofc if we see it from a conservative perspective

true perch
#

Custom objects which contain a dozen member variables pulled from a mysql database

ivory sleet
#

doubt

true perch
#

No problem with that?

#

That's good

eternal night
#

the server code is creating enough variables per tick, unless you are doing IO you should be fine

silver shuttle
eternal night
#

you are fine as well

silver shuttle
#

ok cool thank you

fluid cypress
#

can i prevent this thing from printing to the console somehow while i do something?

[10:53:12 WARN]: Can't keep up! Is the server overloaded? Running 7099ms or 141 ticks behind
true perch
ivory sleet
#

I mean just set the max allocate ram to be adequate for your behavior/requirements, then it should be fine as long as you're not creating any memory leaks that is.

ivory sleet
#

yes

silver shuttle
#

can Player#playSound() play custom sounds from a resource pack?

ivory sleet
#

objects which are no longer considered referenced but cannot be garbage collected

#

thats a leak

true perch
#

Yeah I will have that for sure

#

Need to unload the data from the references then

fluid cypress
ivory sleet
#

Well Idk exactly your design here so cant tell for sure

true perch
#

How do you unload data from object references?

ivory sleet
#

but just using allocated memory doesn't inherently mean you'll encounter a memory leak

#

The garbage collector is awesome, in fact it finds objects that are no longer referenced and enqueues them for gc.

#

So most likely you'll be fine

true perch
#

Most of the objects created, 50-100 objects per second, will only be used for a small portion of time.

ivory sleet
true perch
ivory sleet
#

hmm yes

true perch
#

Cool! learned a new thing

#

I'm gunna try making 10,000 objects, and watch the memory shoot up and go down

ivory sleet
#

yeah its a hack cause developers cant be arsed to work with side effects

#

and state

true perch
#

Tbh it would be a pain to remove the data from references properly

ivory sleet
#

Idk depends how you're doing it

#

there are known principles when it comes to data models and that stuff

true perch
# ivory sleet Idk depends how you're doing it

I am using the objects to create an itemstack for a GUI menu. The object's goal is to return an itemstack which is modified by data found in the SQL database. Every item on every page a player views will need to create 50 new objects. Therefore each new page will create 50 new objects, making the previous 50 objects from the last page unneeded. You say garbage collection will get those though, so I shouldn't worry right?

ivory sleet
#

yeah

#

tho I suppose you could optimize it with something like a soft cache

true perch
#

Not sure what that is

fluid cypress
#

is there any way i can count all chunk tickets added by my plugin?

ivory sleet
#

a soft reference is a reference that points to an object, however if the jvm instance is running low on memory it will gladly stop referencing that object making it available for garbage collection

edit ofc if any other object still reference it strongly then it in principle doesnt matter

torn shuttle
#

so this is a weird question but is the trick to using the EnderDragon.Phase.DYING to apply it before the dragon reaches 0 hp?

#

I don't know if it's something about my implementation but it looks like just setting the health to = 0 will instantly remove it? might be something else in my system that I am overlooking though

true perch
#

Thanks for your help Conclure

tardy delta
#

if i do item.setAmount() does that updates the inventory? i'm kinda stuck

ivory sleet
#

yeah anyways SoftReference is what you'd be look at or a cache library like Caffeine, highly recommended

true perch
#

Okay thank you :>

#

Was interesting to see the server memory usage after 1000 objects were created in a for loop https://prnt.sc/1q5nu7v

#

went back down to normal during the next garbage collection

ivory sleet
#

yeah lol

#

garbage collection does hella of a good job

#

its generally hard to actually achieve a memory leak

rigid hazel
torn shuttle
ivory sleet
#

oh shit

rigid hazel
#
Guild guild = Guild.createGuild(this.plugin, RolePlayer.getOnlineRolePlayer(player).getTempGuildName(), player, block.getLocation());

                guild.getGuildLocation().subtract(0, 1, 0).getBlock().setType(Material.GOLD_BLOCK);

                // Sets the blocks manually, because I'm bad in math
                guild.getGuildLocation().subtract(0, 1, 0).add(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(0, 1, 0).add(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().subtract(0, 1, 0).subtract(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().subtract(0, 1, 0).add(1, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(0, 1, 0).subtract(1, 0, 1).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().subtract(0, 1, 0).subtract(1, 0, 0).add(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
                guild.getGuildLocation().subtract(0, 1, 0).subtract(0, 0, 1).add(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);

                guild.getGuildLocation().subtract(0, 1, 0).add(0, 1, 0).getBlock().setType(Material.BEACON);
tardy delta
#

whoa

rigid hazel
#

Location startLocation = startChunk.getCenterChunkLocation().add(0, 1, 0);

#
public Location getCenterChunkLocation(){
        Location center = new Location(this.chunk.getWorld(), this.chunk.getX() << 4, 64, this.chunk.getZ() << 4).add(8, 0, 8);
        center.setY(center.getWorld().getHighestBlockYAt(center));
        return center;
    }
rigid hazel
#

Can anyone help?

torn shuttle
#

don't do the thing you are doing

rigid hazel
#

Okay Ni.

#

What trying instead?

torn shuttle
#

are you just trying to make a pyramid

#

or what

tame coral
tardy delta
#

beacon?

rigid hazel
torn shuttle
#

3x1x3?

shy wolf
#

69

true perch
shy wolf
#

how to set color for glow?

rigid hazel
tardy delta
#

that doesn't work

#

still doesn't update

torn shuttle
#
location goldBlockY = whatever;
for (x = -1; x <2; x++)
for (z = -1; z<2; z++)
Location location = new Location(world, x, goldBlockY.getY() - 1, z); 
haha code go brr
#

man I am just about done

plush crescent
#

Hi.
How can I get the player as a command argument in the Spigot plugin?

torn shuttle
#

if you mean player from command executor you can just cast it

ivory sleet
#

If you create new objects in them, sure

torn shuttle
#

I mean I've caused a few mem leaks in the past

#

just keep adding new entities to a list for forever

ivory sleet
torn shuttle
#

🤷 it's not that hard to do by mistake

#

especially when you're still editing critical code 12 hours after you decided you were going to stop for the day

ivory sleet
#

Well if you’re actually trying to make a solid application it should be trivial in most cases to quickly tweak or avoid

torn shuttle
#

like right now

torn shuttle
#

there's a fallible human behind pretty much every line of code

ivory sleet
#

Indeed

tardy delta
#

for some reason player.updateInv does not work

torn shuttle
#

I genuinely can't tell why dragons won't do the death animation

rigid hazel
#

It still place as before

torn shuttle
#

no it doesn't

#

that uses a fixed y value so I can't see how it would be placing gold blocks above that y value

rigid hazel
#

But I'm using guild.getLocation

torn shuttle
#

so what?

tardy delta
#

int * double is int right?

ivory sleet
#

no

quaint mantle
#

Hello i'm asking for how to make /stack command
like if i have potions on my inventory they gets all of poitions and set it on 1 slot

#

is there anyway to make it

tardy delta
#

get the current itemstack and increase its amount to 64

#

eventually create a new max size for that item

young shell
#

When does a PlayerLevelChangeEvent is getting called? Does it triggers on Experience Level Change or what kind of Level is meant by that

warped gazelle
#

where can i hire a developer?

eternal night
#

most likely on the spigot forums service section

tardy delta
#

uhh does item.setamount also updates the item? so the amount is visible

spark meadow
#

hey, can someone help me with using a player name as an arg in a command e.g. /kill (playername)

young shell
#

Whats the Issue?

tardy delta
#

check if Bukkit.getOnlinePlayers().contains() your args[0]

#

then you now its a player

spark meadow
#

Player target = Bukkit.getPlayerExact(args[0]);
if (target instanceof Player) {
target.setMaxHealth(20);
target.setHealth(20);
target.setGameMode(GameMode.SURVIVAL);
} else {
player.sendMessage("This player does not exist");
}

tardy delta
#

i hope you check if the player is online

spark meadow
#

is bukkit.getplayerexact a viable method?

ivory sleet
#

Yes

spark meadow
#

i dont get how it doesnt work than

#

i have an alt on the server

#

and i type /revive (altign) and it gives nothing no erros

#

errors

tardy delta
#

Player target = Bukkit.getPlayerExact(args[0]);
if (!Bukkit.getOnlinePlayers().contains(target)) {
  // player isnt online, send a message or something
  return true;
}
// do something with the player is he's online
#

this looks better

ivory sleet
#

if (Bukkit.getPlayerExact(args[0]) instanceof Player target) {

}

#

This should work fine also

tardy delta
#

wew

opal juniper
#

hey conclure

ivory sleet
#

hey Jeff

tardy delta
#

i dont think you want to heal or revive an offline player if thats even possile

quaint mantle
#
Player p = Bukkit.getPlayer(args[0]);

if (p==null) return;
#

Or getPlayerExact()

ivory sleet
peak depot
#

no hes trying with get player so he need to do the @quaint mantle way

#

like with bukkit.getplayer

ivory sleet
#

?

tardy delta
#

:/

quaint mantle
#

Don't need to check if Bukkit.getOnlinePlayers() contains player

ivory sleet
#

getPlayerExact works also

quaint mantle
#

Ya

tardy delta
#

if you're using getPlayerExact yea dont check if hes online

quaint mantle
#

Check in google, what's difference between getPlayer and getPlayerExact

tardy delta
#

what

ivory sleet
#

none of those is needed to check online/offline

tardy delta
#

check if he's != null

#

and i know the difference

quaint mantle
ivory sleet
#

getPlayer and getPlayerExact grabs the player from the backing map which only holds players who are online during invocation

#

No it return null then

#

Thus an instanceof suffice

shy wolf
spark meadow
#

i tried bukkit.getplayer(args[0]);

#

but it still doesnt do anything

quaint mantle
#

Hi i want to compile a ServerJAR and i need help on that
could someone please help me on compiling 1.8.8 of https://github.com/softpak/HOSE ?

Would be awesome and i would give you a "thank you" gift 🙂

quaint mantle
shy wolf
eternal night
#

lmfao what is HOSE

#
+        AImove ait = new AImove(x, y);
+        ait.fork();
+        ait.join();
tardy delta
#

i dont see a src

eternal night
#

provide mind-blowing multithreaded impl like this

ivory sleet
#

lol

tardy delta
#

ah there

eternal night
#

forking to then directly joining

tardy delta
#

but what is this all

eternal night
#

mind blown

spark meadow
#

else if (cmd.getName().equalsIgnoreCase("revive")) {
if (args.length == 0) {
player.setMaxHealth(20);
player.setHealth(20);
player.setGameMode(GameMode.SURVIVAL);
}
} else {
Player target = Bukkit.getPlayer(args[0]);
if (target instanceof Player) {
target.setMaxHealth(20);
target.setHealth(20);
target.setGameMode(GameMode.SURVIVAL);
} else {
player.sendMessage("This player does not exist");
}
}

    return true;

when just using /revive it works fine but when putting an arg the command doesnt work anyone has a solution?

quaint mantle
#

why are you checking the command name anyways

spark meadow
#

wait which else?

tardy delta
#

imagine compiling with javac

spark meadow
#

@quaint mantle which else is wrong?

shy wolf
#

how to selct random player

#

i am makeing a game

tardy delta
#
int random = new Random().nextInt(Bukkit.getOnlinePlayers().length);
Player player = Bukkit.getOnlinePlayers()[random];
shy wolf
#

ty

tardy delta
#

or .size()

#

instead of .length i think

shy wolf
#
        int random = new Random().nextInt(Bukkit.getOnlinePlayers().size());
        Player player1 = Bukkit.getOnlinePlayers()[random];```
narrow furnace
#

?

shy wolf
narrow furnace
#

why the uh

tardy delta
#

.get probably

#

ah wait

shy wolf
tardy delta
#

ugh its a collection so i should add them to a arraylist and call the get method

#

maybe there's a better way

shy wolf
#

like do for?

tardy delta
#

yea

#

or just like this

ArrayList<Player> p = new ArrayList<>(Bukkit.getOnlinePlayers());
#
int random = new Random().nextInt(p.size())
Player player = p.get(random);
narrow furnace
#
int random = new Random(getServer().getOnlinePlayers().size()).nextInt();
Player player = (Player) getServer().getOnlinePlayers().toArray()[random];
spark meadow
#

else if (cmd.getName().equalsIgnoreCase("revive")) {
if (args.length == 0) {
player.setMaxHealth(20);
player.setHealth(20);
player.setGameMode(GameMode.SURVIVAL);
}
} else {
Player target = Bukkit.getPlayer(args[0]);
if (target instanceof Player) {
target.setMaxHealth(20);
target.setHealth(20);
target.setGameMode(GameMode.SURVIVAL);
} else {
player.sendMessage("This player does not exist");
}
}

    return true;

when just using /revive it works fine but when putting an arg the command doesnt work anyone has a solution?

narrow furnace
#

?paste

undone axleBOT
tardy delta
#

oh true

spark meadow
#

ye but which else do u mean

narrow furnace
spark meadow
#

omg

#

i see it

#

i am

#

ok

#

sorru

burnt mural
#

Hi everyone. I have a problem with my plugin and I don't understand why it appears. My goal is to make a weather module which manages the weather of a specific world. So there are different types of weather : SUNNY, RAIN and STORM.

However, I have a problem with the RAIN weather. Indeed, when the user wants the rain to be enabled for a specific world, I use the WeatherChangeEvent to detect a weather change and I cancel it in case in which the new weather isn't rain. However, when I use the /weather clear command and the event is cancelled, it is called a lot of times. I don't know of to fix that. Can someone helps me, please ?

Version used : 1.8 (I want my plugin to support 1.8 to 1.17).
Code :

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWeatherChange(WeatherChangeEvent event) {

    System.out.println("WeatherChangeEvent");

    event.setCancelled(true);
}

Note : The sysout is displayed like a loop in the console.

quaint mantle
#

it might be called per player

#

chrck the docs

#

?jd

eternal night
#

you will have to update the world time till the weather is supposed to change next

#

else the server will endlessly try to switch into the next weather state

burnt mural
eternal night
#

check this

burnt mural
eternal night
#

should hopefully work

burnt mural
#

No it doesn't work...

#

Same result as before

lusty cipher
#

You sure you don't just /reload

#

And your plugin is loaded a bunch of times or something

burnt mural
#

I restarted the server. The listener is registered only once and the message in the console is spammed as before.

#

However, I should notice that when I do /weather rain again, the event is no longer spammed.

tardy delta
#

?paste

undone axleBOT
tardy delta
burnt mural
#

Something also very interesting with my problem is that in the event, world weather duration is set to 0 even if I set it to 12000 at the end of the event.

#

@eternal night

humble heath
#

hey i am trying to make a god command in a gui but how do i get if a player is already god to check to set them godmode to false and if

#

and if not set them to god

lusty cipher
#

you can use a List or Map to keep track of the player ids and a boolean value

shy wolf
#

hey i am tying to make a random player system or something
uhhh any way whan i do the command it's showing to me a player and to ather player it's showing b player
how can i fix it?
here is my code

                            ArrayList<Player> p2 = new ArrayList<>(Bukkit.getOnlinePlayers());
                            int random = new Random().nextInt(p2.size());
                            Player player = p2.get(random);
                            p.sendMessage(random + " " + player.getName());
                            player.setGlowing(true);
shy wolf
#

any one?

tardy delta
#

what

undone axleBOT
#

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

undone axleBOT
#

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

shy wolf
#

but i dont have timeeeeee

burnt mural
#

So don't be a developer

lusty cipher
#

you'll just have to have time

shy wolf
#

jk

burnt mural
#

Very funny

quaint mantle
barren granite
#

Hello, so I'm trying to code a GUI plugin. How can I make a different GUI pop up when a player right clicks a item in the first GUI? Currently, it performs what I want to become only the left click function, whether the item in the GUI is left clicked or right clicked.

#

I've gotten that part down. 😅 Only thing is, I want something different to happen when a player right clicks a item in the GUI, if thats even possible

shy wolf
#

idk my english i so bad

barren granite
#

ah, thank you!

spark meadow
#

when using player.teleport can i just teleport the player to a specific coordinate?

#

what do i put between the () then

#

like player.teleport(xxx)

burnt mural
spark meadow
#

yes

normal isle
spark meadow
#

ye ik but i dont get it

#

it sais @notnull location location

tardy delta
spark meadow
#

so
Player location = (the cords)
player.teleport(location)

burnt mural
#

What information do you want ? I have a weather set to rain. When I use the /weather clear command, the WeatherChangeEvent is spammed infinitly.

spark meadow
#

to an extend

#

well im still learning thats why im here :p

narrow furnace
#

?learnjava

undone axleBOT
spark meadow
#

oh

tardy delta
burnt mural
#

I think you're right but how to fix it ?

spark meadow
#

Location location = new Location(Bukkit.getWorld("world"), x, y, z);

tardy delta
#

yea

spark meadow
#

and then player.teleport(location);

tardy delta
#

uhu

#

i think it also needs a yaw and a pitch not sure

narrow furnace
#

na just world, x, y, z

tardy delta
#

pmm how can i fix this

The POM for org.spigotmc:minecraft-server:jar:1.11.2 is missing, no dependency information available
quaint mantle
tardy delta
#

?paste

undone axleBOT
tardy delta
#

its from @quaint mantle

#

its messed up i think

quaint mantle
#

🥺

tardy delta
#

where did you even got it from?

quaint mantle
#

@weary geyser

tardy delta
#

to array or something

quaint mantle
tardy delta
#

something like that

quaint mantle
#

that good

tardy delta
#

does it work?

quaint mantle
#

try

shy wolf
#

not rly

quaint mantle
#

?

#

shoud work

ivory sleet
#

Randoms are kinda expensive to create but apart from that yeah

young knoll
#

How does nextInt work without an argument

tardy delta
#

thread idk what random

#

that thing

ivory sleet
#

Oh yeah Coll sharp eyed

#

ThreadLocalRandom you probably mean

tardy delta
#

yea

lusty cipher
#

the size should be in nextInt not the Random ctor, no?

young knoll
#

Yes

lusty cipher
#

And randoms get a heck of a lot better in JDK 17

young knoll
#

The ctor is the seed

lusty cipher
#

I hope mc makes use of it

shy wolf
#
17.08 12:21:33 [Server] INFO java.lang.ArrayIndexOutOfBoundsException: Index -1154715079 out of bounds for length 2
17.08 12:21:33 [Server] INFO at net.inbar.main.hideandsik.command_maneger$1.run(command_maneger.java:50) ~[?:?]
17.08 12:21:33 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:485) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1427) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:436) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1342) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1130) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-786]
17.08 12:21:33 [Server] INFO at java.lang.Thread.run(Thread.java:831) [?:?]```
tardy delta
#

out of bounds

#

-1

lusty cipher
#

not -1

#

-1154715079

tardy delta
#

idk not even looking at it

young knoll
#

Like we said

narrow furnace
lusty cipher
#

yeah we already answered it

#

scroll up

young knoll
#

Move the size to nextInt

tardy delta
#

:/

shy wolf
#

uh?

lusty cipher
#

well learn java then

shy wolf
#

lol

narrow furnace
#

not lol

lusty cipher
#

you have to move the size from the ctor to the nextInt function parameter

narrow furnace
#

?learnjava

undone axleBOT
ivory sleet
#

ThreadlLocalRandom.current().nextInt(upperBound)

quaint mantle
lusty cipher
#

no

quaint mantle
#

bruh

lusty cipher
#

the random ctor takes a seed

#

you gave the size as the seed

#

works, but makes 0 sense

quaint mantle
#

lng

tardy delta
#

smh

narrow furnace
#

thats a very long line

quaint mantle
#
Player p = Bukkit.getOnlinePlayers().stream().skip(new Random().nextInt(Bukkit.getOnlinePlayers().size())).findFirst().get();
#

thats good

tardy delta
#

lol

narrow furnace
#

why are we still on this

ivory sleet
#

lmao

quaint mantle
lusty cipher
#

We already had answers

#

Why do we need new answers

young knoll
#

Because everything must be streams

#

Apparently

ivory sleet
#

mmmmm yesss

lusty cipher
#

streams go brrrr

young knoll
#

I would advise using thread local random

ivory sleet
#

Or you could go with something like a SplittableRandom

young knoll
#

Player p = Bukkit.getOnlinePlayers().toArray()[ThreadLocalRandom.current.nextInt(Bukkit.getOnlinePlayers().size())];

#

Something like that

ivory sleet
#

I mean you don't have to create a new Random instance then which stonks

#

So even in a single threaded application ThreadLocalRandom is fine

narrow furnace
#

you dont have to write everything in one line

#

less code != better code

young knoll
#

Lies

#

Gotta save those bytes

#

The world is running out of bytes

narrow furnace
#

that is not very readable

#

at all

#

...

#

your opinion is incorrect

ivory sleet
#

yeah bingie I agree

#

some explanatory variables wouldn't be too bad

#

tho its really a nitpicky criticism

narrow furnace
young knoll
#

:p

narrow furnace
#

ik but i had random defined in that class 🙁

spark meadow
#

so small problem
Location location = new Location(Bukkit.getWorld("world"), 200, 85, 200, 0, 0);
player.teleport(location);
this code does not work :(

young knoll
#

Explain how it does not work

tardy delta
#

is the world not present?

spark meadow
#

so i have an event onplaydeath and it does set the to gamemodfe adventurer like it chould but it doesnt tp them :p

narrow furnace
#

idc if you can read it its still better to write it in multiple lines

spark meadow
ivory sleet
#

objection

#

anyways this argument is ludicrous from top to toe

iron condor
#

hey, how can I translate world coords (ex, x: 100) to chunk coords (0 - 15)?

rotund pond
#

Hello !
Does anyone know why this is deprecated ?
I'm wondering why this method is deprecated but the same method with a Runnable instead of a BukkitRennable is not deprecated man_shrugging

ivory sleet
#

🥲

undone axleBOT
spark meadow
#

public static void onPlayerDeath(PlayerDeathEvent event){
Player player = event.getEntity();
why can i not put Player player = event.getPlayer(); ?

ivory sleet
#

read the bottom section

rotund pond
young knoll
#

Because PlayerDeathEvent doesn't have a getPlayer

rotund pond
quaint mantle
young knoll
#

Because it extends EntityEvent, not PlayerEvent

ivory sleet
#

I mean spnda's redirection isn't less right

lusty cipher
#

well it both says effectively the same

young knoll
#

Is that one of the methods that was deprecated because people were getting confused by the name?

rotund pond
#

😩

quaint mantle
#

not that easy

lusty cipher
#

it's basically just because of API changes that this is for some reason the preferred way of scheduling now

quaint mantle
#

i need it in a diffrent version

young knoll
#

Ew 1.11

quaint mantle
#

Its better than you think

lusty cipher
#
         if ( enabled && Thread.currentThread() != MinecraftServer.getServer().primaryThread )
         {
-            throw new IllegalStateException( "Asynchronous " + reason + "!" );
+            //throw new IllegalStateException( "Asynchronous " + reason + "!" );
         }

Patches like this give me shivers

ivory sleet
#

tf

quaint mantle
#

its not that simple as i said

#

i used it back in 1.8.8

rotund pond
#

Oh, last question, does anyone use dependency injection on spigot ?
How ?

quaint mantle
#

but now they dont support it so i want to geo back

ivory sleet
#

the design pattern, I use it all the time

rotund pond
#

Ik

rotund pond
#

Someone told me to use dependency injection and another one told me that it's not useful on spigot so I was a bit confused 😕

ivory sleet
#

hmm

young knoll
#

Static abuse

ivory sleet
#

dependency injection

#

I mean after all coupling instantiation is doable Ig

iron condor
#
int y = world.getChunkAt(x,z).getChunkSnapshot(true,true, true).getHighestBlockYAt(floor(x) >> 4, floor(z) >> 4);



    public static int floor(double num) {
        int floor = (int) num;
        return floor == num ? floor : floor - (int) (Double.doubleToRawLongBits(num) >>> 63);
    }


#

trying to get the highest block in pos

lusty cipher
#

you know how floating point numbers are represented in binary? (Idk what the math is that you're doing there, just looks weird)

tardy delta
iron condor
#

without flooring

lost matrix
#

Pretty sure there is Math.floor

iron condor
#

did that as well

#

no luck

iron condor
#

I need to convert real coords to chunk coords

#

current code

int x = RandomUtils.nextInt(44000) - 22000;
        int z = RandomUtils.nextInt(44000) - 22000;
        int y = world.getChunkAt(x,z).getChunkSnapshot(true,true, true).getHighestBlockYAt(x >> 4, z >> 4);
tardy delta
#
block = chunk.getBlock(Integer.parseInt(data[0]) & 0b1111,
                        Integer.parseInt(data[1]), Integer.parseInt(data[2]) & 0b1111);
lost matrix
tardy delta
#

data is just the coordinate

#

oh

lusty cipher
lost matrix
#

IEEE 754

iron condor
lost matrix
lusty cipher
#

besides, you can just do Math.floor(num) to floor your double

#

which will probably be a better implementation

iron condor
#

I need to get the highest block, and the chunk is not loaded so the server doesnt know the real highest block

iron condor
lost matrix
#

world.getChunkAt(x,z) will load the chunk

lusty cipher
iron condor
#

ok, so?

#

im using ints now

lost matrix
#

getChunkSnapshot does literally nothing

#

Use the World#getHighestBlockSomething because you load the chunk already anyways.

spark meadow
iron condor
#

so why I dont get the actuall heights?

spark meadow
#

what did u tell me again

lost matrix
tardy delta
spark meadow
#

oh ye

#

ill try that

iron condor
#

and what I do form here? world.getChunkAt(x,z)

lost matrix
lost matrix
# iron condor yep
  public Location getRandomHighestLocation(final Location center, final int radius) {
    final World world = center.getWorld();
    final ThreadLocalRandom random = ThreadLocalRandom.current();
    final int x = random.nextInt(-radius, radius);
    final int z = random.nextInt(-radius, radius);
    final int chunkX = x >> 4;
    final int chunkZ = z >> 4;
    final Chunk chunk = world.getChunkAt(chunkX, chunkZ);
    return world.getHighestBlockAt(x, z).getLocation();
  }
spark meadow
#

@tardy delta so Location location = new Location(player.getWorld(), 200, 85, 200, 0, 0);?

tardy delta
#

try it out

spark meadow
#

it doesnt work

tardy delta
#

grr what are you even doing

spark meadow
#

wait ill send full event code

#

public static void onPlayerDeath(PlayerDeathEvent event){
Player player = event.getEntity();
Player killer = player.getKiller();
if (player.getMaxHealth() == 2){
player.setGameMode(GameMode.ADVENTURE);
Location location = new Location(player.getWorld(), 200, 85, 200, 0, 0);
player.teleport(location);
killer.setMaxHealth(killer.getMaxHealth()+2);
} else {
player.setMaxHealth(player.getMaxHealth()-2);
killer.setMaxHealth(killer.getMaxHealth()+2);
}
}

#

it does set the player to adventurer but doesnt teleport

lost matrix
#
  1. Dont make it static
tardy delta
#

@brave glenHandler

#

o huh

#

sorry sir

spark meadow
#

there is an @ eventhandle

#

r

lost matrix
tardy delta
#

ki

spark meadow
#

above it

tardy delta
#

but not static

#

i dont think it is the location who is not working

spark meadow
#

ok

tardy delta
#

i think it s something else

lost matrix
spark meadow
#

no when someone isnt at 2 health and he dies 2 health gets removed

#

so u keep doing that

lost matrix
#

Ah i see what you are doing.

spark meadow
#

until hes at 2 health

lost matrix
#

What version are you on?

spark meadow
#

1.17

lost matrix
#

Then dont use those methods. They are deprecated for a reason.

#

Never use deprecated methods.

tame coral
#

^

spark meadow
#

which method should i use then to teleport

iron condor
tardy delta
#

what is deprecated?

lost matrix
# spark meadow which method should i use then to teleport

Example:

  @EventHandler
  public static void onPlayerDeath(final PlayerDeathEvent event) {
    final Player player = event.getEntity();
    final Player killer = player.getKiller();

    final AttributeInstance playerMaxHealthAttr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);

    if (killer != null) {
      final AttributeInstance killerMaxHealthAttr = killer.getAttribute(Attribute.GENERIC_MAX_HEALTH);
      killerMaxHealthAttr.setBaseValue(killerMaxHealthAttr.getBaseValue() + 2.0D);
    }

    if (playerMaxHealthAttr.getBaseValue() == 2.0D) {
      player.setGameMode(GameMode.ADVENTURE);
      final Location location = new Location(player.getWorld(), 200, 85, 200, 0, 0);
      player.teleport(location);
    } else {
      playerMaxHealthAttr.setBaseValue(playerMaxHealthAttr.getBaseValue() - 2.0D);
    }
  }
tardy delta
#

why final event?

lost matrix
#

Its just a setting of my IDE. Everything is final by default

tardy delta
#

oh lol

shy wolf
#

how can i hide play nik name?

tardy delta
#

escape them?

#

backslash

hexed hatch
#

<char>

#

wait

quaint mantle
#

\c

hexed hatch
#

\char

tardy delta
#

put another

shy wolf
tardy delta
#

google is a good one

lost matrix
shy wolf
#

i need to see just the player not the "Owner danos360"

eternal oxide
#

Then you have a plugin that is modifying it

#

Use getName() not getDisplayName()

shy wolf
#

nononon

#

i need to hide it

#

like whan you shift

lost matrix
#

I think he wants to completely hide the nametag. I think there is some scoreboard magic for that iirc

shy wolf
#

I think he wants to completely hide the nametag
YES this

spark meadow
#

when using .addBan you need to give an expiring date how can i make the ban infinite?

quaint mantle
#

null

#

read the docs

spark meadow
#

oh i found them

#

couldnt find them before

#

ty

tardy delta
#

i made an inventory with an itemstack as icon, when i use itemstack.setAmount(itemstack.getAmount() + 1) for some reason it does not display the number

quaint mantle
#

you have to set the item back

tardy delta
#

so i would have to do this every time 🐼

lost matrix
#

Setting the amount of an ItemStack within an Inventory should work fine as long as its the same instance of ItemStack.

narrow furnace
lost matrix
#

ScreenToGif 😄

narrow furnace
#

thanks

tardy delta
#

uh

#

i dont think it's possible to understand my code

spark meadow
#

UUID playerId = player.getUniqueId();
Bukkit.getBanList(Type.NAME).addBan(String.valueOf(playerId),"You have died", new Date(null), "You have Died");

#

is this a good code to ban someone

#

well

#

add them to the banlist

tardy delta
#

wait

spark meadow
#

wait

#

lmfao

#

my source

#

is

#

wrong

#

right

tardy delta
#

isnt it the player name?

#

instead of id

sacred ether
#

I need some help. the comand line didnt make my jars for sigot. it made folders not jars

tardy delta
#

yes i have to change my § symbols 😔

#

and you also have to kick him

#

just banning wont kick

spark meadow
#

fourteen can you explain to me what i need to put in source?

#

ye ik

tardy delta
#

to put in source? you mean which parameters?

scenic hornet
#

wait is the spigot api on 1.13 or 1.14? or does it not madder?

spark meadow
#

no like is source the person that bans the other person?

scenic hornet
tardy delta
#

it is the player name who banned him but it's not important

sacred ether
# lost matrix Do you use maven?

I am not a programer so I do not know what that is. I followed the instructions on the spigotmc site and did the whole prequisits with the batch file and the buildtools.jar to compile the jars but it gave me folders insted of jars

spark meadow
#

oh ok tysm

shy wolf
#

what is the max dameg?

lost matrix
tardy delta
#

?paste

undone axleBOT
lost matrix
#

I think default is 2048 and absolute max is around 1.8 with 308 zeros

tardy delta
lost matrix
#

So max damage is around
1800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

tardy delta
#

lmaooo

#

i made an itemstack with - ... items

#

so it dissapears

#

if (amount > 0) 😏

burnt mural
#

Hi everyone. I have a problem with my plugin and I don't understand why it appears. My goal is to make a weather module which manages the weather of a specific world. So there are different types of weather : SUNNY, RAIN and STORM.

However, I have a problem with the RAIN weather. Indeed, when the user wants the rain to be enabled for a specific world, I use the WeatherChangeEvent to detect a weather change and I cancel it in case in which the new weather isn't rain. However, when I use the /weather clear command and the event is cancelled, it is called a lot of times. I don't know of to fix that. Can someone helps me, please ?

Version used : 1.8 (I want my plugin to support 1.8 to 1.17).
Code :

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWeatherChange(WeatherChangeEvent event) {

    System.out.println("WeatherChangeEvent");

    event.setCancelled(true);
}

Note : The sysout is displayed like a loop in the console.

tardy delta
#

i'm earning - 100 coins yea hmmm smh

lost matrix
#

Discord4j vs JDA
Pros/Cons?

ivory sleet
# lost matrix Discord4j vs JDA Pros/Cons?

Hmm JDA is favorable in terms of getting things done faster since it’s a lot more exposed to developers due to its overall popularity. I haven’t done much discord4j myself so can’t make a fair comparison.

chrome beacon
#

I've only used JDA 🤷‍♂️

lavish hemlock
#

I wrote a light wrapper for Discord4J.
It's a bit of a sluggish library to use, if you want honesty.
It uses the Reactor library for all values since that provides reactive programming, but it also means you need to do a lot of null-checking when block()ing a Mono in case you don't want to use the reactive model.

ivory sleet
#

Well isnt JDA reactively designed also

lavish hemlock
#

Maybe.

#

I think I'd recommend JDA personally though.

#

Just because of how nice it looks :)

plush crescent
stone sinew
narrow furnace
#
(Player) sender
#

just that no?

stone sinew
upper vale
#

Never seen this before, anyone have any idea lol

[14:36:21 WARN]: Entity threw exception at world:246.10000610351562,42.25,1408.949951171875
[14:36:21 WARN]: java.lang.NullPointerException
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.AdvancementDataPlayer.b(AdvancementDataPlayer.java:435)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.EntityPlayer.tick(EntityPlayer.java:652)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.Entity.passengerTick(Entity.java:2382)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.EntityLiving.passengerTick(EntityLiving.java:3089)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.EntityHuman.passengerTick(EntityHuman.java:483)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.WorldServer.a(WorldServer.java:1552)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.WorldServer.entityJoinedWorld(WorldServer.java:1516)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.WorldServer.doTick(WorldServer.java:1132)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1552)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:439)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1402)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1134)
[14:36:21 WARN]:     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:292)
peak depot
#

send the complete error

upper vale
#

that is the complete error

karmic grove
#

||where can i download spigot api none of the links work||

#

?

#

what u doin

peak depot
#

bot deleteing

karmic grove
#

the link?

#

you can d

#

m

#

ok

peak depot
#

bot deletes the name

upper vale
#

have you ever wondered why it does that

stone sinew
peak depot
#

yeah but if he says it dont works for him he can download it there

narrow furnace
#

cos its illegal

stone sinew
hexed hatch
#

Just be a sigma male and use buildtools

upper vale
eternal oxide
#

You are creating a fake player/NPC that does not exist on the server. Your NPE happens when the server attempts to check the achievements for riding but the NPC is fake.

karmic grove
#
Description    Resource    Path    Location    Type
JavaPlugin cannot be resolved to a type    Blank.java    /SpigotBlankPlugin/src/com/atnipcontruction/com    line 4    Java Problem
The method onDisable() of type Blank must override or implement a supertype method    Blank.java    /SpigotBlankPlugin/src/com/atnipcontruction/com    line 12    Java Problem
The method onEnable() of type Blank must override or implement a supertype method    Blank.java    /SpigotBlankPlugin/src/com/atnipcontruction/com    line 8    Java Problem
The package org is not accessible    Blank.java    /SpigotBlankPlugin/src/com/atnipcontruction/com    line 2    Java Problem

#
package com.atnipcontruction.com;
import org.bukkit.plugin.java.JavaPlugin;

public class Blank extends JavaPlugin {
    
     // Fired when plugin is first enabled
    @Override
    public void onEnable() {
    }
    // Fired when plugin is disabled
    @Override
    public void onDisable() {

    }
    
        
}

``` code
glossy barn
#

You need to use the spigot api

karmic grove
#

i did i think

glossy barn
#

the class JavaPlugin cannot be found

karmic grove
#

i did but maybe it didnt work is there a way to add after the project is made

glossy barn
#

I'm not too familiar with eclipse, but if you right-click on your project, select "build path", click "configure build path", click "Libraries" and select "Add External JARs", then select your desired jar and click apply/ok

#

try something like that

quaint mantle
#

Use maven

#

no you should be using a build tool like maven or gradle

#

Just use bukkit's Tutorial instead

#

It is more Feature complete than spigot's ones despite being almost a decade old

glossy barn
#

they should be but you can't just throw everyone into the deep end and go "here learn all these tools and know them inside out before you actually start doing anything with our library"

#

some people learn how to code alongside writing mc plugins (despite it being fundamentally wrong)

quaint mantle
#

Sure, but using maven/gradle make switching to another IDE much more easier

#

(or PC)

karmic grove
#
JAR export finished with warnings. See details for additional information.
  Exported with compile errors: SpigotBlankPlugin/src/com/atnipcontruction/com/Blank.java

hasty prawn
ivory sleet
#

Gradle 😌

quaint mantle
#

#FuckGradle

hasty prawn
#

I hate Gradle so much lmao

karmic grove
#

everyone on forums and such says use eclipse so i decided to

ivory sleet
#

Nerds

quaint mantle
#

Maven 😌

hasty prawn
#

I'm pretty sure you're the nerd for liking Gradle

ivory sleet
karmic grove
#

why cant we post pics here it would help so much

quaint mantle
#

intellij is sinply superior

narrow furnace
#

yes its very sinple

hasty prawn
#

"hello Gradle I would like to depend on this project and you build it into the Jar for me so it's there at compile and runtime "

Gradle: "ok install this plugin and we can do that for you"

quaint mantle
#

fr

#

🤸 🏌️

opal juniper
ivory sleet
#

lol inaccurate as hell but Ig dessie

karmic grove
#

still got 3 errors

quaint mantle
undone axleBOT
hasty prawn
quaint mantle
#

ant is easiest

opal juniper
#

conclure is something of a gradle fanboy

hasty prawn
#

I mean I've not spent much time trying to learn Gradle, how would you go about doing what I explained then?

ivory sleet
#

well first of all you probably don’t need any plugin

hasty prawn
#

So if I want to use, for example, zip4j in my plugin, and build it with the jar. How would you do that without using shadow

karmic grove
#

is it supposed to be in mudule path or class path

ivory sleet
#

oh well that’s a bit complicated but why would you not use shadowJar

river spear
#
public void test(void v, String s) {

}```Why doesn't it work?
ivory sleet
#

It’s pretty much a standard at this point of time

quaint mantle
#
<project name="MyApplication" default="dist" basedir=".">

    <description>

    simplest example build file

  </description>
    <property name="src" location="src" />

    <property name="build" location="build" />

    <property name="dist" location="dist" />

    <property name="version" value="1.0" />

 

    <target name="init">
        <mkdir dir="${build}" />
    </target>

    <target name="compile" depends="init" description="compile the source">

        <javac srcdir="${src}" destdir="${build}" />

    </target>
</project>
eternal oxide
hasty prawn
#

But that's what I mean, it makes you use an external plugin to do such a basic function of a BuildTool, or atleast what seems like would be a basic function.

#

It's kinda dumb LOL

karmic grove
ivory sleet
#

Hmm not really

river spear
quaint mantle
#

?learnjava

undone axleBOT