#help-archived

1 messages · Page 179 of 1

gusty comet
#

And since this triggers my OCD i can't live without it 😄

frigid ember
#

but if it's someone else's plugin... too bad

gusty comet
#

if it's your command, check the constructors for Command
@frigid ember The constructor only specifies the name of the command

frigid ember
#

it has two constructors

gusty comet
frigid ember
#

Command(String name) and Command(String name, String perm, String... aliases)

gusty comet
#

Should i just use the second one or use them in combination?

#

Im a noob at constructors 😄

#

OH DANG I FOUND IT ❤️

#

How have i never noticed this

frigid ember
#

your "Reply" constructor can be whatever you want, just make sure to call the superclass constructor the proper way (super("mycommand") or super("mycommand", "some.perm"))

#

aliases are optional, as always

gusty comet
#

this.getPermission()

frigid ember
#

I believe it won't even call execute if the sender doesn't have the perm node

gusty comet
#

Can i change the no perm message?

frigid ember
#

mm

#

thinkin

#

no you can't lol

#

unless

#

you specify no permission in the constructor

#

and check when execute gets called

#

but that would defeat the purpose of setting a node in the first place so it won't show up in the commands suggestions

gusty comet
#

Yeah but i want to disable tab complete 😄

frigid ember
#

¯_(ツ)_/¯

gusty comet
#

How can i pass the empty alias array?

#

Because i dont need it

frigid ember
#

you don't

#

you just don't type anything

#

just the name and perm

gusty comet
#

ah okay

#

So just remove it from the constructor?

frigid ember
#

your constructor can have completely different parameters than the superclass'

#

so yeah you can remove it

gusty comet
#

Yes but will bungeecord detect it?

frigid ember
#

ofc

gusty comet
#

ah okay

wheat summit
#

Hey! I would like to have a block where I can identify it from other separate chests? Would anyone know how?

gusty comet
#

I mean of course it will work but my goal is to make the permission thingy work

frigid ember
#

yeah the perm thing will work

#

it'll pass a null-valued string array for aliases

#

so aliases are registered

wheat mirage
frigid ember
#

hmm

#

that doesn't look very healthy

#

good luck with that lol

wheat mirage
#

It's a protocollib packet listener for sure, but I've not changed any code.

#

Like it was working earlier today, and I haven't changed any of the listener code.

frigid ember
#

anyone know how to get those green attributes on tools?

#

the attack damage and attack speed?

#

when i add attribute modifiers theyre blue/red and behave differently

#

are those just hardcoded or can i change them

#

green?

torn robin
#

have you specified the operation?

wheat mirage
#

Clearing attribute modifiers seems to get rid of them

#

So I'd assume they're a part of that

frigid ember
#

what operation should i be using

torn robin
#

no idea

frigid ember
#

im using ADD_NUMBER

torn robin
#

you could try playing around

frigid ember
#

none of them work

#

theres only 3 anyway

#

aa

#

also when i add a speed modifier it gets rid of dmg

gusty comet
#

Command(String name) and Command(String name, String perm, String... aliases)
@frigid ember Thanks again it's unbelievable i searched for like 10 hours straight and haven't found anything

tiny pebble
#

If I wanted to change an entity's model, presumably using packets, how would I do it? Not a custom model, but rather making a chicken look like an enderman for example.

gusty comet
#

And letting people tab complete admin commands triggers my OCD ^^

frigid ember
#

just a lil useful source lol

gusty comet
#

Yeah thats too complicated for me lol

rustic prism
#

One message removed from a suspended account.

gusty comet
frigid ember
#

because it only has two constructors:
(String)
(String, String, String...)
but not (String, String...)

gusty comet
#

But with just name and permission it works

frigid ember
#

because as third parameter for String... it "passes" null

gusty comet
#

Oh okay

#

That makes sense thanks

frigid ember
#

it'll pass a null-valued string array for aliases
👆

gusty comet
#

I did it myself before and it threw an NPE lol

frigid ember
#

(String[]) null

wheat summit
#

Hey! I'm trying to make an autoselling block and I'm quite close though I'm getting an error which is saying that I can't cast a CraftBlock to a Chest which I was worried, does anyone know how to fixx it? Here's all my code https://hastebin.com/ihuderudil.java

gusty comet
#

Ohhh

wheat mirage
#

@wheat summit Look into blockstates and blockdata. Blocks aren't cast directly, only their data.

wheat summit
#

Ok, I'm also in 1.8 so there's no BlockData

#

How would I use Blockstates since I think they exist?

wheat mirage
#

Block#getState

#

check the javadocs, and there's countless threads on it

wheat summit
#

Ok thanks

agile whale
#

java docs 🙌

wheat mirage
#

I feel like bolding questions may be a good idea for this channel

frigid ember
#

well, I don't know

#

maybe nobody who read that can help?

wheat mirage
#

Perhaps

#

Everyone's at different skill levels in here

mellow wave
#

RealmGame?

#

Whats that

wheat mirage
#

It's custom code

#

It's using a protocollib packetlistener

mellow wave
#

Yeah I can tell

wheat mirage
#

is there a better way to get an entity from a protocollib packet?

bitter tendon
#

Anyone know how to change the lifetime of a FallingBlock?

wheat mirage
#

Than finding the entity with matching entity id?

gusty comet
mellow wave
#

There are better ways

#

You can read the entity modifier

frigid ember
#

dude, I already told you your class constructor arguments doesn't have to match the superclass'

#

you can literally make this

#
public class BanCommand extends Command {
  public BanCommand() {
    super("ban", "myplugin.ban");
  }
}
wheat mirage
#

@mellow wave event.getPacket().getEntityModifier(event).read(0);?

#

Is that decent code.

gusty comet
#

Well yeah but this is easier to "maintain"

wheat mirage
#

@frigid ember I don't necessarily disagree with passing in registry values etc

mellow wave
#

I can help more after I sleep it's 00:40 :/

wheat mirage
#

No worries, thanks @mellow wave

gusty comet
#

same

mellow wave
#

But yeah that could work, depends on the packet

#

Try it

wheat mirage
#

@mellow wave It's an entity metadata packet, and I will, thanks!

#

Well and also a spawn entity living

wintry bison
#

Is there a way to access Minecraft's random chunk updater. Apparently it is this random tick that triggers crop growth. Wondering if its accessible or if I need to make one from scratch?

frigid ember
#

@wintry bison you can listen to that event and cancel it whenever 🤷‍♂️

bitter tendon
#

Anyone know how to change the lifetime of a FallingBlock? The nbt tag is Time

frigid ember
#

try setTicksLived()

wheat summit
#

Is there a way to make an entity have no hitbox?

#

There's no sertMarker method in 1.8 Nevermind updated to 1. 8.8 and the method was there

rotund orbit
#

I have a 1.15 test server but I forgot how I made it 😛 Could anyone point me in the direction of a useful video/tutorial for setting up a 1.16 test server using BuildTools?

fathom shard
#

can anyone help me and tell me how to do it so others can open the 3d model i designed ?

#

1 sec ill send the file

#

im new to this stuff 😦

marsh hawk
#

@rotund orbit download build tools. in cli run "java -jar BuilTools.jar"

#

bim bam boom

#

or double click it

rotund orbit
#

I have done as you have said

#

and this'll give me the Spigot-1.16.1 server JAR?

frigid ember
#

How would I get the amount of people in a boat using VehicleEvent

#

@rotund orbit java -jar BuildTools.jar --rev 1.16.1

rotund orbit
#

thank you 🙂

outer timber
#

i cant update to 1.16.1

#

ive run the script mentioned in the fourms post

#

but the spigot .jar is still 1.15.2

#

and i cant connect through 1.16.1

grim halo
#

java -jar BuildTools.jar --rev 1.16.1

outer timber
#

thats what i've done

grim halo
#

Did you download the latest BuildTools?

bitter swift
#

is there a place to hire a dev ? i need my plugin fixed

sturdy oar
#

No

#

Not here

#

spigot services on forum

outer timber
#

@grim halo yeah build #120 right

#

i'll try running the command in bash instead

fringe cairn
#

How do I use nms in my plugin using maven

