#help-development
1 messages ยท Page 283 of 1
still want it in a paste haha
I'm pretty sure that's not possible with plugins, unless you put the item on an invisible armorstand, place it correctly in the shulker box and let it move/animate/rotate
fair
It is possible with trickery as usual.
exactly
putting a block in a minecart and making it invisible go broom
yeah
but then you'd have to make the item fram einvisible
when i added plugin (in my neparth server) and restarting server after and joining the server and doing) /plugins and is saying 0:( plugins (used spigot plugin downloaded one! and is not working
link plugihn
@remote swallow you know why it's crashing?
There's not really enough information
theres no stacktraces in console so ive got no clue
try waiting a tick
also pass a double not an int
do me a favor and print Thread.getDefaultUncaughtExceptionHandler()
I want to recreate something like this, you can see a glowing item floating in the shulkerbox
And how can i let the items "explode" out of the shulker and put it on the ground, and that you cant pick it up
ddg lmao
oh that, thats just spawning an item
I cant even find the function player.damage in the documentation
didnt know id see someone who plays on there
and cancelling pickup events
declaration: package: org.bukkit.entity, interface: Damageable
u can just set the item pickup delay absurdly bif
big
ohh thanks
oh lol
And cancel pickup for it, to get the best of both worlds, lol
Just cancelling pickup alone would result in a thousand calls to that event, so I'd definitely set the delay, yes.
Is there a different way to deal damage?
thats 1.19.3 api
not 1.17.1
player#setHealth
declaration: package: org.bukkit.entity, interface: Damageable
its also in the 1.17 docs
declaration: package: org.bukkit.entity, interface: Damageable
hm
๐
Why does this shit always happen to me
How?
hello anyone?
Citizens
any errors in console
any other plugins
just one plugin i added the npc plugin but doesnt working
?paste latest.log from after a restart
a link to the paste site
i open the link?
restart your server, open latest.log, press control and A, press control and c then open the link, press control and v then save it and send us the link
how to send the link
But will it explode out of the block like in the video?
you would have to tp it
idk how to do that tho .-. pretty bad at making servers .-.
But will it go in random directions then? Because it need to be like 5 items
you would have to do the math for it
do you know how to restart your server
I will try it thank you!
do you know how to open the server files
yea ik how to open file manager
go to the logs folder
find the one called latest.log
open it
How can i tp it tho
havent done it before but i would guess you need to get the entity of the item stack in the world
ok opended it and now next?
copy the entire file and send it on https://paste.md-5.net
copy file of the plugin or just everything in the logs folder?
copy the contents of the latest.log file
can i send on private dm to you screen shot of it so i doing it right?
sure
Hey, this may sound absurd but is it possible to force players to refresh the server resource pack?
Any ideas why this isn't working? The part marked with a cross does not work.
i cant send here
?img
Not verified? Upload screenshots here: https://prnt.sc/
you can dm me if you want
Player#setResourcePack iirc
and follow naming conventions
thanks
Is it possible to generate a resource pack in a plugin and then send it to the player?
hm
you'd have to generate all the json files, make a zip, then host it somehow
Do I really have to host it? Dang
the client needs a URL
ye this
? just use packsquash to "protect" them then
that doesnt make sense though
the textures can be accessed by anyone who downloads your resource pack
whatever nothing is free
Can I have multiple server resource packs at the same time?
Dang
You can combine them
How can I simulate block placing with an item?
I mean this, using paper place for example deepslate
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
You might want to call the BlockPlaceEvent too to make sure that worldguard etc. will block the action.
@gleaming grove Btw, in case you're interested: I've now played with proguard to eliminate dead code, this is the configuration I've ended up with: https://paste.md-5.net/kepezehaca.xml, while using this as my proguard config: https://paste.md-5.net/unevafucun.coffeescript
The shaded jar had a size of 50K while the shrink could get it down to 36K. May not be impressive to many, but that was only one (and my smallest) lib. I'm planning on doing much more than that. Seems like a nice setup, as it doesn't take much longer than usual and I do not have to take any extra steps. "It just works".
thanks that will be useful for me in future
What is the best way to move an entity to a Location?
without teleporting
like actually move it
@remote swallow player.setHealth(1.0); worked, no crashes anymore. But now I'm wondering why .damage doesn't work ๐
Anyways, thanks for the help ๐
How can i do this sound?
loads of noteblock sounds
what was your code?
i would guess it was a 1.17 issue
Do you maybe know wich sound that is?
theres a lot in that
that isnt just one sound
its a lot of noteblock sounds with different pitches and type of noteblock
Oowh oof i think i cant recreate that
Yepp
@remote swallow Do you know a good way to move an entity to a specific location without teleporting the entity?
without teleporting i cant think of any good ways
simple, remove them from the world and respawn them at the new position
is there a way to set a target for a vector?
thats like teleporting
well i mean idk how else u plan on moving them
summon invisible colidable blocks and pray
true, i was actually thinking a long path with flowing water
it may take a while but
is there a way to set a target for a vector?
a vector is just a direction with a length
Can I focus the vector on a location?
you can calculate a vector between two locations
how can I do that?
its probably better you tell us what you are trying to do
calculate the distance you want and create a vector with the distance
Location loc = block.getLocation();
if (block_face.equals(BlockFace.UP)) {
loc.add(new Vector(0, 1, 0));
if (loc.getBlock().getType().equals(Material.AIR)) {
return loc;
}
}
else if (block_face.equals(BlockFace.DOWN)) {
loc.add(new Vector(0, -1, 0));
if (loc.getBlock().getType().equals(Material.AIR)) {
return loc;
}
}
else if (block_face.equals(BlockFace.EAST)) {
loc.add(new Vector(1, 0, 0));
if (loc.getBlock().getType().equals(Material.AIR)) {
return loc;
}
}
else if(block_face.equals(BlockFace.NORTH)){
loc.add(new Vector(0, 0, -1));
if(loc.getBlock().getType().equals(Material.AIR)){
return loc;
}
}
else if(block_face.equals(BlockFace.WEST)){
loc.add(new Vector(-1, 0, 0));
if(loc.getBlock().getType().equals(Material.AIR)){
return loc;
}
}
else if(block_face.equals(BlockFace.SOUTH)){
loc.add(new Vector(0, 0, 1));
if(loc.getBlock().getType().equals(Material.AIR)){
return loc;
}
}
}``` I created a function that returns the Block Location. But says: "Missing return statement".
you have no else statement
theres a chance for none of those to be correct according to intellij
else {return null;}?
yeah
Yes, that's what I did now.
"block_face" this isnt python, get outta here with that snake_case!
camelCase*
takes too long to type
okey XD
dont hate others for other conventions its just a way to do it if you like
?conventions
i can and i will
conventions may be thrown out the window when youre coding for yourself, but that doesnt mean you should throw them out the window
using them in all cases would make code better and easier to type
what if he codes easier with his conventions?
btw you can say it more nicely and not just "tHiS iSnT pYtHoN"
unless a keyboard has the underscore near space bar i doubt its easier to type
have you never heard of opinions "i" being the important thing im my statement
if u couldnt tell my initial statement was made with a hint of sarcasm thats on U imo
just give him a nice hint but not a rude answer you are like these big-ego-devs who thinks that they are better than everyone
meanwhile php:
bcadd
bind_textdomain_codeset
dngettext
getimagesizefromstring
image_type_to_mime_type
image2wbmp
can't get more inconsistent than php
oh yeah fuck php
well tru
i say as i write php
thats just the same as saying "fuck my life" while living
yeah
you cant say "fuck my life" while dead bcs when ure dead u cant speak
i almost said PHP instead of python too but then i remembered
i was like wait ive used not snake case methods in it
checking an isset and then two seconds later im calling file_get_contents
good old php conventions
bonus mention for PHP, the fucking non-english error name for when youre missing a semicolon??!
at least i think thats what the errors for
oh nvm its for the double colon (::)
T_PAAMAYIM_NEKUDOTAYIM
like what the fuck
@EventHandler
public void onLeaveBed(PlayerBedLeaveEvent event){
Player player = event.getPlayer();
player.damage(1);
For some reason, player.damage(); stops the server
nice
same thing
ah alright
theres a lot pre 1.18 ive seen that is just weird
I'm trying to update some numbers regarding timing in a sqlite database, but for some reason they seem like they aren't updating?
However, I get that the query should have been executed via my logging statement. I'm quite confused why the numbers aren't being updated
[11:11:27] [Server thread/INFO]: Updated island: 76d60884-afd9-406c-a2c0-b9569e81ad62in database // executes properly
[11:11:27] [Server thread/INFO]: Saving NodeBlockData at location LightLocation{worldName=SuperiorWorld, x=609.0, y=112.0, z=-8.0} with Data{LastUpdate=1672420287210, TickTimeLeft=3} // shows the data should be saving
[11:11:27] [Server thread/INFO]: Updated node at LightLocation{worldName=SuperiorWorld, x=609.0, y=112.0, z=-8.0} with type IRON_ORE, time left 3, last update 1672420287210 in database // shows the database query should be occuring
public void updateNode(final NodeBlockData data) {
try (PreparedStatement statement = connection.prepareStatement(UPDATE_NODE)) {
statement.setString(1, data.getType().getMaterial().toString());
statement.setLong(2, data.getTicksLeft());
statement.setLong(3, data.getLastUpdate());
statement.execute();
Bukkit.getLogger().info(() -> {
String message = "Updated node at %s with type %s, time left %d, last update %d in database";
return String.format(message, data.getLocation(), data.getType().getMaterial(), data.getTicksLeft(),
data.getLastUpdate());
});
} catch (SQLException e) {
e.printStackTrace();
}
}
note read only has to do with the vscode extension I'm using to read the sqlite database
your view probably aint updated
I refreshed it
i didnt see your name, saw vscode then was about to ping you
I had wrong code posted maybe there is an error in this one?
dunno if calling exec instead of execupdate affect the process
why tf are you logging with a supplier
Guys, whenever I try to type Material (already starting with M) my IntelliJ crashes
it just freezes
When I type M...
sounds like an intellij problem can't relate as I use VSCODE
sounds like intellij doesnt have enough ram or cpu power
How can I increase the allocated ram to intellij?
I have 16gb in total
as if intellij doesn't hog enough resources already
download sources
true
https://www.jetbrains.com/help/objc/how-to-adjust-cpu-cores-number.html you probably need this instead
have u ever tried to OPEN the Material class in intellij?
Thanks
it just fuckin dies
just said download sources
you dont say or show how
google is too hard
yes
double shift for every ij instruction
wtf do you mean with sources
source code
I can tell you to launch a nuke but you wont be able to without the instructions
why would I want to download source code
so you arent trying to decompile the material class everytime to get the values of it
executeUpdate call didn't fix it??
I'm so confused
just do a select again
its only 10k lines long
wdym I'm trying to update the entry though all other functions work besides update for some reason
I'm confused. How would downloading 'source code' (which can mean anything) help with not compiling the material class everytime
exec a select query and see the results
when you try and get the material enum, by typing Material. intellij has to probably decompile/call for the 10k lines of code that the file is
which intellij cant handle
Yeah I get that
it works as expected
downloading sources would mean you dont need to do that
I get the NodeBlockData object with expected values
And where can I find these 'sources'?
Sources can mean so many things
A source can be a link
sources can refer to source code and in code to which you can contribute or copy paste
a source can mean a place where you can get water
uhm in a programming context its pretty specific
you are overthinking also intellij should auto download sources
Google how to download sources intellij
k
So if I understand correctly, instead of having to reprocess the entire material class each time, by downloading sources it just gets stored on your pc and it remembers it which saves performance/data?
mr 14 brush
I am dumb ass
I forgot to set where its setting the data too ๐คฆ๐ฝโโ๏ธ
I'm going to go die now goodbye
Like I just sent an Update query with literally no target
[11:26:31] [Server thread/INFO]: UPDATE miner_nodes
[11:26:31] [Server thread/INFO]: SET node_type = ?, time_left = ?, time_stopped = ?
[11:26:31] [Server thread/INFO]: WHERE node_location = ?;
[11:26:31] [Server thread/INFO]:
[11:26:31] [Server thread/INFO]: parameters=[IRON_ORE, 3, 1672421191368, null]
"" In order to download sources on demand you need to select pom.xml and choose Maven->Download Sources". Did this, and it's still crashing when I type Mat...
just hit double shift and type download sources
Did that, but when I click the 'download sources' thingy, it doesn't give a loading screen or anything, it just closes the quick search tab and does nothing. It's still crashing when I type mat
just run maven manually
mvn dependency:sources dependency:resolve -Dclassifier=javadoc
I downloaded sources and documentation and it worked for a sec
now it froze again ugh
Where do I run this?
Im using jdk 19 or smth like that btw
in the directory where your pom.xml is
How do I disable the Tab Completer?
just don't create one
the auto-complete of names is client sided, you cannot really disable that
Can you disable the command-complete?
Reset a World: is it better to copy and repaste a world or track every action (BlockPlace, BlockDestroy) and reset the actions
just create an empty tab completer
i dont think that works
it does
just return a new Arraylist
why is the world i copied not air map but i copied an airmap??????
How do you use potion effects when using player.addPotionEffect()?
I know about Effect but thats not for potions
oh ok. all I know is that returning null does not work. but rather use Collections.emptyList()
player.addPotionEffect(new PotionEffect(PotionEffectType type, int duration, int amplifier))
orplayer.addPotionEffect(new PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient))
orplayer.addPotionEffect(new PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles))
orplayer.addPotionEffect(new PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon))
ohhh I see, thanks!
What would you fill in for PotionEffectType? It doesnt show autocomplete results
If, say, I want to give the player nausea
nausea is PotionEffectType.CONFUSION
idk why
declaration: package: org.bukkit.potion, class: PotionEffectType
Wow they really gotta make it even more confusing eh? Thanks for the link btw
NMS:
How i can get a entity by the ID?
(I've already tried World#getEntityById)
u sure you are healthy?
im sorry im not good in nms
Entity entity = world.getEntity(idd);
never used it
NMS, Not Bukkit
oh
but appreciate your help
never use an int for a counter when ur multiplying it with 10 lol
What is the best way to spawn something like skywars cages?
love the overflow
int max value my friends
What you mean with cages?
for loop to place cages (or remove them if they are a port of the map) store the locations in a config
I mean cages where players appears
I stopped programming for a year. I downloaded Eclipse now and use Spigot API, but it cannot read the code. Why?
https://prnt.sc/52tDYjaN1pfu
fix: download intelliJ (sorry for that)
i did
i'm already using intellij but i tried to use eclipse i have the same problem on both
what u use? maven gradle or artifact
What api mby?
Too old! (Click the link to get the exact time)
lol nice website
Minecraft 1.8.8 is 7 years, 5 months, and 7 days old today.
(2714 days)
lol
HAHA'
to long
thats long time
lol
And most people still use it for pvp..
btw if you upload code than pls the WHOLE CODE and not just a snipped of 3 words @quaint mantle
i soon deleting my whole email to my server hosting .-. beccuse i getting angry i cant make plugins i did right and no plugins there bruh XD
me: Using 1_8_R1 NMS to create NPC plugin xD
What i should use to spawn structures?
schematic
So you're not even using the latest 1.8 version ๐
Needs to be the minimal version to enable support for every single version after 1.8 ๐ xD
The NMS isn't too good, but its better than the nms from 1.16.5+
hashed ๐
you cannot just use 1_8R1 nms on anything above 1.18.3
Yeah i know
i will create every single mapping for every single version
until 1.19.3
Not even close
Modern nms is quite a bit better
I NEED HELP TO ADD NPC PLUGIN ON NEPARTH SERVER. I cant do it i tryed and is not workinggggggg
show us your problem
i installed it in the server and restarted server and i getting inside the mc server and doing /plugins and is saying 0 plugins
Citizens-2.0.30-b2857.jar
Use #help-server
this
why do you still use #help-development if you're not developing anything
BUT I DONT KNOW WHAT HE MEAN WITH START UP LOGSSSS
the file
then ask in #help-server
is there a way to wait in a while loop? I tried Thread.sleep() but that just crashes the server
latest.log in logs folder
?scheduling
choco u can most definitely render a map absolute to the player's screen with vanilla shaders
without needing the player to hold the map in their hands
lol fr
if u have it on a wall for example
they were most likely wondering how to send map packets to the player manually
is it possible to do that while for example a player is mid air?
why wouldn't that not be possible o0
Holy moly, what's that? Is that some kind of protocol-lib excerpt? Sorry if I don't recognize it immediately and the question sounds ignorant, xD.
Thats a old version of my NPC plugin, now its extremely better than that, but same concept
The new version contains a lot of classes as you can see that recreates the NMS
as you can see
Hmm, very interesting! Because I'm thinking about how I could create true version independence without creating interfaces and a specific impl for every single version, that just hurts. I thought about some kind of json files describing the structures, then using my class/method/field predicate builder to build these descriptions and get what I need, but I'd also need to describe the invocation-order, arguments and so on and so forth. Which is why I haven't actually accomplished much so far, been procrastinating, xD.
But it takes some size xD (its not 10% completed yet)
Please dont do that
hahahaha
that system gaved me brain hurts some time ago
I'd love love love to break through that tho
But hey, anyways, so cool that you're also working on version independence and are not just like "oh, hey, just 1.16+ for me"
Complicated, but when you get it, its easy
Yeah, i wanna do the best NPC plugin
some months of hard work
I could probably get something working quickly, but I want it to be the best possible, most elegant and most beautiful solution I can come up with, otherwise I'll beat myself up forever again because I produced a shitty implementation.
Oh yes, I feel that.
xD
Idk how I would have to keep track of time the player is in air and Idk how I could count it
Btw, is that plugin going to be paid or open source? I'd completely understand if it's the former tho, xD.
Is there a way to set a tag for a block?
open-source
Mind sharing the repo-link?
Its not on github yet, do you want the .jar at your DM?
Actually yes, I very much do, lol
Hope you use version control tho, not that you loose the project due to a disk failure, xD.
My projects folders are inside the Google Drive, its safe ๐
show your imports
nvm
you have to set a duration and an amplifier
duration and level
you could schedule a runnable every tick in your onEnable, then have a Map<UUID, Integer> of all players. loop over all players and check whether they are isOnGround(). If not, add one to their map value
Oh, right. Thanks
primitive generics when
Bukkit.getScheduler().runTaskTimer(this, () -> {
for (Player player : Bukkit.getOnlinePlayers()) {
if(!player.isOnGround()) {
if (/* player is on ground */) {
// remove player's uuid from map
} else {
// add 1 to player's fall time or set it to 1 if the map doesn't contain the player's uuid yet
}
}
}
}, 0, 1);
still waiting for pairs in java too
I need help! what is command (ingame) for create an NPC. with plugin citizens
why do you still ask in the wrong channel
.-.
How do I get an armor stand that is located at block coordinates?
getNearbyEntities ig
or if youre creating the armor stands map them by block location in a hashmap
I'd use a boundingbox
private static final Predicate<Entity> ARMORSTAND_PREDICATE = entity -> entity instanceof ArmorStand;
public static List<ArmorStand> getArmorStandsAtBlock(Block block) {
BoundingBox box = BoundingBox.of(block);
return block.getWorld().getNearbyEntities(box, ARMORSTAND_PREDICATE).stream().map(entity -> (ArmorStand) entity).collect(Collectors.toList());
}
I haven't checked how CraftWorld#getNearbyEntities works
plugin.getConfig().getStringList("Berserkers").add(player.getName());
plugin.saveConfig();
is that supposed to add a player to the config??
Thanks guys, I'll try it now
alternatively sth like this
public static List<ArmorStand> getArmorStandsAtBlock(Block block) {
return block.getWorld().getEntitiesByClass(ArmorStand.class).stream().filter(armorStand -> {
return armorStand.getLocation().getBlock().equals(block);
}).collect(Collectors.toList());
}
Hello guys
can someone please help me (Berserkers is a stringList saved in the default config)
I have a question, how can I change the messages sent by the console
It's not
what happened here
For instance, console sends โAn internal error occurredโฆโ I would like to change this message for other
How could I do it? Ty
why
no
that's going to add a player's name to the list you just got, without changing your config
I has added all needed api and still get this error https://hastebin.com/uvekizipen.less
libraries:
- org.reactivestreams:reactive-streams:1.0.4
- io.projectreactor:reactor-core:3.5.1
- io.projectreactor.netty:reactor-netty:1.1.1
- io.netty:netty-all:4.1.86.Final
- com.fasterxml.jackson.core:jackson-databind:2.14.1
- com.discord4j:discord-json:1.6.13
- com.discord4j:discord4j-core:3.2.3
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
then could you maybe tell me how do i make it work?
they seem hardcoded
Yeah they're both hardcoded
only way to change it is to intercept chat packets
Oh
I thought there could be an event for that
Happens the same with messages sent by other plugins?
For instance, world edit, if you want to replace the โYou cannot change blocks hereโ
some plugins can hardcode it, others make it configurable
you can still intercept chat packets and change messages
Do you have any tutorials for that or a wiki? Thanks
how do i save a players name in a stringList i cant seem to get it to work
by using add(String) on your List<String>
I earlier already told you that you have to change the actual config and not just the list you loaded
so e.g. like this
{
List<String> myListOfStrings = getConfig().getStringList("my-list-of-strings");
myListOfStrings.add("some new entry");
getConfig().set("my-list-of-strings", myListOfStrings);
saveConfig();
}
ok ill try that thx
how would i fix this?
it says its connected but i disagree
and reloading it without reloading the server isn't it
i've tried both ways
all it is:
client = MongoClients.create("URI");
database = client.getDatabase("SQLTest");
collection = database.getCollection("player_data");
Bukkit.broadcastMessage("Connected to MongoDB!");
Bukkit.broadcastMessage("Collection: " + collection);```
is a hashmap thread safe if im only reading not writing?
or should i still go with concurrenthashmap?
Yeah it is
I mean... that depends on whether or not it's being written to from another thread
If you want a thread-safe map, yeah, you'll want to use a ConcurrentHashMap
I write to it on load and then read from it after that
from multiple threads
but i dont write to it
Right so it's never changed while you're reading from it?
nope
Yeah then you're fine
great ty:)
I want to write in my own way so that I can at least understand something here. And my code doesn`t work. I created HashMap<Location, ArmorStand>. And when I summon armor stand, it adds. But when I tested it, ArmorStand is null.
What is the warning on the Block#getLocation line 23?
block might be null
whenever youll click in the air, youll get a nullpointer exception
ah theres a check
dunno if air block counts as block too ๐
Im getting this error on my bungeecord server with nuvotifier
If event.getClickedBlock() != null before everything:)
Man, it feels so weird to just now have found out about the java.util.StringJoiner, :-:
Could've saved me so much manual work.
You to me?)
Oh, no, I just said that generally, as I guess there are other people too not knowing this helpful utility.
How would I display an empty player in tab list?
What version?
yeah haha
I already knew of those options tbh
Why NMS? Api itself allow it
Oh not sure tho
So, exactly why are all events interfaces?
If im not wrong, you can directly create tabs without 3rd party libs
not all
PlayerInteractEvent isn't iirc
tab list
like the one at the top
you can only set header/footer
Tablist is the same as tab ๐ different ways of calling it just
okay, you want to add that thing that appear the player head empty?
You want to add entries that is called
exactly
no though?
?
searched a random image, you see those empty connections?
You are messing me
Yeah those
Yeah?
when is java going to allow default arguments like c++ does
the red text is footer, golden text is header
oh yes, they are fake entities
yeah
So what your point? Sorry bro i cant understand
Wanted to know if spigot had a way
๐
adding an npc works, probably dont even need a phsical one, just send some packets
How do i disable player collsion so that players are not colliding with each other?
What I tryed
player.setCollidable(false);
yeah
Have you test it?
add them to a team and set no collision rule
I'll just get remapped NMS for this
I know the packets, just wanted to know if spigot had an API
Yeah definitly it have to be done thru packets
i guess not
but tbh, I had to expect it, no tab list API lmao
oh i dont think
might just contribute an API myself tbh
Yeah create a PR to spigot so then they add an api
I don't know how to design it though
Do you use tab prefix/suffix?
no
Mostly apis base on this example
public interface Tablist {
String getHeader();
String getFooter();
Map<Integer, TabEntry> getEntries();
}```
Sure? Because tab-team collision rules can override collision. I have no idea what that bukkit API is supposed to be doing behind the scenes, but I guess the only way to change collision is tab teams.
D:
Ok thanks i will give it a try
If your tab uses colors on names in any way, shape or form, you have teams. If so, you need to modify those. Otherwise, create a dummy team on the scoreboard manager's default scoreboard and add all players onEnable and when they join.
I guess something like this works:
var player = somewhere.getPlayer();
var tabList = player.getTabList();
tabList.freeze(); // Don't send updates
tabList.clear();
tabList.setHeader("My");
tabList.setFooter("TabList");
tabList.setHeight(9); // 9 fake players on the y
tabList.setWidth(4); // 4 fake players on the x
tabList.setEntry(0, 0, player);
tabList.setEntry(0, 0, UUID.fromString("someUUID"));
tabList.setEntry(0, 0, Bukkit.getOfflinePlayer(...));
tabList.setName(0, 0, "Some Text"); // No Skin, just text
tabList.setIcon(0, 0, "someplayericon"); // Just skin, no text
tabList.unfreeze(); // Send all queued updates, and start sending each update as soon as it is received
Something like that?
Yeah looks okay
Also add something like a delay setter so then its more configurable
?
Like have scoreboads, a delay for update
show me an example
Just my two cents: I think that it's not a good idea to design an API which immediately performs updates behind the scenes right when setting properties of the local state, which your freeze() indicates. Please just have a clear and simple update() method.
cough cough Inventory#setItem cough cough
What i suggested tho
cough cough the whole damn scoreboard API cough cough
I don't appreciate these ways of handling updates at all.
hm fair
Sorry, didn't mean to parrot.
I wouldnt create the freeze() / unfreze(), instead a simple update()
then my mind went to the average spigot developer
Spigot and bukkit are both a big mess, don't get inspired by that. Rather write clean and friendly APIs.
watch it get denied for too clean
Agreed
You don't have to work with any legacy stupidity, you can just design everything from the ground up and not limit your creativity.
Agree x2
fair
It's the first version
it's my version
Spigot is not friendly
Bukkit is a nightmare and I'm surprised we still use it
why cant i click this??
Yeah, why dont they wrote the new versions on Kotlin, they will need less lines
I'll work on a replacement once I am done with #1014622546852847646 /s (maybe not?)
Ehh that's in source
Let's write a proper open source minecraft server in a proper language which abstracts versions right above the packet layer and is friendly towards developers. Who's in? lol.
no
but i can this
When it comes to compiling Kotlin, you actually get larger, slower binaries
yeah i know, but in terms of obfuscation its pretty good
And also โจ the inclusion of the entire Kotlin standard library โจ
?stash
Not to mention you force all developers to use Kotlin-based APIs
What are stash never understand them
spigot's repository
can't be os on gh due to DMCA
oh, they dont use github?
Depends, you can load the std-lib centrally instead of shading it into the plugin. And you could - in theory - also tree-shake off any unused files in the stdlib. But then again, it's bloatware, why even argue.
oh yeah what stupid questin i have done
Either way I don't really dislike Kotlin
Scala > Java > Kotlin
Neither me
Kotlin is awesome, but it's cost is too high.
For minecraft plugins.
Hmn yeah, but not in terms of protection, can be deobfuscated simplier than Java
no actually
you can't deobf scala code
it just translates to java
so at most you get the compiler's output of scala
If kotlin is unreadable, what is scala then? xD
Does Scala use a transpiler?
Scala is actually cleaner
So after lots of rework and trial and error I get this error https://hastebin.com/virimahubi.apache
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Scala is a jvm language
Kotlin does too but
It's just very strange bytecode
Since it uses a lot of dynamic invocation
While channel is being used please ope na thread its 100% better and efficient
I confused? I only open one channel
Hee? I just have said, that when the channel is used there is no need to reply your messages to get answered, instead open a thread its better tho
ooo I misunderstand what you mean lol ๐
So, scala its harder to deobf compared to Java or Kotlin Okay - And what about in terms of sintax?
Hastebin Send and Save Text or Code Sni...
It's clean
That is wrong.
Tbh, I'd just stick to vanilla Java, it's a plenty powerful language if you use it right. I never had issues with the language, rather with the problem at hand, on a language-agnostic level.
I mean its a big change compared to Java?
Kotlin outdoes java in some departments where java outdoes kotlin in some departments.
Even arrays has these extension functions. It's great.
Stop defending kotlin
I used kotlin, java and scala
scala is just bae
Imagine yesterday there was a kid, tryign to write a Lua api, to write spigot plugins but in LUA ๐
What's the issue tho? Not really having any context to get what you mean.
doesn't report error
I like scala too
Kotlin is still a valid choice though.
Imagine there are people using Skript to drive their whole server.
๐คก โ๏ธ
I mean, from a technical standpoint it's an immensely interesting language, but I just somehow cannot take it seriously. Don't know why.
What properties will need a Group object? will be use for creating permissions groups
blank finals.
would error if not set
That's an issue? Oh. I thought as long as it's only assigned once, like in the if- or it's matching else clause, you're fine. Like an inlined if-else in kotlin, or even a switch. Think the variable can also be a val then.
why?
blank finals is a thing.
google it
Ah, you mean it in a positive way.
It's called balnk finals.
You cannot use a blank final variable. Try to print it.
probs because of a class?
...
x points to whatever piece of memory
You cannot access it before you assigned to it.
Yeah that will error, but try setting it @dry yacht before printing it
What its better for serializing/deserializing mongo document? Why / why not?
Write each property manually from/to document for saving/loading it or directly using Bson parser?
Not sure if it only works in constructors.
Yeah, then it works. It is exactly what I talked about, for like "inlining" if-else or switches.
what about a mongo library
That's a valid error. You created the variable but you didn't initialise it with anything.
isn't weird I said. My lord, do people not get me?! D:
it @rough drift complaining about valid code.
no?
nvm it was morice
I am just saying that
final String x;
if(condition) x = "a";
// x is not valid, not assigned in all paths
Blank finals allow you to to "inline" logic into variable assignments, and the compiler only allows you to access the variable if it has been assigned in all available paths.
It's never pointing at unknown memory...
if you're on 16+ you can inline the switch
final String num = switch(a) {
case 0 -> "zero";
case 1 -> "one";
default -> "don't know";
};
I know, but I don't like to compile at that version.
Can the compiler compile that down?
I compile at 19
nah
Stupid compiler.
Big amount of people will trip up on 19 requirement.
I only really work for the server I am dev on
Why not just compile new language features down to the old runtime, what's so hard about that.
so yk
some can't
like new APIs
Yeah, but this inlined switch can literally be accomplished using blank finals and is only syntax-sugar
Is what im using, but im not sure if there is a better way tho
I have no clue how to clone spigot EEEEEEEEEEEEEEEEEEEEEEE
Well, to add new cool features, but if these features can be depicted using old technology, why not compile them down? Like TypeScript does to JS.
Btw, any news on updating inventory titles? xD
What do you personally use for saving them?
I haven't used mongo in 7 months
I came clean of mongo
happiest I've been, used it for like 2 days
went into depression /s
They suck.
You have to do it via packets in that way, they dont get bug
no shit
Hahahaha :,D. It's such a weird topic. I have yet to look through the decompiled minecraft client to check it's logic on PacketPlayOutOpenWindow-receival
I don't want them to limit my free will. If I wanna run an inlined switch on java 8, I should be able to. Assholes.
if(object instanceof Point(int x, int y)) -- Coming next java version
Also, why didnt mojang re write, their backend in a better lang?
Pattern matching? What's that?
if you say kotlin one more time I swear to god
No no, not even Java
record destructuring is just extracting values out of a record
like
if(obj instanceof Point(int x, int y)) {
System.out.println(x + y);
}
// x -- not allowed here
I literally see no appeal in records. Maybe they help the compiler to achieve some lower-level optimization, but that's about all of the advantages I see there.
they are good for immutable data
@dry yacht worked thank
Tbh, I see no appeal in that either. It's getting weird with these new features. Like they want to imitate JS destructuring.
I know, what lombok solved years ago.
Uhm, what again? Sorry, I forgot already, :/.
Reflection? Code generation.
collison teams
Ah right, how did you solve it? By creating/modifying teams?
Created teams like you sayed
Awesome! :)
Tell me the real world advantages of records over lombok @Getter, @Setter and @AllArgsConstructor instead of just hating on it.
Annotations + Hacky reflections
they are reflections
it's annotation processing
Am I that misinformed? Let me check for a second before I talk trash here.
yeah
Eh it's done at compile time so it's fine
It's a compiler plugin
compiler plugins just process annotations
they can add some stuff iirc
Iirc records use some mix of reflection and invokedynamic
records?
Lombok could actually be superior in that regard
I mean record has support for proper reflection api etc, though tbf its mostly preference
In what way exactly?
It's not at all using reflection, I don't know where you pull that knowledge from. Everything I said is valid, they modify classes at compile-time. https://www.freelancinggig.com/blog/2019/04/06/how-does-project-lombok-work/
annotation processing is reflection
compile time reflection
Proper reflection API? In what sense? That you cannot change it using reflection?
lombok is like a poor mans kotlin
So who cares? It has zero effect on runtime efficiency.
No, that things such as Class::getRecordComponents exist
Oh, okay, sure. Another level of headache when trying to find your required dependencies using reflection in the hell we call "bukkit versions".
Classes, Methods, Fields, Constructors. Now, also have to handle records. If they convert any class to a record, my reflection matchers are screwed for the new versions.
It isn't. Records offer nothing which justifies this.
Making a language have more features is driving it in C++ direction: a clusterfuck.
Records are immutable transparent data carriers
@Getter @Setter etc generates a getter/setter at compile time
The point of records is โto devise an object oriented construct that expresses a simple aggregation of valuesโ
?
Annotations are not really object oriented, and in the sense of lombok more inflexible in an OO infrastructure
Just wanted to know in which context you said that, sorry, should've written more than a questionmark, xD.
That does not mean annots and lombok are bad, but it makes sense for Java to add a proper โooโ way and being a proponent of that
Myea
True
You just threw that in there, so I thought you did.
Yes, you did. You replied to "in what way exactly", which referred to "if it's anything that needs updating, it's the annotations api", which itself kinda refers to lombok.
Whatever...
Print out the default message.
?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.
var player = somewhere.getPlayer();
var tabList = player.getTabList();
tabList.clear();
tabList.setHeader("My");
tabList.setFooter("TabList");
tabList.setHeight(9); // 9 fake players on the y
tabList.setWidth(4); // 4 fake players on the x
tabList.setEntry(0, 0, player);
tabList.setEntry(0, 0, UUID.fromString("someUUID"));
tabList.setEntry(0, 0, Bukkit.getOfflinePlayer(...));
tabList.setName(0, 0, "Some Text"); // No Skin, just text
tabList.setIcon(0, 0, "someplayericon"); // Just skin, no text
tabList.update();
```Thoughts?
Anything to add/remove?
You can also add an interface, but i dont think its really necessary
TabList is an interface
the methods you see here
It's just a demonstration of every method
print out e.getmessage and you shall see why you have ur issue
Wait, does Player has a tablist getter tho?
Since you're setting the message to the final format you'd like to have and then prepend the playername by the format string, you'll end up with two playernames.
Oh and yes: there are the equivalent getters
I cannot find in the docs
Just remove the manual player-name from the message.
I am making a new API
And I'll commit it to spigot
well PR it
Oh yeah you are re writing api
he is writing some functions for the api
yep
jan, suggestions?
Is there a limit to how wide (in slots) the tab can be?
Also will do something similar, but for scoreboards
Yes
I guess mc limit
@sterile token you can't
you cannot remove ANY old api
Oh ok that makes sense, because if you remove old api method then when the PR is accepted, people have to modify their code
Four, right?
it will never be accepted
New code please, and make sure the new code actually ran (often times it doesn't, xD).
What's the 0 0 again?
I see, newbies will get more confused than me. I had to tell someone what a grid is.
no?
Tab is a grid
1.7 3 rows, +1.8 4 rows
Hi, could someone help me with my Plugin? I try to display titles with a Scheduler, the first title shows but the others which run by the scheduler doesnt work.
@quaint mantle
?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!
Can i just post the raw code here?
random screenshot:
0, 2 here is the top-left yellow text
because zero slots from the left, two from the top (0 indexed)
like a 2D array
what would you prefer then?
So like what?
like ye
I'll add slots too I guess
I really don't want to over-engineer anything, but maybe it'd be a good idea to use an enum for the tab-width, to constrain the valid range of numbers. I'd still have integers for setting slots and just performing a noop for invalid positions, but at least you cannot create an invalid-width-ed tab format (and you don't need to throw a stupid IllegalArgumentException). You could have a static #fromInt, which min-max-es internally
did you print e.getmessage?
Now, why not used a Vector2D
fair point
A vector? D:
Alright connophy
For colum i would use an enu
I guess the second one is better just for one reason: iteration
I know it sounds counter productive, but you can do
for(int x = 0; i < tabList.getWidth(); x++) {
for(int y = 0; i < tabList.getHeight(); y++) {
}
}
Can someone tell me what i did wrong?
It is that part.
huh?
You should change the format if you wish to display the displayname differently @quaint mantle
%s: %s
Because you don't tend to store a grid-layout as a list.
So, I am a little new to API Documentation and reading other peoples code. When I created a inventory how am I supposed to know that inventory needs ItemMeta which is the data the represents the Items?
the first %s gets put to the displayname and the second is set to the message. @quaint mantle
If you set the message to name: message, the format %s: %s. Will get set to name: name: message
ItemStack
Rephrase your question, what do you mean "how am i supposed to know "that inventory""
Just dont fuck and use Flexbox!! - Its a meme sorry i have to say it. Dont blame me please
Because? You have to do math to translate between pos and slot, while 99% of users are going to use a grid in their local state?
I feel like grid is better, and if you want slot you can just int slot = x + y * width;
show me your changed code.
That's not how you should put it.
Okay, so when I create an Itemstack it requires ItemMeta for the item data of the ItemStack. How am I supposed to know that? Maybe I am still wording it wrong.
The format is already that.
@quaint mantle Print out message and format before you do anything to see what they are for yourself.
Because nobody thinks of an inventory (in day2day use) as a grid, except for when you want to create animations. But who would modify the tab like this to only have standard players? You'd either store per-column or a full grid. Otherwise, you have to think about the current width all the time.
They do in IF
no why
he want it to go vertically @rough drift
bruh wtf
How do ya'll make this tab like that?
hacks
that is a random ss I found
ItemMeta is not required. It's basically everything besides the material and it's amount. If you want to attach custom data (NBT tags, in essence), you use an ItemMeta. ItemMeta is the most generic type, where a BookMeta, CompassMeta, ... are specifics, only applicable to their matching Material.
But I also don't quite get the question.
also @quaint mantle
If you only modify the max slots, setSlot is not going to be interesting to you at all.
Map rendering uses (x,y)