#help-archived

1 messages Β· Page 56 of 1

agile whale
#

The plugin uses it's own fall damage

#

The problem is the player can avoid fall damage by logging out, and logging back in since their noDamageTicks will not be zero, completely avoiding all fall damage

frigid ember
#

is this plugin help?

tiny dagger
#

just an idea

#

what if you calculate the fall distance + what's left till below and apply the damage on quit ? πŸ€”

agile whale
#

That's not how fall damage works though

#

What if a player logs out before going into water?

frigid ember
#

If they do it then kill them, ezpz

#

Same with combat logging

vale slate
#

is this plugin help?
@frigid ember It is coding, server and plugin support, but if you have questions to existing plugins please contact the author, if you want to get a plugin coded please use the forum

agile whale
#

I'm really not looking for some hacky way to apply fall damage to the player. All I wanted to know is why setNoDamageTicks is not working

vale slate
#

setNoDamageTicks was broken eversince 1.8

agile whale
#

So there's no way to set it with the bukkit api? If so why would it still be in the latest version

vale slate
#

there is but setNoDamageTicks is not exactly doing what the method name suggests to be doing

agile whale
#

"Sets the living entity's current no damage ticks." ?

tiny dagger
#

i don't think it's what you're looking for tbh

#

πŸ€”

#

that's only if you take damage

#

it's doing exactly that

vale slate
#

if you'd take a look in the NMS class, no damage ticks is not exacly ticks without getting damaged

small quail
#

Where to rent a free server machine

vale slate
#

in heaven

tiny dagger
#

host it on your own pc, nothing else is free

vale slate
#

there are free hosts, but then you'll *pay *with your personal data

small quail
#

Thanks

pastel basin
#

@agile whale Here at CraftLivingEntity class

  public int getNoDamageTicks() { return (getHandle()).noDamageTicks; }
  public void setNoDamageTicks(int ticks) { (getHandle()).noDamageTicks = ticks; }
#

they should have the same number

vale slate
#

as said noDamageTicks is not exacly what you are looking for

patent monolith
#

@subtle blade i got it

private int getBreakTime(Block block, Player player) {
        net.minecraft.server.v1_15_R1.World world = ((CraftWorld) block.getWorld()).getHandle();
        
        BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
        IBlockData data = world.getType(pos);
        
        net.minecraft.server.v1_15_R1.EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
        
        return (int) (1/data.getDamage(nmsPlayer, world, pos));
    }
#

lol

subtle blade
#

1/hardness?

agile whale
#

That’s the problem though, it’s not correctly setting noDamageTicks

#

Theoretically it should return the number I just set it to

vale slate
#

NMS checks some things before you can set this number

#

wait a second I'll send you the proof

small quail
#

How can I do a permanent IP?

vale slate
#

home hosted?

tiny dagger
#

ask your service provider to make it static

pastel basin
#

buy a domain or use no-ip and its free domains

vale slate
#

But as said, please be careful when hosting a server at your home

#

It has some major security risks if not done properly

tiny dagger
#

always keep your ports closed except 25565 :p

frigid ember
#

Hi one of my friends tried to set up a localhost on their Mac and somehow duplicated every file on their computer

#

They followed the wiki

#

Any ideas

patent monolith
#

@subtle blade it takes into account alot of factors

vale slate
#

whut

#

mac users...

#

||just kidding||

frigid ember
#

I agree with u

#

Idk how they managed

patent monolith
#

I printed it out while breaking a block and I found out that it was 5 times longer when I was in the air versus when I was on the ground

frigid ember
#

@tacit geyser is the idiot who duped every file on their PC whilst attempting to set up a localhost on their Mac

subtle blade
#

Yep. Even more so when swimming

patent monolith
#

It also Increases under water

frigid ember
#

