#help-archived
1 messages ยท Page 187 of 1
@subtle blade So what do I need to do to make it work?
Oh ok, should I run BuildTools at the root then?
Create a variable called player. Though this is something you should really understand if you want to update a plugin
No, create a folder on your desktop or somewhere you'll remember titled "BuildTools". Run it there
BT generates a lot of files so it's best to keep it all in a single folder
Ok, thanks ๐
Yeah obviously I need the variable player but how do I set it to the player?
either do
Player player = event.getPlayer();
just do that
above the if statement
okay thanks
๐ np
Hey guys after I updated to 1.16.1 from 1.15.2 nametags (above player head) stopped working. I removed all my plugins from spigot server and nametags still didn't work anyone have any idea what might cause this? I really spent a whole 2 days figuring out what might cause this but without luck..
Anyone know where I can change this jar name in IntelliJ? https://i.imgur.com/lRUYAu3.png
@peak glade it would help if you spoke in sentences
@peak glade make sure you have bungeecord.command.server permissions, make sure its linked to a db so your bungee can also read the permissions
3 of the plugins I'm running can't get InventoryClickEvent passed to them, is there a setting in Spigot that's causing this?
it's a plugin @green cedar
I don't think PAPI has one for listing worlds
So he is asking how to use the features of a specific plugin, not how to code using spigot API?
Yes, which is a totally valid question to ask here.
Yes, i wasn't knocking the question. Just assumed he was asking how to code. Im not familiar with existing plugins. So i will shhhh now.
@latent rock What do you mean by "can't get InventoryClickEvent passed to them"?
Did you code these plugins or are you simply using them?
Also, inventory clicks don't work the same when you're in creative mode, by the way
If you want to code it youself, then sure
i came across to this thing called sql?
I'm getting a really strange bug where players' inventories disappear when moving worlds. It's gone visually but comes back if
- The player clicks on any slot in the invenotry
- The player relogs
I thought it might be related to the inventory click event errors
@tranquil edge You can simply Server#getWorlds
@latent rock do you have a plugin that seperates inventories?
No
or do you lose the items when you travel
It's still there when I use /invsee on them but they can't see it. It's fixed by clicking on an inv slot or relogging
Hm
Which method do you guys think would make more sense to open chests silently? Use a open() and openSilently() or just open(boolean silent) https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/491/diff#src/main/java/org/bukkit/block/Lidded.java
I'm trying to set up a "bleed" effect on a player, where every 1 second they lose 1/2 a heart for 5 seconds.
I implemented the following method to do so:
private void bleed(Player defendingPlayer, Player attackingPlayer) {
int counter = 0;
while(counter < 5) {
Bukkit.getScheduler().runTaskLater(Statics.getJavaPlugin(), new Runnable() {
@Override
public void run() {
defendingPlayer.damage(1.0, attackingPlayer);
}
}, (counter * 20));
counter++;
}
}
open with a boolean
@frigid ember I'm guessing you've implemented that in the EntityDamageEntityEvent? That event will get called again every time you call the #damage method with an entity source
oh
wow
@wraith thicket How do I damage the player then without calling that event
Don't specify the source
I'm not that familiar with that specific plugin
I know it works well with DeluxeChat
Don't they have their own support discord
@wraith thicket Thanks man
Ask in their discord
Have you tried their wiki?
https://wiki.helpch.at/clips-plugins/deluxetags
I want to ask a thing: why does everyone use Vault nowadays?
Is just because the others do
It's easier to support multiple economy and permission plugins
eh it works
Hey, tried getting dynmap to work on my server but i keep having issues ive got a nice old map on 1.16.1 formerly on 1.18 idk if thats the issue but i keep having my log filled with chunk errors:
[21:41:44] [Server thread/ERROR]: Couldn't load chunk [274, 420] java.lang.ArrayIndexOutOfBoundsException: null
Anyone who knows how to fix this?
This is properly making the Stone Pickaxe use stone instead of cobble, but it is also getting rid of the Blackstone recipe. Can anyone tell me why its getting rid of the Blackstone recipe? https://hastebin.com/utenimuxes.cs
Hey, tried getting dynmap to work on my server but i keep having issues ive got a nice old map on 1.16.1 formerly on 1.18 idk if thats the issue but i keep having my log filled with chunk errors:
[21:41:44] [Server thread/ERROR]: Couldn't load chunk [274, 420] java.lang.ArrayIndexOutOfBoundsException: null
Anyone who knows how to fix this?
@gusty crane excuse me when did 1.18 release
this guy playing in the future
Awhile ago the map was created on 1.8 but has been updated t 1.16.1
you could try loading the chunk?
not directly over time
Oh ok
version from version as they came out
I'm sorry I can't help very much. Dynmap always has some issues for me as well
upgrading from X to Y directly is preferred over upgrading from X one intermediate version at a time
this is because the converters used in world conversion do contain some bugs that have usually been fixed with later updates
It depends, sometimes people haven't been able to directly update from X to Y without intermediate steps
mmm, according to md_5's latest post all worlds should be updated to 1.15.2 before being updated to 1.16
i don't care about what md69 says
But he is spigot god
fact is that 1.16 converters contain all of the tools and more that were used in 1.15 to convert worlds from pre-1.15
said converters have also received bugfixes in 1.16 that those in 1.15 haven't
fact is md_5 said
Upgrading
Although upgrades from between any two version pairs are technically possible, it is recommended that all upgrades are conducted from 1.15.2. This means that you should first upgrade your world completely on 1.15.2 using the --forceUpgrade server argument, and then do the same on 1.16.1.
jokes aside, using 1.15 to convert pre-1.15 world risks you to the bugs in the converters introduced in 1.15
bugs that have been patched in 1.16
I am assuming that he said that as 1.16 is still in the experimental stages and the converter could be more unstable/worse bugs
the 1.15 converters in 1.16 are the exact same as the 1.15 converters in 1.15, except for bugfixes
( อกโโฏอส อกโ)
Speaking of bugs (not sure if it's ok to ask here), has anyone had issues with end gateways not spawning after the dragon is killed?
Someone killed the dragon a second time but they said something about how new gateways weren't spawned.
I honestly don't play minecraft much myself, so I wasn't sure if this was a common issue.
I saw this was a bug back in 20w20a and 20w21a, but it was patched in 20w22a
I remember that being reported, but I don't remember if it was an actual issue or just a case of weird misconfiguration
And checking the level.dat confirms they did spawn at some point.
Yeah. I wasn't sure if there was supposed to be something specific for multiplayer. Like if there are known things people modify to allow people to play the end dragon like it is always the first time.
Or if it is supposed to just work by itself without anyone touching it.
Is there another way of stopping a player without cancelling the PlayerMoveEvent? So far I've tried this:
event.getPlayer().setWalkSpeed(0); event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 250));
but it still let's people move a tiny bit when they press spacebar
can you use @?
One of my plugins assigns timestamps to certain items when they spawn. The idea is for crops that get harvested to get a timestamp assigned to them so that they go bad eventually. Unfortunately, it has come to my attention that when players drop items with food stamps and pick them back up, a new food stamp is applied. My question is:
When players drop an item, is the ItemSpawnEvent called? And if so, is there a way to tell if the item was dropped by a player?
use BlockDropItemEvent
PlayerDropItemEvent... also just check if the item already has a time stamp
Why not use the block break event to assign the time stamp.
Then no need to mess around with dropped items.
Is there another way of stopping a player without cancelling the PlayerMoveEvent? So far I've tried this:
event.getPlayer().setWalkSpeed(0); event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, 250));
but it still let's people move a tiny bit when they press spacebar
@raven flare what's wrong with cancelling move event
listening to playermove bad
it isn't bad
it's not that bad I do that in my plugin and the timings are fine
yeah, it's not bad as long as you don't do anything expensive in it
@sturdy oar It's looks buggy client side
people just have the misconception that "playermove listener bad" because a lot of noobie devs mistakenly put some pretty heavy logic in those handlers
I just don't want it to look buggy that's all, nothing against it
It looks like it snaps back?
suppose you could set them to be flying and then set flyspeed to 0
well, yes
That's a good idea @pastel nacelle , how would I do that?
yes i know that one, how do i set players to be flying?
except when spigot naming isn't consistent
most of the methods are, though
usually
don't get me started on getType and getMaterial
and then you have fucking gems like VillagePlace
@green cedar I don't use the block break event because it is supposed to work for mob drops as well.
When an item spawns from either crops or a animals, a timestamp is assigned to it.
Do I just need to use two separate events?
well tbh
you should use that other guy's advice
don't assign a timestamp it it exists already
Timestamp like System.getCurrentMillis() ?
also in my humble opinion the timestamp should be like the current hour and not something like milliseconds
It is the current hour ๐
Bro won't that break on year 2036 ๐ . It will reset back to 1997
so not every reed or potato needs its own inventory slot
the only way I can see it not being buggy, if there isn't API methods to do it, is to intercept the incoming packets and silently ignore them
Alright I'll try the not assigning a timestamp if it doesn't already exist
I added it earlier and it didn't work lol
maybe it's a problem with my timestamp system
maybe...
Just found your plugin @rotund orbit
I believe I looked at it the other day as well
Bro won't that break on year 2036 ๐ . It will reset back to 1997
@sturdy oar getCurrentMillis() is backed by the system OS's method call for that, so if you have a 64bit OS the answer is no it won't
So it only affects 32 and lower?
eventually when I have the effort to write something similar for my server, I will probably let items with different decay values stack and just average the decay value for the resulting stack
yes
Yes which are almost impossible to find now-a-days
this is my ItemSpawnEventHandler at the moment
https://github.com/Kingdom-Programmers/FoodSpoilage/blob/master/src/main/java/spoilagesystem/EventHandlers/ItemSpawnEventHandler.java
and you are expecting your plugin to be ran in an enterprise business?
i actively use a 32bit windows xp machine
and you are expecting your plugin to be ran in an enterprise business?
@keen compass no , spigot won't even start with the java 32bit 1G heap limit
glad to hear @pastel arrow
32Bit OS's technically will survive after 2036 though
only requires 1 modification ๐
Raspberry PI is 32Bit after all
instead of using 1 address space for the date, you just need to use 2
and then you have the equivalent of what 64bit does natively
this is my ItemSpawnEventHandler at the moment
I'd recommend setting some variables. Would clean up that code alot.
Ex;
ItemStack i = event.getEntity().getItemStack();
Material type = event.getEntity().getItemStack().getType();
if(type == Material.POTATO) {}
it doesn't need to be final o.O
final is far more informative when only the things that need to be final are final
did you know that final makes compile faster
not really
it doesn't
Thanks @pastel arrow
Try yourself
np
I get insane compile time since when I've started using final
I thought final was just java's way of saying "const" wait am I wrong
Na I'm not wrong, I googled that shit
I also use it in classes and method parameters
should really only use final, if you really need the value to not be changed/manipulated
Yea exactly, okay so I've not been using it wrong
Which is 90% of the times Frostalf
otherwise, as far as optimizations go, it doesn't do anything really
And that is why Kotlin has final method parameters by default
"need x to not be changed" is not the same as "don't need x to be changed"
Don't you dare dirty kotlin by comparing it to yur shit.
just because Kotlin does something, doesn't mean it should be the standard
or that it is the best way possible
only cases where you need x to not be changed is like lambdas and shit
most of the time x won't change on its own anyways
usually it is because of some other plugin changing it on you ๐
unless you are doing something to manipulate the stuff in which it is handy to know the variable you get won't change later after that
not like final is going to stop anybody from changing it if they really want to change it
yeah there is that too lol
i think 14 started to put some stops on that though
should really only use final, if you really need the value to not be changed/manipulated
Or if you don't want a member to be overridden by a child class
not what we are talking about but yeah technically yes
Yeah I do that too
I have many abstract class with final methods
It makes sure you can't change that when extending the class
i'm sure we all know what final does
Stop being a fucking weirdo
Kind of defeats the purpose of abstract in that case but whatever it is your projects ๐
I'm not weird I code that way and many others do
There is a appropriate places to use final in java, everywhere is not it.
only thing I am saying is that, it isn't correct to attempt to force people to use final everywhere just because you do ๐
abstract classes can and should have final methods when necessary
when necessary yes
but it shouldn't be for everything though
otherwise you might as well just have a normal class lol
clearly yeah lol
I also always put child classes final
It's really rare that I extend a class
Again , Kotlin does that by default
@pastel arrow cleaned up that code, thanks again for the advice
Np
Viper, then use kotlin instead of java, don't use java like you would kotlin.
I don't like Kotlin tho
Has weird constructors and bitwise operators are ew
Not to mention I have to shade the stdlib for each single plugin I make
make custom infix operators then
Quite the conversation in here
and >caring about filesize in 2020
i would like unsigned primitives though
you can get several hundred gigs of storage for $10/mo nowadays, a little 1MB extra per plugin wont hurt you
magtape to the rescue
Kotlin has unsigned stuff doesn't iot?
yep
like uint and shit
theyre just inline classes tho
Meh, it probably behaves somehow similar when you use them 
it behaves as youd expect
C is where you have real unsigned primitive
literally any native language actually
anyone know if theres a way to upload a map faster to muliticraft?
this map is taking forever, and im uplopading as a zip file
so hopefully I can upack it right there
Are you using SFTP?
well
signed slash unsigned doesn't really depend on how you store it
java does have methods for unsigned arithmetic as well
whats SFTP
it's just not as handy
Multicraft is ftp i think
Im using filezilla for ftp yeah
Rust is bae, C is ew.
its been like 10 min and bruh
C is equally epic as Rust; it depends on your usecase
FileZilla is superior, and it's not unsecure if you use FTP over TLS
SFTP ftw I'm sorry
My problem is with my isTimeStampAssigned() method, my bad guys, internal issue
Nooo, C is very ugly Rust looks great(sometimes).
Rust is new
@opal adder when I logged in i got this warning
about it not using ftp
and using something else
so the info will be available over the internet
C is pretty in its own ways, and Rust can quickly look awful with generics
Meh, i'm only on the rust train cause i found it the same time i found kotlin
Does anyone know what would cause hoppers to "randomly" stopping functioning? I've had this issue ever since I started running my server. For some reasons my players normal hoppers just kind of stopping transferring items, so they have to re-place their hopper system to get it to work again. I used to think this wasn't even fixable, but maybe one of you guys know
I suspect it could be them leaving chunks and re-joining, or maybe during a server reboot whilst the hopper is transferring items that could cause it, but I honestly don't know
I have no idea what plugin would even cause that, I don't use special hopper plugins
LOL, you would fucking say that
I swear to god if it actually was
i don't think clearlag does anything with hoppers
but "lag fix" plugins are the usual suspect when things stop working
Well, I don't really have many of those Tbh, maybe it's the fact that it's 1.8. I guess I don't remember people complaining about that on my newer version servers
Could just be an old bug
Let's say I was making a vote currency where 1 vote = 1 (insert currency name here)
What would be the best way to store how much of the currency each player has?
HashMap
You could do per player files for their balance storage I guess
That's what essentials does
Or, you could be disgusting and give them a permission for it "votecurrency.<amount>" and unset/set that every time it updates, though, that's a really gross way to do it
or be lazy and use nbt/PersistentDataContainer to store them >:)
N o
Is that a new thing? that's the second time that's been mentioned in her
I never even knew that was an option
They're quite new
Database FTW
PersistentDataContainer is an NBT wrapper but it's missing a few things
like booleans, uuids, etc.
I mean is it really a practical thing to do though?
no
Ah okay
you can make your own data types though
This might be a really, really dumb question, but what's the best way to store my hashmap or a list of objects on my drive?
I'm confused what?
sqlite?
use a database or store it using gson
If you're going to use it globally, you need a database, but if it will be used on 1 server, then normal file storage, yml or sql is all you need
Yeah, sorry. I haven't really done too much with data storage thus far.
^^
isn't sql a database?
implement bukkit serializable on the objects you store in it ๐
wait
I personally prefer YML, but that's only because I've not dabbled in sql, and with YML I can very easily view individual player files
using gson is slower than sql but it's better than yaml
and it's shaded into the server
access speed is almost literally a nonfactor 99% of the time
Why does YML = bad?
it's not meant for storing big amount of data
its a slow ass format
You're working with files
okay so about SQL. Isn't it usually like an external program that you run? I have experience with MySQL, and I had to host a database to store data. Is that really the best way?
Also isn't SQLite driver written in native
I mean but if you read to the file when the plugin starts, and only places values into it when the plugin disables, is that really in-efficient?
it obviously works its just many times slower
the point of yaml is that it's human readable
not for storing data
Da fuck? They use YML storage, at least that I know of. When I look players up in the plugin, it's all yml
okay so about SQL. Isn't it usually like an external program that you run? I have experience with MySQL, and I had to host a database to store data. Is that really the best way?
Too dumb of a question?
You can use SQLite, which is a flat file version of MySQL
Ah I see
there is no need to overengineer everything
SQLite Is not really flatfile database
many plugins persist literally all of their data into a single yml using bukkit's shitty configuration api, load it all into memory on startup, and still perform completely fine
unless you are storing gigabytes of information it very much doesn't matter how wrong you're doing it
many plugins persist literally all of their data into a single yml
Essentials' config.yml e_e
i mean more like pex
it literally stores every user and group in one giant permissions.yml
๐คข
i know right
but it still works fine, data persistence wise
no one's really planning to make thousands of groups with pex ._.
so; don't sweat it
there won't be thousands of groups
but there will be tens of thousands of users
I got 523 pex groups
each with their set of groups and permissions
I got 523 pex groups
why
even if they only take 3 lines each, that is still one massive blob
are they atleast converted into lp
What is the advantage of using packets and does anyone have a good resource on packets and NMS? Looking to get into it
there is no way to tell the "advantage of packets" when you don't specify what you think they are advantageous over
afaik you only use packets for things the API can't help you with
I was joking i've never used pex for anything real.
packets can also be used to overwrite api components hehehe
Like not allowing it through
and shit.
Np
@pastel nacelle I don't know thats why I'm asking??? I see a lot of forms and servers that want to hire people with experience in packets and NMS so I was wondering why that is and if anyone had some good resources so I could dive into it.
packets are what the server and the client communicate to one another with
Iโm about to delve into it myself for holograms that only appear for players within a certain distance of a location
Wish me luck
Unless thereโs a resource that does that
Then I would GLADLY take the lazy route
a dark souls bonfire plugin shit that uses packets to send different lit states of campfires to different players
based on whether the bonfire is discovered or not
@pastel nacelle do you know of any good recommended resources?
My question is how did you manage sending the packet when the player comes into range of the campfire
the packet wrapper can help a lot too
tl:dr if you know how to work with packets, you can make some things far, far beyond what the API would allow.
what's NMS?
i didn't really do anything range related
lol
i just listen to chunk map packets and spoof the campfire state after sending them
so whenever the player gets a serverside chunk update, the campfire is also sent
Do you scan each chunk for a campfire or check for specific locations
Made this a while ago with packets, and it was hell. https://i.imgur.com/18vrFGB.gif
i have a cache where i store the chunk coordinates that contain campfires
Ah ok.
if the chunk coords are in the cache i get the bonfires from the cache in that chunk and send the packets for them
I have no idea how Iโm going to approach mine
probably just sending create/destroy entity packets depending on how far the player is from each hologram
@wise flame NMS = net.minecraft.server
the route i see most people take is create the entity using nms without adding it to the world
Iโd probably just.. want to modify the text line for the entity when players come within range
Just have it be a blank line instead of generating a new armor stand
net.minecraft.server... this? https://github.com/Bukkit/mc-dev/tree/master/net/minecraft/server
yes, but that's insanely outdated
Youโll have to decompile it yourself for more current code
Good luck lmao
Obfuscation be like
maybe just change the data that determines whether the custom name of the armorstand is displayed or not
Mini's Mappings ๐
Ooh thatโs a great idea
that way you can keep the text and just flip a single boolean back and forth
https://www.spigotmc.org/threads/nms-tutorials-1-introduction-to-nms.204127/ I found this resource. It's 2 years old, but I bet some of the information is still relevant
what an angry looking weebio
Should've seen Choco
many things
for example, using NMS, my spawner plugin removes spawner tile entities from the world's ticklist so they don't get ticked at all
that's super cool
i'm a super cool guy
how do I get access to NMS?
read the tutorial i guess
I'm just going to skip nms for now and just learn about sending/using packets
What
and sometimes with protocollib too
Basically I want to make a plugin which makes all trapdoors placed down make them placed at the bottom half:
https://i.imgur.com/IM9kd5Z.png
This is my current code. It does detect trapdoors placed but cannot change them so they would be at the bottom half. Any tips?
@EventHandler
public void onPlace(BlockPlaceEvent event) {
Block block = event.getBlock();
Material material = block.getType();
if(
material == Material.ACACIA_TRAPDOOR ||
material == Material.BIRCH_TRAPDOOR ||
material == Material.DARK_OAK_TRAPDOOR ||
material == Material.IRON_TRAPDOOR ||
material == Material.JUNGLE_TRAPDOOR ||
material == Material.OAK_TRAPDOOR ||
material == Material.SPRUCE_TRAPDOOR
//material == Material.LEGACY_IRON_TRAPDOOR
){
// not working
//block.setMetadata("half", new FixedMetadataValue(RocketRoam.plugin, "bottom"));
}
}
use an enumset, a tag, or a switch
insead of if or or or or or spaghetti
also, that metadata value is keyed by your plugin
a switch would be unnecessary if its a single if statement
Okay, but what about the problem I'm having?
As for what you're doing, that's not how you update block data
Metadata is a completely different concept. In-fact, it's a plugin-exclusive concept
You want to modify BlockData
declaration: package: org.bukkit.block, interface: Block
I tried checking BlockData and it only gives me a string of it
I don't know what to do with it
Cast that BlockData accordingly. There is a type for trapdoors
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/type/TrapDoor.html
Cast, change what you need, re-set it with Block#setBlockData()
For the sake of clarification, what you were using - metadata - is a plugin concept to temporarily attach non-persistent data to a metadatable object (entities and blocks)
A way for mods to communicate with one another that gets fairly under-used
Oh
I never knew about BlockData and other stuff to be honest, I started programming one plugin like 3 days ago
BlockData is used to change a block's states (i.e. half, facing, waterlogged, etc. - the things you'd see in the F3 debug screen on the right), BlockState is used to interact with a block's tile entity (chest contents, furnaces, brewing stands, etc.)
๐
1 small question why when i use p.gettworld(). getname() doesn't work on PlayerChangedWorldEvent
May I ask, where can I find all events that I can use? Like onLogin, onPlace, onBreak and etc
in the docs
Player#getWorld() will be the world the player is currently in
Events are called immediately before an action occurs
Any new state is passed to the event. If you want the name of the new world, PlayerChangedWorldEvent should have a method to get the new world
I think it's getTo()?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/Event.html
look at the subclasses of this class. @frigid ember
declaration: package: org.bukkit.event, class: Event
I mean im trying to get the world name he joines in so if(p.getworld().getname() == "name"){
Do something
}
Im using phone
Oof
https://hastebin.com/pehazolole.java
can someone tell me what I am doing wrong here? it still wont give me the effects when I rename the helmet to test
ArmorEquipEvent is not part of the Spigot API
I have a package for it tho
@hardy cedar , Strings cannot be compared with == in the majority of cases
in the plugin jar
So then two things. (1) Check to make sure your event is actually calling, (2) Ensure that you've registered your event listeners
@hardy cedar , Strings cannot be compared with == in the majority of cases
I wasted my life on nothing oof
.equals()
== is referential equality, meaning the objects are the exact same instance in memory.
Because Strings are immutable and created every time an operation is performed on it, more often than not, they're not == comparable
So that method can be for example a player name @subtle blade ?
Anything that's a String, really. Strings should be compared with .equals()
Or, rather, most things should be
General rule of thumb is that if it's not a primitive (int, boolean, long, etc.) or a constant (enum), you should be comparing with .equals()
Also that didn't work btw to get the world name oof
let us start an argument on whether we should use == or eq for enums
choco I am have that in the plugin
No. If you use .equals() for enums, you're stupid and that's final
but muh primitives and things
I think I used it once ๐ค
i actually don't remember what the argument is for using eq on enums
i remember seeing a whole shitstorm about it a while ago
I just imported nms and I don't see any obfuscation
Choco it's ok, let them be Bob
Isn't it supposed to be hellish?
๐
Not sure but it wouldn't be valid considering enums can't even override equals()
Skyy, CraftBukkit maps a small part of NMS. It maps what it uses
well yeah, I know that, but what about what it doesn't map? Why don't I see any of that?
All class names are mapped, though methods, fields and nested classes aren't all mapped
In fact, most aren't
Ah, that makes more sense
The event doesn't even work for me i just used it to say hi and it didn't
Replacing that big IF statement with ```java
if (block.getState() instanceof TrapDoor)
Is it the correct way of implementing it?
No because it's not a state, it's a BlockData
NMS actually seems like a lot of fun. I know what I'm getting myself into.
Though you're probably best to use the Tag.TRAPDOORS.isTagged(block.getType())
oh
Thank you!
public void WorldChange(PlayerChangedWorldEvent e) {
Player p = e.getPlayer();
p.sendMessage("HI");
}```
if i did something else kill me .-.
i will restart eclipse maybe an unimported thing bc my pc suck so its glitchy for some reason
yup it was
i hate my 2gb ram pc
is it possible to give players effects if their wearing an armor with a specific lore with armor equip event?
Oh, right, where do I find the names for functions?
example BlockPlaceEvent has onPlace function name.
Or can I put any function name?
yes
just tried it out, yes... unexpected...
Ah right, I haven't coded in java for 3 years
how can i make big server dedicated like hypixel
๐ฌ
๐คจ
does anyone know how to be able to run a command from the console of a spigot server and then it would run on bungee console?
To host something like Hypixel would take ALOT of money, time and a huge team
not something that can be done by yourself
does anyone know how to be able to run a command from the console of a spigot server and then it would run on bungee console?
i cant believe that's a thing
how to give a player his skull as a join item and add a command to it ? ๐ค i think thats just hard idk
@hardy cedar Getting the head of an online player is pretty easy:
private ItemStack getHead(final Player player) {
final ItemStack itemSkull = new ItemStack(Material.PLAYER_HEAD);
final SkullMeta skullMeta = (SkullMeta) itemSkull.getItemMeta();
skullMeta.setDisplayName("ยงfSkull of " + player.getName());
skullMeta.setOwningPlayer(player);
itemSkull.setItemMeta(skullMeta);
return itemSkull;
}
Adding a command to it could be done in a similarly simple fashion or very modular.
ik hot to get it but to add a command on right click is hard
PlayerInteractEvent
doesnt help me
Do you want to run a command when the player holds it in his hand and interacts with it?
yes
Why does PlayerInteractEvent not help you then?
becouse i cant put the ItemStack item in when i do have a private / public method
I dont understand that sentence. Could you give me a bit more context?
i cant do e.getItem and item name in that case u sent to me
if(event.getItem().equals(yourCustomItemStack))โ
icant call it in the itemstack point
@EventHandler
public void onInteract(final PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
final ItemStack item = event.getItem();
if (item == null || item.getType() != Material.PLAYER_HEAD) {
return;
}
// Here you can use the item
}
Ah ok your problem is equals.
You dont need to check if one item equals the other.
It is sufficient to check the name for example.
event.getHand?
@EventHandler
public void onInteract(final PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
final ItemStack item = event.getItem();
if (item == null || item.getType() != Material.PLAYER_HEAD) {
return;
}
final ItemMeta skullMeta = (SkullMeta) item.getItemMeta();
final String itemName = skullMeta.getDisplayName();
if (!itemName.startsWith("ยงfSkull of ")) {
return;
}
final String playerName = itemName.replace("ยงfSkull of ", "");
}
That would be one examle on how to check some values of the item
gethand isnt a thing for me
The interact event is fired for the left hand and the right hand. We only want the event with the right hand
Are you on 1.8?
I dont care then. The version 6 years old.
You can just leave the check away then.
If there is only one hand then the first 3 lines are obsolete
Hey y'all! I'm having an issue where my server crashes when I enter a specific area of the nether. Is this the right place to ask for help/send my crash logs from console?
I've already tried deleting the area in the region folder using MCAselector and reloading it
Could you pls post the full log?
latest.log
Did you generate the world with 1.14?
The server was created around 1.13/1.14 ish, but I don't know if I went to the part of the nether that's crashing my game then. Since then I've deleted most of the chunks in the nether and reset for 1.16 using MCAselector
The chunk that's crashing the server should be among the chunks that I deleted and reset for the nether update
Would it be ok for you to delete the nether completely?
Then try running your server with the --forceUpgrade parameter once
java -Xms4G -Xmx4G -jar server.jar --forceUpgrade
Something like this
Sorry, how do I do that? My server is hosted through ApexMinecraft
(I'm pretty clueless, sorry abt that ๐ฆ )
No idea. I guess you cant add java parameters there?
Then... download the world and forceUpgrade on your local machine?
Actually I just found the parameters section
Ah ok
Should I get on the server and see if the problem persists after the startup
sure
this isn't exactly related to Spigot, but I have a question. I tend to use static variables pretty often. Is that a bad thing for any reason?
I figure it's not but I want to make sure lol
static variables have their place but they are pretty rare in java.
90% of spigot plugins should not need any static variables. In fact you could probably
Write every plugin without the use of a single static keyword.
Its not inherently bad to use them but in many cases the static keyword gets abused by
ppl who did not take the time to properly learn how to write proper java code and just jumped into
spigot heads first.
If you send me some code examples i am happy to give you some advice.
Anyone know how to set a beehive to full of honey?
@grim halo Just tried the force upgrade, no sauce ๐ฆ
Anyone??
@frigid ember Is this from your own plugin?
What do you mean by "own"
Did you write a plugin that tries to interact with the citizens api?
no
What event is called when a player cooks food on a campfire?
Then you have a plugin that doesnt know how to properly register citizens traits.
I tried looking it up and thought it might be BlockCookEvent but I couldn't find documentation on it.
what plugin would it be though
@rotund orbit BlockCookEvent
Thank you
@frigid ember i have a 1 in 55000 chance to guess what plugin could cause this...
Want me to start from "a" ?
sure
@frigid ember sure... he sais. Ok here we go.
Is it "AdminOnly AdminOnly 1.3" ?
Can I just add permission commands everywhere on the console or it needs a specific location?
AdminOnly I don't have that plugin?
Ok next one.
Is it " AdminOnlyChat 1.2 " from "Slayde_Blayde"
I have no plugins that have admin in the name
Ok skipping all plugins with admin in the name.
Only 54985 plugins to go...
Is it " Advanced Slots Manager 1.0.0 "
LOL no
Is it " Advanced Spawners 1.3 - 1.4.4 "
anyone else having trouble logging in to the spigotmc website? the login button is redirecting me to the account signup page
Ah so you see whats missing. XDDD Did take a while.
lol
I pushed my sarcasm lvl to 300% percent and you just kept going
all my plugins
You paste stuff like this here pls
Now only list plugins that have Citizens as dependency. dtlTraders for example
CitizensCMD
is it CitizensExtension2
Didnt read the list. Try disabling both and see if the server starts. If yes -> install dtl -> if it still starts well then CitizensCMD is broken and vice versa.
ok
It just spams this in console when I try and start up the server
and I cannot join
--forceUpgrade your chunks
?
Are you on 1.16?
@grim halo I tried restarting my server with the --forceUpgrade parameter but it still crashes when I try to load a specific region in the nether. Are there any other possible fixes?
I just got on my laptop and there is an error in every place that has something to do with the spigotapi...
That's a pretty broad statement, can you provide some context? Do you mean in your IDE?
Are you using Intellij?
i use intelliJ, so i just opned up my plugin and there is errors everywhere, all the Bukkit and Spigot imports are broken, the only thing that has no errors is just the normal java parts, I dont know hot to explain it:/ ill send a screen shot
check ur dependencies
reimport/refresh the pom.xml
im trying to import vault or whatever but its not working
Dependency 'com.github.MilkBowl:VaultAPI:1.7' not found
Is there a problem with the spigot verification? cant seem to get a verification in discord and the in browser
also says Cannot resolve com.github.MilkBowl:VaultAPI:1.7
Hello, i'm having an error connecting to my bungee server. I can connect to the servers without bungee but cant connect with bungee. Someone please help me
@sage summit Do you have the appopriate repository? I believe they use jitpack
Ummm, idk
any way to nerf end farms?the spawn rates are crazy
@vernal spruce yea
help me please
So there can only be a certain amount of mobs spawning/staying
there is the config option
in either bukkit.yml or spigot.yml
Hey ppls, Is there any way to disable regular players from doing /plugins
Remove the bukkit.command.plugin perm I think
Does somebody know a ChatCo plugin alternative that isn't abadoned/is in active development?
chatco?*
chatco?*
@bold anchor yes
What is chatco
Latest release was in 2017 and there is no source code available
@frigid ember file > project settings
artifacts
create an artifact
or edit if you have a current artifact
make sure your plugin and plugin.yml are in there, then change the output directory of your artifact to wherever it should go
then just build that artifact
Is that for Maven
Hello, what's the best way to format money like ```
K
M
B
T
Qd
Qt
Ht
Latest release was in 2017 and there is no source code available
@kind crow that's what happens to non open-source plugins
You don't update it? It dies forever.
Hello, what's the best way to format money like ```
K
M
B
T
Qd
Qt
Ht
decimalformat
Okay thanks
Scientific notation smh
You don't update it? It dies forever.
@sturdy oar I would pick an open source one if I had a choice, but there is none or I couldn't find it
10ยณ = K, 10โถ = M, 10โน = G, etcetera
How do I change my spigot mc account name?
wtfd
Come on the website is free
well thats stupid
Just do it
might as well just create a new account
Lmao
I have a 10$ donation on my account and I changed my username recently
You also get other cool perks
bruh im too poor for that shit
I get things for free usually
I didn't donate myself
Simpleauthority sent money for me
@pale crow bruh ๐ฅฐ ๐ฅฐ ๐ฅฐ
I love u
is there a way to limit perChunk entities?
@tough kraken https://github.com/NerdNu/MobLimiter
https://github.com/Jikoo/ChunkSpawnerLimiter/releases
that wont work, that are custom entities, they got spawned infinitely, i mean can i check if there already are for example 32 entities in the chunk where the entity spawns?
i am manually spawning them per plugin
can i use this?
if (event.getLocation().getChunk().getEntities().length == 16) { return; } else { loc.getWorld().spawnEntity(loc, randomEntities); }
and if yes, what would be a good amount of entities per chunk? would 45 work for most Servers?
@plush kraken Alt account is against the rules.
@tough kraken Yes you could use this to limit your spawn rate. For most Mobs 4 per chunk is more than sufficient.
i know that, but that was my problem, but fixed it
lil query, I want to add a ShapedRecipe that has a bucket in it, I dont want to consume the bucket, just the contents of it. How would I do this with the shapedRecipe? or is this not possible?
or do I have to add an EventListener for this?
Doesnt this happen automatically if you create a recipe with a Water bucket?
i think it should
Hm not sure, ill test it out ๐
And you were correct ๐
With that, thats the only working recipe. My other ShapedRecipes, dont work. I register them as follows: Bukkit.addRecipe(new RecipeLightAnvil().getRecipe());
The recipe class: https://paste.md-5.net/lanehiteyi.cpp
Mc 1.8.8, I added the recipe the same way I would on 1.16, yet it doesnt work here ๐
Figured that one out, it didnt likje the way I set the empty spaces ๐
Yes dont use Material.AIR for those. Just leave a space in your shape like. " b "
Anyone ever tried making music on noteblocks purely through code?
im extremely bored and wanna try it lol
Yes there is even a api for that.
is there any function that accepts var args ? ๐ค
You mean generally?
public int sumUp(final int... numbers) {
int sum = 0;
for (final int i : numbers) {
sum += i;
}
return sum;
}
I wrote you a quick example
final int a = this.sumUp(1);
final int b = this.sumUp(1, 2, 3, 4);
final int c = this.sumUp(new int[]{10, 11, 13});
final int d = this.sumUp();
Those are some valid method calls. However new int[] is redundant here.
a functional interface
it would seem useful
i could make it
but i was just wondering
if there was already one
You mean a functional interface for var args like "VarArgs"?
Im not sure... what something like that would look like or be used for.
i was gonna use it for a string array that changes overtime
And a List<String> wouldnt be sufficient there?
Is there a difference between ArrayList and List?
yes
Yes-ish
so List just extends ArrayList?
ArrayList is always a List but a List does not have to be a ArrayList
or the opposite
hmm
I'll take a look at it later on
I have rails (which are retextured to act to show up like "wires") and trapdoors (which are also retextured to show up like some kind of repeater)
https://i.imgur.com/DmuIYJc.png
I want to modify how the rails connect. What kind of event should I look at?
the list is used for compatibility
like if you change from arraylist to something else that implements list too
it won't break
Anyone Have A Good Voucher Plugin? I Need it To Give Kits Out Of Crates.
ArrayList > List > Collection > Iterable
Thats the hirarchy
Same goes for LinkedList (It also implements Deque and other stuff)
LinkedList > List > Collection > Iterable
But essentially you can always cast a LinkedList or ArrayList to a List but not the other way around.
Wait is this from a mod? @frigid ember
it's a resource pack
is this even allowed
Good thing with linkedlist is that it technically has no max size
Though arraylist is faster iirc
LinkedList is horrible. After i made my jmh benchmarks with it i have never used it once
@grim halo I mean how rails can connect
Itโs really not
I just want to modify that it would connect to trapdoors
What exactly is good at a LinkedList*?
what kind of event shall I look at, guys?
BlockPlaceEvent? You want them to rotate so the show at the trapdoors right?
Hmm actually right that could solve the problem, I'm stupid.
@naive goblet So pls enlighten me. I think there is only one very specific case where you would use a LinkedList other than that its rly bad.
7smile7 I think you need to read some before going with massive fud https://en.m.wikipedia.org/wiki/Linked_list
In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes which together represent a sequence. ...
There is probably thousands of more sites explaining it
And pros and cons
Not really in for an argument right now
Yes. I know all of that and have written multiple benchamarks with the JMH to test a lot of cases that where not covered in articles and whitepapers.
My conclusion: Its horrible
Because?
but wait, if rail would be placed next to it, it will change the direction of the one which is next to it
@grim halo yo, I'm trying to implement that custom arrow thing you showed me yesterday but I'm having some troubles. Can I take it to DM and show my current code?
linked list is good at adding and removing
High ram usage. O(n) index access O(n) index insert O(n) index removal.
Rly slow iteration time. 5x slower than a ArrayDeque when used as a queue.
Hundrets of nodes clogging up your ram.
Yes itโs known for slowness thatโs true
Well I donโt know why you would use it in that case when you need something faster
ยฏ_(ใ)_/ยฏ
There is one case i would use it:
You want ordered element iteration with O(1) remove and O(1) insert time while doing so.
@frigid ember I think you do not want to worry about the rotation at plugin level.
If you use your own resourcepack you can as well just implement rotation based on
surrounding blocks there.
Wait let me think if thats possible without Optifine...
?paste
Pls paste code here
There is one case i would use it:
You want ordered element iteration with O(1) remove and O(1) insert time while doing so.
Yup
it says "SSomething went wrong" when I try to use paste.md-5
Ok i see several things that could create a problem here. Whats yours?
Hahaha
Well for starters I don't know how to implement it where I want it. I'm not very experienced when it comes to OOP tbh
Not with NMS either
hey I keep getting a build error for Spigot 1.16.1. I tried updating BuildTools, different command syntax etc
Can you show logs DanDeMedicMan
Ok then i think its a better aproach not using nms.
So dont create a class that extends EntityArrow.
Spigot alternative:
- Create a manager class. For example called "ArrowManager"
- You will have only one instance of this class so you will create one in your onEnable.
- For the sake of ease you implement Listener and Runnable
- This manager maintains a private final Set<Arrow> of tracked arrows.
- create EventHandler methods that add the arrows to the List when theyve been shot
- create EventHandler methods that remove the arrow when it hits somethin (or gets unloaded!)
- In your run method you write a for each that iterates over every arrow and spwans particles on their location.
- Register this one instance of your manager with the PluginManager as Listener
- Use the same instance to schedule a task that runs ever or every other tick with the BukkitScheduler
I'll try that, 7smile7, thanks
Thats more of a "plugin wiki" problem rather than spigot
@frigid ember what permission plugin?
You might even be able to change that in plugin.yml
Why are chunks loading so slow?
Bad ram/cpu or overloaded
i have a issue. Getting a offlineplayer by name seems deprecated. But i need getting the player via name for my plugin. The UUID way seems not deprecated, but noone knows their UUID.
https://mcuuid.net @frigid ember
Minecraft UUID and username lookup. Resolve, convert and view name history of any username/UUID today.
hm
Does it support offline servers too? I may want to support a wide range of servers
I don't know I just found it on google tbh
ok
What is the alternative for HoverEvent? - Just noticed it got deprecated.
really?
no hovering over text in chat
^^
Can show items and text
one sec im searching it
@cerulean gust found it
It seems partially deprecated
You need to give it a content
not a basecomponent
Ahh
hi i have this ``` List<String> badWords = getMain().getConfig().getStringList("chat-filter.list");
I got essentialsxchat, edited the config but still shows <> in name
hi i have this ``` List<String> badWords = getMain().getConfig().getStringList("chat-filter.list");
@frigid ember seems like a job for iterating it
what?
@frigid ember string should also extend charsequence
just a for loop
If you need to pass a charsequence you can also pass a string
yeah
As a string is a charsequence
pls just write some code how it looks i dont understand
String test = "Noice testing"; CharSequence cs = test;
then create a charsequence list
a for loop
and loop over all entrys
@frigid ember I think you do not want to worry about the rotation at plugin level.
If you use your own resourcepack you can as well just implement rotation based on
surrounding blocks there.
@grim halo
I cannot.
hi i have this ``` List<String> badWords = getMain().getConfig().getStringList("chat-filter.list");
^^^^
not charsequence[]
we already told you it
Im not even gonna bother
@frigid ember If you don't know what is for loop/iterate we recommend to you to learn java.
โ
for(CharSequence sequence : badWords) {
//do whatever with sequence
}```
nice spoon
Kappa
also wrong type is loop through the string inside the list to add in a sequence list
was very simple, not like it was anything overly complex
also CharSquence is usually not used everywhere, so don't know why you want to "convert String to CharSquence", https://www.baeldung.com/java-char-sequence-string#conclusion
i mean having to describe something very simple is not a good thing
i have a issue. Getting a offlineplayer by name seems deprecated. But i need getting the player via name for my plugin. The UUID way seems not deprecated, but noone knows their UUID.
um can someone help me?
Converting UUIDs to player won't really work for me
You might be able to acces the player data by name
But that still doesnt work if they never joined your server
there are two uuids
offline and online
no
yes
they are unique
to the player
offline and online
indeed
You might be able to acces the player data by name
but if the player is offline it return null
When i try to get a onlineplayer
And by that i mean getting the player from the world saves
oof
But i think best way would be to store a player data if it joins the server
some low level stuff?
Save the players yourself
hm
Yeah seems reasonable
If it ever gets removed i will use this way
But why is it even deprecated?
Probably because the player never on the server, so it retrieves offline player by name from GameProfile
Deprecated. Persistent storage of users should be by UUID as names are no longer unique past a single session.
if your server is set to offline
Its because you can change
your uuids will be offline
names
ah
but uuid will always be the same
wasn't it displayname?
if its online mode it will be online
OfflinePlayer op = Bukkit.getOfflinePlayer(/* your name to lookup*/);
if (op.hasPlayedBefore()) {
UUID uuid = op.getUniqueId();
} else {
//hasn't played before
}```
no
bro offlineplayer means hes not on the server
and onlineplayer means hes online
UUID's are generated from player names if server is offline mode, so there is no guarantee that any two players are the same
^
Why do i even need to explain you that?