#help-development
1 messages · Page 1829 of 1
Read the docs, but still
deprecated?
Read the docs
Should've been enough to get you on your way
Do Mojang plan into removing pretrified slab
no
Fairly sure they won't at this point, they've basically supported it
there's three block states to make use of as well
That’s only 1 block though
I mean what are states?
bottom half, upper half, double slab
Iirc they only have top bottom and double states
So with a resource pack, I could modify the model of a petrified slab
What is your plugin ?
Not public
Oh okok
I also often use command block states
but survival players cannot break them obviously
Ok I am prob the big dumb, gimme a little nudge. I am getting the items with event.getItem() in a PlayerInteractEvent listener. But these seem to just have a basic ItemMeta, not damageables.
and too many of them will cause lag spikes entering chunks
Note blocks
I want player to destroy the block, which will be a tombstone so petrified slab is good
it acts like a stone
note blocks are another good option, but you'll have to disable behaviors for them and it does take away from noteblock functionality in survival
but yeah, petrified double slab is the best non-replacing custom block
nah people use the noteblocks, would be weird
Only tools and armor have durability
Also what version
This is for 1.18. So if I wanna have a durability bar on my item, I will need to use a base Material that is damageable?
Yes
In that case, am I stuck with that item as the appearance for my custom item, if they aren't using a texture pack, or is there another way to set appearance aside from base material?
Ultimately custom items need a texture pack
You can require texture packs now
Players won't be able to join your server without it
Are you the guy that made spigot ?
Yes
Ohhh thats interesting, Is that a spigot setting that will enforce that or something I have to code? Also holy shit your amazing, thanks so much for the great software.
there are much better ways to get custom textures without using damageables
CustomModelData™️
Mojang needs to add ArmorModelData immediately
It needs to be an item with durability
So custom model data is what im using for the custom appearance in my own resource pack
I want custom armor damn it
that was like the method back in 1.9 but theres actual methods for it
buoo, I think they want a durability bar on a non-tool item
but I ALSO want durability for my item, but want it to appear as an ender eye for people who DONT have the resource pack
Prob impossible 😉
Yeah that's impossible
but you can just make a custom item for like shears or something
give it an ender eye texture with custom model data
and boom
you got it
unless you want all your items to be eyes of ender its impossible lol
yeah thats what im gonna do I think, gonna use a tool and look into forcing people who join to download the texture pack
yeah whenever i make servers which rely on custom textures i always force it
believe vanilla mc has a setting for forcing resource packs in server.properties
don't quote me on that
keep your packs light too
Yes
even pre 1.18 its possible to force it anyway
yep, with ploogins
yeah im workin at 7kb right now for the mod and resource pack =] just wanna do a simple item retexture
Lol going into mb is fine
no
OR is at I think 8mb
8mb is the limit yes
Even on my internet it only takes 8 seconds to download 8mb
8mb is not the limit
16k textures
then what the fuck is it
It’s 250mb now
oh
Is this a fairly new feature? I can't seem to find anything about forcing players to have a resource pack. There are some old plugins that claim to do it
they upped it?
They upped it twice
that's so cute
50 -> 100 -> 250
New in 1.18 I think, but as you say, plugins
look if a player has the resource pack if not, spam their chat with a message (download my texture pack plz)
I don't think you can see that from server side right
There’s an event
pre 1.18 you can just listen to the texturepack event
oh snap you can see what texture packs a player has? That will work 😮
No
Damn, my troll idea came out great
No, but you can send them one to use
But you can see if they accepted it
Ohhh I see
pre 1.18, better option now?
wdym
server.properties
server.properties
so true
I think I might check out server properties 😮
Anyone saw the video of the guy ordering his pizza with minecraft by using plugins? lol
huh, ya don't say o.o
Activate the boolean 🥳
initiates hacks
if I use petrified oak slab, how can I get the block state (double)
getBlockData and cast to slab iirc
Ok... I enabled require resource pack to true, but upon joining the server nothing happens when I have no resource packs installed. Maybe I put it in the wrong location? I put the zip inside my spigot folder /world/datapacks
Hello! Is there a way to change the locale of the death messages? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/PlayerDeathEvent.html#getDeathMessage()
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
It’s not a data pack
You need to have it hosted online and point to it in server.properties
Ohhhhh interesting, lemme try that here
thank you guys for the patience, I'm being the big stupid tonight
it would be too convenient
Yeah would be nice if I could just have the file on the server and pipe it to em somehow
you can with some coding
can in bedrock
make spigot support it immediately
the one sensible feature
Modifying the model of a block is by resource pack right?
Because I know nothing about datapack
datapacks are more game logic, resourcepacks are textures and models
im still under the shock that texture pack are now named ressource pack
i feel old
I am going to strip all of my assets from it though
I mean theyre the same thing
how many mb/gb @hexed hatch
yeah they changed the name waaay back
if you want to mess around with resourcepacks i really recommend lookign at fonts
fonts?
can do heaps with them
why fonts
yeah
they're so much work though
https://www.spigotmc.org/threads/custom-inventory-ui.525744/ i made this post a while ago about custom inventories with unicode
can also do stuff like tags, emojis etc
the virgin font-based custom inventory system vs the chad item model based custom inventory system
in the post i outline why font based is better
im reading your thread and its quite genius ngl
there you go
block models go in models/block, and you'll have to change the json file in blockstates to point to the models
good luck
you already prepared everything for me
Ill make a test out of it
rn
thx a lot
well there aren't any models in there
so you'll have to make them and put them there
blockbench
blockbench is fun
Custom helmet model?
yes sir
Well, item model on the head
are models json files ? @hexed hatch
All of my work goes into my private smps, I just like making augmented smp experiences
Yes
yes Dreamy, and you'll have to put the textures in there too
What ya got more than 1
smps?
Ye
well, over time. not multiple at once usually
my projects tend to be overambitious anyways and will only be completed like 10% of the time
See you just need to get simps to fund the smps
My friends don't have money
I really don't enjoy playing public minecraft servers anymore
medium sized smps amongst fun people and no children is the way to go
eventually you will not enjoy public servers anymore xd
that's what u get from being a dev
at least for me
Awesome 😄 you guys are the best. If its not SUPER obvious people just aren't gonna do it, this will handhold even the most stubborn =]
yep same with me
I had no idea it supported custom messages
it's modified on the resource pack maybe?
today we all learn things 😄
Yeah you can send a custom message
that's kinda swanky
That was set in the server properties
owh
thats great!
owo
you should make the message more threatening
tell them you'll eat their liver if they don't install it
it even just applies it immediately, you don't even have to alt tab and get the file and all that!
amazing
if you dont download the ressource pack we'll send someone to kill your family
LOL I'm gonna make it super aggressive
lol
I'd rather do something submissive. "If you don't download our resource pack, kittens will die. Somewhere. Maybe..."
If you dont install it, your game may not work properly and may crash please for the security of your pc
yes thats good
I like the kitten one
classic
could make it a bit more minecraft
then use "ocelot" instead of kitten
yes
If you don’t download this pack ya getting yeeted out of here
or any other minecraft reference
turtles
everyone loves turtles
some people dislike cats (which I don't understand) but NOONE hates turtles
Interestingly, it SAYS it will disconnect you, but if you click proceed, then the request fails, you can just click "continue". But I suppose that makes sense.
If provider of your resource pack is down, your server shouldn't be down
Too late. I really, really hate turtles
ugh
Millions of villagers suffer every year, please it's time to stop. Download our ressource pack to avoid the death of multiple villagers
ON GOD
ugh no villagers suck
you would hate this?
I hate this one especially
they take 7 emeralds an give you - what? a dirt block
😂
fuck villagers
and his stupid beady eyes
villagers suck, and not in the good way
Hey, ideas why this would throw a NULL error?
https://pastebin.com/ciKrYj9h
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
error pls
your list isn't initialized
what's abstractcommand line 81?
it's in the pastebin, but:
this.subCommands = subCommands; what is this lol
that's not how you initialize a list
silly boy
oh wait
I'm an idiot
oh okay nvm
Doubt it
its passed to the constructor wallah
Isn’t add(null) valid
seems like the thing you wanna add to the map / list is null
I doubt that
just check whether what you wanna add is null. if it isn't, the list itself is null
Like you can't use List#add If the List is initialized with Arrays#asList
List<String> list = Arrays.asList("a", "b");
list.add("c"); // It will throw UnsupportedOperationException
The most common list is an ArrayList
new ArrayList<>(Arrays.asList());
Which accepts null
List.of
then the list itself must be null
fun fact: modern java versions tell you what's null
Has to be using Java 17, they're using MC 1.18
I believe aglerr is correct
afaik, that : null bit is the message from the exception, which is probably null
That’s wouldn’t be a NPE though
but if the list isnt inited, it must be null
It's not an NPE
this isn't a npe
Ah
It's an UnsupportedOperationException
What is the BungeeCord chat event?
Yeah that would be an immutable list
ChatEvent @dusty sphinx
got it
Is there a way to debug/obtain the error stacktrace on why a command won't register?
This is all i get and I know just commenting out this line makes the plugin turn on.
at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
at xyz.nekonii.hexcraft.hexcore.HexCore.onEnable(HexCore.java:40) ~[HexCore-2.0.0-shaded.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-398]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-398]
Command being registered. (It was working fine before, I'm unsure as to what I've changed to affect this.)
Objects.requireNonNull(getCommand("shop")).setExecutor(new CMD_World_Shop(this));
Is it in your plugin.yml
bump :3
Yeah it is
? I'm using Java 17
yeah as said, I was wrong
I only saw "null" and didn't read the stacktrace any further
oh, didn't see that part my b
np 😄
did the same exact thing
I see that null and assume it's a good ol' npe
but tbh I still think that abstractCommand is null
✨cullfacing✨
yep
because if the collection isn't null, it mut be the parameter
btw sorry if I'm missing some ltters in typing, my keyboard is a bit fucked lol
how to fix that
I thought we established null was not the issue
obviously it is the issue
it says so in the error message
Which error is this
yeah but instead of doing that, you should check why you tried to add null to it in the first place
UnspportedOperationExc
So one more thing about custom items, the base material will determine what enchants will be available to my item right? So if I want my item to be enchantable I need to look for a tool that has the same available enchants I am looking for?
Yeah that would be because the list is immutable
(available from the vanilla craffting table)
if i cancel a chat event will it still reach the server
But then it would throw an exception everytime when adding something
i want to translate a chat message into a command that can be executed on either the proxy or the target server
depends - are you talking about custom enchantments?
So, LIS, this is the line that causes the error
I would like the item to perform like a real item at the vanilla crafting table, with the base game enchants
But I don't see why anything would be null for it to throw unsupported
You can initialize the List directly on the field, maybe?
How do i get if someone enters /give?
Or, show me how you initialize the AbstractCommand
with additional info obvs
How you create the AbstractCommand object i mean
@hexed hatch ?
onCommand method?
yeah well
PlayerCommandPreProcessEvent
^
but why do you want to intercept other plugins' commands anway?
in 99% of cases it's a very bad idea
That’s a vanilla command
it's also a command that 99% of servers have from 3rd party plugins
that's just why I was asking
because normally people just use permissions to block vanilla commands
im trying to create /give <player> <customitem>
i could be misconstruing whats needed
then just register your command in your plugin.yml and register a CommandExecutor
that's a misuse for that event
yeah you're abusing that event to do things that aren't meant to be done that way
So this Damageable interface. Is there a way to set the total durability? I only see get and set damage values. I imagine it uses the durability of the base material again.
there isn't
if you wanna have custom durablity, you'll have to do your own logic for handling it
I may be able to cheese it by using some sort of ratio. If they specify 3000 as the max durability, ill find the ratio of the flint and steels max durability to that, then set the surability on flint and steel appropriately
so there is a fucky wucky way to add custom durability
by adding negative durability
which works, but it won't display the bar until it reaches 0 obviously
yeah but anway, it will look fucked up to the client
i can provide the other class if i need to, but this is what i have currently. pretty sure one if not multiple parts of this are wrong
when sending a file, change extension to .java so I have some nice colors to look at
👁️ 👄 👁️
was there any noticeable slowdown from that, since you're constantly looking up the pdc shit on common events?
u can do that
No
?
PDC is probably just a map
only prope thing to have it work nice is to store the ACTUAL durablity in the PDC and then make the client think / set the "real" durablity on the itemsatck to be scaled accordingly to your ACTUAL durablity
ah
yeah
Yeah that’s what I did
@mighty sparrow
Hmm, so it's something with the .add()... but the object is not null...?
those if statements could be reworked with some || and &&. Use some exit conditions
are you sure neither the list nor the object to add is null?
It's probably because you're using collections.emptyList
what class is your list?
Same one
Which returns an immutable list iirc
what is || for?
I meann yah but look at my debug message
|| = "OR and don't continue"
ah
it means: don't execute the second statement if the first one is already true
you get what I mean? If not I can explain it in 3 lines
yeah
does anyone know when PersistentDataHolders save their persistent data?
for example: if i set persistent data and then the power goes out before a world save happens, when the server is relaunched will the data be lost?
Hmm
I don't think that's the case.
If you attempt to add something to a Collections.emptyList(), you get this error.
omg the other gizmo
hi
boolean firstCond() { print("Test"); return true; }
boolean secondCond() { print("Bla"); return true; }
if (firstCond() || secondCond() ) print("Yo!");
``` ->
Will result in
Weirdly enough if I run that code locally on my machine it has no null exception message.
"Test"
"Yo!"
while if you just use | instead of || , it will print
"Test"
"Bla"
"Yo!"
^
Interesting. So I need to remove the Collections.emptyList(); in the constructor?
just try changing your Collections.emptyList() calls with new ArrayList<>() or something, it might help.
yea
imma go to sleep, have a nice day everyone ❤️
gn
How odd. Okay
What is bungeecord
a proxy
A proxy to connect servers together
I changed Collections.emptyList() to new ArrayList() and it worked
damn thats cool
bungee = makes players think that different servers are just different worlds on the same server
fax
(very basic explanation)
Hypixel use bungee af in this case
every large servers uses a TON of proxies
Prob their own implementation of Bungee
even the server I worked for used 3 different bungees and they only had about 500 players being online at the same time
I never learnt about proxys, even in my network class. pandemic shortened everything
think about bungee as this: it makes the servers more relaxed and it makes the devs much more stressed
lol
that's a proxy in a nutshell
I don’t know much about networking but surely hypixel isn’t able to route all that traffic through one point
bungee makes dev caffeine consumption increase
Yet you connect to 1 ip so idk
yeah of course they use a ton of proxies
as said, even the tiny 500 concurrent player server I used to work for used 3 bungees
were you talking about CommandExecutor or the Preprocess event one?
But then how can you connect via 1 ip
Do hypixel use spigot ?
or both
probably their own implementation as well
I see
hypixel uses their own paper fork IIRC
So the DNS routes to multiple IPs?
kinda, yes
thought u were going to bed @tender shard
I thought so too
@young knoll I'll explain SRV in a nutshell
normally you enter domain.com and it returns you one IP
with SRV records, you can do something like: you enter domain.com and it returns:
1.2.3.4
or
2.3.4.5
or
3.4.5.6
it's called "round robin"
using purpose of command in the event
But it seems to have the /find command which is from Bungee
the client then chooses one of those IPs at random
sometimes it takes the first one, sometimes the second, etc
the ips are in a list then the index is choosed by a random next
yeah but it's actually the client to decide
how they manage to do this clientside
well the client simply gets 3 (or 8, or 129) IPs and then just decides for one randomly
?
How do you manage to change the server version in the debug screen btw?
You can do that easily with a fork
packets
would a preprocessevent be the way to go or?
For?
You can do it with packets too, yes
create a command if you want to give custom item to player
I saw a plugin that lets you put placeholders in there
ugh I dont like you everyone. now I have to drink another beer and stay online for 20+ minutes
hello, does anyone know how I can prevent the command from repeating in this way?
lmao pufferfish fork. i find it so funny
Never heard of pufferfish before
with a commandexecutor or PlayerCommandPreprocessEvent though?
as a server admin or as a plugin author?
its a paper fork.
ahh
Everything is a paper fork
(all those forks will die at sometime. stay with paper)
i think send-namespaced in spigot.yml turns that on/off
CommandExecutor of course, listening PlayerCommandPreprocessEvent isn't actually creating a command
its not very well known, its @quaint mantle that initiated me to it
ah
yes
author
how do i access if they entered /give tho?
You can use the PlayerCommandPreprocessEvent
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandPreprocessEvent.html
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
how do I go about getting the maximum health of an item? Damageable doesn't seem to have it, I think I am on the right track with event.getItem().getItemMeta().getAttributeModifiers(Attribute.GENERIC_MAX_HEALTH);, but this returns a collection of AttributeModifiers. I expect there would only be one for this guy
I believe
Read a tutorial how to create a command first https://www.spigotmc.org/wiki/create-a-simple-command/
hey guys, looking to crowdsource an idea, so far everything ive tried hasnt worked.
i'd like to have items floating above players heads, pretty much by having them equipped as passengers. issue is, you can see the items in first person clipping through your head since they start at an awkward position.
does anyone know a good possible workaround?
I am creating a command outside of plugin.yml.I need the command to be in the list
ik how to already. im setting up a fairly large plugin for my server and it already has some cmds
Max health of an item?
yup like a Damageable should have a maximum durability right
make the item invisible if player is in first person view
idk if its possible
but there doesn't seem to be a way to get that value
I'm not sure I understand
Create a command to give player a custom item then
can do something derpy like what i've seen sethbling do and have the item riding an invisible armor stand riding the player, to get some extra height
Material.getMaxDurability
Or something like that
I am creating the command outside of plugin.yml, and doing it the command autocomplete in chat returns the duplicate command to me. instead of just returning "global" it returns "global:global"
Thank you, @desert loom btw
i tried this but its so bad and a bit too tall, do you by any chance have a video?
you cant i tried 😦
maybe i didnt try a proper way, i think i used like hideEntity and it caused issues like dropping the item
if player press f5? @quaint mantle
no, the sort of things he did was years ago and with command blocks...
if it's too tall though you could try a baby armorstand
idk if you can know the keys the player pressed
did this too
whats the right way to compare two itemstacks to make sure they're the same? even extra data like enchantments, fireworks data, etc
.equals
i need to ride another item ontop of it - when i do this and hide the first passenger, the others just fall on the floor
Probably because the command isn't registered to any plugin?
can do it with packet trickery afaik, i did it for mouse movement once
ItemStack#isSimiliar or ItemStack#equals
universally, equals is the best option
hmm I used isSimilar but something is wrong. I'll check again
it's pulling wooden swords without enchants when compared to a wooden sword with enchants
Ohh, look what came out
really?
bizzare
isSimilar should compare everything bar stack size
It is very probable. the problem is that the command can be changed from the configuration so I can't register it in the plugin.yml
ya there must be some flaw in my code because I have isSimilar
Look into a command framework
You can also inject into the command map yourself, but you should avoid that
Yeah, I believe you'll still use PlayerCommandPreprocessEvent
Aliases is useful you know
1 min, i think i still have the code somewhere
do someone made a plugin in kotlin here except me
that's really cool would love to learn hwo you did it if u have it
np
I doubt it. solve my error and it will not be repeated but only because it would not come out and now haha
Is this part correct?
p.getInventory().addItem((ItemStack) items);
}```
give me a sec to clarify
Idk what you mean by that but anyway. I'd have to write it out but PlayerCommandPreprocessEvent along with TabExecutor should work
class org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack cannot be cast to class org.bukkit.entity.Damageable (org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack and org.bukkit.entity.Damageable are in unnamed module of loader java.net.URLClassLoader @6a4f787b) What exactly is goin on here....... That error message confuses me a little
ok ya this code of mine was ancient... it was from an era where wool colors were determined by durability
Ah holup, damageable inherits from itemmeta not itemstack
i think i need to create a target player var too so theres that
The old days. I forgot about that but I remember when they changed that and plugins started to break. World Edit, namely
Well, same issue with ItemMeta. complains about an unnamed module of some kind?
found the code, but its really old and idk how usable the code is now
also do i need the ItemStack get() for anything?
wrong damageable class I think, there is an entity damageable and a inventory damageable 😉
is it bad to use command.equals(args)?
How would that work
also gn
...are those even the same type?
what is command in this context?
you should never compare two variables that are not of the same type due to the contract of equals
I would guess it’s a command
(the reason it requires you pass Object is that it is a pre-generics method, obviously)
I mean most equals impls should handle it gracefully
But it’ll never be true, you can’t compare a ham sandwich to an airplane
it'll usually always return false, but yes
this is bc it has to cast the second value to compare fields within stuff like IDEA's automatic implementation
im trying to get if (command.getName().equals("give")) && command.equals(p.getDisplayName() + heart_of_war)
i probably did the second part wrong anyways
always use equals on String
Yeah the command is probably not going to equal a string
don't do this tho command.equals(p.getDisplayName() + heart_of_war)
you're comparing a command class to a String
how would i do it?
which is invalid
And by probably I mean definitely
this got burried, headed to bed now, but if anyone knows feel free to ping me
equals is suppose to be used to verify if the object that called equals is equal to another object
right
equals is value comparison, == is identity comparison
i guess i got saved somehow periodally, but, on power off shit happens
yes
value comparison = comparing the values of the two instances
identity comparison = comparing the references of the two instances
I would imagine pdc is saved with the rest of the object
which is why you don't use == on String
So chunk save for chunk pdc, player data save for player pdc, etc
because it's never guaranteed that will be the same String in the heap.
so with string, I must always use equals ?
yes
For simplicity sake, yes
IDEA automatically warns about it but ye
ok nice, i was hoping that was the case, thanks and goodnight
c# is the same thing right its the same concept
idk why it would be different
You can actually make strings identity comparable
interning ✨
But that’s not important to worry about here
but never use .intern(), it actually has some pretty bad performance costs
it's better to use stuff like Guava's Interner
Good to know
I’m not even sure what the use case is
Strings that are used a ton I guess?
yeah
anyone know a good npcs plugin for 1.17? i was using znpcs but after putting it on my server instead of my pc, it just gave me a bunch of errors
Citizens
preferably not paid
tried that aswell but it kept giving me errors, ill try once more tho
this always happens
the server runs at ~4gb of ram usaged normally then when i spawn an npc it jumps to 8gb
which is how much ive allocated to it
indeed.
optimization
its not my plugin lol
There’s no way citizens uses 4GB of ram to spawn an npc
want me to record it
decompile the plugin and make your own
That would be a level of incompetence so great the universe would have collapsed into a singularity
you can just build Citizens yourself
Don’t even need to
Just grab it from Jenkins
oh
after i spawn an nps lol
Yeah I feel there is something else going on
i am so close to committing
I used to run citizens on 4GB just fine
i did lol
Did u fix it @sick herald
found a random plugin that kinda works so its fine
Citizen is a well known plugin I dont understand why it does this to u
Maybe u spawned too much npcs
Have you tried a diff version
hey guys, i have coded a plugin to join a team via the /status command, but now a death scoreboard isn't displayed anymore in the tablist can someone help me?
here the code:
import commands.commands;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
public class Tab {
private static Scoreboard sb;
public Tab() {
}
public static void setScoreboard() {
sb = Bukkit.getScoreboardManager().getNewScoreboard();
sb.registerNewTeam("001LIVE");
sb.registerNewTeam("002REC");
sb.registerNewTeam("003AFK");
sb.registerNewTeam("004REDSTONE");
sb.registerNewTeam("005MINING");
sb.registerNewTeam("006RP");
sb.registerNewTeam("007GOD");
sb.registerNewTeam("008FARMING");
sb.registerNewTeam("009VC");
sb.registerNewTeam("010DEFAULT");
sb.getTeam("001LIVE").setPrefix("§f[§9LIVE§f] ");
sb.getTeam("002REC").setPrefix("§f[§cREC§f] ");
sb.getTeam("003AFK").setPrefix("§f[§7AFK§f] ");
sb.getTeam("004REDSTONE").setPrefix("§f[§4REDSTONE§f] ");
sb.getTeam("005MINING").setPrefix("§f[§bMINING§f] ");
sb.getTeam("006RP").setPrefix("§f[§dRP§f] ");
sb.getTeam("007GOD").setPrefix("§f[§6GOD§f] ");
sb.getTeam("008FARMING").setPrefix("§f[§aFARMING§f] ");
sb.getTeam("009VC").setPrefix("§f[§5VC§f] ");
sb.getTeam("010DEFAULT").setPrefix("");
Iterator var0 = Bukkit.getOnlinePlayers().iterator();
while(var0.hasNext()) {
Player all = (Player)var0.next();
setTeams(all);
}
}
private static void setTeams(Player player) {
String team = "";
if (commands.livers.contains(player.getName())) {
team = "001LIVE";
} else if (commands.aufnehmer.contains(player.getName())) {
team = "002REC";
} else if (commands.afks.contains(player.getName())) {
team = "003AFK";
} else if (commands.redstoner.contains(player.getName())) {
team = "004REDSTONE";
} else if (commands.miners.contains(player.getName())) {
team = "005MINING";
} else if (commands.rper.contains(player.getName())) {
team = "006RP";
} else if (commands.gods.contains(player.getName())) {
team = "007GOD";
} else if (commands.farmers.contains(player.getName())) {
team = "008FARMING";
} else if (commands.vcs.contains(player.getName())) {
team = "009VC";
} else {
team = "010DEFAULT";
}
sb.getTeam(team).addEntry(player.getName());
player.setScoreboard(sb);
}
}
How would i tab complete a players name?
@CommandAlias("crown")
public class crown extends BaseCommand {
@Subcommand("on")
@CommandPermission("untitledplugin.crown.on")
@Description("puts a crown on the specified player")
public static void onCrownOn(CommandSender sender, String[] args) {
Player p = Bukkit.getServer().getPlayer(args[0]);; // Person to be crowned
if(p.isOnline()) {
p.sendMessage(ChatColor.GOLD + "You have been crowned!");
} else {
sender.sendMessage(ChatColor.RED + "Player Must Be Online");
}
}
@Subcommand("off")
@CommandPermission("untitledplugin.crown.off")
@Description("takes the crown off the specified player")
public static void onCrownOff(CommandSender sender, String[] args) {
Player p = Bukkit.getServer().getPlayer(args[0]);; // Person to be crowned
if(p.isOnline()) {
p.sendMessage(ChatColor.RED + "You have been un-crowned!");
} else {
sender.sendMessage(ChatColor.RED + "Player Must Be Online");
}
}
@Default
@HelpCommand
public static void onHelp(CommandSender sender, String[] args) {
sender.sendMessage(ChatColor.RED + "Usage: " + ChatColor.GRAY + "/crown <on/off> <player>");
}
when doing this:
public void kothTimer() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.runTaskTimer(KothMain.getInstance(), new Runnable() {
@Override
public void run() {
for (Player tempPlayer : KothMain.getInstance().playersInBorderList) {
KothMain.getInstance().playerTimer.put(tempPlayer, KothMain.getInstance().playerTimer.getOrDefault(tempPlayer, 0) + 1);
System.out.println(KothMain.getInstance().playerTimer);
}
}
}, 20, 20);
}
it goes up by 12 every second
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1188}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1189}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1190}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1191}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1192}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1193}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1194}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1195}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1196}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1197}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1198}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1199}
[10:34:46 INFO]: {CraftPlayer{name=Oscimate}=1200}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1201}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1202}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1203}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1204}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1205}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1206}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1207}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1208}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1209}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1210}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1211}
[10:34:47 INFO]: {CraftPlayer{name=Oscimate}=1212}
argh, that made no sense. could you give an example 🙂
How can i can execute all events in a new Thread?
java.lang.NoClassDefFoundError: net/minecraft/network/chat/Component
at devs.sparepartsmrflyn.ClashwarsAddon.Main.setupManager(Main.java:548) ~[ClashwarsAddon-1.0-SNAPSHOT.jar:?]
at devs.sparepartsmrflyn.ClashwarsAddon.Main.onEnable(Main.java:62) ~[ClashwarsAddon-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:563) ~[paper-1.18.1.jar:git-Paper-77]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:477) ~[paper-1.18.1.jar:git-Paper-77]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:727) ~[paper-1.18.1.jar:git-Paper-77]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:503) ~[paper-1.18.1.jar:git-Paper-77]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[paper-1.18.1.jar:git-Paper-77]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1202) ~[paper-1.18.1.jar:git-Paper-77]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-77]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.network.chat.Component
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
```
I couldn't see it in there, I might be blind though 😆
i followed the nms tutorial posted in spigot forums but its still not working can someone tell me the fix? it compiles fine
?
Can you give me an exmaple?
Executor executor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true).build());
executor.submit(() -> {
MyEvent event = new MyEvent(…);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
//TODO
});
The code dont't work when i try to use it
I can't use new ThreadFactoryBuilder
Quick question: so, I was trying to remove all the tab completions (namely the "minecraft:", and "bukkit:" as others are hidden by a perms plugin) but I have a concern in the way I am doing it.
Wouldn't this remove the help map globally? How can I do this for just one player? (The last line)
But i have to use it because i do a lot of things in this event that make the server lagging
No that’s now how threads are supposed to be used
You have to optimize whatever you do first
Not just, oh it lags, let’s do it on another thread
Because you’re simply neglecting thread safety now
I get the location and append it to an string builder evry 10 seconds
that shouldn’t lag at all
And than every 10 mins, i safe the string builder to an text file
Oh well
Then just do the save operation asynchronously
And for the 10 min and 10 sec, use the BukkitScheduler::runTaskTimer
Yes i k ow i do that alredy
How can i do that
Hey, Conclure, thoughts?
PlayerCommandSendEvent won’t remove the commands for every player
Or well if you remove then in the callback
Okay, thanks
But yes the help map would be cleared globally
oop
I think?
Know any way to get around that?
I suppose I could just block each command individually but I feel there should be a better way of doing that
No not really, but why would you remove something from the help map?
I don't want players who don't have permission to see all the plugins and their respective menus
Hmm, well, sadly Bukkit haven’t implemented a per player help map feature
So you could inject your own implementation of HelpMap which does this I think altho that’s quite unsafe
Or just block the /help permission
^ Yeah, I'll prob just do that
what will this load?
YamlConfiguration bukkitYml = YamlConfiguration
.loadConfiguration(new File(Bukkit.getWorldContainer().getAbsoluteFile(), "bukkit.yml"));
the bukkit.yml ile in the server root?
Yes if the world container is the same directory as the server root directory
However, on startup, it might be changed
(World container)
So you could just new File(".","bukkit.yml");
ok
also is it worth using multiple databases at the same time
i saw a plugin for a big server doing it
Depends what type of databases we talk about
Because different ones have different purposes or well, use cases
hmm yes and no
The word database is still quite an abstract word
i guess if you like to keep them clean but unless ur expecting a huge amount like 100k requests per minute i doubt it will matter
that wont happen
then im not sure its worth the husstle
i'm also wondering
FourteenBrush
For instance we have flat files which work great to store configurations, then we have in memory databases which work great as caches such as redis. We also got the non relational databases and are usually used to store unstructured data namely mongodb, then we got the relational ones such a mariadb, mysql and postgre. 
Well, point is, there are a lot of them, not all are fit for x purpose
true
hey, can anyone help? i use "shadow("com.github.InventivetalentDev:MineskinClient:1.1.0-SNAPSHOT")" in my build.gradle.kts but when i start server it throws ClassNotFoundException
Do you use shadowJar?
i use this plugin id("com.github.johnrengelman.shadow") version "7.1.1"
and just add that line in dependecy
shadow("com.github.InventivetalentDev:MineskinClient:1.1.0-SNAPSHOT")
Well use implementation then
it throws the same exception
you need to build with shadowJar as opposed to build or normal jar task
oh it worked, thanks
I hate InventoryDragEvent
its clunky
and doesnt want to work properly
since its fired in the middle of inventory calculations
does PotionEffect::getAmplifier() start counting from 0 like the command or 1 like the display?
also event.getNewItems() for some reason is wrapped as unmodifiable
why we couldnt modify what items are being added to inventory in the drag
now i need to make a new task which runs 1 tick later to execute the code after the cancellation of the event
because event.setCursor() just says fuck you
if the event is cancelled
and inventory.setCursor() doesnt work, since its in the middle calculations
I am so triggered that my IDE doesn't know the words teleport and cooldown and keeps trying to suggest autocorrections
literally unusable
give me my money back jetbrains
workin fine for me
huh
oh i have typos check thing disabled
does it not complain when you set it as a variable name
🤡
well that too
does PotionEffect::getAmplifier() start counting from 0 like the command or 1 like the display?
0, potions are 0-indexed
don't ask why
I mean not even indexed
they start counting at 0, it's not even a list
I look forward to when minecraft will add set bonuses that start counting at -5
do you guys get annoyed when IDE suggest that this object could be null
but you know from cirucumstances thats impossible, since method inside it doesnt allow that
I used to get annoyed until some very "special" item plugins managed to make those impossible nulls possible
also fake player entities
just spawn in via packets
but then how will they attack other server entities and be attacked by them
ignore it.
i made server entity tracking fully possible in packet level
I'm unironically currently unravelling all the stuff I "just ignored" for 4 years
but im too dumb to code pathfinders yet
but im keen on developing pvp bots
in the future
not that it really matters but I just want the code to be more uniform and better in general
still... 2879 issues to go
nms
do you mean advancement?
boy sonarlint does not like modifying static fields from non-static methods
or you can use those librabries
https://www.spigotmc.org/resources/ultimateadvancementapi-1-15-1-18-1.95585/
i believe 1.8 achievements are deprecated and clientside
while advancements are serverside
how do i check server version? like 1_14_R1?
/**
* Compares a Minecraft version with the current version on the server. Returns true if the version on the server is older.
*
* @param majorVersion Target major version to compare (i.e. 1.>>>17<<<.0)
* @param minorVersion Target minor version to compare (i.e. 1.17.>>>0<<<)
* @return Whether the version is under the value to be compared
*/
public static boolean serverVersionOlderThan(int majorVersion, int minorVersion) {
String[] splitVersion = Bukkit.getBukkitVersion().split("[.]");
int actualMajorVersion = Integer.parseInt(splitVersion[1].split("-")[0]);
int actualMinorVersion = 0;
if (splitVersion.length > 2)
actualMinorVersion = Integer.parseInt(splitVersion[2].split("-")[0]);
if (actualMajorVersion < majorVersion)
return true;
if (splitVersion.length > 2)
return actualMajorVersion == majorVersion && actualMinorVersion < minorVersion;
return false;
}
ayy
quick n dirty
there's no simpler method out here
it uses NMS to provide you an API
since spigot api doesnt provide you one
NMS is a native minecraft server
its the guts of your server
these apis use internal minecraft methods to get advancements working
thats OBC not NMS (CraftBukkit internal methods)
NMS goes deeper than OBC
too deep
OBC is the wrapper around NMS, Bukkit is an API provided around OBC
wrong
ok
better
stare into nms code for too long and it will stare back at you
craftbukkit implements the bukkit api
because spigot dont use mojank mappings so it is really curse lul
thats not debatable, lmao
there is literally doc there
you're dwight like persona
craftbukkit literally implements the bukkit api
^
anything is debatable if you're willing to be wrong
wait do you know java? just in case
anything is debatable if you stink like magma
When i make a thread in my plugin, how can i change the name of it?
mank
i want to ask you this
ladies faint when I enter a room
toto
from the stench
it's very inconvenient and has gotten me banned from most enclosed spaces
not only ladies, everything in a 5 m radius just ceases to exist 😄
you guys just can't comprehend my true power level
it is beyond you mere mortals
I belong up there with shaggy and rich evans
I had to google who that is
you's uncultered
(rich that is, I do know shaggy, lol)
no scooby doo is bae
they are all bae, as am I
now I need to rewatch this https://www.youtube.com/watch?v=bdneye4pzMw
Watch Sting And Shaggy play "Englishman in New York", "Don't Make Me Wait" and "Shape of My Heart/Lucid Dreams" at the Tiny Desk.
Watch Tiny Desk Concerts ONE WEEK before they go on YouTube at https://www.npr.org/tinydesk
Follow NPR Music:
Twitter: https://twitter.com/nprmusic
Instagram: https://www.instagram.com/nprmusic
July 10, 2019 | Jo...
you need to go watch every single rlm video several times
I wonder who does the mixing for tiny desk
gimme one vid and ill consider it
hm
lets switch to #general tho before mods get angry
mods never get angry at me, I'm too kawaii
stop the server, lol
ye but like such a trek
like i can disable the plugin with plugman and then upload it but its kinda annoying after a while
that's a cool way of getting your server to crash
boi why. i can import them, why doesnt it compile?
@EventHandler
public void join(PlayerJoinEvent e) {
String UUID = e.getPlayer().getUniqueId().toString();
e.getPlayer().getServer().broadcastMessage(UUID);
e.setJoinMessage("hi "+e.getPlayer().getName()+" :)");
if(UUID.toString() == spaceID.toString()) {
e.getPlayer().getServer().broadcastMessage("this message SHOULD only run when i join.");
}
}```
i have this code to test stuff
but the server doesnt run this?
if(UUID.toString() == spaceID.toString()) {
e.getPlayer().getServer().broadcastMessage("this message SHOULD only run when i join.");
}```
the UUID is the right id
.equals not == on Strings
is it possible to check if a specific structure exists in the world? I once wrote my own method but i wonder if there'S a simpler solution
at specific coords
no simple way, no.
is there a way to convert a structure into a 3d array of materials/blocks?
or do i have to get such an array manually too?
read teh post in #announcements about nms and special source
Hey! short question:
i try to create a plugin, where its possible to claim a Minecraft biome like in CityBuild. For that i thought if use a tutorial of creating a citybuild plugin i can create this plugin too. Unfortunately i couldnt find a tutorial for this on google. Does anyone happen to know of a tutorial I could use for this?
What do you mean by “claim” a biome?
should i use interactentity or interactatentity for invisble armor stands?
so that only the player who claimed it can build in this biome
what packet will be sent to the server when someone loads a hotbar in creative ?
when i do
server.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
public void run(){
if (KothMain.kothStarted) {
KothMain.getInstance().kothTimer();
}
}
}, 20, 20);
``` and
```java
public void kothTimer() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.runTaskTimer(KothMain.getInstance(), new Runnable() {
@Override
public void run() {
for (Player tempPlayer : KothMain.getInstance().playersInBorderList) {
KothMain.getInstance().playerTimer.put(tempPlayer, KothMain.getInstance().playerTimer.getOrDefault(tempPlayer, 0) + 1);
System.out.println(KothMain.getInstance().playerTimer);
}
}
}, 20, 20);
}
``` it runs the sout multiple times a second instead of just once a second any ideas on how to fixc this?
Not really easy. Two biomes next to each other can be the same and theres no way to tell where one ends and another begins.
biomes also have height now so you can have two biomes on top of each other
so it would only be about the biomes at the surface. there everything should then be claimed up to the very top and bottom
You can still have two biomes next to each other of the same type
That would just be considered one biome
if you are ignoring biome changes top to bottom there is no point in claiming a complete biome on teh plane
Most claim plugins do it by chunk or defined area
trying to do it by biome is going to be wildly inaccurate
if i have an npc and armorstand in exact same position, how can i handle click on armorstand?
i guess this is the click thing
how to check if it is loading a hotbar
PacketType.Play.Client.SET_CREATIVE_SLOT
Is what I use to detect items being created in creative
read the post in announcements about nms and special source
I don’t think you can technically detect a hotbar load
yeah okay. Then i will try it with chunks. Thanks first of all for your help.
how do I connect intellij to a git repo? I have already created the git and local repo
how do i add npc right click handler with plain nms (NO API)
spigot is an API, so i doubt you will find people here that will tell you not to use an API, i suggest using PlayerInteractAtEntityEvent or PlayerInteractEntityEvent. If you need left clicks you can use EntityDamageByEntityEvent
(all of these suggestions are part of spigot, which is an API)
no no no no no you didn't get me, by api i mean external dependencies like protocollib, also npcs don't get detected by spigot, because they are made via NMS and only for specific players
ok, thought you meant villager when you said npc.
my apologies, im not sure how you'd be able to do it if the npcs are fictional things on the serverside
i need to listen to packets, and there's plenty plugins providing such APIs but they all are external dependencies which i want to avoid
if you scroll up a bit i made a thread that says some of the info about how i went about making a packet handler, i didn't provide much info because i was unsure if it was outdated, but it might help
(assuming you do need packets)
Hey guys, is there any way to know what noteblock sound is associated with a material? I can't seem to find a way to get that sound programatically, without hardcoding this table https://minecraft.fandom.com/wiki/Note_Block
which citizensapi version shud i use to work with 1.14-1.18.1?
latest i guess?
ok guys
my life is a lie
did you guys knew that inventory splitting doesnt care how much are there in the itemstack
everyone's life is a lie, exept for mdaddy_5
you can literally split 64 items into three pieces and go through stack via mouse
and it would still split to 3 equal parts
21 + 21 + 21 = 64
it doesnt care if the splitting available slot is full or not
well atleast cursor is updated
but this makes no sense that client doesnt recalculate the values of the splitting slots
I'm trying to get a basic clear command to work but my server keep throwing this error that it cant register the command even though I've got the command executor setup properly from what I know, I've looked around but cant find whats causing the issue?
Console error : https://paste.md-5.net/aminexipam.coffeescript
Command: https://paste.md-5.net/lurimokaqu.java
Executor: getCommand("clear").setExecutor(new ClearCommand());
it should be: NETHERITE_BLOCK x 31, NETHERITE_BLOCK x 64, NETHERITE_BLOCK x 31
CURSOR: NETHERITE_BLOCK x 1
instead it just gives up recalculating the slots
anyone know wtf? java.lang.ClassCastException: class net.citizensnpcs.Citizens cannot be cast to class net.citizensnpcs.Citizens (net.citizensnpcs.Citizens is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @7c465a52; net.citizensnpcs.Citizens is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @4a60d822)
CitizensAPI.setImplementation((Citizens) Bukkit.getPluginManager().getPlugin("Citizens"));
npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "Test");