If anyone has any idea please help ! Tyvm (he's on 10 mins timer from joining)

patent monolith
#

It's only took me in entire freaking day

vale slate
#

is the idiot who duped every file on their PC whilst attempting to set up a localhost on their Mac
@frigid ember please mind your language

small quail
#

Thanks

stone fossil
#

is idiot a bad word?

vale slate
#

If you say it to a person, it is an insult

vast arch
#

@stone fossil who cares

stone fossil
#

ah, okay. was just cofused. my mummy doesn't mind me saying

#

MFMKillCrafter clearly does

vale slate
#

In private enviroment I don't mind either, but if you are in a public chat, you should be a little bit more polite. But that's just my opinion

warped shuttle
#

@warped shuttle idiot

small quail
#

πŸ‡­πŸ‡Ί

vast arch
#

@vale slate idiot

frigid ember
#

@vale slate sorry SJW, it was a joke as they're a friend of mine

small quail
#

Why?

vale slate
#

I worked in support for too long to feel insulted, so don't even try. XD

frigid ember
#

Look out boys the local 14 year olds have arrived

patent monolith
#

Lol imagine calling someone sjw

vast arch
#

@vale slate not everything is a personal attack on you

tacit geyser
#

ok 10 mins is up

#

im alright with him calling me an idiot lmao dw

#

but ye downloading it duped by files by 14

#

so i just wrote a python script to delete all dupes

vast arch
#

Trying to fight for the blind elderly people's feelings is a bad cause

tacit geyser
#

thanks for the help !!

frigid ember
#

@vast arch I think more to the point there's a time and a place, when trying to get support from the community, you should show some level of respect 🀷

vale slate
#

@vale slate not everything is a personal attack on you
pinging me for no reason counts as personal attack πŸ™‚

vast arch
#

@frigid ember Respect is earned

#

not handed out like candy

jade mango
#

πŸ‘‹ @vale slate

frigid ember
#

@vast arch and if you want our support, keeping in mind we are not obligated to actually help anyone here at all, I would suggest people show a little bit of respect. Don't forget we don't have to help people with their issues, we choose to

vast arch
#

@frigid ember Good for you πŸ‘

small quail
#

.

patent monolith
#

@frigid ember @vale slate I went ahead and already did this, but right click their user-name and do "Block"

frigid ember
#

Hey, is it a bad time to ask a questionπŸ˜„

#

Fire away

patent monolith
#

people like him are probably under alot of stress and it leaks out in this chat

#

@frigid ember never a bad time πŸ™‚

frigid ember
#

Is it a bad idea to learn Java only for making plugins in minecraft? I already know python so it wouldn't be to difficult to learn Java

#

No it's not a bad idea, it'd work as quite a good way of getting into java to be honest

patent monolith
#

funny thing is, I learned java purely to do minecraft, but then I used it for other things

#

like sable said

frigid ember
#

Before making plugins, I'd only been working with C, C++ and C# really (With some python thrown in the mix)

#

Ok. And how did you jump into making minecraft plugins?

#

What api, libraries, etc

#

There's loads of great entry-level tutorials out there

dusty topaz
#
private static final Pattern pattern = Pattern.compile("[0-9]+-[0-9]+");

... method {

line = "* 1-2% Success Dust"
Matcher matcher = pattern.matcher(line)
System.out.println(matcher.find()) --> false
}

bleh, whats up with my regex

vale slate
#

but please, check the tutorials, because some of them give a shit on every Java convention that exists

frigid ember
#

^ true

#

Lol okπŸ˜„ Thanks guys

patent monolith
#

of course, feel free to come back here along the way

vale slate
#

regex has been my worst nightmare eversince

dusty topaz
#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

patent monolith
#

there should be a system with java that is kind of like pypi and maven; basically just enter the alias for the library and it will be autorecognized in your ide

#

like for example

get-break-delay==1.0.0
protocol-lib==3.2.1
#

I liked the idea of making an entire pypi resource for one specific function

pastel basin
#

there's probably a method in client side

#

aka forge

patent monolith
#

oh for get-break-delay?

pastel basin
#

sadly the packets aren't sent to the server

#

yes

patent monolith
#

oh

#
private int getBreakTime(Block block, Player player) {
        net.minecraft.server.v1_15_R1.World world = ((CraftWorld) block.getWorld()).getHandle();
        
        BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
        IBlockData data = world.getType(pos);
        
        net.minecraft.server.v1_15_R1.EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
        
        return (int) (1/data.getDamage(nmsPlayer, world, pos));
    }

i recently made this lol

spring sapphire
#

Guys

patent monolith
#

hola

spring sapphire
#

Is there any one who can help me in a block.setMetaData thing?

patent monolith
#

sure

#

also go into #text and do !verify <your spigot username>

pastel basin
#

does that calculate when the player is underwater and have aqua afinity enchanted helmet?

patent monolith
#

yes @pastel basin

pastel basin
#

oh sweet

spring sapphire
#

I am trying to create a function to set an owner for a block placed.

patent monolith
#

it is nms, and it is basically what runs whenever you begin to break something

#

well

#

the methods under it

spring sapphire
#

sorryh

vale slate
#

Is there any one who can help me in a block.setMetaData thing?
?ask

spring sapphire
#

public void setBlockOwner(Block b, String name)
{
b.setMetaData("owner", new FixedMetadataValue(MainClassInstance,name));
}

#

That's the function

#

however, the setMetaData is not recognizible

#

cannot resolve 'setMetaData'

vale slate
#

it is Metadata not MetaData

spring sapphire
#

still same error

vale slate
#
b.setMetadata("", new FixedMetadataValue(MainClassInstance, name));

should work

#

or did you import the nms block

#

and not the bukkit one

spring sapphire
#

import org.bukkit.metadata.MetadataValue;

#

?

vernal spruce
#

Yeah

#

all the imports related to it should be bukkit ones

patent monolith
#

@spring sapphire do you want it to save even after the server shuts down?

vale slate
#

import org.bukkit.block.Block; should be somewhere in your import list

spring sapphire
#

Yes, Perzan

patent monolith
#

then dont use that

#

try persistent metadata

vernal spruce
#

Isnt that only for tiles?

spring sapphire
#

setMetaData won't save after shutdown?

patent monolith
#

no

vale slate
#

Blocks can't store Metadata

#

persistent

vernal spruce
#

Im pretty confident you cant store data over restart in a block..

spring sapphire
#

import org.bukkit.block.Block; should be somewhere in your import list
@vale slate I imported it, but nothing changed.

vernal spruce
#

unless a tile like chest...

spring sapphire
#

unless a tile like chest...
@vernal spruce I am working on a chest lock

vale slate
#

then u need to use NBT tags

patent monolith
#

i have two suggestions:

  1. NBT
  2. database
#

or 3. file

vernal spruce
#

or.. make a persistentdataholder system

#

Checking owner value

spring sapphire
#

PersistentDataHolder works for chests?

hallow surge
#

Anyone have an example of a blockgrow event I could use to help me with my project?

patent monolith
#

ah yes

spring sapphire
#

and if yes, what does it return?

patent monolith
#

block state? @vernal spruce

vernal spruce
#

it implements it

patent monolith
#

ayyy!

vale slate
#

Chests are TileEntities, therefore they are working

naive stratus
#

Anyone know of a way to detect when an arrow is removed from an ItemStack in the inventory?

patent monolith
#

@spring sapphire today is your lucky day

#

lol

#

forget what i said earlier

hallow surge
#

@naive stratus on click events?

spring sapphire
#

will PersistentDataHolder return the owner UUID?

naive stratus
#

@hallow surge I want to detect an arrow being removed from the inventory

vernal spruce
#

you can set it to have

hallow surge
#

idk if thats what your looking for

vernal spruce
#

be more specific? when a player shoots a bow?

naive stratus
#

@hallow surge I have an arrow with metadata, I need that on ProjectileHitEvent, but cant get it, since it's not an ItemStack, but an entity.

#

Yes

#

And it does not seem to persist the data in any way. If I pick up the arrow the meta is gone.

vernal spruce
#

Listen to projectilelaunchevent check if its an arrow,check if the bow has infinity and so on

hallow surge
#

^

naive stratus
#

I need to do it through the arrow, not the bow. If possible. I have created a custom arrow type. Not an enchanted bow.

spring sapphire
#

Can I use PersistentDataHolder with eventHandler playerInteractEvent?

vernal spruce
#

why not,here is a model adding data to an item

#

cm.getPersistentDataContainer().set(pl.ciNK.sieverKey, PersistentDataType.STRING, "ssba.siever");

#

you should have the method as well for the block/state

#

also cink.sieverkey is this sieverKey = new NamespacedKey(pl,"ssba.siever");

spring sapphire
#

I am getting error.

#

cannot resolve getPresistentData

vernal spruce
#

there is 1 import for it.. import org.bukkit.persistence.PersistentDataType;

#

buddy i think ur IDE is broken if it can find imports automatically

spring sapphire
#

Yeah, it's imported automatically

#

but still

#

can I show you the function?

vernal spruce
#

Are you casting the block to a chest first?

spring sapphire
#

I don't know

#

public void onBlockPlace(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemStack block = event.getItem();
if (block.getType() == Material.CHEST) {
player.sendMessage(ChatColor.GREEN + "YOU PLACED CHEST!");
block.getPersistentDataContainer().set(player, PersistentDataType.STRING, "owner");
}
}

#

take a look

vernal spruce
#

I asked if you are casting it to a chest before setting the data

spring sapphire
#

I added an if situation to check if the block is a chest

#

but I have no idea how to make it a chest

vernal spruce
#

if(chest.getState() instanceof DoubleChest) { DoubleChest dchest = (DoubleChest)chest.getState();

#

Same for normal Chest

#

"chest" is the block

subtle blade
#

We expect a basic understanding of the language before you make plugins

patent monolith
#

@spring sapphire ```java
private NamespacedKey owner_key = new NamespacedKey(plugin, "Chest Owner UUID");

private void setOwner(Chest chest, @Nullable UUID owner) {
    PersistentDataContainer container = chest.getPersistentDataContainer();
    
    if (owner == null) {
        container.remove(owner_key);
    } else {
        container.set(owner_key, PersistentDataType.STRING, owner.toString());
    }
}

@Nullable
private UUID getOwner(Chest chest) {
    PersistentDataContainer container = chest.getPersistentDataContainer();
    
    String raw = container.get(owner_key, PersistentDataType.STRING);
    
    if (raw == null) return null;
    
    return UUID.fromString(raw);
}
vernal spruce
#

Ahh yes,spoon feeding at its finest πŸ˜‚

patent monolith
#

I wanna keep them interested lol

vernal spruce
#

You shouldv seen me get excited when i made my first plugin with no feed code πŸ˜‚

#

then they will get interested

patent monolith
#

the messiah

spring sapphire
#

I actually red the code and I felt like I wanna delete the IDE and never try again lol

patent monolith
#

welp

vernal spruce
#

its actually not hard just that you skipped some important steps in the java tutorials

patent monolith
#

im going to delete my life and never try again

spring sapphire
#

don't get me wrong Perzan

patent monolith
#

later πŸ˜‚

#

lol jk

vernal spruce
#

Also most of us do it for fun/hobby

spring sapphire
#

my IDE is just "I DON'T KNOW WHAT CHEST IS, SO GET OUT"

vernal spruce
#

what ide?

patent monolith
#

is it on buildpath?

#

spigot

spring sapphire
#

Intelji

vernal spruce
#

strange didnt have a problem with it yet

#

it always autosuggest casting and correct imports

patent monolith
#

try manual imports i guess

#

for testing ofc

#

not in the long run

lilac echo
#

guys does anyone know how can i disable this message

spring sapphire
#

@patent monolith that's my IDE

vernal spruce
#

I did however met a problem where intellij for w/e reason didnt know java.utils.List existed

#

but it autosuggested to change to it??

frigid ember
#

Eclipse gang rise up

patent monolith
#

did u restart it?

#

lol yes eclipse gang

tiny dagger
#

you prob are mistaking aws with the util one

patent monolith
#

we need :eclipse:

vernal spruce
#

thats what i mean

#

it wont find the java util

spring sapphire
#

does eclipse have a minecraft plugin?

frigid ember
#

Doesn't need it

#

lmao

spring sapphire
#

For a beginner, I guess I need it

vernal spruce
lilac echo
#

@atomic rapids

vernal spruce
#

Still doesnt know java.utils one exist LUL

lilac echo
#

how can i disable this message from console

vernal spruce
#

I mean is your own plugin?

spring sapphire
#

@patent monolith excuse my stupidty, what you gave me is not the full code, correct?

vernal spruce
#

looks like a debug

patent monolith
#

its just some methods for you to use in your code

vernal spruce
#

no he gave you some methods to easly call

spring sapphire
#

I get it

patent monolith
#

when you have a Block instance, make sure to check if it is instanceof Chest

spring sapphire
#

but why the hell my IDE is just rejeceting these methods

#

and making chest red

vernal spruce
#

@patent monolith that @Nullable Kapp

#

at the UUID

patent monolith
#

bet

spring sapphire
#

I give up

vernal spruce
#

He covered too much of bukkit...

spring sapphire
#

I will check him

#

I shouldn't have started before doing that, thought C++ knowledge is enough lol

vernal spruce
#

its not much different than java

spring sapphire
#

I know, that's why I just rushed in

vernal spruce
#

but i still think you are missing some important parts... like casting

spring sapphire
#

I will watch the source code videos

#

hopefully can be ready tomorrow

#

thank you

#

Time to install eclipse

subtle blade
#

we need :eclipse:
@patent monolith

patent monolith
#

:pepeEclipse:

#

i

subtle blade
#

Mine

#

I just threw it into photoshop and made it real quick lol

vernal spruce
#

Yeah gonna change back to eclipse

patent monolith
#

for some reason my other nitro emotes wont work here lol

vernal spruce
#

after i finish this plugin

patent monolith
#

:aspoggies:

vernal spruce
#

i dont like intellij πŸ˜‚

pastel basin
#

I used both for a long period of time and for me intellij is better, at least for me

#

it is easier to configure and prettier to look

frigid ember
#

@pastel basin Eclipse themes exist πŸ˜‰

pastel basin
#

I am not talking about themes, its the UI in general, Intellij feels more modern

frigid ember
#

Idk, to me, Intellij is like discord and Eclipse is teamspeak

pastel basin
#

lol

frigid ember
#

And I still prefer teamspeak lmao

#

Maybe I'm just old school idk lmao

vagrant widget
#

Hello

tacit geyser
#

hey so i'm downloading spigot on mac, i've done the whole
#!/bin/sh

cd "$( dirname "$0" )"
java -Xms512M -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot.jar nogui
and i've put a space between it and the chmod a+x but it still doesn't do anything

waxen notch
#

Hello everyone! I've installed the Spigot server on my linux machine. How do I install a texture packet and where do I find them? I've looked at the Resources page on the Spigot website, but it yielded nothing.

vernal spruce
#

Its more towards vanilla minecraft server rather than spigot

waxen notch
#

Thanks a lot

vernal spruce
#

Is this considered a GET to a url? `String surl = getConfig().getString("UrlToCall");
try {
URL url = new URL(surl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();

            } catch (IOException e) {
                getServer().getConsoleSender().sendMessage(ChatColor.RED+"[StartupHTTP]Found wrong or missing link to call!");
            }`
frigid ember
#

Are there plugins where the player cannot place blocks on top of chests?

tiny dagger
#

pretty sure there should be

bitter tendon
#

Is it possible to have tooltips on tabCompletion suggestions?

subtle blade
#

The TabCompleter supports it

bitter tendon
#

ooo

#

How does it work?

pastel basin
#

it works the same as the command api

#

you just return the possible tooltips in a list when the player tries to autocomplete it

bitter tendon
#

Are you refering to the purple outlined minecraft tooltip?

golden chasm
#

Hey, sorry. Not sure if this question fits here, but on my server clearlag is reporting that the end and the nether both have 529 chunks loaded, and the overworld has around that many extra loaded as well. I'm thinking that this might be affecting the tps on the server. TIA

fleet crane
#

thats the spawn area which is always loaded

#

(unless disabled by a plugin)

dusty topaz
#

when I do inventory#getItem(n) and an item isn't there, is the itemstack null or is it type material.air

#

because I always check both but I want to increase performance (lol, more like code readability)

fleet crane
#

who knows, Bukkit isnt very consistent about that unfortunately

vernal spruce
#

it returns null most of the time

#

usually null checking work

dusty topaz
#

πŸ‘ ty

frigid ember
#

how do i enable so, when i wear the armor piece i get the effect instead of just whnr its in my incentory?

vernal spruce
#

1 method and from there u should be good to change it based on what you need

#
            ItemStack helmet = p.getInventory().getBoots();
            if(helmet==null){
                return;
            }
            if(!helmet.hasItemMeta()){
                return;
            }
            if(!helmet.getItemMeta().hasLore()){
                return;
            }
            List<String> lore = helmet.getItemMeta().getLore();
            for(String s : lore){
                if(s.contains(ChatColor.stripColor("Infused with Speed"))){
                    p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,5*20,1));
                }
            }

    }```
#

ignore the name..

#

too lazy to replace "helmet" with "boots"

frigid ember
#

do i put that in my item class?

vernal spruce
#

you use this as a guide

#

not as feed code

dusty topaz
#

pls use ```

#

:(

#

hurts the eyes

vernal spruce
#

yeah it screwed it

#

there we go

#

And that method gets called every potion time -1

#

so it makes an infinite effect as long as its equipped

frigid ember
#

wait

#

but i thought infinite was 1000000

vernal spruce
#

you dont add an effect with infinite amount

#

you add it just longer than the check

frigid ember
#

so would 999999 work?

vernal spruce
#

to avoid just equiping armor,get the infinite effect then get it off

#

oh boy..

#

so i check every 4 seconds and i add the effect for 5

#

i think you get what this does..

frigid ember
#

oke ty

#

i hope i understood that correctly tho

sage wigeon
#

Hello! How can I make an entity only visible per player?

#

So far as I could read is using packets (with the ProtocolLib)

pastel basin
#

I don't know how to do it with protocol lib but I know you can spawn an entity to a specific player using nms packets

sturdy oar
#

Filter outgoing packet

#

And just send them to the specific player

#

I remember doing this a long time ago with NMS, honestly no idea how ProtocolLib would implement that

sage wigeon
#

Well, I'm kinda new to plugins... So I might confused it a bit

#

And thanks for the fast response!

green epoch
#
> ./start.sh: line 1:  7833 Killed                  java -Xms2048M -Xmx3700M -jar server.jar nogui
[root@minecraft-anarchy-server minecraft]#

randomly happens after like 1 or 2 days

sturdy oar
#

Omg

green epoch
#

running it on screen and it just gets killed

sturdy oar
#

that's like the worse flags and setup I've seen

#

You're literally running a server as root and with improper flags

green epoch
#

what's wrong with running a server as root?

sturdy oar
#

😩

green epoch
#

and which flags are wrong

dusty topaz
#

if you run a server as root my plugin can rm -rf /

#

:D

sturdy oar
#

You're not using any garbage collector for the JVM

green epoch
#

yeah i know but if u run it as sudo can't it rm -rf too?

dusty topaz
#

then dont run it as sudo or root

sturdy oar
#

Not to mention non matching flags

green epoch
#

or how are u supposed to run it

dusty topaz
#

with permissions to modify self contents

#

and thats all

green epoch
#

just as a normal user?

#

k

dusty topaz
#

even that is risky

sturdy oar
#

just make a user without sudo permissions

bleak osprey
#

hey,

i can not connect to other servers on a bungee network.
I only get to the lobby server.

i entered the IP and port of the servers at the Bungee config, set online-mode to false and set bungee in Spigot and paper.yml to true

#

whats the matter?

green epoch
#

@sturdy oar so what do i change the flags to

sturdy oar
#

And use proper JVM flags

green epoch
#

or what's wrong

bleak osprey
green epoch
#

/what do i add

sturdy oar
#

From the startup scripts

green epoch
#

just give me a hint so i can do some research ty

#

kk il see cause i got those from the minecraft wiki i think

#

(changed min and max memory values ofc)

pastel basin
#

let me see if I remember the command

sturdy oar
#

java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=8 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=”https://mcflags.emc.gs” -Daikars.new.flags=true -jar spigot.jar nogui these were made by aikar

pastel basin
#

?setup

#

nah

sturdy oar
#

They weren't tested on spigot but they should work great as well

green epoch
#

alright ty

#

so the process getting killed could be because the JVM garbage collector has no memory?

pastel basin
green epoch
#

yeah ty

sturdy oar
#

Those are spigot flags you sent

#

What I've sent are mainly jvm and garbage collector tweaks

pastel basin
#

its in the middle of the page

sturdy oar
#

Yeah I'd not recommend those πŸ˜‚

bleak osprey
#

team?

green epoch
#

ok so

#
[notroot@minecraft-anarchy-server minecraft]# ./start.sh 
./start.sh: line 1: 25913 Killed                  java -Xms3000M -Xmx3000M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=8 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=”https://mcflags.emc.gs” -Daikars.new.flags=true -jar server.jar nogui```
#

modified it slightly

#

it just kills the process

frigid ember
#
> [23:55:41 WARN]: [SellChest] Task #186 for SellChest v1.1.2 generated an exception
java.lang.RuntimeException: Economy username cannot be null
at com.earth2me.essentials.api.Economy.getUserByName(Economy.java:67) ~[?:?]
at com.earth2me.essentials.api.Economy.playerExists(Economy.java:378) ~[?:?]
at net.milkbowl.vault.economy.plugins.Economy_Essentials.hasAccount(Economy_Essentials.java:289) ~[?:?]
at net.milkbowl.vault.economy.AbstractEconomy.hasAccount(AbstractEconomy.java:10) ~[?:?]
at codes.biscuit.sellchest.hooks.HookUtils.addPlayerMoney(HookUtils.java:199) ~[?:?]
at codes.biscuit.sellchest.hooks.HookUtils.giveMoney(HookUtils.java:148) ~[?:?]
at codes.biscuit.sellchest.utils.Utils.lambda$runSellTimer$0(Utils.java:99) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[beerspigot.jar:git-TacoSpigot-bf023c7d]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:349) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:794) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:422) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:724) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:627) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
#

