#help-archived
1 messages · Page 179 of 1
but if it's someone else's plugin... too bad
if it's your command, check the constructors for
Command
@frigid ember The constructor only specifies the name of the command
it has two constructors
Command(String name) and Command(String name, String perm, String... aliases)
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
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
I believe it won't even call execute if the sender doesn't have the perm node
Can i change the no perm message?
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
Yeah but i want to disable tab complete 😄
¯_(ツ)_/¯
your constructor can have completely different parameters than the superclass'
so yeah you can remove it
Yes but will bungeecord detect it?
ofc
ah okay
Hey! I would like to have a block where I can identify it from other separate chests? Would anyone know how?
I mean of course it will work but my goal is to make the permission thingy work
yeah the perm thing will work
it'll pass a null-valued string array for aliases
so aliases are registered
My server freezes whenever someone logs in. And I've not changed any code it's flagging up in the crash log, anyone got any insights? https://hastebin.com/agujurepij.md
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.
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?
have you specified the operation?
Clearing attribute modifiers seems to get rid of them
So I'd assume they're a part of that
what operation should i be using
no idea
im using ADD_NUMBER
you could try playing around
none of them work
theres only 3 anyway
im talking about this btw
aa
also when i add a speed modifier it gets rid of dmg
Command(String name)andCommand(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
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.
And letting people tab complete admin commands triggers my OCD ^^
Yeah thats too complicated for me lol
One message removed from a suspended account.
because it only has two constructors:
(String)
(String, String, String...)
but not (String, String...)
because as third parameter for String... it "passes" null
it'll pass a null-valued string array for aliases
👆
I did it myself before and it threw an NPE lol
(String[]) null
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
Ohhh
@wheat summit Look into blockstates and blockdata. Blocks aren't cast directly, only their data.
Ok, I'm also in 1.8 so there's no BlockData
How would I use Blockstates since I think they exist?
Ok thanks
java docs 🙌
My server freezes whenever someone logs in. And I've not changed any code it's flagging up in the crash log, anyone got any insights? https://hastebin.com/agujurepij.md
I feel like bolding questions may be a good idea for this channel
Yeah I can tell
is there a better way to get an entity from a protocollib packet?
Anyone know how to change the lifetime of a FallingBlock?
Than finding the entity with matching entity id?
Is this bad?
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");
}
}
@mellow wave event.getPacket().getEntityModifier(event).read(0);?
Is that decent code.
Well yeah but this is easier to "maintain"
@frigid ember I don't necessarily disagree with passing in registry values etc
I can help more after I sleep it's 00:40 :/
No worries, thanks @mellow wave
same
@mellow wave It's an entity metadata packet, and I will, thanks!
Well and also a spawn entity living
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?
declaration: package: org.bukkit.event.block, class: BlockGrowEvent
@wintry bison you can listen to that event and cancel it whenever 🤷♂️
Anyone know how to change the lifetime of a FallingBlock? The nbt tag is Time
try setTicksLived()
Is there a way to make an entity have no hitbox?
There's no Nevermind updated to 1. 8.8 and the method was theresertMarker method in 1.8
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?
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 😦
@rotund orbit download build tools. in cli run "java -jar BuilTools.jar"
bim bam boom
or double click it
How would I get the amount of people in a boat using VehicleEvent
@rotund orbit java -jar BuildTools.jar --rev 1.16.1
thank you 🙂
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
java -jar BuildTools.jar --rev 1.16.1
thats what i've done
Did you download the latest BuildTools?
is there a place to hire a dev ? i need my plugin fixed
How do I use nms in my plugin using maven
holy-
i DID NOTHING WRONG
:((
but on update
The Scoreboard DUPLICATES THE TEXT
THATS GREAT
if (placedBlock == water) {```
I need to check the block thats placed without an event :/
How would that be done in a situation like this? 😐
it has to be done with an event afaik
do i just need to dump my plugins into the plugin folder to make them work?
if you restart after dumping them in
k
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 :/
how should I get the version and compare to make sure nms is compatible with that version?
((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
and how do I find the mappings versions that nms is using
or like what to I compare that to
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)
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?
Not necessarily. Arguably the better approach
Just depends on what exactly you're working with
okay... seem like comparing the mappins version takes a lot more work to see what the nms version is
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
a method in the api?
No no, NMS
or a method in nms
It's obfuscated and if a small change is made in the class by Mojang, the class' obfuscation may vary
okay thanks
so in case I take the second method, I'll just have to update if the method changes in the same revision
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
is it possible to store a PersistentDataContainer inside another PersistentDataContainer?
so im using luck perms and essentials chat and i cant seem to get prefixes and suffixes for roles working
you need vault i think
wdym?
its another plugin
what does vault helps in when making a plugin?
how to i change save location
intellij
yea
@mellow wave you solved my protocollib issue, thanks!
What’s the code to make the config.yml reset and update on a new plugin version?
Yes
How do I get it
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
Ok
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
?bt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
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
oh it's called buildtools?
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
oof goddamn
yea
is there any way to fix the enchantments past level 10 names or do i just have to hide enchants and add lore
how can i remove old values in scoreboard so it doesnt get dulplicated? https://ss.pvplounge.com/FfrG6.png
@hardy cedar use teams and just reset the suffix or prefix.
https://paste.md-5.net/vujuturoki.cs @balmy sentinel
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?
🤷♂️
You can do that with packets. Its basically intercepting item packets and hiding the enchantments -> adding lore to the beginning of the lines
Yeah it’s client side if you want to fix it that way
how do i check if a block is a chest?
i tried block.getBlockData() instanceof Chest so far
Check if the blockstate is instance of chest.
Does checking the Material not work?
ill try both
Material should work
Material check is the preferred approach as getBlockState() and getBlockData() create snapshots
And we don’t need more of those, mojang already breaks things with ever one they release
Not quite what I meant with snapshots lol. Think World#getChunkSnapshot()
It creates a mutable copy of the block state
XDD
sorry to be annoying, I just want to know if md thinks this is a bug: https://hub.spigotmc.org/jira/browse/SPIGOT-5901
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.
Why do you need to check the name?
player.openInventory returns an inventory view you can compare with event.getView
Rather than using the name
@rich olive I've reopened the issue
Hello anyone knows an NPC Plugin which lets me trade custom items
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
player.openInventory returns an inventory view you can compare with event.getView
player.openInventory returns an inventory view you can compare with event.getView
it's literally just a == comparison lol
Mhm
as fast as it gets
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
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!
.------------.
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
Thats basically what ive said. In your case SomeData is just a UUID
yessir just going to get some dinner and then I’m going to code it. Thanks guys!
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!
@sudden elk Depends on how the frames are hidden. But i suspect that you would need to send a packet to every nearby player.
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
I don’t know but it does
Only the player that makes it invisible instantly sees the change
How does the player make it invisible? Is it a command, an interaction...?
What do you mean by "makes it invisible"
When you click the itemFrame it toggles
that's what he's calling
^ yes
but it supposedly doesn't update for everyone 🤔 which doesn't make much sense
thanks Choco
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)
doesn't really make much sense...
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!
I'm trying to get all chests in a world, I can't get getLoadedChunks since players won't be in the world
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?
To fill them with random items
Want the source code? Its a bit complicated as i wrote it in ~2h
Sure ok
Wait ill add some comments so that you are not completely lost.
Its better if i write a fast api with a Consumer<Chest>...
@grim halo It doesn’t print the message. https://paste.md-5.net/gitesicija.java I just realized I never remove from the Map but I don’t think that’s the issue.
Just put some sysouts in your method to see how far you get
https://paste.md-5.net/atuvitokoh.java It only calls the event it never gets within the if statement
Maybe try event.getClickedInventory
nope still only calls the if statement never goes within it
Could you show me the code where you open th GUI?
https://paste.md-5.net/ewuyujurix.java No error checking yet but I’m testing it on myself so targetPlayer shouldn’t be null
and the GUI opens up fine and everything it’ll say “Report Rubberninja” at the top
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.
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?
is there an event similar to PlayerMoveEvent, but for all entities?
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
okay I’ll try it
I think you dont want an EntityMoveEvent... What exactly are you planning on doing? @knotty karma
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?
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.
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)
@knotty karma Yeah i think you have only two options:
- Like you said. Iterate over every player then iterate over entities nearby.
- Extend NMS entity and do something with the tick() method or Pathfinder/AI
thanks! I’m going to try it right now
@frigid ember Whats a Pattern items lore?
Flower Charge
alright, thx for the help :)
Ah the item
You can try using the HIDE_ATTRIBUTES ItemFlag...
If that doesnt work its probably client side.
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
how to
meta.addItemFlag(ItemFlag.FLAG)
is there a plugin for it
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
do u know the name of ther plugin
InventoryView represnets a HumanEntity viewing two inventories (top and bottom inventories)
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?
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.
lmao glad I learned this😂
But it still hasnt fix my Banner Pattern lore issue tho
It still syas flower charge
Ah the banner pattern meta is (for some reason) the potion meta?
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.
@rugged sundial Look at this example.
https://www.spigotmc.org/resources/selecteverywhere.64475/
java would be 10x better if you could return tuples like in python 😦
pls no. I like my type safety as it is.
Also you can create a tuple class and then return it ^^
mhmmm debating
We can discuss why Java should be as far away from dynamically typed languages as possible,
Kind of... If we dont count reflections
lol nah it would save some lines of code tho
I'd probably say my favorite is python, than c, than java
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
assembly is the worst🤮
Thats the strength of python. You can in some instances write short code that just does the thing you want.
the advantage of the JVM implementing however is the possibility of native code enhancement.
anyone know a rules gui plugin which allows heads to be added in
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.
depends really
I'm a computing security major so it's somewhat important to understand
@keen compass What do you mean by that the advantage of the JVM implementing however is the possibility of native code enhancement.
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.
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.
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
Ofc. But you dont compile Java code for one set.
No, but Java is fast. Faster then it used to be anyways lol
Exactly. Thats what i meant by: If you write it fast its fast everywhere. (Almost)
How do I create a plugin that hides all banner pattern lores
@frigid ember Look into ItemFlags maybe
the advantage of C++ is you can make use of instruction sets directly as opposed to Java making that determination which can be annoying
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
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.
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
I still see Miscallenous blue font
@frigid ember Are you sure that's not just your F3+H settings?
I hate cleaning up in C++. I like Javas GC a lot.
can still happen, but it isn't as a major problem as it is in C or C++ when you forget to release resources 😛
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
The banner pattern is stored in the potion meta i think...
can u teach me on how to im clueless lol
Do you want to hide the attributes of every pattern?
yeah i do
i just want to cretae a plugin right now that hides every banner pattern lore
Have you written a plugin before?
nope
Hm... do you know Java?
XD no but if u link me a website that teach basics
then i could probably learn it within a day or so
the other thing people forget also is that Java makes it easier to interact with other languages as well directly and indirectly
@frigid ember You need some dedication and at least some days to get the basics right.
directly you can use JNI to interact with native code and indirectly you can make use of system commands right from within java
But to be fair every language with memory access can interact with other languages like that.
Yes, but there is a difference between the ease of doing so
I mean in C# its basically just unsafe{... write C-ish code with e.g. a class for intpointer }
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
Its pretty similar yea
But how would you for example interact with Python where you have absolutely no access to memory?
system command line
Or use a memory mapped database like Redis.
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
Doesnt this need IO access?
Only IO access you are going to need is a line reader at most
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
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
anyon eable to help me removing banner patern chares lore pls
I still haven’t figured that one out yet... HIDE_ATTRIBUTES doesn’t work
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
and that attitude is perfect for not learning
wdym @graceful vigil
can someone open the port for me ?
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
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? 🙂
Does any of u got any plugin to remove this
https://gyazo.com/7fcdaa0243263e377465bf0cfb84d653
"Flower charge"
uh
does a hideflags exist for it?
if not then its probably client side and nothing you can do about it
Any idea what my problem is? :c
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
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
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?
is there any way to find which version of java is running on the server?
check a timings report?
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
(Prepare for terrible explaining) How do I use a runnable like below on an interface that has more than 1 non-overriding abstract methods https://gyazo.com/25feb38e85280200db174530fa229b19
executing method and interfaces look like this https://hatebin.com/cjhijiqqui
you can't
You understood what they wanted to do?
Sounds like they wanted to use lambdas on an interface with two different methods
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
default link is this: https://download.mc-packs.net/pack/f97861d3205d24dd5fd52c7d6f419db8cb797174.zip
sorry for really bad english
@frigid ember have you tried adding ""'s to the url?
like
resource-pack="https://download.mc..."
no
could you try doing that?
could you try removing the https:// part?
so resource-pack=download.mc-packs...
without the quotes
Anyone here who's experienced with VotingPlugin reward setting up?
the \ is irrelevant, that's just escaped, the file is saved back to the disk automatically, so it just takes the char escape
@raw canyon don't ask if someone is experienced with something, just ask the question and wait for someone to respond
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?
copy/paste your yml and throw it in a yaml linter
(<unknown>): did not find expected key while parsing a block mapping at line 51 column 5
on line 51, it's Enabled: true
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
i restarted the server and this error showed up on the console any issues? i just updated to 1.16.1
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);
could you try removing the https:// part?
@torn robin tried, same
What version of MC are you on?
me?
Yes
1.8.8
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.
oof
found it, for future reference new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.WITHER.ordinal())
Can I use "BuildTools.jar" without downloading PortableGit (I do have git installed and in my PATH)?
if you have something else wich can run the command yeah
git bash is to allow use of "java -jar" command
Im running "java -jar BuildTools.jar" and it downloads PortableGit. But I have installed git.
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.
What's the problem with using git bash?
Its not a problem. But why doesn't it detect that git is installed in powershell?
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
how are they ordered client wise cry? or do you not know?
@crisp bluff do you not have git bash installed already?
nope, the enchantments are dynamic on the book
curious, is it by order of enchanting?
don't know, the enchantment table can return books with 2 enchantments and fishing can return 3+
im curious whats the use case for this?
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
@torn robin I have installed git bash. But why does "BuildTools.jar" download PortableGit, when git is already installed (inside Powershell)?
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
can you run git commands themselves in Powershell?
i was just hopping in here with hopes that there's an easier way
yes
I strongly doubt there's a convenient api-friendly way of doing what you're trying to do unfortunately
yikes
there might be but idk off the top of my head
thanks for your help regardless though
Why install git bash, but not use it?
https://www.spigotmc.org/threads/building-spigot-on-windows-without-downloading-portable-git.344198/
Powershell with Microsoft Terminal is better
buildtools runs everything in bash
It's probs not picking up the version installed in the windows path for some reason
But why does it want to use "sh" when running on Windows?
¯_(ツ)_/¯
because the scripts are all written in bash
My guess is easier development
it works across platforms
@chrome lark makes sense
Which is even better, because they don't have to make multiple
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 🤷♂️ )
Maintaining 2 would just give the devs extra work for no reason
oh boy
Thought you were serious, was about to slap you silly
I mean, if that's your attitude, brb
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();
you'd have to be doing something pretty crazy for that to /really/ matter
okay cool so it doesn’t matter
Has anyone ever done multi-spigot version support with Gradle? I've seen it done on Maven with submodules, I don't know if https://docs.gradle.org/current/userguide/multi_project_builds.html is the equivalent for Gradle
Gradle also has submodules sure
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
anyone know why RunnableCoutdown is newer used? https://prnt.sc/tj07va
because you're not using it
but why?
You're not calling anything on it?
In this case you really don't need to assign that to a variable
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)
im kinda stupid, how can i call that run() method in link: https://paste.helpch.at/uqagoyozeb.java
new YourClass().runTask
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
Hey, i'm searching a way to always have a biome plains in 0 0 (the terrain need to be a plains too)
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]
hey,
does anybody know how to setup VotingPlugin on Bungeecord with Pterodactyl?
please you can help me friend : https://discordapp.com/channels/690411863766466590/690470011382267904/733015761576263680
they aren't tho
how do i create a PersistentDataContainer so i can save it inside the PersistentDataContainer on my sign?
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
kind of dumb question in BlockPlaceEvent how can i get the placed block it's getBlockPlace right?
If ur not sure about a specific method checking the javadoc can give you the answer
declaration: package: org.bukkit.event.block, class: BlockPlaceEvent
Clarity method for getting the placed block. Not really needed except for reasons of clarity.
thanks
kind of dumb question in BlockPlaceEvent how can i get the placed block it's getBlockPlace right?
@dry horizon e.getBlock();
can i get it as an ItemStack? or just use e.getItemInHand();
yes getiteminhand will return the item used to place the block
thanks
how do you add plugins?
@dry horizon
@EventHandler
public void onBreak(BlockPlaceEvent e) {
Block placedblock = e.getBlock();
placedblock.getState().getData().toItemStack();
}
once you have spigot,as simple as dragging the .jar file into the "plugins" folder then starting the server
try that
A block once placed loses all its info
if the block had a lore or anything related will be gone
ah
getItemInHand seems to work
kk
oh wait no it doesnt
what r u trying to do?
mb was testing something else
are you sure? choco confirmed it returns no matter what hand used
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
ok can someone help me
nevermind it's working now when i removed the try catch
i dont think you can directly check if a list of strings contains a string
getItemMeta and getLore can both return null
But using a try catch is not the proper way to check that
@grave narwhal you didnt say the problem
i designed a neat little gui here kind of like a crafting inventory and i want to be able to check if those 9 slots are filled with blocks of coal
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)
well its just a tiresome 3 loops
well
Or 1 loop with a Int[] of slots
@grave narwhal
yes
yea so how would i check those specific slots?
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
getSlot only returns an integer
for int slot : new Int[] { 10, 11, 12, 19, 20... }
so if i clicked the first slot it would return 0
nvm
here it is
declaration: package: org.bukkit.inventory, interface: Inventory
getItem(slot to check)
will return the item in that slot
That's not a boolean
ItemStack item = e.getClickedInventory.getItem(slot);
@grave narwhal the code you wrote expects a boolean
checking if(thisIsTrue)
That method returns a ItemStack
or null if its nothing
you would want to do something like ```
ItemStack item = e.getClickedInventory.getItem(slot);
if (item != null && item.getType == whatYouWant)
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
alright
how do i create a PersistentDataContainer so i can save it inside the PersistentDataContainer on my sign?
how do i get colored glass pane
Material.COLOR_STAINED_GLASS_PANE
that doesn't exist?
What version are you on
mhm
ty
Hi, maybe a stupid question, but can someone help me with generating a blank world
@stuck quartz (your container).getAdapterContext().newPersistentDataContainer();
thanks
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
is this typescript
also how can I get the inventory name in InventoryClickEvent in 1.16.1
event.getView().getTitle()
thanks
You shouldn't use that to check if it's the right inventory btw
then how
player.openInventory() returns an inventory view you can compare with event.getView()
hewp
when i do updateTeam
For 2 things in the scoreboard
the last one to update Stills and the Other Disappear
Hi, maybe a stupid question, but can someone help me with generating a blank world
Nevermind, got it fixed by extendingChunkGeneratorlike
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)
}
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.
why isnt PersistentDataContainer saving
@stuck quartz In what context?
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
@frigid emberoooooon_ sync your servers time. It might be of.#
.google Sync system time
Does persistent data container use nbt?
Yes.
Was about to say that. Cant see anything wrong here
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.
Bit more context on how you set the data and how you retrieve it
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
There is no problem with multiple instances of namespacedkey
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?
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
PersistentDataContainer container = ((Sign) e.getBlock().getState()).getPersistentDataContainer();
Replace that with signState.getPersistantDataContainer()
ok
@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.
Cannot resolve method 'getPersistentDataContainer' in 'BlockState'
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.
let me just remove some of the dozens of unnecessary debugs
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
@grim halo There is, I've done extensive testing even with a 0tick delay
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...
hi im getting this error, anyone knows what is causing?
?paste
Do you have the same plugin installed twice?
nope
Is this from your own plugin?
Do you have more than one class that extends JavaPlugin?
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
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
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();```
pls use 3x ` to write code
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
Like this
Anyone know why the version isn't updating here for my plugin? https://api.spigotmc.org/legacy/update.php?resource=71355
It's saying v2.0 Release but I had to re-release as v2.0-Release
https://www.spigotmc.org/resources/chests-now-with-autocrafting-chest-linking-hopper-filtering-remote-chests-menus.71355/history Here it says v2.0-Release (Missing hyphen)
@warped dune try running BuildTools
do you know whats the error?
@frigid ember Dont ever create a instance of you main class.
what?
okay
i dont understand
public void onEnable() {
plugin = this;```
The 'main' class is the class that extends JavaPlugin.
eg if SomeClass extends JavaPlugin
You do not want -> new <- before -> SomeClass <- ever.
i maybe know the problem...
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?
@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
@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
Again. What events are you using
still error https://paste.md-5.net/axihiwiquz.css
Interesting... thats a bit weird to be honest.
It is, but I'm not sure where to submit it to jira @grim halo
do interactive books work with 1.8?
@tranquil edge you're missing the pom.xml s or the project is setup incorrectly.
Lol petakou... you just instanciated your main class. Dont u dare calling someone a noob...
@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
i have this instances:
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
Join Class:```
public static Bedwars instance = new Bedwars();
public Join(Bedwars instance){
Join.instance = instance;
}```
petakoumak what is your main class
@frigid ember NEVER initialise your main class
If its "Bedwars" then do not instanciate it
Like I said
Calling other people noobs in #help-archived with this.
public void onEnable() { plugin = this;```
Embarassing
Main Class : ``` public Bedwars(){
instance = this;
}
public static Bedwars getMain(){
return instance;
}
public static Bedwars instance;
public void onEnable()
instance = this;```
Make the constructor private and empty so you dont do something stupid like this again pls.
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
but i need it public static
Also writing a getter for a public static field is pointless
public void onEnable() { instance = this;```
^
Not that I encourage the public static part
I don't mind it, if you need extra functionality on top of a getter in future 7smile
so wait what i need to do?
Lombok's getter is easy to add
pass your plugin instance to the class in the constructor
and adds some slight future proofing
skip the static abuse
Delete your plugin and learn java
basically
@pastel nacelle I wouldn't qualify this as static abuse
Oh
bruh
It would be used the same even nonstatic
anything that has static in it is static abuse unless it's actually necessary
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
this is static abuse
It shows more of a lack of understanding of java than any knowledge
It doesn't need to be non-static, and in fact as I just explained it could be less performant if non-static.
There is something called dependency injection and it should be encouraged for JavaPlugin classes.
Dependency injection is fine, but unless the spigot plugin structure changed at all, it would never be strictly necessary
But every beginner tutorial does use the singleton approach because its easy and convenient
I disagree in this case.
Singleton's are fine for a JavaPlugin class
As there can literally only be one at any time
it could be less performant if non static
imagine caring about this level of a micro optimization before you have even tested anything
@pastel nacelle I read up on it some time ago, when someone did tests.
Imagine caring that much about blindly following standards even when it doesn't make sense
Use your brain, not your paper
hey im not from america/uk/ other countries where is talking english, i dont understand u guys
so if i change a private variable to private static i'm assuming that the object wont be created when a subclass is instantiated?
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
hey im not from america/uk/ other countries where is talking english, i dont understand u guys
you can go back to python to micro optimize your pointers or whatever
I'm not saying the dependency injection approach is wrong
@wanton delta Yes. A static variable lays in the class scope. A non static in the instance scope.
But don't slam a more efficient method as wrong when it's an equally valid design approach for this specific scenario
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
alright, thats what i thought.
Will the hex text colour option in 1.16 work on the motd/server list?
i didn't realize a hashmap i meant to be static was being created over and over again... lol :)
it's not "more efficient", it's barely even a micro optimization
You already got an answer in #general
it's a nano optimization
Sick of arguing with idiots in the spigot discord, learn the reasons behind standards instead of laser printing a book into your brain
itty bitty teeny weeny optimization
one that is going to bite him in the ass later
so; don't teach him on bad habits
@wanton delta You generally dont want a static HashMap. You should create some sort of Manager class that
maintains the one collection you want.
Its a Nullpointer. It points to null.
what it means?
in this instance it's fine for what it does
google nullpointer
It means buy a java book or follow an online tutorial on java
but yes i do use managers
No offence but I would really recommend you to learn the basics of Java @frigid ember
What's the correct way to check if a chunk is loaded
so i didnt set command in plugin.yml?
world.isChunkLoaded
chunk.isLoaded
no
what
@crimson sandal What smile said, if you get an instance of the chunk, it automatically loads it
@wanton delta no, don't use that
chunk.isLoaded will return always true as you need an instance of a chunk
If you're on another thread or with a delay, it may work
that makes sense
But never rely on it
👍
Bukkit loads the chunk to populate the CraftChunk info
So you get the world and then pass through the locations x and z
Yes the chunk x and z
so location coords: "Math.floor(x) >> 4" and "Math.floor(z) >> 4"
or yes just devide by 16...
Its basically the same
yea
Okay sweet 🙂
i just prefer it, thats just my opinion tho :P
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
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
How come >> 4 works for the chunk X and Z
Those are signed (potentially negative) values?
bit shits and division have different outcomes with negative values
@pastel nacelle
negative values with % will have you off