#help-development
1 messages ยท Page 1685 of 1
no man,
man, that's not what I wanted
This would be my proposal for a really simple custom mob wrapper
that can be used if you dont want to get into NMS:
public class CustomMobWrapper {
private final LivingEntity entity;
private int ticksAlive;
private final Map<Ability, Integer> abilityCDMap = new HashMap<>();
public CustomMobWrapper(final LivingEntity entity) {
this.entity = entity;
}
public void tick() {
++this.ticksAlive;
this.abilityCDMap.forEach((abil, cd) -> {
if (this.ticksAlive % cd == 0) {
abil.executeFor(this.entity);
}
});
}
public void addAbility(final Ability ability) {
this.abilityCDMap.put(ability.getCooldown(), ability);
}
}
i've already made the code that changes the player's camera position
go to your minecraft options
find this option:
guys calm down
I've done it too, but it's not what I want, wait for me to finish talking
ok
Uhm. I would say not completely true.
Not spigot but where can I find javascript functions like getting system time and stuff
unless you change the players speed, this setting is purely client side
go to your minecraft option: find this option, activate it and go back to the game and move your camera sideways
ok sec
doesnt it has like an official documentation
I tried finding it I am blind
i'm sorry, but I'm confusing saying perspective with cinematic..
Ty
- Ew.
- Download 500MB of npm packages for a simple system time lib
https://262.ecma-international.org/11.0/ this also maybe @olive lance
i dont believe you can do what youre asking
obvious
ty guys for the references
I just want to make a system that the player's camera moves to the same side like this using spigot
You cant make the client change its settings.
i know
i plan to use this feature for other systems, but now the part and how to make it move fast, then slowly and slowly...
You can however record a fixed track with a List<Location> that include the rotation
and then force the player each tick to be teleported to the next Location in the track.
wait
I have a scheduler running at 60 tps so I don't use 1 tick to make the camera move smoother
You can also write an interpolation algorithm that works with waypoints and delta timesstamps.
I dont... what?
Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set = new HashSet<>(Arrays.asList(
new PacketPlayOutPosition.EnumPlayerTeleportFlags[] { PacketPlayOutPosition.EnumPlayerTeleportFlags.X,
PacketPlayOutPosition.EnumPlayerTeleportFlags.Y, PacketPlayOutPosition.EnumPlayerTeleportFlags.Z,
PacketPlayOutPosition.EnumPlayerTeleportFlags.X_ROT,
PacketPlayOutPosition.EnumPlayerTeleportFlags.Y_ROT }));
public void camera(final Player player, final float y, final float x) {
PacketPlayOutPosition packet = new PacketPlayOutPosition(0.0D, 0.0D, 0.0D, x, y, this.set, 0);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}```
you can create async threads outside of spigot that run at 0.20 ms around
could you just set packetplayoutposition to exact coordinates?
Ofc. But why?
I would really need to create something that does that, but I don't have the slightest idea
Player movement is not fully server authoritative. You can get away with 20 TPS and velocities pointing to the next location. Let the client do some work.
16.67 ms = 60 tps scheduler
is there a way to grab the plugin version from the pom.xml?
Ah i see. In most cases recoil can just be done my lifting the crosshair a bit.
If you want smooth animations then you should def build an animation system which
allowes mid animation cancelling + merging animations first.
From where?
I want to grab it from my plugin to check wether the config is up to date or not so I can tell people to update the config
set "version="
for /f "tokens=3 delims=<>" %%a in ('find /i "<version>" ^< "pom.xml"') do (
set "version=%%a"
If not [%version%]==[""] (
goto :end2
)
)
:end2
I use this inside my project to fetch the projects version from the pom.xml
.bat btw
I just read something about PluginDescriptionFile.getDescription().getVersion()
Oh so you want your plugin version on runtime -.-
"from the pom.xml?" ...
honestly just a string with the version so I can compare it
sorry if I was confusing
I confuse myself most the time
@Override
public void onEnable() {
final String version = this.getDescription().getVersion();
}
thank you ๐ I really appreciate the work you do here
spigot soft vs not soft dependency?
net.luckperms.api.LuckPermsProvider from LuckPerms v5.3.65 which is not a depend, softdepend or loadbefore of this plugin.
can't figure out why my hikariCP connection doesn't connect.
can i post a stack trace/code?
How would I go about making a players armor invisible?
Ik packets ofc but what would I have to put in the PacketPlayOutEquipment?
Soft depend means your plugin can utilize another plugin but doesnt need it.
Hard depend defines a crucial dependency.
Sure
?paste
Do you use maven?
i'm using gradle
Do you use the shadow plugin to shade in hikaricp?
this one? id 'io.spring.dependency-management' version '1.0.1.RELEASE'
i know i tried adding a certain plugin in for it... btw that's from my build.gradle file
if using 1.17.1 use the libraries entry in plugin.yml
are u saying you can build dependencies in the plugin.yml?
You can have spigot auto download dependencies
libraries:
- com.h2database:h2:1.3.159```
is that just a package name?
Huh? Since when?
its a maven central repo address
1.16.5
late in 1.16.5
lul. Noice.
I suppose it is a channel to ask questions I do not know because I speak Spanish but what plugin do you recommend for ranges and permissions. Permissionex or luck?
In my time it was widely used in permission but I see that now half the world uses luck
Thanks!
where do you find that??
https://mvnrepository.com/artifact/com.zaxxer/HikariCP/5.0.0 mavenrepo site
libraries:
- com.zaxxer:HikariCP:5.0.0```
i also have the required lines in my build.gradle file... will this make a difference?
gradle is for building/packaging
libraries in plugin.yml means you don;t need to package/shade any dependencies in your jar
Has seriously no one ever worked and tried to expand the vanilla pathfinding?
PR or dont complain
- md5
what
This literally has nothing to do with the spigot abstraction
Nor is it something that can be pred
This is about the underlying server
wdym expand
I need to modify the vanilla pathfinding to allow a entity to climb ladders
While entities themselves can infact climb ladders, the pathfinding does not account for it
iirc paper has mob goal api and such
Unless paper is modifying the Path Navigation, Pathfinder and MoveController, no
well @eternal oxide that actually worked.. i'm getting a different exception. at least i can try to work through that for now
You can use goals and set pathfinding targets it seems
still kinda curious as to why i couldn't get the hikariCP dependency to compile via the build.gradle
declaration: package: com.destroystokyo.paper.entity, interface: Pathfinder
I actually had issues with a recent project using Goals, they worked on Spigot but not on Paper.
You need goals to set pathfinding targets...
Still, if they modified Goals I wouldn't be surprised if they modified Pathfinding as well.
Your gradle was building fine, its just not shading
False, modifying goals is trivial
Not what I meant.
Goals don't interact with the pathfinding beyond telling it to "go to there"
I'm aware lmao.
The paper stuff is just wrapping the vanilla pathfinder for allowing access to it on the abstracted layer
Since it is usually hidden away in nms
It's not messing with the actual path generation, or allow modifications to it
what's the difference exactly?
shading is adding any dependencies you specify into your final jar. That bit you don;t have gradle configured to do.
However you don;t need it with the libraries feature
Using libraries keeps your jar smaller and removes any needs to relocate dependencies
ahhh there was a bit in the file about adding a dependencyManagemet block in the build.gradle... but i couldn't get the methods to work right
@halcyon mica what exactly is it that you need
I need to allow mobs to consider ladders in pathfinding
Mobs can infact climb ladders, but pathfinding ignores them
Probably just need to Override createPath() in GroundPathNavigation. It seems like it only creates a path if their target block is Air.
Moj Maps for names also ^
Seems like that would be a good place to start atleast
The navigation is not actually what judges nodes
How can I enable the Event, if the command gets send? I want to make a godmode command ๐
?learnjava
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.
It would be easier if you say me how to disable/enable it ๐ I googled for like 20mins
if (e.getCause() == EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) {
e.setDamage(0.0);
e.setCancelled(true);
}
if (e.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK) {
e.setDamage(0.0);
e.setCancelled(true);
}
if (e.getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) {
e.setDamage(0.0);
e.setCancelled(true);
}
if (e.getCause() == EntityDamageEvent.DamageCause.CONTACT) {
e.setDamage(0.0);
e.setCancelled(true);
}
if (e.getCause() == EntityDamageEvent.DamageCause.CUSTOM) {
e.setDamage(0.0);
e.setCancelled(true);
}
...
don't do this
please
Instead, use an EnumSet and store the DamageCauses
then check if it contains the cause
.
.
.
WTF
if i include my username and password in my db.properites file... when it comes time for deployment that seems really easily accessible...
Can someone help me please. :
main needs to extend javaplugin
and dont name it main name it your plugin name
ok
If you want to make a godmode plugin (I.E, cant take any damage whatsoever), you dont need to check for every source of damage and cancel the event for every one of those circumstances haha
You could store a Set* of UUID's of players that have ran the godmode command, then check if the entity being damaged's UUID is in that list, then just cancel the event
Although I am confused as to what the setDamage bit is for, cancelling the event prevents any damage from being applied, you dont need to specify
Set
Right
Usually you read the db login from a yml config.
Datacontainers might be a bit complex for a beginner
So I have created a custom entity with a custom NMS entity as a handle. It is using the pillager entity type for rendering etc on the client, but here's the issue:
When restarting the server, the entity becomes a regular pillager. How can I have it stay a unique entity after restart?
Is that in the jar?
Plugin Main class not found
Based
look at it
Nope. Just read it from a FileConfiguration (yml) when the plugin is enabled.
You need to register your custom entity class before the chunks are loaded.
So that minecraft uses it to deserialize them.
So I assume a custom entity type is necessairy?
You could use a workaround and just save your data in the PDC of the entity, then listen for
the chunkloadevent and replace them with your own entity.
Im considering if a central database would be plausible or installing one locally
Last time i tinkered with custom entities i looked at this repo:
https://github.com/Iltotore/CustomEntityAPI
Considering that they have a custom underlying nms entity, that doesn't sound very smart
Thats why i called it a workaround 
I suppose a custom entity type will work
But the question is, how will it work with the client
Since the server sends the entity type identifier to the client for rendering
How do you let the client know the type of the entity?
Right now, I simply inherit the nms mob entity and pass the pillager as it's entity type
Which is then used to serialize the entity to be sent to the client
But the same applies to chunk serialization on save
Which leads to them becoming regular pillagers on restart
When you add a registry entry for your class then it will be used for (de)serialisation.
Take a look at the nms impl of the repo ive sent. This is the impl for 1.16
https://github.com/Iltotore/CustomEntityAPI/blob/master/nms/1_16_R1/src/main/java/io/github/iltotore/customentity/v1_16_R1/NMSEntityRegistry.java
Thankfully minecraft gets more data driven with every update. But currently a lot is still a bit obscure.
Hm, I see
I think you provide a Supplier<T extends Entity> somewhere that is used for instantiation. But dont quote me on that. Ive done this a while ago.
I'll verify it in a bit
EntityTypes.b<? extends net.minecraft.server.v1_16_R1.Entity> nmsCreator = (entityType, world) -> {
try {
return constructor.newInstance(entityType, world);
} catch(InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
};
EntityTypes.b
Looks to be a functional interface taking type, world and producing the entity.
You'll be fine
The issue is less the registry and instantiation, and more serialization to the client
Because while it is considered a custom entity by the server, the client has to see it as a pillager
(Or whatever other entity I pick as its representation)
I remember having a remap util to remap from mojmap to onfuscated, can someone link me to that?
I need it for reflection
Actually, nevermind
I don't need reflection to register a type
@lost matrix What event would I register the entity type at?
No idea. Ive not touched that in a while. Some registries.
With the IRegistry class for sure.
Oh, I already have the registry code
I meant what bukkit event to have it happen before any world shennanigans
oh event. Ive read that as "What even would I register the entity type at"
As early as possible. onEnable and make your plugin load before the worlds.
You want the entities in the spawn chunks to be serialized as well.
in the plugin.yml
load: STARTUP
So
Is there a way to make a hoe break dirt at the same speed as a shovel
Not unless you give the player haste
What is the expected outcome if a plugin fails to clean up an async repeatable task as the server shuts down - does the scheduler throw a stacktrace or is it suppressed / warned ?
is there are any plugins that give custom % of damage received with armors
if (p.getInventory().containsAtLeast(new ItemStack(Material.STAINED_CLAY, t.getWoolColor()), 1)) {
System.out.println("contains item");
p.getInventory().remove(new ItemStack(Material.STAINED_CLAY, t.getWoolColor()));```
why no work
it contains item
i cant belive there is no public plugins for that
i mean i searched a lot
most dont work and rest dont have this feature
such basic feature
Can anyone help me please
public void InitPathfinder() {
super.initPathfinder();
this.goalSelector.a(1,new PathfinderGoalFloat(this));
}
}
the goalSelctor isn't working
??
is there a fullproof way to make pvp normal (so you can spam click)
in 1.17
and disable cleaves for sword
Pretty sure itโs because youโre applying โnew ItemStackโ to it
Just containsAtLeast(Material.STONE) for example
#help-development message
I'm not asking to ask the question is in the top of the thread, can someone please at least check it out?
Use bP
goalSelector -> bP
Sorry I don't understand can you edit my code please
can someone help me? i made a custom crafting gui, but it has some bugs
code for the events of the gui: https://hastebin.com/ibitububub.java
bug 1: when i put a recipe that is not just 1 item i have to click an allowed slot in the gui to update it and only then it puts the result in the result slot
bug 2: after i do bug 1 and take the item from the result slot it will remove 1 of each item in the crafting grid, let me take the item but then it will put another one in its place, then if i take that one it will just give me another one and disappear from the result slot"
Why dont you just open a crafting table instead of creating your own?
idk
Hello, can anyone give me a hand?
I've got a class that reads a lot of data and then has to store it
config files
let me type ๐
So I've got it all in a config file like so:
illnesses:
slowvid:
# Name of illness
name: "Slowvid-19"
# Percentage chance of horse getting it
percentage: 5
# prevent illness from recurring again
preventReccuring: true
# You'll get an error in console if this is not recognised
potionEffectType: "SLOW"
# Multiplier of potion effect
multiplier: 3
# Command to vaccinate horse.
# Keep in mind it will be after /vaccine, for example
# /vaccine slowvid
command: "slowvid"
# Permission for vaccine command
permission: "horse.vaccine.covid"
And then I read through this using a for loop
And I have all my data in the respective strings and integers
So in my IllnessManager.java class I've got a string called 'name' which can successfully read the data from the config file
Only thing is I want to have mutliple illnesses
e.g.
illnesses:
slowvid:
...
anotherone:
...
How should I store all of the data within my class so I can easily access it? Like should I dump it all in a list?
Example:
public class IllnessManager {
public final Map<String, Illness> illnessMap = new HashMap<>();
public Illness getIllnessFromName(final String name) {
return this.illnessMap.get(name);
}
public void loadFrom(final FileConfiguration configuration) {
// Load the config into the Map
}
}
So in the map you've specified <String, Illness>
How would I create an Illness object? You can send me a wiki on it or something - new to java ๐
might want to follow a java tutorial first then to learn the base concepts
?learnjava
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.
has some nice starter tutorials ^
Are the illnesses dynamic or predefined? Because dynamic would mean that you probably need abstraction.
Predefined means you can use an Enum and things will get easier.
Just change goalSelector to bP
The illnesses are user-defined, so basically the user puts in the potion effect they want and a name and then the plugin automatically gives the horse an illness, described under the name and potioneffect specified in config
So I should be able to use an Enum
Ah i see.
Probably not
Thank you! I'll fiddle around for a bit and do some research and try and get it working ๐
Thanks for your help @lost matrix and @eternal night
public class IllnessManager {
public final Map<String, Illness> illnessMap = new HashMap<>();
public Illness getIllnessFromName(final String name) {
return this.illnessMap.get(name);
}
public void loadFrom(final FileConfiguration configuration) {
final ConfigurationSection illnessGroupSection = configuration.getConfigurationSection("illnesses");
for (final String illnessName : illnessGroupSection.getKeys(false)) {
final ConfigurationSection illnessSection = configuration.getConfigurationSection(illnessName);
final Illness illness = new Illness(illnessSection, illnessName);
this.illnessMap.put(illnessName, illness);
}
}
}
public class Illness {
public Illness(final ConfigurationSection section, final String name) {
this.name = name;
final String effectName = section.getString("potionEffectType");
this.potionEffect = PotionEffectType.getByName(effectName);
this.percentage = section.getInt("percentage");
// And so on
}
private final String name;
private final PotionEffectType potionEffect;
private final int percentage;
}
You should be able to figure out the rest.
If not then i recommend the tutorials from above ^^
Thank you so much!
At least he's helpful ๐
someone pls help
its not spoon feeding if hes not asking for it
what kind of logic is that
7smile is just being kind
um you should read their name again
also how they bein kind
oh wait ur talkin about urself
yeesh butthurt are we?
???
vro you ain't makin sense
?
use ?paste
what's with people not making any sense today
???
idk
๐
i'm not judging people on their java skills?
vro wtf is going on today
then why u mad
is there like a requirement to judging people?
lol
you must be this high and know this much java to judge people?
i think you need to look at a mirror @lean gull
i swear everyone here is conspiring against me to confuse me ๐
please get some thicker skin
see? i told you i'm not crazy!
i told you all!
wtf is that even supposed to mean, your langauge sounds like it comes from a mumble rap community
hes speaking code ๐คฃ
?ban @hybrid spoke disrespectful behavior
Done. That felt good.
Stop harassing
what
What did he do?
tf
I was reading his message he replied to me xD
even i don't think that's a good reason to mute
wasn't a mute
i mean ban'
he banned he didnt even mute
i mean ban, ok?
Iโm tired of people being uncivilized here now
um ok
He said something about math so I'll reply to that...
Derpy posted specific slot integers no math could be used to get them...
damn
dont mess with @ivory sleet ๐ฌ ๐
And for the record, that was not the first time he did something like this.
I know. lol
๐ฌ
ok true but you could have muted him
Thereโs no mute
damn
is that ban perm?
Like it hasnโt been implemented
thats sucky
Yeah weโve been asking for it quite a while
You can mute... just takes alot more work then banning xD
anyways, can anyone help with my bugs?
relist them please
Yeah I have a bot add a muted role
^^^
Or just have a bot remove messages posted by the user
u would still be able to see the messages they're sending for a split second
Thing is, md5 hasnโt added that so itโs not possible as said earlier
But it pisses people off that their messages get deleted ๐
fair, fair.
add a timer before it gets deleted too that'd be funne
md5 should do da funy
Inventory clicked = e2.getClickedInventory();
List<Integer> slots = Arrays.asList(11, 12, 13, 20, 21, 22, 29, 30, 31)
slots.forEach(slot -> {
ItemStack item = clicked.getItem();
if(item != null)
item.setAmount(item-1);
// Also need to set item to null if amount == 0
});
``` Implement this code then repost your code.
I want to make an event that teleports you back up 200 blocks when fallen through void and turns off your fall damage, checks the block under you and sets your hearts to half a heart. How can I implement the turn fall damage off in my event?
Player player = event.getPlayer();
if (event.getTo().getBlockY() == 0) {
player.teleport(player.getLocation().add(0, 200, 0));
//turn fall damage off
if (player.getLocation().getBlock().getLocation().equals(-1)) {
if (player.getLocation().getBlock().getType() != Material.AIR) {
player.setHealth(1);
}
}
}
Ah I see what he meant about math now. Because of the grid pattern. Meh a list of the ints suits fine.
i dont understand how yours would be more readable
isnt this loop way more readable
no?
that's my opinion, atleast
well thats a you problem then ๐
sadge
Thats fine. Not judging. Just would be easier for me to read it thats all.
any help?
conclure epicgodmc202 hurt my feewings
:(
am so sadge now
:(
@lean gull have you debugged and found out which if statement discontinues the code block?
is conclure your helping hand for banning people now?
idk what code block u mean and what's a code block but i think i figured out something (that may be what you're asking for)
so basically it checks all the items first for a recipe and then it removes one of each, but the thing is that can be what's causing the bug
i tried switching their places but then it broke even more
i forgot why this is lol
The method*
So what exactly is the bug then?
1 sec lemme check my message
You very well know the rules yourself I hope. I donโt side by anyone however I do act what I think is reasonable depending on situation.
this is the message, i just can't remember why i thought that was a problem
you... you do realise that was a joke, right? right?
Iโm serious
no i mean what i said was a joke
Alright
Debug it is all I can say. I might be misreading your bug but I don't really understand it.
Maybe get a video?
you do realise that was a joke, right?
How to stop fall damage in an event?
sure
conclure i can post streamable links, right?
eh i'll just dm it
Those r fine as long as theyโre relevant however it wonโt show an embed
Since youโre unverified
ok
as you can see it lets me craft it twice, and for recipes that are not 1 item per recipe i need to click an allowed slot in the gui
is docker-compose.yml an example of this
what?
docker-compose is for docker compose, he means a plugin yml
oh so i include my db configs in the plugin.yml
no, a yml file within your plugin folder (usually config.yml)
plugin.yml is strictly for plugin configuration
where would that be located... as in: where within my plugin directory
Anywhere, you can define your directory structure.
Just as long as its in that folder.
word... so i'm passing it through "src/main/resources/config.yml"
ohh
i still need help btw, pls
unless you want to hardcode db settings in
nah cuz people can easily decompile jars lol
You can copy it to your plugin directory though. Call saveDefaultConfig() in your onEnable()
i'm aiming for secure in case people actually want too use this
could you resend your code pastebin, i cant seem to find it
^^^
Leave security up to the server host. If people can't get into the File management, they can't access your file.
okay. so i'm presuming once someone runs the jar it should install the config.yml to the proper location on the hosts system?
does that grant the host access to the database password and such
yes
Is there any way to stop your server from picking up the teleport in your tp event?
Well, the config just allows the user to define the database username and password for the plugin to access it.
The host doesn't really care what the password is. Your plugin does.
if (Bukkit.getCraftingRecipe(slots, e2.getWhoClicked().getWorld()) != null) {
e2.getClickedInventory().setItem(24, Bukkit.getCraftingRecipe(slots, e2.getWhoClicked().getWorld()).getResult());
} else {
e2.getClickedInventory().setItem(24, null);
}
is also redundant
if it is null, you are setting it to null
and you arent removing the item after the fact, thats why it is duplicating
since its on a scheduled task, it will set the result again once they pick up the result
help?
oof... so each user that downloads my plugin will have to define their own username and password for it ?
I mean
If you're trying to support SQL databases
That's a good thing
Since people can use their own databases instead of yours
(And anyone using SQL in the first place probably has their own DB setup)
https://hastebin.com/qixotofori.java could be cut down into something like that derpy
so i guess il'l include notes about that in a potential README
"define your database stuff here"
i mean its self explanitory with the variable names craftinc
can also have a message on startup saying "You have not defined database stuff"
You can support both flatfile and databases.
public void InitPathfinder() {
super.initPathfinder();
this.goa
}
like it does give me the option to select goalslector
Ahhhhhhh
please someone helpme
Be patient
i ask this question 6 times
but yeah i get what you mean
Create a thread
??
A discord thread
ohhh
do you mind if dm you the issue
Probably need to use it's obfuscated name if it's not auto completing
Post it here in detail. More people will see
Or your class doesn't extend an entity that has a goal selector
public class custom_mobs extends EntityWolf {
public custom_mobs(Location loc) {
super(EntityTypes.bc, ((CraftWorld) loc.getWorld()).getHandle());
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
this.setHealth(2000);
this.setSprinting(true);
}
@Override
protected void InitPathfinder() {
this.setGoalTarget(2, new PathfinderGoalFloat(this));
}
}
this is my entire coded
i am sorry ??/
You're using 1.17 right?
I know 1.8.8 is outdated, but how can I spawn particles? There's no spawnParticles like there is in newer versions
Last time I tried to use playEffect it did nothing
That was in 1.16 though, so it might be different in 1.8
#playEffect
1.9
OH
so hikari handles files on its own right? no need for using this ?
https://www.spigotmc.org/wiki/config-files/?__cf_chl_jschl_tk__=pmd_RwI9.k7N4el6od.K3Eg3dOtsS14hRiAa60MPua7pmfY-1631199356-0-gqNtZGzNAeWjcnBszQi9
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
or do i need to use that still
what does hikari have to do with handling configuration files?
you can create a hikari config from a properties file if you want, but that is as far as it goes
Hikari is for SQL
well, i need to create a config file for my database
and hikari is my connecting api
Please, read the java convention
as in a place for users to configure their connection
yes
And not a plugin config
you can load it yourself, or hikari probably has a way as well to use some standardised file or something
it definitely does
i guess that brings me to my real question xD sorry i wanted to make sure i understood all that before i went forward... when passing files in and out of my plugin class where is the root of the path. im' getting a "file not found exception". String configFile = "src/main/resources/db.properties"; i guess i'll move it outside of the plugin. just need to know how to construct the path
and to continue off of what i was saying before about config files... hikariCP uses a file called db.properties to configure the database. THAT sounds like it would be my config file.
In this Unity game development tutorial we're going to look at the mathematical function, Lerp, or linear interpolation.
This function allows us to linearly interpolate between two values, and is most commonly used for changing values over a period of time.
While its usage is really common in Unity, it's quite often misunderstood, and can easi...
6:00 does anyone have any idea how i can add this in java? some feature that does something similar
this must be the first time i have seen a woman-narrated programming tutorial
women in dev is awesome
No more than a man. The placement of ones sexual organs should not affect how awesome you are.
#egalitarianism
๐ pogging
it should be equal, but sometimes the treatment of women in STEM in atrocious
Yeah - i just meant it in the sense that i dont really see many, not that they are in any way different
tf
hmm?
cant seem to find on how to make a custom entity drop custom exp
how can i make a task executes every 1 miliseconds?
spigot tasks can only execute every tick (so around 50ms). That is the lowest it will get on the main thread
anything below you'd have to start your own thread and use Thread#sleep
tho you cannot interact with most parts of the spigot API off the main thread, so it won't help you much
i tried that to make the armorstand perfectly follow the entity
since 1.8 nametag bug is a thing
but when the mob move too quick the name tag move very strangely
why copy hypixle skylblcok
concept
btw i cant do public class Blahblahblah extends EntitySkeleton
it just gets colored red
p o r q u e?
anyways, ways to fix this?
invalidating cache does not work
yes
hover that red thingy
it gives nothing
its the english and profile picture for me
not what hes asking
ok so discuss it clearly
bro
you're literally causing confusion
and telling people to talk clearly
????? logic??
meh i will create a thread
public class (whatever) extends EntitySkeleton doesnt work
hen passing files in and out of my plugin class where is the root of the path. im' getting a "file not found exception". String configFile = "src/main/resources/db.properties"; i guess i'll move it outside of the plugin. just need to know how to construct the path
and to continue off of what i was saying before about config files... hikariCP uses a file called db.properties to configure the database. THAT sounds like it would be my config file.
?paste
i want to use hikariCP because (if i understood correctly) i don't need to create a new connection for every time i need to give the data base data
using the JDBC seems a bit heavier in that you have to create a new connnection everytime
what
Where did you hear that JDBC makes you make a new connection for every query lmao
new pfp! (:
Oo
idk. but someone here suggested i use hikari instead of JDBC
Depends on your use case
JDBC is verbose and annoying to use but you can easily make a wrapper (or use an existing one)
I have never used hikari but I know it's for connection pooling
well, i basically want to make a query every time a useful log message comes through.
hey i want to make a simple cluffing plugin when someone right clickes the other entity the entity will be moveless until player closes the inventory.
((Player) clickedEntity).setWalkSpeed(0.2F);
}```
I cant open while loop cause server is crashing i keep entitys walk speed at 0 until player closes his inventory, after that if player closes his inventory want to set entitys walk speed 0.2F again
as i said above how can i do that. Code: https://paste.md-5.net/tofimaduna.java
don;t mess with speed or any of that, just flag teh player as locked, and prevent movement in PlayerMoveEvent
After you get that event you can just set their walk speed back to 0.1
where should i listen inventorycloseevent
Alternatively you can stop them from moving with potion effects (high levels of jump boost overflow to become negative; the player cannot jump, and slowness can prevent movement)
You already have a listener
Just make another
so i need to make new event
essentially, i'm gonna access the log messages (i would prefer as strings) and parse them to see if i need them. basically its supposed to be a discord bot that uses the database populated from the plugin to post useful messages to a discord channel
what database connector do u suggest?
at least on the spigot side
public void InventoryCloseEvent(InventoryCloseEvent e) {
}```
Wait why do you need a database for this
Is it going to be used for anything other than putting the messages in the channel?
nah
not yet
my original thought was to output the log messages to a text file and read it from there
then delete em
to save space
is there a socket interface that comes with spigot?
Would both of these return a ItemStack with the material GOLDEN_APPLE with the method getItemStack()? ```java
new ItemButton(Material.GOLDEN_APPLE);
new ItemButton(new ItemStack(Material.GOLDEN_APPLE));
any like good nms tutorials?
that dont have 1st step : Print out "Hello, world" 2nd step: make a self driving car from scratch
Yes
Great, thank you.
๐
i just wanna make my custom entity somewhat smart :(
goals is a pain
Tho I believe paper has an api for it, not to glorify by paper by any means however maybe see it as an alternative to nms
idk i just want to make my entity not run into walls every 2 seconds
no
Good
just a skeleton boss
Flaying entities are a true pain
fax bro
i got an entity that isnt made in nms
ok will do
head over to public class (whatever) extends EntitySkeleton doesnt work
the thread
Like me Ofc ๐
โบ๏ธ
@waxen plinth can you suggest any popular java "socketing" libraries?
or are there any ways to talk with the file descriptor table like in c
Like a web socket or just sockets?
If itโs just sockets I think netty has some framework stuff for it
it's a socket on localhost
Why do people gotta keep pinging me for things they can easily google
Just look up "java sockets" it's not that hard
is there any way i can make my custom entity deal certain DPS to the spawner?
???
A spawner is a block
It doesn't have health
Or do you mean modify what the spawner is spawning so that the enemies deal a certain DPS to players?
no. my own made custom entity (with custom metadata), that deals certain DPS to players
by the "spawner" i mean the player who spawned it
I know its a bit stretched but I could make a custom item class that manages the meta and display name etc. of a custom item, so that i have a better foundation to easily make new custom items. I just want to know if anyone has any tips or sources that can help me? Thanks
Do you have it publicly available? I would like to see how it's done since i have no clue :p
hmm
I haven't tested it
like tested the individual units
so idk if it works
and im not done yet lol
oh ok xD
tho if u're interested still I could add u to the gh repo
and in that case dm me ur gh name
That would be great
gh - github
elaborate
And Scorboard
ugh if i create a new object in a class method does that creates an new object every time the method is called or not?
๐ณ
like
Heh
CommandFly cf = new CommandFly();
cf.fly(p, vanish, false);
I don't know what this is but it really looks like it can't possibly be good
like maybe i could write new CommandFly().fly(p, vanish, false)
Why are you instantiating a new object just to call that method on it and then never use it again
iknow
And why is it CommandFly if it seemingly has nothing to do with a command
its a command :/
use static
If it's a command then why are you instantiating it like that
It should be a singleton at least
you should keep the CommandFly instance somewhere cached at the very least
so what, it makes perfect sense to have it static then (if the #fly method is a utility method, otherwise it might be more of an issue).
i cant access a non static player uhu
but the fly method can be static?
like this is the method
public void fly(Player player, boolean fly, boolean message) {
if (fly) flyingPlayers.add(player.getUniqueId());
else flyingPlayers.remove(player.getUniqueId());
player.setAllowFlight(fly || player.getGameMode() == GameMode.CREATIVE);
if (message) Utils.message(p, fly ? "&aSet fly mode enabled" : "&cSet fly mode disabled");
}
is flyingPlayers static?
if i make the command executor static but that will lead to the same player on every command
yes
I am big dum dum
So got question how would I stack items in getDrops Collection
thing is I got like 64 seperated ItemStackes by 1 stone
when I add them
to palyer inventory
they take seperated slots
i call the fly method in a vanish command
this seems not to work
just delete the override?
no, delete the method
Java allows for implicit overrides, which can be quite the pain if not intended, which is why the override annotation exists
delete this one?
yep
'runTaskAsynchronously(org.bukkit.plugin.Plugin)' in 'org.bukkit.scheduler.BukkitRunnable' cannot be applied to '(me.powerbutton.kaboom.SMPCore, long, long)' but then this shiz, but it is part of my poor java knowledge
Okay, and are you sure that you want to call runTaskAsynchronously(Plugin, long, long) (which does not exist in bukkitrunnable)?
is there a way i can make it working? because ComponentBuilder is a final class
what should it do in the first place?
ChatComponentBuilder its for the chat
so how can i make it working?
you see, there are likely better alternatives than .. this
in the current state, impossible without transforming spigot - which uhm - isn't a great idea
which one?
Well, it's a builder - builders usually don't need to be extended
Well, if I knew what it is I could say it - but looking at the code I cannot deciper easily what it should do
ah
how can i check if my custom entity is alive?
doesnt seem to work
you'd probably want to use !isDead tbh
hm ok
or just both for maximum efficency
i did that
meh will continue tmr, if u want to help me more, just dm me
going asleep. bye
Hello everyone. I'm working now on a class to create custom books for 1.8 to 1.16.5 but i have a problem on the reflection for the 1.8 to 1.16 (excluding the 1.16.5 because It works in an other way). My problem is that I want to set TextComponent object in the book but we cannot just put textcomponent.getText() and I don't know why. On a website, someone did something similar but for me it does not work and I have some errors, like something for the setLenient(boolean b) method from the Json.
The way i'm doing this (like other plugins) is that:
TextComponent mainCompound = new TextCompound();
TextComponent base = new TextComponent(string.text);
base.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, string.value));
mainCompound.addExtra(base);
// some other code with the mainCompound...
versionName = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
craftBookMetaField = Reflection.getClass("org.bukkit.craftbukkit." + versionName + ".inventory.CraftMetaBook").getDeclaredField("pages");
chatBase = Reflection.getClass("net.minecraft.server." + versionName + ".IChatBaseComponent$ChatSerializer");
Object object = chatBase.newInstance();
Object page = object.getClass().getMethod("a", String.class).invoke(object, ComponentSerializer.toString((BaseComponent) mainCompound));
List<Object> p = (List<Object>) craftBookMetaField.get(meta);
p.add(page);
this.book.setItemMeta(meta);
All this works for simple Strings added in the invoke method
With this I have the error com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8
i think you can use the spigot api for that
You mean bookMeta.spigot().addPages() ?
maybe
Let's try
Hey! short Question! I try to connect my Plugin with a MySQL Database. I have created the following class for this purpose:
In my main method, I first create the Config.yml and also execute the following:
https://paste.md-5.net/igabadipup.cpp
However, I get the following error:
This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable.
For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.
Cannot assign requested address: connect
and the following line is given as the source of the error:
try (Connection conn = dataSource.getConnection()) (its in the first block from my message)
Does somebody know how i can fix this?
?paste
It does not exist for 1.8
sad
ok sorry, I have improved it
How can one calculate the Players y Motion without relying on the client to send me the informations?
Because people bad, people cheat
wdym
I want to calculate how far the given player fell in an specific time
Only reliable way to do that would be to compare their location each tick
Ok thx
Found a good and reliable way
I check if the player is reporting he is on the ground, actually check if he is near a block in his y location value
And if the client and server conflict I flag em
Anything wrong with how I try to achieve my goal?
You could have a rounding issue as x/y/z are doubles
I've not checked to see what y value is "on the ground"
It sounds a good plan
Because only the client can lie to me D:<
You would need to check auto step and the real Y value variance (if any)
Looking for some help possibly. Im using citizens2 and trying to get a npc to generate locations between locations, essentially creating waypoints at a specified range, each moving closer to the destination.
I have a working system but its pretty "dumb" as is just takes the direction/vector from the npc's location to the final destination, moves whatever the specified range is in that direction, then finds the highest block at that location, and sets the npc's target there. Issues are that if a mountain is inbetween the waypoint will go straight into it and then staight to the highest location, which will usually end up out of the pathfinding range. I currently have citizens pathfinding range at 75 blocks and the waypoints generator at 30. I can only think to increase the pathfinding range or reduce the waypoints generator range to try to mitigate the issues. Another issue is when the npc is in an area with many trees or in a cave, most likely a waypoint will be generated at the top of a tree/cave, causing the npc to teleport or get stuck. Im very concerned with performance and being as lightweight as possible. There may be hundreds of these npcs wandering the world.
Another question, are you aware of a way to process pathfinding on another server? Is pathfinding async?
When using player.getLocation().getDirection() is it possible to go from the head, not the feet?
getEyeLocation()
thanks
do I replace player.getLocation() with player.getEyeLocation()?
@eternal oxide I did that and its still going from the feet
Then you did something else wrong
ill try compiling it again
@eternal oxide can u call me just so I can share my screen, i'm gonna mute you can if you want to
Use your words. Be descriptive
what is coming out of your feet?
Bukkit.getLogger().info("lol");
Bukkit.getLogger().log("lol");
Difference??
First one specifies the log level, second one uses the default
info, warning, severe
and where is log on that scale
log is the action. It has no scale
actually your code will error. The second will not compile
log with a single argument takes a Record not a String
is there a way to get the last output from console
No, you add a handler
alright so i need some help
I have two coordinates, and I'm trying to calculate X amount of points between those locations. However, they need to be in the shape of a (Festoon?, Garlands?)
I would like the points like the circles in the image
โญ math ๐คฉ
How do I make plugin wait for player's response?
Math, indeed. I'm no genius lmao
https://www.databaseusers.com/article/7885310/ Find teh third point then calculate your points using the radius
wdym? what is their response?
Well that depends. If you want to have a perfect circle, that's correct. Though if it's at all elongated this won't work
Oh man, I'm way in over my head lmao. Should've spent more time at math class...
Bezier curves might be a better approach
Like I type /calculate and then plugin wait for my response
/calculate
I type: 4+1
and then i get message
got any tutorials for api?
Conversation API seems overkill for this
yeah
it just depends
on whether they wanna implement it manually
You just need a listener for the chatevent and then just add/remove players to listen to their messages
oke
Yep bezier would give him more control
ty
calc command -> {
chat listener
runnable {
wait 10 seconds
remove player response
"You took to long!"
}
}
I would actually like them to be perfectly straight
The link you sent is to like an unsolved thread. Is there any tutorial or something i can use? It's my first time doing these kinds of maths using java
Do you know how I can do it for 1.16? Its asking for a list<pair> how would I do that?
if you want a simple implementation you could just form a quadratic curve from your two points and transform (stretch) that function to control the slope
Try to draw a circle/elliptic but only the half of it with the distance of the two point as diameter
p.getInventory().remove(new ItemStack(Material.STAINED_CLAY, 1, (short) t.getWoolColor())); isnt working
i have 18 of that type of clay
but it doesnt remove it
Isn't the meta a byte value and not a short
idk
maybe?
i fixed that
still same thing lol
no errors
just doesnt remove item
if (p.getInventory().containsAtLeast(new ItemStack(Material.STAINED_CLAY, 1, (byte) t.getWoolColor()), 1)) {
p.getInventory().remove(new ItemStack(Material.STAINED_CLAY, 1, (byte) t.getWoolColor()));```
thats my code
Is it passing the if check
wouldn't have compiled
no it isnt
It is
he is using the 3 arg constructor
Then there's the problem
that is not the problem
assuming they're using 1.8 (why?), the wool colour was stored in the durability
yes
Hm you appear to be right
wool color must use getWoolData
Anyway I'm off to bed now
So, how do I register the attributes for my custom nms entity?
The map for it is a immutable one
Torturing myself with spigot for a friend and hating every second of it
how about you
Not much really, just being lazy and getting nothing done while I plan out a theoretical programming lang in my head.
Cool
I am more moving towards hardware and low level os stuff
Anyway, about my question
My custom pathfinder entity cannot be spawned because the default attribute registry lacks the type
And due to the map being a immutable map, I can't just add to it
Is there a way to add one, or do I have to read the map, copy it, add it, and reassign?
what does this mean exactly?
net.luckperms.api.LuckPermsProvider from LuckPerms v5.3.65 which is not a depend, softdepend or loadbefore of this plugin.
is it hard dependency ?
it means youre loading a class from one of your dependencies that isnt declared in plugin.yml
doesnt do anything if you have (in this case) luckperms installed on the server but if you dont you could run into issues
aka, doesnt matter if you know what youre doing (and have that dependency already on your server)
matters if youre making a publicly available plugin where a lot of people dont know what theyre doing
no worry i always think if it is not null and plugin is enable
i were hooking into the plugin just need to know why the output
add it as a softdepend
ah
or, if you plugin can not work without it, add as a depend
Well for the stick use the PlayerInteractAtEntityEvent
ProjectileHitEvent is what you want
you want to know when the egg hits the player not when the player throws the egg
ProjectileHitEvent > hit entity is player > projectile itemstack is ban egg > ban player that was hit
?
ok? what do you need help with
getHitEntity
declaration: package: org.bukkit.event.entity, class: ProjectileHitEvent
just wondering, whats this "ban egg" for anyways?
? you ban the player if they lose
huh
ok
does bungee have a discord? cant find anything on it. I'm tryna get assistance with plugin messaging
i love you
๐
So basically, I have my main server where I have players sorted into a group for a minigame. Then after I have a group that's ready to play, I want to send a command to my other server to start generating new worlds.
I know how to teleport the players to the other server, but I don't know how to send the "message" to tell my second server to start generating worlds
how can I get the location a player is looking at?
like a block thats within a 100 blocks of a player or so
I'm currently trying to update a plugin from 1.12 to 1.17.
Does anyone know the equivalent of this/if it still exists
import net.minecraft.server.v1_12_R1.IChunkLoader;
iirc there is a getTargetBlock
?pmc
I saw this. But all of these receivers are players. Thats where I'm confused cause there won't be any players on the second server when I send the command to it
cool it worked
Is there any Player event related to elytra flight? I'm looking in the docs but can't find anything
^Might add, my goal is to implement 1.8 1.18 Elytra mechanics into 1.17.x
1.8 didn't have an Elytra so you're disabling it? 
Ah yes I love that idea
Well how are you going to implement non-existent mechanics 
Oh I see the edit now
The only Elytra events I know of are EntityToggleGlideEvent
Hmm I'll see what I can do with that. Thanks
can I cancel teleport event seamlessly?
it doesn't necessarily cancel the event, but teleport the player back
I want to cancel lots of unwanted teleports
What kind of teleports
wdym?
none of them
So which then
It's not going to fire an event for that afaik. Kinda sounds like a performance issue.
it does for some reason
you got an anti cheat?
I'm trying to make a plugin which removes the vanilla anticheat
tnt cannons and those stuff work properly then
vanilla doesnโt have an anti cheat?
Isnโt that a spigot thing
bukkit
I'm just trying to get rid of it anyway
Kicked for flying can be disabled & you'll probably have to modify the server jar to get rid of the disconnect.spam
currently managed to remove illegal characters in chat and kicked for spamming and kicked for flying (there is config)
The illegal character one is there for a reason, you can end up crashing clients.
Only real way is to intercept the outgoing packet
yea, doing that, but I don't know how to get the cause of it
since I can check the getcause on teleport event but I don't know how to on teleport packets
I don't mind

also, I can't just get the teleport event's cause since that (at least to my knowledge) fires after the packet has been sent
You can crank up the moved wrongly threshold in one of the config files
does that even work though?
it just made the server not boot at all or just did nothing for me last time
but there's one more left, the one that blocks players from going through blocks
You want to disable block collisions...?
I assume they want to disable the server teleporting players back if they somehow end up on the other side of a block?
Maybe they want a super anarchy server
why does https://pastebin.com/nuWmQhcV give me this error: https://pastebin.com/YYiKywM1 ? im trying to get the all of the config sections in a list to see if a message contains one of them, for example the config could be:
- stuff
test2:
- stuff```
and i want to check if the player sends a message containing stuff 1 or stuff 2
so how else am i supose to get the config sections
use it as a set
then how else am i supose to check if a player sends a message containing 1 of the config sections..
Store it in a Set<String> variable
alright il try it thanks