#help-development
1 messages ยท Page 2255 of 1
new TextComponent(" ");
yeah that
how would you send event.getEntity() to console?
just accept.addExtra(spacesComponent) right?
Is it possible to retrieve getFireTick() value of a Player in EntityDamageByEntityEvent when hit by a flame bow ? I mean it always return 100, like the flame effect triggers before the actual damage
so i have the event to get the teleport for enderman but how could i get the block its going to teleport on to
its still turn to this ๐
there is getto() but i think thats just cords
Location#getBlock()
Show me your code?
i get it
because you're adding the spaces to the accept component directly
use a component builder
that's probably why
Why not just spigot()#sendMessage(textcomponent + " " + textcomponent)
because impossible
is it?
yes
there is i just said it few messages above
Then use that lol
that seems to get the block above the block the enderman lands on
if (clickedBlock.getType() == STONE_BUTTON) {
event.setCancelled(true);
event.getPlayer().sendMessage("You clicked a stone button!");
How do I put a cooldown on how fast some things can be activated?
Say I want to cancel every stone button press, but I want to make it so I can only send the player the message once a second or less?
Location#subtract then
store the last click time millis in a map and check if it's 1 second
runescape is the best game
what is a map and how do I store things in a map
its like a dictionary, you use some kind of object to point to some kind of other object
for example you can use strings to return stored object
instead of looping through entire array or list and comparing it till you find one
for example: map.get(Player's uuid) can return Player object
but it can return things entirely different than that. the choice is yours what to store there
// Creating a map using the HashMap implementation
Map<Player, Long> cooldowns = new HashMap<>();
// run this when player clicks your button
cooldowns.put(player, System.currentTimeMillis());
// check if it's 1 second
if ((System.currentTimeMillis() - cooldowns.get(player)) > TimeUnit.SECONDS.toMillis(1)) {
// run your super cool code, don't forget cooldowns.remove(player)
}
this should be somehow correct
but i suggest look up how maps work
they are big and extremely useful
tysm
so don't just use code without trying to understand it
yeah Im literally searching on youtube rn Im confujsed as hell
example:
Map<UUID, SkyIsland> islands = new HashMap<>();
map.put(player.getUniqueId(), new SkyIsland(x, y, z)); // Store your island with a key as a player's UUID
how could i teleport a specific player to cords?
Player#teleport(Location)
you need to make a location object or get it from somewhere
and somewhere else:
SkyIsland island = map.get(player.getUniqueId());
would return you that SkyIsland object by you specifying the key (in this case player's UUID)
nobody ? :(
what if you measure the time it takes for player to cool off in seconds
and then multiple it by 20
also @mortal hare i did find a way to remove arrows in body, in EntityDamageEvent
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), () -> ((Player)event.getEntity()).setArrowsInBody(0),1);
you'll get an rough average
oh yeah
arrows inside player are not really entities
that's why it didnt work
Is that a method in Player class ?
no
i mean physically measure the time
๐
how much time does it take for fire to cool off
and then multiply it by 20
to get it in ticks
then you'll get an rough estimate
i bet you can do this more clean by using NMS but bukkit api shouldnt always return 100 when player is ignited wtf
Oh yeah but i think it won't work for what i'm trying to do, I want to increase the damage of Arrow by 20% if the target is on fire
So all operations must be done in the event
It works with the sword tho
yeah it doesn't make any sense, since with a fire aspect sword I can retrieve the fireTick value properly
But with a flame bow it always return 100
Player.teleport(event.getTo()); like this?
yes, but you need to use the player variable that you got from the event or somewhere
The Player has to be predefined else where before teleporting other wise it wont know who the player is
CraftBlock{pos=BlockPosition{x=-18, y=-64, z=36},type=DEEPSLATE_TILE_SLAB,data=Block{minecraft:deepslate_tile_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@70b31415} how do i get the type=bottom?
BlockFace?
yeah i think
How can I check if a sign is placed around a chest?
applyPatches.sh (line 3): Unsupported use of '='. In fish, please use 'set PS1 "$"'.
warning: Error while reading file applyPatches.sh
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [/usr/bin/fish, applyPatches.sh]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:973)
at org.spigotmc.builder.Builder.runProcess(Builder.java:904)
at org.spigotmc.builder.Builder.main(Builder.java:703)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Trying to compile 1.8.8 using buildtools, but I get this error?
Im using fish as shell
but when I use the command set PS1 "$", I get an error:
fish: Expected a variable name after this $.
set PS1 "$"
^
Fixed it by adding SHELL=/bin/bash before the command
Around or against?
Add null as clickevent and hoverevent
a wolf gettingg left clicked by a player would just be the EntityDamageByEntity event right?
anyone here have experience with implementing the Firebase API into their plugin? I got it all working with sending and retrieving data including POJOs, but when I try to implement a SpigotAPI Location type variable into the POJO it gives me an error. Any way to make it so I can store POJOs with custom types and have them be retrievable? Do I have to cast it to a string on storage somehow then recast it back on retrieval or is there a better way?
pretty sure as long as the wolf is getting damaged yea
if the wolf is hit it would be EntityDamageByEntityEvent i think
but im pretty sure PlayerInteractAtEntityEvent is fired too, so could use that as well
Storing Custom Variable POJOs in Firebase
CraftBlock{pos=BlockPosition{x=-18, y=-64, z=36},type=DEEPSLATE_TILE_SLAB,data=Block{minecraft:deepslate_tile_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@70b31415} how do i get the type=bottom?
just in the radius of 1 block, rotation is irrelevant
Get the block data and cast it to Slab
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/type/Slab.html
Slab slab = (Slab) block.getBlockData();
How do I create a Runnable that receives a variable?
So far I just declared it inside a method, is it the right way to do that?
public void onVillager(VillagerCareerChangeEvent event) {
for (MerchantRecipe rec : event.getEntity().getRecipes()) {
rec.setPriceMultiplier(2);
if (rec.getResult().getType() == Material.ENCHANTED_BOOK) {
rec.setMaxUses(1);
}
}
event.setCancelled(event.getProfession() == Villager.Profession.FLETCHER || event.getProfession() == Villager.Profession.ARMORER);
}
@EventHandler
public void onVillagerReplenish(VillagerReplenishTradeEvent event) {
event.getRecipe().setPriceMultiplier(2);
}```
no errors, but it doesnt work at all p.p
you registered the events in your main class?
yep
could you paste that here too
getServer().getPluginManager().registerEvents(new VillagerFix(), this);
i found the issue
event.getEntity().getRecipes()
returns nothing
Because this event is fired before the profession is changed.
Oki can I ask one last thing, what is special price?
javadocs arent really helpful
What is it asking for?
merchantrecipe
My bet is it's the price besides emeralds that's required
Such as the book for enchantment trades + whatever emerald value
if the player has the Hero of the Village effect they usually get a discounted price. could it be that?
could be the secondary trade item too tho
im pretty sure that chnges the priceMultiplier
Thatโs called a Consumer
No input/output -> Runnable
1 Input/no output -> Consumer
no input/1 output -> Supplier
1 input/1 output -> Function
2 inputs/no output -> BiConsumer
2 inputs/1 output -> BiFunction
Correct me if Iโm wrong
There are some specifics like Predicate iirc
1 output for bifunction kekw
there's nothing with 2 outputs lmao
Yeah XD
hehe tuples
I honestly haven't seen a public plugin use tuples any often
hmm i broke my project.. again...
i guess it cant see the pom
its in the right location no?
Oh I didn't know that, thanks !
Yea it is
uhh it said that dependency reduced pom file wasnt a project file
and i clicked edit anyway and it looks like it worked
When biomes become abstract, will I be able to define grass color, sky color, etc for specific biomes?
Presumably yup
What about changing them on the fly?
@EventHandler
public static void detectButtonPress(PlayerInteractEvent event) {
Block clickedBlock = event.getClickedBlock();
Player p = event.getPlayer();
Map<Player, Long> cooldown = new HashMap<>();
if (clickedBlock.getType() == STONE_BUTTON) {
event.setCancelled(true);
if((cooldown.get(p) + 5) >= (System.currentTimeMillis() / 1000)){
p.sendMessage("you have pressed a stone button!");
cooldown.remove(p);
}
cooldown.put(p, (System.currentTimeMillis() / 1000));
}
}
This sends me a huge error log but primarily:
at java.base/java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because the return value of "java.util.Map.get(Object)" is null
at LadsActionButton.EventListener.detectButtonPress(EventListener.java:28) ~[?:?]
Line 28 is "if((cooldown.get(p) + 5) >= (System.currentTimeMillis() / 1000)){"
clicked block might be null too
and that error says that the entry isnt present in the map
clicked block?
I tested earlier with sending a message to player, but I want it to have a cooldown of a second so you cant spam the button
You really should either use a weak hash map with Player or use UUID
Donโt just use Player alone with normal map because of the player disconnects the Player object is invalidated
How can I display a permanent title to a player?
Create a repeating task that sets the title for the player for a long duration
What's the maximum amount of ticks that I can set a title for?
The stay variable is an int though
while user.isOnline() ๐ข
and Integer.MAX_VALUE doesn't work
its a long
ah for the title i thought you were talkinb bout scheduler methods
that method doesnt say
but Integer.MAX_VALUE doesn't work
Hmm
Is there a way to have persistent custom data for mobs?
?pdc
Oh, I thought that's items only, thanks
declaration: package: org.bukkit.persistence, interface: PersistentDataHolder
Anything that implements PersistentDataHolder
livingentities have them right
smh wrong interface conclure
Woops
how do i do a if not then return thing?
yes i set it for stay
anyone knows if i have to write "${heap_size}" myself cuz i cant see it defined anywhere?
https://gist.github.com/Prof-Bloodstone/6367eb4016eaf9d1646a88772cdbbac5
in the start.sh file
shell noob basically :(
?
if (event.getEntity().toString() != "CraftEnderman") {return} idk something like that @paper viper
Oh god
those paper fuckers where laughing at me for running a server on a pi ๐ญ
Please donโt do that
<:
Get the entity type instead and check off of that
well uhh is this valid syntax then?
readonly java_args=(
-Xms3G # Set heap min size
-Xmx4G # Set heap max size
)```
weird stuff anyways
Hi, is it poseble for me to desable commands in config and remove the command? tag me
Like any command?
I suppose you could remove from command map
ok start with can i desable a command in config like not working? and how?
Yeah itโs definitely possible
and what do i need to do?
If thatโs what you mean
ok
is it normal for getPlayer().getInventory().getContents()) to only return the items in players hotbar? and not all 36 slots?
ArrayList<FallingBlock> blocks = fallingBlocks.get(name);
for (FallingBlock block : blocks) {
Location blockLocation = block.getLocation();
Vector onePercent = loc.subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(blockLocation.add(onePercent));
iterations++;
if (iterations >= time) {
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}``` i have a 3x3 platform of fallingblocks that just stay there so i can move them but with this the 3x3 platform squishes into 1 block and then moves how can i make it so they all move together and dont just squish together
I already answered you on the forum
yeah i responded cuz i was confused someone was helping me but they had to go to sleep
Is the EntityTargetEvent also fired if the target reason is "LoveMode"?
uh ohh
You need to pass a vector and let all blocks move in that direction.
You are currently passing one location and all blocks just fly towards the same location. No wonder they end up in the same location...
i would assume they would be different since im adding a vector that depends on the locaiton of each block
also if i switched to velocity id basically need to redo everything
This is what you are doing.
The direction of each block is different but the target is the same.
For anyone interested in the solution for my question earlier
The reason I couldn't set the max Integer value to the title time was that the game probably counts the fade in and fade out time as well so I needed to remove that from the stay time:
p.sendTitle(title,subtitle,10,Integer.MAX_VALUE-20,10);
Anyone wants to recommend me a good hosting service which can run 40+ players and 60+ plugins on 20 tps? and it should also be relatively cheap like 2$ per gb
I use pebblehost for my test server
I don't know if they are good on the larger scale but they are cheap for what I ordered
Don't ask in multiple channels
If you want a root server: Hetzner. 40$ for 64Gb of Ram, Ryzen 5 3600 and an NVMe SSD.
Pretty much the best hardware you can get for a minecraft server. Very fast SSD and very good single core perfrormance.
tf
Hey,
Is there a way to manipulate which entity is chosen when in LoveMode?
i used aternos before which is a free hosting and it runs 40+ players and 35 plugins on 15 tps lmao
and as far as i know ram isnt really important
I know about the EntityBreedEvent, but that's not the selection
cpu is
You can run one server per core. I would recommend not going over 8 servers with 100 players each.
when i tried using vectors the blocks went flying the opposite direction, no where near my location block.setVelocity(blockLocation.toVector().add(onePercent));
I've never seen a mc server running well on one core ๐ค
A minecraft server only runs on one core...
Did I stutter?
Ignoring IO and and some chunk stuff
-.-
Ram can be a bottleneck. Especially if you use public plugins.
For some reason when I set a high value in the stay variable in player.sendTitle it doesn't slowly fades in or out it just waits for the time I set and pops the title immediately, this fixes when I set a smaller value.
I can set a repeating task that will set a smaller value but that seems unnecessary
Any idea as to why is this happening?
2 million should be enough. Thats like 28 hours or so.
What are you even trying to do?
I'm making an AFK plugin so when a player is AFK I send them a title that says it
if youre planning to use a lot of plugins or have a lot of chunks and other data loaded, for example with factions or survival, it is defenitely benifitial to have more ram
I don't think it's enough for an AFK plugin
just keep sending it
Then times 10.
20 mil = 11 days
im gonna use around 40-50 plugins and border is gonna be 10kx10k
Make sure to pre render all chunks within that border
yea ik
if 40+ players are all spread out, thats definitely going to use some ram
but i cant find a good host
how can i do like "/execute if block ~ ~-1 ~ minecraft:obsidian or minecraft:crying_obsidian"?
I dont know any "gaming" host that is not a total rip off.
??
In your logic, just get the block under the current block location and check the material
I guess
so what should i do ? host from my own pc?
i only have 8 gb ram in my pc
Thatโs the best option
with a render distance of 8, 40 players, worst case scenario youre going to be loading 11560 chunks
The next best is probably like a vps or something
oracle free tier pretty good
idk about cpu power but if you pregen the world that should be fine
it has 24 gb of ram
anyone? also i dont really want to use a vector since the blocks just go flying everywhere
hosting a production server on your own pc that does not even run 24/7 is not the best option, but the worst
buy a proper machine
No, I mean like assuming he actually had a server computer. Of course hosting yourself is the best in that case
Turns out the message sent after he said he would use his PC :/
yes, on a server it would be alright
get the offset of each block relative to the center of the platform, and add that offset to the position youre teleporting to
in the case that it's properly managed in his house and wont burn it down lmao
what would be the best way to get the center of the platform
the best thing is just to buy a machine and put it in a datacenter imo
you could use the top left back corner for ease
that would work with even amounts of blocks too
for getting it, store it when created
anything tbh it doesnt need to be centralized at the location
i want to use a host so does anyone know what a good server host is?
i have it stored in an arraylist so id just get the 1st block in the list right?
players can select a region with we then i store the blocks in the selection
you could store the width, height and depth of the whole thing
https://paste.md-5.net/idaqitizem.cpp would this make sense to parse Location from a json
Is it possible to schedule a repeating consumer?
or store another array list with all the offsets and generate them at the start
what would you consume
to answer your question, no
but why
oh, then I will ask another question, in order to schedule a repeating task that recieves a variable I've always just set a runnable inside a method
is that the right way of doing htat?
to pass in variables, you can use
final Object val;
/* some method */ (/* runnable */ () -> {
if (val == null) // do whatever
});
they have to be final
so if they change but they dont need to reflect into the lambda, copy them to a final var
otherwise use an Atomic<Type>, for example AtomicInteger or AtomicReference<T>
Double coordX = Double.parseDouble(array[0]);
Double coordY = Double.parseDouble(array[1]);
Double coordZ = Double.parseDouble(array[2]);
Location hiveLocation = new Location(MobCapturer.world, coordX, coordY, coordZ);```
is this a good way to parse location from json
Like so?
public void methodName (Runnable taskName () -> {
if (val == null) // do whatever
});
in my example i was passing in the runnable, so for example
for (int i = 0; i < l; i++) {
// copy to final var
final int fi = i;
// some schedule method, just an example
schedule(() -> {
System.out.println(fi);
});
}
usually , is used as a separator, as they are tostringed as doubles
so they might contain a .
which would result in smth like
0.0.26.0.5.3
x y z
which the computer cant tell apart
Isn't this just setting the Runnable inside a method?
its passing it as a parameter to the method
its declared using a lambda
JsonObject json = new JsonObject();
String[] array = String.valueOf(json.get(elementName)).split(",");
Double coordinationX = Double.parseDouble(array[0]);
Double coordinationY = Double.parseDouble(array[1]);
Double coordinationZ = Double.parseDouble(array[2]);
Location location = new Location(MobCapturer.world, coordinationX, coordinationY, coordinationZ);
return location;
}```
so something like this?
yeah
okay thanks
i hope JsonObject json = new JsonObject(); is just for example, because thats obviously not going to work
it smells what it needs
ArrayList<FallingBlock> blocks = fallingBlocks.get(name);
for (FallingBlock block : blocks) {
Location blockLocation = block.getLocation();
Vector onePercent = loc.subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
double offsetx = centerLocation.get(name).getX() - blockLocation.getX();
double offsety = centerLocation.get(name).getY() - blockLocation.getY();
double offsetz = centerLocation.get(name).getZ() - blockLocation.getZ();
block.teleport(blockLocation.add(onePercent).add(offsetx, offsety, offsetz));
iterations++;
if (iterations >= time) {
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}``` why doesnt this work? the blocks kinda just scatter in a line in the opposite direction of the location i give ```centerLocation.get(name)``` is the center location of the platform
get the center location and calculate the offset outside of the lambda for performance
public void apply(Bee entity, JsonObject json) {
super.apply(entity, json);
entity.setHive(parseLocationFromJson(json,"hiveLocation"));
entity.setHasNectar(json.get("hasNectar").getAsBoolean());
}
public Location parseLocationFromJson(JsonObject json, String elementName) {
String[] array = String.valueOf(json.get(elementName)).split(",");
Double coordinationX = Double.parseDouble(array[0]);
Double coordinationY = Double.parseDouble(array[1]);
Double coordinationZ = Double.parseDouble(array[2]);
Location location = new Location(MobCapturer.world, coordinationX, coordinationY, coordinationZ);
return location;
}```
this is going to be the usage
idk
but it still doesnt work
yeah im trying to see why not
can u send screenshot
through imgur
or verify rq
of what it does?
!verify
yeah
Usage: !verify <forums username>
the reuslt
ok 1 sec
Okay thanks man
https://imgur.com/a/Yfc2IFS black arrows and circles is what happened red arrow is where the 3x3 grass block platform is supose to move to there are more grass blocks in a line just what my screenshot could fit
you probably have the offset or center calculation wrong
can i see where you create the platform
center calculation uses world edit
File f = new File(XKits.getInstance().getDataFolder().getAbsolutePath() + File.separator + "storage" + File.separator +"platforms.yml");
YamlConfiguration fc = new YamlConfiguration();
try {
fc.load(f);
} catch (IOException | InvalidConfigurationException e) {
throw new RuntimeException(e);
}
ConfigurationSection sec = fc.getConfigurationSection(name);
ArrayList<FallingBlock> stand = new ArrayList<>();
for (String key : sec.getKeys(false)) {
ConfigurationSection sec2 = fc.getConfigurationSection(name + "." + key);
Location loc = sec2.getLocation("location");
FallingBlock fb = loc.getWorld().spawnFallingBlock(loc.add(0.5, 0, 0.5), Bukkit.createBlockData(Material.valueOf(sec2.getString("type").toUpperCase())));
fb.setGravity(false);
fb.setDropItem(false);
fb.setInvulnerable(true);
fb.setTicksLived(2147483647);
stand.add(fb);
}
fallingBlocks.put(name, stand);```
also youre always teleporting to the same block location
wdym
o h
hey guys is possible to get sign text from block data?
no nvm
it changes the instance
so it should work
ooh
dude
you have to add the offset at the start
not inside the loop
wdym
so id ad it right before the for loop?
- before the runnable
yeah
for (FallingBlock block : blocks) {
Location blockLocation = block.getLocation();
double offsetx = centerLocation.get(name).getX() - blockLocation.getX();
double offsety = centerLocation.get(name).getY() - blockLocation.getY();
double offsetz = centerLocation.get(name).getZ() - blockLocation.getZ();
Vector onePercent = loc.subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(blockLocation.add(onePercent).add(offsetx, offsety, offsetz));
iterations++;
if (iterations >= time) {
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}``` the blocks just fly off in every direction now i could only find 1 block so they seem to be going very far away individualy not as a group
The UUID of an entity is persistent, right?
you need to add the offset before calculating onePercent
oh
add it to what
- singletons, why?
- exposing collections
- not following conventions for method names
- you can use early returns
- Material#valueOf throws an exception if the str doesnt match perfectly, use #matchMaterial instead
- probably more stuff
lol
@dim palm
Im depressed now, thanks ๐ฆ
me everyday
cant take critisism lol
i only can if its based
you look silly with that haircut
only 1 block moves but the rest just seemingly dissapear.. do you know whatd be causing that? ``` ArrayList<FallingBlock> blocks = fallingBlocks.get(name);
for (FallingBlock block : blocks) {
double offsetx = centerLocation.get(name).getX() - block.getLocation().getX();
double offsety = centerLocation.get(name).getY() - block.getLocation().getY();
double offsetz = centerLocation.get(name).getZ() - block.getLocation().getZ();
Location blockLocation = block.getLocation().add(offsetx, offsety, offsetz);
Vector onePercent = loc.subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(blockLocation.add(onePercent));
iterations++;
if (iterations >= time) {
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}```
alr
Map<String, List<FallingBlock>> ew
me?
i guess
it works ๐ so :p
if nasas code just worked too they wouldnt have reached the moon
its stored in a file
all the blocks are in the list and the storage file so idk why its doing this
yes i use the data from the file
its only the middle block that moves the rest dissapear
Is it possible to make a certain thingy happen every week, even if the server goes offline for a portion of the week?
It is, but you have to do time calculations.
Make two ItemStack variables. One is your original state. The other your updated state. In your runnable, update the player inventory with the old state once the period is up.
Well, there are a couple ways you could do it. There is the server time which only ticks up as long as the server is online.
There is also the system time and timestamps which you can use.
You'd want to keep track of the time on startup and shutdown.
Then in your system for executing events, you'd take one of those points as your reference point then subtract your current time from it to get the difference. If it's greater than one week, do your stuff. Otherwise, keep waiting.
so for example save the System.TimeCurrentMilis
then every hour or smt
check if it - system.teimcurentmilies is greater than > 7 * 24 * 60 * 60 * 1000?
You may want to convert the timestamp to a date for easier comparisions, but essentially yea.
I mean in startup you start a scheduled executor service where you schedule the task, whenenever the server instance shut downs save the date and on startup read it again and do what I mentioned in the beginning.
is that possible?
You can turn the different time stamps into Instant instances and use the delta method
i see
Yea, there's several ways to convert a timestamp into a usable object.
does system.timeCurrentMilis go up only when the server is online?
i'll google that more
anything you need to know about Time ;)
anyone?
No not really
#currentTimeMillis() is always ticking up as long as your computer is up.
system time
say the program shuts down
but then turns back on
would it still track and go up?
Optional<Cat> irl ๐
and compensate for lost time?
#currentTimeMillis()
Returns difference, measured in milliseconds, between current time and midnight January 1, 1970 UTC(coordinated universal time).
So yes, it will constantly tick up.
I mean it shows accurately all the time
filter(cat -> false)
๐
literally Schroedingers cat. not sure if he used that in his video, havent watched it yet
and calling isPresent() is the same as opening the box
dunno why but im watching vid about java optionals alto i need how to work with it lol
bored ig
I am so sad that video came out a week after I needed it XD
Optional is ehm well good but a bit late, wouldโve been needed since the very start of Java
some older java version added ::ifAbsent attho ::ifPresent is a thing lmao
Ye
they were bored too
lol ye
why doesn't this work?
dead_bush = p.getInventory().getItem(Material.DEAD_BUSH).getAmount();
can someone help with this?
what doesnt work? you get an error? etc
also naming conventions
says "cannot resolve method"
should be deadBush
which method
.getItem needs equipment slot or a number you dont get a material
getItem(org.bukkit.material)
how would i get the amount of a certain item in a players inventory?
idk easiest thing i can think of is looping
I think there is no method
kinda obvious that it doesnt work if there is no such method
how to make tabable subcommands? so that they are there if you press tab?
you know how to use streams?
their should be a faq page here tbh
aaand how to make this multiple times in a row? such as for a command like this: /testcommand taboption1 location playername
no clue, still new
then just loop through it
and have some kind of sum variable
and where does this script explain, how to do multiple tab commands in a row? sry cant find it
tf, no need to sort and you can just return StringUtil.compyPartialMatches
click the link... its that section
that's just different tab options for different perms, not multiple command tabs?
ahhh no, found it thy
sry for asking again :/
int sum = 0;
for (int i : p.getInventory().all(Material.DEAD_BUSH).keySet()) {
sum += i;
}
so that'll add 1 for every one they have?
no that would add the count of the stack
check the length of the args
so for example if you want to use /home create and /home list
it would look like
if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], List.of("create", "list"), new ArrayList<>());
}```
so if you have for example 3 different stacks in your inventory like 32, 5 and 58 Dead Bushes
it will add 32, 5 and then 58 to the sum variable
declaration: package: org.bukkit.util, class: StringUtil
i have this which is supose to move a 3x3 platform to a given location but only 1 of the blocks moves and the rest just dissapear https://pastebin.com/2DpTANXY video: https://drive.google.com/file/d/1TLJSNzh297MCnFOJre7Cjt8TnF4NW2K4/view?usp=sharing why is this happening? the blocks are supose to move together to keep the 3x3 shape over a period of time which the 1 in the video does fine
if i dont want to expose a collection to the outer world but they still need the whole collection, whats the best thing to return?
- new HashMap<>(innerHashMap)
- Collections.unmodifableMap(innerhashMap)
why would you want to do this as a stream anyways?
depends on the circumstances
yea, you shouldnt in this case.
I didnt know that #all returns a HashMap and I hate to use streams for hashmaps
well i just want to iterate over the map and print the entries, thats all i need
Then unmodifable map is the way to go, there is nothing that can go wrong there anyways
new HashMap allocates a shallow clone of the hashmap, which may not be intended
hi can i stopp a command with his? config is false
if(!instance.getConfig().getBoolean("Freeze-Enabled")){
player.sendMessage("StaffChat is not enabled.");
event.setCancelled(true);
Are you not using the command executor api?
yes, i am
Why are u cancelling an event?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
whats the best way to colorize a string without knowing if it contains hex colors and color codes?
whatโs the point of the hashmap here?
just save the durability as an int
also that method will throw an exception in most cases
anyone happen to know if there's an easy way to deserialize an itemstack string?
the deserialize method requires a map
wdym string
I serialized an itemstack, made that a string to store in a config line and am now trying to deserialize the string
how did u serialize
itemStack.serialize()
doesnt the deserialize method come from configurationserializable
yes
I wanted it as a single line
is why I didn't serialize it in the more normal way
u should use base64
because it's a part of a string list
can you show me the string?
- serialized={v=2975, type=ENCHANTED_BOOK, meta=ENCHANTED_META:{meta-type=ENCHANTED,
stored-enchants={PROTECTION_ENVIRONMENTAL=1}}}:amount=1-3:chance=.5
u might have to manually parse it
to deserialize
look at this
yeah that's what I sort of was hoping I wouldn't have to do
serializes items to base 64
a single string
and also deserializes
its for inventories but you can adapt it to ur use case
yeah guess I'll go that way, than ks
Hello, how can i pass the instance to another class if i dont implement listener or somethin?
then use constructor
any example? (im new to java and spigot api)
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
thanks
how could i change player name?
so i was in class and idk why my brain randomly remember this and then i realized the name is a pun on "path"
Pathetic
Lmao, I'm out here giving WorldEdit a run for their money with their startup messages telling you to use paper. At least this is configurable though xD
And people say startup info isn't important. smh
How can we kickstart the zombie villager curing process programatically?
Setting the ConversionPlayer and ConversionTime enough? Or there is another way to achieve this?
i have this which is supose to move a 3x3 platform to a given location but only 1 of the blocks moves and the rest just go off to random places https://pastebin.com/2DpTANXY video: https://drive.google.com/file/d/1TLJSNzh297MCnFOJre7Cjt8TnF4NW2K4/view?usp=sharing why is this happening? the blocks are supose to move together to keep the 3x3 shape over a period of time which the 1 in the video does fine but the rest seem to have a mind of there own and teleport all over the map , since there is a 3x3 square there are 9 blocks so i broadcasted their location each interval and https://pastebin.com/puiFXuuK shows how they are going all over the place for no reason at all since each block has its own variables none are static or used by all the blocks
make sure you're using location.clone before you add if necessary
ive not taken a super deep dive into the code but it seems you may need to do that
location.add will modify the object to hold new x/y/z values forever
sometimes that's not necessary, and you just want a completely new location without mutating the original
Because you can't set hp higher than max health
k ty
^
i just added Location blockLocation = block.getLocation().clone().add(offsetx, offsety, offsetz); same issue
how do i get my command to send the missing permissions error message if the sender is not opped
on second look
i think this is definately what you need to do
How can we kickstart the zombie villager curing process programatically?
CommandSender#sendMessage()
might have done this wrong ``` Location center = fallingBlocks.get(name).get(0).getLocation();
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i);
loc.clone();
double offsetx = center.getX() - block.getLocation().getX();
double offsety = center.getY() - block.getLocation().getY();
double offsetz = center.getZ() - block.getLocation().getZ();
Location blockLocation = block.getLocation().add(offsetx, offsety, offsetz);
Vector onePercent = loc.subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(blockLocation.add(onePercent));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}``` im not sure how .clone() works
because ^ doesnt work same issue
Location#clone() returns an exact copy of the location you want to clone.
Location loc1 = new Location(0, 100, 0);
Location loc2 = loc1.clone();```
loc2 = 0, 100, 0.
yeah what about it
where you have Vector onePercent
im saying use loc.clone.subtract
right now, loc.subtract will mutate the variable
which means on the next loop, loc will be different
thus all the blocks will go in unintended directions
except for the first
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i);
double offsetx = center.getX() - block.getLocation().getX();
double offsety = center.getY() - block.getLocation().getY();
double offsetz = center.getZ() - block.getLocation().getZ();
Location blockLocation = block.getLocation().add(offsetx, offsety, offsetz);
Vector onePercent = loc.clone().subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(blockLocation.add(onePercent));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}``` same issue ๐ข
would blockLocation need to be cloned or smthn?
no i dont think so
also 1 block does as intended but the rest dont
im using plugman but i can restart my server
yea, i would do that to make sure
Where is your loc variable declared?
sorry thought i had that in there 1 sec
Location center = fallingBlocks.get(name).get(0).getLocation();
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i);
double offsetx = center.getX() - block.getLocation().getX();
double offsety = center.getY() - block.getLocation().getY();
double offsetz = center.getZ() - block.getLocation().getZ();
Location blockLocation = block.getLocation().add(offsetx, offsety, offsetz);
Vector onePercent = loc.clone().subtract(blockLocation).toVector().multiply(1d / time);
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(blockLocation.add(onePercent));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}``` loc is the location the platform should be moving to which is defined by the player
parameter of the method
same issue after restart
could it be that all of the runnables of each block are picking up the last block's variables after the for loop?
if i understand you correctly, no
๐
should loc also account for an offset?
I don't think I caught what you were trying to do here. What are you expecting to happen?
the offset is there so it moves like a platform and they dont all teleport to the same location
if you watch the video i have a 3x3 grass platform which i want to move to a new location over a certain period of time
link?
here
the gdrive
as long as they move in the same direction at the same speed, they will all end up in the correct place over time
ive tried vectors as well but they just scatter all over the place and id basically need to redo everything
wdym
your direction vector would be final - initial
and this vector is the same for all of the blocks
i had the same setup but all the blocks flew in different directions
i dont think you're understanding
yeah i understand
but right now its for teleporting id need to do more math and stuff to use vectors
no
and im not great with vectors so that isnt ideal
you're not understanding
for every falling block:
teleport to falling block location + direction
of course you can add in your runnable between these steps
and scale down the vector as necessary
but that's the code
define vector direction: final location - initial location do you mean just getting the vector of the location its supose to go to and the location it starts at?
Yes
the center of the final location - center of the initial location
alright also wdym by teleport to falling block location + direction?
all of the blocks should be using the same direction
fallingblock.getLocation().add(direction)
ah
i suppose
imagine a group of people
you want them to all move to a place relative to their starting position
if you tell them to all move "forward" for 10 seconds
theyll never bump into eachother and end in the correct position
alright ill try it thanks
that's the idea that's happening here
does getKeys(true) (i.e. deep) give the entire path (for example among.us.sus)?
yes
ok
oh
the values will be configuration sections tho
so you can just filter them out
or maps
not sure
pretty sure thed be config sections
yes
among:
us:
sus: 1
among = ConfigurationSection[us=ConfigurationSection[sus=1]]
among.us = ConfigurationSection[sus=1]
among.us.sus = 1
can i change activation & tracking range at runtime?
any idea how to convert like 10,000 to 10k, and stuff?
i have ``` public static void moveBlocks(String name, Location loc, double time) {
Vector endCenter = fallingBlocks.get(name).get(0).getLocation().toVector(); // get the center of the location the blocks should end at
Vector startCenter = centerLocation.get(name).toVector(); // get the center of the current platform
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i); // get the fallingblock entity
Vector onePercent = loc.clone().subtract(startCenter).toVector().multiply(1d / time); // get the value for linear motion
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(block.getLocation().add(endCenter.divide(onePercent))); // teleport the fallingblock
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}``` but im getting this error https://pastebin.com/ZNzZPCJ4
may be dividing by zero somewhere
ok so multiple things are wrong here
should define the direction vector outside of the loop, becuase like i said before, it should be the same
end-start
ah
what's the purpose of loc again?
loc is where the platform should end up
move the onePercent declaration outside the loop and make it final just to make sure you dont reassign it
eh, making it final is unecessary because it's still mutable
that's where most trouble is with locations
true
so what's the difference between endCenter and loc?
the onePercent declaration should also only use endCenter and startCenter
thats a good question it was like 2am when i made that part
along with the multiplying thing you had
also @quartz basalt could you add java syntax highlighting to your code block next time
you can do so using "```java"
as the starting tag
ok
Vector end;
Vector start;
Vector one = end.subtract(start).divide(time);
"```java" public static void moveBlocks(String name, Location loc, double time) {
Vector endCenter = loc.toVector();
Vector startCenter = centerLocation.get(name).toVector(); // get the center of the current platform
Vector direction = endCenter.subtract(startCenter);
Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time); // get the value for linear motion
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i); // get the fallingblock entity
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(block.getLocation().add(direction.divide(onePercent)));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}``` doesnt seem to work, no errors, but the platform just teleports away no idea where it goes but it doesnt go to the specified location
what
thats to make it smooth so it can go over x seconds
a and b would be what sorry?
``````java <your code here>```
Vector end;
Vector start;
Vector dir = end.subtract(start);
Vector one = dir.divide(dir.divide(time));
// Your code here
id prefer not to spoonfeed but whatever lol
what im trying to say here is that
yeah i just like writing shit so
you have two vectors that use a-b
- that's unnecessary in almost all cases
- you divide them, which just gives you 1
doesnt the client already interpolate positions
yes, the client already lerps teleports that are less than 8 blocks
thats the purpose of the move packet haha
yeah
thanks for the help but with the method you sent orb (time) needs to be a vector so that wouldnt rly work and Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time); // get the value for linear motion would work already no?
.divide is the same thing as .multiply(1/t)
ah
could make it a vector, that would be interesting
some components move faster than others
i cant put a double or numbers in the (time) part its asking for a vector
oh i see
youre right
i see what you meant
also instead of 1d you could use 1.0
in my opinion it looks cleaner but honestly thats just a nitpick personal thing
Vector endCenter = loc.toVector();
Vector startCenter = centerLocation.get(name).toVector(); // get the center of the current platform
Vector direction = endCenter.subtract(startCenter);
Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time); // get the value for linear motion
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i); // get the fallingblock entity
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(block.getLocation().add(direction.subtract(onePercent).divide((direction.subtract(onePercent).multiply(1/time)))));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}``` does the same thing as before, it kinda just shoots off above my head and then goes out of my render distance
you're not really understanding
direction.subtract(onePercent) this is entirely not necessary
direction.subtract(onePercent).divide((direction.subtract(onePercent).multiply(1/time)
oh i thought it was the equation you sent?
oh, absolutely not what i meant
i was telling you the equation you currently had
and how it was completely wrong
Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time);
THAT is the vector
you need to use
you still dont understand
.
that equation is what you had
im telling you
that equation
is equal to t
this is literally the only vector you need
then i just add it to the location?
Vector endCenter = loc.toVector();
Vector startCenter = centerLocation.get(name).toVector(); // get the center of the current platform
Vector direction = endCenter.subtract(startCenter);
Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time); // get the value for linear motion
for (int i = 0; i < fallingBlocks.get(name).size(); i++) {
FallingBlock block = fallingBlocks.get(name).get(i); // get the fallingblock entity
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(block.getLocation().add(onePercent));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}``` same issue as before the platform just goes away
you could simplify your for loop to have a foreach loop
yeah i had that before but i thought that couldve been the issue
for (FallingBlock block : fallingBlocks.get(name)) {}
once again
please use java annotation if you're gonna usediscord markdown
sorry forgot
it's because of this
Vector direction = endCenter.subtract(startCenter);
get rid of it
i removed it but it had no usage
wdym
it wasnt used
well im saying it likely didnt work because of that line
endCenter was just mutated before you use it
did you run the code without that?
i removed it and the same issue
// public static void moveBlocks(String name, Location loc, double time) {
Vector endCenter = loc.toVector();
Vector startCenter = centerLocation.get(name).toVector(); // get the center of the current platform
Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time); // get the value for linear motion
for (FallingBlock block : fallingBlocks.get(name)) {
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(block.getLocation().add(onePercent));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}```
public static void moveBlocks(String name, Location loc, double time) {
Vector endCenter = loc.toVector();
Vector startCenter = centerLocation.get(name).toVector(); // get the center of the current platform
Vector onePercent = endCenter.subtract(startCenter).multiply(1d / time); // get the value for linear motion
for (FallingBlock block : fallingBlocks.get(name)) {
new BukkitRunnable() {
int iterations = 0;
@Override
public void run() {
block.teleport(block.getLocation().add(onePercent));
iterations++;
if (iterations >= time) {
block.teleport(block.getLocation().add(0.5, 0, 0.5));
this.cancel();
}
}
}.runTaskTimer(XKits.getInstance(), 0, 1);
}
}```
how would i convert 1000 to k and like 123456 to 123.45k?
took me 15 seconds
thanks broski
@quartz basalt i would try debugging again
and make sure you run that version of the code on a server restart
at this point i think its something else
oh my it worked tysm ive literally spent about 6 hrs trying to figure it out
what the best way to loop over all players and skip yourself?
Create a copy of online players and remove yourself before you iterate.
i mean cant you just obtain a copy of the onlineplayers, remove yourself and loop over it?
ah
great
I don't really know if there is a simpler way to do that.
i was doing an if check the whole time and that looked kinda brr
You could add a check to see if it's you, but at that point you might as well just remove yourself.
Bukkit.getOnlinePlayers returns an immutable collection right? so not a copy which i can edit
Yep
meh
List<Player> players = new ArrayList<>(Bukkit.getServer().getOnlinePlayers());
the only issue now is it looks very jolty its not moving smooth do you know anyway to fix this?
bukkit.org not reachable for anyone else here?
Add more steps or increase the time it takes to get from point a to point b.
bukkit.org ๐
go to spigotmc.org loser
ive increased the time but it still very jolty, how would i do steps?
lmao
I still have some plugins on bukkit paying me monthly
Find locations inbetween your start point and end point. Then move to each one of those locations in order until you reach the end.
The reward system on bukkit is kinda nice
but thats what the onePercent does in my code its supose to do that 1sec
makes sense right
here
Then play with the number.
Hi how I can validate packet PacketPlayInUseItem?
for (Player player : Bukkit.getOnlinePlayers()) {
if (player == target || player.canSee(target)) continue;
player.showPlayer(plugin, target);
}
no need for copy
mmh you could be right
i hope == works on player objects as acf gives me that player ยฏ_(ใ)_/ยฏ
it does
== works
@quaint mantle Got a question about your ConfigFile class. I know there is the #dumbLoad() method, but I'm working with weird file paths. Currently I'm doing something like this.
File file = new File(plugin.getFileManager().getLocaleDirectory(), "locale_en.yml");
this.locale = new ConfigFile(file, YamlConfiguration.loadConfiguration(file));
I was wondering why there isn't a ConfigFile(File file) constructor that just calls YamlConfiguration#loadConfiguration(). Do you use the #dumbLoad method more frequently than not or am I just doing something wrong?
I think CurseForge made a mistake LOL I ordered a $5 PayPal payout and somehow they sent me $50
dumbload basically does what you're doing
it just saves it if it doesnt exist
Ah, ok. Ty
wondering what the diff is
One takes a namespaced key.
i have one for accessing pdc
Presumably, you could use that to trigger bosssbar for other plugins.
which class is responsible to kick the player for flying?
ServerGamePacketListenerImpl
i was going to say the same thing
i just done that in a vanish plugin
this baby horse is stuck here not knowing whether it should follow parent or drink water, as if rapidly switching between the two pathfinder goals
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(2, new FleeFromHorse(this, 10.0F, 1.5D, 2.0D));
this.goalSelector.addGoal(3, new RunAroundLikeCrazyGoal(this, 1.2D));
this.goalSelector.addGoal(3, new PanicGoal(this, 1.2D));
this.goalSelector.addGoal(4, new HorseBreedGoal(this, 1.0D));
this.goalSelector.addGoal(6, new DrinkWaterGoal(this, 1.0D));
this.goalSelector.addGoal(7, new EatSeedsGoal(this, 1.2D));
this.goalSelector.addGoal(8, new FollowParentGoal(this, 1.0D));
this.goalSelector.addGoal(9, new WaterAvoidingRandomStrollGoal(this, 0.7D));
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(11, new RandomLookAroundGoal(this));
even though DrinkWaterGoal is a higher priority than FollowParentGoal

