#help-development
1 messages · Page 1890 of 1
WTF? Using 1.18.1, and I cannot extend JavaPlugin?!
Libs I use are norm just the commons, redis, mongo, and a few others depending on the project
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
I made a quick video trying to explain my problem https://www.youtube.com/watch?v=bR7fYKxGsM4
Anyone know what the hecc is going on
People mistake "don't reinvent the wheel" for "don't ever make something better" don't reinvent the wheel just means if someone has already created a library to handle universal logging don't create your own because it's just going to make everything more difficult for everyone else
Sure but its properly written and documented.
There are truly horrible plugins which are widely used. CoreProtect for example.
Super hacky and half of it is just String based. And instead of abstraction/overloading they simply use Object parameter
Why the hell are they making this be that crap?
Read the reason thats at the bottom

cause no full dev not does use a build system like maven or gradle
I guess it was pretty enough that we just needed to import a server jar instead of a bootstrap jar... -.-
Show me the constructor for BagInventoryClickEvent please in hastebin or something
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.
Hello, how can i set a backend server as default server? (Bungeecord)
I mean that the players are always connecting to this server if they join, not to any other even if they played on another server the last time
Just makes no sense that the variable changes
I don't mean to be stupid but it's -1 by default so I assume that you're not setting it?
You call the wrong super constructor
ah
didnt know there was an extra one for this specific thing
thanks though i was really lost
super best java function
there isn't a better one.
extending a class and using its constructor. ah just beautiful
cancel the move event
Listen to the move event and see if the target location is in another chunk as the current location
You should probably do this mathematically as the move event is quite expensive
I mean you could set walkspeed to 0? Not sure if that'd freeze them in place or not
I mean you don't want them to leave you don't have much of a choice beyond barriers but if you want other players to be able to then idk beyond some sort of check for location
Yeah you’ll have to use the move event
Or a runnable, but that isn’t really any better
I recommend use CompletableFuture for Async
or just the scheduler
Also note even with movespeed 0, they can still sprint jump
I've never used it so I wouldn't know.
😔 cant stop jumping without hacky workarounds
Is jump boost that hacky
This is probably as cheap as it gets:
@EventHandler
public void onChunkCross(PlayerMoveEvent event) {
Location from = event.getFrom();
Location to = event.getTo();
int fromChunkX = from.getBlockX() >> 4;
int toChunkX = to.getBlockX() >> 4;
int fromChunkZ = from.getBlockZ() >> 4;
int toChunkZ = to.getBlockZ() >> 4;
if (fromChunkX == toChunkX && fromChunkZ == toChunkZ) {
return;
}
event.setCancelled(true);
}
I'm sure there are libraries which calculate chunks
Otherwise you should be able to get the chunk coordinates by the spigot api
Think I've done that a few years ago just forgot how.
You could also use the PlayerMoveEvent and check if the player's from Location is greater than one block, and if that Location is in a different chunk.
That’s what that does
How does config reloading works?
uh
you gotta use the copyDefaults method
getConfig().copyDefaults(true);
saveConfig();
that should do it.
It'll reload the config?
I don't recommend reloading the config using that method.
Anybody know of any good terminal manipulation libraries for Java?
Ah, ok
There are none :)
But JLine, Jansi, etc. are neat.
Java does not support a lot of terminal features you'd see in native apps (or even JS ones)
Why
Any opinion of how is made this?
How would I create a custom mob with a player skin that I can equip armor, items?
Just save the config once again using it's config, reloading the config messed up earlier my entire config file and cleared it.
Is this a 3d model based on Armor Stand Head?
Probably
I seen that you load that title based a 3d model title
I've heard using heads you can add any textures without requiring the client to download anything
I mean the player
Hello, I'm trying to restore a map by unloading all of its chunks (with ought saving them) and loading them back again, the problem is when I unload the chunks they get saved, so when I try loading them back again the chunks aren't getting restored. Does anyone know how I can prevent chunks from getting saved? The restoring feature works on version 1.8 but it won't work on any versions above. Here's a pastebin of the world restore method: https://pastebin.com/nkAixcLG if you could help it would be much appreciated.
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.
Lanterna perhaps?
You want to code in 1.8? or 1.18?
uhhh thats not that hard ...
How can I fully regenerate (and change the seed) of the whole world including other dimensions? I'd really need it for my plugin
anything above 1.8
well... you cant rly modify the overworld with this easily ... but for any other world just unload -> remove files -> load with new seed
You can’t unload the main world at runtime
not with the api 😄
Can't I create another new world, make it an overworld, mark it as main and delete the old main?
You could, but you wouldnt be able to change the seed.
depends on if you want to do some hacky stuff
How?
hacky?
do you know how to use packets ?
No, but I can learn
Hello everyone, I have a question about netty for reading packets
Every time someone "inject" a player for that in the PlayerJoinEvent, creating a ChannelDuplexHandler and then do this
ChannelPipeline channelPipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel.pipeline();
channelPipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
But I see that when I do this outside a PlayerJoinEvent -> for example after a command custom, it does not work
does anyone know why it's only working in the PlayerJoinEvent ?
Thanks
thats 3 different java versions and 10 different minecraft versions, with quite a big recode in the middle.
reflection to access world-stuff to close the datastreams and access the world-list to modify the list of worlds ...
then you can create a new world and need to replace some stuff to get this work
i would prefer md5 to give a damm shit about Multiverse and other plugins and instead implement my PR so this would get quite easy ...
then you should probably start with this with google on how to do this ^^
Ehm wow
What its better for singleton or which one is correct/incorrect:
1-
public ClassName {
protected static ClassName instance;
public Classname() {
if (instance == null) {
instance = new ClassName();
}
}
public ClassName getInstance() {
return instance;
}
}
2-
public class Main extends JavaPlugin {
protected ClassName instance;
public void onEnable() {
this.instance = new ClassName();
}
public ClassName getClassName() {
return instance;
}
}
1.16
I mean it depends on how big of a world you want to keep.
Both of these are terrible.
So what do u recommend?
private static final ClassName INSTANCE = new ClassName();
public static ClassName getInstance()
That's an actual singleton.
Also you'd need a private constructor.
But if i use that every time i getInstance() the class will create a new instance
No it will not lmao
you just return INSTANCE
A field is not evaluated every time it is accessed.
I only want to restore the region which contains around 1000 000 blocks
Or at least i was my problem when getting Player menus from map, because every getInstance was creating a new instance of class
one sec
public final class MySingleton {
private static final MySingleton INSTANCE = new MySingleton();
private MySingleton() {
// you could also inject some logic in here to get the caller
// but that's unnecessary unless you're really strict about reflection
}
public static MySingleton getInstance() {
return INSTANCE;
}
}
That is a pure singleton ^
yeahh... i am sadly to lazy to find the issue for not saving scorebaord+gamerules for this world then 😄
only a small amount of a million blocks....
Allright and what i was doing on mainClass what its that?
Does it have a diff name?
Oh ok
No all of it
I don't know the actual name for that design pattern.
The point of a singleton is that there can only ever be one of it.
But I'm restoring it 100 000 blocks at a time
This doesn't work if it extends JavaPlugin.
Therefore the 2nd one is the best if your class extends JavaPlugin
Then don't make your plugin a singleton, use DI.
Singleton is fine for the JavaPlugin instance lol
DI was what i use on MainClass so?
just delete the world and regenerate it
This isn't objective.
why PlayerPickupItemEvent is deprecated
Read why?
There's a large number of people (like myself) who fucking hate singletons.
And your reasoning?
Coupling.
Wait using singleton can i have many ClassName#getInstance() without getting a new map, set, etc on every method call?
I suppose, but DI is just obnoxious as fuck
I looked into that but I need to keep the worlds name as it is, if I change the worlds name the minigame won't start.
And the fact that most people use them incorrectly (e.g. like in the context object pattern, where large services will never be cleaned up)
is there any event called when someone copies an item in creative with middle click ?
I am only suggesting Singleton for the JavaPlugin instance.
I'm not entirely against static, it has a place in certain areas (utils and static factory methods)
DI for everything else.
Change it so it will just wipe the world and generate a new one with a custom name...
I mean one benefit I can see of using a singleton plugin is that it makes it enforces the plugin instance in the rest of your code.
So after listening to you Maown and Dessie this is wrong?
There should be a ClickType you can check against, but I’m not sure if it’s available in the creative event listeners.
Why do you never use final or private?
for what event 💀
A class could extend FileManager and set instance to something else, making it invalid.
InventoryClickEvent ?
Yeah you should use DI for that Verano
Trying to just roll a world back will just lead to corruptions and unnecessary resources.
@brittle loom
protected because if not you can acess the varName from outside of the class when i only want you getting acess to getMethod()
Creative mode has different events you need to listen to. CreativeInventoryEvent or something along those lines. Not at my computer atm.
private
Use private then
Private is more hidden than protected, that's why he said an extended class could change it.
"hidden"
protected makes it accessible to classes in the same package as well.
As well as classes that extend that class.
It's a little more hidden than public but not by much, especially since your class is inheritable.
Same lol
Apparently it's also package-private
I stared at my IDE confused for like
5 minutes
When I saw an inspection for my protected field
really
Yeah it's fuckin' weird
So there is no way that only getting the getMethodName() and cant getting varNames (no matter if you extend it or not)
I don't understand what you mean
reminded me that I need to check for creative mode in my nuke plugin
Do you mean there's no way to stop people from getting fields? If so, then no. It's called the private keyword.
Yes i want only people getting the methods, not fields and no even extending the class
no I mean that it takes away an itemstack even if you are in creative mode because I'm a bit silly
Okay then make your field private and your method public.
You can also use final on that field to stop it from being set to something else.
But i can also get fields being final or not final
Yeah
I dont want that be possible
Which is why you private-ize the field as well so it's only accessible through the method.
private makes something only accessible to the class it's in.
protected makes something accessible to the class it's in and subclasses.
public makes something accessible to everything.
protected and no modifier are also package-private, meaning they're accessible to the classes within the same package
Mnns
Yeah that means you have to set the config field in the constructor.
I dont wanna that btww
Because otherwise my main class would be filled with crap
I need a keyboard for: Dont let you getting fields, only gettings methods, no way of extending for (getting fields/methods) and only be able to use it in the same project
I'm pretty sure that's not how it works.
Like i need to load more than 10 files. I have 10 lines extra
That i can take them out from main class
You'd just move them to the constructor though.
But why?
So you are telling me
Using fileManager.getInstance(FileHandler config, FileHandler lang).register()
So?
just do new FileManager()
oh ya
i agree
You can instead do plugin.getFileManager()
Even more lines of code on main class because i need to initialize the class and then create the getter
🤔
Guice?
To much things for doing something easy
Yes that no my problem, my problem is that doing in this way i will be getting more than 1000 lines.
😂
I mean if you design it well enough
I'd argue the main class wouldn't be too bloated
I use the main class for only services and registration
e.g. creating instances of other classes and then registering commands/listeners
services refence to what?
Ah now yes i understand
Which doesn't take up that many lines btw
Wait i wanna as k you smth
Yeah?
If i use singleton and i had some data saved in map/set/list/etc and i do Class#getInstance() that data will be there or it will be empty because its create a new memory space?
If it's a singleton that memory is never cleared.
static things do not get garbage-collected, and as the instance of the singleton is static, it can't be garbage-collected nor the things contained within the instance.
So what the singleton does is create an instance and reuse it
Btw verano guice allows singleton (:
Haha yeah ^
Yes
The singleton pattern is one where you have a single instance of something and cannot create any more instances
Why is why it's called a "singleton"
i mean the event for player middle clicking a block and it coming to the player inventory
So if I save objects the object will be there, no matter if calling multiple times getInstance() data will be always there
Yes
Same thing applies to creating things in the main class though
You always help me
Since the main class isn't cleaned up till the server stops
Or sorry, until the plugin is unloaded
Yeah
So if had something saved on map/set/etc will get deleted i suppouse
By the way if you wanna know another way of implementing a singleton
Yeah
It goes like this
public enum MySingleton {
INSTANCE;
public String getWhatever() {
// just a basic example method
...
}
}
:)
"Effective Java" says this is a good way to do singletons but I somewhat disagree since it's unclear what's going on here.
am I dumb or should this work just fine? 1.12.2 btw. There are no errors at all
private static final String[] sounds = new String[Sound.values().length];
@Override
public void playSound(Location location, Player player, int sound, float volume, float pitch) {
System.out.println(Arrays.toString(sounds));
player.playSound(location, sounds[sound], volume, pitch);
}```
You would use this like MySingleton.INSTANCE.getWhatever()
i didnt understand it
Yeah exactly
That's why I never advocate for it.
So
An "enum constant" is essentially just an instance of an enum class.
e.g. INSTANCE is actually a new MySingleton()
You can't create any more instances of an enum from outside of one.
So, enums can be singletons, since you can declare methods in them.
I still don't really recommend this.
But it's a cool fun fact at least.
(Another off-topic fun fact: Did you know enums can implement interfaces? They can't extend classes though)
I didnt know btww
It's good for a system where you want extensibility but you also want to support enums.
GUYS
when i cancel InventoryClickEvent,
the item duplicates, how to fix it, please answer if you know
So you can have an enum called DefaultStuff that implements Stuff, as well as an ExtraStuff class that does the same.
im getting ignored, feeling good
Java actually does this in a few places, namely NIO.
Yeah I'm having a conversation with someone else right now.
I'm not forced to respond to you :p
Also
You told people to answer if they knew
I did not know, so I did not answer.
it be like that
can the types of the standard config be changed if the server owner would if he change the int or bool to a string or something?
I'll do that thanks for the help👍
So I get this error when using my own library lmao: https://paste.md-5.net/megovilisi.pl
plugin source: https://github.com/JEFF-Media-GbR/Spigot-BestTools
updatechecker source: https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker
I really don't get why it throws this error
thats pretty wrong
Without the code telling us that an event canceling not working is like me saying a outlet in my house isn't working to the electrician standing outside. The answer is the same "can I see it"
Checking a pdc and setCancelled
the array is literally empty, u just set its size?
System.out.println(Arrays.toString(sounds));
just use super.playSound(and pass in the stuff)
player.playSound(location, sounds[sound], volume, pitch);
I found the problem lol
Im on phone rn
I got two classes with the same name in the plugin and the lib
did u try player.updateInventory();
if its a ghost item it will disappear
The method is just not there
what
Oh
declaration: package: org.bukkit.entity, interface: Player
Wait
No i just messed something with cast
o

I will try tomorrow thanks
ok
Next time send the code or we are going to ignore you again
That's what being a developer is like.
if I have an int in my config, will the user be able to make it something else or will it always be an int?
The user can do whatever they want with it
lol weird question
they could replace that pretty int with "ooga booga" if they wanted to
they could even replace it with "uwu 69 asd"
very good point, I failed to consider that
I need my config debugModeEnabled always be a boolean, how™️
You can't
how can I get a standart of a config path?
The user can set it to whatever they want. You can however, throw an error or warn them and set it to something default. I wouldn't do that imo it's best to let it crash so you can tell the user personally how dumb they are when the error says "unable to parse bool from 'treu'"
.
standart?
what does that mean
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
when you add a path to your config, you add a default to it. I need to get that default
I don't see a way to get default here
Default what? I'm confused
when you create a new variable in your config, it has a default value
path is the name, value is the default value
Alright so you set a default now what
I need to get it from another function
use .get?
Tbh I have no idea how defaults work
oof
I think there is a getDefault? Idk
Well there is a public Configuration getDefaults();
Question when I spawn a FallingBlock how can I make it that he wont disappear?
and what is the output type?
hmm, maybe this`?
No that’s just the normal get
Is Class.forName slow even if the class is already loaded?
@waxen plinth https://stackoverflow.com/a/18232127
how can i send data via proxiedplayer to spigot server
ServerInfo#sendData sends the data via first player, not the specified player
ProxiedPlayer#sendData sends the data to player's client, not to the server
how can I check the type of a variable?
instance of might be useful
ok thx
^
Couldn't you just specify the players info in the data?
ye i am going to do that
i was looking for another efficient way
but seems like there is not
#general
ok this is pretty basic but I'm getting tired of trying to figure this out xd
How can I get the message from a custom Exception? (which I think is the message given to the exception when thrown)
I tried e.getMessage() but it returns null so idk 😦
I know this is not reallly spigot too but... yeah xd
What do you mean by custom exception
show code
public class DisabledCommandException extends Exception {
public DisabledCommandException(String message) {
super(message);
}
}
This is my custom exception, idk if it should have something else lol
try {
Utils.isCommandEnabled(command);
} catch (DisabledCommandException e) {
sender.sendMessage(Utils.color(e.getMessage()));
return true;
}
And this is what's supposed to send the message given by the exception but e.getMessage() is returning null.
What does e.getMessage return
Like type
String
Show us where you throw the exception
I am making a villager that when clicked shows an interface to interact with. This villager has to stay when logging out and logging back in.
Best way to achieve this by extending entity villager and spawning a custom mob? Or are there much easier ways of doing this?
public static void isCommandEnabled(Command command) throws DisabledCommandException {
System.out.println("Evaluated command: " + command.getName());
System.out.println("Received value: " +
Main.config.getSpecificValue("Commands." + command.getName().toString()));
if (!((Boolean) Main.config.getSpecificValue("Commands." + command.getName()))) {
throw new DisabledCommandException("&c" + command.getName() + " command disabled.");
}
}
well, the exception class extends Exception so I thought it'd handle the setting by itself, that's what I'm not sure of too
yeahhh I thought about that too but I wanted to learn the exception thingy xd
What class does the getMessage method come from
Question why is this giving me this error:
BukkitTask s = new BukkitRunnable() {
int count = 0;
@Override
public void run() {
if(count == 150) {
this.cancel();
run();
run2();
return;
}
for(ArmorStand armorStand : armorStands) {
entityUtil.up(armorStand, armorStand.getLocation());
}
count++;
}
}.runTaskTimer(main.getInstance(), 0L, 1L);
java.lang.StackOverflowError: null
at com.google.common.collect.MapMakerInternalMap$Segment.get(MapMakerInternalMap.java:1430) ~[patched_1.17.1.jar:git-Paper-233]
at com.google.common.collect.MapMakerInternalMap.get(MapMakerInternalMap.java:2345) ~[patched_1.17.1.jar:git-Paper-233]
at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:329) ~[?:?]
at co.aikar.timings.MinecraftTimings.getPluginTaskTimings(MinecraftTimings.java:81) ~[patched_1.17.1.jar:git-Paper-233]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.<init>(CraftTask.java:79) ~[patched_1.17.1.jar:git-Paper-233]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.<init>(CraftTask.java:44) ~[patched_1.17.1.jar:git-Paper-233]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler$3.<init>(CraftScheduler.java:308) ~[patched_1.17.1.jar:git-Paper-233]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.cancelTask(CraftScheduler.java:285) ~[patched_1.17.1.jar:git-Paper-233]
at org.bukkit.scheduler.BukkitRunnable.cancel(BukkitRunnable.java:30) ~[patched_1.17.1.jar:git-Paper-233]
at me.katze.av.rides.flatrides.chairswing.chairswing$1.run(chairswing.java:61) ~[av-0.1.jar:?]
I think it is inherited from Exception (?)
Throwable, actually.
yeah, just noticed heh
Reading the documentation you'll find this
Read in detail the entire comment
And I'm sure your question will be answered
Ahh
Whoops this one my bad
Will this work?
lol i was already reading xdd
so it is not being set because it is not automatically incorporated ?
Seems like it.
what should I do then? make a setMessage myself? or what? xd
Still same error any Idea how can I make it otherwise?
It's weird because it shouldn't be null.
That’s worked for me in the past without issue
Almost sure it is returning null or at least that's what I'm thinking from the log in my server, let me test it rq
"i think"
first check
you can know by
going to the maven repo dir
and seeing if the spigot dir is there
goodnight yall
b r u h it is working now wth hahaha
{homedir}/.m2/repository
Welp gg
i mean, i got this.
I swear it was giving me a NPE before, idk what did I change but it is working now, sorry for bothering, thanks! 🙂
your local
windows 11 👀
is that windows 11?
yes those are the new folder icons
yea
a
i want it too but my school blocks it
Man they added so much s p a c e
see the BuildTools.log
and see if it ran without problems
i almost said make sure u have mavenLocal but then i realized..... hes using maven
The space can be disabled ....
didn't find any problem
Shouldn’t be enabled in the first place
what space
between the icons
It is enabled by default
I am using Win11 and it is so buggy with multi screen...
idk it doesnt look toooo bad
I restarted intelijj and now the 3 sends errors xd
did you run buildtools for this version ?
whoops
It's more it feels like
its
really
spaced
out
I mean you either load a chunk or you don't the most efficient way is to only load those you need
there is also preloading
load an area of chunks before anyone comes near the chunk
?Math
is there any way to properly make entities ridable (e.g. sheep)?
I know I could spawn an invisible boat but
that would require to basically get all the existing mob speeds etc, manually control them using code etc
probably way too complicated
Purpur has a patch for this ( https://github.com/PurpurMC/Purpur/blob/ver/1.18.1/patches/server/0006-Ridables.patch but it's so long, I doubt that can be easily done 😦
I've got a question with buildtools, can I ask that in here?
yes
So, I am getting the following errors when running the build tools with and without a .bat file.
Starting clone of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git to CraftBukkit
Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file CraftBukkit\._LGPL.txt698738479853962368.tmp to CraftBukkit\LGPL.txt
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:215)
at org.spigotmc.builder.Builder.clone(Builder.java:1051)
at org.spigotmc.builder.Builder.main(Builder.java:333)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: java.io.IOException: Could not rename file CraftBukkit\._LGPL.txt698738479853962368.tmp to CraftBukkit\LGPL.txt
at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1516)
at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:563)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:467)
at org.eclipse.jgit.api.CloneCommand.checkout(CloneCommand.java:385)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:212)
... 3 more
Caused by: java.io.IOException: Could not rename file C:\Users\lahou\Desktop\Desktop\SpigotBuildTools\BuildTools\CraftBukkit\._LGPL.txt698738479853962368.tmp to C:\Users\lahou\Desktop\Desktop\SpigotBuildTools\BuildTools\CraftBukkit\LGPL.txt
at org.eclipse.jgit.util.FileUtils.rename(FileUtils.java:323)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1514)
... 7 more
The error starts at the second line
sounds like something on windows is grabbing a hold of the file
are you running this in some synced folder or is your antivirus scanning stuff
I'll try this without the Av running, that caused problems in the past
quick fix: did you try to reboot? 😛
for windows, yes 😄
🙏
:3
Thanks!
np 😄
The Av 😬
lmao
Yea
whoops I missed that
Nah dw
I still steal the credits
:>
Have you tried using templeOS to run all your builds?
Is there a lightweight schematic parser library that doesn't require the entirety of worldedit to be loaded?
Does anyone know an NMS util for custom entities that does it like this? I don't know how to add attributes are there any guides on that ?
Do you need to use NMS to work with custom entities?
You probably don't have to use NMS to modify attributes
so i can just cast my custom entity to spigot and use that instead?
NMS should really always be a last resort
Yeah I know but seemed a little easier this way but prob wrong
anyway I am trying to make a villager that just sits there and is interactable
you could probably just do that with spigot right ?
My question remains
if so how would you check if your villager is a custom one that i spawned using a command? (without the name in case I dont want to name it)
Chances are no one here knows one if no one answers
The persistent data container is your friend
Chances are not everyone is online at the same time
i dont know if this has anything to do with it but I just passed it looking for my solution might be something related https://www.spigotmc.org/threads/structure-util-nms-schematics.199250/
Then wait a few hours before asking again I suppose
Also you want to make it unable to move just use this
Now it is not working in the IDE itself. This is the POM.XML dependencies part:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
It gives an error for the version: Dependency 'org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT' not found
I do have the folder in: C:\Users\user\.m2\repository\org\spigotmc
https://www.spigotmc.org/threads/a-guide-to-1-14-persistentdataholder-api.371200/ is this fine if i am using 1.12?
nope. where is the problem when using schematics already to use worldedit ?
Can't use PDC if you're in 1.12
I see no point in including all of worldedit for something soley dedicated to loading a schematic from time to time
I was something about metadata
well then create your own system... but schematics are part of WorldEdit ... you could also use the Structures API if your not using ancient versions
Schematics are not only part of WE, they came up with the base concept
But by now, it is more of a standardized format
@halcyon mica Schematics use the NBT format.
That has been revised plenty of times already
thats why you can create your own system
I know, gzipped nbt
Sponge has documented their extension of it via GitHub.
But that's all you're gonna find, really.
I was hoping to not have to create my own parser
I believe schematics actually originate from MCEdit.
dont know how schematics are build (what keys ....)
but chances are not that bad that you can use the Structures API anyway ^^
I have been explicitly told to not work with structures
hmmm why
Don't ask me
We are asking you because why
If they didn't give you a reason, do it anyways :)
I just get a list of requirements and things I am to avoid
I do it, and get paid
I don't care enough to ask questions
Then either write your own or start searching I suppose
copy&paste is way harder then writing own system trust me
+1
+1 by the expeirence.
I trust you
Just going to post this without a reply. I am getting the error in the second block. I ran buildtools earlier
POM.XML
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
It gives an error for the version:
```Dependency 'org.spigotmc:1.18.1-R0.1-SNAPSHOT' not found ```
I do have the folder in:
```C:\Users\user\.m2\repository\org\spigotmc```
did you properly reload your ide
Yes
do you have the foldet and also the jar ?
org.spigotmc:1.18.1-R0.1-SNAPSHOT is not a valid dependency
so like, make sure you clicked the maven reload button
did that twice
rip
Guess I'll have to reboot the pc at last
how do you make an entity freeze? but not with no ai
No ai fully disables the enemy ai not letting it to do anything. Why don't you use it?
Just rebooted and it still doesn't work
cause i use some ai
actually no ai does that also make it not pushable?
I think you can push it (using code) or tp it even with no ai
As its still an entity and it still has its coordinates and velocity
yeah but I also want to make it not pushable
Hi, how do I make a "timer", for example, if the player does not give a command within 30 seconds he is expelled, or something along those lines, how do I make this timer?
I saw some old post overriding the g(double d0, double d1, double d2) method but I cant do that so idk
Try pushing it, maybe it won't be
it is pushable atm
oh i did it
overwriten this method
and than it stops pushing
velocity still works fine
Bukkit.getScheduler().scheduleSyncDelayedTask()
For anything else, use your ide
Or google
thanks
?paste your full pom
For me too, but not for the ide
I'm late to this party but build tools has been run I assume
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< me.cosmicdev:ACMobs >-------------------------
[INFO] Building ACMobs 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.spigotmc:spigot:jar:1.18.1-R0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.248 s
[INFO] Finished at: 2022-01-15T23:45:38+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ACMobs: Could not resolve dependencies for project me.cosmicdev:ACMobs:jar:1.0-SNAPSHOT: org.spigotmc:spigot:jar:1.18.1-R0.1-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Process finished with exit code 1
you did run maven with --rev 1.18.1?
erm I mean buildtools
Do it again
java -jar BuildTools.jar --rev 1.18.1
done
I ran it using the .bat file
- Run BuildTools again (with --rev 1.18.1)
- Run mvn clean package -U
what bat file?
send your bat file
or better paste it
?paste
Is it possible to get a player's name with all the corresponding colors and prefixes that this player has? :)
It runs with latest
Vault API
No possible way with the spigot api?
Vault handles prefixes
So you need to query their API
as well as the spigot one for other stuff OFC
You can try doing the Player#getDisplayName() thing but it may not give you all the information or none at all
players do not have any prefixes in spigot
it's something thats provided by other plugins
e.g. vault
that doesnt work :I
As I said, the chances are very small
yes, team prefixes eg
Any idea on what may be causing the issue, because if I run the clean and pkg thing, still getting errors
You need to use vault
Okay, thanks :)
out of curiosity, I saw a minecraft dev plugin for intellij idea that generates an initial project (mavan depends etc). Should it be used or is it better to do everything manually?
You should use it if you have enough experience.
Doing things manually is a good learning exercise.
But yeah I know MinecraftDev, it's a very nice plugin.
those aren't assigned to any player directly though^^
I always use my pom generator: https://pom-generator.jeff-media.com/
(only works when you check at least one dependency though)
I really dislike the intellij minecraft plugin
okay got it :)
check whether this directory exists:
what is allatori?
C:\Users\mfnal\.m2\repository\org\spigotmc\spigot\1.18.1-R0.1-SNAPSHOT
Yes it does, but when I removed the .1, so just 1.18 it works. That dir also exists
Guess it works now$
im trying to check if a item has a certain enchant, this is what i have
.getEnchants().containsKey(Enchantment.DURABILITY))
what should i put inside containsKey instead since rn it throws an error
there is no ItemStack#getEnchants()
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
there is itemmeta.getenchants but i did not see hasEnchants ty very much :D
np^^
for getEnchants: it returns a Set
for getEnchants you'd have to use getEnchants().getKeys() to check the enchantments
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (event.getItem().getItemMeta().equals(BetaRelease.betarelease.getItemMeta())) {
Player player = event.getPlayer();
DustOptions dustOptions = new Particle.DustOptions(Color.fromRGB(255,0,0), 1.0F);
player.spawnParticle(Particle.HEART, player.getLocation(), 100, dustOptions);
}
}
}
why is that even static
ah kk ty
im such an idiot XD
would that fix it?
yeah i changed it
Question when I spawn a FallingBlock how can I make it that he wont disappear?
sorry but
you can't
they will ALWAYS disappear at some point
I spent hours getting it to work - listening to events, manually setting the "alive ticks" to 0 every few seconds, ...
they always get removed after about 5 minutes at most by vanilla
I just need them for 20 seconds
Okay thank you
declaration: package: org.bukkit.event.block, class: EntityBlockFormEvent
I think you can cancel this
oh wait sorry
Okay
Thanks
np
what would be the best way to store data on achievements (which players have already completed which achievements)? a row for each player and a column for each achievement?
'x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type
This is the error.
package me.cosmic.mobs;
import net.minecraft.network.chat.ChatComponentText;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.monster.EntityZombie;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
public class TribeDruid extends EntityZombie {
public TribeDruid(Location loc) {
super(EntityTypes.be, ((CraftWorld) loc.getWorld()).getHandle());
this.x((float) loc.getX());
this.y((float) loc.getX());
this.z((float) loc.getX());
this.cn(new ChatComponentText(ChatColor.RED + "" + ChatColor.BOLD + "Tribe Druid" + ));
}
}
This is the code. I am pretty confused on what it causing the error and why I can't use things like setPosition
It cannot resolve the setPosition method
Use Mojmaps
See the 1.18 release post for more info
Where can I find that?
Main page of spigotmc
Other question I'm able to teleport falling blocks?
I mean in a smooth way
I'm trying to do it like this but this is now a good idea I guess
public static void teleport1() {
for(FallingBlock fb : door1) {
Location loc = fb.getLocation();
CraftEntity ent = (CraftEntity) fb;
ent.getHandle().setPositionRotation(loc.getX(), loc.getY(), loc.getZ()+0.1, loc.getYaw(), loc.getPitch());
}
}
you must use remapped NMS
sorry no idea
of course you can use .teleport
Why are you using CraftEntity for this
since they fall, they SHOULD be able to accept velocity too
^
Idk just used the same methode I'm using for armorstands
So just normal teleport?
and why do you use NMS to teleport armor stands? lol
the API can do it, no need for NMS
It runs smoother
this should definitely be a thing in spigot API
Hi, I want to write a plugin that prevents Elytras from being repaired. So its about enchanting with mending, combining with phantom membranes or another elytra. Which events should I look into?
why doesn't it exist D:
bump 😄
There's an event for mending, for crafting there's CraftItemPrepareEvent, and for the phantom membrane, there's PrepareAnvilEvent
thanks! crafting what exactly? 👀
is it about applying the enchantment book?
Yup
thanks!
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (event.getItem().getItemMeta().equals(BetaRelease.betarelease.getItemMeta())) {
Player player = event.getPlayer();
DustOptions dustOptions = new Particle.DustOptions(Color.fromRGB(255,0,0), 1.0F);
player.spawnParticle(Particle.HEART, player.getLocation(), 100, dustOptions);
}
}
}
It’s not workin
How I fix?
Did you register the event?
Yes
Use debug statements to figure out which line isn’t working then
<classifier>remapped-mojang</classifier>. This is what I add right? Nothing else?
because I ran the bt with --remapped
and added this
There is more
That was the only thing I read on a spigot discussion
Just add that?
Yeah
no, you need more
You can PR it 
Hello everyone, I'm making a plugin for kik for afk. How can you ignore the push from the water?
Still doesn't work
Send pom
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Yea, it actually works. It's crazy when things work, I'm not used to that lol
lol
when im getting the lore from an item if the lore has a color / chat color how can i remove that from the string or check if it is in the string
ChatColor.stripColor
to check if it contains any colors: check if ChatCOlor.getLastColors is null
bruhhhhh tysm lmfaooo9
how can I remove all of a certain material from a player's inv?
i was trying to do String.replace and when checking using != "symbola"
declaration: package: org.bukkit.inventory, interface: Inventory
player.getInventory.remove(item)
removes all of that material
yea I was looking through the docs when I found out what that does
Getting this error sometimes now https://www.toptal.com/developers/hastebin/ujonavugiq.properties
check if getCustomName() == null before u use it @elfin atlas
custom name can be null of course
as @buoyant viper said
if something is annoted with @ Nullable, ALWAYS do a null check before accessing any methods on it
i see only CraftItem event
👀 is it that one?
oh sorry
it is
PrepareItemCraftEvent @wintry badger
oh wait you talked about the anvil event
declaration: package: org.bukkit.event.inventory, class: PrepareAnvilEvent
or are you using some outdated MC version?
World#spawnFallingBlock
declaration: package: org.bukkit, interface: World
can you pls juste give me the code to spawn it bc its like the 15th time i go on this site and found nothing that work
I literally sent you the method to use
what did you try?
and what doesn't work?
all
show the code you used
I really don't understand what you can do wrong with this method
it takes one location parameter and one blockdata parameter
ok I don't like it but here you go
World world = Bukkit.getWorld("world");
BlockData blockData = Bukkit.createBlockData(Material.DIRT);
world.spawnFallingBlock(new Location(world,0,100,0),blockData);
how can i disable the item drop?
You should really learn to use javadocs
@shrewd solstice
declaration: package: org.bukkit.entity, interface: FallingBlock
i put this on what?
I think this would be enough to prevent players from repairing elytras? i know they wont be able to rename elytras, but its not a problem
@EventHandler public void onPrepareAnvil(PrepareAnvilEvent event) { if (event.getInventory().contains(Material.ELYTRA)) { event.setResult(null); } }
this seems to work but im curious if theres any other way to repair elytras in the game
run buildtools 1.8.8, then add spigot as dependency to your pom
Via repo maven please
does anyone the difference between these InventoryAction.DROP_ALL_CURSOR and PLACE_ALL?
nvm I found out. DROP is for putting it "outside" of the inventory, i.e. dropping it
I already add <type>jar</type> but here is no difference
Hahaha
I will prob create a normal project instead of maven one
u could add it via local file
idk ur the one whos maven cant find it
?paste your pom
^
you used spigot-api
instead of spigot
spigot-api = only api
spigot = spigot-api + NMS + craftbukkit
Ahh
did you run BuildTools for 1.8.8?
Why run build tools??
to get spigot
Im using it from maven repo
Yes it is
no it is not
Go to sonatype
SPIGOT IS NOT IN THE MAVEN REPO
Yes
It's not
no it's not
you aren't
otherwise you wouldnt get an error
No cuz,because the first time i declare the repo
spigot-api is in the repo
And then its get download to local repo
spigot is not
nice equation
if you're a dev you should probably've used BuildTools anyways :p
?bt
No never
I run buildtools everyday with cron lol
how else would you run a test server?
Already compiled jars
. . .
https://paste.md-5.net/xusaqicuga.gradle
https://paste.md-5.net/momakogaxa.xml
a little longer, but boy at least now i know its not gonna randomly shit on me because of an update or something
FUCKING KNEW IT
From there
Y'all didn't see it but I did
:3
@sterile token That is not an official source.
switching from gradle to maven ❤️
I love it
i just dont know how a few of the tasks i used to use work
No sites that provide pre-compiled server jars are official, and are prohibited from mention/discouraged from use.
like i cant figure out an alternative to gradles 'application' plugin
i tried 'exec' but it kinda
almost worked but didnt
what does it do?
the application plugin
Provides a script for running an application.
it lets you run your project
maven exec should work fine
it almost was
here's an example for maven exec:
@buoyant viper You shouldn't use Maven btw.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>run-allatori</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Xms1024m</argument>
<argument>-Xmx2048m</argument>
<argument>-jar</argument>
<argument>${user.home}/.m2/repository/com/allatori/allatori/${allatori.version}/allatori-${allatori.version}.jar</argument>
<argument>${basedir}/target/allatori.xml</argument>
</arguments>
</configuration>
</plugin>
Just my advice.
but a system property i was trying to provide just didnt work, and then when i fixed that, a dependency wasnt getting included or something
why?
bro maven is amazing
nor should i use gradle
Yes.
maow build system when?
Don't use Gradle or Maven :)
my time is precious and my money is short
bruh
Both are shit for different reasons.
the people want and i have nothing to give
maven is nice. gradle is nice too but... maven does the same thing, just easier
i NEED Maow build system.
EXACTLY
I'd argue Gradle is easier when it takes less lines to do the same shit.
yeah exec seems simple enough but it still crapped out on me
maven at least doesn't need a 150MB wrapper downloaded into EVERY project
yee
imagine you have 10 gradle projects - now you have 1.5 GB of useless wrappers
i think maven is a bit more stable, gradle can break something you used in just one swift update
gradle projects take SOOOOOO long to load for me
Maven projects take forever to compile for me :p
yep, because their servers are slow as hel
ikr
well if you have many many modules, that's true
At least Gradle is fast after first run
that's true
It was a single source file with just a few dependencies lmao
both maven and gradle have their ups and downs
lets switch to SBT
It spent like a full minute resolving dependencies and then a few more minutes compiling.
weird
Not to mention how fucking terrible Apache's projects actually are.
Here's a question, has anyone here done cyclic multiplicative groups with java 🤔
so log4j had a slight hiccup
More than just Log4j
ik
my angelchest plugin takes over a minute to compile but I once converted it to gradle and it was only like 5 seconds faster than maven, so..... whether it takes 60 seconds or 55 is probably not really important
The very library itself is bloated
But past that
There's tons of things that make other projects better than what Apache does
How often do you import Apache collections over Guava?
Bidirectional maps, immutable collections (which can be faster), multimaps, etc.
And Guava has more functionality on top of that.
(Although I wish it were modular)
And oh god
Have you even delved into projects like Apache Maven Resolver?
Like, sometimes you might need to resolve a Maven dependency with transitiveness and other important aspects.
Well, why not use the official solution?
It's god awful to work with.
(This is because Maven Resolver should actually be called Repository Resolver, seeing as it is decoupled from Maven)
(This also means it's over-engineered and it follows too many enterprise design decisions, like thousands of services with no good explanation)
Face it, Apache libs are outdated.
Minecraft no longer imports Apache Commons iirc.
lang3, io, codec, compress in 1.18.1
Codec and Text are pretty useful actually, but beyond that ehh...
(Oh yeah, fun fact, Compress is much slower than java.util.zip)
they still import apaches Http instead of using the Chad java 11+ HttpClient
smh mojang
(Like much slower)
Well that's probably because HttpClient isn't technically JDK API.
oh actually wait
apparently they moved the package
Java 9 and 10 it was in an incubator stage
yeah fair enough
it was introduced fully in J11 yeah
Why not just make your own HTTP server? :)
i have
Same
it wasnt nearly as correctly implemented as any other http server implementation
but hey
it served static files
lmao
btw this is awesome:
if you quickly wanna download sth from your server without any SFTP setup etc
python3 -m http.server
creates a webserver from your current directory
i usually have php installed so i just php -S 0.0.0.0 or whatver it is
my main grievances with Maven boil down to usability
for one
the documentation is hosted on Apache's shitty site
I say their site is shitty because I find it hard to navigate
gradles isnt really much simpler
oh u hate it bc of that? i hate it bc its called fuckin POM
SGML was aight, still not readable but not as bloated as XML
actually
HTML would make a decent format for a lot of stuff
but it's cemented as "the website format"
well sure but it's also a little cleaner
yes
but in reality none of these formats work great
I personally don't like formats that require indentation (to either function or be clean)
because they're painful to work with in a text editor that doesn't automatically indent
tab key go brrrr
Some text editors still interpret TAB as "insert tab character"
But I personally prefer 4 spaces
what kinda text editors r u usin
Nano and Windows Notepad