Anyone know what could be causing this?

green epoch
#

although i am not experienced with java and i might just be talking shit,
java.lang.RuntimeException: Economy username cannot be null
your plugin does not check if that string is null which causes the exception

frigid ember
#

It's not my plugin, shit,,,

subtle blade
#

Essentials & Vault not playing nicely together

#

If you're using EssX, contact them. If you're not, do that. Or just don't use Essentials because it really isn't an essential plugin

#

It's bloatware

near lodge
#

If you're using EssX, contact them. If you're not, do that. Or just don't use Essentials because it really isn't an essential plugin
@subtle blade Couldn't have said it better myself

#

Back in the day it was amazing

#

it went downhill

subtle blade
#

It was never great to begin with. My biggest gripe with that plugin is its insistence on overriding vanilla commands. why

#

The amount of times I've had to answer "/give @p diamond_sword" isn't working is ridiculous

pastel basin
#

true, tp and kill commands were completely unnecessary

near lodge
#

yes

#

and ugh

#

The amount of times I try to type /kill @e[type=x] or something of some sort then have to change to /minecraft:kill are too many of my liking

#

and also /tp ~ ~10 ~

crimson sandal
#

Is there a way to get the current hopper rate using the API or should I just read spigot.yml?

subtle blade
#

Server.spigot().getConfig()

