#help-development
1 messages · Page 1956 of 1
That’s VSCode, you have to install a bunch of extra stuff if you want a “create project” type thing
Honestly, I always found vscode more like a generic text editor than anything usefull for development
how do i do that then
That’s basically what it is
At that point you might as well use vim or emacs
pretty much
Anyone knows if there's a way to color the players names above head with hex colors?
Team.setColor doesn't support Hex unfortunately
I even tried looking up some packets but nothing seems to do the trick
who can help me with a plugin
wrong channel sorry lol
Are you sure the game supports it?
so uh what do i do
Google it
didnt work out
above the player
Nop. Couldn't really find any source
Yeah, that's a bad idea .-.
I personally use Geany for C dev, but that is another pretty generic text editor
welp then im not sure
You googled visual studio, not vs code. You need to Google for your setup
no
i dont know if you can do it in player names/tags
Ok one sec I’ll look for you
Do you have the C++ extension installed?
Well, then you are on-par with my knowledge
iirc yes
listen to the orange guy
thats why i hate anything other than jetbrains
like you can probably pass an int
orange guy :kekw:
well im not wrong
might be byte even
seems like it doesn't support hex colors
Tried running the /team command and it didn't work with HEX
I’m looking at the renderer to see
amplifier is int
yes but in minecraft you cant have any higher than 255
have anyone used NIO V2 before?? hello??
additionally its interesting since 129-255 iirc uses negative integers (when stored in nbt)
yes in api
tho thats not how game treats it
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2021-12/R/eclipse-cpp-2021-12-R-win32-x86_64.zip try this I guess, it is a portable install so you can just delete the folder if eclipse turned out too confusing either
well yeah they're capped to the limit of shorts also in modern versions
used to be 35k or 36k or sth
35k
@native bluff doesn’t appear to be supported
its java.nio since java 7
there were some packages of nio before that
yups, that's what I thought. Thank you! 🙂
Why would be use pre-java7 java?
interesting
yes, but specifing this is a bit strange, given that nowadays we all understand the same thing
i have such a question
lets say i want to serialize some data to files
ingame
should i use AsynchronoushFileChannel
At least in the progressive java world
depends
also does Files interface blocks
I'd use a simple FileOutputStream (you can dump the data off-thread and I do not think that there is a global FIO lock)
That’s fine
I have 2 listeners, one is EntityDamageByEntityEvent (for the fireball hitting the player and setting the damage) and one is the PlayerInteractEvent (for throwing a fireball)
both of them currently work as intended, but im trying to add a message like this :
"Your fireball hit %count% entities for %damage% damage."
and
"You were hit by %playername% for %damage% damage with fireball"
How would i get the shooter and the player hit and use the message like that? i have a few options that i thought of:
i could put them both in the same class, but then i would need to let the damage event know who threw the fireball if multiple different players were throwing them at once
i feel like im overcomplicatnig my thought process
and its really simple
i don't want to use java.io specifically, since we have new apis since java7 to handle that
but im not sure about that actually
Projectile#getShooter
myes
if i dont specify ExecutorService inside AsynchronousFileChannel
what thread pool will it use
I mean I'd say its the exception rather than the rule that sth is obsolete and should not be used when its contained in that package
iirc fjp common
i mean my binary files are quite small (1-5KB) uncompressed
so im thinking if i could use separate thread pool
should i put them in the same class
i like it neater
wdym i just use FileWriter and BukkitScheduler#runTaskAsync
to have different evnthandlers in differnet classes
?paste
doesnt matter
i like to put them per category
any ideas how to improve this
depends on what you want to improve
why filewriter?
but maybe write a unittest for it dovidas
Like the listeners?
to check that it works fine asynchronously
Idk
yeah file writer or buffered writer both cool stuff
I havent worked with io by myself too much
same
does it have advantages over FileOutputStream?
well
(other than the fact that you can write raw strings with it)
Writer is usually meant for text based streams
At least it worked
I mean FileOutputStream and FileWriter are kinda for different things
oh
(not entirely)
I used writer for gson
Yea one's for byte transport
^
and another for text based transport
I wanted to use outpur streams, but that didnt work
okay, so I am not misusing it
Guys how can i get a random entry in an enum?
this is my method rn, and it is a little broekn
Enum.values[random.nextInt(Enum.values.size)]
I mean most common approach is to cache the enum values by Enum::values and then access a random index with sth like RandomGenerator::nextInt where you pass the length of the collection
Except yknow, less ugly
I want to make my plugin use MySQL. It has to save a lot of data several times. How should i do that?
Just beware that .values() clones the returned array
omg i forgot that arrays have that option of getting an entry by [entry]
I'd personally recommend storing the array to a local variable and then using that
Hence the less ugly
Elaborate
Enum[] values = Enum.values();
Enum value = values[random.nextInt(values.length)];
yes
I mean, the issue with this is that the .values() call is not fully cached
I already fixed it! ty
i cant sleep if i know that my code does unnecessary computations
finally this is what i'm using
JIT might solve a few concerns but nothign is 100% sure
is it ok for you ProDevs?
yeah altho iirc uses System methods to copy the array so should be kinda fast
but ye for enums like material
better cache it
🥲
I think it just calls Enum[].clone() (so it could be using jvm internals shenanigans to reduce ops)
What do you mean?
why use CustomItems#valueOf?
oo ye good point
Yeah why do you convert the enum entry to a string and then back to an enum entry
We cant help yoy without knowing the context
OK. I create something, store the data. Later on i would delete/change the data. This Data has do bei persistant.
I don't know how to make that with dbs. Should i keep the connection live? How should i do that?
Go and learn sql and jdbc
(i. e. just yolo it)
There is nothing better than jumping head-first into the cold waters and then to come out screaming in pain
Ok i come when i am screaming 🤣
hikaricp 
Because then I’m sending a message that says what item they added
So i need it as a string
but can't you just invoke .toString() later on?
hey, so this is my first time making a plugin, and i have used gson to make a json file to store a class's contents in an array list, but when this function runs, it doesnt update the json
(it does create the file, though)
do you really want to create a new GSON and File object everytime the method runs?
yeah so it overrides the current file (sorry if i sound stupid im coming into java from haxe)
basically i want to know why the file stays blank even when the method runs
and the arraylist does have contents
that's nothing anyways
still unnecessary
boilerplate should be avoided
what boilerplate
How I can clear list of recipesUsed from furnace?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Furnace.html#getRecipesUsed()
#clear?
but seems like there is nothing wrong. what if you use the writer to actually send the data, instead of gson?
I testing it but i get this error
[22:36:07 ERROR]: Could not pass event PlayerInteractEvent to wiktorm v1.0.0
java.lang.UnsupportedOperationException: null
at com.google.common.collect.ImmutableMap.clear(ImmutableMap.java:877) ~[guava-31.0.1-jre.jar:?]
i'll try that
otherwise it could be the file location. if that doesn't work, try to use this constructor instead https://docs.oracle.com/javase/8/docs/api/java/io/FileWriter.html#FileWriter-java.lang.String-
ah, an immutablemap. well, then i guess you can't except with some NMS stuff, but idrk.
is there any way to declare generic type inside the class like this?
public class Foo<Bar[]> {}
Whats the point lol
record 👀
i have an interface with generics
aaand?
and i need to have array as a generic type
what's the problem
this doesnt work
What
but it does?
internally its just a fixed order of objects, or primitives
I dont understand your issue dovidas
lets say i want to create a class which already declares a generic type
with primitive type array
as a generic type
what you don't understand
Thst doesnt make any sense
it does make sense
because i have class implementation which doesnt need generic type anymore externally
use c+
please provide a context
doesn't matter. just use a list or any other collection impl you might need
ok this is weird
if it doesnt support primitive types as generic types
then why Class<byte[]> is legal
java.lang.Class<**T**>
cuz arrays are objects
You can provide byte[] as an object generic type inside variable declarations while you cant declare them inside the classes
weird.
Foo<byte[]> foo = new Foo<>(); // Legal
class Bar implements Baz<byte[]> {} // legal
class Foo<T> implements Baz<T> {} // legal
class Foo<Integer> {} // legal
class Foo<byte[]> {} // not legal
Latter works as well
Because the last doesnt make sense
so does Integer
why doesn't Integer make sense?
it does
it does
since its a class
not explicit
that was just me experimenting
Doesnt that makes an UUID... A generic type?
Liks, not the actual java.util.UUID
or Integer
Could be
And you cant have arrays since []
That's it
welcome to generics
How evil would that be if someone named generic type as an existing class name
great for obfuscation i guess ( not much, but harder to read i guess)
yeah, its an easy refactor
How to get an offline player in bukkit from an uuid?
Bukkit::getOfflinePlayer
?? i am using the mojang api to get their uuid
you can't get an offline player if they haven't joined yet
Bukkit.getPlayer(UUID.fromString); im going to use this?
Explain
And has to use their name
Oh
Explain what
Wait
getOfflinePlayer is unresolved reference
Bukkit#getOfflinePlayer
Oh wait you use stupid outdated versions
No idea if it existed then
Gets the player by the given name, regardless if they are offline or online.
This method may involve a blocking web request to get the UUID for the given name.
This will return an object even if the player does not exist. To this method, all players will exist.
'getOfflinePlayer(String!): OfflinePlayer!' is deprecated. Deprecated in Java
Yes there are two methods
So this would probably slow down the main thread as it sends a request to mojang api?
So, in that case, wouldn't an async function made by me be better that way that gets their uuid
some guy on spigot forums said that it would stop the main thread for a bit
Yes
and slow the entire server, but if you do it asyncly?
So do it async
Okay
was gonna us ethis
but ill just do the already existing bukkit one u said
Bukkit.getOfflinePlayer()
its thread safe?
Sure
java.lang.ClassCastException: class java.lang.String cannot be cast to class org.bukkit.entity.Player (java.lang.String is in module java.base of loader 'bootstrap'; org.bukkit.entity.Player is in unnamed module of loader 'app')
var playerfromargs = args[0]
playerfromargs = Bukkit.getOfflinePlayer(playerfromargs).toString()
playerfromargs as Player
its probs thread safe, but not atomically safe (just a guess)
what am i doing wrong ?
Trying to cast a string to a player
doesnt getOfflinePlayer() cache data?
my ide is telling me to
Bukkit.getOfflinePlayer(playerfromargs)
Type mismatch.
Required:
String
Found:
OfflinePlayer!
yes which is why it might not be atomically safe
meh, i'd probably would've made http request by myself just to be sure im not screwing up something
yeah, the entire disadvantage of abstraction is mainly concurrency
cache boolean or separate method would be enough for me to not to
since its an "implementation detail"
but still needs to be concrete in apis (since hiding implementation causes concurrency update oblivion)
I still dont get how to to turn a uuid into a player
I got the uuid as string
now what
if you dont mind looking up data online on the main thread use the getOfflinePlayer()
You already have a uuid?
I got the uuid
but what if that player haven't played on the server
Mhm
@Override
public OfflinePlayer getOfflinePlayer(UUID id) {
Validate.notNull(id, "UUID cannot be null");
OfflinePlayer result = getPlayer(id);
if (result == null) {
result = offlinePlayers.get(id);
if (result == null) {
result = new CraftOfflinePlayer(this, new GameProfile(id, null));
offlinePlayers.put(id, result);
}
} else {
offlinePlayers.remove(id);
}
return result;
}
1.8.4 implementation
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_8_R3.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_8_R3.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader 'app')
myFunction.initializestuffs(sender as Player, finalOfflinePlayer as Player)
Dont get it
what version of minecraft do you use
1_8_R3
ah nice then its not thread safe by the looks
1.8.8
You can cast an OfflinePlayer to a player
the other way around?
Player is always an OfflinePlayer
So, chances are, an OfflinePlayer could be a Player
You cant cast OfflinePlayer to Player
Best to instanceof first
yes exactly
Or use isOnline
Ye
If you're saying you can't cast without doing a type check first
That's just untrue of the language
Well, you know what I meant, anyhow point is as said there's no guarantee an instance of OfflinePlayer is an instance of Player
I didn't know what you meant until you said "yes exactly."
Say "You can't just cast"
How many requests can be sent to the mojang api
Shh
Well, not infinite I know.
well usually you get your hands on a OfflinePlayer object so then it will objectively yield a ClassCastException if you cast it to Player
or
wwait
what am I even saying
its the reverse
I just said what you said before
myes
Thanks
well using Bukkit::getOfflinePlayer by passing a uuid would yield an instance where the name might be null
Don’t need the toString
but else, sure if its cached
when you .toString().toString()
might be using sth like components 
I got
e.getRightClicked() as Player as a player
but how can i get their uuid
from this
.uniqueId
thanks
?jd-s btw
getters and setters become properties
Is this the same?
if(player.isFlying()){
// code here
} else {
if(player.isInWater()){
// code here
}
}
if(player.isFlying()){
// code here
} else if(player.isInWater()){
// code here
}
Yeah
Ah, intereseting
I mean they are effectively the same
elif 🤩🤩🤩
But there is one difference
You can put some code after that if in the else
And it will only run on else, no matter if the if was triggered
I want to do something If player is flying and in the water in this case.
sender.name.toString() returns uuid???
sender = OfflinePlayer
I always thought you need to put !player.isFlying() in the else if statement.
else if(player.isInWater()){ this mean the condition will be success if the player is not flying and is in water right?
Yes
Alright, thanks guys
that broke me 💀
how do i save an arraylist to a .json, i have literally been trying to do this all day and the file stays blank
so can someone give me a snippet or something
What is it a list of?
an arraylist would be equivalent to a normal json list
Depending on what's in there you might not need a json library at all
a class
can someone please give #942934911432687656 a look?
Could you be more specific
Like do you literally mean it is a List<Class<?>>?
ArrayList<Menu>
the class is called menu
which opens the inventory and handles the customizations
Okay then that's really important information that you left out
You're gonna need a way to serialize the Menu instances
how would i do that (sorry i am new to java)
You need some way to convert it to a string, basically
alright
And then back
this is what i came up with
String menu = new Menu(name, size, new Menu.OptionClickEventHandler() {
public void onOptionClick(Menu.OptionClickEvent event) {
event.setWillClose(true);
}
}, this).toString();
right now i am just saving it
so i will worry about destringing it later
Not like that you won't
You can't just call toString() and expect something deserializable to come out
The standard toString() implementation just gives the name of the class and its location in memory
Which is useless for persistence
You need a way to actually convert all of the relevant data to a string
And you have an anonymous class definition in there so that's gonna be quite hard
oh so not the whole class
just the variables that need to be read
Why are you trying to save this to a json file exactly?
well it doesnt really matter i could do yml but i tried that earlier
It does matter
Why are you trying to save this
It's very strange to try to save something like this to a file
it doesnt really matter what file it is
not why
so when the server shuts down people don't lose the menus they have created
they need to be stored somewhere
as well as the name, items, etc.
/menu create
In the code
Thats not a trivial problem. Designing classes to be serializable is an art in itself.
What variations are there
I just wouldn't expect that ever under any circumstance, even if docs say it is ;p There really should be a designated serialization method and toString() should be reserved for human readability
Just a random aside I wanted to throw in there
They can overlap considerably
My serialization methods tend to be human-readable
But yeah it often does make sense to separate them
It's rare. Few cases for that are things like enums
A Menu takes an event handler of some kind
That's what's going to make serialization difficult here
If there are a preset number of possible values then you can just assign names to them and be done with it
Otherwise it's going to be a lot more complicated
He would need to define a fixed set of actions with serializable context.
Yeah I guess "assign names to them and be done with it" is a bit simplistic
But it really is much much simpler if that's how this works
when a player runs /menu create {size} {name} it is SUPPOSED to add the size and name, items, and commands items do when clicked to an array, which would be stored in either a yml or json depending on which works
But what other properties does a menu have?
Size and name are clearly not the only ones
It's probably the items in there, right?
The behavior of the menu - can each item have a different handler that is run when it's clicked?
yes
edited above
Right, that's where it gets complicated
So does each item have only one command attached to it?
Are there any other things an item can do when it's clicked other than just run a command?
yes, you cannot add more than one to an item
no, just run a command
Okay
Then that's doable
Now you have a few choices
You could do all of this yourself
Handle serialization of everything, including the items, which is gonna be very annoying
Or you can use a pre-existing library that will handle the serialization for you as long as you tell it how
any good ones
?
I've made one that you could use for serialization to yaml
For json there's gson which I believe works similarly
i tried gson earlier but it did not work
You can also use ConfigurationSerializable which is built into bukkit
file would create but not update
This does not make sens right?
`@EventHandler
public void onPlayerRespawn (PlayerRespawnEvent event) {
Player player = event.getPlayer();
player.teleport(new Location(player.getWorld(),97, 242, -143));
if(!player.isOnGround()) player.setGliding(true);
}`
Make sense how
It's valid code
I don't know why you would do such a thing but it would work
But it doesnt work 🥲
Hey, does ```
FileOutputStream output = new FileOutputStream(file);
ObjectOutputStream stream = new ObjectOutputStream(output);
stream.writeObject(object);
Allocate the same amount of memory as
new ObjectOutputStream(new FileOutputStream(targetFile)).writeObject(object);
?
Why would it not
It will take the same amount of heap space
It will use very slightly less stack space, but that barely matters at all
Take readability over that micro-optimization
So no reason to use one or the other? Just impacts readability?
Readability is more important here
The stack allocations of a few variables uses such a negligible amount of memory that doesn't even need to be garbage collected
gotcha thanks
The player will just be spawned at the World Spawn Point. But player.setGliding(true); works, why does the teleport not work?
ty
I'm querying db "mysql/SQLite" for each online player every 5 min. Would I just use a for each loop on online players and inject playerdata into db ? Or do something like hashmaps ? Im not sure if db can handle a loop like this or what is most commonly used to do this.
how do i change a large area of blocks?
I use a for loop, and theres just a small visual lag of the for loop working, and it just bothers me :}
loop
You keep your data in memory while the players are online and store the data when a player disconnects.
Additionally you can also backup the data every 5minutes. But this should not be done with a loop but a single query that delivers all data.
Makes more sense thanks!
Additionally you can also backup the data every 5minutes. But this should not be done with a loop but a single query that delivers all data.
so it'll cause less strain on the database?
yeah one single data dump every so often is better than constant r+w
but also runs the risk of data loss if the server goes off line, the cache of data will be lost
how would one go about doing that?
a for loop that just appends to some sort of an Object?
well personally i used to cache to redis then dump that every so often
oh that sounds smarter
but if you are only using 1 db just have a db manager that stores objects then writes later on
wdym by a db manager-?
just a class that manages the db IO
oh
or just create your statement, save it to some sort of array
or queue
then dump all those statements
ooh okay!
and would redis be better opposed to using variables for a caching? (or does this just matter on usage cases?)
yeah depends on usecase tbh. Only reason i used redis is for redundancy
if your mc server goes offline, redis will still have the data
whereas if you didn't have redis you would just lose the data
I just write every change :p
unless your entire host were to magically poof 🤡
Reads are heavily cached though
because of that large networks do have many servers
aight
with many backups
if its not super taxing i wouldn't bother even caching it
at different locations
yea i suppose
theres some nms methods that are far faster
World#setType or whatever will be very slightly faster (on 1.18.1 anyway)
the 'fast' nms methods are a scam
setType without physics is as fast as you'll get without breaking things
Is it possible to have an on click that would then open the player's chat and write a command in for them, for example when they click their inventory item it would open the chat and write "/help" but not actually execute it (just show it)
I mean, kind of
Could reflect into the CommandMap, #get() the command and invoke its execute() method
That's ugly and hacky as hell, and I seriously don't advise it
but you can do it lol
but not actually execute it
led me to believe they want to avoid that lol
Isn’t that what the execute method does
afaik it does still perform and log the command
I want it to be like how JSON does it, it sends a player a reccomended command.
oh you want command suggestions
yeah that's only done with components. You can't do that any other way
I misunderstood the original question I guess lol
No you understood right first time
Not a suggestion where it shows possible commands in a black box in chat, but actually write it in the player's chat box so then they can finish it by writing the arguments in
but i guess that cant be done.
Yeah that's a command suggestion done with components
Does anyone know the proper way of getting a player’s DisplayName as a String in 1.18.1? The Player#getDisplayName() is deprecated. Still works but is there a better way to get someone’s display name?
You are developing against paper's api if that method is deprecated
How can I send a centered message in chat
I have a question guys, so I have two plugins that I am working on and I want to incorporate the first one into the second one without having to always update it back and fourth, how can I manage these two plugins with IntelliJ and build and compile them in a way where the first plugin goes into the second one easily, and I can manage what different files classes are in the second plugin? Thank you
Not sure what exactly you are trying to do but this sounds like you should use maven
So what is maven?
How can i set it up?
A dependency manager
- search for apache maven setup
- watch maven tutorials
[21:53:52 INFO]: §x§2§0§B§2§A§APig §x§7§7§9§9§9§9(9)
[21:53:53 INFO]: 9
[21:53:53 INFO]: §x§2§0§B§2§A§APig §x§7§7§10§10§10§10(10)
I am trying to only replace the 9 in the (), but when I replace 9 it replaces all the hex. How can I only replace the 9 in the ()?
lol
Use regex
\(9\)
.replaceAll uses a regex parameter at first
Im working with EntityPlayers right now to create NPC's, how can I make an Entity sit on another one? Do i have to use packets for this? Im in 1.8
How would I update a player's gameprofile to have a different uuid? I'm trying to make a custom profile plugin where players can have different profiles. When I change the gameprofile uuid, the getUniqueId method still returns the original uuid.
1.8 is half a decade old and lost support years ago... Go search in old forum posts.
Lmao, im literally looking on youtube right now. im just talking about entities and how to make them sit on other ones?
because i cant find much about that
like
This will break a lot of plugins. Im not even sure if this is possible on an online server.
Depends on the version you are using
does it really though
If you use nms then it matters a LOT.
Not using it??
Yeah I'm trying to make this plugin work with most plugins, essentially giving the player an entirely new account. I've seen client-side uuid change but I'm not sure about server-side.
EntityPlayer
EntityPlayer is a nms class
oh yea nvm
You will have to reconnect the player for that because his UUID will be used for internal mappings. Example Bukkit.getPlayer(UUID) accesses a Map<UUID, Player>
If you just change the GameProfile then this map wont be changed and the old UUID mapping will remain. And thats just one place.
So you will have to hook early into the handshake.
Would be worth looking at the protocol to see where a good place for injection would be.
Im actually not sure if thats even possible.
you mean you wanna regenerate the entire world?
Talking about just setting the block type at a location. Dont bother with nms.
If you want to change huge areas of blocks then you should do it async.
Async does not mean from a different thread. If you split the task over several ticks then thats an async action.
Example: You have a million blocks that need regeneration.
Doing this in one tick will crash the server. But placing 20k blocks every tick for 50 ticks will probably be fine.
It wont lag and only take about 3 seconds.
You can also just place 1k and wait for 30 seconds and dont even lose 0,1 TPS. Shouldnt really matter.
I'm trying to navigate to latest.log in the logs folder but getting the parent file beyond /plugins is returning null
earlier it was said spigot doesn't prevent it but... does it?
// f = plugin.getDataFolder();
System.out.println("--------------------");
System.out.println(f.getAbsolutePath());
System.out.println(f.getParentFile().getAbsolutePath());
System.out.println(f.getParentFile().getParentFile().getAbsolutePath());
System.out.println("--------------------");```
the logs
```[00:39:20] [Server thread/INFO]: --------------------
[00:39:20] [Server thread/INFO]: C:\Users\name\Documents\Minecraft Server\plugins\ConDump
[00:39:20] [Server thread/INFO]: C:\Users\name\Documents\Minecraft Server\plugins
[00:39:20] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'condump' in plugin ConDump v1.0-SNAPSHOT```
spigot cant do anything like that
is there a way for me to reach latest.log?
Sure. You have java at your disposal. You can do anything. As long as the os allows it.
Thank you, I will try that
public File getLogsFolder() throws URISyntaxException {
File spigotFolder = new File(Bukkit.class.getProtectionDomain().getCodeSource().getLocation().toURI());
return new File(spigotFolder + File.separator + "logs");
}
In most cases this will also work:
public File getLogsFolder() {
File spigotFolder = Bukkit.getWorldContainer();
return new File(spigotFolder + File.separator + "logs");
}
oh shoot I just raw dogged it, didn't know those methods existed
LinkedList<String> oldPath = (LinkedList<String>) Arrays.asList(f.getAbsolutePath().split("\\"));
oldPath.removeLast();
oldPath.removeLast();
oldPath.addLast("logs");
oldPath.addLast("latest.log");
String newPath = oldPath.getFirst();
for (int i = 1; i < oldPath.size(); i++) {
String s = oldPath.get(i);
newPath = newPath + "/" + s;
}```
oof...
quite a big one indeed
I just need to resolve this illegal escape sequence in the split regex...
Use the second method. Im not 100% if the first points to the jar or the folder.
I will, thank you for showing me that method
Hi all im using NMS but when im compiling i get an error because it cant find the classes, how do i tell gradle to compileOnly with it? i typed in compileOnly(org.bukkit:bukkit:spigot-1.8.8.jar) but i dont think it can find it? where do i put spigot jar . my IDE can recognize it because i added it in Settings Global Libraries
Only add stuff in build gradle and use the gradle build command to make the jar
You do not add your spigot jar anywhere
this is in my dependencies...
*/
compileOnly("org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT")
BUILD FAILED in 4s
Anyways that is the wrong compileOnly information
org.spigotmc
1.8.8-R0.1-SNAPSHOT
...
It replaced it to an emoji
Either way I think you get it
It does
BUILD FAILED in 3s
Could not resolve all files for configuration ':compileClasspath'.
Could not find org.spigotmc
1.8.8-R0.1-SNAPSHOT.
Searched in the following locations:
- https://jcenter.bintray.com/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/maven-metadata.xml
- https://jcenter.bintray.com/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/spigot-1.8.8-R0.1-SNAPSHOT.pom
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/spigot-1.8.8-R0.1-SNAPSHOT.pom
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/maven-metadata.xml
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/spigot-1.8.8-R0.1-SNAPSHOT.pom
- https://jitpack.io/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/maven-metadata.xml
- https://jitpack.io/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/spigot-1.8.8-R0.1-SNAPSHOT.pom
Don't include the emoji >.<
i didnt
Ah so you didn't run BuildTools
- What went wrong:
Execution failed for task ':compileKotlin'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find org.spigotmc:1.8.8-R0.1-SNAPSHOT:.
Required by:
project :
How do u want me to run that
?bt
Never download Spigot from anywhere else
Yes i know that!!
i built my spigot and put it in resources folder
but dont know how to link it up to gradle
Just run it once and reload your project
BuildTools
how do you run buildtools in ide
You don't
so what are you talking about
?bt
i already have that and i built spigot jar with it !
Just follow these instructions
???
That literally just says how to build spigot jar
and i did
but gradle doesnt know anything
how do i link it
So you didn't download your jar
It shouldn't be there
Ok, so how does gradle know build tools then
youre telling me to build a spigot jar with buildtools which i already did.
i ma just
Im still learning and im new so Be patient with me
But this gradle shit doesnt work
Thats what im literally asking how to use it and how to compile
It will read from the local maven repo. BuildTools should add it there for you. This appears not to be the case then. Try running BuildTools again and make sure to build 1.8.8
dead versions yey
If it doesn't work you will need to add it manually
if you have nothing to add to the convo dont
yep so i built everything in my downloads folder
but thats shouldnt be where it is
You can run that anywhere
oh
i see now
repositories {
jcenter()
mavenCentral()
maven(url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven(url = "https://jitpack.io")
}
do i have to add my own
?
so that it can find
org.spigotmc:1.8.8-R0.1-SNAPSHOT
this is the right one?
my jar is named spigot-1.8.8.jar the built one
didnt work
- What went wrong:
Execution failed for task ':compileKotlin'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find org.spigotmc:1.8.8-R0.1-SNAPSHOT:.
Required by:
You forgot the spigot part?
Okay thank you it worked
kotlin?
but what is mavenLocal() and how can I make sure that it can access spigot jar file ?
points to maven local repo on your computer which is named .m2
in users folder?
yep
So it works now?
Aight
more 1.8 plugins ;7
Eh let them choose what they want for a private project
Just do understand that working with 1.8 will be harder than newer versions
not really
if anything its easier
cuz it doesnt have the extra shit
👀👀 a wild take
1.8 is missing a lot of API that can be pretty helpful even outside of the API that represents gameplay additions
What are you talking about? If youre going to say something at least explain it or give actual examples
1.18 is so bloated + servers require like 2Gig ram each, now tell me, how are you supposed to launch a big network based on 1.18? You can't, each instance of a lobby / minigame will be like 2 gig each, with 1.8, what? its like 400mb. usage, or smaller plus, its so simple, and the fact that i have to learn packets and shit, just better for me as i can get even more understanding and learn more
bollocks
haha, youre funny, i went onto the papermc server, got laughed at for using 1.8, so i tried out 1.18, my entire pc nearly crashed, 100% cpu usage, and i had to put at least 1 gig ram. whilst 1.8 can easily just fine with 400mb using 200mb currently, on my server
1.8 is simple, yes old, but simple
You are still using outdated software. If neither spigot nor paper were kind enough to supply you with a fix for log4j, you'd be stranded.
for most people new versions are recommended -- yes. but let people choose what they want to play with
True but they did, because a lot of people are still using 1.8
In terms of API, PDC, NoAI, MaterialTags, all that good stuff
- You dont need to support thousands of concurrent users. You are not Mineplex.
- 1.18 is more than capable to handle a metric ton of users if you know what you are doing
- Its all a matter of setup. If you know what you are doing then 1.18 is as capable as 1.8 when it comes to minimalist setups
idk where people get the "a lot of people are using 1.8" from
bstats screams otherwise
"a lot of people are still using 1.8"
Its like 8% or something. Eeceding.
I literally dont care
But I guess your point stands yes, 1.8 does require less resources
Please stop talking about versions
How can i set set players tablist name ?
I cant really find anything about it
in what API version ? :>
lol
Does anyone know how to make mobs not hostile and not moveable on there own?
Use trash versions -> deal with trash problems
I dont have problems.
tho like, one google search got me an answer to change the players tabname/over head name
even for 1.8.8 lol
Lynx I want them to not be able to move on there own but I can move them with my body or with water etc
Ohh, hmmm probably less easy for you and might require NMS
you'd have to wipe their mob goals
I am using scoreboards to set the scoreboard of the player, but i dont really know how to set the player to more teams (because nametags with prefixes) interfere with scoreboards and then one gets removed, so in my current implementation both cant be running at the same time? do i have to make fake scoreboards or something
declaration: package: org.bukkit.entity, interface: LivingEntity
no that breaks the "move around and in water" afaik
Is that decided by the entities AI?
So is there no simple way?
Eh I mean, if you just want suffix/prefix then have either one scoreboard globally or (if neeeded) every player gets their own scoreboard and you have to maintain all players teams across all scoreboards
Well with that method o.O
You literally call the method with a boolean ^^
final LivingEntity e = world.spawn(loc, Zombie.class);
e.setAI(false);
No idea what a Boolean is
Btw this method is not present in 1.8 😄
you are in help-development o.O
Oh
you are coding a plugin right ?
Oh this is for coding plugins 💀
yeeaaa
...
if you just want to spawn one in game you do
/summon sheep ~ ~ ~ {NoAI:1b}
as a very basic example
But is that permanent
yea
that is persisted through restarts
however, again, you'll have to see if that is actually what you want to happen
Say like I have blaze spawners and I do that with blazes will they still spawn fall flow in water and not attack me
?tryandsee
Alright
tho for blaze spawners to all spawn blazes with that tag
If you let the spawner spawn an entity with that flag
Cant you specify a nbt String for custom spawner? Or did he mean naturally generated ones.
I have silkspawners
I think it works
So they don’t attack me but they can still walk
You always should
Meh. Not sure i
f it makes sense with sqlite
Probably good practice still
supporting Sqlite only is meh
yep
nice
why do people always confuse this channel with help-server
i never realised that you can do something like this:
for (ItemStack itemStack : player.getInventory()) {
}
Inventory interface extends Iterable
you don't need .getContents() to iterate through the items
but sadly InventoryView doesnt implement iterable interface
Would be a bit weird because it doesnt contain ItemStacks itself. It just represents the view of 2 inventories.
ah yes, im a developer, i can edit config.yml
Guys, anyone know how to send a title with subtitle? Thanks
does changing an enum that other plugins have already compiled with cause issues? like do they rely on the ordinal under the hood
You need NMS and packet in 1.8 iirc
Thanks ill do that
In 1.18? Just call sendTitle() 😄
You can even specify fade in fade out time
yah thats cool
Damn I never knew newer API has those cool feaures smile!
But yeah, Google once and you should find the respective Packets
Astounding, right? Its like people improved the API in the last half decade.
lol
b-b-but old versions are so much simpler to use!
No complex API additions like that dum PDC!
Sometimes i which that old versions would have been left out from CVE-2021-44228 patches.
Was an opportunity for a big cleansing.
people would have just downloaded a plugin to fix it
How would you fix this with a plugin? This was a vulnerability with the logger internals.
I guess with some regex...
Still
there were plugins made that intercepted it using packets
It is literally so simple, i added 5 lines of code for packets, and made it into my own function so i can easily do SendTItle(player)
Whilst having the efficiency and speed of the server with only 200mb memory usage
something a 1.18 server will never be able to achieve.
you could fix it with packet catching like Sam said
but eh, i mean whatever
200mb ram, zero features
You are making the wrong design choices, but ok...
Do you even have a playerbase worth sacrificing that much API and features for?
Increasing your development time by years just to have 20 players on an outdated piece of software
@neon minnow what server type
Its 1.8 so it has to be PvP/Minigame stuff
Or factions with laggy cannons
You gotta use a cannon fork 🤡
i mean as far as the jndi part goes mojang themselves had released a fix
Config get differnt value in a while loop
the regex filter
can someone please check out #942934911432687656 ? I'm trying to make it so the cube goes behind the player if it goes over his head
Does someone know what this effects are?
Guardian rays
All 3 of them?
Probably
Ah
No clue what 1st is
This ^
Is there a way to make it full white?
Try killing an ender dragon in the overworld
See if it's white
I'll check back later
hello I missed the method for creating a formated text like "&1H&2E&3Y" instead of doing ChatColor.BLUE + "H" + etc...
does this db query cause heavy load to db ?
ChatColor.translateAlternateColorCode
or something like that
why dont just reuse the queryhashmap thing for the first method?
instead of copying the codes over
just call the method with 5 mins
prob more readable code?
phwwww just realized they are two different codes
ah yea 😄 np
player.location.getY
create a new location and add thst for the y
Location location = new Location();
ty
or just location.setY(location.getY + 5) ? thats simple stuff you should know
dude, chill, i was wondering because im new to locations and shit. anyways, i figured it out, and yes, in the end i did use your method.. but im trying to get a whole location so i just did new loc with location.getx, location.gety + (variable), location.getz
just a question, how can i do async in a function?
trying to do object : BukkitRunnable() { } but it doesnt let me
^^
Yep
i read
it says to do new BukkitRunnable() {
/* the usual code */
}.runTask(plugin);
but i cant do that in function
what do you want to do and show code of what you want to do
just use lambda expression instead of new BukkitRunnable
I have a function. I want to thread sleep inside of it, but to do that i need to make it async. I cant make it async inside of the function, because bukkitrunabble turns into object: BukkitRunnable in Kotlin, and object cant be used inside function.
? sorry what u mean
sounds like
?xy
Asking about your attempted solution rather than your actual problem
stupid kotlin
i believe he is doing it wrong anyway
there should be a way, shouldnt make sense otherwise
Do you understand what i am trying to say
yes
wdym object can't be used inside function?
although I don't like kotlin, I gotta add that this statement is not true
its not letting me for some reason
show your code pls
yes
uhm kinda but why would youN
as long as you don't have thousand threads, I don't see any problems in putting one of them to sleep
just be sure to include a nice catchy lullaby before doing so
Just schedule the task instead of sleeping the thread