#help-development
1 messages ยท Page 2048 of 1
exactly what I'm thinking too
but yeah my whole RecipeUtils is bad
but it works and I'm using it in 10+ plugins so I won't change anything there anytime soon lmao
Should call it mySecretRecipeForAwsomeTacosWithGuacamoleBaseAndExtraBeans
depends on how many recipes you have lol
Just one
descriptive variable names even in small scopes
would make it way easier for me to understand
then definitely yes, it'll make it much more readable
Otherwise it would have an s to confuse people
tacoRecipe
secret its not secret anymore
Isnt there a library for working with locations and selections?
Like world edit, but much simplier
BoundingBox?
boundingbox represents a cuboid "selection"
just like normal worldedit when using the wooden axe
That what i need for the protection plugin?
I think i would take a look atbounding box
are you still talking about your "radius" thing?
Yeah
when we talked about distance and distanceSquared?
No, I have already explained it many times
simply get the distance between your block and the nearest "protection" block
I even sent you some example code
But wouldnt that cause lag in PlayerMoveEvent?
that depends on the amount of protected locations you have
if it's 300, no
if it's a billion, yes
what do you need this information for anyway in the move event?
You could learn to use frames - then it's all vector after on the frame
I thought it was about placing / breaking blocks
To let player he is joining a protection area
okay so
Yes it would cause lag
I'd do some thing like this, just brainsotrming now:
- HashMap<World,List<Location>> (a map with worlds as keys and a list of pretected locations containing the center of your protected region)
- not using playermoveevent, but a runnable. I think running it once per second is more than enough
- have another map<UUID,Location> of players currently inside a protected region
- check every second if a player is inside a protected region. if yes, and he's not already in the map from #3, send the message and add them. if they are not in any area anymore but are in the map, remove them
and be sure to use locations instead of blocks
and of course only do your math if the player is in the same world as in the map's keys in #1
if you do all of that, no lag at all, guaranteed, even if you have 200 players and 500 protected regions per world
and be sure to always use distanceSquared
you never need the real distance
if distanceSquared > MAX_DISTANCE*MAX_DISTANCE is true, then distance > MAX_DISTANCE will also be true, so no need to do any square roots
depends if they have many many worlds
if yes, yes. if no, no
i would use Set
that won't be the problem anyway, but yeah depending on the size, a set MIGHT be better
in fact the Map should contain Collections and not lists/sets anyway
and instead of Location you could do your own tiny class that simply stores X,Y,Z, so e.g. a Vector3
but my opinion is to not overthink everything a hundred times unless you actually experience any problems
premature optimization isn't exactly very helpful
especially since they have to loop over the collections contents, having a list or set makes no difference at all
in iterating they are equally fast
and in fact the list will be faster since it won't have to check contains() when adding a new location
so yeah that's why I decided to suggest a list here
somehow people always think that sets are faster than lists when in most cases, the opposite is true
ah i thought you were talking about the bad impl of the map interface
why does it matters tho
it doesn't matter at all unless you want to switch from List to Set or other way around at some point
ah
but in general, if you don't need any methods from List, you can as well refer to it as Collection
but yeah it won't actually change anything except to make the code more versatile
Like does spigot api for player right?
what?
Is it possible to use switch on arguments from a command?
What i mean is using switch on String [] args
wdym?
isnt it, Collection<Player>?
Bukkit.getOnlinePlayers() you mean?
what methods does list have that collections doesnt have?
mfalex, people recommend me to based on the protection block calculate 2 corners (based on xyz)
yes
How would you do it ?
Ohh I'm dumb, thanks!
but in my opinion the string parsing goes brr so i transformed it a little
Map<String, SubCommand>
still wondering how to implement sub-sub commands
I know how to do it
Umm create <SubCommand, SubCommand> ? ๐
๐
Take a look there @tardy delta
https://github.com/Alexito2060/CommandAPI/blob/main/Spigot-Utilities-Command
Does anyone know how I could implement a way to limit the number of a specific block that a player can place per chunk? (feel free to ping me)
thats for tab completion
Look at my command api it will help you to understand
lombok ๐
Lombok lol
i guess the CommandExecutor class has to be extended by command classes?
Yeah
Look at the wiki
It has examples
how to I grab an entity's score in a specific objective? (as a value)
e.getEntity().getPlayer().getScoreboard().getScores("timealive")
this returns a bunch of addresses to the players' score entries
store the amount of blocks a player has placed inside a chunk in the chunk's PDC
unless you're on 1.16.2 or below
then you're fucked
Why would i need to store the World ?
you don't have to, but it'll quickly allow you to only check for protection blocks inside the same world
my reply was not to you btw
Is the BungeeCord Plugin Messaging not both ways?
it is
Its but you need 1 player online atleast
How do I use it on Bungee's side, can't find anything? ๐ค
idk, never used it
Its a event
is there even a point of returning false in onCOmmand, that prints the usage message right?
That's how I can read it, yes, but I also need to send?
yes it prints the usage
but verano youre already printing the usage
Doesn't your command executor still require plugin yml stuff?
What?
U dont need to register them via plugin.yml
Its already done by doing reflections
Ah found it
command library ๐
For reading use PluginMessageEvent
For receving
@EventHandler
public void onMessage(PluginMessageEvent event) {
// Do stuff here
}
For sending:
public void send(String data, ServerInfo) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
try {
out.writeUTF(data);
} catch (IOException e) {
e.printStackTrace();
}
server.sendData("BungeeCord", stream.toByteArray());
}
Yeah i have done it some weeks before
If you have any recommendations let me know please
For what to use or what to add to yours?
Reminds me of what I'm doing. Except mine is a lot less focused on QoL for commands themselves
Please use try-with-resources
getScoreboardManager().getMainScoreboard().getObjective("OBJECTIVENAME").getScore(e.getEntity().getName()).getScore()
^how to get a specific entity's score in an objective for the CTRL+F users ๐
looks ugly asf
Do u have experience with cuboid selections?
Because im too much confuse
Try catch finally
It allows u easy command usage and sub command, and of course registration
public void send(String data, ServerInfo server) {
try (ByteArrayOutputStream sink = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(sink)) {
out.writeUTF(data);
server.sendData("BungeeCord", sink.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
}
I never liked that
Try-with-resources properly manages classes that implement the Closeable interface by closing them after the scope of the "ARM block" is over.
Always close closeables when you are done using them, and preferably with try-with-resources.
havent seen many people closing their scanner
There are some closeables that literally do not work properly if you do not close them, e.g. ZipInputStream
Honestly, don't even use Scanner. It's pretty slow. You can use new BufferedReader(System.in)
hey so I am trying to make a custom client, I am following a tutorial and it said to generate the mod skeleton using this https://github.com/ExtraCrafTX/GeneratorFabricMod
I got to the Usage and then where it says
Once the bin directory has been added to your PATH, navigate to the folder where you would like to create a new project. Here, simply run GeneratorFabricMod
how do I do this?
im not very often using readers tbh
i was using a scanner to get console input
for my jda bot
Sir this is a Wendy's
This is just for Spigot or Bungeecord development
sadge
Imagine making a custom client for a custom client
hahaha
Stop being a pussy, use MCP instead of Fabric
Probably one of the first Minecraft modding tools ever made?
Minecraft Coder Pack
mcp isnt minecraft pocket edition but for pc?
It allows you to decompile/recompile the game alongside some other tools.
Im so confused because minecraft has many shits
Pretty fuckin' historic uhh
is it still being maintained?
Forge used it
o
Forge won that war
I think maybe ModLoader used it too?
Sigh
ignore the missing thing at the end
thanks!
Probably by learning java
how can i create a spoiler on spigot plugin upload to spigotmc.org?
what do you think I'm trying to do
Code a spigot plugin with no java experience
lol thats whats already happening here
solved
like
Why every protection plugin works using fucked world edit ๐ก
They dont
Send one without using please
Prism doesnt
worldguard best protection plugin ever
To the old one or the new one?
prism is premium
Nope
Send the one which doesnt use world edit
And really thanks
But i get really confused since working with my protection plugin i will fork another and that all
Neither do, prism is in the middle of being rewritten by the original dev
Mine doesn't
Is it free?
Lol send gith i will fork
Not for general-purpose protections
Oh but i should be possible to adapt to protect using a custom block i dont think it would be diff or ye?
Currently everything is done with commands in it
You could modify it to work differently if you really want
Thansk you too LowExpresso and you redempt
Plugin version
Coreprotect came up when prism started faltering under the last maintainers
correct
Oh why every plugin isnt simply
I hate the ones that have many shit just for something not diff
You can talk to viveleroi about features you think are missing
vive le roi?
So using your library i can use cuboid class to manage regions?
Yes
It has regions and region protection
The library provides region protection tools, RedClaims just uses those and allows land claiming with them
So i can create a cuboid based a radio?
What
just create different methods in that class
For example i set my custom protection block, then i calculate coner a and b of the radio. And create the cuboid?
void onJoin(...)
void onQuit(...)
etc```
Yes
You can create two methods that listen for that event
you cant have the same event twice
Verano are you mentally challenged today? I have explained 3 times today on how you can make certain areas protected from a certain orgin + radius today lmao
Allright i ask because mfalex help me before but i was too confuse
lol
With RedLib you can just:
simply get the distance from the block to the nearest "protection" block
then check if it's above or below your radius
that's it
But that would lag
CuboidRegion cuboid = new CuboidRegion(start, end);
ProtectedRegion protectedRegion = cuboid.protect(ProtectionType.ALL);```
๐
It wouldn't lol
why having two listeners for the same event?
I mean, the issue with protections is that there are so many ways that blocks can be modified
That's why I created ProtectionPolicy
If he is moving like he mentioned and is merging players as well ...
wdym different things, youre listening for the damage event twice?
There are tons of events you have to check and the code gets incredibly repetitive so I made an abstraction that makes you not have to handle it directly
You just tell it which types of protections you want and it will do the rest for you
With your lib not, but what about with this?
private static final int PROTECTION_DISTANCE = 20; // 20 blocks
private List<Location> protectedBlocks = new ArrayList<>();
@EventHandler
public void onPlace(PlayerMoeveEvent event) {
for(Location protectedLocation : protectedBlocks) {
if(protectedLocation.distance(event.getBlock().getLocation()) >= PROTECTION_DISTANCE) {
event.setCancelled(true);
}
}
}
there isnt such like different things, you just write logic for all what might happen in that event
Redempt so with your lib i dont have to listen to place, break, etc events?
You could use RegionEnterEvent instead of this
Nope
Allright i will use your library so
You can do
cuboid.enableEvents() on a CuboidRegion
Then you can listen for players entering/exiting it and cancel if you want
Do you have a fully example but more simplier than your claim plugin?
Because my brains are to burned and im so idiot that i cannot do anything today
declaration: package: redempt.redlib.region, class: CuboidRegion
Applied to my case Cuboid(start, end) in my case would be coner a and b (like doesnt world edit axe)?
And sorry for being annoying
it's called ABBA
waht that means
it means they are the Dancing Queen
I wil ltake a break
money money money
And then try to do it calm down
talking to?
Jokes aside it's probably the simplest tool
must be funny.... if you'd actually own it D:
And it has great features
the one who said abba
ABBA is for regions pupouse?
It's how MC handles regions
Needa conversion
I know them
@waxen plinth which your library i can just do and would that
Location location = event.getBlock().getLocation(); // Custom protection block
CuboidRegion cuboid = CuboidRegion.cubeRadious(location, 20);
So i think i will use your library
why don't you just use BoundingBoxes
I didnt find it
radious
it's the first result on gnoogle lol
And how i apply that class to my usage
which event is called when the player stops to spectate an entity?
That what i cannot do
Gnoogle and radious great day for spelling
gnoogle is a running gag here
unfortunately I am the only one using it
Dont be sad you are special
yeah, I'm using light mode, I already was outside today, I am coding for 1.18 but still using java 1.8, I know I'm weird
Wait bounding box doesnt exists on 1.8 :(
lmao
How i would apply them?
Because my plugin would be multi version
anyway I gotta go
hypixel begs to differ
I am actually meeting people, don't ask me why, I don't know why either
wait what
anyway anybody know what a configuration.getInt(); returns when the key does not exist?
0
when people invite me
What!?
fun fact:
(0.0d / 0.0) == (0.0d / 0.0)
equals to false
Not the drip
that is not a fun fact
a disturbing fact?
yes
I made one with Node
nodejs is js without the browser
Why copy only one tutorial when you can mash together 6?
i did ๐๐
i need a library or project idea im so bored
cya everyone tomorrow
cya
cya
I wish everyone a good Thread.sleep
Implement frames for spigot

A simple cuboid library?
Bruh stop
for what
I needing cuboid library for multi spigot version
I dont know whats that though
make fabric mods run on spigot
BoundingBox?
Done now stop asking
No
Mutli version, bounding box its 1.13 up
Just use this https://paste.md-5.net/liqujidine.java
let me check
my eyes bro
omg why is that obfuscated
obfuscated LMAO
mojang get robbed

What is the point of InventoryHolder?
i only use it with instanceof my own holder
Saving bukkits :p
MikeShadow and how would i create a cuboid based a location and a radiou?
maths
Literally im so dumb on math
maow why is ur pfp scary? it looks like a cute cat but when looking closer..
Wdym by that?
Buckets hold things - bad pun
bone helmet
AABB aabb = new AABB(minX,minY,minZ,maX,maxY,maxZ);
it scares me in my sleep
technically it's a part of the face for this species
it's made of crystal as well
monke
what mean minX and that all?
that's one corner. The max is the other
Ahh allright
InventoryHolder is just an interface
And then on block place event i get the location of the block and?
So is there any benefit to using it?
I don't think there is benefit of using it in your own code
Depends if you want easy access to the inventory of whatever object you are interested in
^^^
public boolean contains(Vec3 p_82391_)
Vec3 where came from?
If you always know what the object is, probably not
location
So i have to create a vector 3 based on block placed location?
No you just parse the location to it
Allright
Idk why you're having so much trouble making a simple cuboid
i was using it to check whether or not a clicked inventory was one of my custom ones
https://github.com/FourteenBrush/MagmaBuildNetwork/blob/ef86a3b81781c81b06c408d5767b84b96bc926ef/src/main/java/io/github/FourteenBrush/MagmaBuildNetwork/listeners/InventoryListener.java#L22
that what i ask myself
its bad code lol
what?
my first serious plugin
and actually it's a wolf
ooh
werewolf
static noises
?
nah that's my dad
public static final noises
I see
Something like scanning mobs to see if they have or picked up an item might be a good use case for it since you dont know what the mobs are
inv holder?
Yeah
what does that have to do with mobs?
Villagers should as well
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("death");
out.writeUTF(e.getEntity().getUniqueId().toString());
e.getEntity().sendPluginMessage(this, "cranked:crossrespawn", out.toByteArray());
This does nothing, or the event for receiving them is broken on bungee's side...
anynone?
My guess is none, why have an event for when something stops?
why not to have?
Waste of server ticks?
server ticks for something sent by the client?
The client only sends on move afaik
I guess you could test for a lack of move change in a certain time?
Or you could write a client mod report it to yout
thats useful
wdym
Most only want and look for when something happens
I guess the lack of something happening could be viewed the same way
Hello, I got this error ```[20:07:01 WARN]: [FarmChest] Task #2 for FarmChest v1.0-SNAPSHOT generated an exception
java.lang.NoClassDefFoundError: jdk/nashorn/internal/ir/Block
at fr.twizox.farmchest.chest.ChestRunnable.run(ChestRunnable.java:14) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:352) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:783) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:833) [?:?]
But I don't know from what it's from
You are using some weird Block import
nashorn ๐
ty
However how would you determine when a player stopped as opposed to network lag or disconnect only on the server side? All the server knows is that the client stopped sending location changes
All I can think of is to track what player changed to spectator mode and specifically poll to see when they stopped.
PlayerTeleportEvent is a TeleportCause of SPECTATE would probably do it.
And then use what Coll sent to check if they left or went in
that is called only when the player ENTERS the entity view
not when he leaves
Wow I didn't think it would be called for either
I mean it's still a teleportation so it makes sense that it's fired.
True
but not when the player leaves the entity view ๐ญ
Is there another way to leave spectating an entity besides sneaking?
Could just check PlayerToggleSneakEvent if there's not.
Hey, why i can't import the Arraylist? public class unmute implements CommandExecutor {
private smpmc.getter getter;
public unmute() { getter = new getter(); } @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { if (sender instanceof Player){ Player p = (Player) sender; String prefix = "ยงcยงlSMPmcยง8.ยงcยงleu ยง8| ยง7"; if (p.hasPermission("smpmc.unmute")){ if (args.length == 1) { Player target = Bukkit.getPlayer(args[0]); if (target != null) { if (getter.getStringList().contains(target.getName())) { getter.getStringList().remove(target.getName()); p.sendMessage(prefix + "Du hast den Spieler ยงc" + target.getName() + " ยง7entmuted."); target.sendTitle("ยงc"+p.getName(),"ยง7Hat dich entmuted."); target.sendMessage(prefix+"Du wurdest von ยงc"+p.getName()+" ยง7enmuted."); } else
Does that even fire
PlayerToggleSneakEvent?
Yes
Player cansee player
That's for use with hidePlayer
True true
Yeah it does
well
just use di
Should work perfectly then
getProvidingPlugin returns the plugin instance associated with the class loader from the class you pass
for instance Nuclues.getProvidingPlugin(this.getClass()) would also work (since your plugin class loader loaded the class)
Not really sure what you're asking, what do you mean you can't import the ArrayList?
Sry im new. I have a StringList in the Class getter, and wiant to use this in the class unmute.
why is it saying that the condition will always be true (e instanceof NodeParseException will always be false)
Heyo anyone used jackson serialization and know how to register a way for serializing enchants? I keep getting com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a (Map) Key deserializer for type [simple type, class org.bukkit.enchantments.Enchantment] when trying to convert an itemstack to a json
Isnt it inherited the other direction?
NodeParseException is a part of Exception is it not?
Exception
|- CommandException
|- CommandParseException
|- NodeParseException
this is the tree
Yeah
So how can exception be an instance of nodeparseexcption without being an instance of itself?
You would only ever get one return
it catches any exception right
so it should catch instances of NodeParseException
so why can it never be a NodeParseException?
oh wait
i didnt extend RuntimeException and nothing in the block throws it
so i think that might be it
I think you want isInstanceOf
nah
that was it
it wasnt a runtime exception and nothing explicitly threw it so it couldnt be
works now
Hmm
how can i get the up vector of another vector?
ToLocation ?
no
some trigonometry shit
uhmmmm
make a static method called "getHandlerList"
eventually
bro its PlayerEvent
?
it already has getHandlerList right
you cant listen to PlayerEvent
why not
player event is not an event you can listen to
its abstract
its a base class
sadly
why can I listen to event tho
thats the point, you cant
I'm pretty sure I've used Event
why listen to event?
and Im pretty sure all events work
getPitch()
probably built-in
It has to have a HandlerList, PlayerEvent does not
making something like a skripting language could be done poorly like that for example
no
hi, does anyone know how to open an anvil gui in 1.17 in which i can rename items?
Well thats complicated xD
X y z ... no it would be getYaw() - pitch is z
Event is most certainly built-in
like whenever an event is called it just goes over the handlers
no
cant find a handler list
because i need a vector pointing up from that vector
not its y
wait a second
i just need to rotate it
90d up
Then set it
brooooo i am dumb af
but if you want to listen to every PlayerEvent just do something like
public void handlePlayerEvent(PlayerEvent e) {
// ...
}
@EventHandler
public void onEvent(Event e) {
if (e instanceof PlayerEvent) {
handlePlayerEvent(e);
// return; /* optional, if you only want to listen to the player event */
}
// ...
}
@quaint mantle
Hey guys
k
Is there any script that can make NPC from Citizens as a pets?
I tried command rewards to create npc from quests plugin but it didn't work
Does the citizens api contain that ability?
LMAO I cant even handle event
What is this API thing?
of course you can't
yeah it doesnt have a handler list
orby are you ok
i thought they may have built it in but i guess not
Maybe you should ask the Citizens devs to create pets as a feature for you
wouldnt it make sense for the bukkit devs to do something like
/* in PluginManager.java */
public void callEvent(Event e) {
// ...
callAllHandlersForEvent(e);
// ...
}
no
although that would produce massive lag if there are a lot of listeners
Yeah but I want like Hijacker npc as pet for all players
so i guess not
Who is the Dev?
then make an NPC that follows you
lmao
For all players, I want to make like:
Atter completing quest, It will create new npc with same name, and it follow player around
Without deleting npc that gices quest
Hijacker gices quest and he join the party
Give
Sounds like you might want to hire someone or make that yourself
Yeah youโll probably need to write a plugin using their API to do it
How do I do it? :)
ah ohh
Do you know Java?
is pretty sure the Citizens plugin has a discord somewhere that you can talk to the dev(s)
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/
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.
or look for a plugin
Ok but maybe you know good plugin that already exist and can be added like pet shaped as a person
I broke me interwebs ...
Thatโs why Iโm saying this is the wrong channel, that would be #help-server
public void onLive(Event e) {
if(e instanceof PlayerEvent && e instanceof Cancellable) {
e.setCancelled(true);
}
B)
Idk about the other people in here but I know quite a lot about building plugins but almost nothing about what modern plugins are on offer these days
How would I set the age of a crop in 1.8? Right now I have this:
byte b = (byte) (block.getData() + 4);
if (b > maxAge) {
b = (byte) maxAge;
}
block.setData(b);
And does that do anything?
Sanity check for old age crops?
no
Block#getState#getData
Gives you a MaterialData
And then you can set data and state and all that
i only know <? extends A & B> kek
Show us addComponent
Itโs ambiguous
I suspect I know whatโs going on but letโs see it
?paste
And letโs also see the line throwing the error
the other error is just because it doesnt know the parameter type
as it cant resolve the method
Change your method names
Also what is the material for wheat seeds? I tried Material.WHEAT and Material.SEEDS and they are not working
Just ask your friends to follow you around in-game
ez
Make the ones that accept a function different from the ones that accept a node @glossy venture
On the ground? CROPS
I think
ohhh
is there an event for when the player stops drawing a bow but doesn't really get to shoot it?
At compile time <T> becomes Object
So if youโre passing an Object it knows thatโs not a function, but the other way around the function could be an object
So the method call is ambiguous
Right
compile*
Is there no way of changing my name on the spigot website other than donating 10$?
But the compiler replaces it with Object
So after compile time the generic info is gone
No. Just donate or keep your name
So at runtime the JVM wonโt know what method youโre trying to call
So the compiler wonโt allow it
yeah
At the moment only Kotlin allows to keep generic data with reified keyword and some hackery (I guess with annotations)
Anyone?
If thereโs no bow shot I donโt believe thereโs an event
any hacky way to check it tho?
ProjectileLaunchEvent exists
NMS
Not if thereโs no projectile launched
oh f me
You said no bow shoot event
Theyโre asking about the situation where someone is drawing back a bow and then switch slots
So they stop drawing back the bow but they donโt shoot anything
I'm aware of what they are asking. My reply was for you
I wasnโt speaking generically about it
I was speaking about their specific situation
Lol
not switching slots, I can check for that
If no bow is shot no event is fired
Anyways NMS isn't that bad. Mojmaps helps quite a bit
but release the right click before shooting the arrow
no event for that (that I know of)
NMS should tell you when they go from having a bow drawn back to not
Or you could listen to packets
Hello, I got an error when I try this: ItemStack[] items = (ItemStack[]) FarmChest.getInstance().getConfig().get("Items.list");
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class [Lorg.bukkit.inventory.ItemStack;
At least I have a library to work with nms easily I guess
You get a list from the config not an array
this is telling you the reason why it's failing
i had an issue trying to get a Location from config a long time ago,
config.getLocation doesnt seem to work as (Location) config.get did so
weird stuff
how do i align this to left? i tried that but did not work
the logo?
yes
i would just do float: left but im bad at css lol
nop
How do I set the display name of an item with no item meta
i did my site like this with basic css
except air
that kinda sucks tbf
i still am not being able to find top and left correctly
see https://wizardlybump17.tk then
lol its for school i dont give a fuck
oo
im not a web developer im a programmer lol
i thought of this
public static ItemStack applyMeta(ItemStack stack, Consumer<ItemMeta> consumer) {
ItemMeta meta = stack.getItemMeta();
if (meta == null)
if ((meta = Bukkit.getItemFactory().getItemMeta(stack.getType())) == null)
return; // material cant have meta
consumer.accept(meta);
stack.setItemMeta(meta);
return stack;
}
applyMeta(item, meta -> meta.setDisplayName(...));
tbf i really
want to make something like that
but idk css or html or js
all the css i have lol
https://paste.helpch.at/oxilokibid.css
also its unresponsive
also @golden turret is it worth applying for devnics
they seem to suck and ask for too annoying projects
not all items have item meta like potato_item which im trying to set the display name
yes
use the method above
but what version are you on
because on modern versions i think every item has meta
if ((meta = Bukkit.getItemFactory().getItemMeta(stack.getType())) == null)
return; // material cant have meta
``` My item can't have meta
except air
My version is 1.8
They are 1.8 the metadata for crops is 1.9
does it not work?
because every item can have their display name changed
so every item can have meta
Idk
You get frames done already?
no that seemed boring
Hahaha
same
godcipher
i think im gonna make smth like
type
give me a diamond sword now
in chat
will give you a diamond sword
you will need a plugin to shade it in
english parsing
give me a golden sword after 120 ticks
its already built into intellij
but its not working now for some reason
keywords
SystemParameterType.ENGLISH = (p) -> promptOtherPlayerToDoIt(p);
``` ez
ig
OOf i put potato instead of potato_item sorry
You could implement Oterlu into a MC Chat moderator
Lmao im still so confused with cuboid
ah
Is it possible to let a player execute a command and ignore if they have the permissions for that command?
Giving op before and removing it afterwards isn't an option since permission plugin might override that
Lol
inject a permissible
how
You can do that in luckperms
or something
I cannot figure how to create simple cuboid class
wdym? Its a public plugin I can't do something that might not work for everyone
not really, if even. I would built it up like a builder pattern
or a converter
I cannot figure how to build my cuboid class
// -x -y -z
final Vector3 negativeCorner;
// x y z
final Vector3 positiveCorner;
public Cuboid(Vector3 n, Vector3 p) {
this.negativeCorner = n;
this.positiveCorner = p;
}
public int getLengthX() {
return positiveCorner.x - negativeCorner.x;
}
public static Cuboid of(Vector3 a, Vector3 b) {
int nX = Math.min(a.x, b.x);
int nY = Math.min(a.y, b.y);
int nZ = Math.min(a.z, b.z);
int pX = Math.max(a.x, b.x);
int pY = Math.max(a.y, b.y);
int pZ = Math.max(a.z, b.z);
return new Cuboid(new Vector3(nX, nY, nZ), new Vector3(pX, pY, pZ));
}
2 points will always build a cuboid
you could just look at this: https://www.spigotmc.org/threads/region-cuboid.329859/
I was wondering if was possilble to buidl a cuboid from a specific block
If in luckperms you cod/would just grant or use tracks
wdym with luckperms??
I don't and won't use luckperms
it has nothing to do with my problem
as permission system not ignoring op players is simply stupid and insecure so most of them do ignore it
i edited it
idk what you mean but thats a cuboid class
with anything you need
how i can get the custom name of a monster ?
entity.getCustomName()?
for exemple if i have a zombie named "Potato", how i can get the name ? ("Potato", not "zombie")
Let me check !
yup thank for your answer ! ๐
Quaternion(new Vector(-x,-y,-z), new Vector(x,y,z))); is the fun with quaternion! Zoom zoom
Hello, how can I set the default config from ressources in the .jar pls?
Set?
in my .jar I got a config.yml in resources that I want to set as default configuration
saveDefaultConfig() as first line in your onEnable
okay thanks
Hi! Do you know any tutorial plug-in? Like you are teleported in a world and you need to do certain stuff to learn how to play in a server
Like adventure mode?
Wdym?
Restricted actions with specific goals
Yes
can u modify attributes for any entities or just players?
Not sure that I've come across a plugin like that, well not a non-rpg one
Let me see
I recall the engineers pack having a sort of tutorial into
How do I make WorldSpesificCommands?
AKA: Command only apepars in /(command) if you are in a spesific world
Not easilly
does anyone know the new generatorsettings specification in worldcreator?
previously in 1.18.1, i had
{
"structures": {
"structures": {}
},
"layers": [
{
"block": "minecraft:air",
"height": 1
}
],
"biome": "minecraft:plains"
}```
Is there a way to change the size of entities?
but something in the NMS has changed a little bit
yo anyone?
anyone have a suggestion on how i could do this better?
i have a few ideas like annotation processing but idk
all this massive code snippet does is make a command like
test <hello> <hello2> print
^^^^^ optional subcommand
https://paste.md-5.net/vaquvequgi.java if you want the code
I donโt think itโs possible
?paste
oof
I wanted to do the same and someone said that itโs not possible
Not in a normal spigot server
damn
#setBaby()
That's the closest you'll get, really
In one of the other forks it is possible for some entities
You can probably change the aspect of a slime depending on its size, so then you can make a slime with custom size and having it like a big zombie
wait, if I spawn an entity is there a way to never make it a baby?
Call setAdult();
alr
... Is anybody able to help me out with that?
How can I make world spesific commands?
AKA it will only show /bal in the tab list if you are in a certain world
Hello, I got this error ```[22:17:45 WARN]: [FarmChest] Task #9 for FarmChest v1.0-SNAPSHOT generated an exception
java.util.ConcurrentModificationException: null
at java.util.WeakHashMap.forEach(WeakHashMap.java:1031) ~[?:?]
at fr.twizox.farmchest.chest.ChestRunnable.run(ChestRunnable.java:19) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:352) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:783) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:833) [?:?]
You're not trying to have multiple gamemodes in one server I hope
wdym
"multiple gamemodes"
@Override
public void run() {
ChestManager chestManager = FarmChest.getChestManager();
WeakHashMap<Block, Integer> chests = chestManager.openedChests;
chests.forEach((block, delay) -> {
Bukkit.broadcastMessage(delay.toString());
Bukkit.broadcastMessage(block.toString());
if (delay <= 1) {
chestManager.removeChest(block);
} else {
chestManager.updateCooldown(block, delay - 1);
}
});
}
public class ChestManager {
public final FarmChest farmChest;
public WeakHashMap<Block, Integer> openedChests;
public ChestManager(FarmChest farmChest) {
this.farmChest = farmChest;
this.openedChests = new WeakHashMap<>();
startScheduler(farmChest, 20L);
}
private void startScheduler(Plugin plugin, long delay) {
new ChestRunnable().runTaskTimer(plugin, 0, delay);
}
public void removeChest(Block block) {
this.openedChests.remove(block);
}
public void updateCooldown(Block block, Integer cooldown) {
openedChests.put(block, cooldown);
}
}
?paste
your spamming chat
It's not
What are you talking about lol
Note the occurrence of "structures" twice (nested compound may be empty, both must exist.). An example valid configuration is as follows:ย {"structures": {"structures": {"village": {"salt": 8015723, "spacing": 32, "separation": 8}}}, "layers": [{"block": "stone", "height": 1}, {"block": "grass", "height": 1}], "biome":"plains"}
There are multiple servers linked with bungeecord
?paste
... your joking.
Why would I
Yeah running a network is expensive. What did you expect
Ugh that sucks.
I literally wrote that specification on the jd, lol
Hello, I got an error, here are all informations
https://paste.md-5.net/badufakape.cs
it's outdated now
google exists
Canโt seem to find anything
ah
Yeah I was rereading it and there seems no change between .1 and .2
You're removing stuff from the map you're looping
Ok right, but I just tested it and it doesnt work ๐คท
yeah but I can't do it in other way
Help with resourcepacks
You can loop a copy of the map or use a different type of loop
Only height changed according to stash notes https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/generator
Your world ID is set to flat?
ty
what are you even saying
How do I remove an item from the inventory by slot?
That was the only recent change to do with the generator. You can read the changes yourself if you wish.
?
what changes
youre not understanding what im saying
The old codec for the generator-settings property was this:
return var0.group(RegistryLookupCodec.create(Registry.BIOME_REGISTRY).forGetter((var0x) -> {
return var0x.biomes;
}), StructureSettings.CODEC.fieldOf("structures").forGetter(FlatLevelGeneratorSettings::structureSettings), FlatLayerInfo.CODEC.listOf().fieldOf("layers").forGetter(FlatLevelGeneratorSettings::getLayersInfo), Codec.BOOL.fieldOf("lakes").orElse(false).forGetter((var0x) -> {
return var0x.addLakes;
}), Codec.BOOL.fieldOf("features").orElse(false).forGetter((var0x) -> {
return var0x.decoration;
}), Biome.CODEC.optionalFieldOf("biome").orElseGet(Optional::empty).forGetter((var0x) -> {
return Optional.of(var0x.biome);
})).apply(var0, FlatLevelGeneratorSettings::new);
}).comapFlatMap(FlatLevelGeneratorSettings::validateHeight, Function.identity()).stable();```
I understand that you said you had 1.18.1 custom generation that worked Nd now it doesnt in 1.18.2
it is now
return var0.group(RegistryOps.retrieveRegistry(Registry.BIOME_REGISTRY).forGetter((var0x) -> {
return var0x.biomes;
}), RegistryCodecs.homogeneousList(Registry.STRUCTURE_SET_REGISTRY).optionalFieldOf("structure_overrides").forGetter((var0x) -> {
return var0x.structureOverrides;
}), FlatLayerInfo.CODEC.listOf().fieldOf("layers").forGetter(FlatLevelGeneratorSettings::getLayersInfo), Codec.BOOL.fieldOf("lakes").orElse(false).forGetter((var0x) -> {
return var0x.addLakes;
}), Codec.BOOL.fieldOf("features").orElse(false).forGetter((var0x) -> {
return var0x.decoration;
}), Biome.CODEC.optionalFieldOf("biome").orElseGet(Optional::empty).forGetter((var0x) -> {
return Optional.of(var0x.biome);
})).apply(var0, FlatLevelGeneratorSettings::new);```
Inventory#setItem(int, itemstack)
The string that I have set as the generator settings no longer generates a void world, which is what i have been able to use since 1.16
if it is not annotated with notnull you can set the item to null
thanks
This is likely due to the way that structures have been changed, but I do not know what the change is, and how it impacts the generator-settings string
I dont see the second structure tag that is now needed
you need to dig into the source code to understand what happens, but when i remove the structure tag altogether, still nothing happens
wonders if that's what I did...
and it should be optional, that's what is in the NMS
why are these deprecated?
sorry guys, i am stupid. How I can send message to player if he left. I mean, if player is offline and if player joined(one time), it will send message.
Are you depending on Paper?
yeah
That's why
i hate how it deprecates all of that shit
like the entirety of net.md_5.bungee.api.ChatColor is deprecated
Then use deprecated methods
If im following a tutorial on lets say 1.15 would most of the information(Code) be the same if I were coding in 1.18 or similar? I know forge is different and wanted to know if it were the same for spigot
yeah
ive been doing that
but intellij picks the non-deprecated one in intellisense so its tedious working with
The spigot api is designed to maintain backwards compatability. So yes
to be honest, bukkit already provides it
ChatColor.of(Color) tho
Wha
i need that for my fancy shit
Oh, bungee's chatcolor isn't an enum?
no
Either way, I have come to use other apis outside of bungee chat. I don't quite like it
How do I make a leather armor piece colored?
Especially when it comes to the question of configurabillity bungee chat may not be the best choice as there are tons of fantastic libraries that convert strings to components in a very user friendly way
?jd-s
yo?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/LeatherArmorMeta.html#setColor(org.bukkit.Color) gotta read the documentation next time
declaration: package: org.bukkit.inventory.meta, interface: LeatherArmorMeta
alr
If you do not know how to obtain a LeatherArmorMeta you are forgiven, otherwise- read the documentation
idk
lol
I highly doubt that it is any consistent
I thought I can just get the meta of a leather armor itemstack
Yeah sort and find yourself
Sorting is not needed for this operation
ItemMeta im = is.getItemMeta();
LeatherArmorMeta lam = (LeatherArmorMeta) lam;
lam.setColor(BukkitColor.RED);
is.setItemMeta(lam);
thanks
Hello, why my config doesn't support utf-8?
It does if you're using the builtin system
when I put "รฉ" it put "\xc3\xa9" in the config and the chat caracter is weird
Make sure you're saving as UTF8 and not something else
Vector3 doesnt exists
Ah allright
Thanks
So how i can them check