#help-development
1 messages Β· Page 830 of 1
oh
So v1_20_R2 is enough for all 1.20 versions? π
no
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
But is 1_20_R3 then?
no
there isnt really a reason to support those versions, they're already on a 1.20 versin update to latest
I think i understand, where it says NMS Version, that's the version you have to have in your plugin, so I need support
1_20_R1, 1_20_R2, 1_20_R3
To be able to support the entire 1.20 - 1.20.4
correct but in most cases there isnt a point to support all of the versions for 1.20
Okay! but then I at least understand how this works, now I'll just try to get a value from this code that is not null π
If v1_20_R3 is to support both 1.20.3 and 1.20.4 then should it have 1.20.4-R0.1-SNAPSHOT in pom.xml?
what list to use so as not to add duplicates but at the same time it is possible to take an object by index as a list
Is there in maven option to get bungee proxy module instead of api?
There's no collection for that
what you can do is just check if the element is already present before adding it
OR
Use a set and wrap it as a list
which might break the order a bit
With the first solution you have to deal with time complexities
With the second solution you have to deal with an unordered list
well not if you use a sequenced set like a LHS
Yo if I have a block variable in a BlockBreakEvent, and I use block.getType() some time later will the material return always as air? Seems to be the case for me, wanted to confirm
Materials are constants so I don't think you're suffering a mutability issue
it's backed by a LHM which is ordered
I wouldn't hold a hard reference to a block
you sure?
this.griefer = player.getName();
this.block = block;
this.material = block.getType();
this.blockLocation = block.getLocation();
this.standingLocation = player.getLocation();
this.date = new Date();
this.itemInHand = player.getItemInHand();
this.previousOwner = previousOwner;
this.fixed = false;
}```
I have an object that saves it and it takes quite a while after the event to get saved (opening up of threads). Seems the this.material always saves as air
yes, it uses a ctor that is only used by the LHS and so it knows to use a LHM
BTW keep in mind that if you're coding on a version below 1.13 holding a reference to Location can cause memory leaks in the case the world that it points to is unloaded
this is cursed
LinkedHashSet does not keep the order, I mean, yes but not necessarily
Hash table and linked list implementation of the Set interface, with predictable iteration order
Yes
But
Stop
If you remove an element
And insert it again
It won't be on the "last"
It will
It will be on the same position as before you remove it
You sure?
Yes, Absolutely
Wasn't Set collections based on the object hash?
????
does anyone know how I can make intellij not throw it's own exceptionsfor @NotNull parameters
But LinkedHashSet is a combination of a linked list and a hashtable
na
just the ones that has Hash in their names
as geol said as well
I've been thinking wrong all my life π
Why the hell would the collection remember the position of an object even though it is absent?
Remember that hash collisions are not only possible but also relatively likely to occur
Idk, maybe you want that behaviour. Anyway, you are right, dummy thinking by my part
LHS is amortized O(1) access via hash code, but iteration order is guaranteed by insertion order
or, well, that's LHM, and so is LHS by extension
Reee it's O(k/n), where as k is the actual size and n being the amounts of elements
Or I could just leave the default one?
Myes, though that has it's dangers
sure you can do that, but that is not a good hashCode algorithm
because two instances you might consider equal then will have different hashes
and won't actually be "equal"
#equals and #hashCode go hand in hand and for DS you're gonna use as keys should be implemented appropriately
You mean the warnings? They should be fixed, not ignored.
nah
during run time
The annotations are completely meaningless at runtime.
im doing test rn
tests and for some reason
im getting illegalargument instead of nullpointer
Oh wait nvm im dumb, you cant do bukkit methods in an external thread ._.
You can, but not recommended
Show your exception and the code in question please.
Im guessing that this is not a problem with the annotations.
If I have a public static function run on an external thread means all of the function's code will be executed on that thread right?
Yes
Yes, unless you branch into another thread inside your method.
public ConcreteLine(@NotNull Location start, @NotNull Location end, double incrementLength) {
Preconditions.checkNotNull(start, "Parameter start is null.");
Preconditions.checkNotNull(end, "Parameter end is null.");```
```java
assertThrows(IllegalStateException.class, () ->
new ConcreteLine(
new Location(null, 50, 50, 50),
new Location(null, 50, 50, 100),
0)
);
assertThrows(NullPointerException.class, () ->
new ConcreteLine(
null,
new Location(null, 50, 50, 100),
1)
);
assertThrows(NullPointerException.class, () ->
new ConcreteLine(
new Location(null, 50, 50, 100),
null,
1)
);
I guess it has something to do with IJ's annnotationprocessor?
2nd one is test
Try to do a mvn clean and then do it via maven (not via IJ)
Important: Do a clean beforehand, otherwise maven won't recompile your classes
How to stop a BukkitRunnable() ? I read the documentation it says to use cancel(); but my runnable doesn't stop. Do someone has an idea ?
That would stop it
Use the cancel() method.
there has to be a setting bruh
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
new BukkitRunnable() {
double progress = 0;
@Override
public void run() {
progress = progress + 0.025;
double rounded = Math.round(progress * 1000.0) / 1000.0;
bar.setProgress(rounded);
if(!p.isSneaking()){
bar.removePlayer(p);
this.cancel();
} else if(rounded == 1) {
bar.removePlayer(p);
if(p.getHealth() == 1){
p.setHealth(2);
} else if(!(p.getHealth() != p.getMaxHealth())) {
p.setHealth(p.getHealth() + 2);
}
this.cancel();
}
}
}.runTaskTimer(main, 0, 1);
Also uh, are you sure that Preconditions.checkNotNull throws an NPE?
Alternatively, you can obtain the task ID and cancel it
Sir, this is eclipse support
Add debug statements right before you call cancel() and check if its even called.
yeah
Params:
reference β an object reference errorMessage β the exception message to use if the check fails; will be converted to a string using String.valueOf(Object)
Returns:
the non-null reference that was validated
Throws:
NullPointerException β if reference is null
I mean checkNotNull is the wrong approach for constructors anyways...
should I check state
Check argument
Hm? Should you use Objects#requireNonNull or wha?
k
Will fail with a compile error in your IDE
Depending on how it is configured that is, but my eclipse install will
is this a controversial argument or no
how do i remove the flash that forms when i create a firerocket? So when it explodes
I mean technically you shouldn't be unit testing this, but whatever
checkNotNull is used in pipelines to fail fast.
Its only really usefull if you actually have a use case for its return value.
When I use player.getLocation.getBlockX() in a command, it returns the right value. When the player then moves and changes position and runs the command again, it returns the old x-coord? Anyone knows why this could be?
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
oh, sry
You are probably saving that value somewhere on accident
And uh I cannot find the appropriate IJ setting.
And not updating
Explain how that can be the case?
Maybe if you use Sonarlint or something.
I am saving it in a variable, but then getting it new. Even if I don't save it and just get the new value, the old one is returned
That is still no code provided
working on it, wait
public static ArrayList<Integer> gameCoords = new ArrayList<Integer>();
gameCoords.add(0, 0);
gameCoords.add(1, 0);
gameCoords.add(2, 0);
}```
```gameCoords.set(0, player.getLocation().getBlockX());
gameCoords.set(1, player.getLocation().getBlockY());
gameCoords.set(2, player.getLocation().getBlockZ());```
`player` is represented by the command executer, as you may guess
If you do x == null, where as x is marked as @NotNull, every well-configured IDE will scream at you that you have dead code
Ofc, but the compiler has to be explicitly configured to let a warning fail your compilation.
nullability annotations also do not work at runtime unless you're generating code at compile time
IDEs are not the end-all decision maker. Runtime is
This is weird, the line p.sendMessage("tes2") is never run, but the p.sendMessage("test") yes. And when rounded become equal to 1 I have no more message in my chat but I have many errors because the value still increasing.
new BukkitRunnable() {
double progress = 0;
@Override
public void run() {
progress = progress + 0.025;
double rounded = Math.round(progress * 1000.0) / 1000.0;
bar.setProgress(rounded);
p.sendMessage(String.valueOf(rounded));
if(!p.isSneaking()){
bar.removePlayer(p);
this.cancel();
p.sendMessage("test");
} else if(rounded == 1) {
bar.removePlayer(p);
if(p.getHealth() == 1){
p.setHealth(2);
} else if(!(p.getHealth() != p.getMaxHealth())) {
p.setHealth(p.getHealth() + 2);
}
this.cancel();
p.sendMessage("test2");
}
}
}.runTaskTimer(main, 0, 1);
Yes that is correct, but it will be marked as such. And idk, but I am not that kind of lunatic that ignores IDE warnings and errors on my own projects
Btw you should never compare doubles and floats with ==. Always use a very small epsilon like 1E-6 to check when your value is close.
Alternatively you can use an int instead (which is probably better in your case).
Anyway: Show your exception
Just check if progress is larger than 1
No need to check for an exact value
java.lang.IllegalArgumentException: Progress must be between 0.0 and 1.0 (156.4)
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:218) ~[guava-32.1.2-jre.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.boss.CraftBossBar.setProgress(CraftBossBar.java:158) ~[paper-1.20.2.jar:git-Paper-318]
Well sure, you're going to have to normalize your progress then :p
@quaint mantle
Try to clear caches and stuff
Well, your problem is clear. Never compare doubles/floats with ==
Use an epsilon or an unbound check like if(rounded >= 1.0)
IJ probably won't recompile your entire project
k
Ok thank you I will do that
yeah I have a hunch that 156.4 is not between 0 and 1
To be honest I never compared floats with epsilons. Though even then, I generally only compare it with well-defined values like 1, 0 or -1 or NaN, Negative infinity or Positive Infinity
Proof or you lyin
Also uh, I've been thinking about how one would best design a system for packaging a bunch of files into a zip while having an API for transforming the entries. Allowing that while both allowing APIs to be usable and not exploding the memory requirements to infinity for larger files is challenging. So, has anyone ever used or designed such systems and could point to them? If not, no biggie - I'll just invent my own one. Or if anyone has some advice, would be great too
throw a new BuyMoreMemoryYouPlebException()
Or use buffered sections. A proper buffer strategy is probably the trickiest part.
I mean the problem is that files over 2 GB cannot be stored in a single array regardless of how large everything else is - though uh, at the moment I don't intend on storing them anyways, but I'd like to avoid possible future problems
Isnt that automatically solved when using a buffered output stream as a backbone for the zip output stream?
doesn't NIO's ZipFileSystem work well with that stuff?
Uh doesn't the ZipFileSystem have a huge amounts of flaws? I just know that I ought not to touch it
Although given that I am just writing to it it probably isn't much of a problem and that I don't need to be aware of problems such as nonstandard CentralDirectoryHeader positions etc.
wat
I have never heard that before
I probably confused it with something else then
Hi ! I need some help !
I'm using Worldedit API (versoin 7.0.1) and WorldGuard API (version 7.0.8) and i want to get all Region or region name between two org.bukkit.Location.
Someone can help me ? Chat GPT and Google don't help me...
I am getting this error when trying to package the plugin.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources (default-resources) on project FirmlyMCMoon: filtering D:\Programming\Plugins\FirmlyMCMoon\src\main\resources\moon_house.nbt to D:\Programming\Plugins\FirmlyMCMoon\target\classes\moon_house.nbt failed with MalformedInputException: Input length = 1 -> [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/MojoExecutionException
moon_house.nbt is a structure file and is located in the resources folder
So yeah, anyone got an idea why this could be happening? (whats wrong is in an above message)
I fixed it by exluding the structure file from filtering
when including nbt files you need to set filtering to false so Maven doesn;t break the compressed files
What exactly was your problem?
Well, the problem is fixed somehow
But i got a new one
But it's not Spigot related, just some mistake of myself which I'm gonna have to figure out
Feel free to still ask it if itβs programming related
okay
public static ArrayList<Integer> gameCoords = new ArrayList<Integer>();
public static ArrayList<String> gamePlayerUUIDs = new ArrayList<String>();
public static ArrayList<ArrayList> gameData = new ArrayList<ArrayList>();
public static ArrayList<ArrayList> games = new ArrayList<ArrayList>();
public static void newBoard(Player player) {
if (gameData.isEmpty()) {
gameData.add(gameCoords);
gameData.add(gamePlayerUUIDs);
}
if (gameCoords.isEmpty()) {
gameCoords.add(0, 0);
gameCoords.add(1, 0);
gameCoords.add(2, 0);
}
if (gamePlayerUUIDs.isEmpty()) {
gamePlayerUUIDs.add("");
}
gameCount++;
player.sendMessage("Game X: " + player.getLocation().getBlockX());
gameCoords.set(0, player.getLocation().getBlockX());
gameCoords.set(1, player.getLocation().getBlockY());
gameCoords.set(2, player.getLocation().getBlockZ());
gamePlayerUUIDs.set(0, String.valueOf(player.getUniqueId()));
gameData.set(0, gameCoords);
gameData.set(1, gamePlayerUUIDs);
games.add(gameData);```
This is the code which makes problems. Basically, `games` is getting overwritten, which in this case means instead of being 2 different values of the lists, it just has the last one both but the list which already was in `games` just gets replaced by the new one
And I don't know why
Could anyone tell me why I can't pull the item out the result slot in the inventory?
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Seems like you're in need of some Java lessons
You only have one of each list
Wait, do you wanna tell me the list updates inside the other list?
Depends on what you mean
i think you are trying to do something complicated without much experience
Like, if I change gameData the value of it in games would change aswell
it's stored by reference so yes
pretty much haha, I started learning Java like 1,5 weeks ago and yea, still fun tho
For example when you're setting gameCoords you'll be modifying the gameCoords already in the map
since they're the same gameCoords
You're basically only storing the same thing over and over again
Oh, I'd have to get the value, not the list itself, right?
You seem to be quite lost at the concept of OOP programming
I come from Python, so yes
wanna like create a game object that contains the coords, players and other game data
and then store allat in a set
is there something strange going on with gson or is it just me
Learn the basics of object-oriented programming all in one video.
βοΈ Course created by Steven from NullPointer Exception. Check out their channel: https://www.youtube.com/channel/UCmWDlvMYYEbW42B8JyxFBcA
π₯ Introduction to Programming: https://www.youtube.com/watch?v=zOjov-2OZ0E
βοΈ Course Contents βοΈ
β¨οΈ (00:00) Introduction
β¨οΈ (07:37) Encapsul...
I'll check it out, thank y'all. Looks like I got some learning to do π₯²
?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.
You can also take a look at some of these ^^
python also has objects though?
yea
Hi ! I need some help !
I'm using Worldedit API (versoin 7.0.1) and WorldGuard API (version 7.0.8) and i want to get all Region or region name between two org.bukkit.Location.
Someone can help me ? Chat GPT and Google don't help me...
but noone uses python objects really
i will
if I have an ItemFrame, which method could I use to summon that ItemFrame variable in the world at a location. spawnEntity seems to not allow me to grab from a variable
unless im doing it wrong
Do you already have an item frame?
I have it stored in a variable
Are you just trying to clone an existing one
I have the item frame stored in a variable
why
Where did you get it from
walmart
CoreProtect is bugged right now and I cant use their built in performRollback system so I have to use my own
for my plugin
That does not answer the question
that variable is just a single itemframe somewhere in the world probably
That does not answer the question
how did you get it
It only give the regionList on a location. I need to query all location between two location (without loop because the area between the 2 location can be more than 100100100)
On item frame destroy -> stores the frame in an object when when I do a command I can get the itemFrame from the object
Yeah that won't work
It tells you how to do it without a loop
The instance you have is already removed
when you destroy it its gone
I thought a variable just clones all the information about that item frame in that given moment
If you are on a modern version, get a snapshot of the itemframe before it gets destroyed
EntitySnapshot but sure
no its just a reference to that exact item frame
π You can do that now
When did that get added
1.20.2 sometime
is therre an epic scale
hmmmmm
Does still seem a bit limited
oh I use 1.20.1 π
2023-11-19
rip
Ok how could I get the item frames facing direction thingy
ill try to summon a new one
and put the item inside
ye it is epic
do you just want to replace the item frame with the same item frame when it gets destroyed?
I assume I cant get the facing after its destroyed
So I have to register it beforehand
you can probably get it in the destroy event
this will account for item frames on grounds right
but after that its gone
ye but im storing it in an object
well dont
I cant just to this.frameFacing = itemFrame.getFacing() inside of the object
just copy the information you need
ill have to get it beforehand
yes
ok epic
hi thats me
then Im already storing the ItemStack so I can just make a new ItemFrame with that facing and that item and summon it
F to any other data it has
rotation nobody cares, PDC - there isnt any item frame pased PDC on my server
so im mostly good
Tf I just typed new ItemFrame and it automatically pasted this entire text
uhh where do I go from now
ok chatgpt told me I could just do this
that is how you spawn an entity in the world, yes
ok epic
ok wait this is wonky behavior
any way for me to check if there is already an item frame in that location
without having to loop through all the entities in the world
Unless im wrong and looping through all of the entities isnt that laggy
World#getNearbyEntities
epic
I assume setting radius to 0 will only check for that exact block
or should I set it to 1 instead
bruh
Any way to make an ItemStackSnapshot or something
clone it
ok epic thx
technically whats stopping me from cloning the entire item frame, or can I not
ItemFrame is an Entity(when placed) so you can't clone it
Rip
Do you guys have a plugin that restricts redstone usage?
OK I think I did something wrong, when the event runs the cloned item is normal, but when I run it later from storage its air [20:48:24 INFO]: ItemStack{AIR x 0}
ChatGPT told me I could use this to clone it, dont know if it did something wrong,
// Create a new ItemStack with the same properties as the original
ItemStack clone = new ItemStack(original);
// If you want to modify properties of the clone, you can do so here
// For example, changing the amount:
// clone.setAmount(original.getAmount() - 1);
return clone;
}```
```ItemStack itemInFrame = itemFrame.getItem();
ItemStack itemClone = cloneItemStack(itemInFrame);```
if you want to clone it just ItemStack#clone()
Ok let me bring you on an adventure through the lifecycle of the item since its quite long, 1 sec lemme type it out
When it gets broken its gets registered here
ItemStack itemClone = itemInFrame.clone();```
Then I run this method to find which category to put it in (ItemFrame in this case)
```AlertMap.newAlert(griefer, null, 1, itemFrame, previousOwner, null, null, face, itemClone);```
Then here I register the new Object to store the item frame information
```public static void newAlert(Player player, Block block, Integer type, ItemFrame frame, String previousOwner, String[] lines, Material material, BlockFace face, ItemStack itemInFrame) {
...
}else if(type == 1) {
FrameAlert alert = new FrameAlert(player, frame, previousOwner, face, itemInFrame);
alertIndex = alertIndex+1;
frameAlert.put(alertIndex, alert);```
Here is what the object looks like
```public FrameAlert(Player player, ItemFrame frame, String previousOwner, BlockFace itemFrameFace, ItemStack itemInFrame) {
this.griefer = player.getName();
this.itemInHand = player.getItemInHand();
this.blockLocation = frame.getLocation();
this.standingLocation = player.getLocation();
this.date = new Date();
this.fixed = false;
this.itemFrameFace = itemFrameFace;
this.itemInFrame = itemInFrame;
this.itemFrame = frame;
this.previousOwner = previousOwner;
}```
why are you passing the ItemFrame? into Frame Alert?
actually I'll start from teh beginning. What is your end goal?
Ability to add it to an index and then obtain information about it and rollback it. For the other alert types (block breaking etc) I just use coreProtect's built in performRollback system but it is currently bugged where it doesnt rollback itemframes so I have to do itmyself
I think I can remove it now, I used it earlier until I updated the code
ah nvm I need it to obtain the location
This is an explosion regen plugin I wrote. It will store and regen frames, banners etc and their contents. Take a look at its code
ok thx
the plugin saves all teh data to yaml and regens it later.
Sup nerds.
I'm trying to rewrite https://www.spigotmc.org/resources/chaosplugin.99684/ to be data driven. This is easy enough for certain effects, e.g. https://paste.md-5.net/ifanofilex.bash.
I'm however, unsure on how I'd handle entity stuff.
I currently have two of them rewritten as such: https://paste.md-5.net/qasicugeku.bash but I feel that it could be improved π€
Why is it not configurable? Like DogLover - Summons ? tamed dogs within a ? block radius of the player
It's meant to allow complete customization instead of just configuring pre-existing effects, starting with porting the effects that currently exist
Well, that's what converting to it being data driven will solve, on top of (relatively) easily allowing new effects
BRUHH
Ive been trying to figure this out for the past half hour I just realised I've been passing the player's held item instead of the item frame one
Figured it out when I accidentally held grass block
The issue, as stated in the original message, however, is actually porting everything to be data driven lol
I'll probably just port the easy stuff, push an update, then figure out the rest after
Is this the same as despawning an entity?
yes
epic
is it not possible anymore to use custom enchantments? I get the following error when trying to use a custom enchantment
https://paste.md-5.net/avavoqinup.rb
do I really have to extend CraftEnchantment now? that seems pretty stupid
even setting blocks is easy-ish: https://paste.md-5.net/epopuyowun.bash lmfao
enchantments are backed by the minecraft registry for them
that method converts the bukkit instance to the minecraft one, so it needs the nms.Enchantment handle
simply extending CraftEnchantment won't be enough I don't think
the weird thing is, I can add custom enchantments just fine, but removing them again throws the cast exception as my enchantment just extends bukkit's Enchantment :/
its only really "stupid" until enchantments become data driven You're probably best off injecting into the vanilla registry
or just use some arbitrary enchantment for glow instead of a custom one
you can pretty easily unfreeze the vanilla registries with some reflection
but why the hell does bukkit cast enchantments to CraftEnchantment anyway
CraftItemStack#getEnchantmentLevel casts any Enchantment to CraftEnchantment
probably somewhere you may need the NMS enchantment π€·ββοΈ
yeah its because you need the handle there
that method only seems to need the ResourceLocation though
it shouldn't need any instance of CraftEnchantment
true but its using an NMS method easiest to probably defer to the vanilla enchantment instead of doing a patch
mindif
Hey, anyone know what's wrong with my javadoc thingy?
/*
* Checks for a fake nickname stored in the database
* If there is none present, the method returns null
*
* @param sender The sender of the command - used for informing about errors
* @param playerName The name to check against in the database
* @return The fake nickname if present, otherwise null (interpret as empty)
*/
public String checkFakeNickname(CommandSender sender, String playerName){
IntelliJ doesn't seem to show the comments when I display the "Quick Documentation". I even tried to generate the JavaDoc and they don't show up there either.
if there'd at least be a glow enchantment, I'd be fine. but currently it just sucks - 1.20.4 just breaking custom enchantments but only when trying to remove them lmao wtf
NMS removeEnchantment could just take in the ResourceLocation directly and it'd work fine
Do /**
Btw, shouldn't those be async, ie. Futures?
ugh. Location stuff is also a pain π
"location": {
"x": "player_x",
"y": "",
"z": "player_y"
}
Unsure on how to go about adding or subtracting an axis
current_player_x+10 would work, ig but is iffy π€
player.getLocation().add(0.0, 12.0, 0.0).getBlock().setType(Material.ANVIL);
being what I'm trying to port this time
return new ComponentBuilder(this.name + " (level" + this.level + ") ").color(net.md_5.bungee.api.ChatColor.BLUE)
.append("Home to " + this.members.size() + " people")
.append("Description: " + this.description)
.append("Money: $0")
.append("Destroyed Kingdoms: 0")
.append("Land Power: " + this.claimedChunks)
.append("Led by Lord " + Bukkit.getOfflinePlayer(this.leader).getName()).create();
how can i separate the lines, is it literally just with ]n
***\n
yes
ok
Optic, give me a number from 1 to 100, this is of utmost importance
Guess I could do a general
name
enabled
actions:
type
behavior
type behavior
type
behavior
type behavior
but that complicates even basic effects π€
Regrettably you are not Optic
34
Thanks
not yet
you should nuke the one where voldemort came from
Noted
Sorry but, I have no idea what that means
Awesome, works, thanks!
I assume you query a database, like postgresql or smth, for the info.
That query, depending on the size of the db, could take a while. But your code is written in such a way, that everything in that thread stops until it finished the query.
So imagine you query some data and it takes 5ms to complete. You do that query for everyone on the server, maybe 20+ people. That's a 100ms you spend asking the DB for data. A tick only lasts 50ms, but now you are already at 100ms. So the tps goes down, ie. your server lags.
Futures, or rather CompletableFutures, are Javas way of creating callback functions. Functions which get called once the code providing the data is complete. I'd advise using those.
Thank you for the much needed info! I'll do my research and try to implement Futures in this and upcoming plugins.
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
I think mnf wrote something about it, might be pinned idk
nerd
ugh. Location stuff is also a pain π
private final static CommandDispatcher<CommandSender> DISPATCHER = new CommandDispatcher<>();
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
try {
DISPATCHER.execute(
DISPATCHER.parse(command.getName() + (args.length > 0 ? " " : "") + String.join(" ", args), sender)
);
} catch (CommandSyntaxException ignore) {}
return false;
}
@Nullable
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
try {
return DISPATCHER.getCompletionSuggestions(
DISPATCHER.parse(command.getName() + (args.length > 0 ? " " : "") + String.join(" ", args), sender)
).get().getList().stream().map(Suggestion::getText).collect(Collectors.toList());
} catch (InterruptedException | ExecutionException ignore) {
return null;
}
}```
how to use spigot with brigadier.
That looks cursed
are there any other ways?
You also lose highlighting color for suggestions, no?
it's a brigadier thing?
also, I guess no..
i'm using onTabComplete
You don't use brigadier with Bukkit's API. It's not possible
There are libraries that help you do this like Commodore or Cloud if you're interested in looking into those
hey, this actually works.
but I guess I would take a look to see how commodore works
Choco's a nerd
Listen to choco
Commodore is nice enough, if u just want the highlighting colors etc
maybe I can use reflections to catch minecraft's brigadier classes
: >
Or what you can do is to just register commands directly to the dispatcher
Then just on the command source stack u get the bukkit entity
And itβs basically spigot api with brigadier at that point :)
spigot should have started to create it's own API on top of brigadier at this point..
maybe it's overkill, idk
whenever I'll get acces to my account back
Have you contacted md5 about that?
Probably the fastest way to resolve account access
I think the reason I don't have acces is md5
I can't remember what I did, but I'm sure I did something stupid xD
Well it wasnt because you did something smart
qq cuz i cant check myself rn, can i pass a 'int' value to a method taking 'Integer' ? i dont remember how primitives interact with that
yes
related question (i promise) is there an explanation on how to make prs?
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
thanks
time to turn a packet into a block method
there a packet in the api i can check to see how to do it in a non-stupid way?
sendBlockChange InventoryView#setTitle
There'd a bunch of send methods
Usually that indicates a packet
((CraftServer) Bukkit.getServer()).getServer().vanillaCommandDispatcher.getDispatcher().register
the easiest thing of my life ever.
and it works 100% π
CommandSourceStack >>>>>>>>>>>>>>>>>> CommandSender
Imagine using nms for commands
Lmao
Imagine an API for Brigadier
I see now... why people uses NMS
I've tried writing API over Brigadier twice now, and Paper has also tried writing API over Brigadier. We've failed each time because Mojang wrote it in a way that's near impossible to wrap
There is CommandAPI.. and it's quite fantastic
I know. There's also Cloud and Commodore which are fantastic-er. But they're not Bukkit API
Brigadier has been something I've had my eye on though I've seen the countless failed attempts. I might take a crack at it over my break
Hell nah
I dont want implement lots of interfaces to just get fancy tab completer
Does the implementation matter that much? I know the bukkit/spigot API should be easy.. but..
API is the easy part. The implementation is the difficult (and near impossible) part. The way Mojang designed their arguments system heavily ties it to the class instances, which makes argument type wrappers problematic
Yeah, that's what I implemented structurally I would recommend something similar: https://github.com/aparx/skywarz/tree/master/src/main/java/io/github/aparx/skywarz/command
okay
I'll let Owen try
Then.. use annotations.
and break every plugin in the process
That does sound up Owen's alley
I don't understand the obsession with annotation command frameworks. They're not good API at all
Extremely flimsy and no strong API contracting there
You guys can keep Owen to yourselves we don't need him breaking spigot too
They're mostly string-based command construction and that's not good :p
Just use simple command trees no?
I'm extremely lazy. That's why I'm using annotations.
With an executor and some argument type shit and you're good to go
am i wizard or what i've made a sorting algo that sorts million of random numbers in under 20ms in running ryzen 3700x and im not sure if this is normal or my sorting algo is broken, i've checked the sort result with online sorters and it seems to be accurate
Bros want fancy one
i've sorted array using Shell Sort with HIbbard sequence
can anyone confirm that sorting million amount of numbers under 20 milliseconds is not too fast lol
because insertion sort takes like ages
while shell sort takes under 20 ms
i sort with randomization and sometimes I get times such as 1ms
millions?
yeah sometimes
Well insertion sort scales way faster than shell sort
Especially if your heated up
I wouldn't doubt it's possible
yea i've benchmarked it insertion sort and it like needs at least 5 mins to compute while shell sort under 20ms which sounds too good to be true tbh for me
what
how do u fail
Feel free to implement it into craftbukkit and bukkit if you think it'll be easy I hear it isn't quite that
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
Personally would love to leverage brig
Does anyone know how to deploy a package with github 00
and you can..?
I might actually try that tomorrow and create a PR
Not without NMS currently, or some other library
Then we can actually sleep well
Knowing we could do player.respawn() over player.spigot().respawn()
i mean u just need a single reflection class
to get the command map
but then you're done
you don't need NMS or a lib
how would that work with the command map??
lol
that only takes in Bukkit Command's
which inherently don't support Brig functionality
Then don't use brigadier, create your own version and use packets to send the tooltips, command completion, etc
how does that work with the coloring?
I wasn't aware Bukkit's SimpleCommandMap supported that
After all, the client doesn't know what the server is using
again, i swear i had this conversation with you
this seems like something you could google
I see I am not the only one that dislikes annotations
Ive tried ive been going from tutorial to tutorial and they all seem to be doing it in 1 min but mine just gives the same eroor every time
I also just prefer using a Tree
@river oracle
Hey, now that we are talking about automatizing things. Is it possible to automatically create a release (not github packages, just a release under a randomly generated tag)?
i still cant believe it
obv that it's not true lmao
do you rly think a random shuffle will get millions of items into the correct positions
Is there a way to make it so that a certain entity doesn't get pushed back by an explosion
insertion sort sorts 128k array in 17 secs, while shell sort with hibbards sequence sorts in 38ms
that comes with other problems, arguably more severe long term (and short term)
s = are iterations
one iteration group twice the size
last column is the average time in ms
Like for example what problems?
last 5 rows depict arrays of 128k
in both tables
left table insertion sort right table shell sort
like please someone help me in turning this mystery
try setting player velocity to be 0 in an explosion event or something
good idea
yes should be possible
Github actions should be able to do this
All I see is how the client send a suggestion request to the server, and the server responds with suggestions.
link original question pls
there are more issues than that
Did anyone try that?
like for instance tab completetion is done async (usually) which iirc is somewhat tied to the way mojang interacts with brig, then we would need to allocate more resources for that, additionally stuff like cmd blocks and anything that ties to mc's code internally, what happens to that if we just ignore brig and do it packet wise?
^
What?
You are designing your own system over what's already existing. Doesn't matter if it's sync or async. At the end of the day, the client is told what the server is saying.
No, I don't see your problems
not just add a feature because someone wants it
Yes
Correctly
And?
It's something people requested for a long time..
It's the only part of the api that stayed untouched for 10 years, for god's sake..
yes I agree that the command api should get an overhaul
but its not a great idea to design something on top of mere packets
i mean sure there are some api methods that do just that
but thats single methods
I don't say we should remove it, or make it any other way. But we need something new..
yes but you suggested just building our own framework that abstracts directly above packet level
thats what im disagreeing with, and well, there is little chance such a pr would be accepted anyway
You didn't understand.
i did
No, you didn't.
what else does this mean then?
I meant to make our own command tree framework api whatever you call it.
And control that with packets.
Didn't say to make the system out of packets.
That doesn't make any sense.
Build it above brigadier.
Let Minecraft/Mojang do its own thing.
its really not as easy as u think
He said he tried to wrap brigadier
Not to make another api
Or system
Or framework
Or whatever you call it.
What I'm saying is not to use wrappers.
π€·ββοΈ
then what does this suggest exactly?
if its not "wrapping"
I didn't say "on top" intentionally
ah here, heres the explanation
different sorting algorithms take different amounts of time depending on how they sort.
I'll give you two examples: insertion sort sorts the list one by one, comparing the element addedd to the sorted list at the correct spot by iterating over it and inserting at the correct spot
As a result of that it compares each element with (on average) half of all other elements. you have n * n / 2 comparisons, which grows exponentionell with the speed your list of numbers grows
the fastest algorithm im aware of - merge sort, which is pretty similar to shell sort - splits the list in half, and those in half, until it ends up with lists 2 long, sorts those in one comparison, then merges those together.
this merge step takes as many elements as are merged - so for the last step it takes n, for the second to last n as well, because you have two merges of n/2 size
due to the halving you only have that merge as many times as you split, which (iirc) is log(2)n, or at least something that grows slower than n.
The total steps an algorithm needs dependent on the entry set is what we call the 'complexity' (ignoring constants, addition or multiplication) of that algorithm. Note how insertion sort is nΒ², and merge sort n log n.
(google says shell sort CAN take nΒ² but takes on average n log n)
What this means in relation to your question is that with such a massive data set, it is much close to the 'optimal' case than the 'worst' case. assume 1 million numbers: Insertion sort takes 10^6 * 10^6 10^12 comparisons. Average shell sort time? 10^6 * (log 2 1000000) = 10^6 * 19 = 1.9 * 10^7
In other words, on average (large, unordered data sets), shell sort is five hundred thosuand times faster than insertion sort
then what exactly ru suggesting?
- if you ignore the time the other operations take. You tend to have much less of those than comparisons / the same amount as comparisons
so in TL;DR its possible to have such timing then, right due to how much the moving of the array cost basically?
We should make our own command tree framework from 0, make it so commands get registered, unregistered, etc
Then listen to command related packets to control the framework, and send command related packets appropriately to what the framework is saying.
not 100% sure what youre asking here
Basically just skip Brigadier
is it possible that my ryzen 3700x can sort randomized array of a million integers on java in under 30-40 ms with shell sort and hibbards sequence
i mean, probably?
Try it and see
And can be async. Packets can be sent async.
depends how you mean 'possible' here
but then again u would be abstracting directly against packet level
dunno how fast itll be, but it's on the best known average time complexety for sorting
well it does but i cant really test it properly, i've sorted it and my timing shown that it sorts under 30 ms on single thread
it sounds too good too be true
how long were you on both insertion and shell sort for how many elements?
how are you gonna make it not abstracting directly against packet level if you're not allowed to wrap around brig?
128k elements, insertion sort 17 secs, 128k elements shell sort hibbards sequence 20ms
ur idea doesnt make sense
ik but due to how im testing large quantities im not using jmh
i just need rough estimate
You can use jmh for a quick test
Just read packets..
Packets are just bytes..
Generate some random numbers or export a sample of your data
so given the math above - yes it can be proven, no i cba - you have roughly 10^10 comparisons for insertion, and 2*10^6 on shell sort average.
500 times difference
17s / 500 = 34 ms
so yea it adds up
but thats packet level tho?
It's not bound to anything.. tf I'm talking to?
Packets are just bytes...
i've never realised that such a simple algorithm change
yes but you're skipping the entire step of integrating commands with the rest of the server logic
like...
as said earlier
can speed up the process so much
put nΒ² and n log n in a graphing calculator
we dont wanna abstract directly on top of just sending packets backwards and forwards
the diff grows faster the larger ur numbers
You can wrap that with our system..
I'm gonna try tomorrow.. see what I can do..
You guys said you would like cloud?
There's a system.
(side note: bogosort has optimal speed 1, average speed n! (multiply each number from 1 to n in a row).
It sorts by: Randomly shuffling your data, checking if it's in the correct order, and repeating until it is)
thats your 'worst case'
for sorting, the bottleneck is more or less guaranteed how many comparisons you make
Let's see if I can implement it over bukkit api
so minimize those
i got worse sort than bogo
i mean cloud is a framework, tho I doubt it would get merged due to how oppinionated it is
and what scientists figured is that splitting then merging is the simplest way to get very low times because of that n log n thing
It's just an example.
Some people should start thinking outside the box a bit..
yeah I see
well nicuch im still interested in what u might create
so keep me updated :)
Alright
(log n) tends to be very small even for massive numbers (bc its 'how high is n in 2^n to reach this number), so its almost linear
(also side note here: in MATH, log is log base 10, in computer science, it is log base 2)
log is log base 10, in computer science, it is log base 2, yea ik such annoying to deal with
at least for me, since when i log i think of log10 most of the time
i mean if such sorts are so great for large datasets then when you think about it its great to sort it and do the binary search
since it costs basically nothing
binary sort is basically the same
depending on how your data is structured you might want to multiply the pivot point by something, for example decrease it by 30% if you have lots of values near 0
but basic binary sort is just like 'sorted list: element in center? nope, element between here in the direction i need to go now to the other known edge? repeat'
binary sort works best on a small set of items in an array. So what you do is you grab a sub array of elements which is approximate to what you are wanting
the more a list is heavily sorted the better it gets as well
*search oops
as your list gets smaller its best to switch to binary insertion sort as well π
which doubly makes it better
insertion sort is also really good if your data has a lot of presorted sections
as it gets closer and closer to O(n)
yep
grab first 100 elements approx how sorted it is :kekw:
lol
actually
grab 100 random elements and count for how many the next is sorted compared to it
if its above lets say 95 insertion sort
otherwise some on average more efficient one
im tryna import things with gradle
but when i build it says "class file has wrong version"
Guess it depends on what version of Java you have installed, what version of Gradle you have installed, whether or not you're using a Gradle wrapper (and what version that wrapper is), and what version of Java your project is using
So
java --version
gradle --version
./gradlew --version (if you're using a wrapper)
and how you're defining Java versions in your build.gradle(.kts)
Probably you are using a dependency which was compiled for a more recent version of your gradle version (basically what Choco said)
how would i update
We don't know what you need to update, so give us the information we need :p
It's like asking us to help you with your homework but you haven't even told us what the questions are
^
bad class file: F:\Users\aabss\.gradle\caches\modules-2\files-2.1\com.github.MistyKnives\Kick4J\1.0\d02f63867c19a5a31c64bd718b82f223382c43d9\Kick4J-1.0.jar(/uk/co/mistyknives/kick4j/events/impl/channel/ChannelFollowEvent.class)
class file has wrong version 64.0, should be 61.0
Please remove or make sure it appears in the correct subdirectory of the classpath.```
that happens when i try to build
its compiled with java 20 while your project needs it to be java 17
so i gotta make my project 20
Either that, or something higher, or find another API
Who the heck be compiling with non LTS versions
nerds
they also have lombok on maven
you could probably just build the lib urself with java 17
Also probably an option, yeah. It's open source
Depends on whether or not they're actively using J18+ features I suppose
I compile with java 3 π
theres 1 way to find out
Just compile in java 8
And magic
It will be available on all modern LTS versions
Yeah but then I canβt use modern features
like records
Why do I need records when I have @AllArgsConstructor or @RequiredArgsConstructor and @Getter?
I mean yes
I like new features
Why do I need Lombok when I have not Lombok
i only just realised what builder is actually for
I bet itβs for builders
when they dont need anything
I know right? But what I mean is, as long as you are not using java 20 because only one feature, you should try to compile for the oldest version you can compile with (java 8)
I compile for java 8 π
i compile for ur mom
17
I remember when 17 came out and decided to compile one of my plugins with it
Lot of people came to me blaming for setting the version to java 17
thats what i meannnnnnnnnnnnnnn
There's a difference between setting it to Java 17 when only 8 was required and setting it to 17 when 17 is required lol
Yes please, could you please also compile my dad? I'm missing one
idk if i have the source for that
What's wrong on doing
if (something instanceof String) {
String string = (String) something?
}
Of course I like to if (something instanceof String string)
But it's just 1 line of code
all of that brain power saved
Caveman code
by it being 1 line
Whats caveman is to public class Main { public static void main(String[] args) { System.out.println("Hello world!"); } }
That's still one line guys π
wheres ur package
No package, I'm a novel
package pluginname; real
nop

i wonder if choco has a net.hypixel.choco
Yeah yeah new phone keyboard
is the keyboard too big now
Yes
make ur own ios
How do skyblock servers have world borders for each island in the same world?
Packets
I'm looking to write a system like how in Fortnite you can ping players but in minecraft, and was wondering of ideas on how to make it. Like how should the player see the ping? Should it be a hologram, if so you have to be in the same chunk no?
why do you need to ping players?
It's for like showing your location but using visuals
the server already knows the ping of the players to the server there isn't really a way for players in mc to directly ping another player and wouldn't want this anyways
I did
Have you played fortnite where you can ping your locations?
but you didn't clarify the part of pinging players
no, I don't play games just because they are popular
same system exists on apex
basically you can alert your team of things going on during the game
never played apex either
And it's usually a 3d indicator saying "I hear people there" or "someone has been here before"
How do you think it should be made in Minecraft? I was thinking of just holograms, but not sure if it would be possible to render with render-distance and stuff.
If it'd be available to see in different chunks.
I would use particles
Like as a beacon?
if the goal is to show direction of another player
using the particles though gives you a general idea of direction and not exact
depends on the overall goal or how accurate it needs to be
in Apex isn't it just an icon that rotates? I guess you could do the same w/ display entities & a resource pack
Massive ongoing explosion
Haven't touched Apex in ages, only remembered the icon lololol
What GUI and command framework do you guys think is the best
The goal is to make it so you can see it from like the map away.
Particles wouldn't be visible in that distance.
then you are subject to the players render distance
not sure why it needs to be so far away
even from the map, you can't see the entire map from the players perspective either
needs to re-create the functionality of the game lol
That's what I going to ask, I don't think it's possible.
Could spawn a client side beacon I guess
Really the only thing you can do, server side anyways
https://www.reddit.com/r/godot/comments/gj32rl/ping_system_test_inspired_from_apex_legend/ is what OP wants
anyone know why this won't run?
manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.BLOCK_BREAK) {
@Override
public void onPacketReceiving(PacketEvent event) {
getLogger().info("RAN THE LISTENER");
}
});
nothing in console
particles are going to be best for the onscreen portion of direction to face, as for showing it through blocks it won't really be possible. best that can be done is showing an arrow of some sort direction to go in
Yea, probably the best they'll give with server-side limitations lol
Also just remembered I need to look at how Skript parses its files... or I just make my own parser. ig
I have a project in Eclipse that is not using maven but I want to use a maven dependancy for it,
(this one: https://github.com/Rapha149/SignGUI)
does anyone know how I can use it for eclipse anyway? I tried building it but that led to errors. However, I did build the whole project, if you arent supposed to do that lmk, otherwise if anyone knows how I can get this dependancy into eclipse without using maven, that would be great
convert it to a maven project
is that the only way to get it to work? also how hard is it to convert it from an existing project?
yes, if you want to use a maven dependency
Glowing entities have a max render distance
I would just spawn a particle trail to the "alert"
And probably a chat message with the callout text
Like
Enemy in my position
And then displaying a trail to the position
There's unfortunately no way to open a "dialog" like in 3d shooter games, but you could open a GUI (which blocks all the vision)
text display rendered at teh correct location
I switched to maven project but now the sign gui plugin is giving this error:
[20:18:49 ERROR]: Could not pass event BlockPlaceEvent to FusionWars v1.0
java.lang.NoClassDefFoundError: io/github/rapha149/signgui/SignGUI
anyone know why?
Can we see the pom?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>FusionWars</groupId>
<artifactId>FusionWars</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.github.rapha149.signgui</groupId>
<artifactId>signgui</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
</project>
Shade it
wdym?
Shading makes your plugin a fat-jar
This means it contains all its dependencies on the same .jar file
ok cool; is there a tutorial on how to do it?
If you are using latest spigot version and your dependency is on maven central, you can take profit of the "libraries" setting (I don't really remember if it was called like this)
If you don't know about this, just shade
is there a tutorial somewhere on how to do this?
That's an example
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>original.package.name</pattern>
<shadedPattern>destination.package.name</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
You put this in the maven plugins section, inside <build>
<build>
<plugins>
...plugin here
</plugins>
</build>
If you don't know what relocation is, it basically means it will move elements from the dependency into a place you want it to have. It's highly recommended to do it, in order to avoid dependency conflicts
Basically relocation is
- You have your class file at "io/github/myawesomename/MyJavaClass"
In order to avoid other person which also shades the same class file or has a class file in the same directory and name as yours, you want to relocate it, so maven will moveio/github/myawesomename/*to a directory you want
All this internally, and without affecting your plugin functionality
At the beginning, maven seems too big and overwhelming, but trust me, its worth it
You could also try gradle
Which I personally don't like, but its kinda the same
Ive used maven before, just not on this project, and when I did it in intelij the shading was automatically created, I just didnt even realize it was there. Thanks for the help though, il let you know if the shading worked
I seem to be getting the same error, here is my new file, did I do the shading correctly?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>FusionWars</groupId>
<artifactId>FusionWars</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
** <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>**
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.github.rapha149.signgui</groupId>
<artifactId>signgui</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
</project>
I don't really know if that affects, as I think that's the default value, but try adding <scope>compile</scope> on your dependency
<dependency>
<groupId>io.github.rapha149.signgui</groupId>
<artifactId>signgui</artifactId>
<version>2.2.2</version>
<scope>compile</scope>
</dependency>
ok, il let you know. Also, how do you create the code blocks in discord?
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
cool, thanks
hmm still the same "java.lang.NoClassDefFoundError: io/github/rapha149/signgui/SignGUI" error
In IntelIJ I have to setup build artifacts and then it builds them all to the one file. Maybe thats the problem. Do you know how to do this in eclipse?
What's the maven targets you are running?
You should be doing mvn clean deploy
Or that's what I use
I think compile would be the same
is there a way to set the exact amount of time the crop grows with plugin, and to see how much we have left?
i'm thinking of making it using the method of storing all the crops in Map and making them grow every certain time with a scheduler, but this seems too inefficient
mvn clean package
where do you check this in eclipse?
I'm not a Eclipse user, I don't know
A google search will probably give you the answer
I would also recommend you to switch to IntellIJ
did you create a build profile?
I did for the newer projects and it works much better, but this project is an old one I created in eclipse and when I tried to transfer it over it didnt work correctly
where did you find that menu?
right click project, run as -> Run Configurations
"Run as -> Maven build..." will also get you there and pre-fill some fields
so I built it as a jar file and put it in my external jar's, it didnt work either. Do I have to also put that file in my minecraft plugins folder? what I did with protocolib and citizens for example was I put them in my external jars & in the minecraft plugin folder
Update: maybe the error is in how I am building the plugin. Right now I am just exporting as a jar file, does that not work with this?
also, maybe I did the shading incorrectly? (my pom xml is up above if you want to take a look)
what do I put for goals?
clean package
where can i read about the latest additions to the bukkit API, like a list of "patch notes"?
View the Bukkit, CraftBukkit and Spigot changelog.
Or just the Bukkit/CraftBukkit commit history
mmm, this one's a long read
ty =D
how can I load world from specific path?
I tried this with WorldCreator object but It only could load world from main server folder.
<JavaPlugin>.reloadConfig() dont work, i need something else?
fun onReload(sender: CommandSender) {
MainPlugin.plugin.reloadConfig()
sender.sendMessage("Config reloaded!")
}
you are caching your config if reloadConfig() does not work
you should work from getConfig(). Do not assign it to a Field.
anyone know why this won't run?
manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.BLOCK_BREAK) {
@Override
public void onPacketReceiving(PacketEvent event) {
getLogger().info("RAN THE LISTENER");
}
});```
nothing in console
why are you trying to use ProtocolLib to listen for block break packets?
Full code? No?
mhm yeah sorry what website should i use for paste?
why not? then i dont have to use nms
block break is in the API, why are you wanting to listen to packets for it?
oh that was just to test packet listening. i wana listen to BLOCK_BREAK_ANIMATION
i wana set the break animation on a block. is that what that is?
this is when a player swings their arm, left or right
this was my code for that java manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.BLOCK_BREAK_ANIMATION) { @Override public void onPacketReceiving(PacketEvent event) { event.getPacket().getIntegers().write(0, new Random().nextInt(2000)); event.getPacket().getIntegers().write(1, 1); getLogger().info("RAN THE LISTENER"); } });
nah like the break visual on a block
if you want to make teh players swing arm, there is also API for that
there is also API for breaking stages on a block
ayyy TYSM!
I need a real number from America to register in gpt chat, can anyone lend me one? π
Bro is somehow region locked for a global service
Hi there, I'm getting a strange behaviour when spawning a trident and am unable to trace it at all.
Happens with both
val trident = player.world.spawn(projectile.location, Trident::class.java)
trident.velocity = projectile.velocity
trident.shooter = player
and
val trident = player.launchProjectile(Trident::class.java, projectile.velocity)
it doesn't print a thing on console but(and) it freezes the server completely, any clue? Thank you
with so little code it can only be a guess
as you mention a projectile there you are running this code in a spawn event so you are creating an infinite loop
oh that must be it I call it in the ProjectileLaunchEvent, will do some fixes thank you
yup fixed thank you didn't consider that the event was called when spawning it
How do I check if the player meets the required XP level?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#getLevel()
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/AnvilInventory.html#getRepairCost()
declaration: package: org.bukkit.inventory, interface: AnvilInventory
declaration: package: org.bukkit.entity, interface: Player
final ItemStack result = inventory.getItem(2);
int repairCost = result.getRepairCost();``` I tried this but I can't use the `getRepairCost()` method. My plugin version is 1.20
Huh? How can an ItemStack be equal to Inventory?
π€¦π»ββοΈ I misunderstood what you meant
int repairCost = inventory.getRepairCost();```I don't know if i understand what you meant but if you said something like this, its not working.
What's inventory
inventory is an anvil inventory
show code
if(inventory.getType().equals(InventoryType.ANVIL)){
int repairCost = inventory.getRepairCost();
}``` Is this not enough?
((AnvilInventory) inventory).getRepairCost()
block.getType == fire
unless if there is isFire() like there is isAir(). Maybe we'll have different kind of fires and air types in tge future
I wish Mojang added more tags
You can always add your own
Hello, how can I make the sound I am playing follow the player? Right now i am using the player.playSound() function. However, the sound remains fixed at the location where the function was executed. Is there a way to make the sound move along with the player as they walk?
mono sounds only not stereo
How should I play a mono sound
if you are adding sounds they must be mono
But I have to provide a location
player.playSound(location, Sound.valueOf(soundName), volume, pitch);```
are you playing built in MC sounds or new sounds in a data pack?
new sounds
then do as I said
don;t change your code, but change teh sounds so they are recorded in mono
hey is there an online util to convert songs to minecraft note sounds?
Uhh
i'm playing around with sounds and I though how abt if I make it play a song
but doing it manually is a pain im looking for a faster way
so, I'm trying to make a plugin that makes the tab a fixed size by adding things like fake players with blank names in each column under the actual players. how will I go doing that? (I'm kinda new to spigot/protocol lib so please explain, thanks!)
NoteBlockStudio can convert midi files
^^
An open source continuation of Minecraft Note Block Studio with exciting new features.
ok thanks!! so if i have an mp3 file I have to convert it to midi?
yes
can i also do that with note block studio
don't think so
The easiest way would be to find an existing midi file
midi files have .mid extension?
i've found some midi files on midiworld.com
thanks, figured it out
XDD works
nice
is it possible to choose java 19 under 1.20.4?
LTS versions are recommended
31 πͺπ»
unless using a minecraft version 17 or lower then 8 is recommended
11 or 17
Does it sync up with the other females in the house?
How did you change the sky color