Just curious, how do you guys debug your plugins? I have a test server to see if the plugin works but I'd like to be able to print things and stuff.
I normally sout.
Where are you invoking the functions?
Attach a debugger and love your life
Hey guys, is there a way to check if I can trade with a villager? Basically if the trade inv gets opened when I click on him or if nothing happens, is there a way for that?
What debugger do you use?
I don't know which to use for Java.
I'm using Eclipse for my IDE.
is there a way to make it so intellij auto add "Database Manager" or my utils class etc without me having to do it manually
IntellIJ xD
really simple question how do i make a command where when i do /ping the server responds with pong!
I'm a beginner but I'll take a stab at it.
im using Intellij
Set up the command field and info in the plugin.yml
int playerping = ((CraftPlayer) player).getHandle().ping
Nvm lol
sorry haha
lewi
No its good, I have no idea what I'm on about anyways lmao
what does it do
player.sendMessage("");
storm
?
you have to set up a command field in the .yml file
and then you have to have an onCommand
yeah thats what im doing
which responds with pong
oh
send me what you got and ill take a look at it
do you mean like how to make a command from the start or just how to send the player a msg?
Well you would have to make a command right?
its becouse im making a /discord for a specific discord server so no nned for a config file
well ye but idk how new he is etc
Anyone got an idea?
Ahh ok, well goodluck with everything
I have coding experience but just started plugins yesterday.
would say the InventoryOpenEvent get the inventory type.
if the inv type is == to InventoryType.MERCHANT then u can do what u want.
not sure if thats what your after
Yea I think that should do the trick, thank you
np let me know if it works
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player p) {
p.sendMessage("Pong!");
}
return true;
}
}
this would be the class that contains the command
How to make ClickEvent run a method?
not the best idea to spoon feed them i cant lie they wont learn
BukkitRunnable?
not sure what u mean
@Override
public void onEnable() {
// Plugin startup logic
getCommand("ping").setExecutor(new PingPongCommand());
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}``` this would be the main class where you register your command
BaseComponent has ClickEvent
when you click chat message
version: '${project.version}'
main: dev.mono.pingpong.Pingpong
api-version: 1.19
commands:
ping:
description: Replies pong to player
usage: /<command>
and then here you would register it in the plugin.yml
thx soo much
recommend you download Minecraft Dev plugin on Intellij marketplace
as much as your thankful i would really try do this yourself with other commands as you'll use this a lot and just copying a pasting is not a way to learn
I'd stay away from making plugins
and learn java by itself
or try to resolve issues in github repos for minecraft plugins
if you have no idea how oop works you will struggle
bukkit is down rn hard to find guthub repos
You should learn Java first, atleast the basics
You should grow up pfff stupid anime pfp
i learnt from a course on udemy, teaches u base java to get started and goes over a wide range of the spigot API
dont want to advertise here but if u want a link i can send it in DM's i think its like $10
I don't talk to Maven enjoyers
Shut it kid maven is based
edgy mf lookin ass
Gradle for life
Gradle belongs in the dump becuase I don't like it therefore it sucks
maven mfs when they implement a dependency and it actually imports it for the first time
(never happened before)
Gradle is life
eww gradle
dont have to deal with ugly xml too
Must be a glitch in the system wait are you the guy who was ranting about maven yesterday
yes
1st Spoon feeding
2nd gradle
it gets worse
I hate maven
There's no getting to him he's too far into gradle
haha
I don't like gradle either
but maven is too terrible
always use gradle for personal projects
Quit java code in rust exclusively
Cargo is good
Cargo is god
I do love myself a full source compilation ๐
i wonder what's more performant for enum conversions? enum map or switch case?
gradle is good
it supports many DSL's
and multiple programming langs
i use groovy dsl, but I've seen people use Kotlin DSL too (paper devs)
it just takes time to get hang of it
rust
Rust
javascript
The forbidden language
^ shit
(Horrible shit)
sorry, python
Acceptable compares to js
Rust > all
cmon im asking an normal question
true

๐ช
tho tbf, rust syntax is pretty meh
I used golang in the past it's not bad but I prefer rusts language structure
Bro??!?!
Enums are nice the fact they have interfaces are nice
this is the stupidest dude ever
no offense
He uses paper what do you expect
true

oh
i forgot its 4th of july
who is
being a US citizen ist kinda cringe 
I love the US so much can't wait to leave
๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ๐บ๐ธ
most #general convo in days
Integer.MAX_VALUE
Paper has API to lock campfire slots ๐
Get out of here
?kick
Short ๐
