#help-development
1 messages · Page 1622 of 1
it is linked to the item meta tho
so save the item meta first -> grab the PDC from it and then, after modifying the PDC, re-set the item meta
So like
stack.getItemMeta().getPersistentDataContainer().set(new NamespacedKey(plugin.getInstance(),"trident_damage"),PersistentDataType.INTEGER,100);
it is
^^ keep my prior message in mind for this, getItemMeta clones the item meta. This would not persist
sorry wait
no you're right it's not
getItemMeta clones the item meta
so you would have to
ItemMeta meta = stack.getItemMeta();
meta.getPersistentDataContainer().set(new NamespacedKey(plugin.getInstance(),"trident_damage"),PersistentDataType.INTEGER,100);
stack.setItemMeta(meta);
I've been awake for 29 hours running off of will power and caffine
How should i structure this
Chat event is the only one that has other classes it uses
Should i just put it in its own nested package or should i put the other classes chat uses into a package and put SpigotChatEvent in the events package
what you stayin up for
Player p = (Player) projectLaunchEvent.getEntity().getShooter();
p.getInventory().getItemInMainHand();
Eh unfortunatly I saw a great series on netflix and binged it
how will this work with a trident
as it leaves the hand
well you would have a ProjectLaunchEvent listener
to listen for projectile launching
this even is ran just before the item in the players inventory goes blank
so You can get get what Item they threw by getting who shot the projectile, in this case the trident
Here, have a quick read of this
How do I get the tps of a server again?
You don't with Spigot
Hey guys!
Been messing around with custom enchants a bit lately and wanted to make an enchant that can increase xp drops, although whatever I try with the BlockBreakEvent it seems to drop the exp orb in game, but there is literally no exp in it. However, when I go to increase xp drops from mob kills there are no issues whatsoever.
Been reading through the docs and forum posts about this, but I can't seem to find anything relevant
Hoping some of y'all know a bit more about this than I do, and that we can figure something out 😄
Below is the code used to (try) and modify the exp drops from breaking a block
https://pastebin.com/Ctvv4kye
Use the exp drop event not the block break https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockExpEvent.html
type slower
teh teh
brain too fast for fingers
Ah right, thanks 😄
brain is speed
It may do nothign, but its worth a try
Although I can't get the player from that event
hey guys, I am modifying max health of Player using Attributes
true
but I am not saving any data.. is there a way I can reset the attributes?
You are gettign completely empty exp orbs?
Yeah
Any workaround?
Well that doesn't really matter does it? Even if I return because the player doesn't even have the enchant, it still doesn't drop
um, you are doing somethign else then. As simply returning will not result in zero exp
another plugin/event
There isn't though. This is the only plugin on my server as of right now
Its simply impossible for just a return to set zero exp
NMS
Well there sure is nothing else editing the values
Should be a tutorial somwhere
I'd take a few minutes break, then come back and glance over your code. Anything that is dealing with exp and block breaking
o
Did you look at the code I sent you ages back using enums and keys?
If you are the same person that is. Yours was custom recipes?
Map<String,String> aMap = new HashMap<>();
A map is a type of parameterised data struct using a key -> value mapping
Yes
why did u use name() tho?
is that a existing method
Okay @eternal oxide I got it to drop the exp from using a pickaxe with the enchant, but when I just return when the pickaxe doesn't have the enchant it still drops an orb with no exp
this part
public NamespacedKey getKey() {
return NamespacedKey.fromString(name().toLowerCase(), RecipesManager.plugin);
} i dont understand
yes, name() is teh most precise name
Where is that namespaces key class
?paste this is a class I demo'd for him
I'd argue against using name() if it's the Enum#name method
yeah functions do stuff
name() is the recomended to use
Says who xD
the javadocs on teh method 🙂
teh
Returns the name of this enum constant, exactly as declared in its enum declaration. Most programmers should use the toString() method in preference to this one, as the toString method may return a more user-friendly name. This method is designed primarily for use in specialized situations where correctness depends on getting the exact name, which will not vary from release to release.
we don;t want a "user friendly" we want precision
Oh
o
i think i understood all the thing now
Which is something that might change
Also kinda limits you in terms of separators (e.g - isn't supported)
Unless you do some replace logic
The name can only change between version release. Which has no effect on this.
but honestly i still dont think i can make something like that myself easily lmao
Hmmm. Yeah I guess you have full control over the change of an enum name so you could implement conversation
something like what
its really simple when you break it down
yeah i can understand it but i have no clue how to make it from zero
The constructor public RecipesManager(JavaPlugin plugin) just loops over its own enum and creates teh recipes
thats the easier part
once the key is registered you don;t need to store or recreate it
its been created once, you can just pull it from teh keystore
but'
name()
why did u write that
how does it know if what u mean by name() is what u mean
yes, thats a method inside teh Enum. So any access to any element accesses that enums key
because you use Keys.ZOMBIE.getKey()
you specify which enum you want when accessing
inside the enum yes
look at the PlayerJoinEvent
it loops over each entry in the enum
retrieves its key and discoveres the recipe for the player
anyone an idea how i could turn config values into a hologram leaderboard?
and where did u define key
key?
Keys is the enum
but u said key not Keys
You mean this Arrays.stream(RecipesManager.Keys.values()).forEach(key -> { new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()); });
yes
that loops over (streams) each entry in the enum and passes it into teh lambda
its basically a for loop
but
key being each entry
its a lambda
o
so it for loops over each entry in teh enum (key)
how would i store my player homes with an uuid a name and a location
what is materialKey?
that is the order in which the recipe items are listed
@tardy delta I would do something like ```java
public void WriteNewWaypoint(Player player, Location location, String name) {
UUID playerUUID = player.getUniqueId();
this.getConfig().set(playerUUID + "." + name + ".x" , location.getX());
this.getConfig().set(playerUUID + "." + name + ".y" , location.getY());
this.getConfig().set(playerUUID + "." + name + ".z" , location.getZ());
this.getConfig().set(playerUUID + "." + name + ".w", WorldHelper.GetIntFromWorld(location.getWorld()));
this.saveConfig();
}```
like the matrix for ZOMBIE is "RDR", "DZD", "RDR"
i go tthis
private void setHome(String name, Location l) {
if (hasHome(p, name)) {
Utils.message(p, "§cYou already have a home with that name, please try again!");
return;
} else if (hasAtleastOneHome(p) && hasLimitReached(p)) {
Utils.message(p, "§cYou have reached the maximum amount of homes, please delete one first!");
return;
}
name = "homes." + p.getUniqueId() + "." + name;
homesFile.set(name + ".playerName", p.getName());
homesFile.set(name + ".world", p.getWorld().getName());
homesFile.set(name + ".x", (int) l.getX());
homesFile.set(name + ".y", (int) l.getY());
homesFile.set(name + ".z", (int) l.getZ());
homesFile.set(name + ".yaw", l.getYaw());
homesFile.set(name + ".pitch", l.getPitch());
ConfigManager.saveConfig();
Utils.message(p, String.format("§aSuccessfully set your new home! [%s]", name));
}
so it needs to know whast item DRZ are
because there is no order in teh recipe you add a key to say what each is
is there also nothing to write a location into a file?
and you get "DRZ", new Material[] {Material.DIAMOND, Material.ROTTEN_FLESH, Material.ZOMBIE_HEAD})
O
3 entries in the key, 3 materials in the array
yeah i just put it in intelliJ now it explains stuff
Arrays.stream(RecipesManager.Keys.values()).forEach(key -> { new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()); });
can be replaced with
Arrays.stream(RecipesManager.Keys.values()).forEach(key -> new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()));
right
hmm i was thinking about placing three datatypes in a map better i can make a home class
thats just removing the {} but yes
I like the {} as its clearer adn used if you have more than one line of code
whats array.stream?
makes a stream
basically take every item from an array one at a time
Anyone had luck using hibernate with plugins? Before i get into it i want to hear people;s opnions
twitch stream :/
oh ok
@eternal oxide
why does this have 4 letters
"BSDE", new Material[] {Material.SLIME_BLOCK, Material.SLIME_BALL, Material.DIAMOND, Material.GOLD_NUGGET}),
"
BSDE"
4 materials
if you used 9 different items in your recipe you'd have 9 in the key and 9 materials.
Good. Its not hard. The hardest part is understanding the enum
its possible to print a location to a file no?
its serializable
uhh
So yes
i'm making my own class for homes now and i dunno if it looks good
seperate the fileconfiguration and make a service class
actually it looks like this
https://paste.md-5.net/vegitubunu.java
\ehfuoawehfuoaehfuoaefuayefayewbfawfnawef
exactly
i will just ignore this
what do you mean by service class?
i'm considering to make a home class now
but i think in your case a simple manager should be fine
you already have one?
you just need a HomeService
whaat
this isnt your command
skullMeta.setOwner(player); what is the arg here?
is it the players uuid / display name?
it needs a string name
i will try uuid
i dont understand it very good
meh its not teh uuid
displayname prob
Whats the best way to get the current tps?
just make a HomeManager which manages your homes
that should be enough for you
you will have to do something selfmade
And how?
NMS ;/
not really
Should be in the Minecraft Server class
or is there a way nowadays?
./tps
How do I use that to get the tps?
You’re telling me the /tps command isn’t a thing anymore?
It is
You access the Minecraft Server class and read it
But how should I implement that into a plugin xd
Ok
As I said a few hours ago there should be a guide online
@eternal oxide what if i want to check for a config and only add the recipes if the config boolean is set to true
Just look how the command does it in spigot
not all recipes though, only a certain set of recipes
an enum is fixed, so instead of controlling what recipes you create, restrict the ones you show
wdym?
you can't dynamically change an enum
Referring to this, still with no result really.
Tried rewriting the whole plugin in a new project where only this is being used, yet it still doesn't drop xp without the enchant.
https://pastebin.com/1RjhKbWA
you manage the registering though
WAIT
so in the class constructor the array.stream
CANT I CHECK IF i = a certain number where the set of recipes start???
then check again if the config is true and continue
and if it isnt i break>
?
If I were you I'd do a disabled list
Wdym?
a list in your config you add any recipes you want turned off
if (config.getBoolean(whatever)) { use the recipe
yeqh but
how do i do that is the problem
for(int i = 0; i < data.materialKey.length(); i++) {
recipe.setIngredient(data.materialKey.charAt(i), data.materials[i]);
if(i == 20){
break;
}
}
i thought about this thing
enable them all except for the ones in the file
https://imgur.com/a/LRJEdSs How do I fix that?
if it is then continue;
look in the addRecipes() method
You’re using a newer version of java
disable any recipe you want turned off in the addRecipes() method
you simply don;t register it
disabled = config.getStringList(path);
Well yes and no
You should save when you think its convenient for the server to do so
not just onDisable()
:/
what if the server crashes?
all data lost
ofc you should have a save method in onDisable by default
but also saving as you go
(if the values being saved are pretty small)
i'm saving homes to files
larger data would require a caching approach
so they're pretty small
wdym update?
thats not the hard part lol
when any variable in the home changes
the part is how to disable it
Hum guys, quick question. When you add a functionality to your plugin but later on you think that functionality will not be used so often. What do you do? Do you remove that functionality or do you keep it?
I have thought of if(Onceuncraftable.INSTANCE.getConfig().getStringList("disabled").contains(data.name())){
i++;
break;
}
but will break stop the loop forever
i assume it will
yes
break means break out of the loop
continue means skip the rest of the code in this loop and go to the next loop
do u think this will do
for(int i = 0; i < data.materialKey.length(); i++) {
if(Onceuncraftable.INSTANCE.getConfig().getStringList("disabled").contains(data.name())){
i++;
}
recipe.setIngredient(data.materialKey.charAt(i), data.materials[i]);
}
Bukkit.addRecipe(recipe);
});
cuz without setting the integredient there will be an error and the recipe wont be registered
i just have to stop the error from showing in console
wait
how to check what stage is it in a array.stream
stage?
yes
what value is it in
for example here
Arrays.stream(Keys.values()).forEach(data -> {
what value is it on?
How do I set the world type? There is no "level-type" in my server.properties
You can add it and it should work
is there an event for picking up arrows?
and whats PlayerPickupArrowEvent
yeah, I just saw that haha
Thrown when a player picks up an arrow from the ground
probably the same, just only for arrows lol
oh XD
because theres a difference between an arrow that lies on the ground, and one that sticks in the ground
oh wew about what you said yesterday from the home command that caused stuff with essentials it seems the permission for the command is null :/
uhh
when i run myplugin:home everything works fine
wrong chat mb
You can remove the command from essentials
i disabled it
Ok
is there a better way to let sheeps despawn, if they're in spawn-area, than checking for sheep every like 3-5 ticks? they destroy my spawn area
net.minecraft.(...)
help pls
Grass should grow back. I would try to find why it doesn't
not when no one is online
It should spawn chunks are kept loaded
How do i check what value is it on now?
Arrays.stream(Keys.values()).forEach(data -> {
My Keys enum : public enum Keys {
ZOMBIE(Material.ZOMBIE_SPAWN_EGG,
"RDR", "DZD", "RDR",
"DRZ", new Material[] {Material.DIAMOND, Material.ROTTEN_FLESH, Material.ZOMBIE_HEAD}),
SKELETON(Material.SKELETON_SPAWN_EGG,
"BDB", "DSD", "BDB"....ETC
https://cdn.discordapp.com/attachments/741875845089722499/873199391261995058/unknown.png
or do you want to explain me this?
https://github.com/PaperMC/Paper/issues/2414
seems to be a common issue
What behaviour is expected: grass should grow back What behaviour is observed: grass dont growth in spawnarea after sheep eat it after some time it looks like this -> example https://i.imgur...
.-. Paper
this
Is there any alternative to PlayerMoveEvent that does not cause TONS of lag?
Looks to be a vanilla bug in newer versions ;/
Elaborate
PlayerMoveEvent is fired 20 times per second per player that is moving
Sounds like a lot but computers are fast
The more players the more lag.
As long as you don't do anything too slow in the event it should be fine
is it possible that the server throws an error when not knowing which tabcompleter to use (from which plugin)
Wow I never would have known that
Well now you do smartass 😉
In what situation would it not know what tab completer to use
You're the smartass for trying to say "the more players the more lag" after I literally just said it's 20 times per second per player
normally my plugin loads after essentials which has the same command as me
Anyways, if you want to cut back on lag in your move event make sure everything you do in it is fast
And check runtime complexity
Beyond surface level advice, we can't help you without knowing exactly what you're trying to do
Only alternative would be your own runnable checking if the location is changed from the last location. It could be helpful but like I said to the smartass it depends on the playercount. Some times just using PlayerMoveEvent is best.
i got an error with my tabcomplete and the run from essentials
Didn't you say you disabled essentials
Couldn't I just schedule a task to run every second, to check every online player's location?
i disabled the command from them
You can do that
?scheduling
so... how to fix that?
Reproduce it in vanilla and submitt a new bug report so Mojang can fix it
i'm pretty sure thats not a vanilla bug lol.. never had that in past on my vanilla server
Then create a plugin that disables the AI or removes animals from spawn while players are offline
true thats an idea
If it isn't create a bug report on JIRA or create a new issue on Papers github
Not really you will have to calculate that yourself
fuck
Shouldn't be hard
yeah... idk how far it goes tho
pretty sure, it's more than 21x21, where the sheep destroy the world lol
is someone hasn't permission to use a command is its tabcomplete by default disabled?
hey there!
I need some help to include MassiveCraft factions to my plugin using gradle. I can't find the repo. i tried:
maven { url "https:/ci.herocraftonline.com/plugin/repository/everything/" }
but it doesn't seem to work
Literally what I said lol.
it cant find that dependency at the given repo
at least looks like that
yup that's why I'm asking here 🙂
may be there is another repo?
that website isnt even existing lol
yeah I found it on an old gist
I didn't think anything in their docs
whats the name of the plugin
or api
or whatever
in most cases, it's better to use an getter/instance, instead of letting static abuse go brr
i took a look, it looks like you're supposed to add the local jar? they doesnt seem to provide any repo anymore
Check what value is on?
they have a discord, maybe you can ask there
they r for different things
the first one implies its a static helper / utility method
So I made a plugin (it does nothing) as I'm new to Java using https://riptutorial.com/minecraft/example/30092/first-plugin-in-eclipse
and I get this error when I load it
Error: "Plugin does not specify an api version"
Specify api-version in your plugin.yml
Because they target versions below 1.13
How can I get all Versions of BungeeCord? Whats the link from the YAML File?
Bukkit.getScheduler().runTaskTimer(this, () -> {
for (Entity entity : spawn.getWorld().getNearbyEntities(spawn, 300, 150, 300)) {
if (entity instanceof Sheep) {
((Sheep) entity).setAI(false);
}
}
}, 0L, 100L);```
i don't think, this is a really good solution... but i saw that entities could always move into the spawn-region, so just doing it when they spawn, seems not to be enough
They can't move in to the spawn region cause other chunks aren't loaded
They can spawn however
move into the spawn region ?
you'd preferable listen to the respective spawn event and run your no ai logic there
Thank you @chrome beacon for the help.
No problem
true... my head ahhhhhhh
So no need for a timer
but what's if they spawn outside of spawn-area, and run into it when players are online? and then when all are going offline, they start eating
oh, well then you'd also have to give them AI back if they leave those chunks huh
they can;t leave with no AI
can entities spawn SOMEWHERE if no player is online, but the chunks are still loaded?
true, big brain moment
Yes that's persistent
that would only be possible in those respective spawn chunks then xD
which are the only ones ticking when no player is online
bc if not, i'd just kill all sheeps on last player quit, who have no nametags
or let them despawn tho
technically I think mob spawning is linked to players anyway (if I am not wrong)
e.g. it isn't the loaded chunks that spawn entities but rather entities are spawned around the player in a given radius
what does for example #setAI(true); do when an entity already has ai
report error, or just do nothing
does nothing
What's the Api version for 1.16.5
so... the only question is now... do entities spawn for example 3 seconds after the last player left
Is there in any way to check player POV?
pov
getPitch(), getYaw()
What do you want to check
first person or third person
Uh no
Not possible
hi!
how to set text in sign?
Only me or is the spigot documentation really bad
what is the mothod
is playerquitevent called after, or before the quit itself?
alright then, thanks
Not really
You have Javadocs with a lot of info
Then you have wikis
Yeah true
setLine
Yeha
like what index
Because using streams seems impossible to do that with
i just did
?paste
2hex youre a god
i wanted to use that command at literally the same time lol
lmao
BlockData sign = world.getBlockAt(215 ,63 ,-353).getBlockData();
sign.setLine```
stop reading my head!
you don;t use an index with enums
olivo, what's with this?
https://paste.md-5.net/diqarawoho.java
you use the keys
assuming, quitevent is called before quit
Use getState my bad and cast that to Sign
i hope i didnt fuck it lmao
no, your recipe class already has an instance to your main so use it plugin
oo yea
do not disable by integer, disable by name
but
how
so so so happy
literally one list in yoru config with names you want disabled
how do i check the name of the recipe getting registered
what is that? lol
disabled_recipes:
- ZOMBIE
- SQUID```
my account got fixed
yes it is
how do i check
after years of not being to access it and change password and stuff
if the recipe exists there
imagine spigot staff would answer my support request after about 3 months lol
i'd be happy too tbh
if (plugin.getConfig().getStringList("disabled_recipes").contains```
its been years and years
they need to fix my acc too :3
Im so happy
bruh?
I know that
lol
the thing is
lol?
how do icheck if the recipe
whaddafuq
qwrhauwefhajefnawefuaw
Hey Guys! I need help. I will get the icon from a server from my code.
what have i done
if the recipe thats getting registered
is in the list
what u told me is config basics lol
I literally just showed you and you said you know
what
Bukkit.getServer().getServerIcon()```
if thats the help you need
what??
before you create/register the recipe you check if its in the disabled list
Without the spigot api
uhhhh
how tho
2hex I raise you https://gist.github.com/lynxplay/9d45139555b204d2a6f2d42dfbb8ff65 to store namespaced keys
wdym exactly
Why?
NamespacedKeys are already stored
how do you want to access spigot-stuff without the api? lol
not that
aren't they @eternal oxide
oh god
I literally told you how to check if a recipe is disabled before you register it
?paste
@eternal night also
this isnt a place to make fun of people
if you are helping or need help
if you are helping or need help
do so
something else can go to general
https://paste.md-5.net/simeviniho.cpp Optimize it so you are not pulling the list every time
"Serious"
what ?
oH
I am so confused 😂😂
Because i will get it with a discord bot
If it looks like I'm making fun of someone I am sorry ? Merely proposing a maybe less static version to store and move namespaced keys
Then just get the png from the folder
But i mean from any server
Then you will have to read packets
use jda inside a spigot plugin maybe?
How much Java do you know?
or whatever discordbot-api you use
I' not bad but aslo not the best
when i did that
You were shot in teh head and your eyes are full of blood?
What you're trying will be a bit advanced. I recommend skipping this feature if you're not very experienced with Java
Cannot resolve symbol
Ok
what went red and what symbol?
@manic furnace why don't you just use JDA (or whatever api you use) inside a spigot-plugin? then you can safely use the spigot-api and your api together
He wants to get data from any server
Because i can not upload a plugin to hypixel
that doesnt fix it
then you broke something
uhhh... are server-images even accessable public?
yes about the server-query
that goes over my knowledge, sry
How would I call a BlockBreakEvent for a specific block?
i just want my sheep's be friendly to others, that's all
you mean listen to it?
ok thanks. I don't know how this goes to😂
Is yoru recipes enum called Recipes?
No, I would like to call it for a block so other plugins can listen to it as a BlockBreakEvent.
probably create a custom event?
Any idea why this would be popping up with the line:
plyr.teleport(CrusadeCraftUtils.getPlayerOptimizedLocations().get(plyr));
?eventapi
So could I call an existing Bukkit event or would that not work?
becuz its not a loop
i dont think so
Yes, I already told you that, twice
o
You can call Bukkit events
sorry didnt see it
return not continue
but for specific blocks?
Why would this change anything?
yeah how can you just call events with Bukkit.getPluginManager().callEvent(exampleEvent); with no other information on the event.
You need to create a new event instance and call that
why would you even want to do that? wouldn't it be easier to just use
public void onBreak(BlockBreakEvent e){
if(e.getBlock().getType() == Material.YOUR_BLOCK){
//do your stuff
}
}```
?
instead of creating a custom event/calling the existing one, just for one block?
Because I want the plugin to break a block
i'm sure i'm getting this totally wrong lol
and it to be called as a block break event.
Is a player breaking the block in your plugin
No
Then you can't call the BlockBreakEvent
To simulate a fake BlockBreakEvent as a player?
Yeah
You throw a new BlockBreakEvent yourself, then check its cancelled state to see if you can break the block.
if the event is not cancelled no plugins prevented it, so you breakNaturally
btw
what if i want the materialKey to be an itemstack
cuz apparently enchanted books r only possible with item stacks
the materialKey is only an index to the following Material array
okay
if you want to be able to define the ItemStack you would need to alter the enum to use ItemStacks and not Materials
Then you would change the first element to be an ItemStack and not a Material
i can just make a enchanted book item with a pcd and check with a sheduler if a player has it then give him the itemstack but thats way too long
yeah and then just say
new ItemStack(Material. ///)
hello @slender flax !
I am trying to use your FactionsUUID api with gradle but I have an issue when I try to build:
https://paste.gg/p/anonymous/9cc31977850b4cebb1394969c33d275d
Is there a way to apply a config/add a plugin across all servers connected to bungee?
You would have to setup your own system for that
Myeah just use like the plugin messaging
hey 🙂 we have a support discord you can join
Oh awesome!
what would be the best way to block damage from other players without a sword?
Anyone have experience with WorldEdit 6.1.9 API (1.12.2)?
hey, hey to set an item in player's offhand ?
Anyone knows how to use a resource pack to show custom enchantments on item?
player.getInventory().getOffhand
thanks!
.setItemInOffHand
player.getInventory().setItemInOffHand
i found this
yeah that
bump
yeah i guessed, just needed to know iwhat i needed to put before
bump
tbh
just a tip
before u start coding
check out the player entity
and getInventory..etc
in the java doc
might really help you
yah, i just knew that player.getItemInHand() existed, so i though player.setItemInOffHand existed
i think you can
you have to replace the texture with an enchanted one ? or make a custom plugin for each item you want it to be glowing
Anyone wants to help me better the structure of my code>?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
IM NOT USING STATIC INSTANCES
WHAT
wait did i forget to remove it from my main
fuck
…
its only there i didnt use it at all
i forgot to remove it
this thing is old af
im rewriting it
You just committed like 2 minutes ago lol
?
i just started using github today
Ok.. how does that have anything to do with static instances…
Just get rid of the static and rewrite it with DI
Glowing has no problem as it does, But the enchantment does not show up on item
i think you cant set default enchantements on a texture pack
u dont get it
Before i didnt know di
so i was using that
when i learnt it
i started using it
but i forgot to remove
You were asking for tips on structure, so I gave you one
that part in main
I understand
thanks
But it doesn’t mean you leave it like that
1s ill fix it
Lol
line 156 of RecipesManager you don't need to create an ItemStack there as you changed the eunm to include it
just set teh field
what
1s
IDE?
Lol
o
wdym
this.itemStack = new ItemStack(material); should be this.itemStack = material;
oh yeah got it
you are no longer passing a Material but an ItemStack from teh enum
you should probably change the variable name from material to item
yep i did that
getWorld().getNearbyEntities(player.getLocation(), 1.5, 1, 1.5) seems to be getting a lot larger of bounding box than what i expect...
im expecting it to be a radius of 1.5 blocks along x and z and 1 radius in y (3x3x2 box)
but it seems to be way bigger than that
would anyone know why velocity is so weird when applied to vehicles currently being ridden?
and how to get around it?
Like code formatting wise there are parenthesis in weird places which was as if you deleted some code that was originally there but left the parenthesis or whatever but it’s not a big deal
check the ordering of yoru key in 116 "BD", new Material[] {Material.DIAMOND, Material.BLAZE_ROD}),
wdym weird?
sending the code to the .git upstream
local (commit) (push) -> upstream.git (repository)
o
ok
anyone finds smth weird in my code?
https://github.com/2Hex/OnceUnCraftable
im trying to keep it as efficient as possible
even if its something really unnecessary but better tell me please
like a convention or something
yeah i noticed a naming convention msitake
line 76 "LEB", new Material[] {Material.LAPIS_BLOCK, Material.GLASS_BOTTLE, Material.EMERALD}),
How can I get NMS class of an API class?
For example the net.minecraft.world.item.enchantment.Enchantment class of org.bukkit.enchantments.Enchantment?
it's because the client is desyncing from the ridable entity
it works on non-player entities
o
that is intentional tbh
cuz im lazy
how do i get around it?
I need a plugin dev
it feels like preference more than stuff liek that
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
i cant believe upgrading a plugin structure took 6 hours
bruh
i mean now it prob has so many errors waiting for me so itll prob be 8h
How i can delete plugin from spigot?
is any bungeecord server hosting free ??
Hey, how would I remove the area between two xyz positions using WorldEdit API 6.1.9?
Is it your plugin?
yes
Report it and request it to be deleted
if i have this in my RecipesManager class, (i also have the addRecipes() method in my RecipesManager class)
public RecipesManager(JavaPlugin plugin) {
RecipesManager.plugin = plugin;
Arrays.stream(RecipesManager.Keys.values()).forEach(key -> new NamespacedKey(RecipesManager.plugin, key.name().toLowerCase()));
addRecipes();
}```
I don't need to do `RecipesManager.addRecipes();` in main class's onEnable right
no
so i need to?
that should really be private as its called from the constructor
no, just instance the class
What?
Quick question: How can one, when setting stairs (through the plugin), set them in a certain direction?
I have already tried with the following code. Unfortunately it did not work:
event.getBlockPlaced().getLocation().add(-1, 4, 4).getBlock().setType(Material.BRICK_STAIRS);
event.getBlockPlaced().getLocation().add(1, 4, 4).getBlock().setType(Material.BRICK_STAIRS);
Block stair1 = player.getWorld().getBlockAt(event.getBlockPlaced().getLocation().add(-1, 4, 4));
BlockData stair1Data = stair1.getBlockData();
MultipleFacing facing1 = (MultipleFacing) stair1Data;
facing1.setFace(BlockFace.EAST, true);
stair1.setBlockData(stair1Data);
Block stair2 = player.getWorld().getBlockAt(event.getBlockPlaced().getLocation().add(1, 4, 4));
BlockData stair2Data = stair2.getBlockData();
MultipleFacing facing2 = (MultipleFacing) stair2Data;
facing2.setFace(BlockFace.NORTH, true);
stair2.setBlockData(stair2Data);
Can anyone help me with this by any chance?
it is private in the demo code I sent you
Yeah
but
that isnt my question
im wondering if
should I do that thing in onEnable
you just recipeManager = new RecipeManager(this);
in onEnable after you have ensured your config exists
actually you need to register it as a Listener
unless you expose the recipies elsewhere
The class has a single login event to reveal teh recipes to the players
then thats all you do
if u make it private it tells me a warning
that method has nothing to do with registering the litener or instancing the class
actually
an error
'RecipesManager(org.bukkit.plugin.java.JavaPlugin)' has private access in 'me.hex.onceuncraftable.RecipesManager'
you are setting teh constructor private not addRecipes
thats a method, one you shoudl never need to access yourself
all you do is instance/register the class event
I tested before registering the event
but
it didnt work
i dont think it was because of registering
ill try again
What would be the best way to check if a player is standing on something?
Just checking the block under the player wouldn't work as the player can stand on the edge and it'll get the wrong block
I guess checking the coordinates would work but it feels like a meh solution
Hey, how would I remove the area between two xyz positions using WorldEdit API 6.1.9?
waehquugguwhfwefhwfwfosdfn
Can someone help me, how do I set durability of a tool in Spigot 1.17. Since setDurability and getDurability were deprecated
Cast item meta to Damagable then set damage
ItemMeta meta = item.getItemStack().getItemMeta();
Damageable damageable = (Damageable) meta;
damageable.setDamage(...);
Like this? But setDamage method doesn't exist
how to not suck at code design and architecture
You used the wrong Damageable
There are 2 of them
Oh... that makes sense, thank you so much
yeah im pretty sure Damageable is for org.bukkit.entity
i was going to say something that could've helped but saw that Olivo already answered
yeah i imported Damagable from org.bukkit.entity but instead I had to use import org.bukkit.inventory.meta.Damageable;
ahh yeah
hi ihave proplem
when player join the game get kit but when he is killed or dead never get the kit in respawn
listen to playerespawnevent
then add the kit to them one tick later
ijust need to send the code
send it here
anyone that can help me better the structure of my code?
how can i fix this red message issue???
World#getEntities only returns loaded entities
Soo... does anyone know how to solve this or........
send code
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if(cmd.getName().equalsIgnoreCase("spawn")){
p.sendMessage(ChatColor.BLUE + "Spawn>" + ChatColor.GRAY + " Sending you to the spawn...");
Bukkit.dispatchCommand(sender, "mvtp " + p.getName() + " Hub");
Bukkit.dispatchCommand(sender, "mvconfirm");
return true;
}
}
return true;
}
don't get started on static abuse in 2hex plugin 😅
