#help-development
1 messages · Page 515 of 1
How can I fix that? I mean the fact that \n doesn't work
I'm using this code to create the HoverEvent: https://paste.md-5.net/ojibemakag.coffeescript
Try writing in hard in the code some test "test\ntest". If it works then you'll have to check your config doesn't return \\n for instance
how do I make it so that when a player places a block with the "[ProtocolLib/NMS]" api, he digs it with the animation: "BLOCK BREAK ANIMATION"?
it works this way, how do I fix that?
I need the value to be taken from the config
to replace every \\n to \n?
.
yeah, that was the solution, thanks for helping me
Be more precise, and more patient too
ok: "how do I make a 'Listener' whereby if I place a block, it breaks using the animation of the breaking block "
When a fake block is placed it's client side so you will probably not get any interact even on it
with the 'ProtocolLib/NMS' api can be done but
I can't do it
Use sendBlockDamage every few ticks
and when animation is done remove the block
how to use it?
declaration: package: org.bukkit.entity, interface: Player
"void sendBlockDamage(@NotNull
Location loc,
float progress)" what do they mean by float progress?
hey can anyone help me in dm fix my reload command?
oh boy, aggregateJavadocJar is really severely broken
plugin.reloadconfig();
Why dm
I am using a datahandler class,etc
Hard to explain here sicne more ppl are gonna type
it is a private chat.
May I dm you @scenic onyx
i dont now
it is a plugin
minecraft?
Yes
ah o
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
can you give me a code example?
or someone else
I mean that doc says exactly what you need
?
What part are you having problems with
if I do something like 'player.sendBlockDamage(player.getLocation, 0.1)' does it work?
Can anyone help me fix my reload command please? 🙂
how did you even mess up a reload command
I can t even get it to work
I m boutta break something
just reloadConfig()
I m legit using that
show some code
Do i need to nake all the getStrings into a instance?
?
private final JavaPlugin plugin;
private FileConfiguration config;
public DataHandler(JavaPlugin plugin) {
this.plugin = plugin;
loadConfig();
}
public void loadConfig() {
File configFile = new File(plugin.getDataFolder(), "config.yml");
if (!configFile.exists()) {
plugin.saveDefaultConfig();
}
config = YamlConfiguration.loadConfiguration(configFile);
}
public void updateConfig() {
config = plugin.getConfig();
}
public void reloadConfig() {
plugin.reloadConfig();
loadConfig();
}
public String getString(String path) {
return config.getString(path);
}
public List<String> getStringList(String path) {
return config.getStringList(path);
}
public boolean getBoolean(String path) {
return config.getBoolean(path);
}
}```
you do not need to do this
inside your on enable just saveDefaultConfig
it doesn't replace it if it exists
you mean i don t need the datahandler class?
also using plugin.getConfig() just returns the most up to date version after reloading
ye
yeah but i modified all my getstrings already to use the datahandler
JavaPlugin#reloadConfig()
JavaPlugin#getConfig()
How many do you have
you using intellij?
isn t this doing it already tho public void reloadConfig() {
plugin.reloadConfig();
loadConfig();
}
yeah i am
You're just delegating the config methods
It's a pointless class actually
myPluginInstance.getConfig().getString()
oh bruh
Actually just replace all usages of your data handler with pluginInstance.getConfig()
ye
isn t it any way i can just modify the datahandler dude
i just gotta redo whole classes
and it s alot harder bruh
Just replace it with plugin.getConfig().getString()
ofc you can edit the datahandler
pointless, but you can
Could you help me modify the datahandler please
edit getString to return plugin.getConfig().getString(path);
And do that for the other methods
public String getString(String path) {
return plugin.getConfig().getString(path);
}
public List<String> getStringList(String path) {
return plugin.getConfig().getStringList(path);
}
public boolean getBoolean(String path) {
return plugin.getConfig().getBoolean(path);
}
Like dis?
Hello , How make link Button in java without send URL (1.19)!
I use old Verssion me!
if (cmd.getName().equalsIgnoreCase("site")) {
TextComponent message = new TextComponent("§7[§9Site§7] §8: §fSoon");
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "Test"));
player.spigot().sendMessage(message);
}
also after that it would be smt like this:
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
dataHandler.updateConfig();
dataHandler.reloadConfig();
right?
@remote swallow can you check if it builds for you? for me, now nothing works anymore when it tries to aggregateJavadocs https://github.com/mfnalex/lunatic
yeah that's because the 1.19.4 module uses java 17
if you comment out that module, it'd work, but I don#t get it, because it's excluded from the javadocs
guess I have to exclude the whole javadoc plugin from the module, not just the classes
but idk how
Do you guys ever used SmartInvs by MinusKube?
@chrome beacon mi da errore: "
private void sendBlockDamage(Location loc, float progress, int sourceId) {
// Utilizza NMS API per inviare il danno al blocco
// La seguente implementazione è specifica per la versione 1.17.1 di Minecraft, potrebbe non funzionare su altre versioni.
// Ottieni il mondo tramite NMS API
net.minecraft.world.level.World nmsWorld = ((org.bukkit.craftbukkit.v1_17_R1.CraftWorld) loc.getWorld()).getHandle();
// Ottieni il blocco tramite NMS API
net.minecraft.world.level.block.state.IBlockData nmsBlockData = nmsWorld.getType(new net.minecraft.core.BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
// Invia il pacchetto di danno al blocco tramite NMS API
nmsWorld.playBlockBreakParticles(new net.minecraft.core.BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), nmsBlockData, sourceId);
// Invia il pacchetto di danno al giocatore (vedi nota sotto) tramite NMS API
// Nota: Nella versione 1.17.1 di Minecraft, non è disponibile un metodo per inviare direttamente il pacchetto di danno al giocatore.
// Pertanto, dovrai trovare un modo alternativo per notificare il giocatore del danno al blocco.
// Puoi utilizzare PlaceholderAPI per ottenere il nome del giocatore da mostrare nel messaggio
String playerName = PlaceholderAPI.setPlaceholders(player, "%player_name%");
// Notifica il giocatore del danno al blocco
player.sendMessage("Il blocco è stato danneggiato da " + playerName + "!");
// Puoi eseguire altre azioni personalizzate qui, come premiare il giocatore per aver distrutto il blocco, aggiornare statistiche, ecc.
// ...
}
"
mi da errore: "PlaceholderAPI", "player", "playBlockBreakParticles"
?codeblocks
Don't use NMS for particles also English only
smh
?paste
ok, how i use?
World#spawnParticle()
in what way?
I need NMS because I am making a plugin where if I place a block I rope it using the breaking animation.
you rope it?
?
I do not understand what you mean
particles are just packets, there is zero reason to use NMS/protocol to spawn particles when the API already wraps it
They never exist on the server
non voglio spawnare semplici partivella ma voglio usare il "sendBlockDamage": "https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#sendBlockDamage(org.bukkit.Location,float,org.bukkit.entity.Entity)"
?english
one moments
I do not want to spawn simple partivella but want to use the "sendBlockDamage": "https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#sendBlockDamage(org.bukkit.Location,float,org.bukkit.entity.Entity)"
.
the change never happens on the server
do you know coralmc?
no
if you are sending fake block damage you need to do it in a scheduler as the client actually hitting the block will reset any damage it sees
it is a minecrat server where in the lobby if you place a block it will break it with the animation of the block breaking. if you want to check it out: "play.coralmc.it"
very simple to do
how is it done?
player places block, play increasing damage to the block. When finished break block
I was trying to do it but I don't know how.
does this happen for every block placed?
yes
and all players can see the blocks breaking?
yes
ok simple...
Hello everyone, can I ask here if I have a problem with my Spigot server? I'm sorry I'm totally new here
you want a Map<Block, double> blocks placedBlocks = new HashMap<>();
Oh thanks, sorry
how do I use it?
start a repeating task which iterates over the map sending fake block damage to any players, then increased the damage value in the map
can you give me a little code that does that? at least to understand the reasoning
?
Map<Block, double> placedBlocks = new HashMap<>();
onEnable() {
scheduler.runTaskTimer(this, () -> {
placedBlocks.EntrySet.foreach... Loop and sendBlockDamage to each player...
increase the double in the map.
if new double > max break block and remove from map.} , 0, 1);
onPlace(event) {
placedBlocks.put(event.getBlock(), 0);
}```
pseudo, fill in the blanks
in "player..." "what shall I wear?"
basically kotlin
This is pseudo code. it simply shows what you have to do it. The logic of how to do it, You need to write the code based on that example
i put it in "public class BlockDamageSender implements Listener {
private Plugin plugin = CoralLobby.getPlugin(CoralLobby.class);
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
}
}"
i can't
because is in on enable it
you can start the task from wherever you want
move it to your listener class constructor
Sorry I'm not writing it for you
ok
elgargpt pls generate the code for a cool tower in my tower defense game
Getting an HTTP error with BuildTools when building Spigot Jar 1.8.8, https://s3.amazonaws.com/Minecraft.Download/versions/1.8.8/minecraft_server.1.8.8.jar just returns access denied.
Is this known?
That's helpful hahaha
Wish me luck
I think I have it archived on an old device fortunately
Eh I wouldn't rely on that
Log4j might still impact that Kar
Jat
Jar
Try paperclip
it read fine from s3 here
You don't get this?
Yeah I also get that
@eternal oxide this?: "
`public class BlockDamageSender implements Listener {
private Plugin plugin = CoralLobby.getPlugin(CoralLobby.class);
private Map<Block, Double> placedBlocks = new HashMap<>();
private double max = 10.0; // Valore massimo di danno consentito per un blocco
public BlockDamageSender() {
plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
placedBlocks.entrySet().forEach(entry -> {
Block block = entry.getKey();
double damage = entry.getValue();
// Invia il danno del blocco a ciascun giocatore...
damage++; // Aumenta il danno del blocco di 1
if (damage > max) {
// Rompi il blocco e rimuovilo dalla mappa
block.breakNaturally();
placedBlocks.remove(block);
} else {
placedBlocks.put(block, damage);
}
});
}, 0, 1);
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
placedBlocks.put(event.getBlock(), 0.0);
}
}`
"
yes, you only missed sending the block damage to all players
didn't fuinction: 'The blockade splits it but you can't see it'.
yes you never sent the damage block in the task
how is it done?
something like world.getPlayers().forEach(p -> {p.sendBlockDamage(...
you can get world from the Block
ok
Bukkit.getOnlinePlayers().forEach(player -> { player.sendBlockDamage(block.getLocation(), (float) damage); }); error: "sendBlockDamage"
how i resolve this @eternal oxide
get error: "
private void sendBlockDamage(Player player, Block block, double damage) { player.sendBlockDamage(block.getLocation(), (float) damage); }"
@eternal oxide
still gives error
what error?
sendBlockDamage
need an actual error
error: "Cannot resolve method 'sendBlockDamage' in 'Player'"
I don't know how to solve
@eternal oxide
will need to see code
What version of spigot is this
1.12
Which api to create custom yml files do you recommend me?
not possible in 1.12
verison?
i recommand java file
@eternal oxide
how version ?
making custom yml files isn't hard
Huh
No clue what version it's in. I usually ask because it helps to figure out if this is a version issue which it seems to be
ok
it was probably added around 1.16.5
i verified this
ok but give error: "Bukkit.getOnlinePlayers().forEach(player -> {
sendBlockDamage(player, block, damage);
});
" damage
whats with people using a forEach for no reason
its only fancy if you can pass in a method ref
@eternal oxide
Well is damage a variable
so...
?paste the whole class
how it is?
no need to cast here player.sendBlockDamage(block.getLocation(), (float) damage);
but nothing wrong with that code
you are using the wrong spigot version
how do I solve, i use 1.16.5 but the error is damage
not sendBlockDamage
also this line damage++; // Aumenta il danno del blocco di 1 should be damage+=0.1; // Aumenta il danno del blocco di
changed
are you still getting the method error?
at damage get error Variable used in lambda expression should be final or effectively final
if you are try Spigot 1.18.2
ok
ah ok
i try
just make line 50 and 51 final
make line 23 and 24 final
i try 1.18.2?
ok
error block: "Cannot resolve symbol 'block'"
I cannot because it gives all error then
is there another way to make this queue?
you don't need line 43 to 45
change line 28 to player.sendBlockDamage(block.getLocation(), damage);
damage get error
You seriously need to give more information than "error"
Variable used in lambda expression should be final or effectively final
you did not set lines 23 and 24 final
Block block = entry.getKey();
float damage = entry.getValue();
I see no final key word in either line
were already non-final
make them final
still not final
damage is still not final
can't work with "error"
Cannot resolve symbol 'damage'
where?
Hey, I have code so what if a player tries moves out of a WorldGuard region it sets there velocity to send them backwards. Though the code to send them backwards runs multiple times because while the velocity is moving them they are still outside the region so its sets there velocity 3 times. How do I make it only run 1 time?
whit a runnable
what
Track the last time they were pushed out. If a certain amount of time or ticks has passed you can push them again
alr u dont think there is a better way?
yeah while i was typing that i had a realization abt that lmao
@eternal oxide lo sto rifacendo con protol lib
You don't need Protocollib
Don't make this harder for yourself you can barely use the spigot API
this is the new code: https://paste.md-5.net/ixuvagifik.java
second you want it to work
?
Why are you using Protocollib
You shouldn't be using NMS either
and what
Use the Spigot API like I told you to a few hours ago
and like you were working on 10 minutes ago
btw are you using ChatGPT or smth for code
but it dont fund
my hand
I doubt that
totally gpt according to openai text classifier x)
am I a robot?
I don't think so
this is the problem of this tool. people use it to skip the learning part
you seem to be struggling with basic Java so how did you end up with obfuscated nms names and ProtocolLib code in less than 10 minutes
I have a friend of mine who is helping me in vocal
I mean just send them this: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#sendBlockDamage(org.bukkit.Location,float,org.bukkit.entity.Entity)
declaration: package: org.bukkit.entity, interface: Player
And run 1.19.4 and you'll be fine
I don't think it's as easy as you think
It is, I gave you all the code. You are stuck on basic java
if it runs that's good enough
i use merven
Is that within a proper scope?
i know
repositories {
mavenCentral()
maven {
name = "spigotmc-repo"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
flatDir {
dirs 'libs'
}
}
dependencies {
compileOnly "org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT"
compileOnly 'me.clip:placeholderapi:2.11.3'
implementation ":AquaCoreAPI"
implementation ":BountifulAPI"
}```
i have AquaCoreAPI and it works :I
?paste
I didn't even know they have a classifier, I fed it a text I just generated from chatgpt just to test it and it doesn't know if it's ai generated
not surprised
Okay
BountifulAPI.sendActionBar(player,"Action Bar Message", duration);
It is static
but if i try in IntelliJ
nvm
worked
now
idk why+
Ask Bard if it can give you a recipe for brownies
I heard Bard gets a conniption if you mention the word death
No clue but it's unable to give me a brownie recipe because it's a text model
whats a conniption
I started running uncensored models locally when I asked gpt4 to give me a list of 100 names associated with death and it says that's just over the line
Big angry
can't even generate names for my dnd campaign because the ai doesn't want me to know about Hades
it's not even consistent, if you hit regenerate a bunch of times it sometimes still gives you a list
That's hard to achieve a nice and smooth filter
I make a method that returns if a location is within an area. How do I make sure if a player shoots an arrow that arrow doesnt leave the area?
Well depends
What do you want to do if it leaves the area ? Remove it or redirect it?
remove it
But Im worried if I just check every time it moves it will lag server
When the player shoots the arrow, it has a velocity
You'll just have to compute the time it will take to distance your radius
Launch a scheduler to remove the arrow after the corresponding time
Yeah as long as "in an area" is just a cuboid there is no problem to be had
But once you have like a composed shape it can be taxing on performance
Likely gonna sound stupid, but is there a way to spawn a block but using sand physics? Like if I wanna spawn cobble blocks but make them fall like sand
Search for FallingBlocks
are there any apis for creating custom mobs without nms
Wdym?
When I tried to spawn a bunch of falling blocks my server lagged out because it tries to update each block location each tick
how do I make these particles travel inside the chest
I tried this but its not working
You'll have to change the offsetX,y,z to point the chest location
Your offsetX y z are in reality a relative spawn location
Not their speed
like this @agile anvil ?
Has anyone ever cached their messages in memory so they don't have to plugin.getConfig().getString() everytime or is this just bad practise?
you can create a variable that you will use
No
Spawn you particle a little around the chest
Then substract the chest location with your spawn location
This will give the offset of the spawnParticle
It’ll be a bit faster
And easier to read
So you do recommend caching it in a Hashmap?
I mean thats already what it is internally
Iirc
But it does do some transformations to the key first so I guess it will still be slightly faster
Even better though is to save it to single variables
Like this @agile anvil
Yeah that's better (do the same for y and z
Tell me the result
The offset values are the maximum random offset on that axis
Oh
The offset will be between 0 and that value
Oops
is there any way to set a custom source/target version while using gradle's toolchains? e.g. using "java 17" toolchain but still setting source/target to 8?
your math is incorrect for the nextDouble(). It isn't using a negative
if your intention is to use a negative
0.2 will contain the number between 0 and 1, and -1 will make it always negative 🤣
I want the particle to go in
Mb
but you are not using a negative is my point
.1
oh you are not the one
anyways, its not being multiplied by a negative
0.1 is not negative
I assume they want it to be positive or negative
The current code gives a value between -0.1 and 0.1
what should I do then
Well you should find how to apply velocity to a particle, never played with that sorry
I don't see where this is being set, otherwise it generates positives
random.nextDouble is a value between 0 and 1
nextDouble in [0, 1]
at least now its negative, however even this isn't necessary btw
Multiplying it by 0.2 will make it value between 0 and 0.2
you can just provide a range
And then subtracting 0.1 makes it between -0.1 and 0.1
Does nextDouble in the standard random class take a range?
what should I do now?
random.nextInt(30 + 10) - 10
yes
anyways this is how you could get a negative range
the above would be -10 to 30 exclusive
Well yeah that’s one way to do it
Find how to apply a velocity to particles
I personally don't know
thats a thing?
You could technically also do it with the new stream methods
No
yes you could but my intention was just pointing out the math was flawed
so how they do it doesn't matter as long as its correct 🙂
Particles either spawn with a random velocity or no velocity afaik
I'm trying to store a player object in a PDC so that I can access info like exp and inventory later, but I can't figure out how to get a deep copy of the player object to give to the PDC. Is this even possible or am I misunderstanding how the player object works?
Uhh
And if you have the player you can already get their level and whatnot
I'm trying to save the state of the player at some time in the past
You'll have to write your own object storing infos you want (like level)
like all. xp, health, food, inventory mainly. I know I can save them individually but I want to avoid doing that
Make a data class that holds it all
You can’t instantiate a player anyway
Not with the api at least
yea a data class would probably be the best way actually
you can however make a wrapper
I know it's not possible, but hope dies last
is there any spigot alternative to paper userdev? like, just a maven specialsource plugin for gradle?
or do I really have to manually run the specialsource .jar through ProcessBuilder to get it working? D:
this can't be
me too but they were all like, no readme, no whatever, like no clue how to use it
Pretty much
at least I didnt understand it, so I didnt bother to even try
I just use userdev, I have no issues with it
Well, no issues now that it has shared caches
yeah but my issue is, I need to create a jar working on java 8
and userdev uses toolchains
and toolchains prevent to use -source and -target compiler args because it itself uses -release
I kinda got around with that by only specifying the toolchain for my nms modules but then, the aggregateJavadocJar plugin freaks out
I wish I could do that too but there's still like 300 servers running angelchest on 1.16 -.-
idk why 1.16 is still so popular
probably they use one of those hybrid forks
1.16 is still a fairly big modding version so that’s probably it
/shrug Granted there are plenty of good graves mods so…
Can't something like TeamCity do these things?
looks like I don't have the "gradle toolchain" issue anymore
Sometimes you just have to tell ‘em to get fucked
yeah but first of all, I ask people if it's okay that I fuck them
and right now, nobody complained yet
Meh, they can still use it they just won’t get updates
And if they are already using it that means it has the features they need anyway
57 to 1 now. I love this, I should have asked this earlier
that means I can use records
and ignore the weirdness of having different toolchains per NMS module
I love this
Is LootGenerateEvent to add loot to loot tables?
I just want to add one like one item and its been a pain to just get that to work.
What does the event give you
Nothing it may be because of I'm not giving it a loot percent or smth have no clue
public class LootGenListener implements Listener
{
@EventHandler
public void onLootGen(LootGenerateEvent event) {
event.getLoot().add();
}
}
Like this?
Well you need to provide an ItemStack to the add method
Will this add to all the structures. I know that btw. I was going to try just create a structure arraylist of all the structures I want.
Create a set of the loot tables you want to add to
And check if the table from the event is in that set
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
K so, the stuff here is a wanna make a claiming system this works like this:
There are Teams that can have only 1 claim in overworld, no nether neither end.
This claims should be at least 5x5 and maximum 60x60.
This claims are made with a wand (Like worldedit) pos1 and pos2.
When selected, claims from 1 team and another need to be atleast 2 blocks away like Claim <- 2 blocks -> other claim.
Also, when entering and leaving should inform the player
The stuff is
i dont know how to make it
Spigot 1.8.8 vanilla being used
What part of it
wdym
What part do you not know how to make
Everything
Like
the stuff is
idk how to make claims only private for the team members
(obv other people can enter)
lemme make a video
so u can see
If you don’t know how to do any of it you may want to spend more time learning
look this
So theres a message when i leave and enter
Also i cant modify anything in their claim
I can make it very easily with .yml files and checking the location
but the stuff is
i dont want to check all world to check where the player is
and idk how to like, check only 10 blocks from the player lets say
You only need to check the block they are in?
yeah
but without checking all teams claims
u know
i thought 2 solutions
Partition claims by chunk
1st: Divide all map in a list of hashmaps that will be like 200 - 300 301 - 400
and like that
Well yeah that works too
But chunks is basically spatial partitioning done for you
yah
the problem
is that in HCF normally theyre custom
and well
i like it custom
gives freedom
So
maybe ill try the hashmaps
I have a GUI that I create, I can cancel clicks just fine in the top inventory (the custom one), but how can I cancel clicks in the bottom one (player inventory)?
I still don’t see why you are making your own spatial partition with hash maps
The event will fire for both, simply check if getTopInventory is your custom inventory
Can you give me the is it event.getLootTable()?
i know i should use chunks but i dont like it
:(
My Code.
public class LootGenListener implements Listener
{
@EventHandler
public void onLootGen(LootGenerateEvent event) {
Random random = new Random();
int max = 5;
int pointval = random.nextInt(max);
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
ArrayList<String> lore = new ArrayList<String>();
lore.add("");
if (pointval == 1) {
meta.setDisplayName(ChatColor.GREEN + String.valueOf(pointval) + " Point");
} else {
meta.setDisplayName(ChatColor.GREEN + String.valueOf(pointval) + " Points" );
}
meta.setLore(lore);
item.setItemMeta(meta);
}
}
You can use a ternary operator for setting the meta displayname
meta.setDisplayName(ChatColor.GREEN + String.valueOf(pointval) + " Point" + ((pointval == 1) ? "" : "s"));
Ohh thats nicee.
You still need to add the item to the list of item stacks
w
I have never messed with loot tables. I've looked through spigot forums, create a post. I check the java docs but its too confusing.
What list? As I previously stated. Can you be more clearer.
List<ItemStack> items = new ArrayList<ItemStack>(); basiclly this.
List<ItemStack> items = event.getLoot(); I mean again I don't no much about how these loot tables??
it's a mutable list, you remove and add items from it
I know a bit of java. but still learning. Not to mention not really documentation on things to help.
That's why its hard for people to understand cause it gives no examples for it. Except docs that methods.
Spigot has full javadocs
Yeah I don't like javadocs.
I like an actual code example of things. Its easier to understand vs looking at docs because you have no idea what the hell mean.
Press . and scroll
Usually the methods are fairly comprehensive
You probably don’t need examples for getting a list from something
I am learning vector stuff but got a bit of a problem understanding it, i am trying to move the armorstand 0.5 block to the right and 0.5 down relative to its direction with this code:
Location loc = this.armorStand.getLocation();
Location newLocation = loc.add(loc.getDirection().multiply(new Vector(0.5, -0.5, 0)));
this.armorStand.teleport(newLocation);
but its not moving correctly so i must be doing somethign wrong here, can anyone give me some pointers?
What are we multiplying here
how would i go about making an event not trigger?
essentially i have a listener detecting when a player closes a minigame inventory then sends them a message saying that they failed the challenge.
though I also have it so if a player takes too long in the minigame it will automatically close the minigame inventory and say they failed.
as expected the failed message prints twice and i don't want it to do that.
before you say to not put the failed challenge message, on the last stage i also have it close out of the inventory and prints to the player that they won, but the failed message also triggers because of the inventory close event
return; stops the method
i really dont understand vectors but, i thought if direction.multiply(5) is five blocks forward, then direction.multiply(Vector(...)) is moving it relative to its direction
thats just not what i asked
i don't want the inventorycloseevent to trigger in certain scenarios
i'm asking how i go about doing that
Vectors are based on the 3 axis
So y is always up and down but x and z aren’t always forwards backwards left and right
if blah blah return
then how should i move it left/right relative to its direction?
You can rotate the vectors
Or cancel it in one event and check isCancelled if you insist, but the event will be called.
They have various rotateAround methods
how can i cancel a listener
Return out of it, you can’t stop the event from being called.
sorry could you please explain with a bit of example code
vectors are just so confusing
If you rotate it 90° around the y axis you should have a vector pointing to the left of your original one
And then 270/-90 for the right
Although the methods use radians so you’ll need to remember that
ah alright thank you very
does someone know a placeholder where the prefix of the group doesnt have a space?
as %vault_groupprefix% has a space included idk why
i dont understand
do you mean the underscore?
this?
or do you mean the VALUE of the prefix including a space?
if so, that's because that's how you added it into the luckperms/whatever config
you can however use other placeholders to manipulate strings to remove that space
but isn't that more like a #help-server question?
Oh yeah my bad 😭
oh so you fixed it now?
yea i though it was the placeholder, i created my group with a space, my bad thanks!
no problem!
ArrayList<String> structures = new ArrayList<String>();
public void addStructures() {
structures.add("LootTables.DESERT_PYRAMID");
}
@EventHandler
public void onLootGen(LootGenerateEvent event) {
addStructures();
List<ItemStack> items = event.getLoot();
Random random = new Random();
int roll = random.nextInt(100) + 1; // Generate a random number from 1 to 100
int pointVal;
if (roll <= 50) {
pointVal = 1;
} else if (roll <= 70) {
pointVal = 2;
} else if (roll <= 85) {
pointVal = 3;
} else if (roll <= 95) {
pointVal = 4;
} else {
pointVal = 5;
}
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
ArrayList<String> lore = new ArrayList<>();
lore.add(ChatColor.GREEN + "Right Click to Redeem!");
meta.setDisplayName(ChatColor.GOLD + String.valueOf(pointVal) + " Point" + (pointVal == 1 ? "" : "s"));
meta.setLore(lore);
PersistentDataContainer data = meta.getPersistentDataContainer();
data.set(key, PersistentDataType.INTEGER, pointVal);
item.setItemMeta(meta);
if (structures.contains(event.getLootTable().getKey().toString())) {
items.add(item);
}
}
I'm trying to spawn my custom item in the desert temple as a test. I'm most likely putting the wrong structure id.
how could i send a title to the player (and put it on the actionbar) in api version 1.14? I'm new to plugin development i was using command blocks before lol
Constant or just one time.
it would be each time they break a certain block type (logs in this case)
public void onLogBreak(BlockBreakEvent e){
if(e.getBlock().getType().toString().endsWith("_LOG")){
//whatever code to send a title to the actionbar when the block is broken
}
Does 1.14 have player.spigot().sendMessage
yes
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
This is my first time using the placeholder api how do i make it update every sec as its a timer
https://paste.md-5.net/edemiputud.java
The placeholder should just return the time left
It's up to the plugin using it to refresh the placeholder every second
Nm im just slow a=ig bc when its on a holo it updates slow af
Any way to enable cross play on a server with version 1.8?
Not sure what you're doing with the structures array, but this way - whenever somebody opens a chest and generates its loot for the first time, it will always add "LootTables.DESERT_PYRAMID" into the list thus increasing the memory usage for no apparent reason.
The if check you have at the bottom should be on top so you don't waste resources creating itemstack and stuff and not using it.
(I would also recommend inverting it and exitting the function)
Lastly: you can just print the current loot table in console or logs.
And yes, the loot table id is wrong, from the code it should be minecraft:something I think
Look for plugins ViaVersion and ViaBackwards
Is there a wikipage with all the lootabes or something
I do believe so
wait a sec
I'm not to worried about ram.
I meant how can I join via mcpe but via version just allows all java versions to connect
My main server version is 1.8 which geyser doesn't support
That does not matter, you should strive to make the plugin the most efficient.
You could find it to be a problem down the line
Oh sorry, I misunderstood your question.
I do not know of anything like that, sorry
Yeah, but currently not I'm just trying to get it work lmao
ok I can't find a full list rn but if you got into a world and start typing out the /loot command it will give you all possible loot tables as a suggestion
Not really sure if what the command gives you is actually the internal key tho
Np
I just noticed that nobody answered your question for 6 hours... Oof
With the amount of ppl here I would expect somebody would have some kind of answer
Its fine lmao.
I mean you could have the server on latest, use viabackwards to enable compatibility with 1.8 and use Geyser
If you're looking for 1.8 pvp there should be a plugin for that as well.. probably
Also I believe your question is more of #help-server question
Actually I had got a setup which my friend had made he had asked me to keep it and it's setuped in 1.8
So I'm finding a way to enable cross play on it
Well GL in searching I guess then
What are the reasons of keeping the server in 1.8?
That's strange, you should convince him that the solution is to update the server to the latest version and use eventually viabackwards and 1.8 pvp
That's the only solution left ig
Maybe not the only one, but the easiest and safest one at least
Ya
Maybe there are some disliked new features, but you can disable or change them
But latest versions are way better in term of performances and security
It seems to be working. Also, what would you recommend instead of using a ArrayList.
https://pastebin.com/EjBBGezh
Alright, show me something that backs up your point
Is it a local LAN server?
Then security matters
I would make the list static and populate it in the static initializer
static
{
structures.add(...);
}
Also I think a HashSet<String> might have better performance
I don't have time, neither desire to argument with you. But it's not because you gave a permission to a folder or a program that it cannot access your whole computer, or network. That's why cybersecurity exists
and use structures.contains(event.getLootTable().getKey().toString())
You can also make the list final
ye make it private static final Set<String> structures = new HashSet<>();
Or public if you need to access it elsewhere
The contents of the list can change even if it is final
That does not seem to be the case
Do you mean to change the type of his structures from Set to List at runtime ?
If he chooses he wants a different type he has to change it in source and the final can stay.
I may be not understanding you correctly here.
Oh ye I see
Tho I do not think he could switch from Set<> to ArrayList<>
I was just confused by your example then
Switched it to that
updated that too
Yes, I understand now
I just thought you meant switch between list, set, map from this message.
My bad
I mean, I think they all implement Collection so you could technically do it if they were set as Collection
But that would be just stupid
lol
Yeah dont do this
static here is just terrible
please do enlighten me with your reasoning
You can’t apply humble object principle, goes against object orientation, couples your code tightly, is not thread safe unless externalization of it, global mutability, you go against SOLID, code is less testable, code is less re-usable.
I like the Steve's way since it voluntarily shows that this list is above the object level
Alright, I assume you are indeed more knowledgeable than me
I am just a hobbyist java developer after all
I do what I think looks best and makes the most sense
Moreover it avoids multiple instantiations of this list which would be totally useless
If you wanna use a set globally, make it immutable at least
I mean you can use ImmutableSet.Builder if you wanna avoid some type of clone
^ yeah u have multitons for instance
Yeah but can happens who knows. Since you can do it, it is possible
Yeah that’s fair, I mean sometimes a static set can be justified, its just that there are usually better solutions to it, like 99.97% of the times
I know, but speaking of this case
In this case it looks like it can be immutable also :> since the population part is happening post class load initialization
iirc, you'll need to use static to create singleton or multiton right? That's why I personally find the static use totally appropriate
Wasn't speaking of set
singleton is the design pattern where there is only one instance and it has a global access point
Now ofc u can have staticless singletons etc
Yeah like a private constructor, static variable and static getInstance
But the definition is the canonical singleton
Myeaa
Myea classic example of eager singleton

the magic word is "chicken wing"
what should be final? the "instance"? how are you going to achieve that?
oh with the static block, sure. but won't work for spigot or sth
singletons are weird design anyway
they are very weird, because they force you to use the -release flag instead of setting -target and -source manually
oh I thought you talked about gradle toolchains lmao
mb
Lmfaoo
yeah I was confused because I called them weird in #general a few mins ago
hot dog and bologna
a lasagna is basically a bologna hotdog with shredded sausage
and without the soggy bread
how do i make this but chain them like a dialog?
What exactly do you mean ?
You'll have to be more precise and give examples
are you talking about the clickable links, or the conversation that's behind it
and they each have a chain of dialog
you assign a command to each link, e.g. /answer 1, /answer 2, etc
how do i link 2 clickable elements w/the chat components?
yuo wanna have sth like this right? Where Download, Donate, and Changelog are separate links, right?
if so, check the source of my update checker: https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker/blob/master/src/main/java/com/jeff_media/updatechecker/UpdateCheckerMessages.java#L145
it's just a list of TextComponents
This might be of help as well
https://www.spigotmc.org/wiki/the-chat-component-api/#the-component-builder-api
ight ty
best away to calculate time?
With what use case
Sir, this is Spigot development help
Actually, are applets still a thing ?
I thought they got yeeted at some point.
they were
They probably used the wrong word
I hope
Is there a way to get plugin message in bungee cord?
I don't know well how to use PluginEventMessage and Listener in BungeeCord
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
or are you talking about event listeners?
I saw that. but in there I couldn't find about PluginMessageEvent which is in bungeeCord
?jd-bc
?pmc for Spigot - https://www.spigotmc.org/wiki/sending-a-custom-plugin-message-from-bungeecord/ Bungee
When I Spawn A Invisible ArmorStand Using spigot
ArmorStand armorStand = ((ArmorStand) e.getBlock().getWorld().spawnEntity(e.getBlock().getLocation(), EntityType.ARMOR_STAND));
armorStand.setInvisible(true);
A Visible Armor Stand Spawn and After a millisecond it goes in Invisible
But When I Spawn A ArmorStand Using Command
/summon minecraft:armor_stand ~ ~ ~ {Invisible:1b}
Its Much Much Cleaner, It Spawn it Invisible At The First Place,
There Is Anyway To Make Spigot Version Clean Like Command Version ?
Use the spawn method that takes a consumer
It allows you to modify the entity before it’s spawned in the world
Is there a way to listen plugin message in BungeeCord?
Player's message you mean?
plugin message to communicate with backend servers
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I saw that but in that doc I didn't find the way to get plugin message in proxy (bungee cord)
thx 🙂
Please note that you need a player connected on the backend server to communicate with it
Ahha I got it
it works! 🙂
Hay, i need help how can i create an scoreboard with a sidebar and tablist teams with hex?
by "hex" do you mean text with the new hex colors ?
yes
How do you manage your teams ?
what do you mean?
Well what have you already done ?
now i only have the tablist team via the scoreboard
What do you mean by "tablist team" ?
player prefix in the tab
Okay, and what do you need now ?
a sidebar
So you need the team prefix to use the fancy colors ?
Should I share the github page of my plugin code in my plugins page? Or is going to happen smth
yes and a sidebar with fancy colors
There is no automatic way, you can add it as a link in the plugin description, or add a link in your plugin page
What's your code for creating teams ?
Because Sidebar is basically an Objective of Scoreboard
I believe the method of(Color) should transform the color into the format you can just append to a string message.
https://javadoc.io/doc/net.md-5/bungeecord-chat/latest/net/md_5/bungee/api/ChatColor.html
So just add this to the prefix.
I might be terribly wrong as well btw.
team.setPrefix(ChatColor.of(rank.getRankColor())+rank.getScorePrefix());
team.setColor(org.bukkit.ChatColor.GRAY); ```
and then when a player join i put the player in the team and set him the scoreboard
So you can see the prefix color in the tablist but not in sidebar ?
i dont have a sidebar can i create a sidebar with the same scoreboard?
Yes
Add an objective
Well it depends on what you want to display on the sidebar
If it's only the team names, just use the same one
Okay i have and it work but how can i add Hex colors to the sidebar?
private Player player;
private Objective objective;
public PlayerScore(Player player, String displayName){
this.player = player;
this.scoreboard = player.getScoreboard();
if(this.scoreboard.getObjective("display") != null){
this.scoreboard.getObjective("display").unregister();
}
this.objective = this.scoreboard.registerNewObjective("display", "dummy", displayName);
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
}
public void setDisplayName(String displayName){
this.objective.setDisplayName(displayName);
}
public void setScore(String content, int score){
this.objective.getScore(content).setScore(score);
}
Well I guess it's when you use setScore that you add a line right?
Correct
Then just input a hex color and a text in your content variable
BungeeChat's ChatColor class can get you an RGB colour code which can be inserted as legacy text
ChatColor.of(0xRRGGBB) + "some string"
I have a PR waiting to support components in scoreboards (and everywhere else), but for the time being it has to be legacy chat
becuse it dont fund? https://paste.md-5.net/nenikiwihi.java
sorry, what is your question ?
tis is the errore: "14:00:42] [Server thread/WARN]: [CoarlLobby-1.16.5] Task #2 for CoarlLobby-1.16.5 v1.0-SNAPSHOT generated an exception
java.lang.NoSuchMethodError: 'void org.bukkit.entity.Player.sendBlockDamage(org.bukkit.Location, float)'
at org.plaxer.it.coarllobby1.Listener.BlockDamageSender.lambda$null$0(BlockDamageSender.java:30) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092) ~[?:?]
at org.plaxer.it.coarllobby1.Listener.BlockDamageSender.lambda$null$1(BlockDamageSender.java:29) ~[?:?]
at java.util.HashMap$EntrySet.forEach(HashMap.java:1126) ~[?:?]
at org.plaxer.it.coarllobby1.Listener.BlockDamageSender.lambda$new$2(BlockDamageSender.java:22) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:352) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:890) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:412) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:815) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:648) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at net.minecraft.server.v1_8_R3.MinecraftServer.lambda$spin$0(MinecraftServer.java:133) ~[patched_1.8.8.jar:git-PandaSpigot-103]
at java.lang.Thread.run(Thread.java:833) [?:?]"
score.setScore(ChatColor.of("#aabbdd")+"Rank", 0); this is my code and the output is
Which IDE you are using?
intellij
sendBlockDamage() didn't exist in 1.16.5. It was a relatively recent addition. I want to say 1.18
How did you even compile this ?
I don't think the method sendBlockDamage exists
ok I guess that answeres all the questions :D
i can't upload a picture
Not verified? Upload screenshots here: https://prnt.sc/
thx
I would like to create a plugin where if you place a block it removes it using the block animation
ah+
ok...
Either use newer version or probably packets
it is from bungee
Looks like Red
Replace ChatColor by net.md_5.bungee.api.ChatColor
And tell us if it's the same color
Based on this code I'd say they are using the correct ChatColor
note the last line using the bukkit ChatColor
use Chat.Color.BLUE + "HELLO"
ah ok
IT FUNDDDDDDDDDDD
what ?
Its the same
If the bungee ChatColor doesn't work (which is strange), try that : https://www.spigotmc.org/threads/hex-color-code-translate.449748/#post-3867804
in italian: "FUNZIONA!"
Could you send your code where you add the "Ranks" line?
.
1.19.2 paperspigot
Are you joining with 1.19.2 as well ?
Well I haven't dug deep, but it seems that hex color only works on display objectives, not objectives tables
If some are using HEX somewhere else than in the display name of Scoreboard, that means you'd probably have to use NMS
It uses Kotlin but should be still readable
Ok
Yes
There exists this tiny Scoreboard manager
https://github.com/MrMicky-FR/FastBoard
You could use it if you want
It claims to support hex colors for 1.16+
Didn't hex appeared in 1.16 ?
ye 1.16, I missread, the number is line below :D
How can a view mojang-mapped nms source code? Is it produced by buildtools?
there are --generate-source and --generate-docs
Might be what you want
There is also a mapping comparator online which is great https://nms.screamingsandals.org/
Why 1.16 😭 😭 😭 😭
Ye, he seems to be compiling plugin for 1.16 and trying to use it on 1.8
Hi
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Can someone help me fix the Spigot server, it gives an error
are you developing a plugin ?
If not then go to #help-server
the server does not come up at all it give cmd error
Send the error to #help-server
Are you creating a plugin? If not, #help-server
Please check dm
But why, there are better ppl to help you solve whatever problem you might have.
Just send the log to #help-server
He's trying to run buildtools but the main class is not found. If anybody wants to help him, feel free to do so :)
Hi there, I'm trying to use the NametagEdit API however I keep getting the error below. Wondering if anyone can help.
the code is below
are you shading the nametag edit apit
so top is error message
yea, did you define it in the compile scope ?
not sure what you mean but there is the setup
I'm new to maven so still learning a lot
yea, add <scope>provided</scope> to the nametag edit dep
similar to how your spigot dep is setup
Well, basically maven packages the classes of the nametag API into your plugin jar if you don't use the provided scope
which means there are two version of the nametag edit api classes in the server, one from the nametagedit plugin and one from your plugin
ah ok, so I need the plugin and the scope provided thing?
Alright cause I had the plugin installed
and thought that may be causing the issue
Yea you want the plugin instsalled
you just don't want to shade the nametagedit api
ah okay
Hey everyone!
I'm a programmer with a passion for AI and data science. I'm currently working on an exciting project involving an automated PvP bot for a Minecraft Server. I'm looking for skilled Java developers who are interested in collaborating and contributing to the project. If you have experience in Java development for Minecraft or are enthusiastic about PvP bots, I would love to hear from you.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
whats the payment
the experience
and a python ai dev to add to your network/ friend
look if you are intrested please just dm me
Only the finest exposure
otherwise ignore it
This is just a hobby project, and I need someone who knows java to help integrate stuff. If you're interested in helping, DM me
How can I check if backend server is online in bungee cord?
The backend servers should be running in offline mode
Not sure why you need to check if they're online mode or not
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I just mean if server is turned on
Is this the only way to check it?
It's probably the easiest way to do it
I got it thx 🙂
MapPalette.getColor and MapPalette.matchColor are deprecated - what should i use instead?
My goal is to get the color and then make it slightly greener.
This is the code i have been using so far:
Color pixelColor = MapPalette.getColor(canvas.getBasePixel(i, j));
canvas.setPixel(i, j, MapPalette.matchColor(Math.max(0, pixelColor.getRed() - 40), Math.min(255, pixelColor.getGreen() + 100), Math.max(0, pixelColor.getBlue() - 40)));
deprecated != don't use. There is no replacement so keep using
keep in mind that matchColor doesn't do any caching so it ends up being quite slow to paint a 128x128 frame
Oh, good to know, I'll implement some caching then, thanks
Why is it deprecated if there is no other way to do it?
Read the deprecation note?
or is that nms
it just means it uses magic numbers which you shoudl not do, but currently there is no alternative
it's just warning you that it may be replaced at a later date
Do you want the color?
when there is a replacement the deprecation will tell you what to use.
If so use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/map/MapCanvas.html#getPixelColor(int,int)
declaration: package: org.bukkit.map, interface: MapCanvas
declaration: package: org.bukkit.map, interface: MapCanvas
ehh I'm not a fan of those methods
pretty sure they re-render the whole thing internally
overall the map api is quite slow compared to just doing stuff yourself
I doubt that
PR time?
can't bother
lot to rewrite
and NMS renders stuff too
The map API is not made to like
refresh dozens of frames in less than a tick
I remember doing tests and it was always above 30ms to render a whole frame
Since the cache was added it is way faster
matching the colors without caching them accounted for 3ish ms
Around 125 times faster
Oh what, is the client not restricted to 20 ticks / sec ?
So i can just spam it with map packets and it will give me like a 60fps animation?