crimson sandal
#

Nice πŸ‘Œ

#

My plugin makes use of a custom hopper implementation for virtual inventories and I never considered the fact that the hopper rate could change lol

dusty topaz
#
        int size;
        if (emotes.size() <= 9) {
            size = 9;
        }
        else if (emotes.size() <= 18) {
            size = 18;
        }
        else if (emotes.size() <= 27) {
            size = 27;
        }
        else if (emotes.size() <= 36) {
            size = 36;
        }
        else if (emotes.size() <= 45) {
            size = 45;
        }
        else {
            size = 54;
        }
#

Is there a nice way to do this

bronze marten
#

Divide by 9, round up, times 9 again?

red zenith
#

that's what i was thinking

#

if you need to, you can clamp it to 54 if it's above 45. Unless you assume it'll never go above 54.

dusty topaz
#

nah it's unlikely just wanted it handled

#

just for an emote menu

red zenith
#

So something like this then.

size = (int)Math.ceil(emotes.size() / 9.0f) * 9;
dusty topaz
#

lovely

#

thank you

fleet crane
#

From stack overflow

#

Avoids floating point math

dusty topaz
#

i'm caching the inventory and the last calculation is made at plugin load up

#

so i prefer the readability i think

frozen cedar
#

How do you rotate a shulkerbox?

pastel basin
#

How do you rotate a shulkerbox?
@frozen cedar Entity#teleport(Location)

frozen cedar
#

How about shulkerbox block -> entity?

pastel basin
#

oh sorry

#

I havent slept in 25hrs

frigid ember
#

how do u make it so when u put the item stack armor on it gives u the potion effect but when its not on take the potion effect off?

#

:/

dusty topaz
#

@frozen cedar do you not rotate it as you would any other block

frozen cedar
#

How would you do it for any other block?

dusty topaz
#

hang on let me check its correct first

#

i think it counts as a chest

#

you get blockData and set facing

pastel basin
frozen cedar
#

Ah Directional

#

Alright, thank you

frigid ember
#

how do u make it so when u put the item stack armor on it gives u the potion effect but when its not on take the potion effect off?

pastel basin
#

listen for inventory click events -> add or remove effect

frozen cedar
#

I would personally abstract it and make a PlayerEquipArmorEvent

frigid ember
#

i have 4 armor pieces executing commands do i need to make a seperate class for the listener?

frozen cedar
#

?

#

You just need a class that implements listener

frigid ember
#

but i have 4 classes each with one command to get an itemstack

frozen cedar
#

What do the commands do exactly?

frigid ember
#

give you an item

frozen cedar
#

Ok how is that relevent to listening to armor equiping?

frigid ember
#

becaue its an armor piece

#

i want so when u wear the armor u get the potioneffect

#

instead of just when its in your inventory

frozen cedar
#

Ok, so you just give the armor metadata when they do the command and then have one listener

frigid ember
#

how do you learn bukkit?

pastel basin
#

find a way to listen to armor equip and add the effect, then find a way to listen to armor unequip and remove the effect

frigid ember
#

im not understanding anything :/

frozen cedar
#

When they equip the armor look for the metadata in the listener

#

And based on that metadata do y

frigid ember
#

:/

lavish bolt
#

How do I install plugins to my server? I'm using a debian linux VPS to run my server and keep getting error codes when trying to wget. Any help is appreciated.

pastel basin
#

download plugins at spigotmc.org and drop em in your plugins folder

twin torrent
#

Well he's on a server so there probably isn't a GUI..

#

What error code when you do wget?

lavish bolt
#

I'm using ssh. I get a 503, Service Temporarily Unavailable.

#

It worked just fine when trying to install paper.

twin torrent
#

What's the command you are using?

frigid ember
#

If I want to broadcast a textcomponent to all online players, I'll probably have to loop through all online players and do player.spigot().sendMessage, huh?

pastel basin
#

yes

frigid ember
#

how would i make it where people leave and auto go to the hub server?

lavish bolt
#

wget [url]

subtle blade
#

If I want to broadcast a textcomponent to all online players, I'll probably have to loop through all online players and do player.spigot().sendMessage, huh?
@frigid ember server.spigot().broadcast(TextComponent)

frigid ember
#

hehe was just reading that

#

which does the same thing, but makes my code cleaner, thanks spigot ❀️

twin torrent
#

What's the URL you were using though

subtle blade
#

Yea, I mean you could one-line Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(textcomponent));

#

Though broadcast() is a bit nicer

blazing swallow
#

Sorry to ask, but is it true that the hiring post will need to wait a 48-hour moderation period?

subtle blade
#

Sometimes longer but yes

blazing swallow
#

Thank you

subtle blade
#

They're all manually reviewed by just one person

blazing swallow
#

Ah I see

vernal plank
#

Is there a way to build a 1.16 snapshot version of spigot through buildtools currently?

keen moth
#

No

vernal plank
#

Alright

lavish bolt
#

How do I install plugins to my server? I'm using a debian linux VPS to run my server and keep getting 503 error code when trying to wget. Any help is appreciated.

fleet crane
#

youc ant wget plugins

#

upload them from your PC

wheat spindle
#

Hello, so i just got the bedwars plugin and im sonfused on hwo to get 2 worlds on one server, btw we are using aternos

fleet crane
#

I suggest you read the instructions for the plugin

#

you might need an additional plugin like Multiverse-Core to get another world

pastel basin
#

install a world management plugin

wheat spindle
#

Ok, thanks

frigid ember
#

how do u make it so when u put the item stack armor on it gives u the potion effect but when its not on take the potion effect off? minecraft bukkit plugin btw also pls give an event listener example pls and ty

#

i suck at understanding lol

pastel basin
#

you already asked this about 10 times and we gave you the answer..

frigid ember
#

uhh

#

D:

#

lol

pastel basin
#

we're not spoonfeeding code, as I said before you need to listen when a player equips an armour, probably with InventoryClickEvent and add or remove your effects

frigid ember
#

wait so under the inventory click event u put the potion effect?

pastel basin
#

yes

frigid ember
#

oh

#

ok now i understand lol

#

ty

pastel basin
#

you should probably listen for PlayerInteractEvent and InventoryMoveEvent as armor can be equipped when a player right click and through dispensers

frigid ember
#

You'd be best off creating a "ArmorEquipEvent" that is called within those events, keeps all the messy part in one place

subtle blade
#

