#help-development
1 messages · Page 438 of 1
https://blog.jeff-media.com/common-maven-questions/ here's the default maven-shade config
this?
you had like a website where you could pick stuff and it'd generate the pom
that's long dead, this is the successor
here's the GUI for it: https://github.com/JEFF-Media-GbR/Spigot-Plugin-Generator
I'm also doing an IntelliJ plugin for it
but IJ plugins are a pain
IJ being stupid again
start loop(wait 6 seconds and after that do smth);
}
else{
cancel loops for block;
}``` Hi guys, how can I make logic for starting loop and disabling it
You are missing the version
is there a way to get BuildTools to fully decompile all of NMS with spigot patches applied?
I know it's a spigot. I roughly described the logic, how I want to implement it
Hey, I currently have an entity as passenger of a player.
Is there a way to remove/kill the entity uppon disconnect of a player?
I've tried to "getpassengers()" uppon playerQuitEvent, but it seems like the passengers are already not a passenger anymore (list is empty) when that event fires.
The passenger entity just remains on the ground when the player disconnects, instead of being removed.
the version is declared in <pluginManagement>
as you see, it also builds successfully, maven understands it. just IJ doesnt understand it
I can save task number. The problem is only with the creation of the loop. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> { @Override public void run() { runTaskLater(this new Runnable() {...}, 120L) } }, 0L, 120L) so I need to make this?
okay, thanks
652k? its a joke?
no they are dead serious
i mean ofcourse its a joke, he just wants to learn some java, quite extensively
where do these parameter mappings come from? https://i.imgur.com/7L4YZHd.png
hey ive been having a problem for the past few days which would be that i cannot figure it out why my custom event wont fire. also something weird is that the code after the call line doesnt execute.
calling event
PlayerUtils.soundToAll(Sound.BLOCK_NOTE_BLOCK_PLING);
PlayerUtils.messageToAll(config.getString("prefix") + "§aThe Hunger Games have started! Good luck!");
HandlerList list = GameStartedEvent.getHandlerList();
JavaPlugin.getPlugin(PixliesHungergames.class).getLogger().log(Level.SEVERE, list.toString()); //works up to here
Bukkit.getPluginManager().callEvent(new GameStartedEvent());
JavaPlugin.getPlugin(PixliesHungergames.class).getLogger().log(Level.SEVERE, "test"); //doesnt print
event itself
public class GameStartedEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isCancelled;
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public @NotNull HandlerList getHandlers() {
return handlers;
}
public boolean isCancelled() {
return this.isCancelled;
}
public void setCancelled(boolean isCancelled) {
this.isCancelled = isCancelled;
}
}
listener
public class onGameStart implements Listener {
@EventHandler
public void startEvent(GameStartedEvent e){
JavaPlugin.getPlugin(PixliesHungergames.class).getLogger().info("Starting Hunger Games");//doesnt print
...
}
}
registering listener in main
getServer().getPluginManager().registerEvents(new onGameStart(), this);
i can also send the link to the project(pretty small) if it would help
Does the server freeze?
no
Send me your compiled jar
link to project. Nothing you have posted is wrong
https://github.com/Machmeinparaillegal/PixliesHungergames/tree/master/src/main/java/org/pixlies/pixlieshungergames
calling event in Managers.GameManager:54
event itself in events.GameStartedEvent
listener in listeners.onGameStart
registering in PixliesHungergames:70
ive sent you a dm
i know that the scheduler is bad, thats not my code ill fix it later after ive figured out why the event doesnt work
What does the console output when it starts?
Do handerList.getRegisteredListeners and loop over each.
then print them
instead of printing the handlerlist
totally not spending 1.5 minutes to compile, 15 seconds to send the file to the server and 40 seconds to restart to debug one fucking event
gods spare me
RegisteredListener{plugin="PixliesHungergames", listener="org.pixlies.pixlieshungergames.listeners.onGameStart@54215e5c", executor="TimedEventExecutor['ASMEventExecutor['public void org.pixlies.pixlieshungergames.listeners.onGameStart.startEvent(org.pixlies.pixlieshungergames.events.GameStartedEvent)']']", priority="NORMAL (2)", ignoringCancelled=false}
and the debug was unsuccessful so i changed one line, let's recompile again because much fun
why don't u just
Bukkit#broadcastMessage()
that's strange
the code looks fine
idk what can be wrong
cus the idea was to not send it to all players on the server but i havent done that yet so thats a placeholder
server and client on 1.19.3
jre 19.0.2
jdk corretto 17.0.6
Maven L
lmao
i know nothing about gradle
but i'm open to new experiences
for example this is my third project in kotlin
and my first comm in kotlin
so maybe someday it'll be gradle
though gradle loading times are fucking crazy slow
I'm looking if you guys know of an algorithm I can use to figure this out. I'm making claim zones where players can only claim in these zones. I want to maximize the amount of claims I can fit in a zone. This is an example with a claim size of 1 chunk, where there can't be another claim within its 1 chunk border inside a 7x7 zone where this would be the most optimal claim layout. https://gyazo.com/a1c0b5cc8e92a786399aba9b2bd6930f
never
❤️
is your server running on paper
new antirecord
))
i can't stand this
not even that big
my laptop just sucks ass tbh
i mean it's fairly large but not THIS large
my compiles are usually taking like 15 sec
i want to get back to my pc
this is unbearable
my pc would do this in like 15-25 secs
disgusting
agree
isnt there some shit for testing without starting a server
mockbukkit
i use mockbukkit in my main project
but here the tests would have to be way too detailed
i don't feel like doing that
i mean actually i could
but t oo late
tlauncher be like 3mins for 200mb
is their an alternative to storing value in config that dont reset after server restart?
Location value
i just yoinked my sister's laptop to open the browser and minecraft there
to decrease the overload on my main laptop
now i have 2 laptops and it looks absolutely fucking comical
location of player or just some random
you can store it on chunk's pdc
yes im making /setspawn command
is there a way to use non-obfuscated spigot in production?
but why?
like i tried that already
i pulled location with
Location location = ```p.getLocation();
plugin.getConfig().set("spawn", location);``` But when i already have things in the config it doesnt work for somereason
like i already stored a prefix: string in the config and now the spawn location doesnt save
Did you save the config?
player-!online: "&fThat player is currently not online."
flight-enabled: "&fSuccesfully &eDenabled &fflight mode."
flight-disabled: "&fSuccesfully &edisabled &fflight mode."
spawn:
the reset fo the stuff all works fine
the spawn stuff work too but when you restart server it wipes
saveConfig()
looks like something that yaml would yell at you for
ill try that thx
well, ! is probably not a special character in yaml
might actually work
Yes
if your config is wiping you are accessing the config too early, before you save your default config.
if your config is wiping, your hands should be fixed 🙂
One message removed from a suspended account.
delete .getType()
One message removed from a suspended account.
yay 2x faster
this is an enum not a field potionType
One message removed from a suspended account.
One message removed from a suspended account.
!verify
Usage: !verify <forums username>
P not p
get verified, then you can send screenshots
One message removed from a suspended account.
?img
Not verified? Upload screenshots here: https://prnt.sc/
how did you find this discord without knowing the website lol
One message removed from a suspended account.
@timber oar
public class GameStateChangeEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private GameState state;
public GameStateChangeEvent(GameState newState) {
state = newState;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
public GameState getNewState() {
return state;
}
}```
One message removed from a suspended account.
A private message has been sent to your SpigotMC.org account for verification!
public class GameStateChangeListener implements Listener {
@EventHandler
public void onGameStateChange(GameStateChangeEvent event) {
Bukkit.broadcastMessage(paint("&aHoly shit!"));
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Bukkit.getPluginManager().callEvent(new GameStateChangeEvent(GameState.CREATED));
}
}```
public class EtalonGame extends JavaPlugin {
public void onEnable() {
getServer().getPluginManager().registerEvents(new GameStateChangeListener(), this);
send("&aPlugin enabled!");
}
private void send(String text) {
getServer().getConsoleSender().sendMessage("[EtalonGame] " + paint(text));
}
}```
I like the naming of paint
😉
import net.md_5.bungee.api.ChatColor;
public class Painter {
public static String paint(String text) {
return ChatColor.translateAlternateColorCodes('&', text);
}
}```
basically
One message removed from a suspended account.
ez
One message removed from a suspended account.
why don't you just code yourself
Hello, it has been a long time I haven't played with minecraft. I want to update my pure NMS plugin using reflection for 1.19.4. But it seems that the PacketPlayOutMetadata constructor has changed (it was before (int id, DataWatcher watcher, boolean) but now it's (int id, List<DataWatcher.b>))
Any idea on how to get a DataWatcher$b instance from DataWatcher ?
well... you're writing effectType as a function
?nms
One message removed from a suspended account.
One message removed from a suspended account.
?nms
?switchmappings
Check out both
One message removed from a suspended account.
One message removed from a suspended account.
Nothign to do with me. my statement is correct
One message removed from a suspended account.
Not my fault you have other errors too
Thanks, I know I should do that but I'm rn too lazy to change my whole code (I used to just check manually the mappings x)). However since it's a parameter change is it still related to mappings ?
One message removed from a suspended account.
Maybe show your current code, and tell us which version it was originally for. In 1.19.4 you usually need getNonDefaultValues to get that list
item.getType().toString().endsWith("_SWORD") && item.getType() != Material.GOLDEN_SWORD;
Just use a Set<Material>
or ^
One message removed from a suspended account.
private static Set<Material> SWORDS_EXCEPT_GOLD = new HashSet<>();
static {
Arrays.stream(Material.values()).filter(mat -> mat.name().endsWith("_SWORD") && mat != Material.GOLDEN_SWORD).forEach(SWORDS_EXCEPT_GOLD::add);
}
public static boolean isSwordButNotGoldSword(ItemStack item) {
return SWORDS_EXCEPT_GOLD.contains(item.getType());
}
anyways just erase the line with PotionEffrectType = ... and arrow.setItem()
I'd do it like this
One message removed from a suspended account.
One message removed from a suspended account.
Wtf is that
Looks like chatgpt wrote that o0
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Yikes gpt should learn to use methods
and then make a new if
if (!SWORDS_EXCEPT_GOLD.contains(item.getType()) { /*item is not a valid sword*/ return;};
Iamgine
everyone's gine
One message removed from a suspended account.
except JanTuck obviously
he's a volvo
shit
Opel GL
One message removed from a suspended account.
One message removed from a suspended account.
@fluid river when i save config:
plugin.saveConfig();```
it just completely wipes the rest of the stuff thats in their, do i also have to set that stuff again?
One message removed from a suspended account.
Ford Mustang GC
well it's java, not java script
huh? How are you loading the other stuff
you need saveDefaultConfig() in onEnable()
wdym
One message removed from a suspended account.
One message removed from a suspended account.
and also you shouldn't modify the config by hand while the server is on
The code is too complex but here are the main parts :
NB: Last version was 1.19
// 1.19
PacketPlayOutEntityMetadataConstructor = PacketPlayOutEntityMetadata.getConstructor(int.class, DataWatcher, boolean.class);
// 1.19.4
PacketPlayOutEntityMetadataConstructor = PacketPlayOutEntityMetadata.getConstructor(int.class, List.class);
And here is how I construct it (PS: the getDataWatcher method is correct, I checked the mappings and the return object is yet a DataWatcher instance)
// 1.19
packet = ReflectionCache.PacketPlayOutEntityMetadataConstructor.newInstance(id, ReflectionCache.getDataWatcher.invoke(entity), true);
// 1.19.4
packet = ReflectionCache.PacketPlayOutEntityMetadataConstructor.newInstance(id, Collections.singletonList(ReflectionCache.getDataWatcher.invoke(entity)));
Now I get a cast issue error (cause I give a list of DataWatcher but it requires a DataWatcher$b instance).
class net.minecraft.network.syncher.DataWatcher cannot be cast to class net.minecraft.network.syncher.DataWatcher$b
Which is normal cause this is how look the new constructor (1.19.4) :
public PacketPlayOutEntityMetadata(int id, List<DataWatcher.b<?>> list)
Any idea on how I could get this DataWatcher b instance ?
yes i have that, that is just in another class to save the location of spawn
Exactly my question.
just pre-save a config base version in your jar
How are you loading and using the config.
I can't tell by your very little amount of code.
do you need me to provide all of it?
can you like call me and so i give you free java lesson
sure
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(myNmsEntity.getId(), myNmsEntity.getEntityData().getNonDefaultValues());
this is mojang maps
(you should be using mojang maps)
Dodge Paper
but remember that the methods will have a different name in every version, so reflection won't work cross-version
easiest way is to setup mojang maps
yes
well the code i sent above works perfectly
tried this (with string instead of GameState tbf), didnt work sadly
You don't need gamestate lol
ill try calling it from somewhere else, maybe thats it
You convinced me.. I was doing version-per-version adjustment but since 1.18 it's a real pain lmao. This work will benefit the future versions.
Thanks mate!
he literally only has one saveDefaultConfig in onenable and only one plugin.getConfig().set() + plugin.saveConfig();
and the saveConfig basically erases config contents
might be a bug of 1.17.1
its not, show code
ok it actually works if i call it from somewhere else... now im even more confused
Np!
well i tried it on my server and everything was perfect
guess guy's hosting has some problems
he is using some random free one
Oh and last quick question : I just read both articles, and it seems that I have to compile my plugin for each version. Am I right? And if yes, is there a way to do it multi-version compatible without using a thirdpart lib like PLib?
Seems like there is a nice gradle plugin made by screaming scandals https://github.com/ScreamingSandals/NMSMapper
You'll only need to compile for versions where things change. It's not all versions usually
Is it possible to set the gameTime value with packets to a player?
By gameTime I mean worldAge, if so, could someone clue me in, please?
so ive tested some things again and for some reason it calls just fine if its done in another event like you did but doesnt anywhere else...
can you call me so we can both look at the code
why do you need this
dm or vc here on the server?
give me free C++ lessons
How can i hide a player nametag an another player?
teams
Can you give me an example?
Hey guys! Im having a little bit of an issue. This could very well be a client side issue as i know iv seen it done before. What im trying to do is update the title of a gui (Currently, its just a timer but i have plans to use this for another feature). I have it working, my only issue is the PacketPlayOutOpenWindow removes all items in the inventory causing a super annoying flicker every second. Any ideas to work around this?
the thing was cuz guy used completablefuture
and called the event from it
Put both players in the same team, then theres a flag to hide players from the same team
so he messed up the task watchers work ig
we just tried several solutions(runTask, switching to bukkit scheduler) and they worked
Ye i saw that
Didn’t think much of it
yeah SnakeYaml isn't thread safe
anyone know how would i get the connection of the player in 1.19.4 it seems like they've changed it?
One Java question, I am reading some code and makes a variable private and then uses geters for accessing it, should I do it like this instead of making the variable public?
reflection as connection is private now
entities don't have a connection
good point too
connection.connection is private now
the ServerGamePacketListenerImpl is still public, and that's enough to send packets
but yeah, the COnnection field of that is now private
Anyone happen to have experience making NMS patches
It’s easy
isn't it explained in the ?contribute thing?
?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!
Yes
But when I run makePatches it just immediately closes and does nothing
And I can't read any error, because it immediately closes
Run it from a terminal
I've tried running it from command prompt and powershell
how
It opens a new window, and then closes
Open your cmd
iirc its bash filename.sh
its a .sh so wouldnt you need the bash
you gotta pass the work dir to buildtools
sh applyPatches.sh /path/to/buildtools/work/215721952167591265
sth like that
it's explained in the craftbukkit or spigot repo in the README
and in ?contribute
There we go
Still would be nice if the window didn't just peace out if you did it wrong
Thanks
well it's a CLI tool. if you'd ran grep or awk with a double click, the same would happen
Running it from command line didn't help
It did you just did it wrongly
Guh
./applyPatches.sh /c/mctest/buildtools/work/decompile-00fabbe5/
then it should print a ton of stuff like this
Patching net/minecraft/advancements/Advancement.java < net/minecraft/advancements/Advancement.patch
(Stripping trailing CRs from patch; use --binary to disable.)
patching file net/minecraft/advancements/Advancement.java
Hunk #1 succeeded at 39 (offset -2 lines).
...
how can I convert HH:mm:ss to Date?
first you run applyPatches, then you do your changes, then you run makePatches
Google your question before asking it:
https://www.google.com/
gnoogle
?bing
Bing your question before asking it:
https://www.bing.com/
?duckduckgo
yes, and only like this
?ecosia
Ecosia your question before asking it:
https://www.ecosia.org/
The fuck is an ecosia
tree thingi think
Sounds like a plant
Yahoo your question before asking it:
https://search.yahoo.com/
it's a woman who waters plants
Oh good she can search stuff for me
So I'm trying to wrap my head around why custom potions can cause a lot of lag if they include colour gradient lore (e.g an inventory of brews wkth custom gradiented lore is bad ju ju)
yeah, if she's not currently watering something, she can google stuff for you
Probably not
I mean gradients mean the packets for the item will be a lot bigger
It’ll probably be fine
Well server I play on uses brewery plugin and it has literally been (a few shilkers of these brews are essentially lag machines)
i remember selling books of poems about sausages on a minecraft server back in the days, people paid good money for those poems
I've been using ecosia for like 2 months now and it's surprisingly not bad
that was not related to snakeyaml tho
https://github.com/DieReicheErethons/Brewery
This is the one btw. I'm just curious as to if they've done anything wrong, or if it's just an inheranr flaw
With custom brews
Ooft
Lmaooo
Nom Nom Nom
But legit I'm trying to see if it's the code itself or some minwcraft flaw with custom pots. Seems like one of those where if the plugin falls flat on its arse during the first fight with 50+ players
Then seems a bit naff
As said the thing lags tf out with just a shulker or 2 of drinks
Client or server
Server
Sounds a little surprising
But if it really is that bad a quick profile should catch it
Oh no they know it's the issue. I'm here as someone learning more about nbt to know why its sufh a huge issue
I.e. is it nbt itself or is it how this chucklecluck has coded it in
Oh plugin issue
chucklecluck
Profiler will quickly pinpoint it still
Tis true. Its one of those where apparently its nbt gradients?
Always wondered if id looked at this right? Whats the big "wtf" thing on here?
Can't you send a link or something
He can
Didnt want it up for too long for obvs reasons
idk what those reasons would be
There is no sensitive information in the spark and/or timings report
They’re made to be shared
Quite a lot of ram.
100+ player server go brt
how many is quite a lot
48G
ah thats nothing
48GB is barely enough to run IJ with the minecraft dev plugin
i run it on like 4
i only lag if i open the material enum
legit tho was there any hints as wtf is goin on lol
?
dafuqs up with that
I mean. A bit high ping and msct or whatever it was called
It is to be expected with that amount of players on one server though
1 sec
anyone who can kindly help me out with this problem
my guess is it is a ghost item
player.playSound(player, Sound.BLOCK_NOTE_BLOCK_PLING, SoundCategory.MASTER, 1, 0.5f);
System.out.println("Running!");
```doesn't seem to play any sound (1.19.4, this code is indeed running as the print statement runs)
Do you have your sounds turned down? ;p
need to share the link for the spark profiling for anyone to really know
looking at one or two images of what you think it is, doesn't help
when you are the one asking for help on it
They’re linked to effects now aren’t they?
Think i read that somewhere in here
Some effects have sounds but that's always been the case
You can still play sounds independently from effects ;p
?paste
why are you writing assembly in java
Gotta have your code be as fast as possible!!!1
I am not 100% sure where to ask this it is sorta development help , I was just wondering if anyone knew a place where I could find like 1-2 people that would be willing to help me test a Spigot Plugin I am working on. I would not say its complex but it does have some depth to it.
If anyone here is willing to help feel free to DM me for more details
why can't you test it yourself??
well yes I am but it involves using a API you use to do stuff in the game and I just want some outside perspective is all.
is this the best palce to save my system msg in different languages?
then release it on spigot
or create a spigot thread
fair point my bad this is my first proper plugin and I have like no idea what im doing outside of coding lol
Is it possible to not send certain people a death message? I can't seem to find a way in the documentation.
The only way I found to prevent players from getting a death message is by using a game rule or by removing the message all together, however, both options are not favorable
Remove the message and then manually send it to the players you do want to see it
The only issue with that way of doing it is that it breaks support for other plugins like DiscordSRV
Hey I don't have a ton of experience with Java so I might be misunderstanding something, but I'm getting a NullPointerException whenever either of these goals try to use any methods from the bind "variable" they are passed. The TFTZombie class is able to access the methods just fine so why is the bind being passed as null to the goals?
can you show how are you initializing TFTZombie
To avoid using NMS more than necessary I'm only using the TFTZombie for spawning a zombie with custom pathfinders. It is spawned from the createEntity method in the ZombiePiece class that handles all of the other important operations
but the nms class needs to be able to access some methods from the pure bukkit one so it is passed a copy of it to keep access
can you show your npe stacktrace, because i can't really see how bind can be null there
I'm sorry I'm not exactly sure what that means, do you mean like the server error?
yap
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.
this is the stacktrace from literally just trying to call the println method in the constructor
can you show TFTNearestTarget.java:25
its called latch in this one but its the exact same thing as bind I just forgot to change it
You would have to do some debugging, you can use intellij debugger and track that bind variable, i don't see anything wrong here
probably someone other will find problem
alright thanks for the help anyways
can the intellij debugger run with the minecraft server?
ohp I found the article nvm we good
Hi, I have a problem, I use PersistentDataContainer, and when I save a value in the metadata of an item, it works but when I reconnect I see that there is one nbt tag less and there is no longer the information I stored there
Hey! How to make a color TabCompleter?
@late swallow initialize latch
Your issue is that latch is null that is being passed into the constructor and in that class you also dont initialize latch so its automatically null. If you set a null with a null its still null
Here you are extending tftpiece but are using static methods. Might need to initialize the class before you can use the static method otherwise its null as well in some cases
hmm, what would be the best way of calculating the amount of blocks within 2 locations?
gotta loop every block ofc
could just do it async ig
amount of air blocks*
my bad
just wanting the best performance possible
in this case latch is actually an abstract class, all the other classes (ZombiePiece, SpiderPiece, CreeperPiece etc.) inherit from it and override its methods, but since the pathfinder goals are generic for many mobs, they only require anything that inherits from it
So there was probably a way to make it more concise or function better but Im not well versed enough to know that
Then you need something to inplement the abstract class for it to be usable
Abstract classes cant be instantiated directly
yeah which is why I think I'm going to try to move away from that implementation because it seems really poor and overcomplicated lol
not abstract classes in general just the way I was trying to use it
Probably wise, since it doesnt appear that is what you want to do anyways and should look into using interfaces instead
Still need to implement the base interface everthing extends from but still gives you the ability of casting if that is what you need and associating classes with each other
Im still using that part
but I dont think the nms entities need to have access to it
I was mainly using it to store extra stats that minecraft mobs don't usually have (crit chance, mana, stuff like that) but I think storing them in nbt would be easier
Does it need to be persistent?
especially because for my purposes the data will be cleared at restart anyways
no
its for a minigame type thing
Then create a wrapper class around the entity to add extra info to the object
Is there a 'default' block/item list for the TabCompleter?
That makes the data persistent which you said you dont need
like how the /give command has all the minecraft:acacia_button stuff?
I don't need it, is there a way thats easier?
No but you can make one fairly quickly
Instead make a class that takes the entity as a parameter and thus have a custom entity object to add the info you want. Toss that object in a list or hashmap
That is essentially the basis of a wrapper
will the pathfinders and such be able to access that though?
It needs to be able to be changed on the fly
Dont see why it wouldnt be able to
Anyways got work to do lol. Hope that helped in figuring out your null issue as well come up with an alternative solution
thanks for your help!
how do i save a variable to a player and also call it?
Do you want to save it across restarts
yeah
They are just plaintext with fancy formatting
Spigot has an api for yml, and also includes gson which is an api for json
You can do it async if you use a ChunkSnapshot. For best performance use World#getHighestBlockAt on each location within the chunk, calculate the air up to build height then iterate the blocks downward and count the air.
Also don't forget there are multiple types of air now, there's CAVE_AIR and VOID_AIR depending on your server version.
no, but you can just create a List<String> on startup
private List<String> blockNames = Arrays.stream(Material.values()).filter(Material::isBlock).map(Material::name).collect(Collectors.toList());
@Nullable
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
return blockNames;
}
I already got a solution for it, thanks thought
oki, I hope you're not using Material.values() everytime
because that's quite slow, it creates a new huge array everytime
nah just something entirely different lmao
oki
How does the hex work with ChatColor?
Bungee Cord one has the capability to do that, right?
would streams be good here? I have a hard time picking between for loops or streams
public static boolean isPlayerGenerator(UUID uuid, Location location) {
if (!playerGenerators.containsKey(uuid))
return false;
Location generator = playerGenerators.get(uuid).stream()
.map(PlayerGenerator::getLocation)
.filter(location1 -> location1 == location)
.findFirst()
.orElse(null);
return generator != null;
}```
or
public static boolean isPlayerGenerator(UUID uuid, Location location) {
if (!playerGenerators.containsKey(uuid))
return false;
PlayerGenerator generator = playerGenerators.get(uuid).stream()
.filter(playerGenerator -> playerGenerator.getLocation() == location)
.findFirst()
.orElse(null);
return generator != null;
}```
idk man
yea?
Do I have to implement a hex converter? or?
import md5 chatcolor not bukkit
&
it is
^
& is the char
there's 2 different ones
huh
@eternal oxide sorry to bother but
i needa know
You are instance comparing location. Probably not going to go down well
your code is asking if they are the same Location object
same memory address
also locations values are doubles so unless created VERY carefully they can fail an equals check
hm
how are your locations being created?
ok if it's a Block location you should be ok with .equals
okay
which one should i pick?
there's 2 different streams
or use for loop?
i have a hard time choosing
the first is the better use of a stream
okay, thanks
but not really much difference
thanks
Is there some method in the spigot or bukkit api that returns the server type
eg: Spigot, Bukkit, Paper, etc
Bukkit.getServer().getVersion() is kinda what i need but it has the server version and git and other stuff.
I just want the server name
isRunningSpigot() would return true on spigot and all forks
same for isRunningPaper()
ok thanks
how do i make my own placeholder to use in config?
like if i use %player% in the config it would automatically convert to the player's username
sick, thanks
gotta read the full page, not just the part I sent, maven information etc is at the top
how could i do that with my config though
String myString = getConfig().getString("join-message"); // Imagine it's "%player% joined the server"
String myReplacedString = PlaceholderAPI.setPlaceholders(somePlayer, myString);
ok so I might be wrong but I think slimes literally have no pathfinding
it looks like they're hardcoded to jump and pray
how does that 2nd line work?
wdym how does it work?
what a peculiar issue
like the (somePlayer, myString)
it's a normal method call?
they definitely jump towards me
but yeah they just go into the exact direction, not trying to avoid obstacles
yes, but what does somePlayer mean
it looks like the underlying implementation is an objective that just figures out who's nearby and blindly jumps in that direction
Player mfnalex = Bukkit.getPlayer("mfnalex");
String joined = PlaceholderAPI.setPlaceholders(mfnalex, "The player's name is %player%");
this would obviously print "the player's name is mfnalex"
yeah
they probably couldn't find their way out of a chuck-e-cheese maze that would be given to @echo basalt to shut him up for 5 minutes
i only know chuck-e-cheese from parks & rec
damn it now I gotta check who streams parks & rec
When i package using maven how do I stop it from creating the original and snapshot files and just make it override the actual plugin file that is there so I dont have 3 copies?
https://i.thick.at/wxc3H4HU.png
hey there
is 9 am here
and we are losing players because of server is down
i need to know the answer to that question really quick
but now, i put the exact dependency on maven to compile my other project with it
and its just giving me this garbage error, im raging, HELP
Well what is the error
Unsupported class file major version 61
wrong java version
but, it works with gralde
?paste the full error
would there be a way around this?
ItemStack itemStack = GeneratorHandler.getGeneratorItemStack(block.getType());
ItemStack itemInhand = e.getItemInHand().clone();
itemInhand.setAmount(1);
if (itemInhand != itemStack)
return;```
without doing setAmount?
that's all of it, its just giving me class version error
its not, the full stack trace error
ok
Idk if you can get rid of original, but shaded is something in your pom. What's the issue anyway
way around what?
That != Will always be true, need .equals
since they both need to be the same amount
you wan to compare? if (itemInHand.isSimilar(itemStack))
I Just want to be able to package and have it replace the files that are there instead of making the others. When I package the first time I get 1 file. Then if I package without removing that first one it makes the original. Then if I package without removing either it makes the snapshot and eventually it makes me package 2x to actually get the changes I made to my plugin so I have to go in and delete all 3 files
clean package, unless you really want them all in your local repo
same 🙂
https://pastebin.com/axBfUshr
Clean and install would solve the issue or is that just good practice to do?
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.
Update maven shade version to support version of java used by mongo
under plugins section?
ok, lemme try
I would move lines 42/43 to between 19 and 20
Actually be careful with that
oh it works, thanks!!
Honestly pinning outputDirectory is just messy and prevents anyone else building your plugin
I think @tender shard has a blog post
But I would leave as is and symlink the plugin in your server dir
That happens when im bored in class
PlayerInventory.addItem adds to hotbar first right?
Iirc no
yes it goes slot zero first
Is it possible to rayTraceBlock the whole world?
but why?
about the output location? If so, profiles are the easiest way
short answer: yes
long answer: yes
😂
long answer should be yeeees
fancy thing with maven
thats individual
you can read it as yes but also as yes
the profile can also be declared globally in .m2/settings.xml , then you can use it for every project without having to declare it
thats cool, ill give you that
but where's the one which automatically sets you up a testserver
just put the maven-exec-plugin into a profile and make it run java -jar spigot-1.19.4.jar
@hybrid spoke ```xml
<testServerPath>C:\mctest</testServerPath>
</properties>
<profiles>
<profile>
<id>runTestServer</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>${testServerPath}/plugins</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>run-testserver</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${testServerPath}</workingDirectory>
<executable>java</executable>
<arguments>
<argument>-Xms128m</argument>
<argument>-Xmx512m</argument>
<argument>-jar</argument>
<argument>${testServerPath}/spigot.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
this should do, havent tested
yeah works fine
what the fuck
?
why does clearing the inventory call InventoryClickEvent
maven be like
so NMS has PathfinderMob which does not exist in the Spigot API, however is there a way to determine if an entity extends PathfinderMob without using NMS?
yeah, straightforward, ikr
isnt that from mods
yo anyone know how to put a . in your gradle module name like how java has it for its jre and jdk modules like aaa.bbb.ccc
why is there a ClickType.CREATIVE in InventoryClickEvent?????????
mf how do i differentiate from a clearing click and a normal click in creative mode now
this shit
i swear
inventory's weird but that actually makes sense
looks like i'll have to find out the action
its like shift doubleclicking your whole inventory into a chest
it will call for every single item
perhaps
gradle modules have nothing to do with java modules
ok is it possible though
idk that
the gradle docs don't mention anything about rules for module names
it only has some recommendations, e.g. to use kebab-case-formatting
PAathfinderMob is Creature
in bukkit
this is the inheritance in NMS and their bukkit equivalent:
| NMS | Bukkit | |
|---------------|--------------|--------------------------|
| Entity | Entity | |
| LivingEntity | LivingEntity | Has health, etc |
| Mob | Mob | Has simple AI |
| PathfinderMob | Creature | Has simple pathfinding |
| Monster | Monster | |
| Zombie | Zombie | Has specific pathfinding |
oh that's cool
I am trying to create a new world, however it hangs the server a bit (The world file is copied async, and then I am using worldcreator sync to load it into bukkit), I am also preventing spawn chunks from being loaded, is there any way to run world creator async as well
Yo. I was just curious. Does spigot have any plans to add back the ".setTitle()" option for inventories at some point? It was taken away a while ago for some reason, but was hoping to see it make a return
it's now per view
what the fuck
you need to get a player view and edit the title there
Ohh so now each player sees their own personal menu basically?
that's pretty cool tbh
Thanks for letting me know 🙂
So uhh any chance you're able to tell me how I can edit it? 😅
thought it would simply be a matter of
player.getOpenInventory().setTitle(title);
```but it seems there's only a "getTitle()" option there
You need an inventory view
updated the blog post about changing the maven output directory using profiles. Now it's only one <profile> configuration, instead of needing a property, a profile and a global maven-jar-plugin config: https://blog.jeff-media.com/how-to-make-maven-automatically-put-your-plugins-jar-into-your-test-servers-plugins-folder/
no setTitle option it seems
Just tested on InventoryClickEvent
event.getView.getTitle()
``` is the only option as far as I'm aware
should i be doing this?
@Override
public boolean isGenerator(Material material) {
return Optional.of(generators.values())
.orElse(Collections.emptyList())
.stream()
.map(Generator::genItem)
.map(ItemStack::getType)
.anyMatch(material1 -> material1 == material);
}
@Override
public boolean isGenerator(ItemStack itemStack) {
return Optional.of(generators.values())
.orElse(Collections.emptyList())
.stream()
.map(Generator::genItem)
.anyMatch(itemStack1 -> itemStack1.isSimilar(itemStack));
}``` im sorry, i really hate how i can't decide on Streams or For loops
yesn't. what even is that
yeah you cant change the title. only clientside with packets
basically, if values is null it'll make it an empty list and if it isn't it'll do .stream() then map it to the genItem (Itemstack) then returns if there's any matches
and whats your goal
and whats your question
Out of curiosity, why was this removed in the first place?
Also any chance you might be able to provide me with an example of how to do so, with packets please? 🙂
public boolean isGenerator(ItemStack stack) {
if (generator.values() == null) return false;
return generator.values().stream().map(Generator::genItem).anyMatch(itemStack -> itemStack.isSimilar(stack));
``` would be better imo
no idea. also this could help: https://gist.github.com/Cybermaxke/7f0a315aea70c9d62535
changing the title was never part of the API
it wasn't removed, it was never there
just compare with ==
alr
you always can. but enums should be compared via ==
Hmm. I might be thinking of something else then. I know something was removed/changed about inventories but I can't recall
maybe something about the viewers 🤔
why does it matter
no yeah doesn't matter anymore ig, just a personal vendetta now to figure out what that old issue I was having was 😂
erm, if none of you mind can one of you check of this file and tell me what i should change https://github.com/Outspending/GenCore/blob/main/CoreCore/src/main/java/me/outspending/handlers/GeneratorHandler.java
Some materials have null metas
where?
oop
ohh
yeah let me fix that
thanks
np
is everything else decent, im changing .getPlayerGenerator() rn
I guess you should cache player gens
your isGenerator(ItemStack) is more restrictive than the isGenerator(Material) method.
And when a generator is added recalculate the cache
^
oh yeah ik, that's on purpose
oh alright
uh you probably wanna fix it .gitignore, you shouldnt be pushing /build/ to github
rename Handler. lookup SRP/SOLID. use a logging framework. log4j comes with CB. cache your stuff. looks like this class is very performance inefficient
erm
oki
but is it decent at least?
hopefully 🤞
yeah, just questionable packages
true
looks like copilot generated
I have a world's files, and I am trying to load them using WorldCreator, however even if I disable spawn chunk loading, it still takes a good ~5ms to load, plus a server hang (Which is what I care about, the 5ms is perfectly fine), any way I can stop the server from hanging?
Not sure what you mean
Say I have a world named SomeWorld, if I run new WorldCreator("SomeWorld").createWorld(), this would load the world as it already exists as a world folder, now the problem I am having is that while the operation takes relatively little, it seems to cause a hang/lag spike, as this method can only be run sync, and that's my problem, I am also using
@EventHandler
public void on(WorldInitEvent event) {
event.getWorld().setKeepSpawnInMemory(false);
}
to speed things up (I manually load needed chunks), this decreased overall time it took to load the world, but the slight lag spike is still there (0.2s or something near that, didn't take accurate measurements)
A hang/spike when
200ms doesn't seem outrageous for pretty much the heaviest operation on the server
If you think there's something particularly slow that can be optimised, open a bug report with a profile showing where the spike is
Oh no that's fine, It can take time, I am just trying to not make it visually block the server (For example I'd be fine if it took 200ms but it didn't block like entity movement and such)
does anybody know if it is possible to have multiple chats, one per language, so when a player enters the server he/she chooses a language and then only see messages sent to the correspondent chat?
This is a development channel, use -server for plugin help
yeah, just cancel all chat messages and run a for loop to send the messages to the correct channel if ur making a plugin
Okay, I was asking because if it is possible I'd like to implement it xD
Yes it's possible
I might try to get WorldCreator to be thread safe, then my issue would technically be solved
unregisterGenerator might be able to make use of the return value of map#remove instead of containsKey
createGenerator computeifAbsent might be a bit more concise
registerGenerator logs an inaccurate registration time since registration takes place after the logging
you should probably log more than just the exception's message in your try-catch
Video displaying this (Around second 3 it happens)
you cant really prevent that
you could use paper or write your own world creation thingy which goes async
but normally you dont create worlds that frequently that it be noticable
for what
They are like prefabs, so pregenerated technically
does any one know how to allow essentials to but pickaxes and stuff on your head when /hat is used?
since when is setLore deprecated?
wdym by that
because paper wants you to use Components
its just lore()
?whereami
W video
when I do /hat with a pickaxe it says "this item can not be used as a hat" and I need it to allow me to do that. @terse ore
it not though
its*
and if not that do you know of any plugins that would allow me to do that?
I cant
why
I do not have any programs that allow me to write java. it to expensive
theres free apps
yeah
Notepad can write java
you could still code in notepad
you also got intellij community
intelli j/eclipse/visual studio code all have free stuff
if you needed to pay to code this whole concept would end
was about to post just that
lol
are you sure? because I tryed and the code always endsup looking like "Êþº¾ 4
java/lang/Object <init> ()V " every time I edit or make a file
oof
and has weird stuff
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
thats not gonna help
if your goal is to make stuff with java it will
but if it's not, just use one of those linked plugins.
But the code always breaks or corrupts
Damn
idk why or how
I can write python, but I doubt that will help with mc
I started with python
me too. see: "python"
(like 4 years ago 💀)
grabbing an existing plugin seems like the better way forward for you then
if it looked like this you tried to open a .class file with bytecode in it
I like your pronouns
it never looks like that. its ways messed up looking
you where trying to open a compiled file
I tryed every program I can
They literally opened a .class in notepad
lmao
At least not a .jar lol
what kind of decompiler/disassembler is that?
bytecode viewer
huh
shows the decompiled code and a bytecode disassembler
I'll stay with recaf
I'm usually using
https://github.com/java-decompiler/jd-gui
why they used that color for boolean
fuck knows
and in italic 😭
Recaf requires JFX if you are running on Java 8. Runs best on Java 11+ (where it can resolve JFX itself)
But yeah, it sometimes is a bit strange
the only way i could make it run was from cmd and i couldnt be arsed to do that everytime
Yeah I guess you are running it with the wrong JDK then
Compiled? It was a.class file. the only 2 files that I can use are .class and .dll idk why
.class files are in java files
what does .dll have to do with this
nothing
yeah, .class files are in jars, the .class file is the compiled .java file
oh sorry, .java file. I thought you said .jar
any way idk how to fix it, but thanks for the help
one quesion guys, how can I detect if I created the inventory or if someone just renamed a chest for example?
By using InventoryHolder and not (only) checking by name
how would that help?
If someone renamed a chest it won't be null
ooh
For a custom inventory it is (unless you specify one)
yeah makes sense
Use Recaf. It can edit such files
ok I will try that
Oh well that works, thanks!
I want to store a lot of key value pairs, should I use yml json or sqlite?
If they are basic types I'd just use DataInputStream/DataOutputStream
string string
yaml or json are not that great for larger parts
okok ty
Ew no
Sqlite if a lot means thousands
not to be confused with ObjectOutputStream
You don't need to make your own file format no one else can read
Then performance is irrelevant
Yaml
JSON is like the standard for data storage though
But I guess people will be more accustomed to yaml here
YAMLConfiguration is op ngl
But also rather slow
If you want to use something that shall be represented in a tabular matter then using a SQL storage system is likely wise
why is this the case when I try to check if a string != null
im checking it from a config file
Are you using getString?
yea
Show us
show u what
How you are loading it till you are using it.
?paste
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
Oh wait
Why are you using .replace on something that is nullable.
Also why are you trying to get it as a string and then a string list
Only one of them would work since it can't be both
I'm getting it as a string to check if it exists
just use isset
or even better check if getStringList is null or empty
empty check will be handled by that for loop so just check null
bro ignore that, as I said its not working for anything I have
for normal strings
its still not workibgn
and im so confused
Send that code
strignlist is never null, so just empty
ah
?paste
remove the replace part
why
getStringList will return null IF the section is not a List
It's marked as @urban grotto in javadocs
oh I'm corrected
Tbf
hwo can I save a YAMLConfiguration?
ok sorry what, I don't understand how I'll fix "commands"
I always thought that returned null, same as if a section didn;t exist
saveConfig();
.save
strange
@rotund ravine you said its never null, so can I just check if its empty?
Yeah