#help-development
1 messages · Page 2000 of 1
Something like that
no, it does not fire when I do the hover thing
one moment
alright we're kinda interrupting someone else a bit, can you create a thread real quick
I could set the proxy instance to my own class that extends ProxyServer right?
erm whut
?jd-bc
ProxyServer#setInstance
alr
This method may only be called once per an application.
https://gist.github.com/Flo0/a57fae81ad408681f318b761c5062937
And then
Gson gson = new GsonBuilder()
.setPrettyPrinting()
.disableHtmlEscaping()
.serializeNulls()
.registerTypeAdapter(Location.class, new LocationSerializer())
.create();
i kind of did something very different
public class HomeModule {
@Getter
@Setter
private String name;
private int x;
private int y;
private int z;
private float yaw;
private float pitch;
private UUID worldUniqueId;
HomeModule(String name, Location location) {
this.name = name;
this.x = location.getBlockX();
this.y = location.getBlockY();
this.z = location.getBlockZ();
this.yaw = location.getYaw();
this.pitch = location.getPitch();
this.worldUniqueId = location.getWorld().getUID();
}
public Location getLocation() {
return new Location(Bukkit.getWorld(worldUniqueId), x, y, z, yaw, pitch);
}
public void setLocation(Location location) {
this.x = location.getBlockX();
this.y = location.getBlockY();
this.z = location.getBlockZ();
this.yaw = location.getYaw();
this.pitch = location.getPitch();
this.worldUniqueId = location.getWorld().getUID();
}
}
but ur way of doing it is clean as fuck
This will work but you should really use the type adapter. Because you write it once and then you can simply
automatically serialize List<Location> Map<UUID, Location> etc. from then on.
fair enough
thank u so much for helping me
i would've never figured it out lmao
{
"0867b702-e48b-4cc7-8a88-af9ed424a9ac": [
{
"name": "home",
"location": {
"world": "34268d9f-02f6-49de-aebb-2c6d67b87d98",
"x": 38.369164472631404,
"y": -29.0,
"z": 14.000366179546882,
"pitch": 24.124159,
"yaw": 61.882202
}
}
]
}
result
:D
nice
How can I get this attribute import?
https://www.codegrepper.com/code-examples/java/setting+players+max+health+using+attribute+spigot
import org.bukkit.entity.Player;
import org.bukkit.attribute.Attribute;
Player player;
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(aDouble);
What dependencia using?
Spigot api or spigot jar?
spigot api
Your IDE should resolve this without a problem
Dont bother writing imports yourself. Just use the class and let your IDE import it.
My IDE cant find it
Oh you are using an ancient version of spigot... well... too bad 🤷
Support was dropped years ago and this version is half a decade old. Also the community is vanishingly small.
okay
I think there is just Player#setMaxHealth()
👍
out of curiousity (can hashmaps be madepublic)?
duh
how though
just add a public infront of ur line thingy
^
who are you talking to
Generally happen because you didnt import the spigot into your ide
Yeah that works. Just make sure to place it in a class and not in a method
Also use a Set
You should not make them public. Always strongly encapsulate any data structure.
then what should i do instead
Make it private, In your case also final, and add mutators /accessors for the map
oki
*Methods that access and edit the content of the map without ever presenting the map to other classes
@lost matrix so you suggest my hashmaps should be like this
private final Map<Location, Boolean> blockMap = new HashMap<>();```
Yes
Because making them public damages the robustness of your code. You lose control and track of your data.
ok
so i can make public method to use the hashmap but not a public hashmap?
?
Can you guys just drop it
?
I thought I said stop
does opening a new inventory from another inventory call InventoryCloseEvent?
iirc yes
ItemStack marioChar = new ItemStack(Material.STAINED_CLAY, 1, (byte) DyeColor.RED.getDyeData());
How can I change the color of the clay block?
What version
1.8.8 (ik its not supported anymore)
Probably different byte data I would not try doing dye color
Try just adding a byte data of 1 etc
Red is 14
works now, ty :)
A list of all Minecraft Clay IDs. Clay is crafted with clay balls, which are obtained from the bottom of rivers and the ocean. This category contains all of the different color variations for hardened stained clay, which is also called terracotta in some Minecraft versions.
How do I shrink the world border in mc?
Like the UHC gamemode where the border gradually shrinks as time passes by
Go to docs type in border and you'll find it
Hey \o
I want to disable teleportation via Spectator Mode (Because of an animation which would pretty much break if the player just teleported...).
Is it enough to block PacketPlayInSpectate?
Why does everyone do things the hard way. Sigh. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerTeleportEvent.TeleportCause.html#SPECTATE
declaration: package: org.bukkit.event.player, class: PlayerTeleportEvent, enum: TeleportCause
Took me 5s to find in the docs
That packet is for spectating an entity anyway
why when trying to get the material type of a netherite item i get air?
api version 1.16
why is this not available in different classes?
public void setTeam(UUID player, String colour) {
teamMap.put(player, colour);
}```
Nothing to do with teleporting
How is the nms ChatComponentText called in nms remapped?
Oops 😅
I never think of the easy way, cuz I keep using nms for everything
Delete NMS return to API
why?
Because NMS is discouraged when the API exists already
Because 99% of the time someone in here is trying to NMS an API feature
As just seen
NMS has the problem of being version-specific
And, it's a pain to maintain it across versions
@ivory sleet ping for help
Even if you use abstractions, you still have to write said abstractions every time a new update comes out
Okay, can you please tell me how to modify the names in the tab list?
Which means your plugin will likely stop working at some point
Player.setTabListName
It's easier now, because of the new structure 🤔
Just don't depend on the field names and you're golden
alr ty
Something like that
What isn't available your question isn't clear.
setPlayerListName
I can't use it in differnet clases
Well it’s public
The method? Or the hashmap?
But not static
Hey all, has anyone gotten the 1.18.2 build to work from BuildTools?
So you need an instance of that class to use it
Yes
--rev 1.18.2
so do i need to make it static to use?
ah nvm, just tried it again. It threw an error the first time around, my b
Do you know what static means
that doesn't exist
Learn java moment
setPlayerListName
yea
it means i dont have to make an instance of the class to use it
Thanks! And how can I make tablist headers and footers?
?jd
@young knoll so i make it static?
not neccesarily
i just need it to be used anywhere
Then have an instance if that class
ok
i'm iterating through a collection (for)and i'm trying to assign teams
and there are 8 colours
how do i set the colours
randomly
How can I change the name of a player that is above his head?
Is the spigot jar inside spigot repo or only the spigot-api?
Only the API
Sad... I need some way to get the spigot and not the api other way than running BuildTools inside GitHub action
Atm it takes around 50 minutes to complete
There isn’t one
Can you take the version from build.gradle and load it into the plugin.yml I think it was something like ${version}
hi
player.setMetadata("blood", new FixedMetadataValue(Killeffects.getInstance(), true));
I have that code, and when the plugin is trying to set the metadata
it says owningPlugin cannot be null
hey everyone
can someone tell me if this is a right sql statement
"CREATE TABLE IF NOT EXISTS "+tableName+
"(NAME VARCHAR(100),UUID VARCHAR(100),ELO INT(100),RANK VARCHAR(100),GAMESPLAYED INT(100),WINSTREAK INT(100),LOSSES INT(100),ISBANNED INT(10);"
instance is null
getInstance is null then
make sure you are using the instance after you set it
i cant seem to find whats wrong with it and whenver i run my plugin it says theres an error here
yes shouldbe
getInstance has not been initialized
public static Killeffects instance;
public static Killeffects getInstance() {
return instance;
}
did you set the instance
ohhhhhhhhh
im dumb!
Also why is uuid a varchar
wdym
i forgot to set it, how may I do it? this.instance = instance on the onEnable?
Any idea how I'd go about changing a player's skin only for some of the players via ProtocolLib or nms directly?
nope
instance = this
in on enable
oh
bro i love you no homo
lol
thank you
np
@Override
public void onEnable() {
instance = this;
registerListeners();
registerCommands();
}
like that
ty
you got it
i'll test rn
iirc tablist packet does the trick
do i have to end this with a ; too ?
SELECT * FROM "+tableName+" WHERE UUID=?
yes
iirc every sql statement ends with a ;
o
yeah it aint bad practice
does it work now?
if and else are control blocks
why?
ohhhhhhhh
you mean
bool ? smt : else
oh
its still a control block
like... an if-else
? Is called a conditional operator
Its the more abstract name. Ternary operator refers to ? : *in java
While conditional operator is a more broader term.
Ternary operator refers to any 3 argument operator
ohhh
its a life saver
how?
never had one problem with plugins
ofc i hate it with mods
but its good with plugins
where do I download the java 1.8.0_92
"
*?
I think its a brilliant alternative for archetypes + it has extra code analysis
a
This plugin does literally nothing at compile time
anyone?
Please don’t use java 1.8.0_92
If you get compile time issues then you need to fix your pom
use 1.16
ues
but how do I make it support 1.8
you don't support 1.8
wat
you spit in the face of 1.8
how do
and stop it in the ground
1.16 should be unsupported by all
aa
imo
1.8 is half a decade old and support was dropped years ago. Also the community is vanishingly small.
only support latest version, maybe version before that
I get it but how?
I asked everyone
no answer
1.8 is literally a bubble where everyone thinks all the world uses 1.8 while they are a minority.
only hypixel
They just use java 8 I imagine
yes
nonononononon dont use 92
taco!
Go search in old forum posts from half a decade ago. This version is not supported anymore.
java 92 is 89 versions behind
yes
but does it support 1.8?
wait no it's way back
what do you think
229 versions behind
idk
Update your java
spigot 1.8 usually is written using java 8. But use the latest java 8 version.
Okay
Apparently the latest java 8 is 311
I guess oracle really means LTS when they say LTS
imagine not being able to cast in if instanceof checks 
LTS means = Long (infinite) term suppotr for orcale
i mean supporting 1.17 is fine
thats java 16
but like
1.16 and under?
no
people asked me for 1.16 support because they didn't know how to install viaver
I’m pretty sure 1.8 will happily run on java 17
indeed
it probably would, however there is some plugins that rely on reflection that couldn't though
is there a way to color a mobs display name?
then I must have used it the wrong way, thanks
why hasn’t spigot made a method to change game profile “profileName” yet?
it was removed
you can only set it and UUID while creating a player
any ideas?
Multiple markers at this line
- The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from
required .class files
- The method contains(CharSequence) from the type String refers to the missing type
CharSequence
you messed up yor env somehow
how to fix
already
no
contains(CharSequence) is old java, what version are you using?
How is it old java
hmm, well it was introduced in Java 8, specifically which version of 8 I do not know...
Ah
mmm
I thought you meant it was removed in newer java
can i ping staff?
no it aint
contains(CharSequence) works just fine
mmmmmmmmm
intelli and gh copilot both suggest it
their version might be before it was introduced
hahaha - it tells you right there you are missing the import
? ;d
It has the solution right there
you need java.lang.CharSequence
he could add it to his reference library as well
true, he could just use a regex
What
regex?
anyways
You have the jre right now
That’s not the version ecplise is using
wdym
Eclipse is using the jre
Do you not see where it says jre1.8.0_321
Change which java eclipse is targeting
Google should help you there
um?
Tell eclipse to use the jdk, not the jre
how
he is not listening
buildtool settings
wait
yes that window
actually, two windows up now - i was too quick i thought it was the same one
this window and add the second jdk
how to check that
help/about
what
add a library path for teh jdk so you can access it
Please check your eclipse version
oof 2010
Jfc
i cant
Update eclipse
Well eclipse 2010 doesn’t support java 8
You can use Intellij 2021.1
supports 32 bit?
Yes
Do note this is the last 32bit intellij version
Yes
Also get a new pc that was made in the last 7 years
InteliJ 2021.1 is probably a better option, at least it isn’t as old
Nothing supports 32 bit anymore
ooh i didnt think on thatt :D
why im dumb :D
:/
mmmmmm
Does anyone know how to rename an item using package?
i ll use intelij
this?
nvm
foundit
Idk I don’t use InteliJ
32bit
Cringe
CharSequence has a pretty bumpy history
"
Java 8 supports default methods in interfaces. And in JDK 8 a lot of old interfaces now have new default methods. For example, now in CharSequence we have chars and codePoints methods.
If source level of your project is lower than 1.8, then compiler doesn't allow you to use default methods in interfaces. So it cannot compile classes that directly on indirectly depend on this interfaces.
If I get your problem right, then you have two solutions. First solution is to rollback to JDK 7, then you will use old CharSequence interface without default methods. Second solution is to set source level of your project to 1.8, then your compiler will not complain about default methods in interfaces."
its both an eclipse and java issue
I will have to try and remember about the pre-java 8 indirect issue.
Does anyone know how to rename an item's name using package?
not sure the compiler will allow you to use run() like that
that is fine and working
i just want to know, why spawn 2 armor stand ?
well you have armorStand.remove() inside the run()
yes, after 2 seconds removes the armor stand
you sure it is actually getting called?
aha,
just spawns 2 armor stands insted of 1
If it spawns 2 then its being called twice
is teh damage on both stands the same?
if it is, I'm going to guess you registered the listener twice
so second event has no entity?
yes
check if it has no entity then
just exit the event if there is no entity then
fixed
no nono
it spawns a armor stand
so when u hit, armor stands hits too
so there is a damage to armor stand
lol
yup
why not check for both entities
Try marker
and deal with them? (seeing that this is specific to both player and armorstands)
Anyone got a resource for using scoreboards and teams?
i've a better idea, how can i disable armorstand's hitbox ?
cant you do that just with commands without a plugin?
Marker tag
boolean isMarker() Returns whether this armor stand is a marker, meaning it has a very small collision box.
ow, thanks
why would you think that?
Hello 👋
This is correct
I created a custom texture pack with custom sounds for my minigame and put the direct download link into my server.properties, the pack gets downloaded after joining my server but I cant hear the custom sound, why?
How are you triggering the custom sounds?
player.playSound(player.getLocation(), "minecraft:custom.jump-1",2.0F, 1.0F);
And how is your resourcepack structured
my sounds.json is in my minecraft folder
in singleplayer it worked just fine with:
/playsound minecraft:custom.jump-1 @p ~ ~ ~ 0.05
it is no space
its a folder
its like assets/minecraft/sounds/custom/jump-1.ogg
my question ⬆️
Getting the same results with something other than a pressure plate.
also it worked just fine in singleplayer with the following command:
/playsound minecraft:custom.jump-1 @p ~ ~ ~ 0.05
@ivory sleet go up the replies (ping for help)
Create a set with initial capacity to be 8, then for every taken color push it to the set, and then have a linked list or sth for the available colors and then remove by index there
okay thanks
hey, my events in different classes do not get fired.
package de.juslife0.resourcepackenforcement;
import de.juslife0.resourcepackenforcement.events.join;
import de.juslife0.resourcepackenforcement.events.response;
import org.bukkit.plugin.java.JavaPlugin;
public final class ResourcepackEnforcement extends JavaPlugin {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new join(), this);
getServer().getPluginManager().registerEvents(new response(), this);
getLogger().info("Das Plugin wurde aktiviert.");
}
@Override
public void onDisable() {
getLogger().info("Das Plugin wurde deaktiviert.");
}
}
is there something i do wrong in this main class?
the class names are response and join
the classes in the src of the plugin are also lowercase. should i change it?
Okay. i forget it always. but then the classes/events get fired?
It doesnt change anything but just looks better
okay but what then is the problem that the events are not fired?
package de.juslife0.resourcepackenforcement.events;
import org.bukkit.ChatColor;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class join implements Listener {
public void onJoin(PlayerJoinEvent event){
event.getPlayer().sendMessage(ChatColor.AQUA + "Um das selbe Spielerlebnis für jeden zu ermöglichen, bitten wir dich das Resourcepack zu akzeptieren. Du darfst das Resourcepack ablehnen, bekommst dann aber eine minimale Roleplay-Strafe.");
event.getPlayer().setResourcePack("http://download1979.mediafire.com/7082nvqti96g/aikgiqv20n860a3/Wolfhound+Classic+Medieval.zip");
}
}
this is the join class
they need @EventHandler
oh
on top of each method
i know that i need an eventhandler but i forgot to write it in there
I can but the plugin is only local for my server so nobody will ever see the code or get the plugin
you'll see it later
and you won't remember what you were doing
"When I wrote this code, only I and God knew what it did. Now, only God knows"
the plugin is already final. i will delete the project folder after i check that the plugin works
why would you do that
lmao
that makes absolutely no sense to delete it
what if you want to change it later?
why would you want to have to go back and redo it all
when no documenting:
//this code does something
@crimson terrace in theory but im not doing that
i'm trying to use it to make it so projectiles dont have collision for particular players
How can i round a number like 6.123345 to 6 or 5.89694 to 5.5
Math.round
Also, .setcancelled is not a valid method for projectilehitevent?
Google it lol
that rounds to an int doesnt it
Read the docs and find out
whab about 6.215 to 6.2 or 9.7541 to 9.7
idk what is that but thanks
@sage patio don't use Math.round
aaaa ok, so what
.
With this you can configure for example how many decimal places a float/double has
doesn't that convert it to text
[11:32:14 ERROR]: Could not pass event ProjectileHitEvent to AesopianProject v1.15.2
java.lang.NoSuchMethodError: 'void org.bukkit.event.entity.ProjectileHitEvent.setCancelled(boolean)'
at co.lotc.aesopianproject.listeners.SpellListener.OnFireballHitEntity(SpellListener.java:259) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1164.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.15.2.jar:git-Paper-236]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.15.2.jar:git-Paper-236]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-236]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-236]
at org.bukkit.craftbukkit.v1_15_R1.event.CraftEventFactory.callProjectileHitEvent(CraftEventFactory.java:1279) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.EntityFireball.tick(EntityFireball.java:84) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.WorldServer.entityJoinedWorld(WorldServer.java:803) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.World.a(World.java:869) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.WorldServer.doTick(WorldServer.java:528) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.MinecraftServer.b(MinecraftServer.java:1303) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:430) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1157) ~[patched_1.15.2.jar:git-Paper-236]
at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:946) ~[patched_1.15.2.jar:git-Paper-236]
at java.lang.Thread.run(Thread.java:832) [?:?]
Relevant stacktrace
It's wierd because the method is on the spigot javadocs...
yes this is for printing it
Is it a version problem maybe?
I hate Java docs because that is completely not understandable for me
@sage patio what are you planning to do with this rounding
Looks like a paper problem
Woops
Wrong person
np xd
@restive mango that's an issue with paper
aa lemme show u
watch the video
When i hit some entity, an armor stand spawns and shows the damage
then yes use DecimalFormat
but sometimes that damage is something liek 5.2545945615
I'd recommend DecimalFormat
How many decimal places should be visible?
1
Just set the max amount of ending zeros to 2 or 1 or whatever
DecimalFormat df = new DecimalFormat("#.#");
System.out.println(df.format(someNumber));```
#.# would respresent 100.3 or 20.4
just one digit after the comma
no not .1
just that #.# ?
ye
Is this ok or do I not need the DecimalFormatSymbols? (asking for my own project)
How can I change the Skin of a player? I have like no package knowledge so I will need a good explanation xd
Well, that's fair
Hello i have a problem for use NameTag edit, but its on paper, i was told that the spigot plugins worked on paper
||```java
[ERROR] null
org.bukkit.command.CommandException: Cannot execute command 'ne' in plugin NametagEdit v4.5.0 - plugin is disabled.
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchCommand(CraftServer.java:907) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2289) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2100) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2081) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1414) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:189) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1391) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1384) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1362) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1268) ~[paper-1.18.1.jar:git-Paper-207]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-207]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```||

Go ask the paper people lol
2 for 2
Player
so i need to reorder an array every time a command is ran
but since the array can get to sizes like 60k it stalls the server for a few seconds
i was thinking i can create another thread
but im not sure since while that is happening someone else cant use that array
What doing lol?
okay yeah i see now im not good at explaining
okay so
i have an auction house and i store the ordered values as lists right
and whenever a player purchases/auctions an item i need to reorder that list
but while that is happening the server stalls for a second to do the processing
why are you not using a database?
bruh just add it at the end of the list
yeah but then i need to reorder the ordered lists
i add them to the end of the list
and i reorder the lists
i mean like
ordered by price
ordered by creation time
etc
ofload all that work to teh database
that wont help anything
you're just ordering the auctions by price?
you wont be parsing and sorting on the main thread
price, time left, creation time etc
so an user can pick multiple sorting criterias?
yep
Collections.sort on a collection object is prolly better than holding an array
or is it a list/ set?
ah
its fast but it gets laggy when the size is like 60k
ye
and do users have a limit of auctions they can post a day?
its an extreme case that it would ever reach 60k
not yet
i should probably make that a feature tho
how many players do you have?
60k is an extreme case
but i still need a way to like
not make the server wait to reindex
MySQL ORDER BY Keyword
do your db operations async
mm okay
tell me ._.
hehe anyways thank yall!
😶
bruh im not understanding this, when my server version is 1.17, players cant connect with fking 1.18
how so? viaversion has no problem working that way - 1.18.2 is supported in both 4.2.1 and 4.2.0
Okay, really, I'm just trying to get entities to not collide at this point.
I've tried with teams, yet it does not appear to work.
For example:
Team team;
Scoreboard scoreboard = p.getScoreboard();
if(scoreboard == null)
{
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
}
if (scoreboard.getTeam(p.getName()) != null) {
team = scoreboard.getTeam(p.getName());
} else {
team = scoreboard.registerNewTeam(p.getName());
}
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
if (!team.hasEntry(p.getName()))
{
team.addEntry(p.getName());
}
team.addEntry((p.getWorld().spawnEntity(p.getLocation(), EntityType.ZOMBIE_HORSE)).getUniqueId().toString());
p.setScoreboard(scoreboard);
I know there must be a way to do this with teams, or the collision rule crap would not exist...
This should spawn a zombie horse on the same team as the player and thus be not collidable, yet it is still collidable
do team rules apply to non-player entities?
pushOwnTeam - Entities in this team cannot be pushed by another entity in this team.[1]
How do I use Persistent Data Container on an item?
?pdc
not sure how that is different from: never - No entities can push entities in this team.
Yes
oof: https://bugs.mojang.com/browse/MC-87984 - Still open: teams option <team> collisionRule values are not working correctly
Did someone say modifying source code 👀
oh i need viaversion for it to work?
... that is the viaversion support chart ....
lmao stupid explenation
im trying to implement tab completion for a command. ```java
public void onEnable() {
try {
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
bukkitCommandMap.setAccessible(true);
commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
} catch (Exception ignored) {}
SomeCommand command = new SomeCommand(this);
commandMap.register("somecommand", command);
getCommand("somecommand").setTabCompleter(command);
}
//now the SomeCommand Class
public class SomeCommand extends BukkitCommand implements TabCompleter {
JavaPlugin plugin;
public SomeCommand(JavaPlugin plugin) {
super("somecommand");
this.plugin = plugin;
}
public execute(/.../) {
/.../
}
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
/.../
}
}``` now I get a NullPointerException for getCommand("somecommand")
if i remove that line the command works as declared in execute in SomeCommand
register it in plugin.yml
thats what i didnt want to do...
the line java getCommand("somecommand").setTabCompleter(command); somehow throws me a NullPointerException
getCommand gets it from plugin yml
removing it makes the command work, without TabCompletion
i guess
ok, how can i workaround that?
you're never adding it to the commandmap
isnt it commandMap.register("cmd", new Command("cmd"));
dont you have to declare it as a SimpleCommandMap instead of a Field lmao
or just invoke it
They are declaring it as a command map
do you mean the arguments of the Constructor or placing the constructor in the register function?
not really sure why someCommand() is a plugin and not a command
It is a command?
?
If I add 100 Locations to a ArrayList of Location with a Runnable, is that ArrayList usable in another Runnable ?
iirc its synchoronized
because i tried, it seems when runnable cancels, arraylist clears
Someone who has got a good documentation for learning how to work w teams (for example for a duel plugin)?
microsoft teams 👀
with what?
yep, my first thought
please else if is something
😑
just look at the start and play part
ArrayList<Location> locations = new ArrayList<>();
if (args[0].equalsIgnoreCase("start")) {
BukkitTask record = new BukkitRunnable() {
int ticks = 0;
@Override
public void run() {
locations.add(player.getLocation());
Utils.sendActionbar(player, "&dRecorded " + String.valueOf(ticks) + " ticks");
if (ticks == 100) {
cancel();
Utils.sendActionbar(player, "&dDone!");
}
ticks++;
}
}.runTaskTimer(Main.getInstance(), 1, 1);
}
if (args[0].equalsIgnoreCase("play")) {
BukkitTask record = new BukkitRunnable() {
int ticks = 1;
@Override
public void run() {
NPC.walkNPC(player, locations.get(ticks), locations.get(ticks + 1));
Utils.sendActionbar(player, "&dPlayed " + String.valueOf(ticks - 1) + " ticks");
if (ticks == 101) {
cancel();
locations.clear();
Utils.sendActionbar(player, "&dDone!");
}
ticks++;
}
}.runTaskTimer(Main.getInstance(), 1, 1);
}
if you mean the arguments for the Constructor, thats why im invoking super("cmd") in the constructor of SomeCommand hardcoded????
uhh i cant figure out whats it is supposed to do
You need to learn about variable scope
coll can you live with that code? 🥺 i cant
You create a new list every time you run the command
So of course it’s going to be empty
i am just trying to sort this in my head, using super() is somethin i usually try to avoid
thanks
please fix the if if if if thing
xd, maybe later
it will go thro all those options lol
with switch case
better
why? is it personal reasons or what?
makes the main class a little cleaner
As the same Class only works with one command, it (should) know its own name
do it in super class and not in main the command map thing
ok, update: tried to use java ((PluginCommand) commandMap.getCommand("somecommand")).setTabCompleter(command); now i get a classcastexception or something
yep, ClassCastException Class SomeCommand cannot be cast to PluginCommand
does BukkitCommand extends PluginCommand?
command.SomeCommand(command) subclass should override hurts my head, too many similar names
actuallt i dunno lol
i cant quite sort out the order it should be in
i cant think today lol
could i use TabCompleteEvent?
you dont want to listen for that
thats a clear and upright private repository
404
can spigot surpass the max enchantment level of 255
No
Well I mean you can
how?
But it will just act the same as 255
ItemMeta.addEnchant
Or ItemStack.addUnsafeEnchant
unsfae enchant sounds fun
thanks
for something like this, would it work, or does the for all happen at the same time?
List<String> colours = new ArrayList<>(8);
colours.add("Red");
colours.add("Blue");
colours.add("Green");
colours.add("Yellow");
colours.add("Aqua");
colours.add("Grey");
colours.add("White");
colours.add("Pink");
for (Player value : players) {
int random = (int) (Math.random() * colours.size());
String team = colours.get(random);
setTeam(value.getUniqueId(), team);
colours.remove(random);
}```
no, it extends org.bukkit.command.Command
@ivory sleet for your point before and also ping for help
was discord down?
api is down
Yeah
oh i thought it was my internet
yt worked ._.
Welcome to Discord's home for real-time and historical data on system performance.
guys
i am spawning a bat outside the worldborder
and then, applying a velocity to it
but my bat dont enter the worldborder
is there a way for me to do it?
dont think that will load while the api is still down
then just open the link
your spawning yourself riding the bat?
i just spawn the bat, add me as passenger and set the velocity to the bat
not sure how that works in spigot, I use a different server when I need ridable
You can still open the files directly

