#help-development
1 messages Ā· Page 1555 of 1
š
Hi! I am making a team system and I noticed that when I join, I can only see that I am on red team. But others can only see that they are on blue team. Turns out that this is because it creates a new scoreboard everytime someone joins the server. I decided to check this with the last if statement in the function and sure enough, it printed out the statement. Any suggestions for a fix? Thank you.
i wonder why syncCommands() isn't called after a command is registered
any particular reason?
I mean if it was called more frequently eventual lag spikes could occur if thereās a lot of players online and if itās called on the server thread
tru
Holy
wait
Thatās cool
nice
what is the best way of moving the entity do you reckon elgarl
how do i set an item's durability
i tried googling but theres nothing that shows an example
Hello, is it normal that the only spigot maven dependency available for 1.17 is just "spigot-api" and not "spigot" ?
Yeah
cause i am doing it in a really hacky and stupid way:
public void moveEntityToPlayer(Player player) {
Location location = player.getLocation().clone();
location.setY(location.getY() + 3);
location.setX(location.getX() + 3);
this.entity.teleport(location);
}
Cast ItemMeta to Damageable
uhhh how
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Well itās available right now, no?
Thats not bad as its probably the simplest. teleport will slide the entity
ye i know how to cast but do u have an example
its the simplest for sure - i thought it would jerk it not slide hence the weird jumps
I noticed a couple
ItemStack stack = ...;
Damageable meta = (Damageable) stack.getItemMeta();
wdym ? i was using the whole spigot dependency in 1.16, but then if I just use spigot-api in 1.17 i've got unresolved imports
ahh like that
its just that the STEER_VEHICLE gives this data:
Oh yeah it might not be stable enough to be published yet Mega my bad
its fine np
is there an ETA for it being published?
i hoped it would be a dx, dz sorta thing
Nope
but it is like the accelleration
or an alternative fix ? like installing all the included dependencies by myself ?
Hmm just use the spigot one which you got with build tools
You could try applying velocities but at some point you would have to perform a location correction due to drift.
okay so i just have to build a spigot jar and add it to my dependencies manually until the whole package is published on maven, right?
Myeah
Hmmm - true
okay well thanks for your help š

