#help-development
1 messages · Page 735 of 1
The constructor gets called way before anything in spigot is loaded. Including the worlds. 👍
and.. what about sit? 💀 if (command.getName().equalsIgnoreCase("sit") && sender instanceof Player) { Player player = (Player) sender; player.setMetadata("sit", new FixedMetadataValue(FluffieCraft_Commands.getPlugin(FluffieCraft_Commands.class), true)); }
For sit you can spawn an invisble, temporary armorstand and mount the player on it
i know, but how?(
i promise u, if i make this now, i won't touch you for a couple more days...
Write some code and play around. Let us know if you have something and need help.
I would strongly recommend writng a manager class for this.
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
is yaw vertical or horizontal in spigot
horizontal
pitch is vertical
roll doesn't exist
well
Yaw is rotation in the Y axis
like looking left or right
Pitch is in the X axis
like looking up and down
i see
in this case just use chatgpt lol
i maked all, no need more
How did this developer had multiple CraftBukkit dependencies?
Hello, I'm seeing an issue with the BlockPlaceEvent. This code should get the item that was in the player's hand. In my case a single enderchest. But somehow it contains the itemmeta, but not the type:
@EventHandler
fun onBlockPlace(event: BlockPlaceEvent)
{
val item = event.itemInHand
}
DOCS of BlockPlaceEvent#itemInHand:
The ItemStack for the item in the player's hand when they placed the block
generally done with a modular project, when compiling it just gets shaded in the same place
each module can have its own dependencies
with either maven or gradle
Is it possible to download and install python through a plugin?
I’m guessing so
But just want that confirmed
Sure
yeah make sure you make sure what OS you areon though
otherwise things get FUNKY
Yeah I’ve made a utility to determine the OS. This isn’t probably possible to answer, but if I upload the plugin to an easy to use hosting site, can the plugin install python onto the machine? I’m guessing each server runs on a virtual machine.
It really depends on the service
But I was wondering what’s more likely
python is bundled with most linux distros
I'd say you probably can't since on linux you need sudo privaleges to install programs
which means the plugin'[s permissions would need to have been escalated
personally I wouldn't bundle python with your plugin it makes things to complicated just make users download python
maybe link to the python exe for the windows peoples
Yeah. My goal here is to run a python api on the machine, which would be installed with pypy
e..g warning in console. This plugin needs python to run download from
Tbh I would not let plugin install binary on my system
Also take note that a lot of servers are containerized
Is there way how to get block breaking time (how long it will take to break block) calculation or edit block hardness? I will probably need to calculate breaking speed manually I guess? My goal is just edit how fast block can be broken. I was thinking about edit block hardness and than calculate (like minecraft do) how long it will take to break for every tool.
thats what I found to. I was just thinking if there is way only to edit block hardness. But probably I will need to use that calculation. Now trying to find witch block can be harvested, is there some sort of tag on material for that?
perfect... that is wat Im looking for thanks a lot. So if Tag contains material it should mean it can beHarvested right?
thats could be issiue and I will be not able to calculate that accurate.. well I will give a try and I will compare with Block#getBreakSpeed(Player) output witch should be accurate I guess
Hello. Is there any reason for this.entity to be null?
public ZooFeeAnimal(EntityType type, Location location){
ZooFee.getInstance().getServer().getPluginManager().registerEvents(this, ZooFee.getInstance());
System.out.println(location);
this.type = type;
this.entity = (Entity) location.getWorld().spawnEntity(location, this.type);
System.out.println(this.entity);
}
Not sure what happens if you spawnEntity in an unloaded chunk
No, im actually running it on player location
Maybe because im typing a EntityType into an Entity?
Should not be an issue
Is something cancelling the spawn
Nop
Maybe cuz im type casting from org,Bukkit.Entity to net.minecraft.World.Entity?
if all I'm doing is checking to see if an item has a specific custom tag in the nbt, is there a simple way to access it via item.itemMeta or do I need the nbt api?
What version
1.20.1
You should use pdc
hi
Does anyone know the name of this plugin? Your head comes out and thanks you in the chat when you buy in the server store
How do i cancel a player milking a Cow? This doesnt work for me altough it should.
if(e.getPlayer().getItemInHand().getType().equals(Material.BUCKET)){
e.setCancelled(true);
}
You using PlayerBucketFillEvent?
How do i get the class of the entity clicked with that one?
You don’t
It’s only designed for filling a bucket from a block
PlayerInteractEntityEvent should work
@EventHandler(priority = EventPriority.HIGHEST)
public void onInteractEvent(PlayerInteractEntityEvent e) {
e.setCancelled(true);
}
This code should work, right?
it is designed
but not really
it only works for goats and cows
¯_(ツ)_/¯
it's weird
should be a dedicated event
pr it
rip backwards compat
And it also just gives you whatever block is at the entities location
Wack
I mean I think the backwards compatible approach would be to add a nullable entity to the event
something something you're probably not registering your listener
niche library, they don't have a support server?
Nope
I'm trying to expose CraftBlockState's world (CraftWorld) field. The idea is not having to spend that much time maintaining NMS and CBC methods
import me.lucko.shadow.Shadow;
import me.lucko.shadow.bukkit.ObcClassTarget;
import net.minecraft.core.BlockPosition;
@ObcClassTarget("block.CraftBlockState")
public interface BlockStateBase extends Shadow {
BlockPosition getPosition();
Object getWorld();
}```
I am not sure if it exposes correctly the world field from CraftBlockState...
Hello so I was wondering if anyone wanted to help me create a RPG based server, if you do feel free to DM me 😁
?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/
Why are the nemuber same.. I need to get how long it will takes block to brake in ticks:
player.sendMessage("getBreakSpeed spigot: " + block.getBreakSpeed(player));
player.sendMessage("getBreakSpeed spigot (in ticks?): " + (block.getBreakSpeed(player)*1000)/1000);
You multiply it by 1000
And then divide by 1000
Which just cancels out the multiplication
The number is 0.05 something so, I need how many times its need to be run to get 1, am I correct? So I just think devide thath number by 1 would be it xD
It's the progress/tick
So if it's 0.05, it will be done in (20 * 0.05), about 1 second
(20 being the amount of ticks every second)
Yeah, its progress per tick. So block will break if number reach 1. I need amount of tick what it will take
1/speed
0.05 would take 20 ticks because 1/0.05 = 20
Then I suppose Math#ceil() the value for anything that's fractional
What I want is just change hardenss of block and base on that calculate amount of time what is needed to break a block. Looks like my calculation is wrong. Base on spigot calculation it should take 18 ticks to break a block, but my results is 60 for some reason xD
I jused this but I get diferent results for some reason
?paste
getBreakSpeed() uses those calculations automatically, if it's that number you're applying those to
Ye, but how can I change hardeness of block? Thats why Im doing that calculation by my own (seems to be something wrong with it for me xD) code: https://paste.md-5.net/tasizofizo.java
I will just do the calculation for new hardeness on block on my own thats probably best way?
I want to constantly update the item lore
is there any way for it to not play the reload animation?
What is wrong with that? seems to be good for me, cannot find misstake
Anyone know of a good, working, JVM spiget api wrapper?
is the one by inventiveTalent good? Scared that it doesnt even have a repo its hosted at
status errors on jitpack too
May be time to just make my own 🤷♂️ kind of a time crunch
Made one for hangar
Do player's have PDC's?
Has anyone made any open source system for like per player blocks that are interactable and same for entities?
Yes. All entities have PDC access.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/persistence/PersistentDataHolder.html#getPersistentDataContainer()
Anyone?
uhh
don't think mine is open source
and it also doesn't support tiles
mm rip, yeah I made one for blocks that was really bad and poorly coded just looking for a better solution as I dont have enough time rn
think I shared mine here but it's prob gone
heyl ook it's not
I'm moving from 1.8 to 1.20 and use a book system with chatcomponents in it which requires NMS. I force the book open in 1.8 by having the player hold the book and then using the PacketPlayOutCustomPayload packet with the MC|BOpen string and a pdc. However this no longer works, the packets constructor now takes a MinecraftKey which due to not satisfying the regex expression, cannot take MC|BOpen as a string. Does anyone know what this changed to?
minecraft:book_open
https://wiki.vg/Protocol_History
What would the best way to implement entities be as they have many mechanics such as knockback ect
Or would it be better to use something to edit the server jar to work?
kasm or whatever its called
should i serialize/save permissionattachments?
Player#setBedSpawnLocation
Should be called on death or only once on join?
Once on join should be fine. But what for?
*Just make sure to prevent them from changing it themselves.
@lost matrix setting the respawn location
I would probably use the respawn event and teleport them to a location.
This is not an actual issue in the game. Setting the location in the RespawnEvent will teleport the player
to their location, regardless if they lag their guts out or not. Where do they get teleported if it fails?
@lost matrix they dont
So they just respawn where they died?
Yeah
All their items will go
And the state will be lobby
So they are just there in the arena
This is 100% not an issue with the RespawnEvent but the EntityDeathEvent or EntityDamageEvent
You should look into your damage or death event methods
@lost matrix the respawn event seems to be called
Sure, but on rare occasions you prevent it from being called by doing some shady things when a player dies
how can i solve the problem of flexible customization of placeholders? I used to think that they update on their own, but I have to manually update them in certain places. And I would like them to update themselves regardless of the location in the config. And also to bind them to certain items or conditions
I dont know what the location in your config has to do with anything, but you need to define a trigger for updating a placeholder.
I thought about trying to do an update system, getting values from the config and updating in each lore or placeholders text, but I don't even know if that's the best solution. DeluxMenu can also use them from other plugins no matter where in the plugin's config the Placeholder is located
directly related to the problem. To be able to use placeholders anywhere
without having to update them myself.
They simply replace their placeholders with code. Doesnt matter if they are in a config or downloaded from mars. You can replace placeholders
in any String you want. You as a developer can any placeholder where you want. You just need to code it.
Don't make it PlaceholderAPI.setPlaceholder or whatever it is
*And you should use PlaceholderAPI
You need to call that yourself. Nobody is magically calling that for you.
Yes, that's true, but it's up to you to choose where to fill them.
and how does deluxMenu do that
it goes through every place in the config and looks for a Placeholder to update it?
They use PlaceholderAPI and replace Strings
or other plugins
They use PlaceholderAPI and replace Strings
i know but plugin shold locate placeholder in text
for fill it
in every locate in config
PlaceholderAPI is responsible for detecting placeholders in text
If you want to create your own placeholders, which can be used by other plugins (Like DeluxeMenus)
then you need to register your own placeholder in PlaceholderAPI
You misunderstood me, I'm talking about filling them regardless of the location of placeholder in config
it has to be filled out manually. Select text then check and fill in
and so on for every text in the config
You need to call PlaceholderAPI.setPlaceholders
For. Every. Single. String. You. Load.
yes and you have to do it all the time.
If you write clean code then you really only need to write it once.
in a specific text. I have to choose the right text myself
it does not go through all texts in the config to fill Placeholder if it is there.
You should never replace placeholders inside a config...
you have to select the text yourself and call the code yourself to fill it in.
And whats the problem with that?
You can load your stuff from a config without knowing what is in your config and simply call PlaceholderAPI.setPlaceholders
for everything you load...
this code accepts text as input, how can I do this?
Okay I'll rephrase my question. how does DeluxMenu know where my Placeholder is in its config.
It calls that method on all strings if papi is found
It uses PlaceholderAPI. Everything they load is replaced with PlaceholderAPI.
Player player = ...;
String someText = ...;
String replacedText = PlaceholderAPI.setPlaceholders(player, someText);
For ease of use, make a method that takes a player and a string and returns it formatted and coloured
that's what I was asking about. I thought about doing the same thing, but I thought there were better ways.
is there a way to disable bungeecord scoreboard tracking or whatever it does
its complaining about scoreboard packets
i asked in help-server but its development for my attempt at a bungeecord network so
I have the same problem with one of my plugins. Tell me if you find something.
this shit keeps happening
aight
it used to work tho
but i dont know why
because the packets were fucked up
Hey, i want to React to the event when a Cat gifts a player after waking up. But i dont know wich event that is
is it the EntityDropItemEvent?
why is System.out broken tf
very hard to debug when System.out.println doesnt fucking work
Try it and see
#help-archived message did this ever end up happening? looking for a way to make entities fireproof.
this is more of a general java question but perhaps someone here has some insight for me. i often find myself needing to "Register" objects i often opt for then using an Enum and initializing whatever object that enum entry belongs to in its constructor. but this obviously does not support "Registering" on the fly. another option would be to use a Map<String, Object> but this would require me to remember all the ids i used to register stuff. which could be fixed by using a class full of constants storing these ids. is this the most elegant solution? any advice?
wdym by registering objects
well just an example, custom items. id register custom items by an ID which is also stored on the itemstack
so i can get its functionality
kinda yea
I would remember those string names honestly, its by far the easiest
xy is i want to extract some of my code to an API would limits me from using enums
if you are being consistent it shouldnt be a problem
would you create constants?
you could but there is almost no point to it
then you have to remember the constant instead of the string name
if you're initializing the object each enum entry belongs to in the constructor then why bother using an enum at all?
at that point just use the name for the constant as the id
yea fair point
just have a bunch of static fields on your class and initialize statically. if you want lazy initializtion use a getter and create your object when you retrieve the field for the first time
i mean generally if i want to supply lazily id just a supplier
but yea u also make a valid point
also by using a string as the id to create/register an item your users have more options for adding items
like using commands and stuff or config files
Hello, I know I shouldn't ask to ask, but would it be fine to ask for help with "CommandAPI" here? Or just the Brigadier command system in general?
you can, idk anything about it though
I know I shouldn't ask to ask
at least you're self aware
alright thanks for the insight guys i uhh should probably refactor all this properly
Hello. I'm now using CommandAPI for registering commands, and it seems to work great! The only problem is using it inside command blocks. Although I'm using the executes() method which should technically accept any command sender, it fails when executing the command through a command block. I simply get this as the "Previous Output" whenever I run the command. "An unexpected error occurred while trying to execute that command"
Here is the code I'm using to register the command:
new CommandAPICommand("entitycount")
.withArguments(
new EntitySelectorArgument.ManyEntities("entities")
)
.executes((sender, commandArguments) -> {
Collection<Entity> entities = (Collection<Entity>) commandArguments.get("entities");
int size = entities.size();
if (entities.size() < 1) throw CommandAPI.failWithString("No entities found.");
if (size == 1) {
sender.sendMessage("Found 1 entity.");
} else {
sender.sendMessage("Found " + size + " entities.");
}
return entities.size();
})
.register();
I just think it's better to ask if I can ask about the topic instead of sending a paragraph long help message with images and then being told not to
PacketPlayOutMap packetPlayOutMap =
new PacketPlayOutMap(view.getId(),
(byte) 3,
emptyList(),
getColors(renderer.getBufferedImage()),
0,
0,
128,
128);
I'm using the code above but it still doesnt work :/
what's the best way to sync faction data I have to a database? And what type of database could I run with the server?
data like players in the faction, the name, date created, claimed territory, etc
If I want my commands to be able to use @a, @e, @p, etc. is there something I can use or do I need to implement it myself
declaration: package: org.bukkit, class: Bukkit
Oh that's a thing? Thanks
Personally I'd use PostgreSQL but you can ofc use MySQL
how can i test out my changes to bukkit/craftbukkit, i have the server but idk what you're supposed to actually test if something is working in the implementation
There should be unit tests you can run
If you added new api or changes you might want to write some yourself to make sure everything is working as intended
i just added methods to an existing class to add more functionality, i see some unit tests, do i just find the one for my class and customize it to my needs?
Hi , how to sell my plugins on spigotmc ?
Hello, I want to unregister my implemented Listener class. How to accomplish that?
HandlerList.unregister(Listener)
I would strongly recommend to not (un)register listeners during runtime.
It hints at a fundamental design problem.
It might be a design problem, but it still is useful
I have a lot of my games registering and unregistering events as they are in or out of context
Sure i could do a check for the context
Which i start doing now
But i still like it
so if i complete my requirement , will selling option enable for me ?
following up on this, i got this error running a test: java.lang.Error: java.lang.IllegalStateException: @NotNull method org/bukkit/Bukkit.getVersion must not return null any idea what happened here?
Not sure how fast the bot refreshes thi
so need i 80 messages on post ?
Wild guess but are you sure a @NotNull method didn't return NULL?
I don't remember exactly what were the requirements
But yeah, you need to be helping people on forums and stuff
Don't actually scam your way out of those messages
how is it a design problem?
It hints at design problems. There is no need to every unregister listeners if you cleanly propagate events
*Ignoring that rebaking the entire handlerlist can be pretty expensive
what about when you have Modules that can enable, disable independendly of your plugin.
those modules then having listeners
You might call this method too early
If they constantly (un)register listener then i would see this as a problem
well no its not constandly. but ive considered building my own event system on top of bukkits effectively creating my own handlerlist
dk if its a good idea tho
on bukkit side the listener would then just remain registered
Thats what i mean by cleanly propagating events.
right, right
thats probably what il end up doing then
cuz using bukkit when having as many events as i am
is a pain too
i hate the listener system
Don't scare me about unregistering listeners please
But, my custom GUI managing class is entirely register and un-register event listeners. So far I have no problems.
registering new and unregistering live is not a good idea
why would you need to unregister anything in a gui class
e.g. listen for clicking. then stop listening to it after the gui is closed.
learn to use consumers/functions and you have no need to register again
It seems like building a new event listening system on top of the bukkit.
i mean if no gui is open just return?
This explains the general idea of how modern GUIs are often designed:
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/#post-4553427
no need to unregister the whole listener for that
Oh, I'll check that modern trend
The GUI just discussed is my old context. Like I said above "So far...". But current context I'm working on it is trying to modularize my features on top of plugin. Any idea of it? It's similar to @shurikennen talked above.
here similar to this
but not independantly of plugin
like one plugin have several shared features.
well as i talked about. you can create your own handlerlist on top of bukkits system and propegate the events to the modules when enabled
Pakages are enough for most projects when it comes to organization. Modularizing in shirukennens way only makes sense if you want to
enable/disable modules while the game runs. Rarely usefull.
XD
Hi , is there a way to get structure saved from structure blocks into org.bukkit.structure.Structure?
Does it need NMS?
Why not store the gui in an InventoryHolder
Instead of using maps
for me, my minigame is composed of these modules, substantially changing gameplay as time progresses in the game. i use these modules to enable, disable functionality for the minigame.
that's the thing, idk where this happens at all, i was just utilizing one of the unit tests that existed already with junit, and i was met with this error. i might be setting up the configuration wrong
?nms
Testability and reusability also, you’re essentially enforcing isolation that most projects are trying to structure around
so its pretty good for any scaling project
Hey, I have a Question:
Is it normal, that when a Sign is loaded from Startup, and the line has for example "MyText" in it and you set it to another value (any) and then try to set it back to "MyText" it doesn't apply the text and just does nothing?
LInes is set using a State, so you need to call an update to make a change
Yea, you mean with Sign#update?
Hey if anyone knows anything about CommandAPI or Mojang Brigadier system, help will be greatly appreciated
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
The question is in the message I replied to
Choose one
Brigadier or command api
Not both
@fair gate
Ideally brigadier but yea
Why in intellij, when I right click src, and press new, there is no option to create a package?
It's maybe because you haven't specified a Java project version, then it just tells create folder or smth like that?
Yes, it tells me to create a directory, also for example I can't right click and create a new java class, just a file
Yea, then it should ask you somewhere to select a Java-Version or "load script configuration"
#getPalettes is possibly what you are looking for
I have.
I am using CommandAPI. But the issue is not tied directly to commandAPI
Just ask your question
CommandAPI uses Brigadier under the hood
I have already, look at the message I replied to
Yes but its designed to be completely decoupled from brigadier
which means in theory it could use another impl
Ok
Tho idk why u would commit to anything other than brigadier but alr lemme read
Anyways this is the issue
It could actually be commandapi that does unsafe casting or something under the hood
Since the command source stack is different if its a command block entity
I don't think I created the map packet right, can anyone help?
@fair gate id just use brig tbh, idk why you even bother with some third party thing
So why aren't you using the API?
CommandAPI is simpler to use
What is this error to do with?
[ERROR] [LegacyPluginLoadingStrategy] Could not load 'plugins/limbo.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `net.craft2.limbo'
This is my jar
Nah not really
That’s mad copium
Might get you less lines
But debugging is harder
it doesnt work, if you mean player.sendMap() yeah jt doesnt work
I assume net.craft2.limbo is a package not a class
Do capitals matter?
Why not?
Yes
Which capital matters in here?
to show why its not working
The class is called Limbo, public class Limbo is also in the code
Hello everyone, hope your day is going great.
I want to build some kind of dependency for plugins. Like for a better command system through annotations. How can I do it so I can add that package as dependency and use it automatically? Tell me how I would automatically run reflections on the *users package. Thanks.
reflections and automatic package scanning
I'm going to make a test map project in 1.8
if I get it working within 5 minutes you owe me uhh
peace
Do you just do reflections on literally every class in the package? Won't that be slow as hell
1.8 💀
hes on 1.8
Do it during startup
also you can save time by having plugins register their classes for scanning
instead of having to search every class
wdym?
register each class in some kind of list?
That's what I'm trying to avoid lol
I currently have a system that auto inits with reflection
that's pain
oh well guess you will need to scan every class then
adding each class is pain
I just want to just make a class and it automatically works instead of cluttering my main class
I have a system like this
reflections scan every class with annotation and automatically add the command
wdym
I don't like making a new class for each command
or well using match statements
This method seems way better
How can i check whether a World is the end?
minecraft:the_end
wait
let me tell you a better way
They're asking if it's the end
how do i check it
not how to get it
ye
let me check it wait
...
check it environment ig
That might workl
get biome?
thats not reliable
if(event.getWorld().getEnvironment() == World.Environment.THE_END)``` this should work i think
even though i cant find that method in the docs for some reason
yea
theres only these two but no World.getEnvironment
World extends WorldInfo so
hmm , getPalettes is a method in Structure
but when i get a structure saved by structure block , it returns null
a professionally funny joke
hmmm
lets see
man the only reason im on 1.8 is because im doing this for a cosmetics addon
otherwise I would be on 1.20
mm okay so if I send the colors directly nms fucks it up
but if I render the image in the view it works
good enough
chat why is he making cycadelics
lmao it actualy is cycadelics
if i want to caluclate every prime number up to 2^64, and wanting to use sieve's method, id need a big array
but arrays dont go up that high
I mean yeah you'll probably run out of memory by that point lol
GG
ok
so I owe you a joke
here it goes
what do you call somebody with no body and no nose?
chattttt
i can just store a bunch of arrays in a list
thats meta
nobody nose
you actually got it....
Ive asked
probably
20-30 people
and they've all been wrong
200 iq plays
the reason they got wrong was
they didnt spell it right
instead they put
nobody knows
ppl probably hate you for that ngl
🥶🥶🥶
hi, if i want to use my ban screen and not the default one, how to do that??
I ve done this:
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerLogin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if(player.getServer().getBanList(BanList.Type.NAME).getBanEntry(player.getName()) != null) {
player.kickPlayer("kicked because banned");
}
}```
But this isnt changing anything...
How can I get the Netty Channel of a CraftPlayer in Spigot 1.20?
guys
i have one problem, who can help? i have one plugin with commands, how i can check player permissions from other empty plugin?
What event triggers an item frame to break if a block is placed inside it?
physics
declaration: package: org.bukkit.event.block, class: BlockPhysicsEvent
i'm trying to rotate an ItemDisplay but it's refusing to update
let's say, i have this one in fluffiecraft-commands plugin. heal: aliases: heal
how i can disable it from fluffiecraft-groups plugin?
upd: i found the way!
player.sendMessage("u don't have perms");
return true;
}```
i can't even understand your question clearly
real
Alright guys I’ve got a great new idea
Built in api in spigot that allows you to yell at the maintainers from your plugin
Plugin#setNaggable no?
oh
nms has their navigation framework
I swear i saw one on gh but i cant find it
which I mean might be what u want
yeah
Pathetic
How do I deal with this?
Reload the pom
.
Use an earlier event like the PlayerLoginEvent
is the event called "PlayerLoginEvent"?
Perfect ;)
how do I make a player glow, but only for their team?
still showing the default bukkit banscreen
I would use AsyncPlayerPreLoginEvent
There's an async one?
but how to look for banlist then?
does this still work
Player player = event.getPlayer();
and is eventpriority.lowest best or highest?
No, you only have a UUID.
how to get the player with that
You'll have to use a bukkit call to get an offline player object.
Bukkit#getOfflinePlayer()
oh ok
Then you can check if they are banned, etc
OfflinePlayer#getUniqueId()
Player player = Bukkit.getOfflinePlayer(event);
You can make a game profile from the uuid and use that with the ban list
nah man you gotta get the player name or uuid
you can't just pass in the event
?jd-s
AsyncPlayerPreLoginEvent#getUniqueId()
there is no event to beable to pass in. Do you know java? you should probably learn more java before you make spigot plugins
?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.
and you should maybe encourage learning and
not saying more dont wanna get banne
I am I'm encouraging you to learn more java so you don't struggle so much on basic parameters
i know java
Profiles?
it takes 10-20 minutes to brush up on bsaic methods and such
i just never worked with spigot before
So now, do i need to get the ID from the event or from the OfflinePlayer
PlayerProfile
You need the one from the event to pass in to the bukkit call to get the offline player.
Don't those require a name though?
well i didnt have those args in the event, mhh dont know why i didnt understand It -_-
Bukkit.createPlayerProfile(uuid)
yay i love java security
Nope
how do I give a player the glowing effect but the glowing only gets shown for their scoreboard team?
yaya
Oh, I didn't know that existed.
Probs way cheaper than an OfflinePlayer object too.
Should be
Yea, @silent slate use that method instead. You can get what you need out of it.
buit what is this: public void AsyncPlayerPreLoginEvent(String name, InetAddress ipAddress, UUID uniqueId) {
this it says on the DOCs
What version are you making the plugin for?
1.19.0
sigh this is where @since tags would come in handy.
I don’t think that had the new ban api
no it was added in 1.20.1 iirc
Please update to 1.19.4 at least
Didn’t 1.19.0 have exploit issues
Who keeps their server on the major versions?
no iirc the one that added chat reporting is
anyone know if theres a way to get the 'unsafe' object field offset of a record component? ik java did some weird shit with them being special needs but it has to store the data somewhere so it has to be somewhere right
im not the owner, im the developer making the owner happy
Chat reporting was 1.19.1
now
To the (new) wiki
there are plugins to disable chat reporting. No reason not to update to atleast 1.19.4
woooh!
who can go to my java dev team for fluffiecraft project?
now
Nah, 1.19 had some backbone stuff for reporting, but was never front facing. 1.19.1 made it front facing, 1.19.2+ were fixes for exploits.
i still dont know what event countructor to use
the thigiy
this
public void AsyncPlayerPreLoginEvent(String name, InetAddress ipAddress, UUID uniqueId) {
Why do you need to use it
You'll probably have to use another event then.
But that doesn't seem like constructor lol
how can i convert human entity to player?
cause i wanna do custom ban screen
(Player) entity
ah forgot abt that thank you
guys..?
i dont know english well, i dont care if it event or constructor or listener
IIRC before the new ban api you just converted uuid to string and then checked that against the ban system
i need da public void thing
Lmao
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
// code
}
Don't forget @Eventhandler
Parameter is not a subclass of org.bukkit.event.Event Compiling and running this listener may result in a runtime exception
Show us the code
public class AsyncPlayerPreLoginEvent implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
Player player = Bukkit.createPlayerProfile(uuid);
if(player.getServer().getBanList(BanList.Type.NAME).getBanEntry(player.getName()) != null) {
player.kickPlayer("kicked because banned");
}
}
}
Don't name your class like that, it's interfering with bukkit one
istg this took 5 minutes to build if i made some stupid mistake ima cry
Player player = Bukkit.createPlayerProfile(uuid);
createPlayerProfile doesn't return Player why is that your return type. You claim to know java yet can't read syntax errors?
man
Your class name is the same as the event. Java doesn't know that you want the event
because i need a player name for the getBanlist
You said you knew Java earlier ._.
what to name the class then?
public class SomethingElse implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
if(Bukkit.getBanList(BanList.Type.NAME).isBanned(event.getUniqueId().toString())) {
event.disallow("kicked because banned");
}
}
}
Believe that should be it
Anything else
do you know what a return type is?
is the type of thing it returns if i run it:
Player
what does createPlayerProfile return?
Don't use createPlayerProfile in 1.19.0
It won't work
Well it will, but you can't check bans with it
That is kinda impossible
I assume they don't have the () after
my gues is there some lack of syntax knowledge leading ot this
Prolly syntax
I edited the message
Cannot resolve method 'disallow(String)'
my profile?
Yes
Lmao
Are you using the right event?
Ah okay you need more than just a string
disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, "whatever");
meh you can just ignore it unless you're fine tuning something
Unless you have an explicit reason to specify a priority, default will suffice
Integer priorities when
ok works
also my ban text is long sometimes if bedrock user gets banned it cuts of half
is normal?
Well yeah, but idk what bedrock allows
use a shorter message
If it can only handle so many characters geyser probably just chops it off
can't wait to see servers with resource packs send custom ban msges
bro what how is objectFieldOffset throwing an IllegalArgumentException
which isnt even documented
Hey, I have a Question:
Is it normal, that when a Sign is loaded from Startup, and the line has for example "MyText" in it and you set it to another value (any) and then try to set it back to "MyText" it doesn't apply the text and just does nothing?
Only at startup?
when the sign has been loaded and not freshly placed
what?
but it's only for that specific text
a non placed sign has no text
setAccessible true
or somn
Unsafe doenst check access im pretty sure
is there any class I could cast the World into or smth to respawn ender dragon like the player would
i found this ini the jdk source code though
which seems to be where its coming from
no, I mean, on a fresh sign you can set the text to anything you want but when it was loaded from serverstart or reload if you change the text and change it to the same value it was on load, it doesnt do it
No one understands what you mean settign it from server start
if the sign was already there
when are trying to set it?
ohh i didnt exclude sttatic fields
you are too confusing to understand
lmao
setting a sign text works anytime so long as the chunk is loaded
your settings may be overwritten if you do it in an event though
imagine following thing:
- There is a sign in the World with the text "HelloWorld"
- The server starts now
- You change the text to "HelloWorldFun"
- Wait for a few Seconds
- You want to Change it back to "HelloWorld" <- This text was on loading on the Sign and does not update to this new "old" value
with Sign#setLine(i,text)
Sign#update
oh my days how is it still failing
what you describe is the correct way to set text so the error must be in the way you are doing it
no, it works perfectly fine with every text except for that text that was on the sign on startup
without code we can go no further as what you are describing should be impossible
of course i manage to fuck shit up this bad
What on earth are you doing
example code:
public void sign(Location l) {
BlockState state = l.getBlock().getState();
if (state instanceof Sign sign) {
new Thread(() -> {
try {
sign.setLine(0, "foo");
Bukkit.getScheduler().runTask(plugin, () ->{
sign.update();
});
Thread.sleep(1000);
sign.setLine(0, "bar");
Bukkit.getScheduler().runTask(plugin, () ->{
sign.update();
});
Thread.sleep(1000);
sign.setLine(0, "foo");
Bukkit.getScheduler().runTask(plugin, () ->{
sign.update();
});
Thread.sleep(1000);
sign.setLine(0, "bar");
Bukkit.getScheduler().runTask(plugin, () ->{
sign.update();
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
Place a sign at the location, no text
call the method
now the text is "bar" at the end
now Reload/Restart the Server
now call the method again
now it will only display the "foo1" and "foo2"
Schedulers exist
Okay well show us your actual code
changing sign text from a seperate thread is not safe
Do worlds have pdc
yes
this is what my code actually looked like:java public void sign(Location l) { BlockState state = l.getBlock().getState(); if (state instanceof Sign sign) { new Thread(() -> { try { Bukkit.getScheduler().runTask(plugin, () ->{ sign.setLine(0, "foo"); sign.update(); }); Thread.sleep(1000); Bukkit.getScheduler().runTask(plugin, () ->{ sign.setLine(0, "bar"); sign.update(); }); Thread.sleep(1000); Bukkit.getScheduler().runTask(plugin, () ->{ sign.setLine(0, "foo"); sign.update(); }); Thread.sleep(1000); Bukkit.getScheduler().runTask(plugin, () ->{ sign.setLine(0, "bar"); sign.update(); }); } catch (InterruptedException e) { e.printStackTrace(); } }).start(); }
ItemStacks, Entities, World and Chunk
?scheduling
Use runTaskLater method
instead of creating thread
Its addtional cost
it's just for showing purposes
normally I use Schedulers
I know how they work, dont worry
well your code looks silly, but alr thats good
We need to see your actual code not what you think we need to see. What you descible should not happen so the fault has to be IN your code.
Bro update block itself.
@Override
public void update() {
Bukkit.getScheduler().runTaskLater(DuelWarper.getInstance(), () -> {
AdventureUtil.broadcast(Component.text("Updating sign (" + lines.size() + ")"));
for (int i = 0; i < lines.size(); i++) {
List<ValuePair> line = lines.get(i);
Component component = Component.empty();
for (ValuePair valuePair : line) {
component = component.append(valuePair.merge(this));
}
sign.setLine(i, AdventureUtil.serialize(component));
AdventureUtil.broadcast(Component.text("Set line " + i + " to ").append(component));
}
sign.update(true, false);
}, 1);
}```
is that Paper? 🤨
what does your debug output show?
Nope
The Value I try to set
The Value is the Value that is Correct, as I said, if you execute the earlier code, with only that text, this will not work correctly either
hey, i dont like resorting to discord but i cant seem to find any info about this. My plugin uses a resourcebundle with about 6 language files in it. is it possible to physically generate these property files so players have access to them and maybe make changes?
ok so I am really consfused, how can I get instance of DragonBattle if I don't even know how to get an existing EnderDragon instance except for spawning it. Do I check for entity list in the end dimension?
I see no reason for your issue. What you describe shoudl be impossible
Just try it, you`ll see :D
a reload/restart would make no difference
maybe it is only on 1.19.4
yea, thats why I wrote reload/restart
were double sided signs added in 1.19?
1.20 I think
I can;t test it myself at teh moment
Discord can support videos
thats why onedrive
who can write plugin for mee?
You can just shove the mp4 in discord
if it is not too big yes
Server is boosted so I think you can do 100mb without nitro
ohh, okay
i need plugin with db, in db i need save user names and group id.
in another plugin part i need check user group id and allow or deny use command from my another plugin
We could share spigot jars here if not the law
This is what permission plugins are for
i need my own perms plugin, i need create prefix system
permission plugins also have prefix
LuckPerms has support for that.
how does spigot do offline player ip bans if said offline player has never joined before
I can confirm, I personally use it
i want use my own plugin
I think they fetch the user uuid from mojang resources? I might be incorrect
no but the ip
Ip?
Maybe
then any player that joins from that ip
Or uuid
cause that's the only way I can think of it
yes but different accounts have different uuids so that doesn't really help
They just save uuid as if it's a normal ban or they may wait for the user to join
But who knows
Any experts here?
Is there something you need what LuckPerms does not have?
bad code!
I think so.. For example, the ability to interact with my plugins. LuckPerms doesn't work with my plugins
But thats a thing you have to ensure? I mean, how should it Support the new one without making changes?
You have full control over all permissions and prefix in all permission plugins
Hello, do you know how from the interaction with an item I can suggest an order to the user?
I thought about doing the same as with the TexteComponent but that is not the solution
createButton(Material.SPYGLASS, "§r§6Recherche §8(Pas disponible)", SEARCH_BUTTON_SLOT, viewer -> {
viewer.closeInventory();
new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/viewreport ");
});
I tried to set it up, did everything according to the docs, but unfortunately nothing worked out
You gotta be doing something really bad if LuckPerms can't even work with your stuff.
I believe IP is just null if it can't find one. Depends on how MC creates that JSON object.
Click events do not work on items
Okay because I'm just looking to offer him an order directly in the chat
You can't
You can make them run commands, but you can't suggest commands from an inventory click
so does it just straight up not work? 😭
ok thanks
It looks like it just defaults to a regular name ban.
Wat goin on with bans
Figuring out what happens when you ip ban an offline player who hasn't ever joined.
How ya doing that
it's bad idea? public static void Init() throws ClassNotFoundException, SQLException { conn = null; Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:plugins/FluffieCraft/FCG/players.s3db"); statmt = conn.prepareStatement("CREATE TABLE IF NOT EXISTS players (name TEXT, groupID INT, prefix TEXT)"); statmt.executeUpdate(); }
Doesn't the IP ban system take an INetAddress
It does internally
Spigot lets the string input be either a player name or an IP address.
Class.forName is only used for very old versions of spigot because it uses incredibly outdated dependencies
also i have: ``` public static void addUser(String name, int groupID) throws SQLException {
statmt = conn.prepareStatement("INSERT INTO users (name, groupID) SELECT ?, ? WHERE NOT EXISTS (SELECT 1 FROM users WHERE name = ?)");
statmt.setString(1, name);
statmt.setInt(2, groupID);
statmt.setString(3, name);
statmt.executeUpdate();
}
public static int getID(String name) throws SQLException {
int fvalue = 0;
String query = "SELECT groupID FROM users WHERE name = ?";
try (PreparedStatement statement = conn.prepareStatement(query)) {
statement.setString(1, name);
ResultSet resultSet = statement.executeQuery();
if (resultSet.next()) {
fvalue = resultSet.getInt("groupID");
}
}
catch (SQLException e) {
throw new RuntimeException(e);
}
return fvalue;
}
public static void setNewGroupID(String name, int newID) throws SQLException
{
statmt = conn.prepareStatement("UPDATE users SET groupID = ? WHERE name = ?");
statmt.setInt(1, newID);
statmt.setString(2, name);
statmt.executeUpdate();
}```
Still doesn't hurt to use afaik
Well, the newer #getBanTarget() is just a generic. Still allows for either or.
yes but no
should be using ProfileBanList or IpBanList
to make the compiler happy
Yeah there are subclasses
and the server :trollface:
The generics for the ban system are kinda weird
Have you heared from HikariCP?
It is actually a very good.
Or are you using it?
my test command crashes, ``` @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("setgroup") && sender instanceof Player) {
Player player = (Player) sender;
String name = args[0];
int groupID = Integer.parseInt(args[1]);
try {
if (Database.getID(name) == 0) {
player.sendMessage("Player");
}
if (Database.getID(name) == 1) {
player.sendMessage("Admin");
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
return true;
}```
guys
if i make this in plugin.yml, will luckperms work? randomteleport: aliases: [rtp, randomtp, randomteleport] permission: fluffiecraftcommands.randomteleport
Yes
than i don't need groups plugin
There are quite a few things wrong with this code.
Do you really need to use a Database? Files are much simpler to handle.
I would recommend using Files to save your data unless you can really argue for a DB.
i need 200-300 stable online on server. i think if i use file, it's will be crashed
No not really
I mean a database is more optimal
But a flatfile storage implementation works fine
Assuming you implement is correctly ofc lmao
The amount of online players is no argument. Loading/Saving data needs to be done async either way.
You should use Files if this is your only argument.
I mean there are some problems with flat files
python tinydb flashbacks, sorry
You dont get any good migration and other things u might wna have like analysis stuff
in python sqlite3 better than tinydb and files
When extending Enchantment class for a CustomEnchantment, is there any method I could use to somehow trigger an effect on hit?
For example, I'd like to make an enchantment that can inflict poison, or slow effect to target on hit.
Is it possible to embed the on hit effect inside CustomEnchantment, or do I need to make a separate Listener instead? Thanks.
Btw, if you get even 50 concurrent players on average then you are in the top 0.01% of minecraft servers.
This is usually only achieved if you have high social presence before launching the server. Aim smaller for this project!
ok..
I would just use a listener for this
wise insight
what about big servers with 400-700 online at day?
You would just use a listener because theres no other way to implement? Or is that the best approach to implement?
If it was achievable in another way, then it would include nms. Which makes the listener a more stable and reliable approach.
I didnt dig too deep into this.
Fair enough. Thank you!
Essentials uses files as a default, also it would be dumb to store everything in a single file and also read the entire file every time you look for something
why doesn't that respawn the ender dragon if there is no ender dragon?
World world = Bukkit.getWorld("world_the_end");
DragonBattle dragon = world.getEnderDragonBattle();
dragon.initiateRespawn();
The crystals need to be placed
If you are in a modern spigot version you can use initiateRespawn(null);
ok
how can we run a sqlite database with the server
What packet is now used instead of PacketPlayOutPlayerInfo?
pretty vague question
can you describe problem ur having
I use the function Bukkit.getScheduler().runTaskTimerAsynchronously() and I want it to somehow cancel itself from inside the runnable itself, I saw the answer of adding it to a variable and cancelling that variable with it's id but you can't access a variable from inside itself.
i believe you can use consumer overload
runTaskTimerAsynchronously(task -> task.cancel())
got it, I'll try that
Works like a charm, thank you ^
you can also just create a custom implementation for whatever you're scheduling
I want to make a kit system where you can customize kits using an inventory and name kits using the anvil ui, how do I? I have no idea of how something like that works
how do I like open a fake chest inventory and how do I know when something is happening in it
First google result, ClientboundPlayerInfoUpdatePacket
could've taken you 2 seconds lol
how would I idenfity when it's in my inventory?
Inventory#getHolder()
hmm
how do i get started with learning non regular shape regions
with X amount of points
how do you calculate that?
record your Player#openInventory in a Set<UUID> and remove at InventoryCloseEvent
the uuid's of players
You didn't know how to make a task that cancels itself and asked here, which literally pops up as the 2nd result, yet I didn't blame you for asking. So please, shut up
genuinely how
old code running
I had this exact same in typescript once, but this message doesn't help soo
Ok so I’m listening for packets like player move and stuff wondering if canceling that and canceling block placing does dtuff on the client and if I need to send back another packet
With protocollib
Have you tested it
how can i use JsonWriter to write serialuzed Map<String, Object>?
this 1 map or?
Do I need to put my own text on each map?
end always update this?
Yes
I feel like this will take a lot of resources
item in in frame this block or
ssomething other?
map
for exemple
What
item in frame this
block
or item
i can save item, paste in frame end update him?
Sure?
how can i update the map in the frame ? Or rather, get it
i need get block
or save item end use it
You can save the frames uuid and get it from that
You can probably also just hold the item refrence
That's why I'm asking if the Item in the frame is an "Item" or a block.
Item
oh nice
Item frames hold items
how i can get block distance of "private Location to, from;"
to.distance(from)? :P
If you don't want diagonal distances then Math.abs(to.getX() - from.getX()) + Math.abs(to.getY() + from.getY()) + Math.abs(to.getZ() + from.getZ())
Wow no api method for that?
I mean it's a rather trivial method
So is distance :p
You're welcome to PR blockDistance() :D
👀
Wut
I found a very good code to study how do you think if I study it completely and understand it my programming knowledge skills will improve?
ok
NMS and importing some weird bukkit libraries that I don't know.
practice
I've been practicing for two years, but I don't feel like a professional. There's no criteria for judging
you mean contradictory standardts?
how sonarList
do more projects that are just beyond what your comfortable with, you can also learn a lot by just looking at some of the help given here
a lot of what i know is just from seeing other people giving help
i want try undestand this code
so many folders
looks like a normal project with nms
Just keep sending map packets with different contents
I'm also wondering if it's optimized
how i was read this plugin do "client maps"
but you not can just do with client
smt
What
I just look at such projects and I wonder how people say that bukkit api is so simple.
bukkit is simple compaired to some projects
Tbf that doesn’t use much Bukkit
I'm trying using MySQL in my plugin. Anyway, i tried the link jdbc:mysql://localhost/neostats, but i just get a long error and can't connect to the database
yes i used the right password and username
I know the simple things that allow you to manipulate the game, but these NMS
what version of spigot?
You haven't specified the port after localhost, try doing that. Needless to say, you will also need to know which port MySQL is hosted on. For example, if it was hosted on port 3306, then change the part of the link to "localhost:3306"