FIREWORK_SHOOT Effect not playing
location.getWorld().playEffect(location, Effect.FIREWORK_SHOOT, 1);
is playing an arrow shoot effect instead of a FIREWORK_SHOOT
can you get all the constants of an enum if you have its class?
i guess the issue is not related with passengers
but with the entity trying to move itself
yeah
.values()
You can’t get that from a Class
wa
You could reflect to get the values array though
yeah a Class<Enum<?>> object
cant u do getEnumConstants()
yea i just realized
so it will return the constants in declaration order?
so i can check them to string and see if they are equal to something?
probably
Has anyone had any problems with Player#setVelocity suddenly not applying the velocity anymore?
How can I exchange an item in a chest and have it reset after 30 minutes?
Someone knows, why this Error is showing up? It says, it can't find the path, but the directory is existing
help pls
i had to use Paths myself
to figure out where I was: String path3 = Paths.get("").toAbsolutePath().getParent().toString(); it was dropping me into the wrong directory
You do know Plugin.getDataFolder exists
^
i am personally not working in the plugin folder
Sus
Plugin::getDataFolder then just toPath and toAbsolutePath and resolve the actual file, at least if you do work with the plugin data directory which they seem to be doing
no, I am lazy and managing my server config files
config files should be IN your data folder
Hello i started working on a plugin few days ago but i just hit my first real problem.
And i was wondering if anyone could help me.
Tanks 🙂
umm can i ask how 😅
maven repo is different
oh I see, it is different
So is --remapped just not necessary anymore to get Mojang Maps?
helol is there any way to create a static knockback environment, maybe with packets and stuff? I want to mAKE KNOCKBACK CONSISTENT
oops caps
but also in async
e
Async fast
quik

