#help-development
1 messages ยท Page 1797 of 1
do you create more than one instance of your UserInfo class while your plugin runs?
That seems like an easy API method to make
no
yeah I'd love to see a PR ๐
but I have no idea how to create PRs for spigot
all I see is a huge amount of patch files
I'm not used to that lol
I literally have no idea on how to contribute to spigot
hm yeah sorry but as said, I can't help without seeing more code, sorry
you got a link maybe?
fork over personal info to MD? wdym?
oh yeah I already have that
I got access to the internal bitbucket stuff or however its called
yeah fr
I was disappointed too
I mean, australia <> Germany, it's only like 15k km distance
aaah thanks for that link @young knoll
I'll bookmark that
I got the CLA but I never saw that link
i have a whole project for forking spigot (i will not say i stole it from paper and remade some scripts), if you want i will give it to you, it kinda easy to understand if you understand everything
sure, I won't say no to that, would be nice ๐
but I can't promise that I can do anything useful with it ๐
I'll probably need some time to even remotely understand how all this patching system etc works ๐
Nah thatโs for me
ah okay
yeah okay I'm only 500km distant from berlin
you probably also heard at least of Munich and Cologne ๐
if you want to fork spigot then Paper would do the job but if you want to fork paper then i can give you the 2nd too
well when I'd ever contribute, I'd like to contribute to original spigot ๐
All you do is run buildtools with โdev
and more functionality
oh
And then open the projects in an ide
yeah
I'll just check the guide you sent, thanks ๐
but i remember it is a lil bit slower than mine?
using build tools i mean
wait
wait
wait
...
Yes
nah just use build tools that Paper repo is only for 1.16.5
quickly gotta let the dog let out some dog urine
welp use build tools
?paste
my current code https://paste.md-5.net/japomawuko.java
what i want to do is a simply collision physics like that image
why in the world does EnderCrystal implement ServerOperator
who in their right mind would need to set a crystal as op...
id rather op a slime.
All entities do
๐
yeah but they tend to be very cautious in entering commands
but for real, I'd like to know too why entities can be OPs lol
I mean
why
just imagine you're playing on a server for 5+ years
only to realize that the admin is actually an itemframe
Top 10 plot twists in movies
Made me spit out my drink.
sry lol
how would i specify gradle to use the -shaded spigot-api jar
unecessary
true
the regular jar is fine with gradle
but if i wanted to how could i
When i use my command it just prints the usage and doesnt do anything
pointless, it only exists for people not using gradle/maven
you would use the shaded classifier though
shaded didnt even have what i was looking for, rip
Are you looking for the holy grail
yes
was looking for craftbukkit code
to look at ender crystals with adel
can i get some help please
did you register the command executor?
yes
show your onEnable and plugin.yml pls
k one sec
btw what is the command actually supposed to do
add a life to someone
@Override
public void onEnable() {
// Create Plugin Files
System.out.println("Loading LifeSteal files...");
File LifeStealDir = new File("./plugins/LifeSteal");
LifeStealDir.mkdir();
File playersDB = new File("./plugins/LifeSteal/players.sqlite");
try { playersDB.createNewFile(); }
catch (IOException e) { e.printStackTrace(); }
File configDB = new File("./plugins/LifeSteal/config.sqlite");
try { configDB.createNewFile(); }
catch (IOException e) { e.printStackTrace(); }
// Create Player Database
try { playerDatabaseManager.CreatePlayersTable(); }
catch (SQLException e) { e.printStackTrace(); }
try { configDatabaseManager.CreateConfigTable(); }
catch (SQLException e) { e.printStackTrace(); }
// Load Listeners
System.out.println("Loading LifeSteal listeners...");
PluginManager PluginManager = Bukkit.getPluginManager();
try { PluginManager.registerEvents(new JoinListener(this), this); }
catch (SQLException e) { e.printStackTrace(); }
try { PluginManager.registerEvents(new LeaveListener(this), this); }
catch (SQLException e) { e.printStackTrace(); }
try { PluginManager.registerEvents(new DeathListener(this), this); }
catch (SQLException e) { e.printStackTrace(); }
try { PluginManager.registerEvents(new OnChatListener(this), this); }
catch (SQLException e) { e.printStackTrace(); }
// Load Commands
System.out.println("Loading LifeSteal commands...");
try { getCommand("startGame").setExecutor(new StartGameCommand()); }
catch (SQLException e) { e.printStackTrace(); }
try { getCommand("addLife").setExecutor(new AddLifeCommand()); }
catch (SQLException e) { e.printStackTrace(); }
try { getCommand("removeLife").setExecutor(new RemoveLifeCommand()); }
catch (SQLException e) { e.printStackTrace(); }
try { getCommand("setLife").setExecutor(new SetLifeCommand()); }
catch (SQLException e) { e.printStackTrace(); }
getCommand("info").setExecutor(new InfoCommand());
System.out.println("LifeSteal has been fully loaded!");
}
name: Lifesteal
version: 1.0.0
main: me.wiggle.LifeSteal.Plugin.LifeSteal
api-version: 1.17
commands:
startGame:
description: Start the game with a 5 minute peace period
usage: /startGame
aliases:
- start
- gameStart
addLife:
description: Add an extra life to someone
usage: /addLife <user> <amount>
aliases:
- add
removeLife:
description: Remove a life from someone
usage: /removeLife <user> <amount>
aliases:
- remove
setLife:
description: Set someones lives to a certain number
usage: /setLife <user> <amount>
aliases:
- set
info:
description: Get info on how to start the game
usage: /info
aliases:
- lsInfo
ugh why do you wrap everything in try statements
its required
Because sql
yeah
Donโt know why they didnโt just use one big try catch though
i tried
Or not make everything throw SQLException
add a debug statement, like "sender.sendMessage" something at the top of your onCommand method
see if that gets printed
ok
yeah like
why
public AddLifeCommand() throws SQLException {}
how would that EVER throw an SQLExceptoin?
the code block is empty
it can't throw anything
except maybe outofmemory stuff or sth
or NoClassDefFoundError or sth
why do they?
ok
yeah I'd love to know too
im lolading the server
im still laughing because now i know that the admin is actually an itemframe...
i cant send images :bruh:
i wonder if i can force villager to op me
well it sent the message
verify it when? if you dont we are not the same
i dont have spiggot account
wait
did you try to add just one life to yourself?
and i dont feel like making one kek
because you check if lives == or or GREATHER THAN 1
yeah
but you didn't check if it's exactly one
[21:51:21 INFO]: Wiggle37 issued server command: /addlife Wiggle37 123
so nothing happens
and it printed my msg
yeah you're doing this:
so its stoped somewhere
if(life == 0) -> no
wow i cant type
mk
I imagine either entities also implement some kind of op interface in vanilla
Or itโs legacy weirdness from 2011
hmm fireball still an entity right?
Mhm
so if we throw an ender pearl up and fireball them we will tp to the fireball...?
arrow is shot in water idk
in bedwars i mean
here's the answer
for the "why are creepers OP"
question
quoting md_5
Since command blocks and the /execute command, entities can run commands and therefore can (in theory at least) have permissions and therefore op status.
people stop asking me "why angelchest only work for op" when
Im trying to run build tools but it keeps getting stuck on this (image shown below), any ideas to fix this?
how long did you wait for it to complete?
me?
at least 20 mins rn and ive tried 4 times before where ive waited for longer
remove everything in your buildtools folder except for buildtools.jar and try again
Ive tried that twice already
okay are you on linux?
if so run it with strace
windows
oh okay
does this work @tender shard
else if (args[0] == null && args[1] == null && lives >= 1) {
you should restructure your whole code. I can't tell you whether this works, I don't have any context where you put it etc and actually didn't really bother to read it
the whole structure of your parsing is a bit off tbh
mk
you should completely rewrite the whole class
ok
also as @young knoll pointed out
args[n] can't be null
if it would be indeed null, you'd get an ArrayOutOfBoundsException before the check could complete
ok
also what does this part of code do? lifeManager.AddLife(player, parseInt(args[1]));
add a life to the player mentioned
and how does that code look like?
yeah but as said
your whole parsing logic is totally broken
im rewriting the class now
yeah I'll give you a tiny example
what's the syntax actually meant to be?
can you give an example
like /addlife <player> <amountOfLivesToAdd>
yeah that
okay gimme a sec
ok
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length!=2) {
return false; // 2 arguments are needed
}
Player player = getServer().getPlayer(args[0]);
if(player == null) {
// Show message "player not found"
return true;
}
int lives = 0;
try {
lives = parseInt(args[1]);
} catch (NumberFormatException exception) {
// Show message "Enter a valid number"
return true;
}
player.setHealth(player.getHealth()+lives);
return true;
}
something like this as basic structure
do the pyramid is better ngl
ok ty
it looks cleaner imo
agreed
๐
here with added op check:
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender.isOp()) {
// Show "only for OPs message"
return true;
}
if(args.length!=2) {
return false; // 2 arguments are needed
}
Player player = getServer().getPlayer(args[0]);
int lives = 0;
if(player == null) {
// Show message "player not found"
return true;
}
try {
lives = parseInt(args[1]);
} catch (NumberFormatException exception) {
// Show message "Enter a valid number"
return true;
}
player.setHealth(player.getHealth()+lives);
return true;
}
also why do people call it "pyramid"? it's an arrow ๐
a pyramid has the point at the top, and not at the right side ๐
uhhh
the pyramid here isnt vertical
pyramid/arrow code is NOT cleaner
yes it is...
it looks clearer to me...
say that again after reading that ^
it might look cleaner to you for a tiny method with 3 nested if's without any else statements
but in general you want to avoid this garbage as soon as you can
also if your arrow pattern would be so much more readbable, tell me why it's not working and why you didn't instantly see the bug...
if (boolean == false) {
boolean = true
if (boolean == true) {
boolean = false
}
}```
You won't get a job in most self-respecting software companies if you make use of the arrow/pyramid pattern
true, but I doubt that's something people care about here
I can only say: avoid it at all costs uness you're like in a for loop
Even then, continue exists
pain
watch uncle bob
uncle bob
Uncle bob is the true chad
e.g. this is fine:
private static List<Block> getBlocksInRadiusSquare(final Location center, final int radius, final Predicate<Block> predicate) {
final List<Block> blocks = new ArrayList<>();
for (int x = center.getBlockX() - radius; x <= center.getBlockX() + radius; x++) {
for (int y = center.getBlockY() - radius; y <= center.getBlockY() + radius; y++) {
for (int z = center.getBlockZ() - radius; z <= center.getBlockZ() + radius; z++) {
final Block block = Objects.requireNonNull(center.getWorld()).getBlockAt(x, y, z);
if (predicate.test(block)) {
blocks.add(block);
}
}
}
}
return blocks;
}
But for if statements, etc: just avoid it
Oh I see what you mean with for loops. lol. Nested for loops. I thought you just meant a single for loop
09.00 Uncle Bob - Part 1
11.00 - Break
11.20 - Uncle Bob - Part 2
12.30 - Lunch
13.30 - Breakout sessions (NO LIVE STREAM)
15.30 - Uncle Bob - Part 3 - Including Livestream.
Tomorrow the programme will begin at 09.00 AMS
#codingwith #unclebobutrecht
yeah sure continue exists and I love it ๐
just wanted to say
SOMETIMES arrow is okay, a little bit
but only if there's a reason for it
SomarLint gets mad when I use more than 1 continue
That's cringe
yeah but it has flaws too
I once got a repo rated badly because it analyzed some XML code inside a Readme.md and rated it badly because the code blocks inside the readme weren't valid XML because obviously they included stuff like
[...]
you can ignore files
Anyone else able to help with this?
I could help when you'd be running linux ๐
just let it run overnight
maybe something will happen lol
no
dont care about it
it is apply patches
wow ok
wait for a few more mins
if it still there
how long did you wait for
ur pc is a potato
might be true but I won't invest time for it to tell me stuff that IntelliJ does anyway
delete ur pc
at lesat 30 mins now but ive tried 4 times before where its ran for an hour or more
tried deleteing everything and re downloading the jar as well
what's your specs? ๐
It merely takes a minute on my PC :/
(when everything's been downloaded already)
i forget exact but roughly ryzen 3, radeon rx570 (i think), 16gb ram
check in task manager whether java is actually doing things
e.g. when your CPU is idling, something's wrong
bruh RPG stop and try to help instead
nah dont call me by that name...
bt automatically download portable git
strace java -jar BuildTools.jar --rev 1.18-rc3 --remapped
might be but that doesn't mean the whole git bash thing gets installed
and also added to PATH etc
Ok ill give it a try
I mean it does shove a giant warning about portable git at you
yeah but as said: run it using git bash inside the git bash "terminal"
yea
I mean of course strace won't fix anything but we might be able to see where it's stuck
@worldly ingot @tender shard converted one of the methods in my code to a mostly? arrow-less version, rate?
https://paste.md-5.net/kehutelivi.java (original)
https://paste.md-5.net/ibohoxokir.java (arrow-less)
i feel like arrow vs arrow-less rly depends on just how deep the nesting goes
oh tbh the original code isn't bad at all
the last 2 are not arrow-less bc i just couldnt think of how to make a return; work when it functions differently depending on two different entities
a few nested if's are no problem
but if the whole code indeed looks an arrow, then you might think about refactoring it ๐
hmm
itโs not even that bad
because you can instantly see where it returns
i have an old think pad running arch and thatโs getting me through uni just fine
imagine you want to debug. in the arrowless version, you can just add a debug statement before every return and print "exited because XYZ".
so yeah I'd indeed prefer your new version!
true, in order to debug another project i did need to convert to arrow-less lol
Does anyone know how to reset map after a game without lag?
yeah it's really way easier and also easier to maintain and expand later ๐
my arrow-less is also longer i think because of my reluctance to not use braces, lol
just feels so wrong
reset a whole world?
What do you mean?
I'd copy the world dir before starting your game, then unload the world, copy over the old world, and load it again. but loading a world WILL cause lag
you'd normally just want to use a network and have a separate server for your minigames
well go for whatever you like
ah just realized an issue in my arrow-less, i full-stop if the killer wasnt a projectile
neither is wrong. I think the arrowless is way better readable
tfw u were incredibly right abt the debugging part, didnt even need to compile yet before i saw it
but you also have to know: I don't know what you're code is supposed to do, while you alraedy knew it. for me, the arrowless is way easier to read
๐
this doesnt look good, its been spamming this for the past ~5 mins; also this time it doesnt even have the files that were created until it got stuck last time, theres only BuildTools.log.txt which is empty
isn't that acccess violation?
ive no idea
IIRC c00...05 is access violation
Exception code c0000005 is the code for an access violation. That means that your program is accessing (either reading or writing) a memory address to which it does not have rights. Most commonly this is caused by:
Accessing a stale pointer. That is accessing memory that has already been deallocated. Note that such stale pointer accesses do not always result in access violations. Only if the memory manager has returned the memory to the system do you get an access violation.
Reading off the end of an array. This is when you have an array of length N and you access elements with index >=N.
https://paste.md-5.net/gopuyazuyu.cs fixed ๐ now its just about the same size as the original arrow code
I have no idea, are you running latest BUildTools @quaint mantle ?
yep
awesome :3
hm idk, maybe ask in the forums, I can't help either
Ok thanks for trying
but yeah it can't hurt to try to run it somewhere else
ill give it a try
e.g. I have buildtools at C:\BuildTools on Windows
but tbh
it seems like it's accessing RAM it's not supposed to access
i might try restarting my PC also
yea
but yeah if it would be a file permission problem, you'd get an error message on that
just reboot, and try again
k thanks
np, let me know if you got any new infos
yeah at least strace showed something
they could have waited hours otherwise with no helpful message lol
will Skull#getOwningPlayer call a web request if its owner has never joined the server
to set the player if a valid one exists
wdym by this
just check a username or uuid against mojangs api
you can't know whether the OfflinePlayer has a valid profile
EVERY uuid will return an offlineplayer
You can literally do Bukkit.getOfflinePlayer(UUID.randomUuid()); and you'll get a valid OfflinePlayer object
hmm
perhaps i should re-think how im approaching right clicking a player head to get the owners name then
lol
well
when you have the offline player, you can get the player's name
it will however return null if that UUID / player never joined your server
yeah i need to ensure that it will return the name even if theyve never joined
then you need to call the mojang API yourself^^
rip
yeah, see this:
i could bypass bothering with ensuring the head has a profile, since theres no way on my server the head wouldnt be from someone already on it
yeah
may I ask - why would you have a skull from a player who never joined?
/give
ah yeah okay
it could be since the client does freeze up a little when u first get the head
I made many plugins that simply use OfflinePlayer's or custom base64 skull textures and noone EVER complained about any lags regarding to any web requests
also if the server would to the web requests, that would mean servers could change player's textures / skins, which they also can't
well, except for sending fake UUIDs/usernames to the clients
was gonna say, SkinRestorer
https://paste.md-5.net/binomeluja.cs now THIS is an arrow @tender shard LOL
https://paste.md-5.net/anizohusod.cs ^ converted + comments
Does spigot support loading structures from .nbt files?
trust me, there's muuuch worse arrows ๐
I've seen arrows that don't fit on a 1920x1080 screen without scrolling to the side
and I abused arrows too a few years ago^^ that's why I always tell people from the beginning to not do that ๐
they shouldn't repeat my mistakes
F
i just didnt like how arrow-less looked
i can warm up to it maybe but i just dont like the look
btw since 3 minutes, all my paid plugins are finally 1.18 compatible :3
you'll learn to like it
just imagine how this would in arrow
/**
* Cancels the actual Item Spawn and gives it to the player that owns this drop
*
* @param event
*/
public void collectDrops(ItemSpawnEvent event) {
Item item = event.getEntity();
if(item.getThrower() != null) {
// Do not collect Player-thrown items
return;
}
ItemStack itemStack = item.getItemStack();
if (PDCUtils.has(itemStack, Main.IGNORED_DROP_TAG, PersistentDataType.BYTE)) {
PDCUtils.remove(itemStack, Main.IGNORED_DROP_TAG);
return;
}
Location location = event.getLocation();
Player player = DropOwnerManager.getDropOwner(location);
if (!main.getPluginHooks().mayPickUp(item, player)) return;
if (player == null) {
if (main.isDebug()) main.debug(" Don't pick up: no player found");
return;
}
if (main.getHopperDetector().isAboveHopper(location)) {
if (main.isDebug()) main.debug(" Don't pick up: above hopper");
return;
}
if (!EventManager.mayPickUp(player, item)) {
if (main.isDebug()) main.debug(" Don't pick up: EntityPickUpItemEvent cancelled");
return;
}
event.setCancelled(true);
Utils.addOrDrop(itemStack, player, location);
}
Huh
by looking at it, I just instantly spot the "return"s and know how far it executes until it stops
I guess that is one way to auto pick up drops
yeah that's my Drop2InventoryPlus plugin
BlockDropItemEvent
doesn't work
Ever heard of MythicMobs etc? ^^
I actually claim that D2I is the only auto pickup plugin that works with 99+% 3rd party plugins
BlockDropItemEvent does shit. Only works for vanilla drops, NOTHING else
Yeah sadly it isn't mutable
yeah well it IS possible to add to it IIRC
just the docs say that you must not do that
so no plugin does it, for obvious reasons
Maybe we should fix that
at least in 1.13 it was totally possible to add drops to the list
yeah I wouldn't have anything against that
oh btw @buoyant viper
you wanna see a real example for the anti arrow pattern? ๐
sure
F
?paste
?paste
that's about 20% of AngelChest's spawn method
now just imagine if that would just be nested
as said, the remaining method is at least 5 times longer than this snippet
that plugin obviously grew over time
the method used to be 100 lines long
now it's about a thousand lines
what he fuck
yeah and most of the logic is still inside other methods
death chest plugins get quite complicated when it's configurable and also support a thousand other plugins >.<
sooo just so you know: the code you posted was no problem. REALLY nested if's will get you problems
I think the problem is the fact that the list is of item entities, not itemstacks
So adding to it would require you to spawn the item externally first
and plugins grow over time, so better do it right from the beginning
hmmm
might be true
You could change it to itemstacks
But then you can't mess with any of the entity properties
also that would be breaking changes
not gonna happen
but tbh there's way more important things that could be added
e.g. soooo many NMS stuff could be tunred into API
for example mobs, holograms, ...
unfortunately I don't have any knowledge yet about how to contribute to spigot ๐
You could always make feature requests
yeah sure but I'm pretty sure someone else already did them
tbh
spigot's JIRA totally sucks
IMHO
it's just sooo confusing
maybe it's just me
hey so question about packets- is it better to use packets or should I just stick to using the methods provided?
ie if i want to do some stuff with bossbars, is using packets better in some sort of way, or should I just stick to the methods provided by spigot/bukkit?
Should always use api
aight cool, thanks!
It was just overhauledโฆ
Was it? nice
I only remember seeing the structure API
Hopefully I can touch the edge of a chunk in block populators now :p
what the heckkkk
Surely after writing the next few lines with if (x) and they seem to be the same, it'd be better to code block it off.
hello everyone! does anyone know how i can learn to make this planet generation with noise? this was made with the plugin SkNoise which is an addon of the plugin Skript and they're both made with java, so i do know it is possible i do not know how to achieve this. if anyone knows a very simple way to learn this without requiring a lot of maths that would be great! thank you!
How can i cache a file?
what sort of file?
An image
You can definitely make it in java, but youโre gonna have to learn a lot about noise gen
And noise gen makes my thinking box hurt
So i should load it on startup?
depends what your usecase is
me can do noise in sknoise, me no know maths tho
its going to be some pretty complicated maths, especially a 3d sphere with noise
you can probably find a few resources on mapping noise to a sphere (with polys), problem is putting that into minecraft
Iโd offer you the noise write up Iโve read but I donโt know where it is
For rendering a map
It worked when I moved it to C:/BuildTools ๐
Where were you running it
What do you mean?
is there an easier way to getting user input without command executor than just making a message listener?
guys when i use worldcreator.createworld the world appears completely transparent
on everyone's client side
i can't delete the world and restart because its for a minigamer
minigame
and it deletes and regens every round
why is it doing this
Are the chunks loaded?
Yea probably then :D
how do i force load chunks?
World#getChunk().forlceload() or something
do i have to do that for all chunks
There was a forlceload method iirc
I dunno try loading them in a normal way
Are there even blocks? ๐ณ
ye
Just getChunk will already load it
wasnt this just a 1.8 thing?
No
At least as far as I know it isnโt
Granted chunk does have is loaded methods and such so maybe Iโm wrong
public class EnchantmentWrapper extends Enchantment {
private final String name;
private final int maxLevel;
public EnchantmentWrapper(String key, String name, int level) {
super(NamespacedKey.minecraft(key));
this.name = name;
this.maxLevel = level;
}
@Override
public String getName() {
return name;
}
@Override
public int getMaxLevel() {
return maxLevel;
}
@Override
public int getStartLevel() {
return 1;
}
@Override
public EnchantmentTarget getItemTarget() {
return EnchantmentTarget.BREAKABLE;
}
@Override
public boolean isTreasure() {
return false;
}
@Override
public boolean isCursed() {
return false;
}
@Override
public boolean conflictsWith(Enchantment other) {
return false;
}
@Override
public boolean canEnchantItem(ItemStack item) {
return true;
}
}
i have this enchantment wrapper and from this i created a custom enchant
NamespacedKey key = NamespacedKey.minecraft("experience_book");
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta esm = (EnchantmentStorageMeta) book.getItemMeta();
assert esm != null;
esm.addStoredEnchant(CustomEnchants.EXPERIENCE, 1, false);
List<String> lore = new ArrayList<>();
lore.add(ChatColor.GREEN + "Experience I");
esm.setLore(lore);
book.setItemMeta(esm);
ShapedRecipe recipe = new ShapedRecipe(key, book);
recipe.shape("PP", "PL"); // sus
recipe.setIngredient('P', Material.PAPER);
recipe.setIngredient('L', Material.LAPIS_BLOCK);
return recipe;
```and i have this for a recipe to craft the enchanted book
but when i try to combine the books in an anvil it doesnt let me combine them anyone know how i can fix this?
Heh...
Override the entire anvil system
Or just manually combine them
Custom enchantments made this way are not properly handled by the game
Anvils wonโt combine them, they wonโt automatically work in the enchantment table, etc
wdym manually combine
should i use the preanvilevent
Slot 0 is the left item
is slot 2 the result?
im assuming i have to edit that one because i dont see a setREsult functions
there is a guide on slots iirc
The event had a setResult
oh wait nvm i was looking at the anvil inventory
Guys how could I create a stronger potion? I'm struggling to do it XD, idk which class I must use to do that.
like a potion that can give you more than one effect and with higher levels
should I use the PotionEffect class?
or the PotionEffectType class?
also, how could I add this effect to an item?
for example whenever a player holds a specific item he gets some potion effects
oh
ok, ty
public PotionEffect(@NotNull
PotionEffectType type,
int duration,
int amplifier)
the amplifier parameter refers to the potion level, right?
yes...
sorry for the dumb questions, I've just started coding mc plugins
Also itโs 0 indexed
ok tks
hey so i have this config file like this
and i want to add a new parameter boolean to each uuid
3e8eac9d-c886-47a1-937c-5f0dfdf6114b: iamTheBest```
what's best way to do it ?
i thought about creating multiple .yml files for each one or formatting 1 into something like this :
3e8eac9d-c886-47a1-937c-5f0dfdf6114b:
isNicked : true
Nick : iamThebest
but both wouldnt work (the multpile .yml files would work but idk if its the best way to do it )
if these are nicks for players when they chat it would be simpler to store in the pdc rather than a file.
but i want to keep it for each player
like when someone wants to nick and use the same nick that a player already "owns" they wouldnt be able to
- idk what pdc is
3e8eac9d-c886-47a1-937c-5f0dfdf6114b: iamTheBest
isNicked:
-3e8eac9d-c886-47a1-937c-5f0dfdf6114b
``` will this be a good idea to store them ?
pdc is PersistentDataContainer iirc
why
you need to do a lookup
much quicker
ok i will try
if this is only for online players, store their nick in their pdc, then when they join add their nick and they uuid to a BiMap
@resource staff https://www.spigotmc.org/resources/citizens2.98004/
|| @vagrant stratus ||
i can put uuid here right ?
...?
will it work ?
did you report it on teh site?
what work...?
like will it remove the uuid from the list ?
yes
i tried it and it gave me error
index out of bounds? or waht
at online.shakiz.BwCore.Commands.Nick.onCommand(Nick.java:33) ~[?:?]
java.lang.ArrayIndexOutOfBoundsException: 0
yes
wouldnt a regular Map suffice?
If you use a BiMap you can insert teh players real name and nick, then do reverse lookups
hmm
allowing for very simple tab complete
BiMap<String, String> nicks = HashBiMap.create();
๐
tf is a BiMap
a dual Hashmap backed Map
nicks.get(playerName) = nick
nicks.inverse().get(nick) = playerName
I am extremely clueless when it comes to maven. If I am trying to change the path where the remapped jars (using md's maven plugin), where do I modify that?
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.17-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.17-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>```
hey is it possible to get a player who's displayname have been changed 's uuid ?
because i tried and it keeps giving me an error
if (usedNicks.contains(args[0] )) {
Player target = Bukkit.getPlayerExact(args[0]);
UUID targetUuid = target.getUniqueId();
String targetOgName = playersList.getConfig().getString(String.valueOf(targetUuid));
sender.sendMessage(prefix + args[0] + "'s original name is " + targetOgName);
}```
error here
``` UUID targetUuid = target.getUniqueId();```
How can i block player movement (WASD/Space) without blocking physics (Falling, Getting moved by water, Knockback, Getting Pushed, ...)
what error is it giving you?
One idea i had: Create an NPC copy of the player, make the player invisible, and make the player ride it.
But then Iโd have to transfer damage etc. to the player.
Sounds like a lot of work.
Any other way to just block any player input?
null
Caused by: java.lang.NullPointerException
at online.shakiz.BwCore.Commands.Nick.onCommand(Nick.java:74) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched.jar:git-PaperSpigot-"4c7641d"]
... 15 more```
is there a Vehicle Steer Event?
so the player is null?
so I guess the " Player target = Bukkit.getPlayerExact(args[0]);" doesnt work. you tried changing up that line a bit? getting a player by name is unreliable at best
yes
i have 2 config files
this ````Nicks:
3e8eac9d-c886-47a1-937c-5f0dfdf6114b: uwu
and this
```3e8eac9d-c886-47a1-937c-5f0dfdf6114b: shakiz
how can i link between them ?
what do you mean "link" and what exactly are you saving in them? the bottom one is the name and the top is the nicks?
the bottom one saves the original name of player
and the top one saves the nick
i use bottom one to reset nick
at least that's what i came up with when trying to make this
you could make it into one config where each UUID has a list attached to it where the first element is always the real name
or make one config where the paths are "Nick.RealName" for the real name and "Nick.Nicknames" for the nicks. that would be doable in one config file
to get the name of the player when you have it saved just getConfig.getString(pathToName)
you could even make an onJoin event where it saves the current name of the player who joined in case they change their name
Hi, if I try to load a crossbow with the CrossbowMeta
CrossbowMeta.addChargedProjectile(new ItemStack(Material.ARROW, 1))
The Crossbow is loaded but the item looks like the unloaded Crossbow and the players are not holding it in front of them
that's what i did
it saves it on the bottom config file
good ๐
and then i use it on any class when i need it
wait... are you trying to get a player by the nick they used? so not even their real name?
yes
that's what am trying to do
i want to get their original name
it worked on the reset
but not on this
this is all the class
well Bukkit.getPlayerExact or what you used wont know the nicknames will it
yes that's what hapenned
you need to get the real name. getting Players by UUID is better tho imo
ohh yeah true
i'll try that
wait but i'll still need to use this ?
Player target = Bukkit.getPlayerExact(args[0]);
you will need some way to get the real name of the player, not the nick. or get the player by UUID
rn youre trying to get a player called "uwu" even tho thats not their name. its the nick
maybe save the used nick inside a config file with a list of uuids which have used that nick? could be bad on a big server or when you use nick a lot...
uhh
so that you can get the player uuid by nickname
this is what am trying to do
is there a way to get the key of a value ?
none come to mind other than traversing the whole config and looking through every value
rip
this is exactly what I was trying to tell you with the new config file which saves the values as keys
maybe you want to make a hashmap like this when starting up the server? go through the entire config and from that create a hashmap which saves values as keys
Store the players nick in their PDC not a config. Grab it when they login and store it in a BiMap against their real name or UUID. You can then lookup from teh BiMap for every player thats logged in and get their real name and nick.
config can be useful if you intend on storing a list of past nicknames
?paste
Using PDC and a BiMap for nicks https://paste.md-5.net/uyiqimuvej.java
when a player sets a nick just call the setNickName method
bump
How can I make an invisible item frame Item?
frame.setInvisible
what specifically
jar will be in project.build.directory
name is governed by remappedArtifactId / remappedArtifactAttached
How do I modify that
same as changing the maven build directory normal
<build>
<outputDirectory></outputDirectory>
So under here?
yes
But that completely erases everything in that folder
and replaces it with the compiled classes files
what are you trying to do
it is unusual to build outside your project dir
copy the jar after the build
Yeah but I am developing in mojang mappings, and I am trying to figure out how to make it work with hot swapping
but since thats a bit too hard, the least I am trying to do is to automatically move the spigot remapped jar to my plugins folder
so how do I make it so the remapped jars go directly to my test server's plugin folder
you can use the <outputDirectory> specialsource option
but again, this is highly unusual because not everyone trying to build your plugin will have the same folder as you
This is only for my convenience
So each time I want to build it, I'll need to do so from the cmd line?
no, put it in the specialsource <configuration> section
similar to whatever you are doing currently with whatever you are currently doing to get maven to put it in the directory you want
outputDirectory
and then for this I am assuming this ye?
yes
what do I change to remapped-spigot
add <outputDirectory> configuration
So like this?
yes
And can I get rid of the <outDir> in this section?
yes
It seems to be working, however I am getting an error which is just listing my path
I dont see a line or anything of the sort, just my path listed in red
Also, I dont think the right jar is being copied over
It seems as though the really obfuscated jar is being moved to my plugins folder
Because when I decompile the jar, this is what i get
Hey md_5, is there a Vehicle Steer Event?
like when you try to make a horse go forward by pressing w while sitting on it
๐ ๐
why i cant get access to the NMS?
the build tools?
u need those two, yeah
but nah
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
</dependency>
ok...
u need that dependency
I already have this i think
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
oh
rigght
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
thats spigot + nms
np
btw, do i need a <scope>provided</scope> for the nms?
didnt put and it works fine, but idk, maybe i should put it?
yes
alright
btw it cant find my version 1.16.5 after reloading maven
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
</dependency>```
is it red?
yea
did you run buildtoos for 1.16.5 ?
i think i ran for 1.16.3
then thats the problem
well yeah probably
So is there a VehicleSteerEvent? noone knows?
like maybe under a different name?
is it vehiclemoveevent? or does that also trigger when it gets moved or moves by itself?
yeah but that doesnt account for physics moving it
xD
gotta set up a packetreader and listen to steer packets then
why the heck is spigot so limited in functionality
so many useful packets but only a handful actually are implemented
Hello ๐
How to set block facing direction (north ,south etc..) ?
is it rlly that hard to implement them all?
i dont get it
its around since 9 years or so, and still so many packets missing
cant use paper, as that wont work on spigot servers
cuz u can only use spigot-plugins on paper servers, but not paper plugins on spigot servers
xD
but not everyone uses paper
i want my plugins to be usable by everyone
so switching doesnt rlly make much sense
unless there is a method to include paper inside my plugin
no
looks like its just PlayerMoveEvent and u check if theyre riding something
as far as saying it doesnt account for physics moving it... maybe try EntityMoveEvent?
nvm EntityMoveEvent seems paper only
there does appear to be a VehicleMoveEvent tho
https://jd.bukkit.org/org/bukkit/event/vehicle/VehicleMoveEvent.html @ember estuary maybe?
pffff not working either
the thing is, does the vehiclemoveevent also trigger when it moves by itself or by physics
cuz i think so
and that would make it equally as useless
then i think just using PlayerMoveEvent is what you need
and check if theyre in a vehicle
nah xD
so what im ultimately trying to do, is make the player unable to do W/A/S/D/Space, but still detect him trying to do it
and still have physics affect him
cant use nms
I have this on pom.xml
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
</dependency>
but it cant get the version...
i also ran Buildtools 1.16.5
Cannot resolve org.spigotmc
1.16.5-R0.1-SNAPSHOT
restarted intellij?
yeah
hmm
did you also specified the repo?
spigotmc-repo ?
also set the scope to provided
this and maybe check if when build in buildtools the .m2 has the created dependency (?
otherwise invalidate caches and build again
yeah
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
i have it
did this
or force install
oh i didnt checked that.
just force install it, invalidate your caches and build again
"how do i force install?"
mvn clean install -U
I dont have .m2
ok
weird
i got to know it can load up version 1.9-R0.1-SNAPSHOT
but my api verison is 1.16.5
Hello I'm using the conversation api, how'd i cancel the chat event of the input of the player that receives the conversation after the textprompt?
@Override
public Prompt acceptInput(ConversationContext context, String input) {
config.set("perks.detonation.power", Integer.parseInt(input));
player.resetTitle();
return Prompt.END_OF_CONVERSATION;
}```
the syntax is messed up in discord...
Thanks
https://prnt.sc/213ijd3 this is what i'm getting, my input is "3". What i want it to do is not display the input
Does the server calculate player movement by physics (falling, getting moved by water, getting pushed or hit), or does the client (and the server only validates it with a few simple checks)?
Hello, I'm new to development and I am trying to get my intellij setup but I can't find the spigot api to download and import
I have gradle and all of it setup
Thereโs a minecraft dev plugin in intelliJ, I use that for convenience
It uses maven
Ohhh alright, does it have support for kotlin?
movement is handled on client and validated on server
i would know, i made some
minecraft gone dumb
same tho, but movement hacks were too high for me
i just made bots doing automated tasks
xD
damage
same tbh, movement is hhh
add velocity
:D
any damage is bad.. could be life or death
some bhops or on ground speed
but entity movement is calulcated by the player right?
ye
so when a horse gets moved by water, and a player rides it
is it then still calculated by the server?
i hope not
i think non-player movement is server?
entity is controlled by player
that would be great
well then why is boat or horse fly a thing?
so there is PacketPlayInSteerVehicle and PacketPlayInVehicleMove
i wonder what the latter is for then
good question, i still dont understand how they work
xD
if purely the server handels it
a mix? that would be confusing as heck
but yeah, as there is an extra PacketPlayInSteerVehicle , it might actually be a mix
Iโm not too sure about that, you can check out more about the plugin here if youโre interested https://plugins.jetbrains.com/plugin/8327-minecraft-development. Hope itโll help
when entity is ridden, player controls it, when not, server controls it? idk
idk xD
what does serverbound mean? That the server sends it? or that he gets it
or just that it exists on the server side
probably that
Serverbound means itโs going to the server
ah ok
so the player sends a steer vehicle packet to the server, and a vehicle move packet to the server
is the vehicle move packet just for head-movement of the player?
or why would he send two things
confusing xD
User input in Conversation
help
Hey, Is there a way to paste a schematic at the center of it? (WorldeditAPI)
I want the schematic to be paste at 0,0 and have equal block length on all sides (so centered on 0,0)
afaik, a schematic uses the player's position as the middle-pos. so just be in the middle of the schematic, and when pasting it, just paste it at 0 0
y but that's all the complexity, players won't make the shematic at the middle
So i need to do it myself
Just divide the length and width by 2 and add that to the paste location
Or subtract, whichever it is
But it just gives me the center of the schematic
that's what you want if you wanna center it
i wanna center it at 0,0
so i just add or substract the center compared to 0,0 and it should do it?
Yes?
Where can I get the spigot 1.18 rc APIs for plugin updating?
buildtools
package index
Thanks!
hey can someone help me i want to make a timer to time me n my friends during a race using command blocks can someone help me
this is spigot plugin development help not cmdblock help
not working wtf...
I cant Import 1.16.5-R0.1-SNAPSHOT verison
And idk why help?
Spigot 1.18 just released
https://hub.spigotmc.org/versions/1.18.json
@vagrant stratus this is link fake
@vagrant stratus it's fake link?
Is it allowed for plugins to call PlayerDeathEvent?
Look at the domain
no
stop trolling
sure
i guess you can do that
well the API docs say this, but I'm not sure what that's exactly supposed to mean:
so I guess it is NOT allowed to call a PlayerDeathEvent plugin-wise
where'd you find that?
google SPigot API
first link^^
it's the overview of the API docs
btw I'm asking, because MMOItems thinks it's a good idea to call a PlayerDeathEvent right after the original event, which of course fucks up all plugins listening to that event
sooo I now have to go through the stacktrace to find out whether the PlayerDeathEvent is real or not
/**
* MMOItems thinks it's a good idea to call a PlayerDeathEvent right after the original PlayerDeathEvent was called.
* This is a very bad idea and there's no way to detect whether a listener gets passed a REAL PlayerDeathEvent,
* or MMOItems' cursed fake PlayerDeathEvent, except by going through the current Thread's Stacktrace... smh
* @param stackTrace StackTrace to check
* @return true when the StackTrace contains MMOItems' classes, otherwise false
*/
public static boolean isFakeDeathEvent(StackTraceElement[] stackTrace) {
for(StackTraceElement element : stackTrace) {
if(element.getClassName().contains("io.lumine.mythic")
|| element.getClassName().contains("net.Indyuce.mmoitems")) {
return true;
}
}
return false;
}
that's really bad xd
depending on how much "right after" right after is, you could probably just see if a player died twice in a tick or smth
that is a really weird call from mmoitems though, are you sure they're doing that?
String playerPrefix = "";
String message = e.getMessage();
if (Utilities.api != null) {
User user = Utilities.api.getPlayerAdapter(Player.class).getUser(e.getPlayer());
if (user.getCachedData().getMetaData().getPrefix() != null) {
playerPrefix = ChatColor.translateAlternateColorCodes('&', user.getCachedData().getMetaData().getPrefix());
}
}
e.setFormat(playerPrefix + e.getPlayer().getDisplayName() + "ยงf: ");
Bukkit.getServer().getPlayer("Frandma").sendMessage(message);
if (e.getPlayer().hasPermission("utilities.colorchat")) {
e.setMessage(ChatColor.translateAlternateColorCodes('&', message));
} else {
e.setMessage(message);```
it doesnt show the message
because you're not setting the message
on the format
?
set the message on the format
how
AsyncPlayerChatEvent#getMessage
k
so, event.setFormat(whatever + message)
I ran build tools for 1.18 and it seems to be missing some stuff? It only has META-INF and org.bukkit.craftbukkit.bootstrap now?
Ran java -jar BuildTools.jar --rev 1.18
I'm getting this error
This is my pom.xml dependencies:
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
</dependency>
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>8.3.0</version>
</dependency>
</dependencies>
I don't really know what is happening
I tried reloading maven and I don't even get any error on IDE
is Xseries shaded within your jar
@sullen marlin what tool did u use to get the MinecraftFont fontData?
You can't tell me u made all 255 chars from scratch
