#help-development
1 messages · Page 728 of 1
It feels wrong to do so
the internet doesn't really synchronize and most of it just fails to work
like fr who the fuck is your target audience
Thankfully your computer pulls time from the internet
don't write filler plugins just for the sake of publishing shit
average vk2pgz moment
Ah the wonders of the Atomic Clock
But what if those are wrong!
ok himothy him
What'd you give? List of contributions now.
You haven't really given much, tbh
goddamn I must've designed humanity if you did that much with just 6x 5 minute plugins
You never know when the physical properties of a caesium 133 will change
what are my countless guides into advanced topics, such as multithreading, completablefutures or static abuse compared to "Pi", which displays a hardcoded message when you run a command

Just have high standards for yourself for a moment
You got a multithreading topic?
Honestly pi just feels like something someone would add just to meet the premium plugin requirements
and what solutions we use in the real world (synchronization, queues)
just look for this and give it a read
You think it's good enough to apply to databases?
No one seriously goes I want to run Spigot on my phone
ehh databases are wack
eh
no clue how you want yours to work
The usual approach is just to make an interface and your own 19 impls
Yea, but then I end up with a bunch of empty methods that don't do anything in certain impls
You just make a fake player sleep, of which there are multiple threads I'm sure of
something stupid like
public interface MyDataStorage {
CompletableFuture<Boolean> tryEnable(ConfigurationSection properties);
CompletableFuture<MyData> fetchData(UUID playerId);
CompletableFuture<Void> storeData(UUID playerId, MyData data);
CompletableFuture<Void> deleteData(UUID playerId);
CompletableFuture<Void> flush(); // Can be replaced with an executor. Join this onDisable
String getName();
}
And some other stupid stuff for remote databases n stuff
And then you have a registry where you toss all of them in and handle fallbacks n stuff
essentials? Massive contribution to the minecraft community as a whole
https://www.spigotmc.org/forums/spigot-plugin-development.52/?prefix_id=48
quite a few of these are huge contributions too
public class MyStorageRegistry {
private final Map<String, MyDataStorage> storages = new ConcurrentHashMap<>();
private String chosenStorageName;
public void register(MyDataStorage storage) {
storages.put(storage.getName(), storage);
}
public MyDataStorage get(String name) {
return storages.get(name); // You should probably validate that `name` isn't null
}
public CompletableFuture<Boolean> tryEnable(FileConfiguration config) {
chosenStorageName = config.getString("preferred");
...
}
}
I have a fallback system for example
In case mysql fails to load it automatically falls back to sqlite
y'know it's really up to you
a plugin which print PI? Honestly, it's only a contribution to the already massive amount of poor quality resources on spigot
not 1000% how I'd do it nowadays but still an interesting topic
I got some work ahead of me then. :p
I'm trying to make a multi-database system that will also have a fallback to regular flat file storage. (Mainly cause I haven't completed the sqlite impl)
I just think I could be doing better, but don't exactly know how to fix it yet.
You can make life less painful by just supporting like
because it's too tied down to a single data storage type
a few common databases
nightmare
even https://www.spigotmc.org/threads/list-of-found-malware.389467/ is a greater contribution than a PI plugin, although I haven't updated it in a long time lmao
Alright I think the lad has been roasted enough
let's start rapping on him
Time to make a diss track
wait I thought this was #general
#general is a vibe, not a place
this is also a vibe
This currently has the #general vibe
I want to re-do this however, better though
Need a spigot-zone channel.
Hey there is a domain for that
Make a website for it. You can do it a 1000x better.
Use a set instead of a list
Yea, I plan on it. Just not entirely sure on how I want to impl it though design wise
kek
Something like one of these two would be cool. I'm just not sure how the backend is handled.
Left looks nicer
would also require a separate page per item though 🤔
Not that hard if they all follow the same format
I'd still have to decide on other things, like if the page creation is handled client side or server side
What you'll be showing on the page will depend on what you are storing.
make all pages by hand
^ yeah
Might be genned client side by just looping through the api results. I'll have to check later
okay nvm, I suck at the game I was playing
I'll check now lmfao
Lol
It’s pretty easy to generate a page with the api results
Also saves storing a bunch of pages
note: I know exactly 0 front end stuff
Not difficult for me to do backend, front end though is 😬
You really just need one page design for how you want to display a result. Then just load the data when the user goes to the specific malware page.
Yea, but I'd still need to know the HTML, CSS, and JS to actually make the page
of which I do not know
Making it look nice is its own thing
something else I don't know how to do
Ur just bad. CSS is hella easy
Watchu talkin about?
I'm just not good at making things look nice 🤷♂️
Hey I can make it look like an early internet website no problem
Nice and simple and clean
But nah modern websites need all the fancy schmancy stuff
I can't even do early internet lmao
The websites that rely too much on JS are the problem. CSS is very fast and people just aren't taking advantage of newer features.
Hell, I'm having issues just recreating things that already exist, let alone doing something myself
You get a basic nav bar
You get a simple page with some tables and maybe an image
Take it or leave it
1v1 figma rn
eh.
I’m a Frontend
I'd want it to look nice, not shit
That doesn't mean I'd be able to make something nice out of it
.
Frameworks are also kinda restrictive
I can use bootstrap all I want, I can't make shit w/ it because I can't come up with an actual design
Wikipedia
No
Bam perfect design
no no, you can't make shit with bootstrap because it sucks massive donkey dick
Not for what I need
Fuck I was gonna say that
Can it magically generate CSS for me
Not really. That's what some of the 3rd party plugins are for.
I see
The autogenerated stuff is kinda bad. Even with their recent update
Why do you think I handled the BTGUI? lol
“Does this line of CSS make it look nice?… nope”
“How about this one?… ope now the entire website is fucked”
Heh
I mean, you saw the process. The first one I made was kinda bad, so I remade it and it is what it is now.
It's just a process thing
Can only get good at it with practice
i tried recreating the issue in a new project but couldn't, i modified the original code to be this:
for (Path path : paths) {
if (Files.isDirectory(path)) {
ItemStack item = new ItemStack(Material.YELLOW_WOOL);
if (data.getDeleteMode()) item = new ItemStack(Material.RED_WOOL);
folders.add(itemProperties(item, ChatColor.YELLOW + path.getFileName().toString(), List.of("Folder"), "folder"));
}
else {
System.out.println(path.getFileName().toString());
String a = "§f" + path.getFileName().toString();
System.out.println(a);
ItemStack item = new ItemStack(Material.WHITE_WOOL);
//if (data.getDeleteMode()) item = new ItemStack(Material.ORANGE_WOOL);
System.out.println(item.getItemMeta().getDisplayName());
//item = itemProperties(item, a, List.of("File"), "file");
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(a);
item.setItemMeta(meta);
System.out.println(item.getItemMeta().getDisplayName());
files.add(item);
System.out.println(files.get(files.size()-1).getItemMeta().getDisplayName());
}
}```
and it now outputs this result, i am totally lost.
(i can't send images)
@vagrant stratus Do you have any idea what you want it to look like? Or better yet, what does the command line stuff look like?
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
i just sent it in a different channel and sent the link to the image
but i am so lost with this
the varable changes when i don't change it
CLI? there's no CLI for any of the projects lol
I must be lost then. What are you making then? I thought we were talking about stuff for the anti malware project?
Yea, client-side. So an actual website
What are you trying to do with this? As in, what is the expected output?
Right, but don't your current tools only work via the command line?
or loaded through the server?
The new stuff is gonna be the paper fork & plugins. None of which will use CLI, but be config based
There will be the current Anti-Malware, but that'll be EOL'd once the new stuff releases
bare minimum for the website (for now) though is
home page
register
login
user specific page which lists projects, api key for each (and various functionality related to them), and paypal buttons.
Still not entire sure how I'll handle the paypal buttons though. Still have yet to find a good & secure way to map a purchase to the right account 😐
anyone know why my GUI would be centering elements even though they should be anchored to the NORTHWEST according to my code.
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.NORTHWEST;
add(recipeLabel, c);
c.gridy = 1;
c.weighty = 1;
c.fill = GridBagConstraints.VERTICAL;
add(displayContainer, c);
The PTSD is coming back
couldn't be fucked to use javafx
it makes it to annoying
Are there not any libraries that have been made for JFX?
🤷♂️ I could try javafx but It makes a muck of my pom and I don't like it really
all rodes lead back to me having to figure out how tf javafx works lol
As for this, have you set gridwidths?
no I haven't thats probably it
Also, I think by default, if nothing is changed, elements will be placed in the center of the screen.
Use that netbeans gui thing
I could just use intellijs
IJ's kinda sucks
Not near as easy as the netbeans one. At least when it comes to sizing.
I was contemplating buying the JFormDesigner plugin, but I never did. It's supposed to be easier apparently.
I havent
coll can i dm you for help with something, i don't want to paste my code here because everyone will laugh at me
lol
So to go with my weather plugin I want to make mostly realistic wind
As in if it's fast enough it'll make mobs fly around
I'm not sure how I should do that because I think applying a velocity to every entity in a world would cause performance issues
just ask it here and understand why we're laughing at you
we point out your mistakes because we want you to improve as fast as possible
tough love type of deal
at the end of the day no one cares and you're here to get your problem solved
ok turns out i have no idea what my problem even is
i made an inventory and for some reason when i open it it gets two copies of me as a viewer
i have an inventorycloseevent and event.getViewers() has 2 of me in it
basically it's a semicircle
or well
7 of them
where the radius increases slightly
I want to add it to https://www.spigotmc.org/resources/☄️aurora☄️-ambient-particle-display-customisable-per-biome.89399/ but math fucking sucks KEK
And you need to do some math to know when your angle starts and ends
It's really picky
or well you gotta like atan2
who added letters to math? 💀
😭😭😡
yo you're still here??
hol'up I'm getting there
I thought you left lol
🤠
He also had enough people being mean to him when he was alive
yeah the idea is to render a semicircle around an axis perpendicular to the axis between the 2 points
or we can just use bezier curves lmfao
and make it 19x easier
with beziers it's just
public void renderRainbow(Location one, Location two) {
double distance = one.distance(two);
Vector difference = two.toVector().subtract(one.toVector();
Vector middle = difference.multiply(0.5).add(0, distance, 0);
drawBezier(one, middle, two);
}
type deal
it's kinda shit
thinking of the mathemathical way of doing this
public static final double BAND_RADIUS_INCREMENT = 0.1;
public static final double ANGULAR_DISTANCE_BETWEEN_PARTICLES = 1; // Might want to switch to a lerp based approach
public static final Color[] BAND_COLORS = {
new Color(...) // the 7 colors or whatever
};
public void renderRainbow(Location start, Location end) {
double diameter = start.distance(end);
double radius = diameter / 2;
Vector startVec = start.toVector();
Vector endVec = end.toVector();
Vector difference = endVector.clone().subtract(startVector);
Vector middle = difference.clone().multiply(0.5);
double startAngle = middle.angle(startVec);
double endAngle = middle.angle(endVec);
double min = Math.min(startAngle, endAngle);
double max = Math.max(startAngle, endAngle);
double increment = (max - min) * ANGULAR_DISTANCE_BETWEEN_PARTICLES;
for(double angle = min; angle <= max; angle += increment) {
double radians = Math.toRadians(angle);
trig here idk i failed maths
}
}
hm
I failed maths too, hence me not having it made already lmfao
Seriously though, I don't even remember that stuff
something like
double y = radius * Math.sin(radians)
xz is a bit more complicated
I genuinely forgot
but for xz we need to calculate the angle of that separately
with atan2
fuck atan2
on another note, do skin URLs have to come from the usual site or can it just be... any site?
They must be from Mojang
They need to be signed essentially
Mineskin provides an api for this
Which citizens uses
hmm, guess it could theoretically be replaced then.
I don't want to rely on a third-party though 😐
And depending on how they do it, it might not even bypass the mojang bans lmao
shame
was hoping to reimpl skin handling, but not so... limiting ig
but if it requires mojang services, that's fucked lmfao
Smh making a system to bypass the bans
Nah, it would still include bans. Just make it possible to decide what gets banned
instead of fuck you, global ban
Would include other useful skin related functionality, but it's not worth touching if it has to rely on their services
can't wait for ppl to apply shit to mineskin and report the donor accounts
thanks for the suggestion github
Idk if that matters
In theory the account only needs the skin briefly and then they can just revert to Steve
Plus they would have to get it on the same account several times for it to be banned, if you aren’t being a dickhead it just gets removed
+1s blue a single pixel oops
Every account that has it yes
I mean the account doesn’t get disabled unless they violate it repeatedly
ah
well regardless you probably can't get around it the way you're suggesting
it'll likely just be deletes file and bans hash kinda deal
Yea but I’m not talking about getting around it
I’m saying the accounts donated to mineskin will probably be fine
ehh
They'll likely lose the skins, regardless of the amount of skins passed through them
but banned? Maybe?
They will only get banned if they repeatedly get reported with a bad skin
Yea, and those have 1000s of skins used on them. Probably not difficult
True
It's also not hard to set -> wait -> report -> repeat
Any idea how could i make player let sleep in bed but not set spawnpoint
Hey guys, I am having trouble with the EntityExplodeEvent
So I took e.blockList() and assigned it to a List<Block> variable. Then I removed blockes from the variable that should not be broken.
This used to work perfectly fine, but in recent testing, the blocks targeted by the explosion are still broken.
I also tried removing them directly using e.blockList().remove(block), but that had no effect
As well as e.blockList().clear() followed by e.blockList().addAll(blocksThatShouldBreak). This attempt resulted in explosions breaking no blocks at all regardless of the targets.
I don't understand what I need to do to edit the list of blocks that should be broken by the explosion.
All of the print statements fire at the appropriate times, so the code is definitely being run. It seems to me to have something to do with the event methods rather than the math or PDC calls.
Maybe they made the block list read-only?
If there are separate events firing when the actual blocks are removed you could potentially cancel those instead
you can;t remove a Block from a list you are currently iterating over unless you use an actual iterator.
Is there any event for when an entity lands on a block?
sometimes. Interact events
e
btw
if we spawn an entity for example
and we set its customname as "example" + entity.gethealth it will show its health and will track when it go down am i right
ik its stuopid
just wana confirm
how to
events?
which event
EntityDamageEvent and EntityRegenEvent iirc
like how to track it
uh
when those events happen, check if its that entity, if yes, change the custom name
OHHH
UR SMART
smarty boiii
ik hes gona say "its basic" xd
nah i will just use scoreboard tags
fuck do u mean reference
they work as well
id exists
ik xd\
i mean zacken
oh ye
an ID is not a reference, its the identification. It's not a reversible mapping
Reference = access to the object
uuid doesnt store location data
so you cant get the entity from an uuid
just make sure 'have i iterated over entity x yet?'
They’re not necessarily unique tho, its just the data type UUID, yes it stands for universally unique identifier but it just represents 128 bits in practice.
pretty sure the algorithm used is dependent on the current unix time
I was just picking on ur words since what you said isn’t 100% correct
does it make sense to create an additional level of abstraction if this class does nothing
so i can just impl hashDataStore
end use him
Any idea how to prevent bed set respawn
Same interests ig haha
I tried few things but wasnt successful
I guess you could use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBedEnterEvent.html and reset the spawnpoint a tick later
declaration: package: org.bukkit.event.player, class: PlayerBedEnterEvent
I have actually had that
got a console warning, a sheep had spawned with the same UUID as something else
Sleep event, save the players old spawnpoint and set the players spawnpoint to that after a delay?
My guess
spawnpoint can be set without sleeping
Tried that it was bugging tho
Not on pc so i can show you rn
Listen for a PlayerSpawnChangeEvent and cancel it if the event cause is PlayerSpawnChangeEvent.Cause.BED
Didnt know its an actual event
Thats a cool idea
Must have missed it
Cant find it anywhere
Got docs
?
Is it version dependent?
Paper has PlayerSetSpawnEvent that does the same thing but appears to actually be implemented
No paper tho
🤷♂️ might have to find some convoluted Spigot workaround
maybe something in a PlayerInteractEvent
Yeah PlayerInteractEvent
Cancel the event or in the next tick remove the bed position
the issue would be how do you cancel the spawn set but also let the player sleep
Then you'd do the second option
Just remove it next tick and hope the player doesn't die during that time
Yeah probably legacy
So a bit of a noob question as I just started with learning to make spiggot plugins, I keep getting this error
[13:26:31 ERROR] [Minecraft]: Could not load 'plugins\presenthunt-1.0-SNAPSHOT.jar' in folder 'plugins': uses the space-character (0x20) in its name
But there doesn't seem to be any spaces in my pom.xml file?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.nephalem</groupId>
<artifactId>presenthunt</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PresentHunt</name>
<description>A plugin where players can run to heads around spawn and right click them for prizes Each present can
have 1 random reward from the regular rewards list When you get to ur final present, u get the mega prize
</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Even in 1.12? I should try that tho
plugin.yml, not pom
I'm confused as to why when I used intellij's Minecraft development plugin it made a pom.xml then lol
That’s for maven
The pom is for managing the Java project
plugin.yml is for the finished project during runtime
Wait then do I need to make a plugin.yml file or should it already be there?
If you used the mc dev plugiin it's in the resources folder
It doesn't compile
marked for removal, you get an error if you try using it
Draft api should compile
huh it does compile
I guess IntelliJ just considers it bad practise enough to mark it as an error
I know what deprecated means
it's specifically deprecated for removal, which I guess means its removal is imminent instead of at some point
It’s not marked for removal in 1.20
it is in 1.20.1
It's not
if it's not then why is it
can we pass null to setBedSpawnLocation to remove sp 😦
Are you using spigot api
like setDeathMessage
Or are you using paper api
Mhm
nevermind, I guess it's just Paper that has it marked
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
if it's deprecated in Spigot what's the workaround supposed to be?
lmao you guys get pretty worked up about that huh
Well it's not exactly that
It's just kinda hard to provide support for software we don't develop
It’s not deprecated in spigot
well I'm asking about the software you do develop
Spigot just used to use @Deprecated for draft api
And that will be Spigot, thanks
Now we use @Experimental
this guy doesn't seem to be able to use the event
that is what we're actually trying to figure out
nothing to do with Paper
How i can get Entity in an ENUM? exist class?
can you elaborate a little bit
How do I add a fuction to an block? I wanna be able to right click a mob head / player head and have it give me an item
can be done with PlayerInteractEvent
is the privileges plugin similar to luckPerms or does it use it as a source of permission management?
I'll look into it ty!
Hey guys, how can I get the worldserver from a resourceKey (1.18)
@NotNull
private static final ResourceKey<World> resourceKey;
@NotNull
private static final Method method;
public FakeEntityPlayer18(@NotNull GameProfile gameProfile) {
super(MinecraftServer.getServer(), /** how to return the worldserver by resourceKey*/, gameProfile);
To use EntityPlayer:
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
I mean it's not necessary but for the versions 1.12 and 1.16 I have used it and it seemed to work
And what variable should I put as the world? A Bukkit world ?
Yes
Also there's no need to reinvent the wheel
There are plenty of NPC apis you can use
Until you have to support 1.8-latest
and have to maintain that yourself instead of working on cool features
^^
Yeah I saw
I was thinking of doing the same
I've been researching on how to transpile Dart to Java
🤷♂️
1 more question, how can I spawn here a fake player with the network manager?
private static final void spawnFakePlayer$lambda10(FakeEntityPlayer118 $fake) {
Intrinsics.checkNotNullParameter((Object)$fake, (String)"$fake");
EntityPlayer entityPlayer1 = (EntityPlayer) $fake;
NetworkManager networkManager1 = $fake.b.a;
EntityHuman entityHuman = (EntityHuman) entityPlayer1.getBukkitEntity().getPlayer();
//MinecraftServer.getServer().
try {
//MinecraftServer.getServer().ac().a($fake.b.a, (EntityPlayer)$fake);
//MinecraftServer.getServer().getPlayerList().a(entityHuman);
}
catch (Exception ex) {
ex.printStackTrace();
fakePlayers.remove($fake.cm());
return;
}
}
plugins for donations
is this a new level of abstraction for luckPerms?
why $
^^
Yeah, I'm using my friend's spoofer and I'm trying to learn on how to make it since he's going to uni soon and he didn't want to give me the source code since he said I have to be learning, but rn I am kind of in a hole because I don't know how to spawn a player (since I am kind of a beginner) and I decompiled his plugin and wanted to see how he did it
i use "luyten" or "recaf"
how?
i was ab to ask the same question xD
I see, thanks a lot for your advice, but since I think I'm kind of getting close to it, if it would be already, could you tell me how to do those mappings in 1.18.2?
I never understood how that site works
Thanks a lot 🙂
Well those are obfuscated that's kinda the point of those
just use moj map
They're all the same thing, just different names.
Yep, you're right. I thought it was fine because it wasn't sending an error, but I didn't realize that every time a block was removed from the list, all of the list elements were shifting, causing it to skip blocks. I think my successful tests were done with Obsidian blocks, and I was just testing the PDC aspect. LOL
That's rude, dude
Show us the code you used
lol
ChatGPT is actually pretty helpful if you can get past the hallucinations
it pay
using api is the best solution don't listen to your friend
sorry for late reply, like this?
how undestand this
player1.teleport(player2.getLocation().add(y, x, z))
lol
if you are a beginner you shouldn't use copilot
bros losing his marbles because I called him a beginner
what to do in such a situation when the customer doesn’t have enough money to order a plugin but i doesn’t want to refuse
send a rotation packet with the vehicle entity id?
you refuse
because skill comes at a cost
eh
I've tried but I'm not great
why doesnt this cancel the bed respawn? it should right?
ProtocolLib use NMS ?
internally yeah
hmm? what about them
He can because ProtocolLib handles that.
another verision
I use ProtocolLib because I don't want to have to deal with NMS
the ProtocolLib dev handles updating the NMS code for new versions
plib just uses reflections mostly
all sayEveryone says that NMS is version sensitive, but how does ProtocolLib deal with this?
i could try if you explain the issue sure
open your jar with 7zip and see if the file really exists
Hey, so I've checked the mappings, but I am still not sure how to make this spawnFakePlayer work:
private static final void spawnFakePlayer$lambda10(FakeEntityPlayer118 $fake) {
Intrinsics.checkNotNullParameter((Object)$fake, (String)"$fake");
EntityPlayer entityPlayer1 = (EntityPlayer) $fake;
NetworkManager networkManager1 = $fake.b.a;
PlayerConnection connection = $fake.b;
EntityHuman entityHuman = (EntityHuman) entityPlayer1.getBukkitEntity().getPlayer();
//MinecraftServer.getServer().
try {
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(entityHuman);
connection.
//networkManager1.;
//MinecraftServer.getServer().ac().a($fake.b.a, (EntityPlayer)$fake);
//MinecraftServer.getServer().getPlayerList().a(entityHuman);
}
catch (Exception ex) {
ex.printStackTrace();
fakePlayers.remove($fake.cm());
return;
}
}
bro use api
Citizes
pretty sure that works out the box if you followed their demo yes
I don't want to use API's, I want to do it by myself
;d
gradle is okay when it does what you want it to do
which is... almost never
fair enough
thing just is. gradle has 300 different ways to achieve the same result
so everyone does it differently lol
Gradle just does too many things for it to be able to do the simple things easily
Like making a fat jar requires a plugin
Fr fr
pretty much yea
But, with that being said, if you learn how Gradle does things 
👀
i had to make a modular paperweight project a few weeks ago
lets just say im lucky i have a friend much smarter than me
pain
Lol
I actually made a Gradle plugin recently, the documentation on Gradle's site is actually not bad
what the plugin do
Applies Moj maps automatically
Basically just give it the MC version you want and it adds the moj map dependencies for you and then lets you rebuild back to Spigot
There are also like 3 plugins that can do that with Spigot
Yeah, I'm sure there are now. When I first started using moj maps there wasn't one for gradle
Any idea?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
lol, i have been using Maven for over a year and still only know what one button does
I know what 3 of the buttons do 😎
?paste
So I am trying to add the ability to turn mob heads and player heads into little presents that when you right click them it gives you a reward, I have tried running the code though ChatGPT but it can't seem th find the issue as to why it's not doing anything when you right click the heads
https://paste.md-5.net/faruguvoyi.java
There isn't any errors in the server logs
502 bad gateway 
I'm guessing EntityAirChange event is triggered every tick but if not how often is it triggered?
whenever the amount of air changes 
which i think is less than every tick - depends if it is a discrete or continuous value
I know that much lol
Just making sure
Ok nice ty
Well I got the interaction reward to work but for some reason it only works with player heads and not mob heads as well >.>
https://paste.md-5.net/ekokuyarus.java
maybe because you have a check for player heads??
Mob heads are a different material
I just go with a solid purple
Maybe, I ended up removing it and I'll just use player heads
Turns out that EntityAirChange only really works when entities are in water
For me atleast anyways
Anyone know a good way to track when an entity falls or touchs a block?
is it wrong to use DI with listeners?
Could i technically track an animation of the pig to see whenever it gets hurt or something?
Or entity
no
that's the preferred method
Random question, in what situation would https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getItem() return null if the player has an item in their hand?
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
i mean to inject listener to some class
Wait entityairchange event is for how much breath the entity has my bad
I think i found the solution to my problem
returns null if player has no item in hand
That's what I thought, but for some reason it is returning null when the player right clicks a block
you should never need to do that
yeah, almost always null is an exception type value, so an exception in getItem() is when player has no item
And, I have tried it with a sword item and a food item, the food item doesn't return null but the sword does
This is only when the event is RIGHT_CLICK_BLOCK
Is this because the food item tiggers a use action but the sword doesn't?
Sorry I had the wrong action
it's when clicking a block
if I iterate over Material class legacy values will be included, so could I maybe use !Material#isLegacy
If your api version is set, it shouldn't include legacy materials
api-version: '1.20'
For compatibility with older plugins that have not been updated.
Hello,
i got a class when a player died hes get in the spectator mode. now is the problem if the player scrolls on the mouse he can fly. but i want that the player cant move. the another problem is that the player can get in another players und can teleport to another players. how can i fix that?
¯_(ツ)_/¯ this thing is so much fun to send
With listeners. Everything with listeners.
yes, but which listeners?
PlayerMoveEvent
i tried it already, but the player can teleport into another players
that the hugest problem
Hm. Wait, when I player moves the event gets triggered. So... if you can teleport to it, just save the previous location and teleport back the player.
player teleport event probably
declaration: package: org.bukkit.event.player, class: PlayerTeleportEvent
It's not a regular teleport.
yea, thats a solution . but isnt it possible to remove the function that the player can teleport to another players in the spectator mode
just
it will still cause the event
Best solution
okay yea that a good idea
Sorry for the stupid question but can anyone help me figure out why you gain the rewards twice when you only right click once
https://paste.md-5.net/tosodapiza.java
this count to the what ?
i want to prevent setting the bed spawnpoint
Use PlayerSpawnChangeEvent ?
im using 1.12.2 where this event isnt
my condolences, gl!
i dont know how to fix that lmao 😭
is there a tick event in bukkit
Where exactly?
hm ?
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
u can pass null to setBedSpawnLocation
that would reset it to world spawn right?
what if the player has a normal /spawnpoint somewhere else
that doesnt answer anything tho
Ok I got it working, thank you!
is it possible in the playermoveevent, to activate the mouseviewing?
how to disable tab complete of a certain username(s) in commands?
filter them
If it's your own command you can just omit them from your TabCompleter implementation
great
well its not
You can't know whether a suggestion is a player name though. You just kind of have to assume they're all player names
Custom inventory has duplicate viewers
you can use adventure library
BukkitAudiences.create(Plugin.getInstance()).filter(player -> !notInlcudedList.contains(player))
Adventure is not part of spigot though.
or just getOnlinePlayers and filter them by yourself
I don't even know what that has to do with tab completion
someone knows what event is fired when player attacks other player?
entitiy damage event
does this filter ALL plugins?
Or for a bit more precision, EntityDamageByEntityEvent
it filters online players
i made a thread for a problem im having
use the tab complete event
Suggested above ^
aight
That's your answer. Ignore anybody else suggesting anything else
Literally no clue why they mentioned Adventure
And is there a list of releasee versions like 1.18.2-R0.1-SNAPSHOT
They'll all be <version>-R0.1-SNAPSHOT
Did Mojang remove the ability for zombies to wear heads in 1.20.2?
They aren't being rendered anymore
Even back to 1.8?
Starting from 1.8 actually, yeah
Exception to 1.8.9 because there was no server release for that version
So 1.8.8
Correct
Anyone know of the forum thread that talks about the faster methods of setting blocks in a world?
Thanks for the resource, however it's not what I'm looking for
do you know what discord ur in
apparently there's a rule that if your thing is about paper then ur not meant to reply
thx
If you're talking about coloured text in the console it is a thing
spigot is inside paper, paper isnt in spigot
we cannot help with something that we dont add
ok i understand and i'm really sorry
u dont have to apologise so hard it's ok
we addon to the vanilla jar, paper then addon to us. so paper add stuff seperately
epicebic are you good at spigot
depends on what
the colour thing is spigot though
spigot console uses ansi
papers uses the same as mc colour codes
removethe inspection, ignore it, or null check it
spigot has a console
Override onCommand method, setExecutor to this
it's up the console if it supports the extended colours
public static String applyColour(String string,Color colour)
{
return ChatColor.of(colour) + string;
}
'Color' is from awt
'ChatColor' is net.md_5.bungee.api.ChatColor
none of this is paper
omg bri ish
omg muri cn
im bri ish too
¯_(ツ)_/¯
🤝
aight after some testing it seems while the method is there, it doesn't seem to work in spigot. However you can still use basic colour codes in the console. You just can't use anything beyond the basic colours
How would I listen to packets in 1.20.2?
Seems like something changed in 1.20.2
although I'm using puffer
logicaldark do u think u could check my thread
what thread
y
maybe u know the answer
would it be much strain on the server's storage to track player-placed blocks with a value in their pdc?
I want to write a small plugin to turn off vanilla fishing in Minecraf, where can I start?
My goal is to close the fish in vanilla and only the ones I added with itemsadder appear.
In addition, itemsadderda uses "fishing" so I just want to disable the vanilla loot table and run only "fishing" even if it is empty
save it in a DB file, like core protect, you can look at what they did
apparently saving it in the chunk's pdc is better isn't it?
does anyone happen to have the item slot indexes for the creative menu armor slots
since the player inventory and creative inventory are different
actually nevermind ill just test that
they the same 👍
InventoryCloseEvent : the item that is on the Courser will be removed no matter what i do is there a fix for it?
How can I copy all properties of one Object(Player) to another object (also Player)? I was thinking about making a world profile system, so players have different effects, inventories, health, saturation etc. in each world
nvm found the words i have to search for while writing this lol
Hi, I am having an issue with the BlockDropItemEvent
I'm using the getBlockState() method which the docs (https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockDropItemEvent.html#getBlockState()) states "Gets the BlockState of the block involved in this event before it was broken.", I interpret this as giving a BlockState of the block prior to the event happening i.e. the block itself not a BlockState for AIR
When I break carrots I seem to be getting a BlockState with a getBlock() result of Material.AIR
Does anyone know how I can determine the block that was broken/why I am getting a BlockState for Material.AIR
Code:
@EventHandler(priority = EventPriority.HIGH)
public void onBreakResultsInDrop(BlockDropItemEvent event) {
if (!isCrop(event.getBlockState().getBlock())) {
return;
}
new CropBreakEvent(event.getBlock(), event.getBlockState(), event.getPlayer(), event.getItems());
}
private boolean isCrop(Block block) {
//TODO: Update
return block.getType().equals(Material.CARROTS);
}
Using a remote Java debugger the event.getBlockState() result is
"CraftBlock{pos=BlockPosition{x=-1, y=63, z=42},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@29012da7}"
That's because that event gets called when the block has already been broken (= type: AIR). The Block class represents and returns the live state of the block, while a BlockState is a momentum snapshot of possibly a past moment
Thus event.getBlockState() is not the equivaleng of event.gegBlockState().getBlock().getState()
You'd have to pass the BlockState to isCrop
Ah brilliant - I probably should've looked further into BlockState did not notice it had a getType() method also. Thank you for your help 🙂
hi, how do I get an object with the interface CraftingInventory in 1.20
Getting CraftingInventory for Custom Crafting Table
Does anyone know how to cancel a task timer inside of the task timer itself?
cancel()
I tried that but it doesn’t exist
Give me a minute and I’ll paste it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Here you go
In the if statement I want to cancel the loop
...(plugin, task -> { task.cancel(); });
^
God imagine not making your runnable a separate class so you can just do this.cancel
How to get cancelled
Search your feelings you know it to be true
I normally only do that if the runnable is more than a few lines
new BukkitRunnable()
{
@Override
public void run()
{
cancel();
}
}.runTaskTimer(MyPlugin.getInstance(),20,20);
Ah I like the versatility of it being its own class.
Gets it's own fields, can added it to a manager if u were so inclined (for stuff like event checking etc )
.... I hate this
why annoymous class, lambda is shorter
If usually say go to the church and ask God to forgive you.
But they sint even letting u in bro
because it doesn't matter?
clean🤑
so is this
Clean isn't being it's own class
Also you know someone is being pedantic when they see a runnable that just cancels itself being ran via run task timer and go "WhAt AbOuT lAmBdA ThO?" 💀
then
lambda is overhyped
people like the very little verbosity it is
Get that functional crap out of my OOP 💀
I can do all this complex shit in one line
We are an instance based household sir
How can reference main without making a new instance of my main class? I know it's probably basic java but I'm very stupid
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Hello everyone, today when I wanted to download the plugins for my server, I downloaded one of the plugins, it directed me to the cloudfare page, the case is that it doesn't go beyond that page and I couldn't download anything, any solution?
store your main in an instance in itself
for exmaple
You can also use a static getter for your main
DI is generally preferred
But ehhhhhhh
public class MyPlugin extends JavaPlugin
{
public static MyPlugin instance;
public void onEnable()
{
instance = this;
}
}
then you can just do MyPlugin.instance
???
getters and setters are only needed if you need to control retrieval or setting of a variable like in race conditions
Last thing you want is another plugin just doing MyPlugin.instance = null
they're not needed for literally every variable
they could easily do that with a setter
thats goofy
also if you have another dev doing that, that sounds like a skill issue on their end
Better safe than sorry
Because java lacks whats called property semantics which languages like kotlin have encapsulation regarding data of objects become extremely nice, especially if u dont hate urself
there is more to a getter than just the field invocation
goofy?
yea
and no its definitely not
no it is
If the code compiles I'm fine with using it
thats a poor mindset
thank you
no a poor mindset is someone who thinks every var needs a getter
It's for a server only using my own plugins
they don't
you dont know the point of encapsulation especially in java
💀
i mean sure if u work procedurally then yeah
I do
but java is not really procedural
then make it final
there are a few ways you can accomplish this besides getters though
code becomes really coupled the way object orientation works if you dont encapsulate ur fields
I said unprotected, not none
If you don't need further write access that's fine
public String name { get; set; } when
I use struct-style classes where that's a factor
it's holding an instance of a main class
C# my beloved
there is nothing to write
thats not the point of having it private
Nevermind the code didn't work
again you prob dont know why encapsulation is so vital
Can’t be final here
I do
Since you assign it in onEnable
Does anyone really know why cloudfare won't let me download spigot plugins please help me
this is for code
yeah and since onEnable isn't a constructor...
(i am agreeing with you, i have learned that this is necessary to communicate with developers)
the difference is that I'm past the point of by disenchantment of getters and setters for everything
it's good practice in case someone else ever touches your code
even if they won't
code conventions exist for a reason
Or another plugin is on your server
if you're entirely a hobbyist then do whtaever
That isn’t your own
yeah and it reflectively tries to do some shit
i hope you don't work in tech
and note
to even do that
you'd have to have my plugin as a lib
or reflect access it
not really my problem though
encapsulation can be but an illusion anyway if I can just reflect my way across a plugin
encapsulation has more purposes than just write protection, y'know
java lacks pass by reference for primitives for instance
but that's neither here nor there
I'll just use a getter
yes encapsulation hides what the class actually does and just provides you methods on how you can operate it
if you're after a reference to your plugin class just use the singleton pattern
you really don't need to mate
singleton pattern is very standard for this kind of thing
Javaplz
singleton lmao
java when they try to add structs and fail
singletons?
found the hobby coder
you mean static
static class
Clearly not, because if you have then you would be past the point of not being object oriented in Java. You know how much Java suffered cause of System.out and System.in hell just look at the implementation!? If we want to restrain consumers from touching our data unrestrained then you can't just do that whenever you feel like. Let's say the code you write becomes exposed to external modularity or you define an api layer, or you need to add thread safety, or maybe alter the implementation entirely. Why do you think Java decided to make record components expose methods and not final fields?
that is not what a singleton is
static classes are tied to compilation units
not related
how many more labels are you going to label me with as if that somehow lowers my values of what I'm saying in your head hm?
singleton pattern involves maintaining a static, write-protected reference to an object of which there will only be a single instance at runtime
none, that's the label
and the label means nothing
The issue with not using encapsulation doesn't come right away, but if you don't have any experience in the enterprise industry or in larger code bases you probably don't understand and cannot grasp the bigger issue of avoiding these practices we got together after many years of trial and erroring
Seriously, though, if you'd drop the "I'm right/it's someone else's problem" attitude, I'd be very willing to help
I never judge people for inexperience, I judge them for the attitude they display alongside that inexperience
I'm not a hobbiest
you are objectively wrong on multiple counts and we've explained why
lol
??
Anhwylder chill a bit
yeah mb, i'm getting unreasonably fired up here
the fucking insults man
Try to keep this constructive
chill
xD
not sure what's up with me tonight
I mean like, avoding encapsulation is just absurd but yeah, dw allg
i mean sure its possible
but so is a lot of things
singletons are already procedural enough as is, no need to make them stand out as that, we are trying object orienting ourselves at the end in java, we try to abstract away implementations to make things self conservative for long term, god idk even how long 5 years, maybe 10 or even 20
wow I've created an argument over correct coding practices for java
and also write once run everywhere (which is completely incorrect but im just gonna spit it out lol)
Anyway im gonna re qoute myself
"You know how much Java suffered cause of System.out and System.in hell just look at the implementation!? If we want to restrain consumers from touching our data unrestrained then you can't just do that whenever you feel like. Let's say the code you write becomes exposed to external modularity or you define an api layer, or you need to add thread safety, or maybe alter the implementation entirely. Why do you think Java decided to make record components expose methods and not final fields?"