You'd be best off creating a "ArmorEquipEvent" that is called within those events, keeps all the messy part in one place
One is being PR'd. Just under its final review. Should be merged sometime soon into Bukkit

#

PlayerArmorChangeEvent

pastel basin
#

thankfully

#

how can I make a pull request for bukkit?

frigid ember
#

I'd wait for that then

subtle blade
#

?stash

worldly heathBOT
subtle blade
#

?cla

worldly heathBOT
subtle blade
#

Sign the CLA, takes up to 24 hours or so to be approved. After which point you have access to pull requests

#

Fork, make changes, pull request. The usual

wary spoke
#

?help

copper herald
#

Hello

#

I need a help, after long time I came back to play minecraft and ofcorse I like do it on my server, so I used to bukkit server a years ago but now I installed the spigot, all good, server is running, but please can you remind me how do I install the plugins (Timber Plugin trying to but won't work)? Regards!

golden vault
#

Put the plugin in the plugins folder then restart. If it does not load, link a pastebin of the startup log.

wheat spindle
#

When i used the bedwars plugin, i restarted the server and the arena deleted even though i saved it. Not the world, but when i do the arena command it adds a new one. I spent like 2 hours coding everything and its all gone. Is this a glitch or what?

golden vault
#

You will probably have to ask the bedwars author.

shy birch
#

Hi I’m having trouble with the chat of my server Im using essentials chat but the /mute doesn’t work I don’t why cause the muted players can write message and when someone join the server can write messages without login

#

Can anybody help me?

copper herald
#

oh it did load, but did not work maybe because I forgot to use an axe, lol: [04:23:31] [Server thread/INFO]: [Timber] Enabling Timber v1.0.7
[04:23:31] [Server thread/INFO]: Timber Log Materials: [SPRUCE_LOG, BIRCH_LOG, ACACIA_LOG, DARK_OAK_LOG, OAK_LOG, JUNGLE_LOG]
[04:23:31] [Server thread/INFO]: Timber Axe Materials: [STONE_AXE, GOLDEN_AXE, WOODEN_AXE, IRON_AXE, DIAMOND_AXE] ------ but maybe you would know how to make it work with hands or whatever else instead of only AXE?

golden vault
#

idk you will have to ask the author of the Timber plugin.

copper herald
#

thank you, anyway main think now is that all is working, thank you for a quick respond!

bitter tide
#

Hi, I bought a plugin and apparently it had a problem and it was not bought, but if my money has consumed me

#

@loud kindle

humble hollow
#

check paypal and make sure its not pending in paypal or wasnt declined

golden vault
#

give it 24-48 hours and if you still dont have it you will need to contact the author.

tropic nacelle
#

or just ping the author

humble hollow
#

if they are even in here ^

tropic nacelle
#

ye, if they are here, what plugin did u buy @bitter tide

#

let's ping him 2gether

#

delete that lmao

humble hollow
#

i didnt understand anything in that image

tropic nacelle
#

shame, the author aint here

golden vault
#

don't post transaction details in a public chat

tropic nacelle
#

mfw premium plugins has a donation link.

#

Β―_(ツ)_/Β―

humble hollow
#

Zombies Minigame | [1.8-1.15]

#

i believe is the resource

bitter tide
#

Sure?

#

Do I have to speak to the plugin author then?

tropic nacelle
#

yes, DM him

humble hollow
#

if you dont get it within 24-48 hours, yes

#

@tropic nacelle the author isnt in here, so we cant ping him 😦

bitter tide
#

But I'm supposed to give it to you right now, not in a day 1 or 2

humble hollow
#

depends on your bank

bitter tide
#

It has never happened to me with any other plugin

humble hollow
#

if its pending, you will have to wait

bitter tide
#

But I bought it with paypal

tropic nacelle
#

I literally said that minutes ago legoman

humble hollow
#

@bitter tide wait 24-48 hours and you should get it without pinging the author

bitter tide
#

It is not normal

golden vault
#

the author may have to manually approve it, some author have it setup that way.

humble hollow
#

^

bitter tide
#

So do I have to speak to the author?

humble hollow
#

he will probably see it when he wakes up

golden vault
#

^

manic raptor
#

Hey guys, how can I get the Player who spawned a mob from the EntitySpawnEvent?

pastel basin
#

how can a player spawn a mob?

manic raptor
#

using a spawn egg

tiny dagger
#

using an egg spawner

pastel basin
#

then listen for PlayerInteractEvent

#

check if the action is right click and if the item is an egg spawner

#

there isn't a way to get the player through EntitySpawnEvent

manic raptor
#

Right, cheers! Can I get the entity spawned using the PlayerInteractEvent?

frigid ember
#

Just check the type of egg

pastel basin
#

yes, through the egg spawn material type

frigid ember
#

??

manic raptor
#

Ah right, thanks very much! πŸ™‚

ivory musk
#

How do you make an empty ItemStack? I've tried making an ItemStack of Material.AIR with quantities of 0 and 1, I've tried making a normal ItemStack with a quantity of 0, and I've tried setting an item slot to null, but they all result in a java.lang.AssertionError: TRAP.

pastel basin
#

didn't new ItemStack(Material.AIR) work?

ivory musk
#

Nope, that resulted in the same TRAP error.

#

I'm using Spigot 1.15.2, if that helps.

#

I'm trying to get this to work with PlayerInventory#setItemInMainHand() and PlayerInventory#setItemInOffHand(), but it's resulting in the error for both.

frigid ember
#

Is it nullalbe?

#

setItemInMainHand​(@Nullable ItemStack item)

#

null it

ivory musk
#

Yes, it is @Nullable.

frigid ember
#

should fix your issue

ivory musk
#

Yeah, I just tried nulling it. Same AssertionError.

frigid ember
#

hm

ivory musk
#

But I checked the CraftBukkit patches, that TRAP error should only come up if the ItemStack is a Material.AIR.

#

That's why I'm a little stuck here. πŸ˜›

tiny dagger
#

i think trap is when you're trying to click something that doesn't exist

#

maybe try to cancell player interact? πŸ€”

frigid ember
#

^

ivory musk
#

This is actually in a PlayerInteractEvent, I'm trying to make it so that when you right click an item it reduces its quantity.

frigid ember
#

Can you show us your entire method?

#

?paste

worldly heathBOT
ivory musk
#

Yeah, it's a little huge, though, I'll have to trim it down a bit. πŸ˜›

unreal hedge
#

@manic raptor PlayerInteractEvent is what you want. But don't you want to consider when players use dispensers to spawn them as well?

ivory musk
#

What if I tried PlayerInteractEvent#setCancelled()?

tiny dagger
#

that should work imo

unreal hedge
#

You'd want to cancel it under the right conditions, not altogether x)

tiny dagger
#

yeah

ivory musk
#

Yeah, I noticed that it kind of screws up eating food at the same time, for example.

#

shootHatchet() is just some NMS magic. πŸ˜›

tranquil rampart
unreal hedge
#

Wait, so you want to cancel the monster from spawning and do something else? Does you want it to do the same thing regardless of which hand it is in? Or does it do something different in the left/right hand?

ivory musk
#

It does something slightly different in each hand. Mostly different sound effects.

#

So, come to think of it, I could just condense it and use the action with a ternary operator or something to change the sound, but this works for now.

frigid ember
#

So, you can't remove an item while it's active in an event from what I understand

tiny dagger
#

yup

frigid ember
#

You'd have to start a runnable that waits like .1 of a second then removes it

unreal hedge
#

Just use || and merge them, then check which one when you're playing the sound.

frigid ember
#

so the event finishes, then the item is removed

unreal hedge
#

You could save quite a few lines of code.

ivory musk
#

Yeah, just thought about that.

frigid ember
#

that should solve your issue

ivory musk
#

Alright, I'll try putting it a 1-tick runTaskLater(). Hopefully that should be enough.

unreal hedge
#

Also, it looks so much neater if you just do for instance if(!(inv.getItemInOffHand.isSimilar(AuroraItems.hatchet(1)) || inv.getItemInMainHand().isSimilar(AuroraItems.hatchet(1))){ return; } then do else if else if.. return. You'll probably save even more lines that way as well.

sharp dew
#

I tried to edit the craftbukkit code to add a way to change the player sample inside the ServerListPingEvent without using packets, but I need to edit the file PacketStatusListener but this causes a conflict with the spigot patch "0045-Configurable-Ping-Sample-Size" and i get the error in the image. I tried to manually modify the patch files but i get an error that says "Did you manually modified the patch?". Also i want to compile only craftbukkit and not spigot, is there a way to skip this phase. sorry if this was hard to follow

unreal hedge
#

Also, you use player.getUniqueId() various times, make a variable.

ivory musk
#

Yep, I've done that in some other events. Usually what I try to do is avoid more complex stuff like that and get something working, and then I condense it down much more.

sharp dew
unreal hedge
#

When you make your code cleaner, bugs/errors are so much easier to spot.

ivory musk
#

I've had way too many instances occur where I've done something like that and the code ends up not working and I blame it on the stuff itself. πŸ˜›

manic raptor
#

Hi all, I asked a question here about 30 mins ago and am a bit stuck with a similar problem.
I'm trying to find a way to get the Player, and an ArmorStand that a Player spawns when they place down an Armor Stand.

BlockPlaceEvent only runs for placing ArmorStands under very specific circumstances, such as placing it on grass where the grass is replaced with an Armor Stand.
EntitySpawnEvent does not have a way to access the Player,

which leaves PlayerInteractEvent. My plugin is for spawning NPC players, and I want to be able to get the direction that the armor stand is facing when the Player places it down(So I can spawn the Player facing that direction). Is there a way I can get this in the PlayerInteractEvent?

ivory musk
#

You could get the player, grab their location, and then get their yaw. You can use their yaw and invert it to determine the direction. I forget the exact specifics but I've done something similar before.

pastel basin
#

you would need to listen to EntitySpawnEvent and PlayerInteractEvent

frigid ember
#

It faces the player directly right? So you can just reverse the yaw?

manic raptor
#

I've used the direction as one example, but Ideally I'd like to get the entity too; but that's a great way to do the direction

ivory musk
#

Well, realistically, a yaw of 0 would reverse to a yaw of 180/-180.

#

That would work for a 90/-90 degree inversion, but that's about it.

#

What you can do is get their direction as a vector, multiply the vector by -1, and then do a Math.toDegrees() of the x value of the vector and use that as a yaw I think.

frigid ember
#

Would it be easier if you were to convert them to radians, work it out then reverse back?

#

I might be chatting complete shit, haven't slept in a while lmao

manic raptor
#

I should note, I don't want this to work for all Armor Stands, only for Armor Stands that have been summoned in via a command, which I've specified by them containing a custom data key with PersistentDataContainer. This means that when the Player spawns the ArmorStand, I need access to the item in their hand.

knotty karma
#

I am almost certain this exists but I am probably searching for the wrong things - Is there a method that I can use to trigger a bonemeal use event at a certain location?

manic raptor
#

By the looks of it as you said @pastel basin , the solution is to listen for both EntitySpawnEvent and PlayerInteractEvent, but how I might I go about sharing information between these two events?

ivory musk
#

You can store the information in the Listener class.

frigid ember
#

Create the armour stand entity, spawn it then alter it? Seeing as you'll still have access to the entity no?

pastel basin
#

^

frigid ember
#

Removing the need for listening to the spawn event?

pastel basin
#

cancel the playerinteractevent and spawn the armor stand yourself

frigid ember
#

if you only want to get it if it's spawned via a command you don't need to listen for anything?

#

You just need your command executor?

manic raptor
#

Just gimmie 1 sec...

pastel basin
#

if you only want to get it if it's spawned via a command you don't need to listen for anything?
in that case entityspawnevent would be necessary

frigid ember
#

Why? Seeing as he's creating the entity, spawning, then altering, he can do it all without listening for the event?

pastel basin
#

but you said you want to check when players use armor stand item, right?

frigid ember
#

I should note, I don't want this to work for all Armor Stands, only for Armor Stands that have been summoned in via a command, which I've specified by them containing a custom data key with PersistentDataContainer. This means that when the Player spawns the ArmorStand, I need access to the item in their hand.
@manic raptor
This contradicts

Hi all, I asked a question here about 30 mins ago and am a bit stuck with a similar problem.
I'm trying to find a way to get the Player, and an ArmorStand that a Player spawns when they place down an Armor Stand.
@manic raptor

pastel basin
#

Why? Seeing as he's creating the entity, spawning, then altering, he can do it all without listening for the event?
if you want to check for when an armor stand is spawn by command or any other way, even by another plugin you would need entityspawnevent

frigid ember
#

Pretty sure he's spawning the entity and then trying to get said entity

pastel basin
#

if you have your own command just do it all yourself

frigid ember
#

Not trying to get an entity spawned somewhere else

pastel basin
#

spawn the entity and get it, pretty straight foward

manic raptor
#

Let me clarify it all:
I've got the plugin working by spawning via a command. eg. /npc spawn <name> <x> <y> <z> <direction>
This all works well ^

I'm now trying to add a more "user-friendly" way to spawn npcs in, in bulk.
To accomplish this, typing /npc armorstand <name> will give you a special ArmorStand, that has a custom key, and the value is the string name (Using PersistentDataContainer and NamespacedKey).
I've done it this way so that regular armorstands can still be used without creating npcs.

I want it so that:
When you place down an ArmorStand only when using an ArmorStand given with the command, it spawns an npc that faces the same direction that the spawned in armorstand would have.

#

The problem with this, is that the special custom key is stored in the Item, in which you would need access to the Player's item in hand.

frigid ember
#

You'd be better off giving it an identifier, listening for the interact event, seeing if it's that item, if it is run the command you've already created as the player

#

Nothing fancy, just give it a custom lore, on interact, check if it has that lore, if it does then force the player to run the command

manic raptor
#

But how would I go about getting the Armorstands direction from just the PlayerInteractEvent?

pastel basin
#

In PlayerInteractEvent check if the player used the item with your persistent data and cancel the usage of this item, then spawn the armor stand in the clicked block and get direction from there

frigid ember
#

Spawn it, then get the body pose

#

that'll give you an EulerAngle

#

which is the x,y,z

manic raptor
#

Thanks for the help by the way guys :)
When you say spawn it, is this still in the PlayerInteractEvent? Wouldn't I need to create a new ArmorStand, (where does the direction come from)?

ivory musk
#

Wait, what is an NPC?

frigid ember
#

Yeah, what I'd do is move the spawning to a new method, call that method on command and on interact, it'll be more manageable

#

Set it to where the player is looking?

manic raptor
#

I do actually do that ^^

#

but I'm passing the direction(yaw of the npc)

frigid ember
#

Yeah, I'd just get the player's yaw and use that

#

Presume you're thinking of having a way to manipulate the stand using commands?

manic raptor
#

Basically what I wanted to do, was by getting the ArmorStand entity, I could grab the direction and then convert it into a yaw to pass into my function.

frigid ember
#

Ah

#

I see

manic raptor
#

The ArmorStand itself will actually be deleted, or the spawning of it will be cancelled. I've got an NPC class to handle the EntityPlayer.

ivory musk
#

So an NPC is not an ArmorStand but an EntityPlayer?

manic raptor
#

Using the ArmorStand as an item, just makes it more user-friendly to spawn them in.

ivory musk
#

That makes things a lot simpler, you don't even need to use an ArmorStand entity, then.

frigid ember
#
  Location newLoc = armorStand.getLocation()
  newLoc.setDirection(target.getLocation().getDirection());
  armorStand.teleport(newLoc);
manic raptor
#

@ivory musk yeah, that's right.

frigid ember
#

target being the player

#

Or just add 180 to the players yaw and call it a day

#

lmao

manic raptor
#

@frigid ember might actually do that LOL

frigid ember
#

Give it a go

#

if it works then yipee

#

lmao

ivory musk
#

But would a 360 degree yaw work?

frigid ember
#

Fuck knows

#

never tried

#

give it a go

#

can't hurt

ivory musk
#

If your yaw was 180, you'd want a yaw of 0 to match with what the game expects. I'm not sure if Bukkit actually looks at 360 as 0.

manic raptor
#

I'll just cap it back round by subtracting 360 if it goes over 180

#

or adding 360 if it goes under -180

ivory musk
#

What you can do is this.

#
float newYaw = (player.getLocation().getYaw() + 180) % 360;
#

I think.

frigid ember
#

I wonder how citizens does it

#

because those NPCs spawn facing the player

ivory musk
#

Isn't Citizens open source?

#

Yeah, Citizens2 is open source.

frigid ember
#

Actually tell a lie, they spawn it on the players location

#

which is the other option, just spawn it on the player facing the same direction as the player

#

would save all the hassle

#

@manic raptor

fleet crane
#

protip, Location.normalizeYaw

#

Minecraft is otherwise all over the place with directions

frigid ember
#

Didn't even realise that was a thing, that's really handy (not done much with NPCs)

ivory musk
#

Huh, didn't know Spigot had a utility for it. Sounds really handy.

frigid ember
#

@manic raptor there you go, add 180 then normalize it

manic raptor
#

@frigid ember
Cheers for the help! πŸ˜„

frigid ember
#

That's on @fleet crane didn't even know that was an option until he mentioned it πŸ˜„

edgy sail
#

ikr, I was going to make a similar implemention later on today..

trim void
#

hey anyone knows portforwarding here?

#

i have a silly doubt...

fleet crane
#

Yes what specifically are you having issues with

#

Theres 100000 tutorials on it

trim void
#

are you bot?

fleet crane
#

Beep bop bzzzt

trim void
#

ok i mean is portforwarding one time process?

fleet crane
#

Usually, if your ip doesn’t change

trim void
#

i mean after port forwarding and connecting the minecraft server do i need to have my lap connected to the router always?

#

to connect to my MC server?

fleet crane
#

If that’s where your server is hosted

trim void
#

or can i use mobile data instead after connecting?

#

oh so i always need the router connected to the server hot?

#

i mean host...

fleet crane
#

You generally don’t need to port forward if you have an external host

#

Port forward is only if you host your server at home

trim void
#

yeah im hosting at home so

#

i dont have a router...my friend have one so i was wondering if i can port forward with it and then using MC server from my home..😁

fleet crane
#

Uh your server needs to be connected to the router

sharp dew
#

you need to have a static ip to host a server, you have to check if the connection has nat

trim void
#

you guys know jiofi?

sharp dew
#

i googled it, is it the mobile router?

trim void
#

oh yes ...

#

im planning to buy that as my router..

#

its easy to handle...

sharp dew
#

i don't know if you can host a minecraft server with the mobile connection tho

trim void
#

no its not mobile connection...it act as router and have port forwrding

#

port forward=connect MC server right?

sharp dew
#

I know but is not as easy as that, you need port forwarding, but you also need a static ip which you get by buying a business connection

#

usualy ips are natted so there is a public ip and is shared between many users

#

it's like if you have a router at home, many people can connect to it and everyone has a local ip but they all share a public ip

#

@fleet crane when compiling craftbukkit by using buildtools is there a way to skip the part where it applies the Spigot patches

trim void
#

so i can use my domains instead of ip...

#

and share domain name..

#

there are free domain hosts

sharp dew
#

i think you can do that.

buoyant path
#

Is there any way to clone inventories?

#

I would like to cache one of my inventories and then clone it each time i wanna use

#

Creating a new one each time will cause a lot of lagh

#

lag*

chrome edge
#

Convert inventory to class. Whenever use it just convert class to inventory.

#

You can also use GSON api for json.

buoyant path
#

Wdym?

#

Why would I need JSON?

#

Im just gonna cache it in a hashmap or something

#

hard coded

#

This is not a public plugin

chrome edge
#

Okay just make a class for inventory datas and save in hashmap

buoyant path
#

So serialize the inventory and then grab it when I need it

#

?

chrome edge
#

Yes

buoyant path
#

Doesn't that still create an inventory or does that give a new instance without creating it with bukkit

chrome edge
#

You make a class that contains items. I think it'd be better use like that

buoyant path
#

I don't really understand serialization well I just use resources I find lol

#

Using Bukkit.createInventory() will cause lag

chrome edge
#

How?

buoyant path
#

players can probably create up to 100 inventories a minute with what im doing

chrome edge
#

Oh

#

Try what I said above. It probably your solution

buoyant path
#

Ok

#

Ill try it tomorrow its 3:52 am lol i probably should not be coding

#
    public static Inventory fromBase64(String data) throws IOException {
        try {
            ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
            BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
            Inventory inventory = Bukkit.getServer().createInventory(null, dataInput.readInt());

            // Read the serialized inventory
            for (int i = 0; i < inventory.getSize(); i++) {
                inventory.setItem(i, (ItemStack) dataInput.readObject());
            }

            dataInput.close();
            return inventory;
        } catch (ClassNotFoundException e) {
            throw new IOException("Unable to decode class type.", e);
        }
    }
#

it still creates the inventory

#

idk how to bypass that lol

#

maybe make something like a connection pool with SQL but instead for inventories?

chrome edge
#

I meant to say like that;


    private Map<Integer, ItemStack> items;

    public InventoryManager(Player player) {
        for (int slot = 0; slot<36; slot++) {
            ItemStack item = player.getInventory().getItem(slot);
            
            if (item == null || item.getType() == Material.AIR)
                continue;
            
            items.put(slot, item);
        }
    }

    public Map<Integer, ItemStack> getItems() {
        return items;
    }
}```
#

Make a class like that for storing items and slot then save class in hashmap you created. Get whenever you want

#

You may make another method that calls class as a inventory.

plush forge
#

is there a plugin which in tab and nametag the perfix? for luckperms

buoyant path
#

@chrome edge I’m already doing that the issue is just creating the inventory lol

#

I’ve got all the items I use in the inventory cached

plush forge
#

is there a plugin which in tab and nametag the perfix? for luckperms

buoyant path
#

It’s just stupid because you can’t clone inventories so you are forced to use one instance, or create a new one

#

Idk Aaron

knotty karma
#

I am almost certain this exists but I am probably searching for the wrong things - Is there a method that I can use to essentially bonemeal a location?

chrome edge
#

@buoyant path How many inventory will you create? For each player?

buoyant path
#

Like I said before, it can be up to 100 a minute. Basically it’s a mini crates system that is like a roulette and gives the item in the middle after 8 seconds of rolling g

#

Rolling*

frigid ember
#

idk why you wouldn't pre-generate a random item list with the total items it'll cycle through and just move them along in one inventory as opposed to making loads?

buoyant path
#

They are pre generated

chrome edge
#

I've no idea about that. I thought after using inventory that created bukkit method is delete it self

buoyant path
#

The issue is because if I cache the inventory it will edit it on that same instance

chrome edge
#

Are you sure you're using inventory method correct?

buoyant path
#

Which I cannot fix unless there’s a way to clone inventories

#

Yes

#

I’ll send some of my code

chrome edge
#

You shouldn't use get inventory method. Just create new one when player clicks the crystal

#

And update players inventory

#

when rolling

frigid ember
#

^

buoyant path
#

It does exactly that did you look at it? Lol

#

Unless you mean to cache the contents

lament wolf
#

Hello ! I just did:

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        super.channelRead(ctx, msg);

        if (!(msg instanceof PacketPlayInUseEntity)){
            return;
        }

        PacketPlayInUseEntity packet = (PacketPlayInUseEntity) msg;

    }```