HELP NEEDED: im using an essentials plugin for 1.17 and im trying to get it where regular players can use basic commands such as tpa and sethome and such and I cannot figure it out, gone to google and everything else and still nothing
@wraith rapids u around?
i mean you're not really supposed to register commands after the plugin was enabled
But I don't see why there isn't a way to do it without the server jar or reflection
Ur supposed to do it while it's being enabled
yes
luckperms
does CommandMap.clearCommands()? clear all the commands that your plugin made?
or is it every command
every command
f i just want to remove 1 command xd
A trolly thing. I see
access the knownCommands field
using reflection
and then remove it
its a hashmap
reflectiona
um
xD
luckperms?
Permissions plugin
So u can easily give permissions to groups of players like the default group
where is that?
1 sec
is it in CraftServer?
thank you
Np
its in the SimpleCommandMap class
final Field knownCmds = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCmds.setAccessible(true);
final HashMap<String, Command> knownCommands = (HashMap<String, Command>) knownCmds.get(commandMap);
this will give you an unchecked cast warning
but you can suppress it
commandMap would be your SimpleCommandMap instance
Why would u even want to remove a command?
;V
Just a trollplugin that removes all commands
And u register every listener
Can't go that wrong
wait how would i get the commandmap for my plugin?
define some commands
1 sec
final Field f = Bukkit.getPluginManager().getClass().getDeclaredField("commandMap");
f.setAccessible(true);
final SimpleCommandMap commandMap = (SimpleCommandMap) f.get(Bukkit.getPluginManager());
is it possible to create a
hashmap<UUID, hashmap<Integer,Long> = kits and kit = 3 (just an example)
take the player UUID, use
kits.containsKey(playerUUID)
and then check if kit is in the second hashmap?
the commandmap contains all commands
so you get the commandmap, then the knownCommands field from the commandmap
and then you can remove commands that are related to your plugin
or any other command if you really want to
k
I've got an invisible armorstand that I want hovering over the player's head, but directly over their head while they move. As of right now, it more or less follows the player (about a 1/2 block behind) rather than sticking directly above them.
Is there a simple way to keep the armorstand directly above the player's head while they move?
theres no knownCmds.remove
i have this knownCmds = SimpleCommandMap.class.getDeclaredField("knownCommands"); knownCmds.setAccessible(true);
?
in my code i sent
but isnt that not gonna work
it is?
its just gonna create a local variable?
wut?
final SimpleCommandMap commandMap = (SimpleCommandMap) f.get(Bukkit.getPluginManager());
its making a hashmap
its just getting the knownCommands field
wait wrong
one
this one
this line
final HashMap<String, Command> knownCommands = (HashMap<String, Command>) knownCmds.get(commandMap);
btw, i tried to make every vanilla command require at least op level 2, but it does nothing
if (command instanceof VanillaCommandWrapper) {
CommandNode<CommandListenerWrapper> cmd = ((VanillaCommandWrapper) command).vanillaCommand;
LiteralArgumentBuilder<CommandListenerWrapper> builder = (LiteralArgumentBuilder<CommandListenerWrapper>) cmd.createBuilder().requires((p) -> p.hasPermission(2, "minecraft.commands.give") && cmd.getRequirement().test(p));
AddNodeChildR(cmd, builder);
VanillaCommandWrapper VanillaCMD = new VanillaCommandWrapper(server.getServer().commandDispatcher, cmd);
VanillaCMD.register(server.getCommandMap());
return VanillaCMD;
}
System.out.println(name);
return command;
});```
yes
The problem is, it is about a 1/2 block behind the player
AddNodeChildR is btw
private static void AddNodeChildR (CommandNode<CommandListenerWrapper> cmd, ArgumentBuilder<CommandListenerWrapper, ?> builder) {
for (CommandNode<CommandListenerWrapper> child: cmd.getChildren()) {
ArgumentBuilder<CommandListenerWrapper, ?> childBuilder = child.createBuilder();
AddNodeChildR(child, childBuilder);
builder.then(childBuilder);
}
}
but wouldnt that not effect the actual hash map or whatever it is?
i want to remove a command
show code
what's confusing you
I can try explaining it
All we're doing here is getting the commandMap which is an instance of SimpleCommandMap
then getting the knownCommands field of the commandMap which is a HashMap<String, Command>
the knownCommands hashmap is what actually holds the commands
@opal juniper
if (location.getX() == p.getLocation().getX()
&& location.getZ() == p.getLocation().getZ()) {
return;
} else {
bounty.teleportBountyText(this);
checkAndUpdateState(p);// Updates the state based on the player's position.
}
^ Method that checks if the player has moved at all (I don't want to run this code when the player simply moves their screen)
/**
*
* A simple teleportation method for moving the player's holographic bounty
*
* @param nPlayer - The NationPlayer object
*/
public void teleportBountyText(final NationPlayer nPlayer) {
if(stand == null)
return;
stand.teleport(getStandLocation(nPlayer));
}
private Location getStandLocation(final NationPlayer nPlayer) {
double x = nPlayer.getBukkitPlayer().getLocation().getX();
double z = nPlayer.getBukkitPlayer().getLocation().getZ();
double y;
if(nPlayer.getBukkitPlayer().isInsideVehicle())
y = nPlayer.getBukkitPlayer().getLocation().getY() + 1.75;
else
y = nPlayer.getBukkitPlayer().getLocation().getY() + .8;
return new Location(Bukkit.getWorld(Statics.worldName), x, y, z);
}
^Code that teleports the armorstand
since it's a hashmap you can just remove/add stuff from/to it
Is it possible that the buildtools don't work right now ?
Attempting to build version: 'java' use --rev <version> to override
Could not get version java does it exist? Try another version or use 'latest'
java.io.FileNotFoundException: https://hub.spigotmc.org/versions/java.json
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1981)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1577)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at org.spigotmc.builder.Builder.get(Builder.java:728)
at org.spigotmc.builder.Builder.main(Builder.java:322)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
As https://hub.spigotmc.org/versions/java.json returns 404.
so the hashmap there is a reference to the actual hashmap?
it would change also the original hash map, because in, java variables, that aren't primitive are just pointers to the data on ram
yeah that's how objects work
objects are always passed by reference
is it behind them when they stand still?
they are i thought they weren't
š
yeah
there is nothing you can do
unless u want to try and predict where they are gonna move
it is just it is only called 20 times per second max
which causes the delay
I see
Can anyone help me please ? #help-development message
how do you set motion in the direction you are facing? like i want an armor stand to move in a line in the direction it is looking, how would i do that?
is it possible to get the value of the key which is linked to another Key in a hashmap?
hashmap<Key, hashmap<Key, Value <-- what im trying to get>>
Is there a way to make an armorstand "unhittable"?
hi! I want to teleport people from an Async task. I know that this isnt possible but is there a way to make it possible?
In my plugin the calculation of the location is kinda complicated and using this in a sync context it brings down my server to 18 tps. So it would be great if there is a way to do it
I don't mean invulnerable.
call it in the scheduler
Donāt use playermoveevent probably
Wdym? If you have the first key then you have that hashmap
gonna try it, thanks
Then same concept applies for the next hashmap
just bare in mind it wont be called until the next tick
stand.setMarker(true);
I dont care about that. But what does the scheduler do different than just putting it in my code? I saw that the tps were okay so there is a difference in some way
It will call it on the main thread the next tick
like that?
usign a buffer hashmap
that hold the value of the key
But isnt my event called in the main thread anyway?
U just said that u are doing stuff async right?
which means that it will not be on the main thread
Okay now I see
np
I mean yea that works
wait does this work
kitsUsed.get(playerId).get(kitID)
like is it a thing?
i cant test it
maybe if you had a hashmap inside a hashmap HashMap<UUID,HashMap<Integer,Long>>
yea
It should be
?
yep, it is called 100 ticks after the plugin gets enabled
(originally it was 1 tick after it, but i tried to increase this number, but same result)
You do know you need op lvl 2 to do commands arleady right?
The default commands atleast
Lvl 1 is just bypass spawn protection
nope, some commands as /me do't require op at all
Well that's because it's a default permission
If you use a perm plugin just remove the perm for it if you dont want it to be run
oddly you can't remove base MC command permissions
Well you can remove the perm but the command will still show in tab-complete and will be usable.
Odd
Bukkit commands you can, just not base MC commands
the code for modifieng the command is 100% working, because what i edit the command in command dispatcher, it works for the tab complete
but the registration isn't working
for (CommandNode<CommandListenerWrapper> cmd: ((CraftServer) Bukkit.getServer()).getServer().vanillaCommandDispatcher.a().getRoot().getChildren()) {
root.removeCommand(cmd.getName());
LiteralArgumentBuilder<CommandListenerWrapper> builder = (LiteralArgumentBuilder<CommandListenerWrapper>) cmd.createBuilder().requires((p) -> p.hasPermission(2, "minecraft.commands.give") && cmd.getRequirement().test(p));
AddNodeChildR(cmd, builder);
cd.a().register(builder);
}
(^^^^ this works, but only for the tab complete, bec it doesn't affect the map)
If you're doing this for a private server creating a patch could be easier
maybe, but it is usefull to learn how to learn how to register vanilla like commands, because many times before, i needed the better tab complete
š„²
can you edit the server jar and fuck about with stuff
if you're brave enough
I mean - yeah sure you can
i love this https://github.com/BepInEx/BepInEx
which IDE is best suited for plugin development?
notepad++
intellij or eclipse
notepad++ gang wya
i'm currently using eclipse but i wanna know the pros and cons of each ide
i also rarely see netbeans being used for plugin dev, any particular reason why?
eclipse cons is shit ui and sometimes buggy
intellij cons is you have to really get used to that ui and its kinda hard to
Yeah
i've used intellij before but it was kinda slow
As slow as eclipse for me
i think intellij uses electron
faster
lol that explains it
lol what? it's a native java app
o
intellij's performance depends on your disk speed mainly, otherwise you're gonna be sat there for 5 minutes waiting for it to index
IntelliJ probably caches a lot more stuff like the indexing it does for instance
intellij idea
lol since i've heard intellij so much i'll try using that instead of eclipse and see if it's better or not
because most people here use IJ
Better is very subjective
better for my purposes*
Mye
Handles kotlin better - IntelliJ
holy damn it's pretty slow
You can set a higher max ram allocation limit
I mean they made the Lang didnāt they?
So I would expect it
yep, they did
Thatās why itās so good /s
even it was made for them to make it easier to develop intellij idea
but personally, i don't like kotlin so much
I will convert if it gets union types
is there a better way to do this: https://paste.md-5.net/ikuheyicix.m
i already tried https://paste.md-5.net/yinihoweki.m but i get a few errors
HashMap<UUID, HashMap<Integer, Long>> kitsUsed = new HashMap<>();
im trying to add values to the second hashmap inside that hashmap
You might wanna adjust the load factor
whats a load factor
Also for the record Tables would help you abstract away the awkwardness of nested maps
you can create own class and store there the kitID and the time
Lucas a
Table<UUID,Integer,Long> is equivalent to Map<UUID,Map<Integer,Long>>
Only difference is that it automate creations and destruction
Myeah I guess itās good if you need type erasure
tf is a table and why cant i find docs about it
How can I get the fields in Crafting Table (items in fields)
Probably through CraftingInventory
Is there any way to inject a basecomponent into a chat message?
I know I could cancel the event and create my own chat system but that's a last resort since there are other plugins at work

i thought it uses electron
I tried converting it to legacy but that doesn't preserve the hover or click events
How do I even get the message as components?
I'm just using the AsyncChatEvent
Oh, I think you're thinking of the Paper chat event
Man, that looks a hell of a lot better
Time to use the paper api instead
isn't the paper api pretty much the same as the spigot api?
^^
Not the AsyncChatEvent
ah ok
ah ok
Paper API adds a lot of shit and adds a lot of events
are datapacks just a bunch of in-game vanilla commands?
i dont see how commands like /summon zombie can be packed into a java class
why not
okay then lol
Is there a way doing custom textures for own blocks and items?
yep, resource pack
but for blocks, you must use some block, that already exists
for item, you still must use some existing item, but you can set its custom model data nbt tag, so this texture won't be obtainable ingame
or logs if you need to make it rotateable
Hmm, cant I just use some NBT and make that the texture only gets applied with that NBT Tag?
yep, but blocks can't have custom nbt tags
some have, but you can't define your own including custom model data
there was some funiture plugin used spawn eggs for placing funiture, it doesn't needed the textures installed on client
this uses invisible armorstands with blocks on heads
it can't use custom models, bec op saied, that there were no texture packs on the client
for example this plugin https://www.spigotmc.org/resources/āļøvehicles-no-resourcepacks-needed.12446/ uses the same thing
They are armour stands iirc
And yes
The big models were laggy
and problem is, that minecraft doesn't have any link between entities that supports offset in all directions
so you must send packet for each armor stand when you want to move them
oh, i didn't know this, thx for correcting me
Makes sense to me
why?
You need to keep the state of the server and client in state
Hello, I am making a plugin in Java for my minecraft server, basically it spawns a custom sword inside a chest and when a player opens it, it gives him effect, I'm having some issues with trying to prevent players from re-having effects when opening the chest multiples times, I've tried putting player names into a HashMap which worked but I needed to make the HashMap permanent so I tried converting its data to a JSON then getting it back after a reload, but that didn't work.
Is there any other way I can let a user have effect only one time when they open a chest and then no effects when they re-open it?
btw I already set the plugin to check if the chest contains the custom item, so that not all chests get the effect.
but any packet loss (and this will probably not happen) will be corrected on net entity movement, so there won't be any serious difference anyways
based on if it is private server or public plugin
for private server, I'd go with MySQL, for public plugin, save it to binary file
persistentdatacontainer?
Itās a private server, so youāre saying I need to store players name in a MySQL database ?
What is that?
I recommend more storing UUIDs, because when premium player change his name, the data will still be there
So if I understand, this is like a HashMap or a List, that can store data permanently
thats also option to use nbt tags, but idk if they reset when the player reconnects
does not reset upon anything im pretty sure
Is there a place to read the BungeeCord javadocs?
Yeah a map like structure
?jd
Thanks
it is simply object, that allows plugin to edit nbt tags
How come?
Is there a list of Bungeecord API versions?
Check the repo
Iāve never used MySQL so I might try persistentdatacontainer first
yeah i dont see whats wrong with using it
I mean use pdc if needed, itās very context dependent whether itās a bad or good solution to a problem
it is database, so you can store there almost anything you want, you need to create a table there, that contains columns, each column has some datatype and then each row is some players data in this case
so it has a pro, that you can also add money, ....... there
con is, that you must setup the database server
If you can, use something like mariadb or postgre
Reinventing the wheel without any significant justification is probably somewhat naive yeah
uhm you're saying I shouldnt recode minecraft because I dont like how it works?
š„²
ignorant fellow

I am sorry but I havenāt joined kkk yet and will probably not do that unless I get a zillion dollars or something
yet
dig a hole and bury yourself please
dig a whole
yes a whole hole
i only fixed it because I thought it was too wordy
sorry but I know the CEO
and COO
and CFO
anll the CO's
and you arent oen
oh
oh
NNY how many NNY accounts for you have
md banned like 6
Did he? Lol
Lmao
or kicked, not sure
He hasnāt been banned on a single nny account
every combination of NNY with 17 characters after is owned by him
lol
but why
including every discriminator, so NNYaKNpGms0eUVpiSdHx#5618, NNYaKNpGms0eUVpiSdHx#5619, NNYaKNpGms0eUVpiSdHx#5620, etc
Lmfao
lmfao
how can I cast an Inventory to an InventoryView?
inventoryview contains inventory
You donāt cast it
for example #getInventory or #getBottomInventory
I have an Inventory but I am trying to get it's title/name
and to my knowledge you need an InventoryView to get it's name?
Legacies?
Wait pretty sure on 1.16 you can get the title by the inventory
okay but I am not using 1.8 I am using 1.17
Then InventoryView
how to turn the Inventory to an InventoryView was my question
InventoryCloseEvent -> getInventory()
oh your right, thank you
could someone help me with this?
this
setVelocity I think
There should be a way to hire devs here ngl
I believe you can use PlayerVelocityEvent then setVelocity()
the way i set motion for the player:
player.setVelocity(player.getVelocity().add(player.getLocation().getDirection()).multiply(5));
isnt working for an armor stand , but im not sure why
I mean, there should be a channel for it
Like I gotta find someone else to help me fix some things
what do u need help with?
I am rewriting a mines plugin I paid for
this one? https://www.spigotmc.org/resources/mines-Ā»-1-7-1-17-ā¢-unique-features-ā¢-api.63552/, or something similar?
And I am struggling with some things like the upgrading part
Nah another, want me to grab link?
is it similar in complexity tho?
3 - 4 mb
What is your code for the armor stand?
the exact same, just for an armor stand
according to this:
https://www.spigotmc.org/threads/spigot-max-file-size.309075/
but u can link like a dropbox
I'll sit on it and squash it down
š§
u r big brain
Hmm. Maybe try launchProjectile? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/projectiles/ProjectileSource.html#launchProjectile(java.lang.Class)
declaration: package: org.bukkit.projectiles, interface: ProjectileSource
F well hope my plugin doesn't go over 3mb
Rn it's like 20 something kB or idk something like that
that will just launch a projectile from the armor stand
Ah, nvm then
This is probably way, way beyond the scope of this channel, but can anybody point to some good resources on learning SQL commands? Trying to get into SQL messaging but I'm not quite sure where to start.
Any events for when a player changes the item in their hand?
PlayerItemHeldEvent
Found it š thanks
Or is that only when they change slots? Guess I'll have to test it to find out. I'll reply if it works or not.
Ah it only seems to fire when changing slot
Would you say the only way to do it is to make my own events for InventoryClickEvent, PlayerDropItemEvent, etc
not own events but check inside of them events
I'll do some testing when I get back; I'm going to eat dinner atm
np, i messed arround with it a bunch and couldn't get it to work so i decided to use an arrow instead
now that im thinking about it the arrow was better for what i needed anyway
hey guys
is there any way to generate a book from json, like with the /give command?
eg: {pages:['{"text":"Minecraft Tools book"}'],title:Book,author:"http://minecraft.tools/"}
Yup
?
A question, I have this code from version 1.16 but when I move it to version 1.8.8 the code comes out with an error. Bukkit.getServer().getScheduler().runTaskLater(plugin, (bukkitTask) ->
That API did not exist in 1.8.8
where did you find the source of this function, I am trying to find it, because I need to look at what it is doing, but I don't see it anywhere
correct, it is optional, but I was wondering if anyone knew what it's use is
I am also wondering how you can get an ItemStack[] from a config file
and What is the best way to do it? Can you help me?
I cant help
i want to do it in source
i have the json, i need to convert it to a book without the give command
bookmeta.spigot()
the only method I see is deprecated
right? that supports basecomponents
yes
how would i convert json to basecomponents then?
Which json exactly do you refer to?
nono
The text of the book
Or the book itself
Because there is a way to deserialize items, i just forgot where the method is
This is the closest i could get
Bukkit.getUnsafe().modifyItemStack(book, json);
Its only deprecated because it may not be safe in the future
Ah, well I did some testing anyway and it worked for me. Here's what I used. entityPlaceEvent.getEntity().setVelocity(entityPlaceEvent.getEntity().getLocation().getDirection().multiply(1.5));
Hello1
Need help with getting a player by number with Bukkit
So basically
Player p = Bukkit.getOnlinePlayers()[player_num];
doing something like this
I don't understand your question. Are you trying to assign all the online players individual numbers?
how do I get an ItemStack[] from a config file
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
but
there is no getItemStackList
Show me the values you want from the config
ye
Mmm, one sec
You may just have to use a loop and add them to a List of type ItemStack
ok so say I have a custom library, and 2 plugins on the server shade it, would they both have separate instances of it or would it be 1 instance
ty!
if I dont relocate ^^
YW!
No idea but I assume separate instances
how do I loop through those values
well yes that
Haha
do I just set an ItemStack to the "getItemStack" and then loop through that?
I believe you so
Just make sure you're adding the values to a list so you can iterate through them later
also don't ItemStacks usually only contain 1 value?
how can it also store a list of them?
what should I do with that
how can I also store a list of them?
That's the list you will add the values to. Now just gotta figure out how to grab the values
@shut field what are you trying to do
and this is the config file
I am trying to make a backpack system using a config file
but I don't know how to grab (and use) the info saved in this
get the list of itemstacks from the config
how? there is no getItemStackList
FileConfiguration config;
String path;
// ...
List<ItemStack> itemStackList = (List<ItemStack>) config.getList(path);
Ah, so that's how you grab the path list. That's what I was trying to do
what is "(List<ItemStack>)"
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
well less of "what is it" and more of why would you use it there
to cast it
It's an List of the ItemStack type
but isn't it just set before that, why does it need to be casted right after decleration?
because it's a wildcard <?>
ohhhhhhhhh
I get it now, I was confused by the indentation
List<ItemStack> itemStackList = (List<ItemStack>) config.getList(path);
that is all 1 line!
it wasnt indented?
I thought these were two diffrent lines:
List<ItemStack> itemStackList = (List<ItemStack>)
config.getList(path);
cause I see this:
what client are you on
non-fullscreened discord
I know how to cast stuff, I just was confused by the indentation (that my minimised discord caused)
something like that
Basically I would like to add all the players to a listr
list**
and get the player by doing list_name.get(1)
and then having that be a player object
Any other events to do with items which I can check the changing of an item in a players hand?
https://paste.md-5.net/upowevezum.java
whats your original problem @quaint mantle
Nothing, just asking if theres any more events I need to check for an ItemChangeEvent
when do you want it to be called
When a player swaps items the event ItemChangeEvent will be called
And I checked, no event for that so may as well just make it
So, you can get a list of all players like this and go through one using a for each loop. Or you could just use the .get(0) if you only wanted the first entry
List<Player> onlinePlayers = new ArrayList<>(ERInstance.getServer().getOnlinePlayers());
for (Player player : onlinePlayers)
player.sendMessage("Hey");
@quaint mantle That would work too. I'm not familiar/comfortable with lambdas yet so my code is a little more expanded
True
true != true
!(0)
oh no
xD
lmao
Gotta love programming language
boolean sentenceMakesSense = false;
haha
I can't figure out for the life of me how to use NMS in Maven. I have ran BuildTools so I should have it in my local repository but no matter what I try this dependency doesn't work. Any ideas?xml <dependency> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> <version>1.17-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
I am trying to make a Phineas and Ferb trivia plugin but I am having a prob with getting chat messages this is my code
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
player.sendMessage("yes");
}
am I just a idiot
is it registered
I am just a idiot
š¢
how do i compile a jar (Im trying to get PlotSquared V6)
add the extension .jar to the file
to the ZIP? @quaint mantle
uh
@dusty herald enlighten this man
download the zip, then compile the contents using gradle (since its a gradle project)
Does Citizens NPC count as Player object? Like If I cast (Player) onto the entity will it cause errors?
I have gradle downloaded, its a zip and idk how to use it
may have figured it out on the gradle thing
hold on
Use Spigot
ok so i got gradle, Now how do i use it
EntityDropItemEvent is very poorly named
makes me think it's a more up to date version of PlayerDropItemEvent
when i click the Gradle.bat it says build failed
@ivory sleet @opal juniper @jade perch @summer scroll I have absolutely no idea what happened but after trying to figure out the ACF Command API for an hour I gave up and deleted it. I literally typed the same code from last night and decided to test it for the hell of it and it worked...
Is it possible to increase the time it takes for copper to weather?
Probably
I'm going to assume it has an NBT tag named "Age" or something that gradually increases and once it gets to a certain age the block state changes (similar to how a baby entity transforms into an adult as it gets to a certain age). This is just a guess though.
Actually, a block is not an entity so probably scratch that
Maybe you can start by debugging what event is being called when copper is weathered?
Although i'm not really sure how that works because it's new.
"debugging what event is being called when copper is weathered"
do you exactly know how many events are called a tick
lots of event
Hi when i set soft dependency of multiverse for my plugin?
do i set it like this :
softdepend: [MultiVerse]
I mean the name...
go onto your server
do /plugins
find multiverse and copy the exact characters of the plugin name from /plugins
to the softdepend array
I believe it's Multiverse-Core iirc, you can check them using /pl command.
ohh its same as in pl list ok
ty....but sometimes it runs before multiverse finishes the loading custom worlds
There is one way that I found how to increase the speed, it's by increasing the randomTickSpeed but I don't recommend it, since it will affect other things aswell.
I think that is hard-coded into the game but I may be wrong
it is very possible as it comes from brigadier i believe š¤
So I have the value and signature of a playerās minecraft skin, how would I overlay part of another skin .png texture over that? For example, if I want everyoneās skin to wear a hat on my server, I have the hat as the skin texture file with evertything but the hat erased
Trying to recreate some of hypixel's uhc things but rn im trying to make a recipe book? is there any way its easier than to give ALL the materials even the air ones? this is my code rn:
public class RecipeInventory {
public static Inventory newInv(Material[] mats, ItemStack result) {
ItemStack clearGlass = new ItemStack(Material.GRAY_STAINED_GLASS);
clearGlass.getItemMeta().setDisplayName("");
Inventory inv = Bukkit.createInventory(null, 53);
inv.all(clearGlass);
// ROW 1
inv.setItem(11, new ItemStack(mats[0]));
inv.setItem(12, new ItemStack(mats[1]));
inv.setItem(13, new ItemStack(mats[2]));
// ROW 2
inv.setItem(20, new ItemStack(mats[3]));
inv.setItem(21, new ItemStack(mats[4]));
inv.setItem(22, new ItemStack(mats[5]));
// ROW 3
inv.setItem(29, new ItemStack(mats[6]));
inv.setItem(30, new ItemStack(mats[7]));
inv.setItem(31, new ItemStack(mats[8]));
// RESULT
inv.setItem(24, result);
return inv;
}
}
Is tgere a way to get a .png from a value and signature, overlay two .pngs and then get the value and signature of the final .png?
This us the first part of my message
Actually. I just joined a semi-big server to do some testing and you might not be able to necessarily replace the message itself but it seems you suggest a tab completion.
So in a way, you can
So if anyone could help me I would appreciate it
Yes but I believe that you can suggest a tab completion only after typing the command name
Yeah, you could loop through the materials list
idk how lmao
Right, but that message only shows up when you type something invalid. What I typed was invalid
Would be nice if u could just Turn a shaped recipe into an inventory
I know but i would like to show it even if the sender didn't add any argument
you can
so that when he started to type the command name he receive a custom tooltip
like this?
I know but i would like to do the same without any argument
i didnt type anything and it just shows that
Oh for commands?
yes
wdym?
what do u want after that?
Literally what I sent xD
Oh sorryy but i don't know how to that x)
i already dit it with arguments but it doesn't work when you just type the command name
Use PlayerCommandPreprocessEvent
š
so i can just get the letters
This event fires only when the player hit the enter button
Oh yeah, that's right
I can't get gradle setup and I need to compile a plugin, someone help
What are you trying to do
I'm trying to remove this message
I'm trying to change or to remove this message when a player starts typing an unknown command
Can you? Afaik you would need to register it or do some packet fucknuggetry
pretty sure that's clientside
What makes you say that?
you gotta sync commands
the client doesn't know about any command until you sync
why would it do a packet to get a command on every keystroke
Right - well I imagine that there are packets sent about it yes
Idk if it stores a registry of commands
@deep tiger do you know what a directed graph is?
Nop :/
Yes i've seen this too !
well thats what sync does i'd imagine
// ROW 1
inv.setItem(11, recipe.getIngredientMap().get('A'));
inv.setItem(12, recipe.getIngredientMap().get('B'));
inv.setItem(13, recipe.getIngredientMap().get('C'));
// ROW 2
inv.setItem(20, recipe.getIngredientMap().get('D'));
inv.setItem(21, recipe.getIngredientMap().get('E'));
inv.setItem(22, recipe.getIngredientMap().get('F'));
// ROW 3
inv.setItem(29, recipe.getIngredientMap().get('G'));
inv.setItem(30, recipe.getIngredientMap().get('H'));
inv.setItem(31, recipe.getIngredientMap().get('I'));
// RESULT
inv.setItem(24, recipe.getResult());
made it like this but then i would have to make the recipe each slot an different key
how would i do that
how to fix*
Means we can't do anything right ?
U could send it urself
but how does that achieve the result of removing the error message?
removing/editing
Cause if he registers the command - it isnāt invalid
Thats my thought process anyways
but how do you know what command the user is currently typing out
i'm 99% sure its client side
The idea is : when he started typing, we sent him a custom packet with the command he is typing ?
because something like that doesn't really make sense to be server side
But how do you detect the typing
No idea x)
<args> is a default thing
after you type a command it shows <args> if you haven't declared what each argument is
mmh
@deep tiger I think I'm onto something here š¤£
That's honestly the best thing to see while debugging
Fax
huh
Yeah, since the pop-up message can't technically be replaced, you could override it with tab complete
Like so:
How did you come to this result ? x)
he said
Yeah, since the pop-up message can't technically be replaced, you could override it with tab complete
I haven't yet
I went on a semi-big server (bc they usually have good devs that know how to block things) and did some testing to see if they were able to do it
Why you say that?
because it can't be removed?
?
I want to spawn a Villager at predifined cordinates, but i dont know how to set them in code. Can someone help me?
How do you want the Villager to spawn? Command?
No when the server starts the Villager should spawn
I mean like for initial setup
But ig you could just do that
Well, @deep tiger I tried but am not sure it is possible. This is the closest I could get. The errors suggest both packets and brigadier are in use so yeah... š¦
"playerAvailableCommands" is null
I know but the error still suggests aspects that are out of my control so it seems pointless to keep pursuing it
Didn't give up, I ran out of options.
5head
Whats the mojang website which has all the player skins, that you can search by the skin signature?
btw i just wanna add a thought on this
if the base server is 1.8 and you can join with a 1.13 or later then the auto complete won't exist at all
and will only show <args> for every command
Thanks to thank you very much for trying š
because the base version is under 1.13
You're welcome š
Very true
if that's not the case then they just don't have auto complete on the commands
There should be a textures.minecraft.net/textures/enter signature here and it should give you the skin
Anyone know where minecraft stores the skin files? I have a playerās skinās signature and value and Iād like to download their skin
For a plugin Iām making
still dont know how :(
Can someone explain what owner means and what it does?
Who's holding the inventory. For example if it's a player inventory
Does it behave different if I make it either null or a player?
Not sure but you can just set it to null
It's basically an inventory holder, it will return that object if you try to get the holder by using Inventory#getHolder
ohh, I store the inventories in a database and I set owner to null but I use the player uuid's to find them later
I quess it doesn't matter then
yup, it doesn't really matter
should this play a timer for the player?
private void startReadyCounter() {
Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
int time = 5;
@Override
public void run() {
if (time == 0) {
return;
}
for (Player p : getTraders().values()) {
p.playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 2, 2);
}
}
}, 0L, 5L);
yes, use lambda by the way
never used it : )
Just replaced new Runnable() with () ->
i got an error now
I think you need to remove run
It's 69%
If you use BukkitRunnable I think it would work
You canāt declare it with both the anonymous class instantiation syntax and lambda body expression
I think you should give your server some time to breathe lmao
Probs wouldn't want to do 0 ticks
It's every 5 ticks, the delay is 0
Is the bukkit runnable better??
Depends
I have a scheduler to save data in my database every 20minutes
You know I don't get why they can't just be a delay and that's how much ticks untill it runs
Not like using the BukkitRunnable over BukkitScheduler or vice versa is a performance win. Only reason you would choose the one or the other is cause of lambdas being syntactically cleaner or the fact that BukkitRunnable is impure.
isn't that the delay function? wait x ticks before the scheduler runs for the first time.
Idk
The parameter names are really bad
First one is initial delay in ticks, second one is interval in ticks
Probably spigots
derives from the bukkit class, so.
Normal java scheduledexecutorservices actually have it that way (initialDelay and interval)
if (p.getInventory().firstEmpty() == -1 || p.getInventory().addItem(item2) != null) {
p.getLocation().getWorld().dropItem(p.getLocation(), item2);
}
is this how you check to see if addItem successfully added an item and that their inventory isn't full?
addItem is annotated @NotNull
:/
oh then
.isEmpty instead of null
but with a ! so
if (p.getInventory().firstEmpty() == -1 || !p.getInventory().addItem(item2).isEmpty) {
p.getLocation().getWorld().dropItem(p.getLocation(), item2);
}
yea?
What if it returned null with the @NotNull š¤
if it's annotated @notnull by the dev, it'll never return null.
it can't
isn't that how it is?
rather in my case, it returns an empty hashmap
but always returns a hashmap, empty, or filled
Will it throw a error?
Bad software
It would not compile
It certainly would
Oh lol
does no one know whether or not this's the solution?
Annotations are just annotations
I thought those annotations implemented compile checks?
Hmm maybe certain ones like ides supporting checkerquals or something
lombok š„¶
Mye lombok is annotation processing I think
Probably throws if you try anything impossible with it
You can try it
Just did some reading and it does seem the annotions are blind
okay
It will give warnings at compile time.
Is it possible to show like in the picture [<level>] without being a tab completion?
crashing with OutOfMemoryError: GC Overhead Limit Exceeded is the result of a memory leak right?
Yup
okay and is there a way to like, see the memory values of a java program?
Or u have some bad gc jvm flags
ill send them
Profiler
my guess is an unending loop
java -Xms3686M -Xmx3686M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar craftbukkit.jar nogui
taken off the interent
craftbukkit?
just the name
craftbukkit.jar :kekw:
it's actually paperspigot :)
Itās immensely stupid, kinda defeats the point
Well how much ram do u have available
why do you want to keep your ram that high if you don't need it
1G, 3G maybe then
theoretically, the higher the ram the easier it was to deal with the memory leak as it'd take longer to crash
immensely stupid of me but
i couldn't get to the bottom of it at all
with what memory leak?
Also send the memory errors full stacktrace
that's if i can get it, i made a plugin to auto restart the server to prevent data loss when memory is less than 700 off the max. so i'll have to check logs or whatnot
Can anyone please take a look at my problem ?
https://www.spigotmc.org/threads/create-maven-repo-from-github-repo.514307/
so setting the minimum flag isn't gonna be the answer to my solution?
Probably not if itās a memory leak youāre dealing with
But optimizing jvm flags isnāt a bad idea nonetheless
doesn't seem like a memory leak. more like that you are creating new instances of an object frequently
instantiating an object isn't collected by the garbage collector inside a function?
It is
-Xms1G -Xmx3G?
Sure
well for some reason that caps it at a gig
Yes because it has only allocated that 1G
so what's the meaning of the xmx3G?
Max allocation
When is it gonna be the future where spigot uses like 1mb of ram on its own
Probs not possible
Technically possible with a lot of sacrifice like not caching stuff etc
maybe instead of abusing github repos as maven repositories, use github packages ? https://docs.github.com/en/actions/guides/publishing-java-packages-with-maven
You can use Maven to publish Java packages to a registry as part of your continuous integration (CI) workflow.
I didn't know that github offers it's own maven host
does anyone know if it's possible to spawn a beacon beam? can't see anything on the docs (https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Beacon.html) and a google search comes up with mostly people saying its client side however those posts are years ago so maybe something could have changed?
it's clientside
You might be able to do something with packets
I think wynncraft does it with the end gateway beam
should also be clientside iirc
Could evt.getEntity().getNearbyEntities(1, 1, 1) also include dead/removed entities?
I don't think so
Well they do it ĀÆ_(ć)_/ĀÆ
are you sure that its THAT beam? not the guardian one with a custom texuture? not particles?
nope
not even if the method is called in the same tick?
not if you remove it before
if you remove it after getting nearby entities, its not dead or removed yet
just afterwards
Mhm
I am performing a #remove before and after (the method may be called multiple times). Yet, I am getting some form of exploit that could only be caused if the entity is still considered alive but was already killed by my plugin
could it be that they just set gateway-blocks?
wiki.vg does not mention anything of beacon beams - so protocol side they aren't anything special (if they exist)
Could be
those beams are clientside, so it have to be
debug it
and what type of "exploit" is it?
can't - I cannot reproduce the issue so I have just to go by words
is there a way to add a new update checker to my plugin
Sure there is
There is a tutorial on spigot
why shouldn't there be a way
For it
I think Choco has made one
XP being added far more than usual. The only code that would explain this would be
evt.getEntity().teleport(Grab.grabLocs.get(grabLoc));
evt.getEntity().setPickupDelay(0);
for (Entity e : evt.getEntity().getNearbyEntities(1, 1, 1)) {
if (e instanceof ExperienceOrb) {
// Grab.grabLocs is a Map<Location, Player> map
Grab.grabLocs.get(grabLoc).giveExp(((ExperienceOrb) e).getExperience());
e.remove();
}
}
I believe
hi all ihave proplem with my skypvp plugin when i hit any one with bow it give me error in consol and when i hit with rod the same error
What error?
iwill send it here
pls
Yep^^
.
.
.
.
ican't send it why ?
Iām going to guess trying to cast a projectile to living entity
