#help-development
1 messages · Page 1726 of 1
No
Yeah
But it should send a packet per tick
either that or something to do with shields
e
to implement
I just listen for the right click event and keep track of the time inbetween them
what I initially thought is there are two different command handlers for commands. one is for vanilla commands, and one is for bukkit ones
I need to do it while they hold it though
It works alright for custom foods
Technically you can spam right click instead, but I don't know why you would
ok ig sneaking will have to work
yeah well
well its kinda true since vanillaCommandDispatcher still exists, and its authentic to vanilla, but the whole PlayerConnection chat() method is overriden to use Bukkit command api
click holding is easily spoofable im concerned about
you give it some damn velocity
ThrownPotion.yeet()
uh
get the thrown potion entity
yep that's what I'm also using
and add velocity
btw whats the acceleration due to gravity in mc if anyone knows?
yeet is the method lol?
If you believe hard enough it is
probably something random like 7.2648 m/s
lol
who knows
Just print the players velocity constantly and stand still
yeah like they documented that tho
oh yeah true
Dye some horse armor green or somethin
is that a thing
how to crash http://yamllint.com: Insert a: *b
Validate and Verify your YAML documents, optimized for Ruby on Rails
yes
1.14
Same way you dye player armor
1.14.1 was the best release ever
Correct
1.18 will be sacredly neat also
I have an async task loop running that gets all online players and inserts into a database every 5 minutes
but every 5 minutes, the server lags for a second or two with around 8 players online, and i am not sure why as it's an async loop
yeah but 1.14 added PDC, it's hard to get better than that lol
To be fair that is not related to 1.14 itself :p
do you have the code?
Whats a good hose recipe?
yeah I meant bukkit 1.14 😄
It might be the case something runs using locking mechanisms in which case async doesnt matter assuming the lock awaits the main thread
or if you happen to join the async task
record Entry<K, V>(K k, V v) {
}
class HashMap<K, V> {
private final Set<Entry<K, V>> entries = new HashSet<>();
void put(K k, V v) {
entries.add(new Entry<>(k, v));
}
V get(K k) {
int keyHash = k.hashCode();
for (Entry<K, V> entry : entries) {
if (keyHash == entry.k().hashCode()) {
if (k.equals(entry.k())) {
return entry.v();
}
}
}
return null;
}
}
Hashmap.
What about bukkits
records are nice
sealed is also rly nice
" " "^^^" "^ "? ^ = iron ig?
speaking about bukkits, I'll go to kfc tomorrow
@Override
public void run() {
BukkitScheduler scheduler = plugin.getServer().getScheduler();
scheduler.runTaskAsynchronously(this.plugin, () -> {
for (Player player : this.plugin.getServer().getOnlinePlayers()) {
Bson filter = Filters.eq("_id", player.getUniqueId().toString().replaceAll("-", ""));
// more down here
this.collection.updateOne(filter, update, options);});
popeyes solos
yeah somewhat weird, shouldn't freeze
its getting player stats in the async method
although I'd say, use a custom thread pool
hm? how?
since that operations has nothing to do with bukkit nor needs it tick loop
maybe the database makes the cpu go sheeesh
then i am very much confused why the lag spikes for a bit
looking at a timings report now, it's not my plugin causing the most amount of lag
but the server still spikes hard every 5 minutes
ExecutorService service = new ForkJoinPool(
Runtime.getRuntime().availableProcessors(),
ForkJoinPool.defaultForkJoinWorkerThreadFactory,
(t, e) e.printStackTrace(),
true
);
then
CompletableFuture.runAsync(() -> {
//TODO
},service);
//or
service.submit(() -> {
//TODO
});
How can I use water buckets as ammo for a water hose?
and also cache the pool
they have no durability
you only need one
oh, thank you!
try and see if it helps
save a custom durability inside the items PDC
you should use splash water bottles
it will make everything easier
Well yeah but I want to be able to shoot for a long time
and that would last like one second with a full inventory
shooting water bottles
Item item = world.dropItem(player.getLocation(), new ItemStack(Material.WATER_BOTTLE));
item.setVelocity(velocity);
you can edit the item entity's pdc
pdc?
?pdc
a perfect exchange
p?d?c
cdp?
?pdcdp?
cdp?pdc
CDP
Also wouldnt this just throw the water bottle item
ɔpd¿
thats why i said use splash bottles
so you can detect when they hit
I am
???????
🙂
I believe you can just use launchProjectile
ThrownPotion
Haha guys so I'm getting back into mc plugins and I completely forgot, what version of java do you use?
What version do you want to develop for
How can I get the right velocity so something goes the way a player is looking?
aaannnd everyones gone
Player.getVelocity().normalize()
basically don't be a 1.8 pleb, use java 16 and develop for spigot 1.17
hi
im looking to see if anyone knows how to fix this error
[20:47:35 WARN]: [AesopianProject] Task #1873573 for AesopianProject v1.15.2 generated an exception
java.lang.ClassCastException: class java.util.Collections$UnmodifiableRandomAccessList cannot be cast to class org.bukkit.block.BlockState (java.util.Collections$UnmodifiableRandomAccessList is in module java.base of loader 'bootstrap'; org.bukkit.block.BlockState is in unnamed module of loader 'app')
i store a blockstate as metadata
then i try to get that metadata and cast it onto a blockstate object
but when i do so
it throws that
i assume i need to try some other way to cast or something
show code
BlockState teststate = loc.getBlock().getState();
loc.getBlock().setBlockData(Material.AIR.createBlockData());
loc.getBlock().setMetadata("aeso", new FixedMetadataValue(AesopianProject.getAesopianProject(),teststate));
((BlockState) loc.getBlock().getMetadata("aeso")).update(TRUE);
just assume loc is some location
but yeah i dont think this will work
let me know if you have any ideas how to save blockstates
Anyone know how to turn a ThrownPotion into a Water bottle?
like
to change its type
You can probably just clear it's effects
It has no effects but it just throws a pink potion that does nothing
I need it to be the blue and to put out fires
i did give the code
"next time use this"
wat
oh roflmao
well hey
do YOU know how to store a bunch of blockstates
preferrably on blocks or something
what would be a bunch of blocstates
not in a hashmap i mean
i'm tryna figure out a way to store a bunch of blocks so i can change them all to be air and then replace them if the server restarts
including chests, hoppers, redstone, whatnot
i really dont want to do it with worldedit
mostly because it would be really inefficient
i want to just store a blockstate
i tried setting the metadata of a block to be a blockstate
did not work
?pdc ?
i dont know what this is but imma read it
if it solves my problem can i give you money
wait
no
i cant store blockstates in these
welp
then store the location in a database
and when the server starts
do something with the blocks in the locations
bumpppp
ThrownPotion#setItem() with an empty Splash Potion maybe?
hi!
i'm trying to add the nbt "hide_attributes 64" to an item
when using addItemFlags(ItemFlag.HIDE_ATTRIBUTES) it won't hide disc attributes
Disc?
Isn't 64 HIDE_DYE
anyone happen to know off the top of their head why end crystals would be protected by a wg region? my brain feels like it's swimming through molasses right now
MC wiki says 'Adding 64 hides "Dyed" on leather armors'
They're entities
just that? because mobs are also entities
Use 32 @paper geyser
Do you have any entity protection flags enabled
ahhh
ok
but how would I go about doing that
why tf does intellij have 50 keybinds now
im not even pressing anything crazy and theres a keybind for it
Doing what
I think it's just ItemMeta#addItemFlag(ItemFlag.HIDE_POTION_EFFECTS)
From the Wiki: "Adding 32 hides other information, including potion effects, shield pattern info, "StoredEnchantments", written book "generation" and "author", "Explosion", "Fireworks", and map tooltips "
It's just called HIDE_POTION_EFFECTS
I tried it, it hides some of the disc data
Some?
Good to know
how do i check if a player is wearing an elytra? it keeps giving null errors and when i check if it isnt null it doesnt run
Get the chest plate, check for null and then compare material
Mhm
Unable to connect to BungeeCord: Could not connect to a default or fallback server, please try again later: io.netty.channel.AbstractChannel$AnnotatedConnectException
Bungeecord:
ping_passthrough: false, online_mode: false, ip_forward: true
Spigot (sub servers):
online_mode: false, bungeecord: true, connection: -1
How would I update a block 50 times a second given that the maximum ticks per second in Minecraft is 20
Use timer task
You access timer task from Bukkit.getServer().getScheduler().runTaskTimer
what's the purpose of doing it more often than the ticks allow?
are you actually placing blocks to create map pictures? o0
that's quite inefficient
and why do you have to update a block then?
ohh
I see
you mean the map's blockstate or sth
yeah
Instead of putting that the timer task runs every 20 ticks you put 0.4
So it will run 50 times per second
If the ticks are 20
I thought it only accepts long values
true
Ah thats right
so that wouldnt work
Idk if it would accept this but what if you put (20/50)L
nah that wouldn't work
because its still 0.4L
which isnt a long value
I don't think anything can be run more than 20 times per second in MC
unless the TPS is changed
dont use ticks 🤔
everything in the game runs on ticks
I guess the only solution is to change the tps in your server
Have you ever seen any other plugin doing something like this? I mean 50fps map animation
No, I'm just seeing if it possible. I'm not sure if it will even work due to how many times it updates and the effect on the client.
how can i cancel critical hits?
if(player.getFallDistance() > 0) {
//Critical
}
but there are more ways to get a critical hit
Look at this thread
ok, ty
Hello, why with this code https://paste.md-5.net/nonejomito.java i'm still getting crit damage?
Add debug to it.. On each line add a
System.out.println(“TEXT”)
Then test it.. And see what it does
I’m guessing it’s not passing all of the If statement as you used && not ||
why are you suppressing deprecation warnings?
they exist for a reason
Also… That’s not even an Event -_-
You forgot @fresh templethandler
what are you actually trying to achieve?
.
Yeah it has to be a public void
cancelling crit hits
but return won't work
then it would be very good idea to listen to any damage events
?
nvm
You still need “@fresh templethandler”
no?
Sorry even for ping
xD
You need to pass an event to the listener
because you have absolutely no idea what you are doing
"Player" is not an event you could listen to
In that way the plugin has no idea what to do with that class
Player is an interface wrapping the CraftPlayer class
?events
hm
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?event-api
?eventapi
Ah there
can someone help me? My library has a few modules but when I update it to a new version string in the pom.xml, nothing compiles anymore. I have absolutely no knowledge about maven modules and just followed a tutorial
What error do you get
one sec I'll recompile
Actually if you update the version you need to update the parent information in each submodule
yep I did that
just replaced 5.0.0-SNAPSHOT (working fine) in all files with 6.0.0-SNAPSHOT
?paste
Forgot to replace version in parent pom maybe
Also consider heeding the warning about it should be a constant
I replaced every occurrence of 5.0.0 with 6.0.0 :/
yes but first of all I would like to get it working somehow 😄
Did you recompile the parent
I ran mvn clean install on the parent pom
Did you accidentally specify a parent in the parent
a parent in the parent?
this is my parent pom https://paste.md-5.net/awadayolox.xml
Your children have Jefflib not jefflib-parent as their parent
oh for real? how could that happen lol
thanks, I'll check it out
You probably changed it at some point and forgot to update the children
yeah I used to call JeffLib JeffLib-dist
wow that reads really weirdly with little sleep and not realising im in help-dev not general
and the parent was just called JeffLib
Only exposed now that you updated the version too
Guys would blocking too many accesses to a server and limit the number of players connected from the same ip prevent bot attacks and their impact to the server’s performance?
Perfect! Changing the parent of JeffLib to JeffLib-parent worked! How tf could I not notice that lol
that depends whether your bots are all connecting through the same IP I'd guess
define "bot attacks"
Start with online mode
I always forget that offline servers even exist
Too many players connecting to make your server lag
Then yeah, online mode and from that point there isnt a whole tonne you can do
limiting player count seems like a stupid solution
but
from the same ip that seems like a valid way
do they come from the same IP / the same IP subnets?
If so just block those using iptables/nftables after X connection attempts etc
Is there a way to create plugin data files?
wdym? of course you can create files
do you want to save some data inside files?
new File(...).createNewFile()
So i was wondering if spigot has a built in api for data files
I dont think so, just use the standard java things for writing to files
frick
java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @58134517
When trying to save data ahaha
ugh what are you doing?
Is it a problem to create an addon for a paid plugin and use it personally?
Use YamlConfiguration
Serializing a hashset
i'm not good at reading console errors could anyone help me?
they want to use json
using gson
show the error
org.bukkit.craftbukkit.v1_17_R1.entity.CraftAxolotl cannot be cast to class org.bukkit.entity.Player
Check the line "Caused by"
there you go
at me.fragment.damageindicator.Events.CriticalHits.isCritical(CriticalHits.java:16)
you are casting an Axolotol to a player
you somewhere do Player player = (Player) entity or something
show ur code
without checking whether entity is a player
I'm already doing that
Player damager = (Player) e.getDamager();
if (damager instanceof Player) {
that's what i'm doing
I'm just having issues with serializing the hashset to json
Because it seems it doesnt like it that much ahaha
so, instanceof isn't necesary?
yeah you see
yea it is
you cast the e.getDamager to player
just do it befroe
How would I get access to the lines of a sign in 1.17 java Sign sign = (Sign) targetBlock.getState();No methods for obtaining the lines are available from the sign interface.
you cast
can you show your code?
if (e.getDamager() instanceof Player) {
Somthing like that?
Sign#getLines()
String json = gson.toJson(this.dataFile);
Files.writeString(dataFile.toPath(), json);
declaration: package: org.bukkit.block, interface: Sign
AHAHA
now i see the issue
i'm trying to parse the File not the hashset ahahaha
Big brain mode initiated
I'm trying to make a custom item that makes creepers run away from the player when the item is held - Does anyone know of a method that makes a mob flee like a creeper does next to an ocelot?
u are gonna have to mess with pathfinding goals afaik
Fixed it. Thanks for the help lads
well, not sending the error but still it doesn't cancel the crit hit
show your listener code
Imported the wrong package. My fault 😛
happens 😄
probably blockdata not block
add debug statements
hmm
check which of those if statements is true and which are not etc
first of all refactor the code
e.g. instead of checking whether e.getDamager() is instanceof player, check if it is NOT instanceof of player and then return
same for all the other checks you are doing
then you can print after every if statement whether it's still executing
then you can easily see which condition isnt true
also @acoustic pendant why do you check whether your player is instanceof LivingEntity?
maybe an entity hits 1sec before dying and maybe it has died but mc detect him as a LivingEntity
idk if you get what i mean
erm no
you say Player damager = ...
so damager is always a player
try this
@EventHandler
public void isCritical(EntityDamageByEntityEvent e) {
System.out.println(1);
if (!(e.getDamager() instanceof Player)) return;
System.out.println(2);
Player damager = (Player) e.getDamager();
if(damager.getFallDistance() <= 0.0F) return;
System.out.println(3);
if(damager.isOnGround()) return; // isOnGround is deprecated
System.out.println(4);
if(!(damager instanceof LivingEntity)) return; // Unnecessary
System.out.println(5);
if(damager.hasPotionEffect(PotionEffectType.BLINDNESS)) return;
System.out.println(6);
if(damager.getVehicle() != null) return;
System.out.println(7);
if(e.getDamage() <= 0.0F) return;
System.out.println(8);
e.setDamage(e.getDamage() / 1.5F);
}
}
damager is ALWAYS a Player
yes
no
that's what i'm saying
yes, look at his code
oh thought u mean in general
😄
try the code I sent. then you see which of the checks doesn't go through
yes, i'm looking for an entity
/summon Zombie
it isnt
[12:48:56] [Server thread/INFO]: 1
[12:48:57] [Server thread/INFO]: 1
[12:48:58] [Server thread/INFO]: 1
[12:49:23] [Server thread/INFO]: 1
[12:49:23] [Server thread/INFO]: 2
[12:49:26] [Server thread/INFO]: 1
[12:49:26] [Server thread/INFO]: 2
[12:49:43] [Server thread/INFO]: 1
[12:49:43] [Server thread/INFO]: 2
[12:49:43] [Server thread/INFO]: 3
[12:49:43] [Server thread/INFO]: 4
[12:49:43] [Server thread/INFO]: 5
[12:49:43] [Server thread/INFO]: 6
[12:49:43] [Server thread/INFO]: 7
[12:49:43] [Server thread/INFO]: 8
[12:49:45] [Server thread/INFO]: 1
[12:49:46] [Server thread/INFO]: 1
[12:49:47] [Server thread/INFO]: 1
[12:49:49] [Server thread/INFO]: 1
[12:49:50] [Server thread/INFO]: 1
remote jvm debug >>>>>>>>>>>>>>>>>>>>>
that means the whole thing was executed once
it set the damage to damage / 1.5
well all you do is dividing the damage by 1.5
yes, but the damage is still like a crit hit
you mean it shows the "crit hit" animation?
i did a plugin that is for damageindicator
no
the damage
i did a plugin that sends the damage
well, i don't know why is not cancelling the crit damage
are you trying to detect critical hits
to cancel them
can't you just set the total damage to the base damage
well for a start you're missing a lot of things there
the wiki details it pretty well
but what is the current issue you have?
that all the code is executed
but when i hit a entity jumping it does more damage
base damage:
Critical damage:
can't you just set the damage to the base damage of the weapon in hand?
are you sure you are actually dealing that dmg
yes?
concerning you are playing around with the same event that might be responsible for spawning these damage indicators
you might modify after it spawns
(e.g. have you checked the entities health using commands)
nope
tbh, mc damage code is a mess
ok, i check the damage with e.getDamager(); and e.getDamage();
should i add like finalDamage?
huh ? are you writing the plugin that spawns the damage indicators ?
yes
I'm also amazed there is not API for this yet
yes lol
hello, i want to save a ConfigurationSerializable in the root yaml
move the listener that spawns these to monitor level
so, to get the final damage, should i do something with events?
*ik it wont work, but it is just for an idea*
I believe it should be possible to add an isCritical or some event, I'll have to open up my paper fork and find how
something like this? double finalDamageDealt = e.getFinalDamage();
hm I have no idea whether there's a better way but you could just loop over all keys of your section and set them manually
like
for(String key : mySection.getKeys(false)) {
config.set(key, mySection.get(key));
}
ik
how can i get the life of an entity?
cast it to Damageable
i mean, with a command
by doing what Sam suggested, inside a command executor
or install a mod that shows entity hp if you just want to see the damage lol
you literally have no idea what events are, do you?
?
Gets the amount of damage caused by the event after all damage reduction is applied.
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent
yes, and i'm reducing the crit damage
and now ask how you get the health of an entity inside a command
what does a command have to do with a entitydamageevent?
because i want to check if the hp of the entity
you don't need to code your own command for that
it's according to what the hologram says
there is the /data command
I think with "command" he meant java code and not an ingame command
ingame
getting the health of an entity: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Damageable.html#getHealth()
declaration: package: org.bukkit.entity, interface: Damageable
i explain you.
I have a code that creates a hologram every time i hit an entity
nice
yes and now you want to get the entity's health. So, use Damageable#getHealth
i want to see the entity health because i don't know if crits are cancelling or is a problem of the hologram
where is the code that creates a hologram?
do i send you?
well yes
why are you listening to the event twice
for setting damage and then spawning hologram
oh
that is probably why it's wrong
put the hologram code in the same event after you set the damage
or set the priority of the @fresh templetHandler i guess
like this?
fuck i pinged that guy again
I wouldn't trust that to continue working
you really shouldnt call your ArmorStand "damage", that's kinda confusing - at least in my opinion
the delay?
eeh
that's a great question
oh
because if not
well
nvm
Bukkit.getScheduler().runTaskLater(DamageIndicator.getInstance(), () -> {
damage.remove();
}, 40 );
}
}
got it
use code block for putting code in discord homie
you should also make your plugin field private final
multi-lines of code you can use three ` at the start and then another 3 at the end of your code
I also asked that a few times already 😄
you can also highlight code in discord
i almost deleted my main class
if (a) {
System.out.println("hi");
}```
nag author SamB440 for using sout
SOUT BEST DEBUGGER!!
System.out.println(getLogger());
what even is Bukkit.getLogger()
yep
i suppose it's completely reasonable to assume people here wouldn't actually know
noted
well there are people here who blindly cast an Entitiy to Plugin because that removes the red underlines in IntelliJ
so they think it'll work now
i guess i really didn't think anyone who would be looking in a spigot help-development channel wouldn't know what Bukkit.getLogger() was lol but yeaaaaa its probably not safe to assume that
Bukkit::getLogger returntype is the normal java utility Logger afaik
day 2 researching brigadier. You cannot override brigadier error messages due to the way they're hardcoded into brigadier classes. Unless you edit the source code, there's no way of changing them
Oof
public class BuiltInExceptions implements BuiltInExceptionProvider {
private static final Dynamic2CommandExceptionType DOUBLE_TOO_SMALL = new Dynamic2CommandExceptionType((found, min) -> {
return new LiteralMessage("Double must not be less than " + min + ", found " + found);
});
private static final Dynamic2CommandExceptionType DOUBLE_TOO_BIG = new Dynamic2CommandExceptionType((found, max) -> {
return new LiteralMessage("Double must not be more than " + max + ", found " + found);
that's a deal breaker for me
Maybe pr?
if these were changeable i would switch my command framework to brigadier one
this a mojang lib
not spigot's impl
pr is impossible in this case
You can pr brig tho, and the hopefully they’d include it in minecraft 1.18
i doubt it, its not a brigadier's problem. NMS messages and brigadier messages are actually different
there are two classes which implement BuiltInExceptionProvider
i have no idea how the instance of NMS class injected into brigadier static method to retrieve exception provider
wait nvm
these are exceptions
NMS just catches those exceptions and replace those with its own class exceptions.
ah
} catch (CommandSyntaxException var18) {
commandlistenerwrapper.sendFailureMessage(ChatComponentUtils.a(var18.getRawMessage()));
nvm
it sends the exception message from brigadier
as you can see var18.getRawMessage()
ah yes, var18, that's how I also like to call my variables
decompilation
I know
anyway
a friend of mine obfuscated his code by hand lmao
most stupid thing I ever heard of
there's only two ways to override brigadier error messages
you need to extend net.minecraft.commands CommandDispatcher class and override public int a(CommandListenerWrapper commandlistenerwrapper, String s, String label, boolean stripSlash)
do copy paste from default method and edit sendFailureMessage argument to provide your own messages
why wont this work?
I want to store all block break info in a chat file for my server
public void blockbreakdata(PlayerHarvestBlockEvent f) throws IOException
{
String time;
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
time = (dateFormat.format(cal.getTime()));
String player,block,loc;
String finalmsg;
int bx,by,bz;
block=f.getHarvestedBlock().toString();
player=f.getPlayer().getDisplayName();
bx=f.getHarvestedBlock().getX();
by=f.getHarvestedBlock().getY();
bz=f.getHarvestedBlock().getZ();
loc=f.getPlayer().getLocation().toString();
finalmsg=time+"| Player "+player+" broke "+block+" at x:"+bx+", y:"+by+", z:"+bz+". "+player+" was at "+loc;
write("blockbreakrecord",finalmsg);
System.out.println("Stored block data");
}```
what doesn't work?
you arent even listening to the blockbreakevent
use BlockBreakEvent instead of PlayerHarvestBlockEvent
the PlayerHarvestBlockEvent is for harvesting berry bushes etc
np
why do people always use single letter objects in their code 😦
I also used to do that
because I literally started learning programming 6 months ago
it makes things so hard to read imo
I could understand if you would have called the event "e", but why "f"? 😄
call event event homie lmao
ohk ig
public void onBreak(BlockBreakEvent event) {
and what do you call entities? e2?
i mean you dont HAVE to, technically you are not wrong but its just easier to read later on as you add to your code and have to go back to it it makes it easier on yourself later on
btw if someone wants to see funny variable names: https://github.com/AcmeProject/WildernessTp/blob/master/src/main/java/net/poweredbyhate/wildtp/OuchieListener.java
the whole code is a meme lol
"quality code" according to the author 😄
static void doodWhrsMyCar(UUID sweet) {
if (dr0pp3dPuhlayars.containsKey(sweet)) Bukkit.getScheduler().cancelTask(dr0pp3dPuhlayars.remove(sweet));
}
🤮
TooCool2Teleport.microwave(player);
@EventHandler(ignoreCancelled = true)
private void onPlayerTryingToBreakLegs(EntityDamageEvent ouch) {
i feel like if my plugin gets found by someone in this channel it will surely get roasted as well
but this....
lemme remind that this project has 7 contributors lol
wow
but it has a CNNListener
lmao
if (bonelessIceScream(loco))
loco = netherLocation(loco, 110);
else if (billyIceScream(loco))
this method's name is epic
public class TooCool2Teleport implements Listener {
static HashMap<UUID, Location> coldPlayers = new HashMap<UUID, Location>();
static HashMap<UUID, BukkitTask> coldTaxs = new HashMap<UUID, BukkitTask>();
static HashMap<UUID, boolean[]> boobools = new HashMap<UUID, boolean[]>();
static HashMap<UUID, PotionEffect[]> sauces = new HashMap<UUID, PotionEffect[]>();
ah yes, the sauces hashmap
btw the only time it is acceptable to use a few characters for your objects is with sql statements
cause you got me fucked up if im going to type PreparedStatement1.blah 50 fucking times
that shit's just too long, ps1.blah
these are static fields
not getters
nothing
i thought i would never see something like this in a github with lots of favorite stars on it and 7 contributors LMAOO
static void addPlayer(Player player, boolean[] tips, PotionEffect[] dishes, BukkitTask taxs) {
UUID coffee = player.getUniqueId();
if (coldPlayers.containsKey(coffee)) microwave(player);
boobools.put(coffee, tips);
sauces.put(coffee, dishes);
coldPlayers.put(coffee, player.getLocation());
if (taxs != null) coldTaxs.put(coffee, taxs);
// As addPlayer() can be called async, have to do it in a sync task
if (dishes != null && dishes.length > 0)
new BukkitRunnable() {
@Override
public void run() {
for (PotionEffect leftovers : dishes) player.addPotionEffect(leftovers);
}
}.runTask(instace);
}
the whole plugin is just a parody or sth I think
nvm, forgot to write the deserializer 🤡
UUIDs called hotdog, BukkitTasks called callofduty, microving players, OuechieListener.doodWhrsMyCar(hotdog), sauces.remove(hotdog), .... 😄
i dont feel so horrible about my code anymore
what plugin is that
How to write a simple configuration file (Not create)? If you guys have any advice please share it with me here!
https://www.spigotmc.org/threads/writing-a-clean-simple-configuration-file.529064/
you mean a config.yml?
Yea, and language (messages) file too!
Bukkit has that builtin.
First, your Plugin has the method getConfig()
that includes everything inside your config.yml file
yikes
to create your own config files, you can do YamlConfiguration.loadConfiguration(File)
double yikes
Man... just look at it.
if your plugin includes a config.yml, you can save it using saveDefaultConfig()
😂 Are you a bot lol?
and as set, you can get values using getConfig(), e.g. getConfig().getString("name");
yes
I'm a bot
@tender shard is our answer silly questions bot bot
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
he uses AI
btw is there any website which we can access for like ai chat response?
Desktop.
Localhost for example.
no like
wait
Bumped
so like http://api.icndb.com/jokes/random/3 gives a random joke everytime u access it
similarly is there any website which gives an intelligent response to a chat
uhh
there is an expert guy i know about that
he did it in 5 minutes
i can give his id
yes give me
:D
ye let me ask him
he turn off the bot (self-bot, access a database that he also made, all of them just in 5 minutes 😂 )
damn
but bro is it paid/
?
Yes, like any good service is gonna be
okie I just wanna learn as a hobby so if u have one for free let me know tysm anyways
He isn't online right now, prob sleeping 😂 maybe tmr he will response, we are asia tho.
same I m india
Btw I don't really know him that much, only once tell him to create a discord bot to replace Groovy and Rythm and 2 hours later he already made it, really detail, and I see nothing to say that it is bad.
is there a way to get the current tps without nms and ANY other plugins api ?
or the recentTps
maybe
so how ?
actually
i dont think so
you could fake a commandsender
and make it run /tps
and you could get the message
and split
:114:
😐
barely needed
i need it
Player.spigot.sendMessage
wym?
assume you have your player variable, then invoke
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("action bar"));
i don't have player variable
then you'd need to obtain one
or well a player instance
Bukkit.getPlayer("name")
or Bukkit.getPlayer(uuid) might help you
so who you want to send the actionbar to
to the player
so if you have no variable
just use e.getPlayer().sendMessage().....
public void actionBar(Player player) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("action bar"));
}
}
i have it like that
yes
TextComponent.fromLegacyText("action bar")
no?
wait
sure
this is strange
mine doesn't work either
oh bruh i was using 1.8.8
@acoustic pendant
public void sendActionBar(Player player, String text) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', text)));
}
i guess this will work
do player.sendmessage()
adri, you never use the method
oh nvm me I didnt read above
no?
Just because you declare its existence doesn’t mean it’s automatically going to work
@acoustic pendant please do us a favor and learn basic java, you always come up with totally basic questions, like "why does my code not work" when you don't even call it anywhere, etc
do the command
i dont know the commands
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.
?learnthecommands
has it registered in your brain?
26
oh what the it's already 4pm, I have to switch to harder drinks now
here the sun is shining :3
here the sun is shining too
16°C
anyone knows how I can prevent IntelliJ from having to click on Commit twice when it finds "problems"?
it always says my code got problems because it also checks codeblocks in markdown files
I can 😄
apparently server send translatablechat component to the client
and the text is displayed is from translation file
not from the server itself
changing the text is too much hassle
you can, but that would require to extending and modifying the dispatch method of the existing vanilla command dispatcher, create VanillaCommandWrapper classes, add them to bukkit command map, and then it would work
Is there like a way to stop a player from fishing? Like they throw out their hook and after some specific condition I make them reel in again
can't seem to find anything regarding it
maybe cancel right click event
PlayerFishEvent + event.getState()
I want them to stop fishing not cancel the whole thing
as in reel in their hook, but my plugin would trigger that action
^^
if you don't find a better way, in the worst case you can simply change their item in main hand to air and then give them the fishing rod back
This is what I was thinking as well, but I was trying to see if there would be a more elegant solution 😦
Might dive into the NMS for this as well, there has to be some kind of method that's being used
you got an example on how to use it?
I don't see any way on how that would help to cancel fishing after like 5 seconds
all I can see in that code is that stuff happens when a player reels in the line themselves
but no way to make them force to do so
event.getState() == State.FISHING
??
You are really not getting it...
When you throw your fishing hook out, it stays in the water right?
A player is fishing. Now I compare event.getState() == State.FISHING.
Result: Nothing changed
yeah I also think there's no other way. Do you also want the player to get the reel in animation?
Kind of
Let me try to do something with the hook entity.
might be able to just remove that one
see what it does
good luck! let me know when you found I way. Not that I need it, but it would be interesting to know 😄
I surely will!
ty
teleports the hook entity into oblivion
I have an idea
send a chat message "You reeled in your hook but didn't notice it"
SCNR
@tender shard removing the hook entity from the world does work.
does not trigger a REEL_IN event though, so I might fuck the inner workings a bit hahaha
you can just call the event yourself
the event itself is just to notify plugins
bukkit / mc doesn't care at all about the events
I guess it triggers the same part of code that triggers when you get out of reach of your hook
that doesn't trigger any events either
Which it probably should but EH, this could be my first PR to spigot maybe ;D ¯_(ツ)_/¯
I'd really simply call the event, and when it wasn't cancelled, remove the hook as you said
Weeel
to be honest
I'm not sure whether the event should be called in this case
because
it's a PlayerFishEvent, it gets called when a player does fishing stuff
but the player didnt do anything in this case
Walking away and stopping to fish does seem like something that should be called though
hahaha
This actually breaks the visuals I have setup oof
You can probs send a reel packet to the player then cancel the playerfishevent.
not again pls
???
...
you just don't get it
we want to cancel the fishing after the player is already fishing for 5 seconds
do you think the server keeps to call a playerfishevent every tick the whole time a player fishes?
because it doesnt
This is definitely something I will need though.
I use the FishEvent to cancel all other stuff I have going on. Moving away stops the fishing but not all my visuals now xD
any bobbers in the chat
Yes. so check playerfishevent launch a task after 5 seconds send the reel packet and remove the hook entitiy.
no reel packet needed
I doubt there is a reel in packet
removing the hook is enough
removing the hook = player gets reel in animation
reminds me of when I was making my fishing plugin
I once was fishing IRL and I was totally disappointed that I didnt get old boots all the time
fishing irl is exhilarating
quick javadocs question
/**
* Returns the {@link Random} instance.
*
* @return Random instance
*/
public static Random getRandom() {
return random;
}
Would you also add a {@link Random} to the return thing?
shit
sorry for ping
oki
thanX
I'm currently at the point where I have no new ideas so I'm reworking all the javadocs lol
but yeah it gets almost insulting with this Returns the {@link Random} instance.
isn't a description required?
not really
I think that it throws warnings without ANY description
Not sure though, at least it's true if the parameters or return things aren't commented
yeah me too but right now I'm bored lol

poor re_ovo
why would i use a random instance if i want a specific instance? 🤔
yeah I also keep tagging someone on github very often by accident, though I forgot who it was lol
I tend to reuse the same random instance in my lib everytime because I don't see a reason to create a new one everytime
since Random instances can be expensive to construct
it is a specific random
^
I didnt choose the name for that class lol
it's an instance of Random
and I get it with getRandom
lol
like I get a Player with getPlayer
or a Burrito with getBurrito
getPepsi
i'm going to getVodkaCoke now if there's still ice in the fridge
getJoke()