#help-development
1 messages · Page 2176 of 1
if you had like 2000 players that ever joined your server
the method would loop over all of those (and load their data from the disk)
Use a database to store the data you want to?
hmm isn't all it does to list the .dat files in the world folder, and then create an OfflinePlayer by using the filename as UUID?
so yeah it does IO by checking the files inside the folder but it doesn't actually read any of those files
Like store all desired data on every new player joined?
I just want their uuid
for scalability you could always read all offline players name/UUID at startup and store them in a BiMap
I mean, if it does not read their profile you won't have their name
in which case, the entire concept is useless
but it does look like you are right, it only uses the file name, so this is completely useless
I mean, if you already store player data in an SQL or something
just add their last known username to the table
and use that or something
it looks like it indees only uses the file name as UUID and then creates a new GameProfile with "null" as name
u can also use a map<String, OfflinePlayer>
so yea the method is useless for this usecase
yeah :/
I'd just store a Map of UUID <> last known name somewhere myself
I mean, I still don't see how a potential mojang api lookup is an issue
the server already has that to some degree
public void Blockremove(PlayerMoveEvent e){
Player p = e.getPlayer();
p.chat("It!:)");
Block replace = p.getWorld().getBlockAt(p.getLocation().subtract(0, 2, 0));
replace.setType(Material.SAND);
}
why is not it working?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
i'm just gonna store the last known name of each uuid
this may be getting the block under the block under the player
do you see It! show in the chat?
i chane 2 in 1 and it also does not work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
do you see It!:) in the chat?
?notworking
@EventHandler
public void Blockremove(PlayerMoveEvent e){
Player p = e.getPlayer();
p.chat("It!:)");
Block replace = p.getWorld().getBlockAt(p.getLocation().subtract(0, 1, 0));
replace.setType(Material.SAND);
}
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
LOL
why??
can you read?
Is english your first language?
you are supposed to READ this text
@quaint mantle
- do you see any error messages?
- Do you see It!:) in chat ingame?
no
no
ok well I'll try to help you, you can translate my messages to your native language
Answer these questions
no
said
"no"
Did you register the event?
Both
Well then your event is probably not registered
Oh may not
Mhm
I forgot this😅
Also when you register it, make sure to subtract 1 instead of 2
Ye
another thing u can check ebfore you set the block type is if the player moved a full block
Hoiw?
check whether getFrom() and getTo() are the same block, or not
PlayerMoveEvent has two methods: getFrom and getTo.
Both return a Location. Location has a method getBlock().
If both locations' getBLock() method return the same block, the player did not move a full block
You can send a example code? I not really understand
you should really learn basic java if you don't know how to check if two objects are equal
I know i think
But i am not understand what are u mean in this message
@EventHandler
public void onMove(PlayerMoveEvent event) {
Location from = event.getFrom();
Location to = event.getTo();
if(isSameBlock(from,to)) return;
// Player has moved a full block
}
private static boolean isSameBlock(Location from, Location to) {
return from.getBlock().equals(to.getBlock());
}
no. If it's the same block, you don't wanna do anything, so you return if isSameBlock is true
Maybe someone knows how to add your own scale using a plugin and a resource pack? For example, a thirst scale
latmi
1 sec
negative font and title
With this, I can create something like a thirst bar, like in ItemsAdder?
OHHHHHHHH
"the process cannot access the file because it is being used by another process"
You are the best
help
Why?
paper is faster
its like something else is working on the same thing
idk if its the paper process cause im trying to duplicate a world
it sometimes breaks stuff
that rly doesnt fix anything, all plugins must work with spigot
entitymoveevent probably doesnt exists cuz of the lag it might cause
why wont this work?
Sighhh
Uhm
Because you don't understand java I assume
shhh
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.
noice
is there a reliable way of getting a PersistentDataContainer from a world object? Casting a World to a PersistentDataHolder seems like a bad idea
Idk but you can send water droplet text and use negative space to place the title above the health bar
A World is a PersistentDataHolder. You shouldn't even need to cast it
I mean.. Alot of people use it for quick debugging
yeah although weirdly my IDE doesn't seem to get that - should it be fine if I just cast it then?
ikr :|
World#getPersistentDataComtainer
yeah it just acts as if that method doesn't exist
If you cast it you'll get an error xD but you can try
w
what* version are you using?
that's weird that it doesn't show and wants you to cast maybe you're using the wrong spigot version somehow?
World got the persistent data container in 1.18.1
I see, thanks
What is the new name for entity path finding
in NMS Remapped 1.18.1?
don’t see you here much!
just define a global logger and just do logger.log("something")
Yeah but for debugging you're removing it anyways
no, for debugging sout is the way 😎
and, just attaching a debugger
Have not much to say / write
bump
well thanks for all your contributions!
Remove it from the list?
Like when u add something, remove it from the list so u can't get that item again
?paste your code please
For keeping custom data on blocks exists only NBT right? Its for a 1.12 plugin that why I dont use PDC
Thanks
is it possible to set the title of the bossbar and the name of an entity to BaseComponents without using nms?
Also you're generating numbers from 0-9 but removing items from the list
emm what?
Use that to paste ^
Really?
You just said you get an error
Are all itemstacks in the list different?
Mi ion he is another troll as usual
Most of them they just troll
Then u don't need to check if the inventory contains that item
any clue any1?
Patenient, if need to dont get your message lost open a thread Om this channel
Can you actually post your code
I feel like the edits you made changed something crucial
well this is my 3rd time sending msg here
soo im kinda getting impatient
Yeah that why I guess he is trolling, he doesnt paste the code Where you told him and he said he has an error and then said not. So that my clue
looks good to me
( Using remapped nms )
is it possible to set the title of the bossbar and the name of an entity to BaseComponents without using nms?
Import the bukkit one
right thx
Well let's see your console
how to cancel i task we usedas lambda
thx works
I was before creating custom entity
with the nms skely
thx
Np
You mean you use the scheduler?
yes
Think it returns the taskid
U can store the id and cancel task
With Scheduler#cancelTask
Yes
?paste
But here
how can i get task id
it was on runnable iirc
When you schedule a task
You get an int
That's the taskid
If you're using bukkitrunnable you get a bukkittask when you schedule
Doesn't really matter
I use bukkit runnable when i wanna cancel tho
:/
The code u sent
Isn't your code
Ctrl + s for saving
?paste your actual code please
Mi ion thanks for the answer
I really apareciste you
This days you are helping a lot
Its my Spanish corrector
Just oaste your code dude
Don't change it before you paste
Or else i won't help
I'm supposed to believe youre compiling your plugin with a list of integers as a list<ItemStack>
He is trolling mi ion!
Yeah I'm gonna give up helping
what did i miss
Heavy drug usage
we also had tacos
:( why you do dis to me
that's not heavy enough
weed doesnt count... only tacos and actual drugs
gonna get that h pumping
like alcohol
Here it's legal to use Marijuana but illegal to buy it
So u can give someone some money and they can give u some weed
Here is legal but as medicine pupouses
But u can't buy weed from them
Weed legal here in Canada
only 4 plants per household tho 🤡
So there no PDC alternativa for 1.12x?
no
the alternative to pdc in 1.12 is NBT or external databases or json files or whatever
or upgrading
upgrading is probably the proper solution
upgrading please
why would a server use 1.12.2 and not 1.18?
why is my bridge not working? no console errors btw
I think its because you didnt connect them
people who dont like the new combat stick on 1.8, people who either run potato-pc's or mod their clients usually stick to 1.12
it'll never change probably
same
try adding sysouts to see if the car is actually reaching the bridge
Bridge looks fine to me
hey.. I'm spawning multiple entities and like multiple of them spawn
custom entities
last time they kept spawning
there was 71k endermen
Yes. Your Entity extends Enderman.
Every time an Enderman spawns you spawn one of Your entities. It is detected as an Enderman and the loop continues
^
Would player.getItemInUse() return the item that is in the players hand
Not exactly
Gets the item that the player is using (eating food, drawing back a bow, blocking, etc.)
um I use println in spigot all the time and it’s just fine! 🙂

How would I get the current slot that a player has selected in their hotbar
So the command gets the current item in their hand, how would i find out which slot that item is in
deprecated tho
What’s deprecated about it?
It just prints a new line to the console
it shouldnt be used in spigot
Why? It’s good for debugging
use Bukkit#getLogger()
Its not depreciated as its just Java. Paper give you a BIG warning to use the logger
I hate that dumb logger
It throws so many warnings
I have to turn off all warnings and make it SEVERE only
Can you tell me what you're trying to achieve? It looks like an xy problem for me
deprecated in meant in spigot and such
what XD
Spigot doesn;t object to its use
Only Paper
paper screams tho yea
For specific plugins using their logger
That's not what deprecated means though. -.-
MongoDB for example
So the command basically takes the item thats in their hand, uses the args in the command to change the display name of the item. I'm pretty sure I need the slot that the item is in to give the updated item
Throws tons of exceptions, have to mark the severity as severe instead of warning level
lemme ask paper
You just need to modify the item meta
You don't need the slot on the inventory
so this:
currentItem = p.getInventory().getItemInMainHand();
ItemMeta currentItemMeta = currentItem.getItemMeta();
newName = args.toString();
currentItemMeta.setDisplayName(newName);
currentItem.setItemMeta(currentItemMeta);```
I wouldn't worry too much about it. No one is forcing you to use the built in logger. Besides, the only reason to use the logger is for formatting purposes.
That will error if their hand is empty
Will getItemInMainHand return the copy of the item?
it should, i have no idea how to get it otherwise
If so, you need to set the item back on player main hand
paper says:
not using your own logger is a pretty common anti-practice which often creates a huge number of headaches for server admins due to plugin devs failing to use their own loggers, it makes it hard to work out where something is coming from and there is generally very little sane reason to do so
long term intent is that all plugin logger usage should be directed to the correct place to limit the side-effects of this anti-practice which just poses many headaches for server owners and us
i think sysout doesnt include plugin name
yeah i think it gets a copy of it, unless you know a way to get modify it directly
It doesn't, but if your logger is smart enough, it can intercept it and append it to the front.
yea but imagine it doesnt and some plugin screams some stuff
Yeah, I mean it should return a copy, so yeah you need to set the item back
how do i get the parent directory (aka the one the server files are in from my plugin)
annoying i guess
ok so how would i do that?
PlayerInventory#setItemInMainHand
ok thank you :)
It's not like plugins couldn't provide that information either. A stacktrace can be very useful.
Who cares if it's not formatted with the plugin name in the front. Oh wait, it wouldn't to begin with since it's an error. ¯_(ツ)_/¯
help
Also, if a player was to make the name something like &4Name would it make the item the colour of &4 or would i need to make a method that does that?
You need a method to convert that to the actual color symbol.
Spigot has a method for this already. ChatColor#translateAlternateColorCodes()
You need to colorize the text first
ok so I just do ChatColor.translateAlternateColorCodes('&', TEXT_OBJECT);
Hey ! I'm a minecraft mod developer and I want to start creating plugins.
Does anyone know a place/documentation I can use to learn how to create a plugin ?
Pretty much. You could also turn that into a method that passes in a string to be colorized and return the output from that method.
the docs arent really helpful, if you have an average knowledge of java (or kotlin if ur a real chad) you can search youtube tutorials
you will learn more as you go
help still needed
JavaPlugin#getDataFolder()
Getting "The system cannot find the path specified error"
i dont know whats wrong, i think both of the paths are correct
the new keyword is redundant in kotlin
itll be in the server directory
basically you never have to get the server directory
so when u create a file it gets put automatically in the server directory?
how can i control if a player sent a message
Also, to move up a directory, you should use ../whatever instead of ./whatever. The latter one is indicative of execution.
AsyncPlayerChatEvent
pretty much as that is where the server.jar is located
if u wanan get a world folder you jsut do new File("worldname")
alright thanks
one last question, how do i get it to be pasted in the same directory as the server.jar? do i leave the file path empty?
wdym?
i basically want to duplicate the folder, and i want it to be put in the same directory
yep i think u can copy it to an empty file path
and when using CopyRecursively() it requires for me to pass a path parameter via the file constructor and some other stuff
not 100% sure
You can't copy a file that is in use.
its basically a world, do i have to unload it first?
Yes, you would need to unload it first if you wanted to copy the file contents.
and then load it again before its ready for use?
It's because of the file lock.
Alternatively, you could have the level.dat file stored elsewhere and copy it in where needed.
But, that may be problematic, depending.
@thorny dawn this is how you get the current directory in regualr java
i tried "" as the path and it didnt work
I have a thing like this i want to control if player texts "evet" or "hayır"
@EventHandler
public void onMessage(AsyncPlayerChatEvent e){
Player p = e.getPlayer();
Location arenaLoc = new Location(p.getWorld(),78,94,144);
if(Arena.playersWhoSentMessages.contains(p)) {
p.sendMessage("1.if");
if(e.getMessage().equalsIgnoreCase("evet")) {
p.sendMessage("2.if");
p.sendMessage(String.valueOf(Arena.playerWhoInvited));
for(Player c: Arena.playerWhoInvited) {
c.teleport(arenaLoc);
}
}else if(e.getMessage().equalsIgnoreCase("hayır")) {
p.sendMessage("3.if");
for(Player c: Arena.playerWhoInvited) {
c.sendMessage("kabul etmedi");
}
}
}
}
but its not teleporting the player even its entering the 2.if
yes i can enter 2
and can enter for too but not teleporting
you're teleporting from another thread
try using a bukkitrunnable and go to the main thread before teleporting
or the scheduler
but use a sync task to teleport the player
getting ''IllegalArgumentException(): location.world`` error
you're supposed to initialize Location
?
sender.teleport(new Location(<your-params>));
?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.
highly suggest this to you
Most likely done with a resourcepack.
i am using kotlin
ah
the "new" keyword is redundant
show the full error, but my guess is an invalid world
This is understandable, but how to arrange them exactly at the top?
world might be null from Location::getWorld
It looks like a re-textured bossbar so that it doesn't show and the text for it is the custom characters.
and from Bukkit::getWorld
your world is wrong. Not loaded or doesn;t exist
odd
yea, just a custom bossbar, you can pretty much see that by the size of it
Okay, but how do I make the boss bar transparent? If I make a texture like this, it will show up everywhere, right?
when people have the resourcepack accepted, most likely
this is how im getting the worldname that is then used with Bukit#getWorld()
god, kotlin looks that different?
yeah i cant read it properly lol
Not 100% sure how to do that myself, but yea it'd probably be for all of them. I'm pretty sure there is a way to keep the normal ones as well, but resourcepacks are a challenge in their own right.
Got it, thanks, I'll think about what I can do now
btw ceryth you can use ConfigurationSection::getString so you dont have to cast
think i might have found the source of the issue, one of the worlds is unloded when im entering the foreach loop so i need to break out of it if it matches its name
so I wanted to make a bow which instantly shoots arrow I got the base could u check if this is alr?
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
Player player = event.getPlayer();
player.getWorld().spawnEntity(player.getLocation(), EntityType.ARROW);
}
}
}
}```
or do I need to define that the item is a bow?
Wouldn't you want to check if they right click air since they will likely be aiming at someone and not the ground? Also yea, where is the check to see if they are holding a bow?
Is there a method that can tell if a player is out?
out?
Quit
wat
?
dead?
check if the item is the bow u created
PlayerQuitEvent?
public class Terminator implements ToolStatistics, BowFunction, Ability {
@Override
public String getAbilityName() {
return "Nasty Bite";
}
@Override
public String getAbilityDescription() {
return "Costs 11% of max Mana, deals +19% more damage, heal for 2x the Mana cost";
}
@Override
public void onAbilityUse(Player player, SItem sItem) {
}
@Override
public int getAbilityCooldownTicks() {
return 0;
}
@Override
public int getManaCost() {
return 0;
}
@Override
public String getDisplayName() {
return "Mosquito Bow";
}
@Override
public Rarity getRarity() {
return Rarity.LEGENDARY;
}
@Override
public GenericItemType getType() {
return GenericItemType.RANGED_WEAPON;
}
@Override
public SpecificItemType getSpecificType() {
return SpecificItemType.BOW;
}
@Override
public AbilityActivation getAbilityActivation() {
return AbilityActivation.NO_ACTIVATION;
}
@Override
public int getBaseDamage() {
return 251;
}
@Override
public double getBaseStrength() {
return 101;
}
@Override
public double getBaseCritDamage() {
return 0.09;
}
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
Player player = event.getPlayer();
player.getWorld().spawnEntity(player.getLocation(), EntityType.ARROW);
}
}
}
}```
does this do?
ya but i want to chack if the player left then close the server...
Then the PlayerQuitEvent is what you need.
Just check if the online players are 0 and then shutdown.
check if the item name is equal to getDisplayName
yoo
I like ur pfp
ye but what method?
also spawning an arrow isnt enough
if (item.hasItemMeta()) {
if (item.getItemMeta().hasDisplayName()) {
if (item.getItemMeta().getDisplayName().equalsIgnoreCase(this.getDisplayName()))```
wat
Wdym? You listen for the PlayerQuitEvent and then do what you need to in there.
If you want to shutdown the server when all players have left, just check if the online player count is 0 then shutdown.
If you want to shutdown after a certain player has left, check if the player who quit is that specific person, then shutdown.
ok
Guys, I was doing a credit card plug-in and I wanted to make sure that there was a step where when the banker makes the card a message comes to the person who says, "Are you sure you want to redo the card?" in chat and if you click there confirms and actually makes the card. I know I have to use hover text but I have no idea how to do it in the form of confirmation as mentioned before. Ideas please?
Um you don't want to do that
imagine
yep
someone back doors the server
xd
use tebex
does have in game gui thing
I don't think he actually meant real cards.
OH
Do any of you realize how hard that would actually be?
i thought it was ingame credit cards
my brain runs at 1 fps
You would need authorization from a real credit card company,
But why would you want to have an item be a card when it can all be via text?
put them in a set and then when they click, if they are in the set, you redo the card
Waste of an inventory slot
@EventHandler
public void onPlayerleave(PlayerQuitEvent e){
Player p = e.getPlayer();
if(p.isOnline()){
}else{
shutdown();
}
why is this doesnt working?
cool event
Because the player is not online when they quit.
That event is called after they are already gone.
Also, did you register the event?
the player is still online during the playerquit event
they are offline after all listeners are executed
Wait, really? I thought that was called after they already left.
ye i also
check the number of players online, if <=1 shutdown
it's called on the tick that the player leaves
Considering most games do a virtual currency that is probably the best way to do it. Consider the myriad of issues that come with currency being attached to a block/item.
it doesnt deal with clearing the player instance and whatnot until after
Tell that to all of the token plugins that exist. Or the economy plugins that let you withdraw banknotes.
lmao banknotes plugins is just asking for a destroyed economy
Tokens are not blocks that can store an arbitrary amount. Considering those are vulnerable to duping and what not
Plus players can "lose" them. It's also much easier to track a currency stored in a database where history can be added so if someone does exploit it you can reverse things in a way that prevents the most issues
unless u use uuids for the tokens
Yes but consider you have to add a bunch of checks to make sure that there isn't duplicates compared to not needing all that extra code/checks
takes one dupe to get stacks of $2,147,483,647 bank notes
depends how it is implemented really
^
yea
yeah for sure having a virtual currency is the way to go
just yesterday was able to get #1 baltop on a pretty big server just because they had banknotes
just implement the ethereum blockchain into minecraft ezpz
Tbh, I think the only reason those types of plugins exist is so that players can trade money via a trade plugin. Only because the proper integration doesn't exist.
Most developers who have not been around as some here like myself, are not aware of the various ways dupes can be introduced or the intricacies of the server that allow natural dupes.
a credit card item that accesses a virtual currency can work tho
I mean, most of them come from GUIs.
it doesnt matter if there are dupes of the card
Yes but remember it's an item that literally adds nothing besides physical access. It takes up a slot in your inventory to serve no real purpose
how i do it?
there can be a lot of problems when people use plugins that werent designed well to be compatible with others
check if Bukkit.getOnlinePlayers == 1
Change what you are checking for. How do you want this to work? When a specific player leaves or when no one is online?
Not to mention you'll have to write a tonne of checks to use it
it can make your server unique tho
when no one online
Unique =/= good
Then just check if Bukkit#getOnlinePlayers() == 0 when a player leaves.
a unique feature in your server can make it good
ok
But it can also make it bad. Players will probably be a bit annoyed they have to run around with an inventory slot being used for currency that could literally just be a command or even your fist
Well what about the servers that have a "Keystone" or "Menu" item that gives you a GUI with a bunch of information?
they can store it away
Yeah but then what happens when they forget it?
"Dangit why can't this just be a command or something"
true
My point is it adds needless complexity to something you don't want to add complexity to
There is a reason why credit cards added tap and why it's so used. People don't like inserting their card and typing.
Same with apple/google pay. KISS method comes into play here
there is a reason why physical cards are becoming a thing of the past as well
lol
thing is, the machines don't care about the physical card nor the businesses. All that is needed is just the numbers
and if that can be obtained by simple means for both
then that is the better choice
in games, virtual currencies are favored because there is less ways for someone to just arbitrarily obtain that currency
There are also legal reasons games don;t sell things directly in game. They always sell in game currency which is then used to buy in game items
If you sell a chance (loot Box) to get an item for real money, it is gambling in many countries. Using in game currency evades teh gambling definition
to an extent
really depends. In the US, virtual currency depending how you are able to get it or how you are able to use it can still be considered gambling
hence why there is 2 currencies in games
Usually such games that have dual currencies are ones where you can buy currency directly
Here in the UK we had a government enquiry into it. The only reason its not gambling over here is you can;t cash out.
hello, does anyone know how to make my function call every day at midnight?
just check the time, schedule for however long till midnight is
Hello i search to teleport a player on a another server with a special location !
in the function, have it reschedule
Use an executor, not the Bukkit scheduler
but also remember yoru server time may not be the same as your local time
Does somebody know how can I make the armor stand wear the armor which is spaned at a location
fast
@eternal oxide can you
an ArmorStand has methods to set armor pieces https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/ArmorStand.html
I'm trying to continuously teleport an Item entity towards a Player; I have both of their Locations. Is there any way to accomplish this in a relatively simple manner?
@eternal oxide do you know how can I make the leather armor change its colors when I take it off
but, how would I be doing that
?scheduling
@eternal oxide ?
I want it fast
be patient
but I won't know how long the plugin would be running
it ould be turned off anytime
and I need to be reset not every 24 hours but every midnight
i mean you cant just run something from a plugin if that plugin is turned off
Why it is doesnt work?
?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 is online is boolean
sorry but this is just a**hole thing to do
?
why the Bukkit.shutdown doesnt work?
small b on start
you need uppercase
if someone clearly does not know what theyre doing showing them resources to help them learn isnt an azzhole thing to do
what about rather explaining the thing that is from spigot api?
Some one fast tell me
I need to know if its midnight and not checking it every 24 hours
you need a event to check if he took off armor and then change its meta
If you give a man a fish he is hungry again in an hour. If you teach him to catch a fish you do him a good turn.
example?
as if there was an armor event
tf are you doing?
but you need to show him how to eat a fish, not just tell him to go learn it
90% of the things you want to know is described on the forum
give me that form
if you dont know that you cant compare a boolean to an int (at least in java) then you shouldnt be doing spigot plugins just yet
https://www.spigotmc.org/resources/simplixstorage-awesome-library-to-store-data-in-a-better-way.67286/
I'm trying to install this library. I put the dependency in the pom file and it says Dependency 'com.github.simplix-softworks:SimplixStorage:3.2.3' not found
what should I do?
onArmorDown(even) {
if(event.armortookoff) {
ArmorMeta meta = event.armor.meta;
meta.armorcolor = Color.Blue;
event.armor.meta = meta;
}
}
pseudo code
that's true, but when I was learning it, people pointed me to this and it didn't help
whats that, can you make it simple
its pretty much already in its simplest form
this is pseudo code, it's as easy as it can be
Hello i search to teleport a player on a another server with a special location !
does anyone know?
r u sure u wrote the right version?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I copied it from here
they have their own discord on that page, you should check there first 😉
in the link
oh
put 3.2.4 its the latest version
also u have to add repository if u didnt add that
I did add it
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>```
``` <dependency>
<groupId>com.github.simplix-softworks</groupId>
<artifactId>SimplixStorage</artifactId>
<version>3.2.4</version>
<scope>compile</scope> <!-- Must be compile since we want to shade it to your jarfile!-->
</dependency>```
sometimes it gives that error but u can still access to it
so does anyone know how to check if it's midnight irl? I don't want to check every 24 hours but every midnight. I'm making statistics and I need to make daily stats to be reset at midnight
are you sur ? with plugin messaging it's impossible to teleport to another server in a special location
im not sure if you could teleport them to a specific location
bruh is works and all I did was close the project and open it
it might need a bungeecord plugin
lol
thanks
yes, if it makes something to go to another server then it needs to be bungeecord
i dont mean adding it manually
with the messaging channel, you can teleport them to the other server
on the other server you can catch that (for example by sending something unique together with the buffer), and then teleport them if the join came from the other server
did that previously with instead of teleporting players giving them a unique display name
but its basically the same
okay
i use the message listener 1 for teleport and another for send a packet for teleport on a special location
got this from stackoverflow but seems to be pretty much what you need
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, 1);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
long howMany = (c.getTimeInMillis()-System.currentTimeMillis());
gimme a sec
but to receive a packet, there must be a player connected on the other server, right?
so, doesn't this se the Calendar to midnight? I need to check if its midnight
or check the gametime
well yeah, you would get the time in milliseconds until midnight, then schedule a task in (amount of time / 50) (50 being 1000 / 20)
whats the event for taking off the armor
bascially when you teleport the player, you write utf data to the byte buffer, should look smt like this
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("connect");
out.writeUTF("servername");
but you can then also send something else together with these data, for example this:
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("connect");
out.writeUTF("servername");
out.writeUTF("came_from_previous_server"); // just an example
```
then on the other server, you have a listener that catches this "packet" (thats how i call it, because in some way it's the same thing), and if the "packet" (in this case the plugin message) contains this last data `came_from_previous_server`, you teleport them to that location.
dont have the plugin messaging 100% in my head, so may not be 100% accurate
dont believe there is any sadly
oh
people have made libraries for it
Okayy i will try thank you ! 🙂
yes. but the "connect" message doesn't require that afaik
okay
Can somebody tell me How can I change the colors of the armor thats in player's inventory
any ideas on how to implement a chorus fruit effect with an extended distance
look at the internal code
and how can I locate in the players inventory
private void checkTime() {
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, 1);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
long untilMidnight = (c.getTimeInMillis()-System.currentTimeMillis());
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(WaterRun.get(), () -> {
resetStats(); // custom function
}, 0, untilMidnight/50);
}
just make an ItemStack for the leathor armor, add ur stuff to it, and then add it to the player inventory
seems about right
not sure if the midnight will be localized though
well, time to test it in production
do you how can I make that it keep son changing its colors even if I give it to somebody else
where can i find that
decompile
bukkit scheduler
?scheduling
example?
another event when someone pickup a item, check if its that armor and change its color
This will give u more than enough knowledge to use Bukkit Scheduler
ohhh YEAH THATS WHAT I WANTED
and whats that event called
PlayerPickUpItem or smth
yea
ok
declaration: package: org.bukkit.event.player, class: PlayerPickupItemEvent
deprecated
oh yea
my bad
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityPickupItemEvent.html
this is what u should use
declaration: package: org.bukkit.event.entity, class: EntityPickupItemEvent
do add a player check and item check
ok
yeah, sorry, that's right
what is the default world border damage and damage buffer?
you wanna know the numbers or get it in code?
thanks
Here's a commented version, done to my best efforts https://sourceb.in/UY4S01wSd2
how do I check its name
what's name?
displayname
of player?
use event.item.name
Here are some extra variables that might come useful
I get this error when I try to register the events in my class
event.getItem().getName()
ok
that's... not how it works
The name is stored on the meta
put in the right parameters
then get the meta
wdym
everytime i hover over the server icon, i think he's crying
if you're here to help, provide accurate help. leading someone to the wrong direction, or places they've tried is not really useful and just wastes time
I dont think you should use the name as it can be faked
localizedName instead?
no ik what do to
nbt tags
LeatherArmorMeta meta = (LeatherArmorMeta) event.getItem().getItemStack().getItemMeta();```
and then apply the meta back to item
after you change it
the constructor of your class DiscEvents takes in a logger as parameter (for whatever reason), so either remove that from the constructor, or pass in the logger's instance when registering it
@limber owl do you know how can I get its type
and you should probably check if its armor before getting its meta s it can throw error
#getType() returns Material
event.getItem().getType()
is this fine:
if (e.getItem().getType().equals(Material.LEATHER_HELMET)) {
you should probably look more of these things on internet
yes
ok
if (e.getItem().getType() == Material.LEATHER_HELMET) {
got ninjad
also reuse variables
doesn't the material have it's own equals method?
it's an enum
I'd still suggest using .equals here
y
yea, its giving me an error
just because spigot will move away from the enum approach
whenever its an enum check with == lol
materials won't be the only thing breaking
No obviously not
true, my bad
tbh NMS already does a class-based approach, with hardcoded food info, what creative menu tab it is on and all
how do I set a skeleton's health with attribute?
and it does maintain instance equality so I don't see why bukkit wouldn't
registerAttribute(Attribute)
getAttribute(Attribute)
addModifier, setBaseValue
whatever methods you may need
You never know what spigot codes up XD
Cannot resolve method 'registerAttribute' in 'Skeleton'
i meant the max health
then
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20.0D);``` for 20 hp (10 hearts)
iirc
Can sb explain to me why I get this error???
The method has two arguments
you got 2 players as parameters and you're only passing 1
0.7
ok
Ty
Ty
it's actually 0.25
public static void generateLocation(Location location) {
int xOffset;
int yOffset;
int zOffset;
Random random = new Random();
int x = (int)(Math.random()*(40-16+1)+16);
int y = (int)(Math.random()*(10-0+1)+10);
int z = (int)(Math.random()*(40-16+1)+16);
if (random.nextBoolean()) {
xOffset = -x;
} else {
xOffset = x;
}
if (random.nextBoolean()) {
yOffset =- y;
} else {
yOffset = y;
}
if (random.nextBoolean()) {
zOffset = -z;
} else {
zOffset = z;
}
}
ive got this but is there a more efficient way of doing this
maybe switch?
you can avoid half the randoms if you subtract 0.5 from the nextDouble and multiply by 2
make it repeat if its pickes the same by reapeting the fucntion
let me show you pseudo code
What is the base follow range of skeletons and creepers?
in that case the wiki was false
nms always lie
i never see a or b in minecraft
the wiki says both are true
it says the base value is 0.7, while the generic.movementSpeed is 0.25
i'm confused
cant send screenshots sadly lol
List<ItemStack> items = new ArrayList<>();
ItemStack makeItem() {
ItemStack item = new ItemStack(quests.get(random.nextInt(quests.size())));
if(items.contains(item)) {
return makeItem();
} else {
items.add(item);
return item;
}
}```
look at the wiki i linked
this @wind blaze
tells you all the attributes, and it's base, min and max values for every entity
I have a question, if the same plugin is used on multiple minecraft servers, but is connected to the same mongodb cluster, will the data be common for all servers?
yes
uoh
ok thanks
show me the code
lol
pase it in some pastebin and send the link
yea, then you should help and not telling me that you helped, he seems to understand what i told him but doesn't know how to implement it, its not his fault
yes
everything that is stored on that database will be same for every server, and all of the things that plugins save will be saved in the database
List<ItemStack> quests = Arrays.asList(venenum, obscondis, obscurus, ligare, archaicweal, acies, lentus, levitas, forfex, ictus, hospitium);
Random random = new Random();
ItemStack randomItem = quests.get(random.nextInt(quests.size()));
for(int i = 0;i<9;i++) {
if (!inv.contains(randomItem)) {
inv.addItem(new ItemStack(quests.get(random.nextInt(quests.size()))));
}
}
I didnt say you stole it
i understand it, thanks
i said the code you pasted was not your actual code
because you had a list of integers as your list of itemstack
this will not do what you want
i just made it easier to read, its the same
use this @wind blaze
void something() {
List<ItemStack> quests = Arrays.asList(venenum, obscondis, obscurus, ligare, archaicweal, acies, lentus, levitas, forfex, ictus, hospitium);
for(int i = 0;i<9;i++) {
makeItem();
}
}
List<ItemStack> quests = Arrays.asList(venenum, obscondis, obscurus, ligare, archaicweal, acies, lentus, levitas, forfex, ictus, hospitium);
List<ItemStack> items = new ArrayList<>();
ItemStack makeItem() {
Random random = new Random();
ItemStack item = new ItemStack(quests.get(random.nextInt(quests.size())));
if(items.contains(item)) {
return makeItem();
} else {
items.add(item);
return item;
}
}
spoon feeding 🥄
this should work
@limber owl this is not working:
e.getItem().getName().equalsIgnoreCase()
can you please show the code?
ok
this is my function:
public void onPlayerPickup(EntityPickupItemEvent e) {
Player p = (Player) e.getEntity();
if (e.getItem().getName().equalsIgnoreCase(ChatColor.GREEN + "Re" + ChatColor.WHITE + "ge" + ChatColor.GREEN + "nb" + ChatColor.WHITE + "og" + ChatColor.GREEN + "en-" + ChatColor.WHITE + "He" + ChatColor.GREEN + "lm")) {
p.sendMessage("HHHH");
LeatherArmorMeta meta = (LeatherArmorMeta) e.getItem().getItemStack().getItemMeta();
meta.setColor(Color.GREEN);
}
}
}
and its also not changing the color
how can I hide commands that I ran from TextComponent ClickEvent RUN_COMMAND?
can you fix it and send me
spoon feed bad
List<ItemStack> quests = Arrays.asList(venenum, obscondis, obscurus, ligare, archaicweal, acies, lentus, levitas, forfex, ictus, hospitium);
Random random = new Random();
int amountOfQuests = quests.size();
for (int i = 0; i < amountOfQuests; i++) {
ItemStack randomItem = quests.remove(random.nextInt(quests.size()));
inv.addItem(randomItem);
}
this is what u want
?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.
Please can you
only for you babe
do as we say and dont ask us to write code for you
which is what i told you to do
fix yourself 😁
you were just getting it
no you can just add changes in it
ntdi
you apply the meta by doing set meta
hello
oh wait xd
can you help me here?
you can do that yourself, i can only help you by saying what to add
oh
like just to run the command and not suggest it?
np, hide from showing in console
[20:06:06 INFO]: Drago903 issued server command: /creditcard confirm 7f18ElcAaD
remove all the chatcolor in equals and apply the meta by doing item.setMeta(meta);
that is impossible
you need to remove the itemstack you get from the list
so u cant get it again
so no dupes
console has all i believe
yes, but if you spam-click on it, the console becomes a poem
what can I do for that?
add a cooldown or disable the command to be sent if you’ve already sent it?
what is the base attack_knockback attribute of a slime?
im confused on the question
7451745 IQ
what's the error?
anyone?
yes paste the stacktrace
brUH
there is a plug-in to do what you want apparently ¯_(ツ)_/¯
?paste
i didn’t know mb
it;s not working?
this should work without any issue, just implement the void something int your function
@limber owl why is it not changing color:
assert meta != null;
meta.setColor(Color.GREEN);```
again, did you apply the meta into the leather armor?
yes the armor has meta
which is picked?
but did you apply it into the item after changing it?
List<ItemStack> quests = List.of(venenum, obscondis, obscurus, ligare, archaicweal, acies, lentus, levitas, forfex, ictus, hospitium);
after changing it to what
color
replace the first line with this @wind blaze
arrays.aslist is probably unmodifaiable
should I do that
it’s meant for static use
at the end
yes, i told you that three times already
that’s what you should do but the method is probably named diff
at the last of the code that I sent you
yes
mhm
ok
it applies the meta back to the item and changes the color
item meta is super cringe imo
just make custom itembuilder that does it for you so you never have to touch it again
item meta is super important
still cringe
still important
i love item meta wdym
its not working
error?
show us the code
ok
it's not a error, if its not working then there is no error
its giving me an error on:
e.getItem().setMeta(meta);
setmeta
@quaint mantle i suggest googling some things before going here and then giving as much information as possible
the whole code please
it changes size depending on the amt of stuff in ur list
public void onPlayerPickup(EntityPickupItemEvent e) {
Player p = (Player) e.getEntity();
p.sendMessage("HHHH");
LeatherArmorMeta meta = (LeatherArmorMeta) e.getItem().getItemStack().getItemMeta();
assert meta != null;
meta.setColor(Color.GREEN);
e.getItem().setMeta(meta);
}```
It's setItemMeta not setMeta
oh
yes
also
Hi , why is flute used for Yaw and Pitch Player?
Is for bugs that have existed
Or to use less RAM
Use List.of(stuff)
still not working
and please, try googling stuff before going for help here
instead of new Arraylist(Arrays.asList())
oh, I understand now, what IDE do you use?
Intellig
then it should give you a suggestion after .
I figured out my mistake also now let me try this
and its e.getItem().getItemStack().setItemMeta(meta);
use this ```java
e.getItem().getItemStack().setItemMeta(meta);
ye yes wait
@EventHandler
public void onPlayerPickup(EntityPickupItemEvent e) {
Player p = (Player) e.getEntity();
p.sendMessage("HHHH");
LeatherArmorMeta meta = (LeatherArmorMeta) e.getItem().getItemStack().getItemMeta();
assert meta != null;
meta.setColor(Color.GREEN);
e.getItem().getItemStack().setItemMeta(meta);
}
it should look like this, and next time try googling stuff and when youre at your end reach out here
ok
ah it worked
finally
unchecked casts i love it
ok
public static Location generateLocation(Location location) {
int xOffset;
int yOffset;
int zOffset;
Random random = new Random();
int x = (int) (Math.random() * (40 - 16 + 1) + 16);
int y = (int) (Math.random() * (10 - 0 + 1) + 10);
int z = (int) (Math.random() * (40 - 16 + 1) + 16);
if (random.nextBoolean()) {
xOffset = -x;
} else {
xOffset = x;
}
if (random.nextBoolean()) {
yOffset = -y;
} else {
yOffset = y;
}
if (random.nextBoolean()) {
zOffset = -z;
} else {
zOffset = z;
}
location.setX(location.getX() + xOffset);
location.setY(location.getY() + yOffset);
location.setZ(location.getZ() + zOffset);
return location;
}
@EventHandler
public void onDie(EntityResurrectEvent event) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
Location location = generateLocation(player.getLocation());
player.teleport(location);
}
}
}
why am i not teleported?
yes
1st you have Random random but use Math.random
2nd that if statement looks horrible
3rd are you sure thats event for entity dying?
Hello,
Im having an issue with my plugin. So I want to remove item that I clicked if its a hoe with mending enchat:
@EventHandler
public void onClick(InventoryClickEvent e) {
ItemStack clicked = e.getCurrentItem();
if (clicked.getType().equals(Material.DIAMOND_HOE)) {
if (e.getCurrentItem().containsEnchantment(Enchantment.MENDING)) {
e.getWhoClicked().getInventory().removeItem(clicked);
}
}
}
}
this is event for player dying
PlayerDeathEvent
looks right, did you instantiate the listener?
ofc i did
any error?
wrong event, use PlayerDeathEvent and you can ged rid of checking if its a player
i cant seem to cancel playerdeathevent
well, I'm sure you dont want to do that, why would you
true but im clicking in player inventory xD
im trying to make an armour ability where when you are about to die your are instead teleported like the chorus fruit effect
e.getInventory().removeItem(clicked);
@quaint mantle I event tried to add Bukkit.brodcast to se if I go through all the ifs and i do
then use event for lowering the health, im sure there is one an chceck if hes low
@distant fern e.getInventory().remove(clicked);
or this
Sooo what to do. I didnt cancel the event btw
not working
e.getInventory().removeItem(clicked);
both dont work
owo
?
Hello! I want to make sure my plugin isn't lagging, so what is a good millisecond time to run PlayerJoinEvent?
then remove the item with same meta
what? @ivory flume
?
it runs everytime a player joins, you dont choose it
my PlayerJoinEvent is pretty large and I want to make sure it doesn't lag. whats a good time for it to run?
i mean
like
how long should it take
why is it so large? what are you doing inside of the playerjoinevent?
?paste it
paste?
paste the entire thing?
yeah
yes
yes
i think im under an NDA by the server admin
hi fourteen <3
hewwo