#help-development
1 messages · Page 1982 of 1
Cancel the crafting events if player isn't the wanted one
Yea but then the could still see that the crafting recipe is a thing
I want no one to be able to see kt
Does anyone know how to pass arguments to a lambda function/bukkit runnable?
public class EventPlayerMove implements Listener {
@EventHandler
public void onMove(PlayerMoveEvent e){
eventPlayerMoveAsync task = new eventPlayerMoveAsync(e);
Bukkit.getScheduler().runTaskAsynchronously(Echo.getInstance(),task);}
class eventPlayerMoveAsync implements Runnable {
PlayerMoveEvent event;
public eventPlayerMoveAsync(PlayerMoveEvent e){this.event = e;}
@Override
public void run(){}
}
}
This is a terrible idea, but if anyone has a better one feel free to tell me
?scheduling
well the reason i am doing it like that up there is so i can pass the event, which isnt something the examples in the tutorial have
What are you planning on doing with the event asynchronously
void on(Object o) {
run(() -> {
doSomethingWith(o);
});
} @smoky oak
If you want to make it scalable
Then perhaps pass a consumer into the runnable lambda (which gets applied to the event instance)
uh well i tried that but it said 'variable already defined in scope'
im missing something here
That issue is pretty self explanatory
I mean why
(It’d probably just yell at you in red fyi)
@smoky oak what are you going to do async with the move event
Because you can’t do anything to the player async
^ it’s also not possible to cancel the event if you’re callbacking it after the event invocation itself
I want to check the player movement async to see if I need to do something to the player, this is to prevent it running once per tick on thread-0. If yes, I want to call a sync task with the server, which should happen in like 1/10000 events
Bukkit api is not possible on another thread atleast most of them
The overhead involved in running something async every tick is probably higher than just checking whatever it is
wait seriously?
What are you doing to be checking
velocity vector mainly
the issue is that there's no simple way of for example checking if a player is jumping
Yeah almost never in principle
Isn’t there that statistic increment event that goes up when they jump?
Or am I crazy
wait there is
Either way, basic velocity checking is fine to do on the main thread
You’re not gonna kill your server with that
Not if he’s only looking for velocity with increasing height
As opposed to falling
well the problem is that i need to do a check if a player is applicable for a specific movement modification.
that results in uh
one hashMap check (with player->uuid parsing), one config check
You shouldn’t be reading from the config at runtime
Load the values into memory at startup
yea im doing that
Checking a hashmap and reading from memory is trivial
I'm using a fileConfiguration object for that
It won’t lag
using a getter for a static variable in the class implementing JavaPlugin feels somehow like it would be faster than calling this:
private FileConfiguration configFromFile(String file, boolean useResources){
File read = new File(dataFolder, file);
if(!read.exists()){
if(useResources){
//saveResource(file, false);
//TODO when publishing return the saveRessource and test it!
return getBakedConfig(file);
}
else{
read.getParentFile().mkdirs();
try {
read.createNewFile();
} catch (IOException e) {
log(Level.WARNING,"Could not create "+file+"! The plugin will use a empty config!");
return new YamlConfiguration();
}
}
}
try {
FileConfiguration ret = new YamlConfiguration();
ret.load(read);
return ret;
} catch (IOException e) {
log(Level.WARNING,"Could not read "+file+"! The plugin will use a empty config!");
return new YamlConfiguration();
} catch (InvalidConfigurationException e) {
log(Level.WARNING,file+" is CORRUPTED! The plugin will use a empty config!");
return new YamlConfiguration();
}
}
ergo manual caching
on a completely different note apparantly strength doesnt exist anymore?
SLOW_DIGGING
That’s mining fatigue
Just how stuff ended up being named over the years
I’m not sure about the actual origins
Not in the context of that enum though really
Saturation could also mean a lot of things
So could Speed
Or Slow
Don't javadocs describe them?
They do
declaration: package: org.bukkit.potion, class: PotionEffectType
what event gets called when a player sets their spawn
PlayerInteractEvent?
i want to be able to cancel them setting their spawn
i doubt it
that wouldnt help either because that would not actually keep their respawnpoint anchored to the old bed
its just slowness
still happens after respawn is set
@smoky oak Make a bed system
and cancel interaction with a bed in the overworld
When they interact with a bed cancel the event
And do your own handling of sleeping
You're probably looking at this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBedEnterEvent.html
declaration: package: org.bukkit.event.player, class: PlayerBedEnterEvent
Or that
ffs no
that doesnt work
Then do what I suggested maybe
aha
Block block = event.getClickedBlock();
if (Tag.BEDS.isTagged(block.getType())) {
Echo.log("Bed cancelled.");
event.setCancelled(true);}```
A PlayerSetBedSpawnEvent needs to be added lol
well that is easy to patch
doing a jump event manually is hell
how do i get the target a hostile entity is attacking/targeting?
EntityTargetEvent?
that works i guess
also i found out that ExplosoinPrime triggers when a creeper explodes, not when it lights up
if a entity with a high resistance effect gets attacked resulting in 0 damage, EntityDamageEvent still triggers right?
How can I get the location of a block 5 blocks in the line of sight of a player?
Still having an error with compiling a plugin against bukkit/spigot. The error is Cannot resolve method 'setNameTagVisibility' in 'Team'
symbol: method setNameTagVisibility(org.bukkit.scoreboard.TeamNameTagVisibility)
location: variable curTeam of type org.bukkit.scoreboard.Team```
seems like you're compiling against a lower spigot-api version than the one you're actually using
How would I go about correcting this? I'm pretty new to the development sector! Many thanks
are you using maven or gradle to build your .jar?
hi, im trying to rotate nms stand im doing it right but i think the packet is wrong, which packet should i send on 1.18
stand.setYBodyRot(entity.getLocation().getYaw());
stand.setYHeadRot(entity.getLocation().getYaw());
stand.setXRot(entity.getLocation().getPitch());
stand.getBukkitEntity().setRotation(entity.getLocation().getYaw(), entity.getLocation().getPitch());
for(Player p : showed){
JeffLib.getNMSHandler().sendPacket(p, new ClientboundSetEntityDataPacket(stand.getId(), stand.getEntityData(), true));
}```
should I extend runtimeexception to create an unchecked exception?
yes, or any subclass of it
bruh you're using my lib
yes, that's what it's for
okay thanks
yes 🙏
did you find the correct packet to rotate the armorstand?
it might be the metadata packet
not sure though
nope i didnt 😢
sorta like an illegal argument exception but more specific
whats the name of that packet 🤔
oh yeah alright, then just extend IllegalArgumentExc
alright
for values only important in one class which dont need to be permanent, is a static hashmap in that class the best option?
depends on further context
uuid -> long (for a cooldown)
how to get a Block's namespaced key
Block#getType#getKey
ty
NamespacedKey block = e.getBlock().getType().getKey();
if(block.contains("sponge")) {
Player player = e.getPlayer();
e.setCancelled(true);
}```
why is contains in red/
cannot resolve method contains in Namespacedkey
why dont you just e.getblock.gettype == Material.Sponge?
is anyone here bored and has knowldedge about JDA / discord+java? I'm currently writing a tiny trivia / quiz bot and would love people to contribute 😛
it's very simple right now but already working
Any specific feature you want to add
statistics
saved into a yaml file
erm
mysql db I mean
or for example, getting categories from some trivia API
e.g. "?trivia General Knowledge´ and then it'd query the API to get questions
Sounds like an interessting project but I won't be home for a week
:<
my bot currently just uses yaml files, it works fine, but if someone actually has access to the yaml files they will know all answers
so I want it to work with random quiz APIs like the one I sent
maybe a simple "import" command would be enough
like
?trivia import <category_name> <link_to_api> and then it downloads 1000 questions and puts them in its own DB
or sth like that
because the current #bot-commands bot sucks. I already know 50% of the questions by heart in some categories
Nerd
How can I change the pose of an EntityPlayer in 1.18?
if you'd be using mojang mappings (which you DEFINITELY SHOULD), there would be no EntityPlayer in 1.17+
how are you making npcs?
is there a reason why you don't use mojang mappings?
it'll make your life so much easier
I don't know how they are working
I have some methods to spawn NPCs but nothing about changing their poses
oh okay
Is it possible to move yaml key entries to the top of the file?
When your do FileConfiguration#set, the entries automatically get added to the bottom of the file. I want them to go to the top of the file.
NOT POSSIBLE using the builtin yaml stuff
Unlucky 😢
well technically that's what I've done but I can't add the <plugin> part because it doesn't find the artifactID and the version
?paste your pom.xml please
we'll get it working
Have you run BuildTools
looks good. did you run buildtools for 1.18.1 using --remapped option?
yes
yes
oh I see
you don't have the spigot repo
in your pom
add the regular spigot repo
oh
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
lmao
No need for it?
Anyways I see that you depend on 1.18.1 but the remapper uses 1.18
Ah yeah
oh yeah, you copied my code from my blog which is still made for 1.18.0
0/10 blog
of course you have to switch from "1.18-R0.1" to "1.18.1-R0.1" @vague swallow
it clearly tells you to use the proper version 😛
still not working for some reason
did you click the "maven reload" button?
yes
?paste your pom.xml again pls
that works fine for me
if you just run "mvn compile", does it throw errors? if so, which ones?
"Cannot resolve org.spigotmc
1.18.1-R0.1-SNAPSHOT "
oh yeah
That's the console output
that's because you haven't run buildtools for 1.18.1 --remapped
ooo I forgot the remapped I think
java -jar BuildTools.jar --rev 1.18.1 --remapped
even if you think you've already did that, do it again
if it has finished, in IntelliJ do File -> Invalidate Caches -> Restart
if it still doesn't work, pls show the output of "mvn compile" again pls
alr
I'll be back when it's done
alrighty 🙂
Well
It worked so I don't have errors in the pom.xml anymore
@tender shard
but I got an error in the dependecies now
show the full maven output pls
Hi! How can i add a Map to a persistentDataContainer? For short, I want to add custom enchantments to an item meta, and i want it to have a name (string) and a level (integer). Is there a way to do this in a single set()? I'm also using @tender shard library "MoreDataTypes".
okay so
internally everything stored in the PDC is serialized to a byte[]
in your specific case, I would not worry about using maps and just use STRING_ARRAY in a format like
ench[0] = "UNBREAKING,1";
ench[1] = "FORTUNE,3";
...
then just use String.split[] and get your values again
ok and then how can i retrieve the level?
okay perfect
tysm
int level = Integer.parseInt(ench[0].split(",")[1]);
oh and nsm is not working anymore
what do you mean "not working"? ALmost everything has DIFFERENT names in remapped
e.g. there is no EntityPlayer anymore
yes
in mojang mappings, e.g. EntityPlayer is called ServerPlayer
oh
yeah you'll have to go through this once
but the advantage is:
if 1.19, or 1.20, or 1.21 gets released - you do not have to change ANYTHING
that's good
you just have to switch all your stuff to use mojang names now, then you're ready for almost all future updates
how can i add an array entry?
and what is about the dependencies error?
this one
do File -> Invalidate Caches -> Restart
but tbh
it seems to work
what's the actual error message?
I see it's underlined in red
but
it also seems to use it correctly
tbh I wouldn't worry about that
sometimes intellij is a bit slow when you do maven changes
if you hover it
does it show any error?
there is no message
just fuck it then, for real
do not worry about it
your pom.xml is totally fine
just try to import some NMS classes somewhere
That is working
but I can't export the plugin because of the error
export???
it just says "not a statement"
do you use maven artifacts to build your jar?
well then you don't have valid code somewhere
I'm using "package"
show a screenshot or paste the code that's "not a statement"
Well I fixed the code errors but now the message is "<identifier> expected"
show code and full error msg pls
<identifier> expected is the full error message
and it's still the dependency error
<identifier> expected, where?
seems like you did some stuff like int = 3
instead of int a = 3
np lol
1 sec, gotta do some photoshopping lol
I need the full error log
one sec
click on "Main [package]" there
then send the FULL error log from maven again pls
no
as in my screenshot
click on the TOP most entry on the left side
so it shows the FULL log
show FOrcePowersListener line 2378
I am like 90% sure that you forgot to insert some "variable name" there
you probably did some stuff like
String = "asd";
instead of sth like
String asd = "asd";
wait
sorry you're right, IntelliJ is so slow
no problem lol
It didn't show me many error messages
but tbh maven exactly told you where the error is 😛
yeah you have to click on the correct item in the hierarchy on the left side
then you would have known that the problem was in ForcepowersListener in line 2378
just remember it for the next time :3 did you get it fixed now?
if so what exactly was the problem?
just an unfinished line XD
yess
is that... Lightmode???????????
stop mocking me for that
that joke gets old quickly lol
I like light mode
it's not that depressing
no it's just... unfamiliar
I've never seen it before
OMG IT WORKED
THANKS SO MUCH
You don't know how much you helped me
@tender shard Thaaaaaaaaaaaaaaaaaaaaaaaaanks
Would it be bad if I build one massive plugin instead of all small ones. Imagine like 100k lines of code
and sorry for wasting your time
And more
if I helped you, you didn't waste my time
how
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
you did, although I still don't know how to change the pose
XD
but thank you
and have a nice day
sorry can't help with that lol
I'm not using NPCs etc
@tender shard Have experience with this?
yes, I have
I worked for germany's largest economy server a few years ago, and
I can tell you that it's totally not a problem to have 300 plugins running on a single server
oh really? Are you german?
Check out the unix philosophy
"Do one thing, and do that one well"
A plugin shouldn't handle
- bans
- chat messages
- voting rewards
- ....
there should be one plugin for each
IMHO
but that's just my opinion
of course you can scram it all into one plugin, but maintaining it might be a pain in the ass
Hmm. What about an RPG. Would it be best to keep it all in one plugin (mobs, quests, items, all listeners, etc) or divide them
JA ICH BIN
In enterprise we tend to have more than one jar that we load during runtime, mostly due to independent redeploymentability
HAHAHA ICH AUCH
english here pls
XD
How would one communicate between plugins?
API
it depends - does it has ANYTHING related together?
well you definitely NOT want to have a separate "listener" plugin lol
you are talkibg about "mobs" and "quests"
Each jar usually exposes a facade of interfaces whose instances are obtainable through the ServiceLoader api that java itself exposes (although in Bukkit ServicesManager might be the favored option)
are those "mob related quests" or do you have "quests" and "custom mobs"?
If I have for example a plugin that handles all damage, and one that does all mobs. I would want to check in the damage plugin if the mob that attacks is my custom mob
your mob plugin could have a public API method like
MobPlugin.getMobType(BukkitEntity entity)
that returns an enum or sth like that
so basically the other plugins can use your mob plugin as dependency
I'll need to learn how that works for sure because I would have no idea on how to start that
well basically all you have to do is to add your mob plugin as <dependency> to your other plugins if you're using maven
no idea how it works in gradle
Using maven
and of course add the mob plugin also as depend: in your plugin.yml
But then I would have to use the code in the other plugins code
Which is inevitable if you’re composing a set of jars
(What you still want to aim for is loose coupling and robustness)
erm yeah of course
you use "foreign" jar code anyway
e.g. you do stuff like "Bukkit.getScheduler()" which is also from another .jar
And what about the pom.xml? How would I do that? Repository?
wdym?
imagine you have a plugin called "MyMobPlugin"
you have groupId me.bramla and artifactId MobPlugin
In order to use the other plugins code, I would have to put something regarding that plugin in the pom right?
Yes
then you do maven install on that plugin
in the other plugin, you add as dependency
<groupId>me.bramla</groupId>
<artifactId>MobPlugin</artifactId>
You need to declare your other plugins’ code to your compile-time classpath/dependencies
don't wanna be mean but if you don't understand this yet, maybe you should do some more simple stuff first
Usually a single plugin scales relatively well, if it’s merely for a simple spigot server
I was thinking of learning along the way really 😬
I mean, I have large ideas that are too hard for me to do as of rn for sure, but I would start with the small things and learn along the way.
well as a rule of thumbs, one could say:
If your plugin(s) only work together, you can scram it into one .jar file
if however they also should work with 1-2 features missing, make every feature a single plugin
as said, a ban plugin doesn't need to manage chat formatting
so that's 2 different .jars
but e.g. a quest plugin and a custom mob plugin are 2 entirely different things
even if the quests involve your custom mobs
but you probably want to be able to have custom mobs even if you don't want them to be involved in quests
I see
Anyone know a library that sends plugin messages without need of bungee or anything just sending it to client thats all
Yeah could use redis
no but you could just use redis or sth like that
but a library for that? I don't know any
🤣 redis cant be used
But it opens a server socket so it requires a port
why not?
I just want the client to receive the message
@tender shard uhm do you know what BlockPosition is now?
Why would i connect the client to redis
the client? I thought you wanted to do bungee<>server or server<>server messaging?
Well then just send a packet to the client?
I mean you already have a connection to the player
Im not dealing with nms
erm
let me check
Ive seen a library before
Well it’s not nms
I just forgot its name
It’s netty
what do you need it for
Getting the connection is part of nms
Necessarily not
@vestal moat what are you trying to do exactly?
it's probably easier if you just tell what you need to do
well then use plugin message channels between server<>client, as conclure said
The position of a block
yeah but where do you need it
Blue Tree look at what for instance Choco did with VeinMiner
I want to set the Entity position to the block position
It’s a good example when you want custom communication between client and server
Isn't it just "BlockPos"?
net.minecraft.core.BlockPos
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
thanks
which packet should i send for the map on a packet itemframe 🤔 cause if i dont send the map packet it doesn't show the map but puts the item on the frame
sorry I didn't understand anything
https://paste.md-5.net/laserosomu.cs @tender shard what does this mean?
show ItemBuilder line 178
"using" is null
I guess
oh wait
it's not null
but all it's "members" are null
do not create an array of length 1000
only create an array of the length that you actually use
you can't just save a string array like
"unbreaking,3",
null,
null,
null,
all the array members must actually have "content"
none of it must be null
oh
Is it actually a good idea to copy his classes
whose classes
Veinminer plugin message related ones
I never did netty before i have low understanding of it
you should never copy/paste stuff unless you exactly know what every single line of code does
but how do i know what value to use when i create the array?
He put javadocs
Lmao
There is a different between being able to make one and understanding it
use a List<String> and turn it into an array when you need it
where can I check that?
nowhere
you're on your own when doing NMS stuff
there's a reason why bukkit=bukkit and nms=not bukkit
there is no API for NMS stuff. you have to dig through the class names etc yourself
So do you know what a DataWatcher is now?
like this?
yes that looks good
getEntityData() on an entity
yes that's fine
I know but it's correct
if you have stuff like "toArray()" it wants you to just pass an empty array object
it works!
and how can I set a DataWatcherRegistry then?
I don't even know that that is, I never did any custom entities
what does the DataWatcherRegistry do?
show ItemBuilder line 91
you cannot remove things from a collection while iterating over it
you should use an iterator instead
okay example:
for(Strnig l : lore) {
lore.remove();
}
NOT ALLOWED
but the following is fine:
Iterator<String> it = lore.iterator();
while(it.hasNext()) {
String next = it.next();
next.remove();
}
like this?
better to pass an array with the same size as the list to avoid an additional array being made.
no it wouldn't work
that's the same
either use an iterator, or create another list<string> to save the lines you wanna remove, or actually CLONE the list instead of just creating a new variable for it
you gotta understand this:
List a = new List();
List b = a;
// If you now remove something from b, it also gets removed from a - because they are the SAME object - you just have two variables for it
how can i render a map on a packet itemframe 🤔 which packet should i send to player 😢 on 1.18
just use an iterator like I sent in the last example
?
no no no
Iterator<String> it = lore.iterator();
while(it.hasNext()) {
String line = it.next();
if(line.contains("§9") it.remove();
}
@midnight shore
print out what's happening
?
looks like you never "reset" the "hasInteracted" variable or the "crtype" variable
to convert it to a List?
?
i'm returning a List, so how can i return a list? 😅 sorry for my baaad english
obviously you wanna return lore
oh
can't hurt to do so
is it the same problem as before?
what am I doing there?
i have an array and i get it as a list
then i remove an entry
whats wrong?
Why are you talking to my like that?
do you think i'm stupid or what?
but gets its already an array
the ArrayList returned by Arrays.asList does not support the remove operation.
asList is immutable
What are you trying to do exactly? I'm late to the convo
I have an array and I want to remove an entry

List<String> list = new ArrayList(get); gives you an editable List
then list.removeIf(...
pretty sure List has a removeIf
If I'm reading the docs correctly, when it recalculates the damage with the modifiers it's scales to make sure that any multiplier is preserved.
Does IntelliJ have something that is similar to Eclipse External Annotations?
nvm, found it.
I think gradle? I'm using IntelliJ 2019 and compiling with Java 9 (9.0.4)
Why java 9?
Old plugins I have from years ago, just want to compile them to use them on 1.8
It's usually either J8, J11, J16 or J17 these days
Oh yeah, then you have to use J8 (you can use newer, but you need to know what you are doing)
discord spacing isn't kind on my eyes
Majority of them ran on 1.7.10 - 1.8
Minecraft 1.8 is Java 8, same with Minecraft 1.7.10
There are a few forks of paperspigot that support newer java versions, but few people are likely to use those
Everything seems to be compiling just fine with the java version set, it is just the missing library/API that I'm confused by.
what code do you have?
Just a snippet of the area with the problem or the whole thing?
A snippet should suffice, but more is better
erm you should know whether you use gradle/maven
also isn't java 9 dead since like 10 years?
you wish
Yeah, also give us the pom.xml or the build.gradle file, whatever applies @quaint mantle
Anyone with some worldguard expercience?
Isnt this the right way to check if a player can build in a region?
public void onBlockBreak(BlockPlaceEvent e){
Player player = e.getPlayer();
if(!regionContainer.createQuery().testState(BukkitAdapter.adapt(e.getBlockPlaced().getLocation()), getLocalPlayer(player), Flags.BLOCK_PLACE)){
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.RED + "Text"));
}
}```
looks good except for your "e" variable
oh yeah
is EnderPearl damage called with the EntityDamageEvent or the EntityDamabeByEntity event? The first one right?
EntityDamageByEntityEvent extends the first event you mentioned
but erm
does an enderpearl ever cause damage?
when it teleports you
I believe it is, yes
I always thought it was fall damage
So it’s the normal damage event
yeah but
dammit you're right
okay then
how can i get the ender pearl from that damage event
You can’t
Second is correct
what do you need it for?
If you want to stop ender pearl damage, use the teleport event
public class AbilityCreatePearl {
public static void throwPearl(Player player) {
player.launchProjectile(EnderPearl.class);
//FIXME disable damage on teleport with THIS pearl!
}
}
that
ah yeah
just create boolean "disableFallDamage"
as a field in your class
then cancel the next damage event and reset the bool
i can confirm that it infact calls EntityDamageByEntity, and you can get the ender pearl as the damager
oh
okay
The heck
That’s weird
yea it's wack
nice
but it makes a weird kind of sense
Because it definitely is fall damage
also it makes this so much easier
that's weird indeed
uh oh
opposite problem for me now
how do i find out if fall damage isnt caused by an ender pearl
urgh i guess i can work around that
what are you trying to do exactly
sometimes I hate maven
But the files are so much shorter
yeah but
a zip file is also shorter than a txt
but it's definitely not easier to read
Not with that attitude
D:
I find gradle fine to read
yeah sure, gradle is fine
don't wanna start a buildtools war here
both are fine tools
I have two tags one disabling fall damage entirely and one doing the ender pearl stuff
but they're not meant to be applied at once anyways so it's fine
the refactoring is simple too
just move all the code in EntityDamageEvent to EntityDamageByEntityEvent
and add an if to the check of the fall damage disabling tag
Tags to disable certain things sounds neat
(shouldnt a ender pearl cause magic damage now that i think about it)
well I say tags but it's a shady backend that stores two maps, one that does a player -> group and one that does group -> tags
and then i check on damage if the player is in a group that has that tag
and disable it
hello im trying to edit the nbt of an entity with PersistentDataContainer, but every tutorial i've seen only uses PDC to store plugin data
really?
Yes
i thought it was just pdc
is it nms?
Or getHealth
almost all you need is in the spigot api
theres no way to just edit the nbt?
hm ok
🤔
@EventHandler
public void onClick(InventoryClickEvent event)
{
if (event.getClickedInventory() == null || !(event.getClickedInventory().getHolder() instanceof BlockState))
return;
ItemStack item = event.getCurrentItem();
if (item != null)
{
Player p = (Player) event.getWhoClicked();
if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest)
{
SpellType spell = getSpell(item);
if (spell != null)
{
onSpellLearn(p, spell);
event.setCancelled(true);
event.setCurrentItem(new ItemStack(Material.AIR));
p.playSound(p.getLocation(), Sound.NOTE_STICKS, 0.7F, 0);
}
}
if (item.getType() == Material.BLAZE_ROD
&& (event.getClickedInventory().getType() != InventoryType.PLAYER || event.getSlot() > 4))
{
if (onGainWand(p))
{
event.setCancelled(true);
event.setCurrentItem(new ItemStack(Material.AIR));
p.playSound(p.getLocation(), Sound.NOTE_STICKS, 0.7F, 0);
}
}
}
}
Error:(1114, 26) java: cannot find symbol
symbol: method getClickedInventory()
location: variable event of type org.bukkit.event.inventory.InventoryClickEvent
Sorry I was having dinner
Seems legit
And what is your pom.xml and build.gradle?
Is it unusual to not have one?.. I have a .classpath, .project and a DeadLyfe.iml file. This was built so many years ago in Eclipse, back then I knew it like the back of my hand but I returned to development after 7-ish years (I have a family now!) and I forgot everything almost
Yeah, that is your issue
Use either maven or gradle
(you could use other build tools such as ant, but don't)
How would I go about implementing Gradle?
Eclipse uses ant by default
I see, well I am using IntelliJ 2019 now
Huh, so that is ant?
no its not Ant
Possibly, since it was developed in Eclipse
can someone tell me how to access the minecraft server code in a readable manner?
Special source remappy thing
I know that the paperweight-examples let you create a paper fork which in turn let you see the server code
But I think spigot also decompiles nms, so just run bt
hm
well what im trying to do is to view the nms code for respawns but when i hit f4 it just shows the constructors of the event and nothing else
Yeah, then you may want to use the paperweight-example repo and make your own paper fork
spider
Alex should pay us each time we link his blog
Not without decompiling it
lol
?stash is one way, but that isn't nms
didnt even notice you sent it
I was afk trying to setup the jitpack / oraxen dependency
Alternatively, go with some arbitrary outdated fork of bukkit that can still be found somewhere on github
Are your plugins updated yet
Look in the Source folder of BuildTools
:D
NO
L
Mine are luckily
Not using nms is so much nicer
yeah sometimes it's required 😦
ofc it is
@eternal oxide where can i find that?
but it's not always possible
I mean I could make a PR
Did you use bt yet?
ye
But I don't really know the proper way to expose what I need
fun fact
md5 never ever merges PRs
I once did a PR that was accepted
but still he didnt merge it directly
Yeah he closes them and then commits himself
he "accepted" the PR, but didn'T merge it and instead somehow just copy all the stuff
You still get the credit though so meh
yeah very very weird
I dont care about credits
I just added some javadoc comments
I still wonder why he doesnt just click on "merge"
¯_(ツ)_/¯
probably some random tool breaking in the background when the commiter is not md
He has made some small changes to some of mine when merging
erm what even does "facet" mean lmao
are you shitting me?
the 'respawn() in human entity literally is just 'public void respawn(){}'
no
It's an interface
Bukkit is 99% interfaces
Probably to squish and rename your commit
yeah still a bit weird lol
I always get notified "PR denied" lol
when it was actually merged
I think Choco has had some directly merged
Bitbucket probably doesn't have a way to manually set a PR as merged, annoyingly like GitHub
i just want to see the algorythmus determining a player's first spawn position...
do this
that is nms then
thats what im doing right now but what i have found now is only the respawn with anchor or bed
FOR REAL MICROSOFT CAN YOU PLEASE GET YOUR SHIT TOGETHER
no
what happened?
Speaking of ms - I should start migrating my account
Eh, It probably can wait
i think the deadline is sometime early march iirc
11th march
Is there a way in spigot to get the translationkey?
hello ok so im trying to make an entity walk to a location, do i need nms or is there something in the api im not seeing
isnt there a function to set an entity's target?
only 16 blocks range
Thats the dumb spigot for some dumb reason using classes instead of interfaces
and its .attack which i dont like
Not even abstract ones, just classes
I'm slowly growing insane here... how can i search for viable respawn locations?
how do i set the player's tablist name to a custom font symbol
HumanEntity is an interface
Player.Spigot which has the respawn method isnt
Oh wait
Im dumb sorry
Hello! So i am using
java -jar BuildTools.jar --rev 1.18.2 --remapped
And it not generating local m2 repo 1.18.2-R0.2-SNAPSHOT. Suggestions? Or i am making something wrong
All works with versions below
wouldnt it be 1.18.1-R0.1
Yes, you are right
Thank you
I made a little mistake 😅
All works now
the minecraftHash in buildtool's info.json just refers to a sha256 hash of the vanilla jar right
instanceof Projectile
No
instanceof Projectile
Projectile is a type of entity
Materials are for items
A shot arrow is an entity not an item
Projectile is a class
Instanceof checks a variable against a class type
if (event.getDamager() instanceof Projectile)
for (String s : rewardsList) {
arr = s.split(" ");
for(String word : arr) {
if (word.equalsIgnoreCase("player")) {
word = player.getDisplayName();
arr.
}
}
}
How would I now change the word in arr at the same index with the variable word
You can’t use that type of for loop
Ok
Or I guess you could make a separate int variable and increment it
I can do with the regular one, but I wanted to try and use that type
If you need to update the backing collection by index you’re better off using the classic for loop
Alright, thanks
i wanna make a punish gui where you do /punish <player> and it opens a gui with punish details, but idk how to save the player's name for the gui, like for example how do i set the gui's name to the inputed player's name
?jd
Just set the name of the gui to the 0'th argument
yeah but the command class and gui class aren't gonna be the same
all i know in guis is this: https://www.youtube.com/watch?v=dEwv7ay1RCI&t=795s&ab_channel=TechnoVision
Why do you have different classes for those?
I don't think you can do these 2, but you don't need to implement InventoryHolder to create a GUI
^^^
You can just create a new Inventory instance or object
you can only extend one class but you can implement inf classes
The damaging entity cannot simultaneously be a projectile and a player
Instanceof
If it’s a player then you’re good to go, if it’s a projectile then you have to check the shooter of the projectile to see if that was a player
It’s not guaranteed to be
So that will error when it isn’t a player
@quaint mantle you can’t assume it’s a player
You never check
Also again, it can’t be both a player and a projectile
It can only be one or the other
I would not implement the InventoryHolder and just the CommandExecutor. Then create a new Inventory in that class.
So you can’t make it a player and then check to see if it’s a projectile
alr i'll try that
You can’t nest the instanceof player check inside the projectile check
But otherwise yes
It can’t be a player if it’s a projectile
Like I said
No
It can’t be both
im trying to learn how da hell presistentdataholders work, but i cant seem to understand namespacedkeys?
Separate if statements that aren’t nested
But
In your case
You just want to stop the player shooting themself
so you never need to worry if the damager is a player
You do however need to make sure e.getEntity() is a player
And whether the shooter of the Projectile is a player
Wasn't sure, thank you for clarifying.
EntityDamageByEntity is called every time any entity is damaged by any other entity
what's an abstract class
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
You need to check that event.getEntity() IS a player before you cast it
You can have instanceof inside instanceof

As long as they aren’t conflicting instanceof
oh
it will work fine
No
how do i make a function where it changes a hex code to have a & behind every letter
talking about NFT into minecraft how i can do?
You can’t do Player p = (Player) getEntity() before you’ve checked to see that it is a player
and if you use a boolean, use the primitive type. no need to use the wrapper
i mean like FFFFFF » &x&F&F&F&F&F&F
A good variable name should basically convey enough meaning to tell someone looking at it what it’s for without reading the rest of your code
Player thePlayerInsideMinecraftThatJustShotHimselfWithABowProbablyToBoostHimself = (Player) e.getEntity(); 😉
alright you win
great but its a bit short
Can my main have a constructor? I'd like to be able to access those variables statically
yeah
ye
as long as it doesnt require parameters
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I'll have to make singletons
yeah either make it a singleton, make them static or use dependency injection
ellllo coders & not coders
I have an idea for a rest api, its a plugin cum api, so the plugin is used for data gathering and stuff and then the rest api can be accessed to use that data outside of the server, do u think its a good idea or if anyone has done it already?
lmao did you look at it
uh
read what you sent again
oof
can't make static as they require a plugin instance
and dependency injection in this instance seems quite inconvenient
So do u think making a plugin which has a REST API, (the API is used outside of the server) so the server data like player data can be accessed outside of the server
🧻
perfect
you are an 10+ year developer how the fk abstract class should be used? 😄
did- did- you just stalk the heck out of me?
oh yea
why does no one spe;llll it right here
gitpapyhub best website
memes?
do you really have default pic in github?
les goo
my github is full of random projects

i study this sht at school 😄
its really bad
i study arduino too
Yes but there are some differences that will get you
its cool but i dont understand nothing
😄
easy to code
but not the component
to die*
good
im still wating to learn java at school
sherlock ??
damn bro i thought you dead
they gonna teach me how to ctrl + c and ctrl + v
that crazy bro!
Teach yourself Java
They teach you more than some of the people who ask questions in here know
how to use abstract classes???
Source: have taught intro Java courses
i dont get it
tbh in my school if you do something crazy like use a if youre a dev
so if you use lambda youre a professor?
Are you talking about high school or university
thanks i love you for that suggest!
i dont know how ???
lel
Yes more importantly learn how to use Google
high school
googled
:D
java? whats that? a drink?
That still does not do what you want, no
whats this string you all speak of? i dont sew



