#help-development
1 messages ยท Page 215 of 1
not really it works pretty well
it uses close to 0 resources as well
but also it has close to 0 resources lul
I actually hate the way they designed their minecraft server but I make use of some of their repos
why is every single component in a different repository
minecraft-data for example is used by both the bot library and the mc server
dunno I never used that
https://github.com/PrismarineJS/mineflayer most people use this anyway
im like the singular user using the minecraft server
holy shit this repository holds 90 lines of code
I actually started to re-implement it but I CANT FUCKING FIGURE OUT HOW TO SEND CHUNKS TO THE CLIENT
I send the packets to the client and the client commits le handicapped
do two packets, one for all the data at once and one for changes
compress the former
are you sending json ๐
lmao
client.write("map_chunk", {
x: 0,
z: 0,
heightmaps: {
type: 'compound',
name: '',
value: {
MOTION_BLOCKING: {
type: 'longArray',
value: new Array(36).fill([0, 100])
}
}
},
chunkData: chunk.dump(),
blockEntities: [],
trustEdges: false,
skyLightMask: [],
blockLightMask: [],
emptySkyLightMask: [],
emptyBlockLightMask: [],
skyLight: [],
blockLight: []
});```
looks like this
you know you need to conform to the minecraft protocol standards
I am
or is this with a custom server as well
I analysed the fucking
wiki.vg page
for 2 days
I see no differences
its all the SAMEEE
but youre using a wrapper
idk how did you configure it
idk its part of minecraft-protocol
it gives you a client and you can just do client.write(packet_name, packet_data)
mojang also randomly changing the way chunks work doesn't help
@river oracle Still doesn't show up,
and this is what the wrapper expects
Quick question, what's the idea behind wrapper classes and what defines them?
Are you referring to primitive wrapper classes (Integer) or like in general
in general, issue is that I can only find resources about the primitive types. Yet those resources only tell you when to use them, like for arrays, but doesnt illustrate why and how you create them
It's mostly used for primitives so you can add some methods or pass it by reference
As in java those are passed by value
Also before java records, I saw people refer to class that is holding more objects as wrapper
Ah, cause I thaught wrappers were basically classes which would encapsulate something like a record
quick question, how was the universe made?
big bang
ok
There are different types of wrappers
Which one are you referring to? (The most common canonical ones being Proxy and Adapter)
but the general idea is some type of delegation pattern we talk about the notion of a wrapper
bazinga
Conclure is just saying big words
Basically a wrapper, bare bones, is a class that has a field of a type that is operated on a lot
public class MyWrapper {
private final WrappedType value;
public MyWrapper(WrappedType value) {
this.value = value;
}
}```
Practically all of CraftBukkit is wrappers
How can I send a message when starting the game in bedwars with this api
|| @EventHandler
public void onJoin(final BedWarsPlayerJoinEvent event) {
final Arena arena = event.getArena();
final Player player = event.getPlayer();
}||
player.sendMessage()?
it does not work
wrong discord
how do I cancel a runTaskTimer?
make your own bedwars or go to the api developers
I was wrong
@EventHandler public void onStart(final BedWarsGameStartEvent event) { final Arena arena = event.getArena(); }
what api is it
HBedWars
actually I want to send an actionbar that lasts the whole game
the only api stuff i can find online is just the stuff on their built by bit which doesnt even give jds
?scheduling with player.spigot().sendMessage(ChatMessageType.ACTION_BAR, component);
it 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.
Does anyone know how to use snakeyaml?
?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!
how does friction work in minecraft
yeah forgor
Node
Are you doing this with a configuration file, using Spigots API?
Just... SnakeYaml
youve Node::set<typeOfComment>Comments
you've ScalarNode, CollectionNode and iirc some other Node derivative
So what is a node for like a simple value
ScalarNode
It doesn't work if I plop a list in correct?
All collections need to go in CollectionNode right?
ah might be those then
ScalarNode instead is value
so, technically
hello: 56 ScalarNode
list: [1, 2, 3] SequenceNode
map: {a: 1, b: 2} MappingNode
now how do I construct them
ye
think that solves that init?
hm?
I am doing custom shop iventory menu
now would it be fine if I would extand ItemStack class
I mean
extending ItemStack basically never works out the way you expect it
I know data will be lost after menu is closed
the server does not guarantee you that the same instance is returned at any point tbh
oh
I think it should return proper instance until inventory is closed
got you
just wrap itemstack
like what
bro i must be on something
ServerLevel serverLevel = ((ServerLevel) location.getWorld()); why cant i cast this?
get the handle first
Bukkit's.World is implemented by CraftWorld
which exposes getHandle() which returns you the level
i've used mongodb before
its eh
much rather mysql
nvm
when not using UuidRepresentation.STANDARD it looks like this
ok i can directly modify _id
cry about it
cry about why they call generic params TItem and not just T too
I got automatic type conversion working on mongodb
where I store a Map<String, Object> and deserialize it into the correct class types using gson
without breaking shit
oh i found my mongodb buddy now
no.
You got smoked
bruh how many methods are in here https://mongodb.github.io/mongo-java-driver/3.6/javadoc/?com/mongodb/client/MongoCollection.html
hey, uh I have a runnable that is in a for loop that loops through inventory contents, but it seems to spam the broadcast message, how could I make it stop the runnable and for loop once it detects the item in your ivnentory
show code ?
break;
return;
sorry if this is not the best place to ask, but why the hell can't I import snakeyaml properly? as seen on the left, snakeYAML has a Yaml class, but i can't find it by package or by auto-import. as seen on the right, snakeYAML is indeed in the project
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
</dependency>
return kills the entire method including stuff after the loop
depends on the stuff he has in the method
sometimes i return in the loop, cuz loop is the last part of the method
and yes i tried invalidating caches
that's valid
intellij moment
thanks for a helpful response, i am totally going to use netbeans from now on
why not eclipse
why do you need snakeYaml tho
eclipse looks ugly
to.. parse yaml files?
isn't bukkit's YamlConfiguration alright?
it's not bukkit, just java
oh
that's why i said that it might be not the best place to ask
i just get the fastest responses here
soz
no, i am going to use snakeyaml for its pure simplicity
๐
Hmmm did you make sure it's in there correctly and no errors and not in ur plugin.yml
heres my
code
public void onPlayerUse(EntityPickupItemEvent event) {
Player p = (Player) event.getEntity();
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
for (ItemStack i : p.getInventory().getContents()) {
if (i.isSimilar(ItemManager.Ball)) {
p.sendMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + p.getName() + " has the ball!");
Bukkit.getScheduler().runTaskLater(plugin, () -> {
p.getInventory().setHelmet(ItemManager.DiamondHelmet);
p.getInventory().setChestplate(ItemManager.NetheriteChestplate);
p.getInventory().setLeggings(ItemManager.DiamondLeggings);
p.getInventory().setBoots(ItemManager.DiamondBoots);
p.getInventory().remove(ItemManager.GravHammer);
}, 20);
}
break;
}
}, 0, 1);
}```
why
what
oh apparently none of my dependencies are working, they are imported but i can't use any of the classes or annotations or shit
How does one check when a plugin runs a command? ServerCommandEvent printed nothin when a plugin runs a command.
there are ServerCommandEvent for console
and PlayerCommandPreProcessEvent for player
wut should I do
But what about for plugins?
plugins can't run commands by themself tho
only Player#somethingWithCommand
or Server#dispatchCommand
so server doesn't count command dispatch as ServerCommandEvent?
Ig.
trying to check if an item is in the players invetory
then do shit based on t
upon an entity picking up an item, 1 tick after the event is called, find a Ball item and change the player's equipment???????
this code isn't even bad it's literally readable
yea
that
it's readable but it starts a timer
yea how do I break it once it finds the ball
for no reason
and idk why
That seems like a super inefficient way to do something super simple
i wanan loop through the inventory
but when i dont use the runnable
why
it doesnt work
to check for item
you can just check if picked-up item is a ball
no need for loop
Doesn't inventory have a contains method?
it does
that too
contains
i thought isSimilar accepted a Material?
whats the method
- containsAtLeast(item, amount)
oh
nah, it's itemstack
ah shit
there is no ball material in minecraft too
its an itemstack
when I try to run contains without a loop it doesnt work
for sum reason
public void onPlayerUse(EntityPickupItemEvent event) {
if (!(event.getEntity() instanceof Player player)) return;
if (!event.getItem().getItemStack().isSimilar(ItemManager.BALL)) return;
p.sendMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + p.getName() + " has the ball!");
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
// change equipment and remove GravHammer
}, 1L);
}```
what is the ! for
negation
?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.
because you probably want to use these events for players?..
we are meant to have known that how?
cuz not only players can pick up items?
im aware
actually true
I guess thats need
i just realized why my project wouldn't read the snakeyaml dependency
module com.example.underscorecubing {
requires javafx.controls;
requires javafx.fxml;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.bootstrapfx.core;
opens com.example.underscorecubing to javafx.fxml;
exports com.example.underscorecubing;
}
this shit was autogenerated
when i created the project
ffs
sucks to be you last hour
well it was added in 1.18
wait how might I make an object uneffected by explosions
while on the ground
I tried by setting the item meta to unbreakable
but that doesn't work
you'll have to listen to the event
the exceptions for explosion damage are hardcoded
ok
Ill just retexture the nether star ๐ t
or that xD
easy way out
but yea ```java
@Override
public boolean hurt(DamageSource source, float amount) {
if (this.isInvulnerableTo(source)) {
return false;
} else if (!this.getItem().isEmpty() && this.getItem().is(Items.NETHER_STAR) && source.isExplosion()) {
return false;
}
....
that is the mojang code 
kek
brr
๐ฑ
btw is there a thing to lower gravity for an object
that isn't outright canceling te gravity?
eh, doubt
so ill just set the item velocity
why
that is a good question
๐ฟ
I tried velocity as 5 and i sent it into outerspace llol
velocity to 0 i would guess
I tried 2 it works decent
also im geting this error
[ERROR] Could not pass event EntityResurrectEvent to CrystalBall v1.0-SNAPSHOT
org.bukkit.event.EventException: null
any idea?
?paste the full error
saco
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.entity.CraftSlime cannot be cast to class org.bukkit.entity.Player on at crystalball.crystalball.Event.OnEntityTotemPop(Event.java:67) ~[?:?]
unchecked cast
what is craft slime
look at ur code
Implementation of slime interface ig
Event class, line 67
public void OnEntityTotemPop(EntityResurrectEvent e){
Player player = (Player) e.getEntity();
tru
lemme do dat rq
PlayerResurrectEvent?
yea i fixed that
Is it possible to disable anvil renaming letter cap or increase it or is it hard coded?
Most likely hard coded.
you can increase it
declaration: package: org.bukkit.inventory, interface: AnvilInventory
on the server at least
the client won't care
I imagine the client has the limit hard coded but I haven't really ever used an anvil in Minecraft
yea the client has
you can change it on the server to technically allow too expensive operations
but you'll have to trick the client with a fake cost
Ah
ร generic type
ooh right thx
yea you can
public class Wrapper<T extends WrappedValue> {
T value;
}```
?paste
https://paste.md-5.net/opehafilik.java
shall I change something?
first time I tried using Generic Types for this kind of stuff
what about you actually storing a List<ICategorized>
that would just help the readability right>
there isnt a reason to use a generic param right?
Hello how do i stop a player from charging a bow?
Is there an event for when a plugin sets an item in an inventory?
BowChargeEvent iirc
lemme check
anyone knows if this is possible in acf: i want to create a player wrapper class that, when declared as first param tells acf to only let players use this method and automatically map the user object
@CommandAlias("sethome")
public void onSetHome(User user, String name) {}```
and ill have to provide a way to map a Player -> User ofc
PlayerInteractEvent
yea i have that its just like when i cancel it the bow charge wont reset its just not shooting the arrow
ye
There is an easier method
check for when they shoot, and if your condition is false cancel
otherwise you might need to use packets
i just want like after 0.5 seconds of charging it should cancel so ima need to use packets or just try to find another way ig
why though
like you don't want too much charge?
ye
but why
uh idk just trying to make a op bow for my friend to prank his friends on his smp XD
oh, but charging for .5s will be at max regardless
or no
wait yeah no
you can try to simply limit the velocity
as the velocity dictates damage
ima try that ig thanks
try to shoot bow and print velocity
then use some velocity around that or smt
(print individual comps)
npnp
how do u check if a yml file path doesnt exist
I mean those simple things you can always look it on google
Also you have some amazing invention called javadocs
ConfigurationSection#contains
๐ค
tysm
np
also another quick thing, how to set a path?
can always look it on google first and aso you have some amazing invention called javadocs
lol sry
config.set(path, settingThing)
config.save
add a true as the last contains argument to ignore defaults
But those simple questions can be answered by JAVADOCS or JUST GOOGLING!!!!
Lmao i dont like those actitudes because you ppl now a days want to get the food served and cut on the plate
Making refence that they want to have everything simple an simple
I mean look, people might not have learnt how to google or they might not even know about javadocs
catch them a break
Maybe they're even new to programming
javadocs at the start are just confusing as hell to people
JUST GOOGLE SO
Though it was one of the first things I learnt
LMAO what shity society we are creating
Hello i have a question, is there a way after .registerNewTeam that i can set the Prefix for the team?
Wdym prefix
like the name?
oh wait I am dumb
yeah you can
You need the team instance iirc
Team#setPrefix
i remember when i started, googling isnt hard. Finding the correct thing to google to get the thing you want is the hard part. People learn by getting some help
No bruh, they learnt by being sping fooed
i dont know how to say it
yep having 2 questions answered is being spoonfed
spoofed*
No, serving food on the plate and already cutten is spoonfed for sure
Also i act like this because when i learnt its was by hard no one wanted to help me with this litle things. And it was the best they can do because i realize that putting effort i would learnt them by my self
A prefix before the name like [LIVE] PLAYERNAME, in the tablist i got it to work but in the chat it looks like this <[LIVE] Playername> but i want that is is looking like: [LIVE] <Playername> and i dont want to change every message to this format with the plugin
true
That why your best friend is googling and gogling
okay so, how are they meant to google what they need if they dont know what they need
Come on its not so diff to look for stmh online, you look on url try it and see, then another url try and see
And then its loop until you have been more than 1h, then yes you can come to ask
Because i just googled that and first answer worked
๐ก
Oh then you need to listen to AsyncPlayerChatEvent and edit
oh wait you don't want to edit
sorry but there isn't another way
okay but thanks i guess i will look into it to get some other ideas
You will have to unregister and register it again
alright..... i have ONE more question (sry its a little more complex and there will be definitely no answers on google). So i need to detect if a player puts an item in their 2x2 inventory slot, but i cant use InventoryClickEvent, cuz i need to detect it every tick, is there a way to do it?
InventoryClickEvent does it as soon as it happens
bruh read
why every tick?
Why every tick?
cuz i need to write to a yml file if a player has a dragon egg in their inv
Use the provided events btw
but placing in the 2x2 crafting isn;t going to change outside the InventoryClickEvent
A yaml database is not a good idea
why?
also its soo hard linking up every possible click to the 2x2 slots
^
I did make the mistake of saving to it though xD
yml is OK for data, but ONLY data which doesn't change often or quickly.
i just need to store 1 uuid
cuz there is only 1 egg
I mean it's best to use SQLite for that
or
or
just use a separate file
eggHolder and write the uuid to it
with a data stream or smt
yaml is OK for backend data, so long as you do not read nor write often
and its not a lot of data
so pretty much, never okay 
your use case seems to point to PDC being a better choice
wtf is pdc
?pdc
lol
basically in-game data storage tied directly to items/players/entities
Stored on the object, in yoru case the egg or the player
but it isnt memory based right?
User readable configuration
it's persistent between logins
SQL ๐คข
I mean if you need a quick thing
and if on the Player it's saved on the Player object so would be accurate for teh players current inventory state.
FlatFile is not designed for fast CRUD operations
also you should know how to use SQL, even in case you don't like it
Not telling you to change a configuration
yaml is backed by a big chunky map ๐
good ol' map
Changing smth user/sql itself tables are a messs
fr
i should compare mongodb speeds vs sql
TiMe tO lEaRn1!!! https://www.youtube.com/watch?v=wz8oKcPUzHY
In this episode, I show you how to use Spigot's Persistent Data API to store primitives and Strings in items, blocks, and players. #Spigot #Minecraft
โญ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentatio...
kody simpson ugh
ikr
atleast not codedred
this is probably better https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/
what is it with ever spigot coder youtuber sucking at coding
I mean I'm not very good either, but thats why I don't make youtube tutorials
I'll join them
. Make another awful YT coding channel with skript kiddies in the comments who want the source code so they can copy paste
22 minute video for a 1 minute concept
Im having a lil trouble with this snipet of code
if(e.getDrops().contains(ItemManager.Ball)) return;
if(e instanceof Player) return;
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + "The ball carrier has been killed at " + e.getEntity().getLocation().getBlockX() + " ," + e.getEntity().getLocation().getBlockZ() + "!");```
i wanna check if the player has a certain item they drop opon death
and broadcast the message
wtf there isnt a boolean PersistentDataType?
but there is in vanilla
Don't check .contains. Use PDC
Complain to the guy who made it then 
whats with PDC
Wym what's with PDC
Yeah, because it's a great solution to a lot of peoples problems
Or rather, use bytes for booleans
Doesnt sound stupid how the MongoClient works? Because in my case i connecting to the database thru mongo uri which ask you for all the credentials, etc including the db name. But then when you want to work over the collections there is only one posibility and its by getting the db name. And that makes it stupid because i need another config field for the db name. But its already included on the url
๐
What
You're not making sense
Why not store the db name as a separate string so that you can get it?
wait im just checking if a player has an item upon death
why does that need a pdc
Is the object you're looking for a direct reference to the object being dropped?
yea
its not a stored value
So what's not working with the code then
Its not broadcasting the said code
Because it's probably not a direct reference
.contains really calls
int indexOfRange(Object o, int start, int end) {
Object[] es = elementData;
if (o == null) {
for (int i = start; i < end; i++) {
if (es[i] == null) {
return i;
}
}
} else {
for (int i = start; i < end; i++) {
if (o.equals(es[i])) {
return i;
}
}
}
return -1;
}
Which does a .equals check
Use PDC
alr
Its stupid doing that, because the uri itself already ask you for the db name
?pdc
I don't really understand your problem lol.
okay.. i got through the eternal suffering here and why tf is it still not working?? btw the method is called its just a stupid intellij bug
Personally I'd store the key as a variable so you don't have to make a new instance of it every few lines and helps prevent bugs
okay
Have you tried logging the individual variables?
are u trolling me?
Let me use the translator
Because i dont think u are trolling me
Are you trolling me? I legit don't understand what your problem is that doesn't have an easy solution
I mean it doesn't sound stupid that to get the database collections it asks for the name of the database. When when you start the client itself you pass it the fucking database name included in the mongo uri
Translated by using: https://www.deepl.com/translator
when when?
[22:31:54 WARN]: Task #42 for ZMP v1.69.42 generated an exception
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.bukkit.persistence.PersistentDataContainer.get(org.bukkit.NamespacedKey, org.bukkit.persistence.PersistentDataType)" is null
at com.zushee.zmp.Egg.DragonEggFunction.checkegg(DragonEggFunction.java:35) ~[ZMP.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.jar:git-Paper-81]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1491) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1415) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1188) ~[paper-1.19.jar:git-Paper-81]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:303) ~[paper-1.19.jar:git-Paper-81]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
?stractrace
it gave me an exeption
- pastebin
- That looks like a you problem
Seriously have you learn how java works?
I mean the basics LMAO
Its really make me mad ppl asking for help when they dont event know basic things
no key found in the PDC
assign it to an Integer instead of an int (Integer can be null) and do a nullcheck
๐คฆโโ๏ธ
Also with mongo I always need to ask for the DB name so I don't understand the issue
or do pdc::getorDefault(, -1)
okay
MongoClient client = MongoClients.create("mongodb://password:username@host:port/db-name?authSource=admin");
MongoCollection<Document> test = client.getDatabase("").getCollection("test");
Its stupid mongo
Its asking for db name again
When you already pass it thru the client ๐ก
it doesnt save the db name its as simple as thhat
No, it's because it doesn't know/see/care about the db you pass into the client
So that is not a weed designed
I have already open many github pr and they just ignore them
Im thinking seriuosly starting blaming them
LMAo more lines
๐คก
More lines =/= bad code
Storing the database name in a variable or hardcoding it produces the exact same result
bro the bigger ur file is the better the coder
you can create a MongoClient based on a connstring, well just retrieve the db back from it, issue solved
ye i fixed it now, thx!
Logging does wonderful things hmm
in one line
your worst enemy will be ctrl + alt + L
just dont use it ;-;
It's a free country can't stop me
Not even need the string name
if youre struggling to find the line of the exception, just put everything on one line
Just name it as uri
whats the problem then
Donโt read the stacktraces when you get them, thatโs what theyโre expecting you to do. Never let them know your next move
I have got it to work with the AsyncPlayerChatEvent, but the problem is that when the player hast set a status the hole thing would run into an error ๐ฆ
Then i have added a if (Vcstatus.sb.getEntryTeam(apce.getPlayer().getName()).getPrefix() == null bit the error in the log still apears here a link: https://pastebin.com/Te9vcwjh
Bukkit.broadcastMessage(Vcstatus.sb.getEntryTeam(apce.getPlayer().getName()).getPrefix() + "<" + apce.getPlayer().getName() + "> " + apce.getMessage());
maybe you could help me
Add a try catch
and put the code inside that try-catch
Never try catch if you can avoid it
never used a try catch at Java and spigot could you help me with that?
Just to test what happening
So im going utterly wonko
I have commands that are still registering even if a space is added
Oh i thought he was having an issue but didnt know why
PDC are not designed for 1.8 right? A friend want to know
Correct
no
perfect
pdc came in 1.16 iirc
The error says exactly what's wrong though so try catching it is pointless because you're catching the exact same thing that's being printed and wasting time
thank you man ๐ worked!
It worked but it's awful
๐ญ
Teaching bad practice right off the bat is so wrongggg
better to check if the return value of org.bukkit.scoreboard.Scoreboard.getEntryTeam(String) is not null prior to executing org.bukkit.scoreboard.Team.getPrefix() on the returned value
Yeah i didnt know sorry , i thought he was having an issue but didnt have an exception
Also wait
Send your full code
I will send tomorrow in Germany is very late โฐ I ass you as a friend then I will send
Perfect, dont worry
Have a good night
So has anyone got any idea what plugin could be causing this/
this is what im saying
something about this server
makes it so you can
with basically any command
2 different plugins, neither of which do this on standard
but yet on this server do
It has utterly stumped me
I do not think you quite understand me
This does not happen
in my private server with said plugins
but does here
It is honestly driving me up the wall
How could I make a plugin where if the user puts items in the crafting table, the items stay there. Also only the player that put them sees it, others see what they put
how do u update a block client-side in spigot?
cant
Why not?
crafting tables arent storage
There is a version from 2014 ๐คทโโ๏ธ
really?
Yes
i might be wrong
You must be
You would have to implement a server side cache of the table inventory per player
I should store it on the server?
thats where plugins go
?
update?
Can I not store it on the player?
yes you can store it in the players PDC but that could be messy once you start with more than one table
What do you mean by messy?
You'd be better using teh Blocks PDC
Okay, would that affect server performance if there are tons?
I think crafting benches have TileStates
no it would not have any noticable effect on the performance
Not at all? Like even if there is 10,000
still not as they would not all be loaded at teh same time and they'd not all have data for lots of players
you'd need to check it has a PDC/TileState though
not sure crafting tables do
What do you mean?
chests, furnace, hopper etc do
thats it's inventory
Oh so I would store that in the crafting table it self
What do you mean by not loaded
So if the chunk there isn't loaded, it doesn't have any affect?
Sorry, what is PDC?
persistent data storage
anything with a TileState has a PDC, plus the World and Chunk objects https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/TileState.html
and all Entities
So I can't store it in the crafting table
you could store it in teh Chunk PDC, but you'd have to monitor block break or other types of being destroyed so you could cleanup data
there is a library that does that for you
That won't affect performance too much?
Hi mehbi, how have you been doing it?
Thank you very much :)
Is PDC how minecraft stores normally? In like anvils and stuff
Ohh I thought it was a minecraft thing
just make sure to not think of it as a NBT wrapper
you cannot modify vanilla NBT for example
nor do you have access to any NBT types etc
?1.8
Too old! (Click the link to get the exact time)
NBT is used on legacy versions
what
wtf does that have to do with anything xD
who was even talking about legacy
are you dumb
yes is the answer to that question
there are still viable uses for NBT post 1.14 which is when pdc was added
barely but there are some
pos 1.14 is legacy
You musnt use them
vernan post means after
Pppl under 1.16 should be permanent BAN
are you drunk ?
im consuming... what more i can say now 2d in a row
ah ๐ enjoy that, I can recommend #general
hahaha
Eh?
How would i loop over 1 list of strings from config, replacing each variable from values taken form another list of strings?
I mean i know how to do loops, but i dont know how to do it for what i want, so i can get this output into player;
- "/command help"
- ""
- "/%command% %usage% - %description%"
- ""
So that message is sent one time to the player, but replacing the variable with adding more lines depending on how much commands i have onthe list
Were both of them are Lists
would this work for detecting if a player has an item on death?
if(event instanceof Player) return;
if(((Player) event.getEntity()).getHealth() <= 0 && (!player.getInventory().getItemInOffHand().isSimilar(new ItemStack(Material.AIR))) && ((Player) event.getEntity()).getInventory().contains(ItemManager.Ball)) return;
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[CrystalBall] " + ChatColor.DARK_GREEN + "The ball carrier has been killed at " + event.getEntity().getLocation().getBlockX() + " ," + event.getEntity().getLocation().getBlockZ() + "!");
event instanceof Player
it should be:
if (!(event instanceof Player)) return;
Player player = (Player) event.getEntity();
// rest of code
Ty
I started on that
I mean you shouldnt start with plugins
Oh
Its like trying to drive a car without going to classes or any knowledge about it
It apply the same for coding, if you dont know the lang itself its not recommend to code not even use a library
I told you because i learnt java by hurt and i have really bad experiences of it
for using nms, do you include the jar produced from buildtools into your buildscript?
or is there an external maven repository you include?
You have to include the jar on your project and there is no need to shade it
so whats the best practice for doing that, im using gradle so should i add a libs folder with the jar in it, and then include that folder in my repositories block?
https://stackoverflow.com/a/20700183/14782396 like outlined here
I would install the jar into the local gradle repo
I dont know if that is posible
ill do it like this then ig
I use maven and with maven, you can install projects into local repo
Which then can be used as dependency but locally of course
Then you can deploy them into remote repos
im not as familiar with maven
ill just include the jar then on the classpath or something, ty
I have no clue how to do this but how can I check if a JSON object with a certain property already exists in my .json file using Gson?
Every attempt I've tried hasn't worked so far, it just creates a new object in the file for the same property (while the old one already exists) or just replaces everything in that file.
im still slightly confused about nms, wheres the jar i'm supposed to include when i run build tools?
would i need to compile the repository that ends up in the CraftBukkit folder to a jar?
Just download BuildTools.jar
and run it
Does it matter in what directory?
nope as long as its not in One Drive
beacuse apparently some people use that and thats cringe
And then what do I do lol, just include org.spigot:spigot:version or whatever?
Yes
wait ๐คฆ๐ฝโโ๏ธ sorry
firstly you can't use gradle
if you want to use gradle you need to go with Paper API
spigot runs purely off of maven and I have no clue if anyone has translated the mapping plugin md5 made to gradle
I know one of the pink clowns on the sidebar uses gradle with spigot, but I forgot
just because you don't understand it doesn't mean its bad :P
xml and that html like syntax is everywhere
:P its easy with maven
I figured once everything I googled was using maven
[Update] I might've found the cause, I think I accidentally had the file writing in the for loop that's supposed to check if the element already exists in the array.
nvm, something else did it.
it doesn't work
nvm found a diff solution
hi, im having issues running buildtools
Attempting to build Minecraft with details: VersionInfo(minecraftVersion=1.8.8, accessTransforms=bukkit-1.8.8.at, classMappings=bukkit-1.8.8-cl.csrg, memberMappings=bukkit-1.8.8-members.csrg, packageMappings=package.srg, minecraftHash=a0671390aa0691e70a950155aab06ffb, classMapCommand=null, memberMapCommand=null, finalMapCommand=null, decompileCommand=null, serverUrl=null, mappingsUrl=null, spigotVersion=null, toolsVersion=0)
Starting download of https://s3.amazonaws.com/Minecraft.Download/versions/1.8.8/minecraft_server.1.8.8.jar
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://s3.amazonaws.com/Minecraft.Download/versions/1.8.8/minecraft_server.1.8.8.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1902)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1500)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
at java.net.URL.openStream(URL.java:1093)
at com.google.common.io.Resources$UrlByteSource.openStream(Resources.java:72)
at com.google.common.io.ByteSource.read(ByteSource.java:296)
at com.google.common.io.Resources.toByteArray(Resources.java:98)
at org.spigotmc.builder.Builder.download(Builder.java:1083)
at org.spigotmc.builder.Builder.main(Builder.java:416)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
im using the latest buildtools
Too old! (Click the link to get the exact time)
yes lol
Should i code paper or spigot?
Paper has better performance but spigot seems easoer
Easier
I've been using paper but eh idk
just use spigot
if you like components use paper
there really isn't another reason to use it other than the components and they have like 2 or 3 more events
plus it makes your plugin compatible with spigot as well
armorStand = location.getWorld().spawn(location.add(5, 0, 5), ArmorStand.class);
guardian.setLaser(true);
guardian.setGravity(false);
guardian.setInvisible(true);
guardian.setInvulnerable(true);
guardian.setTarget(armorStand);
armorStand.setInvulnerable(true);
armorStand.setInvisible(true);
armorStand.setGravity(false);``` why does the guardian beam randomly dissapear after like 6 seconds
The problem is mojang removed the downloading of 1.8. Not sure if its permanent or temporary or if they changed the location of where you can download it. Issue isn't buildtools and you are not the only one
Buildtools requires vanilla server jar in order to do its thing
yeah its ok i just forked buildtools and hardcoded the url
im compiling it now
At least you solved the problem
Is there any way for me to get an item that gets shift left clicked from the inventoryclickevent?
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClick(InventoryClickEvent e) {
final Player player = (Player) e.getWhoClicked();
final InventoryView inventoryView = e.getView();
final ClickType clickType = e.getClick();
final ItemStack inHand = e.getCursor() != null ? e.getCursor().clone() : null;
final ItemStack inSlot = e.getCurrentItem() != null ? e.getCurrentItem().clone() : null;
final int rawSlot = e.getRawSlot();
player.sendMessage("Inventory Click Cursor");
changeSpirits(player, inHand, false);
if (clickType == ClickType.SHIFT_LEFT) {
player.sendMessage("Inventory Click ShiftClicked");
} else if (clickType == ClickType.LEFT && inventoryView.getInventory(rawSlot) == inventoryView.getBottomInventory()) {
player.sendMessage("Inventory Click Placed");
changeSpirits(player, inSlot, true);
}
}
Current code ^
Just trying to figure out how I could see what item is moved from the shift click
would it just be the 'inSlot' variable, aka e.getCurrentItem()
ok just tested it, it is
Does the CreatureSpawnEvent is triggered by the spawnEntity method?
is there anyway to create world per player? like sky block plugin.
I wanna make player's personal island but I'm noob ๐ฆ
There are premade skyblock plugins available if you feel like it's too hard
I tried to read other plugin's source code. but It was so hard to me ๐ฆ
Islands are not created in a separate world
do I need to use world generator?
wha...t?
collect many island in one world?
How skyblock does it is it uses a void world and then with some logic uses a schematic or schematics to paste islands in as needed when players join
they usually have a boundary
and then like 1000 blocks in between islands
so theres no way they ever meet
^
a world for each player might be more resource intensive
ohh I was stupid
Multiple worlds doesn't help that problem either and will use more resources in the long run due to how world loading works. Better off with just a single world. Also chunks don't stay loaded unless a player is at their island
I got it! ๐
Also empty chunks don't take resources either
then.. have I use worldedit code to use schematics?
Hence void world being used. Most of the chunks being loaded will not contain blocks so not really an issue
yep
That would be the easiest way
I got it! ๐ thanks!
fake name
Where did this come from lmao
Hi guys. I have been wanting to make a plugin where a player will be able to gain new skills given certain events
I wanna hold all these skills in an array
however, I have been thinking, maybe I should add a new class like PlayerPlus where I extend player and add this new array (plus other things as well)
or maybe It would be best if the player was an attribute, as well as the array and the other stuff
both work correctly
However, what would be the approach of you guys, to do something like this?
nope you dont
yes you do
Hmmm ๐ค
wrap the uuid of the player instead with it skills
I don't know what is uuid, but I can search It
ooh, is It like the id given by the player?
like, each player has one?
yeah, its the โจ universally unique identifier โจ given each account on creation
:o
awesome
so I will use this uuid as an attribute, instead of a Player attribute
and when I want to use methods from Player
I will do something like
uuid.getPlayer().somePlayerMethod() ?
no, then you get the player by Bukkit with the getPlayer method
i mean, you could also have the player as attribute, but UUID leaves more options open
oooh
so I can access more stuff with the UUID?
๐ค
If I understand correctly, that seems cool
no, the UUID is just, like the name says, the identifier for the player. you can either request the offlineplayer object or the player object with the UUID
but for serialization f.e. the UUID will make your live easier
think I got It
also this gives somewhat of an offline functionality
np
Hi guys, what would be a good approach for creating new custom Items?
I'm thinking about creating a class named "CustomItem"
and then
passing the item lore, display name, quantity, material, etc, as parameters
and then I construct an ItemStack on the constructor
and set the lore, display name, etc, with the respective arguments
then you can just use ItemStack
yeah, but
I think It will nice to have methods that generate a specific custom Item I have, so I don't have to create all these values in my main code
for example
public CustomItem createCustomItem1() {
Material material = Material.BUCKET
String displayName = "Super Bucket"
...
return new CustomItem(material, displayName)
}
something like this
ooh
Maybe I can create a class with these methods
but just use ItemStack for the item, as you suggested
๐ค
Yeah, that makes a lot more sense ๐
Now that I think about It, I don't even need a constructor for the class CustomItem
I just have to create methods to generate new ItemStack items
Is there a way to use methods without necessarily needing an object? I'm kind of new to OOP
like, instead of instance1.do_something()
I could do class1.do_something()
so I don't have to initialize a new instance everytime I want to use It
Oooh, I think I found out
I have to use "Static Methods"
Hello noob @fluid river
Hi, this is more of a Java question, rather than spigot
but I want to store a list of skills
they don't have to be in order, I just want to efficiently search if the player has an skill
My first thought was to use sets, since they usually provide this function
but the Set java provides doesn't seem to offer a "search" or "has" operator
The problem with list is that searching on It takes O(n) complexity, where n is the length of the list
I want it taking O(logn)
i mean
logn
what that
It's computational complexity
Yeah, but set doesn't have a method for searching, does It?
it has a .contains
It has contains
limo
It's interface ๐คทโโ๏ธ
Yeah, I'm new to java programming, didn't know, haha
cool
It works
Hey, suppose I have a class PlayerPlus
each player is going to be an object of PlayerPlus
PlayerPlus has a player object, and also has a set of skills, and other attributes
When a event happens, I want to get the object PlayerPlus that made that event happen
however, I can only get the player, with event.getPlayer()
Is It a good idea for me to make a map, mapping the uuid of the players to the respective object PlayerPlus?
Yeah, I got It
but thanks!! :)
well, I'm using a HashSet, so I suppose I can get the value in O(logn)
contains