And I wanna get the entity which the player has clicked on. So the so-called entity is an entityPlayer that I've linked to a DataWatcher where I put the entity ID. So do you know to get the entity id via the packet ?
buoyant path
#

But even then I still think that’s going to cause lag with the create inventory method, I was able to use 1% of my servers cpu by myself

chrome edge
#

Okay I take a look at it and there's no problem about. It's normal method which is every one using it

#

I'm not sure about it sorry

buoyant path
#

?

#

For mine or his

chrome edge
#

yours

buoyant path
#

Damn

#

I’ll see if I can find a cloneable inventories resource tomorrow

#

Doubt it exists but

chrome edge
#

a is entity's id

#

action is action

#

int id = packet.a();

lament wolf
#

the internal id changes all the time, right ?

#

that's why I used datawatcher

chrome edge
#

Actually not. If you create a packet entity, its id never changes if server is not closed/reloaded

#

try to test it with debug messages

lament wolf
#

You mean that the private int a; is "final" ?

chrome edge
#

yes you cannot change entity ids that is created

#

you should try by yourself. you can understand easly

lament wolf
#

Ty i'll try it

narrow crypt
#

can someone send me a link where i can learn how to serialize itemstack[]?

frigid ember
#

Like that???

narrow crypt
#

Euhm