... fast? its just a different scheduling
It’s fast if used correctly
It doesn’t block the main thread
So it’s good for operations that take an indeterminate amount of time
Like io
that does not make it any faster, it is just a more efficient use of your time
Can be good for large procedural tasks that can be decomposed into smaller ones (hence why it can be faster)
Personally I do all my Bukkit methods async and do all the IO and Requests on the main thread
Just better tbh 🙄
if you want faster math, then you would use branch prediction
Which is already done by JIT afaik
Compiler smort
But even so, using some sort of asynchronous worker load distributor for big mathematical tasks that can be split up and processed in parallel sometimes won’t harm you at all
nope
It’s not even split up, it’s just on one thread
Gotta solve the issues before users complain about your task using 0.05% of a tick
Parallel streams are the perfect example
Wait does BuildTools compile SpecialSource?
public void runAsync(Runnable action) {
ExecutorService service = Executors.newCachedThreadPool();
service.execute(() -> {
new Thread() {
@Override
public void run() {
Bukkit.getScheduler().runTaskAsynchronously(PLUGIN, action);
}
}.start();
});
}```
Brigadier?
Brigadier?
:)
(:
Frogadier?
I've been reading about the Minestom API today... it looks quite nice ngl
Isn’t it just the paper API
Yeah that’s brigadier and Minecraft which hooks into it
There’s little documentation
Or well from what I know
Thought there are many open sources that use it, maybe they can teach you one or two things
You can use Forge and Fabric guides too
Fabric has a good quide
You can also use a command framework that hooks it
zacken tho to simplify it for you in abstract terms, you basically have command node trees where super nodes know little to nothing about sub nodes, and then there’s two type of nodes, literals and arguments,
literals are for sub commands usually as it’s basically an enumeration of a set of strings that gets tab completed
arguments are the things that will show <blah> etc, with those you’re able to fetch inputs / actual arguments, as opposed to literals, that’s all
no not really
For instance luckperms
lps first subcommand set is only literals
lp group, lp user, lp listgroups etc
group would be one literal
user another literal
however
lp group <name>, here <name> would be an argument
yes
Does LP use brigadier?
So this is correct so:
/faction - command
/faction list - argument
/faction create <name> - sub command
🤔
iirc yes
I didnt find any class like PermissionAttachment (at least on spigot exists)
It’s a bit less extensive
hey guys is there a better way to make this detects more than one word because I just kind of copied and paste it a lot and it works like a charm but it seems like a mess so how do i make it detect a lot of words in just one
if (e.getMessage().toLowerCase(Locale.ROOT).contains("bitch")) {
e.setCancelled(true);
String message = ChatColor.translateAlternateColorCodes('&', "&c&l(!) &bHey, no swearing ") + p.getName();
Bukkit.getScheduler().runTaskLater(plugin, () -> e.getPlayer().sendMessage(message), 20);
this is a mess
Allright so to add user perms I do it vía event right?
I’d keep a set of strings
Hmm let me see
?jd-bc
I would do a Set and them loop throuht it
Concluclure sorry for asking that noob questions but i didnt find any tutorial about creating a simple bungee perms plugin
Allright thanks
But basically you’re accountable for managing the permissions persistently
Which LuckPerms for instance does
Im spigot you managed them by PermissionAttachment