hardy cedar
#

holy-

#

i DID NOTHING WRONG

#

:((

#

but on update

#

The Scoreboard DUPLICATES THE TEXT

#

THATS GREAT

frigid ember
#
                                  if (placedBlock == water) {```
#

I need to check the block thats placed without an event :/

#

How would that be done in a situation like this? 😐

spice loom
#

it has to be done with an event afaik

outer timber
#

do i just need to dump my plugins into the plugin folder to make them work?

frigid ember
#

if you restart after dumping them in

outer timber
#

k

wintry musk
#

Hey ! I don't know why but the EntitySpawnEvent doesn't work, is it normal ? even though I added the @EventHandler and the listener to my Main class meanwhile the other Listeners registered work fine :/

fringe cairn
#

how should I get the version and compare to make sure nms is compatible with that version?

subtle blade
#

((CraftMagicValues) CraftMagicValues.INSTANCE).getMappingsVersion()

#

It's a hash value against which you can compare. Was added in like 1.11 or something

#

1.13.2 it was added*. Just checked

fringe cairn
#

and how do I find the mappings versions that nms is using

#

or like what to I compare that to

subtle blade
#

You'd have to find the constant for that version you're using and compare against it

#

If you're compiling against 1.13.2, decompile the 1.13.2 jar and find that method, copy the value, compare against it

#

if ("the_value_you_pulled".equals(((CraftMagicValues) CraftMagicValues.INSTANCE).getMappingsVersion()) { }

#

That value updates whenever the mappings update, so it's not an exact science. Generally that will update each minor version (roughly - 1.16.0 for instance didn't exist, there is no Spigot server jar for that version)

fringe cairn
#

I found something online that uses version = Bukkit.getServer().getClass().getPackage().getName().split("\.")[3]?

#

and gets the version in a form like v1_16_R1

#

is that worse to use?

subtle blade
#

Not necessarily. Arguably the better approach

#

Just depends on what exactly you're working with

fringe cairn
#

okay... seem like comparing the mappins version takes a lot more work to see what the nms version is

subtle blade
#

If you're working with a method that has changed between a single revision (very, very unlikely, but possible), then you'd have to take the mappings version approach. Otherwise you're probably fine to compare package names

fringe cairn
#

a method in the api?

subtle blade
#

No no, NMS

fringe cairn
#

or a method in nms

subtle blade
#

It's obfuscated and if a small change is made in the class by Mojang, the class' obfuscation may vary

fringe cairn
#

okay thanks

#

so in case I take the second method, I'll just have to update if the method changes in the same revision

ornate birch
#

Do the spawn-limits for animals affect animals in newly generated chunks? I was getting too many animals for my liking when flying around, reduced that number all the way to zero but saw no change

stuck quartz
#

is it possible to store a PersistentDataContainer inside another PersistentDataContainer?

ocean root
#

so im using luck perms and essentials chat and i cant seem to get prefixes and suffixes for roles working

sinful spire
#

you need vault i think

ocean root
#

wdym?

tiny pebble
#

its another plugin

ocean root
#

ok

#

do i still need esentials chat

stuck quartz
#

what does vault helps in when making a plugin?

unborn jewel
#

how to i change save location
intellij

lone fog
#

Vault is a permission and economy API

#

And chat

unborn jewel
#

yea

wheat mirage
#

@mellow wave you solved my protocollib issue, thanks!

stoic spindle
#

What’s the code to make the config.yml reset and update on a new plugin version?

open ibex
#

config.yml in your plugin?

#

Just delete the file before it's automatically generated

stoic spindle
#

But essentials has a thing we’re the config.yml updates

#

I want that XD

open ibex
#

Yes

stoic spindle
#

How do I get it

open ibex
#

That takes a bit of work

#

You need to make it yourself

stoic spindle
#

How do I do it

#

Tell me

#

Plz

open ibex
#

The basic idea is that the config has a version and if the plugin's config version is different it transfers the configs from the old config to the new one, but you need to manually specify which configs map to which in each version if the names are not the same

#

I assume this works kind of like a data fixer

stoic spindle
#

Ok

rich bramble
#

Hiya I'm extremely confused on how to install Spigot for 1.16

#

I'm just seeing loads of files and pages on this thing called Jenkins... I just want a simple download button lol

#

with 1.16 next to it

frigid ember
#

?bt

worldly heathBOT
frigid ember
#

download that thing called BuildTools

#

put it in a standalone folder

#

and from your console/terminal of choice, go to that directory and run java -jar BuildTools.jar --rev 1.16.1

#

it'll take a while for it to be done; when it is, the terminal screen will be cleared and it'll say something like "blah blah jar copied successfully blah blah"

#

and it'll be in the same folder as the BT jar

rich bramble
#

oh it's called buildtools?

frigid ember
#

im pretty sure the reason why u cant just download it is cuz of legal issues

#

so thats why u need to use build tools

#

@rich bramble

#

so as that page suggests ur gonna need to install Git

#

and download the BuildTools

rich bramble
#

oof goddamn

frigid ember
#

yea

#

is there any way to fix the enchantments past level 10 names or do i just have to hide enchants and add lore

hardy cedar
balmy sentinel
#

@hardy cedar use teams and just reset the suffix or prefix.

hardy cedar
frigid ember
#

is there any way to fix the enchantments past level 10 names or do i just have to hide enchants and add lore
@frigid ember wouldn't that be client side? 🤔 I mean idrk lol but it seems it would be some client side thing

#

hm yea, perhaps with a resource pack?

#

🤷‍♂️

grim halo
#

You can do that with packets. Its basically intercepting item packets and hiding the enchantments -> adding lore to the beginning of the lines

lone fog
#

Yeah it’s client side if you want to fix it that way

stuck quartz
#

how do i check if a block is a chest?
i tried block.getBlockData() instanceof Chest so far

grim halo
#

Check if the blockstate is instance of chest.
Does checking the Material not work?

stuck quartz
#

ill try both

lone fog
#

Material should work

subtle blade
#

Material check is the preferred approach as getBlockState() and getBlockData() create snapshots

lone fog
#

And we don’t need more of those, mojang already breaks things with ever one they release

subtle blade
#

Not quite what I meant with snapshots lol. Think World#getChunkSnapshot()

#

It creates a mutable copy of the block state

grim halo
#

XDD

rich olive
unkempt ridge
#

I have 2 separate classes reportCommand and ReportInventory. When the command is successfully execute it opens the report GUI (public Inventory reportGUI(Player targetPlayer, String reason)) and the name of the GUI is “Report “ + targetPlayer.getName(). I was wondering what’s the best way of checking in the InventoryClickEvent if the inventory name is “Report “ + targetPlayer.getName()? I tried setting a private String at the top of the class and setting it within the inventory but it didn’t work.

grim halo
#

Why do you need to check the name?

lone fog
#

player.openInventory returns an inventory view you can compare with event.getView

#

Rather than using the name

subtle blade
#

@rich olive I've reopened the issue

frigid ember
#

Hello anyone knows an NPC Plugin which lets me trade custom items

unkempt ridge
#

because don’t I need to, to check if it equals “Report “ + name? I also need it because once they click on an item in the GUI I need to create a report in the database with the target player’s name

lone fog
#

player.openInventory returns an inventory view you can compare with event.getView

frigid ember
#

player.openInventory returns an inventory view you can compare with event.getView
it's literally just a == comparison lol

lone fog
#

Mhm

frigid ember
#

as fast as it gets

grim halo
#

Ok i think what you want is a Map<Inventory, SomeData>
You create a class SomeData that contains data linked to the inventory.
In the InventoryClickEvent you can call map.contains(inventory) and then retrieve the data.
Just remember to clear the map in the InventoryCloseEvent

unkempt ridge
#

but I have it setup right now as public Inventory reportGUI(Player targetPlayer, String reason) so if i’m the InventoryClickEvent if I do Player player = (Player) event.getWhoClicked() it will get the wrong player

#

@grim halo I’ll try that thanks!

frigid ember
#

.------------.

lone fog
#

I’d just store the view in a map with the players UUID

#

Then get the map entry in the click even and check if it matches event.getView

grim halo
#

Thats basically what ive said. In your case SomeData is just a UUID

unkempt ridge
#

yessir just going to get some dinner and then I’m going to code it. Thanks guys!

sudden elk
#

Ok so I have a plugin where I can change an item frames visiblility, the issue is when I change this it only updates for the player who changed it, for the change to register for other players they have to unload the chunk and come back into it.

So basically how would I refresh/update the itemframe for everyone?

Please tag me with your replies!

grim halo
#

@sudden elk Depends on how the frames are hidden. But i suspect that you would need to send a packet to every nearby player.

sudden elk
#

It’s with itemFrame.setVisible(false). And yeah I know I need to use a packet but I don’t know how to use packets

grim halo
#

I dont see the player context in this.

#

How would this update only for one player?

sudden elk
#

I don’t know but it does

#

Only the player that makes it invisible instantly sees the change

frigid ember
#

How does the player make it invisible? Is it a command, an interaction...?

grim halo
#

What do you mean by "makes it invisible"

sudden elk
#

When you click the itemFrame it toggles

frigid ember
#

that's what he's calling

sudden elk
#

^ yes

frigid ember
#

but it supposedly doesn't update for everyone 🤔 which doesn't make much sense

rich olive
#

thanks Choco

grim halo
#

Maybe the interaction sends the player that interacts with the frame a meta update packet...
Try setting it one Tick later @sudden elk

#

Bukkit.getScheduler.runTask(somthing something)

frigid ember
#

doesn't really make much sense...

sudden elk
#

Hmm right I see where you are going with that

#

Not at my pc now but I’ll try that and see if it works!

scenic osprey
#

I'm trying to get all chests in a world, I can't get getLoadedChunks since players won't be in the world

grim halo
#

Oh you are so lucky

#

I just wrote a plugin for someone that gets all chests in a world

scenic osprey
#

Should I listen to WorldLoadEvent?

#

oh ok

#

is it on spigot?

grim halo
#

Nope it was for a single person.

#

It gets all chests and outputs the locations to a file

#

Do you want to do anything in particular with the chests?

scenic osprey
#

To fill them with random items

grim halo
#

Want the source code? Its a bit complicated as i wrote it in ~2h

scenic osprey
#

Sure ok

grim halo
#

Wait ill add some comments so that you are not completely lost.

#

Its better if i write a fast api with a Consumer<Chest>...

frigid ember
#

So there’s rgb in Minecraft 1.16 now

#

Anyone know how I can utilize it?

lone fog
#

ChatColor.of

#

Bungee ChatColor API, not the bukkit one

frigid ember
#

How do I type in rgb

#

Like before it was like &6gold for example

grim halo
#

Its scheduled to not use more than 39.5ms per tick @scenic osprey

unkempt ridge
grim halo
#

Just put some sysouts in your method to see how far you get

unkempt ridge
grim halo
#

Maybe try event.getClickedInventory

unkempt ridge
#

nope still only calls the if statement never goes within it

grim halo
#

Could you show me the code where you open th GUI?

unkempt ridge
#

and the GUI opens up fine and everything it’ll say “Report Rubberninja” at the top

grim halo
#

Ok... here is the problem:
Every time you execute the command you create a new instance of ReportMenu.
Every instance has its own Fields (In your case the maps).
After the command is done, the instance just gets discarded. So the Map in your instance that is
registered as Listener always only sees empty maps because they get never accessed.

unkempt ridge
#

so what would be the best way? private ReportManager manager = new ReportManager(); at the top of ReportMenu and then have fields in the report manager class that’ll store the information?

#

or would I have to put it in the command class?

knotty karma
#

is there an event similar to PlayerMoveEvent, but for all entities?

grim halo
#

If you have a Listener class you generally want only one single instance of it anyways.
Normally you create a Manager class for such purpose. Like a ReportManager of which you only have one instance.
In your case i would just create one instance of the Listener class in your onEnable and pass it in the constructor of your command instance

unkempt ridge
#

okay I’ll try it

grim halo
#

I think you dont want an EntityMoveEvent... What exactly are you planning on doing? @knotty karma

unkempt ridge
#

so @grim halo just to make sure I’m coding this right I’m going to create one instance of this manager class in my Main method and have like a function to getManager() and from there add/remove from the map using the manager?

knotty karma
#

basically I want to adjust entities' velocities depending on several factors, the main one being the entity being within a certain radius of the player. I figured out a way to do it differently, this just requires iterating over players, then iterating over entities within a radius of them.

grim halo
#

Yes 😄 You have one Manager that, well, manages the Maps.
The manager has the method openReportMenu(Player user, Player target, String reason) or something, that opens the inventory for "user" and adds the inv in the internal map. And a method removeInv(Inventory inv) that just removes the inventory from the map. There is no reason to check if the inv is actually in the map. If the map does not contain the inv and you call remove then nothing happens. So you can just call manager.removeInv(inv) for every Inventory that gets ever closed (no performance impact)

This one manager instance is created in your onEnable before you create your Listener and Command instance.
Then you pass this manager to your Listener and Command instances when creating them.
They both need to have a private Manager variable that gets filled in the constructor of each class.

You should now have a manager variable in both instances. Both are references and 'point' to the one instance in your main class.
Now you can use manager.openReportManager(...) in your command instance.

#

and manager.removeInv(...) in your Listener instance. (As stated you can just remove every Inventory from the InventoryCloseEvent)

frigid ember
#

Anyone

#

know how to remove Pattern items lore

grim halo
#

@knotty karma Yeah i think you have only two options:

  1. Like you said. Iterate over every player then iterate over entities nearby.
  2. Extend NMS entity and do something with the tick() method or Pathfinder/AI
unkempt ridge
#

thanks! I’m going to try it right now

grim halo
#

@frigid ember Whats a Pattern items lore?

frigid ember
#

Flower Charge

knotty karma
#

alright, thx for the help :)

frigid ember
#

i want to remove the default minecraft lore

#

on patterns

#

*banner patterns

grim halo
#

Ah the item

frigid ember
#

yeah how do i remove it

#

also the miscellenaeous and all that jaz

grim halo
#

You can try using the HIDE_ATTRIBUTES ItemFlag...

#

If that doesnt work its probably client side.

unkempt ridge
#

what is the difference between Inventory and InventoryView? Trying to figure out which is best to save and I’m confused what the java doc means under InventoryView

frigid ember
#

how to

unkempt ridge
#

meta.addItemFlag(ItemFlag.FLAG)

frigid ember
#

is there a plugin for it

grim halo
#

There is one Inventory. Multiple players could look at the exact same inventory but everyone has its own InventoryView.
If you dont open the exact Inventory for multiple people you should just use the Inventory

#

Its easier to work with

frigid ember
#

do u know the name of ther plugin

fossil shoal
#

InventoryView represnets a HumanEntity viewing two inventories (top and bottom inventories)

grim halo
#

The view is kind of a link between the top and bottom inv

#

^

unkempt ridge
#

ahh okay so that’s what it meant by two inventories lol thanks that is what was confusing me😂

#

@frigid ember probably but it’s really easy to implement yourself just get the ItemMeta than meta.addItemFlag

#

@grim halo actually one last question😂 so I had java classes like “PlayerManager” that have serval SQL queries in it to manage a specific part of the database and in previous plugins I just created a new instance in every class I needed it. Would it have been smarter to just create one instance in the main method?

grim halo
#

Lulz. Yes. If you have a class that does only one thing again and again you dont need more than one instance.
You only want mutliple instances of mutable classes that hold data. (There are some exceptions)
If you want to track Playerstats for example, you would habe one PlayerManager.
Within that manager you would have a Map<Player, PlayerData>
So only one instance of PlayerManager (if you had more than one then every instance would have different maps)
And one instance of PlayerData per Player.

frigid ember
#

I found a plugin but it doesnt work

#

I still see Miscallenous blue font

grim halo
#

That is the creative category

#

its only visible in creative

unkempt ridge
#

lmao glad I learned this😂

frigid ember
#

But it still hasnt fix my Banner Pattern lore issue tho

#

It still syas flower charge

grim halo
#

Ah the banner pattern meta is (for some reason) the potion meta?

rugged sundial
#

Does anyone know how to enable using Minecraft selectors for plugin commands? I’m trying to do a thing that makes the nearest player /fly but I can’t figure it out.

frigid ember
#

like that

#

its in another server

grim halo
balmy sentinel
#

java would be 10x better if you could return tuples like in python 😦

rugged sundial
#

@grim halo thanks!

#

I’m gonna add that to my server tomorrow

grim halo
#

pls no. I like my type safety as it is.

#

Also you can create a tuple class and then return it ^^

balmy sentinel
#

mhmmm debating

grim halo
#

We can discuss why Java should be as far away from dynamically typed languages as possible,

#

Kind of... If we dont count reflections

balmy sentinel
#

lol nah it would save some lines of code tho

#

I'd probably say my favorite is python, than c, than java

keen compass
#

that is true and not true lol

#

just because the code isn't in your project directly, doesn't mean it is less code lol

balmy sentinel
#

assembly is the worst🤮

grim halo
#

Thats the strength of python. You can in some instances write short code that just does the thing you want.

keen compass
#

the advantage of the JVM implementing however is the possibility of native code enhancement.

frigid ember
#

anyone know a rules gui plugin which allows heads to be added in

grim halo
#

assembly is only important if you want to understand compiler architecture or Kernels.
Even the lowest end embedded systems are populated with C nowadays. Nobody uses assmbly anymore.

keen compass
#

depends really

balmy sentinel
#

I'm a computing security major so it's somewhat important to understand

grim halo
#

@keen compass What do you mean by that the advantage of the JVM implementing however is the possibility of native code enhancement.

keen compass
#

if the JVM implements something IE the JDK API, the possibility of backing that API with native code is greater. Thus making the method more optimal then if it was purely written in an abstracted language. Also makes it easier for the GC as well since the JVM is closer to the GC then your java application is.

#

you can implement native code using JNI in Java, but it isn't quite the same when it is in the JDK and the JVM implements it lol.

grim halo
#

Ah now i understand. Yes i brought up a similar argument in a discussion i had with a fanatic C++ dev that thought his language was objectively the best choice, always.
I dont know why ppl think Java is slow. Its really fast nowadays. And if you write it right its fast everywhere. While C++ code might run nice on the cpu you compiled it for, if the instruction set is just slightly different you might have significant performance drops. Java doesnt really care.

frigid ember
#

How do I create a plugin that hides all banner pattern lores

#

XXXXXxxXXX

keen compass
#

Well the JVM makes use of instructions sets too

#

since the implementation of the JVM is C

#

so even though Java is a higher language, it is still backed by native code

grim halo
#

Ofc. But you dont compile Java code for one set.

keen compass
#

No, but Java is fast. Faster then it used to be anyways lol

grim halo
#

Exactly. Thats what i meant by: If you write it fast its fast everywhere. (Almost)

frigid ember
#

How do I create a plugin that hides all banner pattern lores
@frigid ember Look into ItemFlags maybe

keen compass
#

the advantage of C++ is you can make use of instruction sets directly as opposed to Java making that determination which can be annoying

frigid ember
#

anyone know a rules gui plugin which allows heads to be added in
@frigid ember Have a look at command to book or other general inventory creating plugins

grim halo
#

Maybe if ppl would stop using Java8 they would see that the performance of Java has made some significant leaps in the past few years.

keen compass
#

and the other advantage is more control over the memory footprint, however that is a double edge sword because this assumes the developer doesn't make a mistake in memory management 😛

#

Which is why Java handles memory management so that the developer doesn't have to worry about introducing memory leaks as easily

frigid ember
#

I still see Miscallenous blue font
@frigid ember Are you sure that's not just your F3+H settings?

grim halo
#

I hate cleaning up in C++. I like Javas GC a lot.

keen compass
#

can still happen, but it isn't as a major problem as it is in C or C++ when you forget to release resources 😛

frigid ember
#

yeah man its not

#

i dont have f3+h on

#

I'm using a gui

#

that doesnt hide banner pattern lore

#

im wondering if i can edit it

grim halo
#

The banner pattern is stored in the potion meta i think...

frigid ember
#

can u teach me on how to im clueless lol

grim halo
#

Do you want to hide the attributes of every pattern?

frigid ember
#

yeah i do

#

i just want to cretae a plugin right now that hides every banner pattern lore

grim halo
#

Have you written a plugin before?

frigid ember
#

nope

grim halo
#

Hm... do you know Java?

frigid ember
#

XD no but if u link me a website that teach basics

#

then i could probably learn it within a day or so

keen compass
#

the other thing people forget also is that Java makes it easier to interact with other languages as well directly and indirectly

grim halo
#

@frigid ember You need some dedication and at least some days to get the basics right.

keen compass
#

directly you can use JNI to interact with native code and indirectly you can make use of system commands right from within java

grim halo
#

But to be fair every language with memory access can interact with other languages like that.

keen compass
#

Yes, but there is a difference between the ease of doing so

grim halo
#

I mean in C# its basically just unsafe{... write C-ish code with e.g. a class for intpointer }

keen compass
#

C you have to implement that yourself in most cases or hope for a library that exists for that. And C++ generally has libraries, but the downside of either is they are system dependent.

#

C# is pretty much like Java since it was designed to be Microsofts version of Java lol

grim halo
#

Its pretty similar yea

#

But how would you for example interact with Python where you have absolutely no access to memory?

keen compass
#

system command line

grim halo
#

Or use a memory mapped database like Redis.

keen compass
#

I wouldn't do it that way. Java lets you run commands on the system easily and grab the output if necessary as well

#

you can do the same in C++ just a bit more involved with that then with Java

grim halo
#

Doesnt this need IO access?

keen compass
#

Only IO access you are going to need is a line reader at most

grim halo
#

But command lines are system dependent again. Also Redis would exist in memory only and has some nice events :D
Just hammer some Json objects in there and notify the other linked services. But i have never done command line communication so maybe its not as bad as i think

keen compass
#

only if you interact with command prompt 😛

#

between linux and macos command line is almost the same

#

just really depends what it is you are doing really

frigid ember
#

ffs

#

how do i view prefrences option on eclipse

grim halo
#

Window -> Preferences

#

Left from "Help"

frigid ember
#

anyon eable to help me removing banner patern chares lore pls

balmy sentinel
#

I still haven’t figured that one out yet... HIDE_ATTRIBUTES doesn’t work

frigid ember
#

it's hide_potions thingy

#

i just researched it out but im very clueless

#

on how to make a plugin with the fucking complexity involving it

graceful vigil
#

and that attitude is perfect for not learning

frigid ember
#

something to do with potion effect

#

replcing item flag

balmy sentinel
#

wdym @graceful vigil

graceful vigil
#

nvm

#

I didn't think before I said that

frigid ember
#

can someone open the port for me ?

brave vector
gusty comet
#

No idea how this is possible lol. Last char gets cut of for some reason in the function but the String is correct

#

But only when using the fixed TC mode

#

ah nvm im dumb accidentally used .substring

ocean prism
#

Hello! I would like to know, currently when I put a block of DEAD_FIRE_CORAL, it systematically puts water on me with it, is there a way to change that? 🙂

frigid ember
#

"Flower charge"

fleet crane
#

uh

#

does a hideflags exist for it?

#

if not then its probably client side and nothing you can do about it

ocean prism
#

Any idea what my problem is? :c

frigid ember
#

WOAH didnt expect md_5 to response

#

AHh well I just researched that there's a fix for it.

#

Replacing item flag and replacing it with hidden potion thingy

sage summit
#

Im trying to send a multiline message, for example, the help command but how would you make it have multiple lines?

#

in the "" or out?

#

nvm got it

#

thanks

vernal spruce
#

Is there any easyer way to serialize an itemstack to a byte array(custom PersistentDataType) rather than the SerializationUtils or breaking it apart into strings and so on?

frigid ember
#

is there any way to find which version of java is running on the server?

chrome lark
#

check a timings report?

vernal spruce
#

ahh lovely

#

Caused by: java.lang.IllegalArgumentException: Could not find a valid TagAdapter implementation for the requested type ItemStack

#

fkng finally

#

created a custom persistentdatatype to store itemstacks

left plover
chrome lark
#

you can't

wraith thicket
#

You understood what they wanted to do?

chrome lark
#

Sounds like they wanted to use lambdas on an interface with two different methods

left plover
#

it was that bad of an explanation huh

#

okay thanks anyway lol

frigid ember
#

hi, im trying to add server resource pack to my 1.12.2 server

#

i dont know why but when i start server

#

server adds \ to some places

#

sorry for really bad english

torn robin
#

@frigid ember have you tried adding ""'s to the url?

frigid ember
#

no

torn robin
#

could you try doing that?

frigid ember
#

yes

#

wait

#

same

torn robin
#

could you try removing the https:// part?

#

so resource-pack=download.mc-packs...

#

without the quotes

raw canyon
#

Anyone here who's experienced with VotingPlugin reward setting up?

chrome lark
#

the \ is irrelevant, that's just escaped, the file is saved back to the disk automatically, so it just takes the char escape

graceful vigil
#

@raw canyon don't ask if someone is experienced with something, just ask the question and wait for someone to respond

raw canyon
#

Okay.

#

So I'm trying to make the VotingPlugin read a Reward file which I have named "VoteReward"
But when I save the file and reload the VotingPlugin, then it gives me an yml error.

#

Minecraft-MP_com:
Enabled: true
ServiceSite: Minecraft-MP.com
VoteURL: HIDDEN
VoteDelay: 24
Item:
Material: GRASS
Amount: 1
Rewards:
- 'VoteReward'
Messages:
Player: '&aThanks for voting on %ServiceSite%!'
Priority: 100
Name: MinecraftMP-Ordu
EverySiteReward: []

#

It looks like this.

#

If I am correct, that's how you make make the reward file work when a player does cast a vote?

graceful vigil
#

copy/paste your yml and throw it in a yaml linter

raw canyon
#

(<unknown>): did not find expected key while parsing a block mapping at line 51 column 5

#

on line 51, it's Enabled: true

torn robin
#

Your messages seems improperly indented

#
EverySiteReward: []
Minecraft-MP_com: 
  Enabled: true
  Item: 
    Amount: 1
    Material: GRASS
  Messages: 
    Player: "&aThanks for voting on %ServiceSite%!"
  Name: MinecraftMP-Ordu
  Priority: 100
  Rewards: 
    - VoteReward
  ServiceSite: Minecraft-MP.com
  VoteDelay: 24
  VoteURL: HIDDEN
#

that should fix it

#

assuming the messages is meant to be under Minecraft-MP_com and not Item

frigid ember
#

i restarted the server and this error showed up on the console any issues? i just updated to 1.16.1

left plover
#

how do you spawn MHF heads? I'm trying this but its just a skeleton head

ItemStack skull = new ItemStack(Material.SKULL_ITEM);
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
skullMeta.setOwner("MHF_Wither");
skull.setItemMeta(skullMeta);
frigid ember
#

could you try removing the https:// part?
@torn robin tried, same

wraith thicket
#

What version of MC are you on?

left plover
#

me?

wraith thicket
#

Yes

left plover
#

1.8.8

wraith thicket
#

Ah, I don't really know how it would work on a legacy version

#

Perhaps simply waiting or placing it down would help. I know there's been some issues like that way back when.

left plover
#

oof

#

found it, for future reference new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.WITHER.ordinal())

frigid ember
#

Does anyone know the solution?

crisp bluff
#

Can I use "BuildTools.jar" without downloading PortableGit (I do have git installed and in my PATH)?

vernal spruce
#

if you have something else wich can run the command yeah

#

git bash is to allow use of "java -jar" command

crisp bluff
#

Im running "java -jar BuildTools.jar" and it downloads PortableGit. But I have installed git.

vernal spruce
#

you followed the example

#

right clicking in the folder and doing git bash here

crisp bluff
#

But I do not want to use git bash. I am using Powershell Core and i can run git (it is in my PATH env variable). But when I run BuildTools, the first thing it does is to install PortableGit. But like I said I have git installed and there is no need to install a portable version of it.

graceful vigil
#

What's the problem with using git bash?

crisp bluff
#

Its not a problem. But why doesn't it detect that git is installed in powershell?

frigid ember
#

how do i get stored enchantments on an enchanted book in order in how its displayed to the client?

#

right now they're alphabetically ordered

torn robin
#

how are they ordered client wise cry? or do you not know?

#

@crisp bluff do you not have git bash installed already?

frigid ember
#

nope, the enchantments are dynamic on the book

torn robin
#

curious, is it by order of enchanting?

frigid ember
#

don't know, the enchantment table can return books with 2 enchantments and fishing can return 3+

torn robin
#

im curious whats the use case for this?

frigid ember
#

im trying to up the first enchantment's level by 1

#

(in the order in how it's displayed to the client)

#

i got it working just fine, it's just that it's alphabetically ordered and it doesn't up the actual first enchantment

crisp bluff
#

@torn robin I have installed git bash. But why does "BuildTools.jar" download PortableGit, when git is already installed (inside Powershell)?

frigid ember
#

from reading the docs i guess i have to use NMS as the bukkit api creates an immutable copy of stored enchantments

#

which orders it in a descending order

torn robin
#

can you run git commands themselves in Powershell?

frigid ember
#

i was just hopping in here with hopes that there's an easier way

crisp bluff
#

yes

torn robin
#

I strongly doubt there's a convenient api-friendly way of doing what you're trying to do unfortunately

frigid ember
#

yikes

torn robin
#

there might be but idk off the top of my head

frigid ember
#

thanks for your help regardless though

graceful vigil
#

Why install git bash, but not use it?

torn robin
crisp bluff
#

Powershell with Microsoft Terminal is better

chrome lark
#

buildtools runs everything in bash

#

It's probs not picking up the version installed in the windows path for some reason

graceful vigil
#

just use git bash for buildtools

#

run it, and be done

crisp bluff
#

But why does it want to use "sh" when running on Windows?

torn robin
#

¯_(ツ)_/¯

chrome lark
#

because the scripts are all written in bash

graceful vigil
#

My guess is easier development

chrome lark
#

it works across platforms

crisp bluff
#

@chrome lark makes sense

graceful vigil
#

Which is even better, because they don't have to make multiple

chrome lark
#

if you're on mac/linux, you defo already got bash; on windows, it's more convenient to just use git bash vs tryna require maintaining the scripts in two languages

#

(Not to mention, you need git anyways, so 🤷‍♂️ )

graceful vigil
#

Maintaining 2 would just give the devs extra work for no reason

chrome lark
#

(buildtools now requires python in order to build!)

#

runs

graceful vigil
#

oh boy

subtle blade
#

Thought you were serious, was about to slap you silly

chrome lark
#

I mean, if that's your attitude, brb

balmy sentinel
#

I have a few different managers (all with one instance) that all get setup in onEnable and then my Core class (main) has methods like getXYZManager. My question is for my commands and listeners is it more efficient to pass each manager to the command/listener in one constructor or just the Core instance and in the constructor get all the managers with getXYZManager?

#

one listener I have to send over 4 different managers so I thought it’d be easier to just send the Core instance over in one constructor and then within that constructor set them all up within the constructor with this.instance.getXYZManager();

chrome lark
#

you'd have to be doing something pretty crazy for that to /really/ matter

balmy sentinel
#

okay cool so it doesn’t matter

fickle flicker
bold anchor
#

Gradle also has submodules sure

frigid ember
#

im running spigot 1.16.1, recently updated from 1.15.2. the chunk loading are too slow. These are the plugins we are using on the server can someone help me find the issue or tell me how to fix if you know

subtle blade
#

because you're not using it

frigid ember
#

but why?

subtle blade
#

You're not calling anything on it?

#

In this case you really don't need to assign that to a variable

frigid ember
#

oh shit

#

im stupid

#

im running spigot 1.16.1, recently updated from 1.15.2. the chunk loading are too slow. These are the plugins we are using on the server can someone help me find the issue or tell me how to fix if you know
server is running CraftBukkit version git-Spigot-0287a20-7560f5f (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT)

tiny pebble
#

i dont think you'd want to extend bukkitrunnable

#

what exactly are you trying to do?

lone fog
#

new YourClass().runTask

subtle blade
#

You're fine to extend BukkitRunnable, though you don't want to call the run method yourself

#

The scheduler does that when you call the appropriate runTask() methods

frigid ember
#

Hey, i'm searching a way to always have a biome plains in 0 0 (the terrain need to be a plains too)

noble aurora
#

I have a plugin called group manager (not essentials) which keeps coming back after I deleted the jar and folder in plugins [and they have no support discord]

bleak osprey
#

hey,

does anybody know how to setup VotingPlugin on Bungeecord with Pterodactyl?

fickle palm
sturdy oar
stuck quartz
#

how do i create a PersistentDataContainer so i can save it inside the PersistentDataContainer on my sign?

tiny pebble
#

whenever that happens to me it tends to mean my port isn't forwarded correctly or something similar

#

im not the one who fixes it so im not 100% sure

dry horizon
#

kind of dumb question in BlockPlaceEvent how can i get the placed block it's getBlockPlace right?

vernal spruce
#

If ur not sure about a specific method checking the javadoc can give you the answer

#

Clarity method for getting the placed block. Not really needed except for reasons of clarity.

dry horizon
#

thanks

grave narwhal
#

kind of dumb question in BlockPlaceEvent how can i get the placed block it's getBlockPlace right?
@dry horizon e.getBlock();

dry horizon
#

can i get it as an ItemStack? or just use e.getItemInHand();

vernal spruce
#

yes getiteminhand will return the item used to place the block

dry horizon
#

thanks

limpid veldt
#

how do you add plugins?

grave narwhal
#

@dry horizon

#

@EventHandler
public void onBreak(BlockPlaceEvent e) {
Block placedblock = e.getBlock();

    placedblock.getState().getData().toItemStack();
}
vernal spruce
#

once you have spigot,as simple as dragging the .jar file into the "plugins" folder then starting the server

grave narwhal
#

try that

vernal spruce
#

A block once placed loses all its info

#

if the block had a lore or anything related will be gone

grave narwhal
#

ah

dry horizon
#

getItemInHand seems to work

grave narwhal
#

kk

dry horizon
#

oh wait no it doesnt

grave narwhal
#

what r u trying to do?

dry horizon
#

mb was testing something else

vernal spruce
#

are you sure? choco confirmed it returns no matter what hand used

dry horizon
grave narwhal
#

can someone help me out here

#

one sec

vernal spruce
#

why are you using a try/catch

#

for a event?

#

some points before you continue

#

first also give a check if the item has an actual itemmeta(if item.hasitemmeta) before getting it

grave narwhal
#

ok can someone help me

dry horizon
#

nevermind it's working now when i removed the try catch

vernal spruce
#

i dont think you can directly check if a list of strings contains a string

lone fog
#

getItemMeta and getLore can both return null

#

But using a try catch is not the proper way to check that

vernal spruce
#

@grave narwhal you didnt say the problem

grave narwhal
#

and then if it is filled with blocks of coal i want it to print a custom itemstack (thats simple enough i can do that i just need to be able to check if the items are in the slots)

vernal spruce
#

well its just a tiresome 3 loops

grave narwhal
#

well

lone fog
#

Or 1 loop with a Int[] of slots

vernal spruce
grave narwhal
#

could i just have it go through an InventoryClickEvent

#

and then check the slots?

lone fog
#

yes

grave narwhal
#

yea so how would i check those specific slots?

vernal spruce
#

for(x 20 to 22) if inventory.getslot x is coal)

#

you have a inventory method

#

getSlot i think

#

wich returns the item in the specified slot

grave narwhal
#

getSlot only returns an integer

lone fog
#

for int slot : new Int[] { 10, 11, 12, 19, 20... }

grave narwhal
#

so if i clicked the first slot it would return 0

vernal spruce
#

nvm

#

here it is

#

getItem(slot to check)

#

will return the item in that slot

lone fog
#

actually probably best to declare the array once

#

And then just do inv.getItem(slot)

vernal spruce
#

yeah can help having the array

#

less loops

grave narwhal
#

its not working

#

my IDE is just screaming at me

lone fog
#

That's not a boolean

grave narwhal
#

it tells me to enter an int

#

lol

lone fog
#

ItemStack item = e.getClickedInventory.getItem(slot);

grave narwhal
#

im checking to see if the slots in an inventory have a specific item in them

vernal spruce
#

@grave narwhal the code you wrote expects a boolean

#

checking if(thisIsTrue)

#

That method returns a ItemStack

#

or null if its nothing

lone fog
#

you would want to do something like ```
ItemStack item = e.getClickedInventory.getItem(slot);
if (item != null && item.getType == whatYouWant)

vernal spruce
#

so to check if there is a item in there do if(event.getClickedInventory().getItem(slot).getType()==Material.COAL_BLOCK)

#

also check before if the clicked inventory its the right one

#

this will fire even when in a random chest/player inventory

grave narwhal
#

alright

tame bough
#

Im getting an error with bungeecord

#

Failed to verify username

stuck quartz
#

how do i create a PersistentDataContainer so i can save it inside the PersistentDataContainer on my sign?

dry horizon
#

how do i get colored glass pane

lone fog
#

Material.COLOR_STAINED_GLASS_PANE

dry horizon
#

that doesn't exist?

lone fog
#

What version are you on

dry horizon
#

oh

#

you meannt (color)_STAINED_GLASS_PANE

lone fog
#

mhm

dry horizon
#

ty

stuck vine
#

Hi, maybe a stupid question, but can someone help me with generating a blank world

lone fog
#

@stuck quartz (your container).getAdapterContext().newPersistentDataContainer();

stuck quartz
#

thanks

stuck vine
#

My WorldCreator.generatorSettings() doesn't seem to affect the world generation at all

#
  private def createEmptyWorld(name: String): World = {
    val creator = new WorldCreator(name)

    // Do not generate any blocks, just a big eternal void
    creator.`type`(WorldType.FLAT)
    creator.generatorSettings("""
                              |{
                              |  "layers": [
                              |    {
                              |      "block": "air",
                              |      "height": 1
                              |    }
                              |  ],
                              |  "biome": "plains"
                              |}
                              |""".stripMargin)

    creator.createWorld()
  }
#

this is the code I am currently using, it is in Scala, but that shouldn't matter, as the thing that is not working is the JSON

dry horizon
#

is this typescript

#

also how can I get the inventory name in InventoryClickEvent in 1.16.1

lone fog
#

event.getView().getTitle()

dry horizon
#

thanks

lone fog
#

You shouldn't use that to check if it's the right inventory btw

dry horizon
#

then how

lone fog
#

player.openInventory() returns an inventory view you can compare with event.getView()

hardy cedar
#

hewp

#

when i do updateTeam

#

For 2 things in the scoreboard

#

the last one to update Stills and the Other Disappear

stuck vine
#

Hi, maybe a stupid question, but can someone help me with generating a blank world
Nevermind, got it fixed by extending ChunkGenerator like

#
private def createEmptyWorld(name: String): World = {
  val creator = new WorldCreator(name)

  // Do not generate any blocks, just a big eternal void
  creator.`type`(WorldType.FLAT)
  creator.generator(new EmptyWorldChunkGenerator())
  creator.createWorld()
}

private class EmptyWorldChunkGenerator extends ChunkGenerator {
  override def generateChunkData(world: World, random: Random, x: Int, z: Int, biome: ChunkGenerator.BiomeGrid): ChunkGenerator.ChunkData =
     createChunkData(world)
}
wheat mirage
#

Teleporting players to another world during some events gives a "Removing entity while ticking" error where in previous version it did not, is this intended behaviour?

#

I've tried using the scheduler with a 0tick delay to teleport, but this allows the player to log out etc which can be very problematic.

stuck quartz
#

why isnt PersistentDataContainer saving

grim halo
#

@stuck quartz In what context?

stuck quartz
#

im writing

#
// variable "e" is the event
Block signBlock = e.getBlock();
BlockState signState = signBlock.getState();

String chest_name = "debug banana";

PersistentDataContainer container = ((Sign) e.getBlock().getState()).getPersistentDataContainer();
container.set(new NamespacedKey(ChestSecurity.plugin, "chest_name"), PersistentDataType.STRING, chest_name);  

System.out.println(signState.update(true)); // this returns true

this script is in a SignChangeEvent event handler

grim halo
#

@frigid emberoooooon_ sync your servers time. It might be of.#

#

.google Sync system time

stuck quartz
#

so

#

what is possibly wrong with my code

#

why isnt it saving

wheat mirage
#

Does persistent data container use nbt?

grim halo
#

Yes.

wheat mirage
#

Cool beans

#

@stuck quartz We need more information

grim halo
#

Was about to say that. Cant see anything wrong here

wheat mirage
#

What happens when you try to find the value?

#

Are you using more than one instance of the namespacedkey? you may want to try just using one.

grim halo
#

Bit more context on how you set the data and how you retrieve it

wheat mirage
#

Add some debugs to make sure the data is being set.

#

After you set it, instantly query to see if it exists

#

There's a lot of things to try here

grim halo
#

There is no problem with multiple instances of namespacedkey

wheat mirage
#

Teleporting players to another world during some events gives a "Removing entity while ticking" error where in previous version it did not, is this intended behaviour?
I've tried using the scheduler with a 0tick delay to teleport, but this allows the player to log out etc which can be very problematic.

#

@grim halo good to know, is it preferable to use just one if possible?

stuck quartz
#

i saved a NamedspacedKey in a script called Utils, but i wrote the NamespacedKey on the message for more context
i'm checking if it did save with container.getKeys(), but it returns me []

Add some debugs to make sure the data is being set.
@wheat mirage i have so many debugs on the script in the plugin, and they're showing up with no problem

lone fog
#

PersistentDataContainer container = ((Sign) e.getBlock().getState()).getPersistentDataContainer();

#

Replace that with signState.getPersistantDataContainer()

stuck quartz
#

ok

grim halo
#

@wheat mirage Just teleport with one tick delay. As long as you have a reference to Player there should be nothing wrong with them logging out.

stuck quartz
#

Cannot resolve method 'getPersistentDataContainer' in 'BlockState'

grim halo
#

Not every BlockState is a PersistentDataHolder

#

More context pls. Show us more about the code you use to write the persistent data and how you retrieve it.

stuck quartz
#

let me just remove some of the dozens of unnecessary debugs

lone fog
#
container = spawner.getPersistentDataContainer();
int count = container.get(SpawnerKey.SPAWNER_COUNT, PersistentDataType.INTEGER);
container.set(SpawnerKey.SPAWNER_COUNT, PersistentDataType.INTEGER, count + 1);
spawner.update();```
#

That works, so yours should be working

wheat mirage
#

@grim halo There is, I've done extensive testing even with a 0tick delay

grim halo
#

In what event do you teleport the player?

#

I would know a workaround...

#

Workaround would be:
Before teleporting: add value to PersistentDataContainer of player containing the teleport location as a value.
In the scheduled runnable you remove the entry after teleporting.
If the player logs in with the tag present you just teleport them then and remove the tag.

#

It sounds a bit hacky but it should work. Also im not sure how you tested the logout problem...

frigid ember
lone fog
#

?paste

worldly heathBOT
frigid ember
grim halo
#

Do you have the same plugin installed twice?

frigid ember
#

nope

grim halo
#

Is this from your own plugin?

frigid ember
#

yes

#

what i searched its something about initialization instance

grim halo
#

Do you have more than one class that extends JavaPlugin?

warped dune
#
Searched in the following locations:
  - https://repo.maven.apache.org/maven2/net/md-5/bungeecord-chat/1.12-SNAPSHOT/maven-metadata.xml
  - https://repo.maven.apache.org/maven2/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.pom
  - https://repo.maven.apache.org/maven2/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.jar
  - https://hub.spigotmc.org/nexus/content/repositories/snapshots/net/md-5/bungeecord-chat/1.12-SNAPSHOT/maven-metadata.xml
  - https://hub.spigotmc.org/nexus/content/repositories/snapshots/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.pom
  - https://hub.spigotmc.org/nexus/content/repositories/snapshots/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.jar
  - https://mvnrepository.com/artifact/redis.clients/jedis/net/md-5/bungeecord-chat/1.12-SNAPSHOT/maven-metadata.xml
  - https://mvnrepository.com/artifact/redis.clients/jedis/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.pom
  - https://mvnrepository.com/artifact/redis.clients/jedis/net/md-5/bungeecord-chat/1.12-SNAPSHOT/bungeecord-chat-1.12-SNAPSHOT.jar
Required by:
    project : > org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT:20170803.111256-74```
#

wat

stuck quartz
#
container = spawner.getPersistentDataContainer();
int count = container.get(SpawnerKey.SPAWNER_COUNT, PersistentDataType.INTEGER);
container.set(SpawnerKey.SPAWNER_COUNT, PersistentDataType.INTEGER, count + 1);
spawner.update();```

@lone fog i tried it and it worked! thanks a lot

frigid ember
#

no its about instance

#

i created this:

#

public static Bedwars instance = new Bedwars();

#
        Join.instance = instance;
    }```
#

and in main class

#

Join join = new Join(this);

#
Join.loadConfig();```
grim halo
#

pls use 3x ` to write code

wind dock
#

quick thing, people in my server cant do /bal or /pay. I gave them the permission node essentials.bal and essentials.balance, along with essentials.pay

grim halo
#
Like this
crimson sandal
#

It's saying v2.0 Release but I had to re-release as v2.0-Release

grim halo
#

@warped dune try running BuildTools

frigid ember
#

do you know whats the error?

grim halo
#

@frigid ember Dont ever create a instance of you main class.

frigid ember
#

what?

warped dune
#

okay

frigid ember
#

i dont understand

lone fog
#

    public void onEnable() {
        plugin = this;```
grim halo
#

The 'main' class is the class that extends JavaPlugin.
eg if SomeClass extends JavaPlugin
You do not want -> new <- before -> SomeClass <- ever.

frigid ember
#

i maybe know the problem...

lone fog
#

In your case

#

public void onEnable() {
    instance = this;```
gusty comet
#

Can i make it that if i send a message to a player and it goes to a new line automatically in the message, that i add 2 spaces?

grim halo
#

@wind dock Its probably a problem with your permissions setup. Check everything again.

#

@gusty comet No. The amount of chars that are displayed in one line is client side

gusty comet
#

ah okay

#

ty

wheat mirage
#

@grim halo I can think of many hacky ways to solve the problem

#

I wondered if this was a spigot bug or not, or if there was an officially supported workaround

#

For teleporting during events

#

For reference, this is an entitydamagebyentity event

grim halo
#

Again. What events are you using

frigid ember
wheat mirage
#

@grim halo I answered that

#

Player is the victim.

grim halo
#

Interesting... thats a bit weird to be honest.

wheat mirage
#

It is, but I'm not sure where to submit it to jira @grim halo

tacit trellis
#

do interactive books work with 1.8?

frigid ember
#

@tranquil edge u noob

#

did u even readed that text?

wheat mirage
#

@tranquil edge you're missing the pom.xml s or the project is setup incorrectly.

grim halo
#

Lol petakou... you just instanciated your main class. Dont u dare calling someone a noob...

frigid ember
#

bruh

#

thats not that problem

wheat mirage
#

@tranquil edge Google as much as you can, your IDE should give you pointers on what to fix

#

Run a maven reimport

#

etc etc

#

@frigid ember You're obviously initialising your plugin yourself, or you have duplicate jars in your plugins folder

#

@tranquil edge Try clean install

#

on the root maven project

#

And also, the pom for spigot shouldn't be missing

#

Re-run buildtools

#

Update maven

#

Update intelliJ

#

Google it, the maven wiki will explain better than me

frigid ember
#

i have this instances:

gusty comet
#

How can i make this in my own command? I know how to make it with normal suggestions but i think this is different

#

Im on Bungee btw

frigid ember
#

Join Class:```
public static Bedwars instance = new Bedwars();

public Join(Bedwars instance){
Join.instance = instance;
}```

lone fog
#

new Bedwars();

#

No

#

Stop

grim halo
#

petakoumak what is your main class

wheat mirage
#

@frigid ember NEVER initialise your main class

grim halo
#

If its "Bedwars" then do not instanciate it

wheat mirage
#

Spigot will do it for you

#

Use that instance, and that alone

lone fog
#

Like I said

wheat mirage
lone fog
#

    public void onEnable() {
        plugin = this;```
wheat mirage
#

Embarassing

frigid ember
#

Main Class : ``` public Bedwars(){
instance = this;
}

public static Bedwars getMain(){
    return instance;
}


public static Bedwars instance;

public void onEnable()
instance = this;```

wheat mirage
#

Don't use an initialiser for your main class

#

Just use onEnable

grim halo
#

Make the constructor private and empty so you dont do something stupid like this again pls.

wooden patrol
#

anyone know why my nametags doesnt work Im using spigot 1.16.1 that is connected to bungee and they are simply not being display above player head I don't know why.. Here is my scoreboard.dat https://prnt.sc/tj5104 I would be thankful if anyone can help me solve this issue

frigid ember
#

but i need it public static

grim halo
#

Also writing a getter for a public static field is pointless

lone fog
#

public void onEnable() {
    instance = this;```
grim halo
#

^

lone fog
#

Not that I encourage the public static part

wheat mirage
#

I don't mind it, if you need extra functionality on top of a getter in future 7smile

frigid ember
#

so wait what i need to do?

wheat mirage
#

Lombok's getter is easy to add

pastel nacelle
#

pass your plugin instance to the class in the constructor

wheat mirage
#

and adds some slight future proofing

pastel nacelle
#

skip the static abuse

grim halo
#

Delete your plugin and learn java

pastel nacelle
#

basically

wheat mirage
#

@pastel nacelle I wouldn't qualify this as static abuse

grim halo
#

Oh

frigid ember
#

bruh

wheat mirage
#

It would be used the same even nonstatic

pastel nacelle
#

anything that has static in it is static abuse unless it's actually necessary

wheat mirage
#

You could even argue you're pointlessly storing many pointers

#

When it's not necessary

#

@pastel nacelle Don't blindly call things static abuse, consider each case individually

pastel nacelle
#

this is static abuse

wheat mirage
#

It shows more of a lack of understanding of java than any knowledge

pastel nacelle
#

this doesn't need to be static

#

why would it be static

wheat mirage
#

It doesn't need to be non-static, and in fact as I just explained it could be less performant if non-static.

grim halo
#

There is something called dependency injection and it should be encouraged for JavaPlugin classes.

wheat mirage
#

Dependency injection is fine, but unless the spigot plugin structure changed at all, it would never be strictly necessary

grim halo
#

But every beginner tutorial does use the singleton approach because its easy and convenient

wheat mirage
#

I disagree in this case.

#

Singleton's are fine for a JavaPlugin class

#

As there can literally only be one at any time

pastel nacelle
#

it could be less performant if non static
imagine caring about this level of a micro optimization before you have even tested anything

wheat mirage
#

@pastel nacelle I read up on it some time ago, when someone did tests.

pastel nacelle
#

yeah

#

i bet those 5ns are going to come really handy

wheat mirage
#

Imagine caring that much about blindly following standards even when it doesn't make sense

#

Use your brain, not your paper

frigid ember
#

hey im not from america/uk/ other countries where is talking english, i dont understand u guys

wanton delta
#

so if i change a private variable to private static i'm assuming that the object wont be created when a subclass is instantiated?

pastel nacelle
#

at any rate

#

in an object oriented language you ought to do things in an object oriented fashion unless that is just really shoving shit into your gears

frigid ember
#

hey im not from america/uk/ other countries where is talking english, i dont understand u guys

pastel nacelle
#

you can go back to python to micro optimize your pointers or whatever

wheat mirage
#

I'm not saying the dependency injection approach is wrong

grim halo
#

@wanton delta Yes. A static variable lays in the class scope. A non static in the instance scope.

wheat mirage
#

But don't slam a more efficient method as wrong when it's an equally valid design approach for this specific scenario

pastel nacelle
#

there is absolutely no reason whatsoever to have a static getter for every single one of your classes and telling him to do that in his first plugin is just going to have him learn bad habits

wanton delta
#

alright, thats what i thought.

forest sigil
#

Will the hex text colour option in 1.16 work on the motd/server list?

wanton delta
#

i didn't realize a hashmap i meant to be static was being created over and over again... lol :)

pastel nacelle
#

it's not "more efficient", it's barely even a micro optimization

lone fog
#

You already got an answer in #general

pastel nacelle
#

it's a nano optimization

wheat mirage
#

Sick of arguing with idiots in the spigot discord, learn the reasons behind standards instead of laser printing a book into your brain

pastel nacelle
#

itty bitty teeny weeny optimization

#

one that is going to bite him in the ass later

#

so; don't teach him on bad habits

grim halo
#

@wanton delta You generally dont want a static HashMap. You should create some sort of Manager class that
maintains the one collection you want.

frigid ember
#

anyone knows?

wheat mirage
#

It's an NPE

#

Find out what's null

#

Do a null check

grim halo
#

Its a Nullpointer. It points to null.

frigid ember
#

what it means?

wanton delta
#

in this instance it's fine for what it does

grim halo
#

google nullpointer

wheat mirage
#

It means buy a java book or follow an online tutorial on java

wanton delta
#

but yes i do use managers

grim halo
#

No offence but I would really recommend you to learn the basics of Java @frigid ember

crimson sandal
#

What's the correct way to check if a chunk is loaded

frigid ember
#

so i didnt set command in plugin.yml?

grim halo
#

world.isChunkLoaded

wanton delta
#

chunk.isLoaded

grim halo
#

no

wanton delta
#

what

wheat mirage
#

@crimson sandal What smile said, if you get an instance of the chunk, it automatically loads it

#

@wanton delta no, don't use that

wanton delta
#

oh didnt know thats what the JD told me

#

¯_(ツ)_/¯

grim halo
#

chunk.isLoaded will return always true as you need an instance of a chunk

wheat mirage
#

If you're on another thread or with a delay, it may work

wanton delta
#

that makes sense

wheat mirage
#

But never rely on it

wanton delta
#

👍

wheat mirage
#

Bukkit loads the chunk to populate the CraftChunk info

crimson sandal
#

So you get the world and then pass through the locations x and z

wheat mirage
#

🙂

#

@crimson sandal The chunk x and z

grim halo
#

Yes the chunk x and z

crimson sandal
#

So that's getBlockX()/16

#

etc?

grim halo
#

so location coords: "Math.floor(x) >> 4" and "Math.floor(z) >> 4"

wanton delta
#

you could use .getChunk.getX

#

or that

grim halo
#

or yes just devide by 16...

wanton delta
#

i personally prefer bit manipulation

#

thats kinda the standard approach

grim halo
#

Its basically the same

wanton delta
#

yea

crimson sandal
#

Okay sweet 🙂

wanton delta
#

i just prefer it, thats just my opinion tho :P

wheat mirage
#

I wonder if compilers ever optimise divisions by powers of 2 to bit manipulation under the hood

#

Pretty interesting

#

Does the bit manipulation approach ever have problems with signed values?

#

Assuming not, but still curious how it avoids it

pastel nacelle
#

bit shits and division have different outcomes with negative values

#

compiles will generally substitute them if they can ensure that there will be no side effects in doing so

#

things like multiplication are also substituted with a set of leftshifts and additions

wheat mirage
#

How come >> 4 works for the chunk X and Z

#

Those are signed (potentially negative) values?

pastel nacelle
#

because that's how the math works

#

plain modulus won't

wheat mirage
#

bit shits and division have different outcomes with negative values
@pastel nacelle

pastel nacelle
#

negative values with % will have you off

crimson sandal
#

I started a GameBoy emulator in Java during Lockdown which had a whole headache of bitwise operations 😄

#

Mostly since Java has everything signed 😄

wheat mirage
#

@pastel nacelle Don't understand what you mean, we're not talking about % here

#

You said left shift and DIV can have different out comes with negatives