#

i got told to try serialize instead of saving the itemstack[] to yaml

#

but that looks like itemstack in yaml

frigid ember
#

ah you want to base64 it?

narrow crypt
#

i think so, im working with saving chests to yaml and loading them

#

cause i had some weird funcation that worked but i should go with serialize

#

just found this

#

is 5y/o

frigid ember
#

You can always use the ItemStack.serialize()????? Creates a map representation of it

narrow crypt
#

euhm but i have a inventory.getContents

#

so thats a itemstack[]

#

ItemStack[] chestinv = chestblock.getInventory().getContents();

ocean anvil
#

What would be the best way of having the server only run in a certain 3-hour timeframe every day? I'm running a daily event and wouldn't like players to be able to interact with the world outside of that time slot, whether that means closing the server or restricting player interaction or something, whatever would be the easiest. Thanks

frigid ember
#

If you literally don't want them joining then a timed whitelist would be your best option

#

you could start and stop the server but eh

edgy cloud
#

Does anyone know how you can make a NonClickable item in ShopGui+?

narrow crypt
#

thanks sable

frigid ember
#

Does that do what you're after Rik?

narrow crypt
#

Jowsey, you could try timed actions and close the server and open it

#

i think so

#

cause i do have 2 methods that worked already but its weird cause only 1 of them works depending on if you saved the chest before a restart or after a restart

#

ItemStack[] contents = (ItemStack[])(chestloot.get("loot." + args[0].toString() ));
and
ItemStack[] contents = chestloot.getList("loot." + args[0].toString()).toArray(new ItemStack[0]);

#

if i save a chest and load it than method 2 works but if i save a chest, restart server then only method 1 works

#

so then people told me do look into serialize

frigid ember
#
//The task which you want to execute
private static class MyTimeTask extends TimerTask
{

    public void run()
    {
        //write your code here
    }
}

public static void main(String[] args) {

    //the Date and time at which you want to execute
    DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = dateFormatter .parse("2012-07-06 13:05:45");

    //Now create the time and schedule it
    Timer timer = new Timer();

    //Use this if you want to execute it once
    timer.schedule(new MyTimeTask(), date);

    //Use this if you want to execute it repeatedly
    //int period = 10000;//10secs
    //timer.schedule(new MyTimeTask(), date, period );
}

@ocean anvil presuming you're developing a plugin for the server, this is the best way to run specified code at a certain time, have it just toggle a Boolean, then when they join, check if it's true or false and kick them respectively

chrome edge
#

@narrow crypt You've to serialize chest again. You may want to try how it works. If so, try to save Player then quit/rejoin game the player data will not working 'cause the old data is not new players

ocean anvil
#

Oh damn, thanks man, will take a look into that!

narrow crypt
#

euhm

#

i was talking about my previous functions @chrome edge

lament wolf
#
@Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        super.channelRead(ctx, msg);

        if (!(msg instanceof PacketPlayInUseEntity)){
            return;
        }

        if (!manager.IsDev(player)){
            player.sendMessage("mode dev reuquier");
            return;
        }

        PacketPlayInUseEntity packet = (PacketPlayInUseEntity) msg;

        Class<? extends PacketPlayInUseEntity> c = packet.getClass();

        Field[] fields = c.getDeclaredFields();
        fields[0].setAccessible(true);

    // the stream just returns the NPC that I created
        for (EntityPlayer entity : manager.getAllNPC().stream().map(StaticNPC::getNpcAssocied).collect(Collectors.toList()))
            if (entity.getUniqueID() == fields[0].get(packet)){
                // my code 
            }
        

    }```
@chrome edge Sounds good ?
chrome edge
#

Will the plugin support multi version?

lament wolf
#

you talk to me?

chrome edge
#

Yes

lament wolf
#

How that "multi version" ?

#

I don't use multiversions

chrome edge
#

            if (!p.a().name().equals("ATTACK"))
                return;

            if (p.a(((CraftWorld) player.getWorld()).getHandle()) == null)
                return;

            if (!p.a(((CraftWorld) player.getWorld()).getHandle()).isAlive())
                return;

            Entity entity = p.a(((CraftWorld) player.getWorld()).getHandle()).getBukkitEntity();```
narrow crypt
#

i imported the code you sent me @frigid ember but what shoudl Itemutils be?

chrome edge
#

I think it's explaining everything

narrow crypt
#

i was importing all things i missed

#

its not the argument for the method

frigid ember
#

???

lament wolf
#

mmm mm mmm

chrome edge
#

@narrow crypt what does need you?

frigid ember
#

?paste

worldly heathBOT
narrow crypt
#

oh wait

#

i think i missed 1 thing

lament wolf
#

I don't think versions are a problem.

narrow crypt
#

my ide doesnt know what to do with net.minecraft.server.v1_7_R4 and ItemUtils

#

like no import functions

frigid ember
chrome edge
#

@lament wolf I meant to say I sent you the code you can figure out how it works.

#

You can get entity like that with packets

frigid ember
#

Use that method

narrow crypt
#

oh

#

will do

lament wolf
#

What's this line for? Is it the player or the entity affected?

Entity entity = p.a(((CraftWorld) player.getWorld()).getHandle()).getBukkitEntity();

chrome edge
#

Entity is interacted entity

#

player is player that interact at entity

lament wolf
#

I had already marked that line before, but it throw me an NPE.

chrome edge
#

It should works. May I see your codes?

lament wolf
#

Well for the moment my code is what I send a little higher

chrome edge
#

If you just need entity ID, you can get it with fields.

#

Integer mobID = Integer.parseInt(Reader.getValue(packet, "a").toString());

#
        try {
            Field field = obj.getClass().getDeclaredField(name);
            field.setAccessible(true);
            return field.get(obj);
        } catch (Exception var3) {
            return null;
        }
    }```
#

When entity spawns, save its id

lament wolf
#

Yeah I'll try it

#

But

narrow crypt
#

@frigid ember thats again just Itemstack and not Itemstack[]

#

or do i loop that function

lament wolf
#

how I get this ID in the channelReader ?

#

When entity spawns, save its id

chrome edge
#

I meant to say entity that you created as a NPC.

frigid ember
#

@narrow crypt I'd loop it, serialize each item, then rebuild it with a loop when it's needed

chrome edge
#

if (mobID == npc.getId())

narrow crypt
#

ah okay

lament wolf
#

Ok ok

narrow crypt
#

should i save it as a stringlist then(to yaml)?

#

where every string is a base64 serialized itemstack?

frigid ember
#

That'd be the easiest method @narrow crypt

narrow crypt
#

okay great

#

ill work on it

frigid ember
#

You could build it to a single string and take it back out of that using the split method, but a string list would work just as well

narrow crypt
#

does it also save empty slots?

frigid ember
#

Not sure how they're represented in an ItemStack[] tbh

narrow crypt
#

as null

frigid ember
#

should do then

#

If not then you could loop through, replace any null ItemStacks with something the player will never have, like a barrier block and then reverse that when you de-serialize it again

narrow crypt
#

good idea

lament wolf
#

@chrome edge That's it ?

        PacketPlayInUseEntity packet = (PacketPlayInUseEntity) msg;

        Class<? extends PacketPlayInUseEntity> c = packet.getClass();

        Integer mobID = Integer.parseInt(getValue(packet, "a").toString());

            for (StaticNPC NPC : manager.getAllNPC()){
                
                if (NPC.getNpcAssocied().getId() == mobID){
                    
    // code
                    
                }
                
            }```
#

NPC.getNpcAssocied() returns all NPC that I created

chrome edge
#

Yes like that. Try to use it

lament wolf
#

Internal Exception: java.lang.NullPointerException

#

Yes

chrome edge
#

which line?

lament wolf
#

NMS doesn't give me line. But I think I found the cause

#

(for..)

#

I guess I can solve it

chrome edge
#

Okay, good luck. I suggest you to make debug system. If you get any error, you can send datas to console or player for understand which one is null etc.

hoary parcel
#

Or use a proper debugger with breakpoints...

narrow crypt
#

when loading

#

the saving works perfectly

#

it returns null as itemstack :(

chrome edge
narrow crypt
#

whut

frigid ember
#

It's NMS, it may have changed, but should show a fault in the IDE

#

Plus, those methods use reflection so

narrow crypt
#

any idea what i should do?

frigid ember
#

But yeah, there server doesn't doesn't seem to support net.minecraft.server.v1_15_R1.ItemStack.createStack

narrow crypt
#

its on my local server

#

paper

#

or isnt that what you mean

frigid ember
#

Is the plugin built around spigot or paper?

narrow crypt
#

spigot

#

try it on spigot?

frigid ember
#

Give it a go on spigot

narrow crypt
#

same error

#

java.lang.NoSuchMethodException:

frigid ember
#

hmmmm

chrome edge
#

CTRL+Click on ItemStack class

#

and search "create"

#

Maybe you can find method

#

that has changed

narrow crypt
#

itemstack class?

chrome edge
#

net.minecraft.server.v1_15_R1.ItemStack

narrow crypt
#

ah

#

oh im stupid

#

ill check for ya

#

this is what im using

#

i dont have that in one of the methods