#help-development
1 messages ยท Page 857 of 1
and how does that look like?
Why would you do that, of course that won't work with the bukkit api
no shit
I mean
Then what's the point of asking for something that is not possible?
what?
"not possible"?
10 years of coding?
I'm not having this conversations any longer
Something like this https://paste.md-5.net/ekayewiwul.xml
Good thing, maybe you should learn to comprehend yourself and to deal with your anger issues
it's coming from the maven-shade-plugin, which first renames the unshaded .jar to "original-...", and then creates the shaded .jar
Hmmmmm
I'm really trying to stop myself from spewing profanity at you
what's the issue with having the original jar?
Github Actions uploads two build artifacts
Block Destroy Events
I have been trying to help you, and you are getting angry at me? Okay
"help" me?
Wtf do you mean
Okay, what were you trying to help me with?
bro calm down
he's spouting nonsense
he is trying to help and if you know it better than dont ask and leave the server
Lets chill
I AM NOT ASKING FOR HELP
Oh wow, it's not even your request
Why the hell are you getting so mad at?
I was enlightening him with what a virtual inventory was
and now he thinks he was helping me
You didn't even explain it yet
I DID
okay what ever just forget it
.
^
^
I agree
and he just-
๐
with virtual items he means items that exist but only in the gui
idk if he explained it already
.
but everything is sent via packages... no?
The items aren't really virtual though, they still exist
yes, but the server doesn't know about these
Dayum
The client thinks they do
now i got your point, you fake the items basically
the server doesn't know about them
yes
Marcely couldn't get that for some reason
so you dont create the itemstack you just send the user the item
how do you detect clicks on these? idk very much about packages
do you sleep well, Marcely?
useless comment
I'm just annoyed
not a reason to let it out on him
I would ask what is the point of doing that, but I don't want you to pass out
the client sends all inventory clicks
You can do all that using bukkit api
no
and how do you listen on them? is there a package event in nms or something like that?
you can get the player connection class
which has a netty Channel delegate
you inject your packet handler
I only use bukkit api, and it works
if u want to do it the packets way you have to use nms and if u want to do it the normal way you can do it with bukkit api
and it intercepts the packets
No need to listen to any packets
also, it's not package but packets
lol yeah im lost
But what benefit do you get from doing that
well it's really limited and you can't create a virtual inventory
You can cancel the click event
am just gonna send you a vid
okok
damn it's too big
then explain it slightly
or like that
can't you just adjust the action to only use the .jar you want it to use?
you see these items
how does your action look like?
let's say i have 2 array lists, teams and players, how can i assign each player to it's own team?
but you can do this all with the bukkit api i dont get the packets point yet
if you use the bukkit api they'll be either removed or some other funky stuff
and the "X" will be visible
but if you only tell the client that it's there
you can have it look pretty
what x?
like when you can't combine 2 things in an anvil
here it only lights up for a sec, I still haven't figured out how I could fix that
yep
help pls i need fast
but if you virtualize the items and manually handle the packet flow
you can remove it
pleaseeee can someone help i think it's easy but im too dumb
well
you create scoreboard teams and assign them
the question is far too generic
we dont know what you are doing
wdym
isn't there any method like Team#addPlayer
^
it's not
we do
i didnt know he was talking bout scoreboards
he's not
i thought it was some kind of minigame with teams
@shadow night the proper way is to make github simply only upload the files you need. the dirty solution is to adjust the maven-shade-plugin's configuration:
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
this will give you only the shaded .jar called artifactId-version.jar
e.g. like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
this is how the code looks like
the gameteam is a custom class
like teams[0].addPlayer(players[0]) but i think it's bad
for Player player : players
for Team team : teams
player.addTeam(team) // or whatever
^
wouldn't that make multiple players join the same team/players be in multiple teams
but thats what you wanted?
that's what you asked for
GameTeam is your custom class
litterally what i wanted but i think it's bad
yes
he litterally said it
show it's variables
it would add every player to every team, just as you said?
what do you want @tribal valve ?
no, like player 1 would be in team 1, and noone else will be in team 1, now player 2 will be in team 2 etc
then Map?
private TeamColor teamColor;
private List<Player> teamPlayers = new ArrayList<Player>();
private List<Player> alivePlayers = new ArrayList<Player>();
private List<Player> spectatingPlayers = new ArrayList<Player>();
private TeamBlock teamBlock;
private Location teamSpawnPosition;
private Location teamGeneratorPosition;
private Location teamBlockPosition;
private Location teamShopPosition;
private Location teamUpgradesPosition;
private boolean isBlockActive = false;
private BlockWars plugin;
public void initializePlayers(List<Player> players) {
if (this.teamBlockPosition != null && this.teamSpawnPosition != null) {
for (Player p : players) {
teamPlayers.add(p);
p.teleport(this.teamSpawnPosition);
setDefaultItems(p, this.teamColor);
}
this.teamBlock = new TeamBlock(teamBlockPosition.getBlock(), this);
if (players.stream().count() <= 0) {
this.teamBlock.deactivateBlock();
}
alivePlayers = teamPlayers;
}
}
how
for (int i = 0; i < teams.length; i++) {
team[i].addPlayer(players[i]);
}
?
maybe
Set<ClassA<?, ClassB<?,?>>> , this is red, the ? values are all defined as generic in the class, i want to store them in a set, i dont know what these values will be, but using ? as a generic type results in it being underlined red, am i doing something wrong?
there's no Team variable
yea that would work but i think doing [i] is bad, like at least i think that
nvm, i still can't understand your problem clearly
what team variable
what the hell
idk why it should be bad?
what?
idk, i think it's just me, i prefer foreach more than doing players[i]
if that's what you meant
Class<?> is possible
but you have to get the index to get the team
Class<?, ?> is invalid
2 lists, each player get's it's own team, like player 1 is in team 1, player 2 is in team 2 and etc
oh I get what you meant it's a Set
so what should i do
i'd do the index thing
@inner mulch
yea but im still not sure about messing with [i]
oh wait not it's a set
but where is the problem?
datamanger has 2 generics, the second one always has to be a dataholder which also consists of 2 generics
i don't know it's just my brain thinking it would broke somehow
it's decleration
how could it broke?
Well i found and made my own version of the ChannelDuplexHandler, however i can't find where you inject it to a player?
idk, it's just my brain
what does IntelliJ say?
bro... just use it... or not...
i'll link it one sec
okay
also is there a faster way to change plugin versions rather than needing to restart the server because the file is in use?
yes
what
it seems that AttributeInstance#addModifier(new AttributeModifier(String, Double, Operation)); (removeModifier also) sometimes causes ArrayIndexOutOfBoundsException, would that be a bug worth reporting
building the plugin straight into the plugins folder
just do /reload and expect that things might break
on windows there is a problem with overwriting the plugin
i just avoid it using a server on linux and upload my files via winscp
really? lol why
no but when i try to replace the plugin with the new version, it tells me that it's in use
exacly
maven or gradle?
maven
If youโre using maven for your Spigot plugins (which you should do), itโs easy to make maven automatically save your pluginโs .jar in your plugins folder. Thereโs two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
^
this should work even on weird windows
xd
i told you...
you have to check if the lists match the size
some work you have to do on your own
no, you told us you wanted to add player 0 to team 0, etc.
However you did not tell us that your team list is empty
sometimes it's empty
well then you should wonder why it's empty
then check for the case
obv you cannot map it 1:1 if the lists aren't already matching
if you got 10 players and only 9 teams, how should we know whether it's missing the team entry for the first player, the last player, or the third?
build the plugin straight into the folder
wait but how is it empty when im passing online players
as @tender shard already said lol
okay i'll do that
show the code, we can take a look
I said it first
good night friends how can I move a plugin I bought to another account I will switch to a new account.
oh wait mb
than its more cringe telling it twice
he ignored it at first
I dislike the word "cringe"
okay
wait what's the maven-jar-plugin version, it highlights it as red
hover over it and read the exception
What
doesn't matter
but the other ones are white
Sometimes, people suggest you to change something in your pom.xml, and then IntelliJ starts to complain: That is totally normal. You simply have to click the โmaven reload buttonโ in IntelliJ. Maven will then continue to download the required dependency/plugin, if itโs available. After a few seconds, everything should be fine. You can find the.....
well you have to reload it ....
okay it doesn't highligh as red in the maven rightbar but still in the pom xml
just ignore it
okay
IJ is stupid
thanks
i think it works thanks
what kind of IDs are shown here?
integer ids?
No shit
I'm asking what they mean
They aren't the protocol ids nor the legacy ones
the legacy ones should have the "Proper" legacy ids
so what are these?
random garbage
Bruh
At least for 1.19.4 (the docs I have DL'd) and doing the research for you.
Yes, but that's "what it does"
Prpbably just plopped smth in
tru
why doesn't it show the footer space?
//Footer
Score footer = objective.getScore("Blockwars.net");
Score footerSpace = objective.getScore(" ");
//Teams
GameManager manager = plugin.getManager();
Score redTeam = objective.getScore("R Red " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.RED)) ? "dead" : "alive"));
Score blueTeam = objective.getScore("B Blue " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.BLUE)) ? "dead" : "alive"));
Score greenTeam = objective.getScore("G Green " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.GREEN)) ? "dead" : "alive"));
Score yellowTeam = objective.getScore("Y Yellow " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.YELLOW)) ? "dead" : "alive"));
Score aquaTeam = objective.getScore("A Aqua " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.AQUA)) ? "dead" : "alive"));
Score whiteTeam = objective.getScore("W White " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.WHITE)) ? "dead" : "alive"));
Score pinkTeam = objective.getScore("P Pink " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.PINK)) ? "dead" : "alive"));
Score grayTeam = objective.getScore("G Gray " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.GRAY)) ? "dead" : "alive"));
//Upper
Score upperSpace = objective.getScore(" ");
footer.setScore(0);
footerSpace.setScore(1); //doesnt show that
grayTeam.setScore(2);
pinkTeam.setScore(3);
whiteTeam.setScore(4);
aquaTeam.setScore(5);
yellowTeam.setScore(6);
greenTeam.setScore(7);
blueTeam.setScore(8);
redTeam.setScore(9);
upperSpace.setScore(10);
player.setScoreboard(scoreboard);
Nvm
I'm doing some packet spoofing
and I need to input numerical ids
network ids are completely different
so I guess they kinda do
How can I cancel other event when this part of the code is executed?
there is a palette iirc
how come?
Yeah it can be changed
they depend on yea ^
thanks
Nothing static anymore
holy fucking shit i thought i finally found a temporary raycast solution until i fix mine but its doing reflection on each entity for each step
and this guy presents it as great for anticheats
Cache the method smh
Cache 
Jk, just use mojmap
on 1.8
oof size: large
Guess ur bad
ok ill modify this bc its also doing an awful amount of memory allocation which is just not necessary
"awful amount"
Caching one Method?
no thats not what im talking about
can i put quick if statements inside each other? like
(boolean ? (boolean ? true : false) : false)
its probably not terrible but still theres a much more obvious way to do it so yeah ig im modifying the whole thing
Sure
Why would you do this
Ternary operator btw
boolean && boolean
Score redTeam = objective.getScore("R Red " + (manager.isTeamDead(manager.getTeamByColor(TeamColor.RED)) ? ChatColor.RED + "โ" : ChatColor.GREEN + "โ"));
is it's equivalent I think
yeah you can
i want to check if the team is entirely dead or is there some player's left but the bed is destroyed
Ew
what
pretty unreadable
looks like something I'd write
yea ik but i don't have any idea how to simplify it better
lemme help ya with that
String sign = manager.isTeamDead(manager.getTeamByColor(TeamColor.RED)) ? ChatColor.RED + "โ" : ChatColor.GREEN + "โ";
Score redTeam = objective.getScore("R Red " + sign);
i have to do that for 8 teams?
When was setComments added to the spigot api?
create a static method
or just a generalising method
If you haven't created an object that handles every team so that all the methods are combined into 1 simple grouping you might want to refactor your code right now.
ok no joke this was looking up 6 declared fields per entity per step + 1 method
If you're working for a server with 10 players it doesn't matter anyways 
They won't find out (until they do)
i know im making my own server for fun but im just amazed by how unperformant u can make ur code
Hey, making the server run at 10tps is better because it's more base10 than 20
Score redTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.RED));
Score blueTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.BLUE));
Score greenTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.GREEN));
Score grayTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.GRAY));
Score pinkTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.PINK));
Score whiteTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.WHITE));
Score aquaTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.AQUA));
Score yellowTeam = objective.getScore(manager.getScoreboardTeamScore(TeamColor.YELLOW));
public String getScoreboardTeamScore(TeamColor teamColor) {
GameTeam team = getTeamByColor(teamColor);
String teamName = "U Unknown";
teamName = team.getTeamColor().formattedName().toUpperCase().substring(1,1) + team.getTeamColor().formattedName();
//โ โ
String teamInfo = isTeamBlockActive(team) ? " โ" : (team.getAlivePlayers().size() >= 1 ? " (" + team.getAlivePlayers().size() + ")" : " โ");
return teamName + teamInfo + " ";
}
``` better?
real
im heavily overengineering my own raycast utility using like mathamatical ray-aabb intersections and per chunk entity checks but of course it doesnt work for shit so yeah
now im using this forum
code
oh it doesnt work either
sick
Time to write a spigot PR 
abt what?
Hello, I'd like to protect the plugins I sell. What type of protection do you recommend? I've done a bit of research and I've found protection by license, which doesn't sound too bad, except that I don't know much about it
like a license
The best protection is good support.
^
License / DRM is not allowed on spigot
Any protection can be broken in half the time it takes you to integrate it. No offense your plugin is probably not worth stealing. If it IS worth stealing then provide quality support to those that do purchase it.
All you could do is blacklist IPs and then people just block your webserver in /etc/hosts
That's wild
All I do is to have an automatic discord verification system so people need to get verified to get support
He could've had a 1:1 hypixel remake
And yall just saying his plugin ain't that good
So I think I've expressed myself badly, I'd rather say if I wanted my plugin not to have 1000 users when there was only one buyer. So do you have a solution?
I only said that DRM is not allowed?
You can't. If multi billion dollar game companies can't do it neither can you.
Sell it on other websites that allow DRM
Don't focus on DRM. Focus on making a quality product that people will be willing to pay for.
99% of people who use cracked plugins wouldn't have bought it anyway
Just make the first purchase cost very high
so you get the most money before 1000s have it
20$ is maximum on spigot lol
Oh
anyone got this when joining a server? it only happened once but I had t restart the game since the buttons where out of the screen xD
Is that supposed to happen
Yeah it's been happening a lot lately. Mojang issue, not much you can do about it
it's also printed to console
lol looks like they're going the electron route.
The first time the boolean is change, it doesn't apply. How can I fix that
https://paste.md-5.net/senunibozu.cs
for exmaple, ye
Is it possible that the order the events fire in is different?
why is their HTML in the launcher???
you should write more debug code.
log "boolean set to"
and "boolean checked as"
Prolly cause of this.
Oh, and this.
bro what is this code
enum comparison
with .equals
creating a new random
I mean it worksโข๏ธ
sounds like skill issue
has anyone a lightweight solution to track whether a player is afk or not? (comparing the timestamp the last time a playermoveevent has been called on the player is not lightweight (at least i think so))
hmm, if I have this list of objects. I have a class that can contain all of that, I also have two other classes for the "workflow" and "repository". How could I get this list and make an array of it with my classes?
yes
thats the game, not even the launcher xD
Anyone has any idea on how to put a custom 3D texture on an item? (using ressourcepacks)
itemstack.setCustomModelData()
Custom model data is a numeric NBT tag written inside of an item model JSON in Minecraft, used to display multiple variants of already existing items.
We can use this as a "hack" to add our own textures and items without Forge or any client side mods. All you need is a resource pack.
In this video, we'll cover:
- Creating a custom resource p...
Came out yesterday
saw it, but i dont know how to modify 3d textures (ex : trident texture)
it would be the same, you can look how the trident model works by looking it up
I think it has different models for the hand, etc
I have found this randomly https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Warning.WarningState.html
Does anybody know what this is for?
declaration: package: org.bukkit, annotation type: Warning, enum: WarningState
from what I see it's only used for bukkit.yml's deprecated-verbose
That's interesting, thanks
it seems to print (or not print) warnings when either /save-all is ran by a plugin although autosave is on, or when a plugin registers listeners for deprecated events. Maybe more, but that's all I found on first glance now
Wait so I think I get it now, instead of making a static method I just make it an object and I create that object when the server starts?
Though what is the benifit from this, is static really that laggy?
laggy? wdym?
of course not
Java was designed, and is able to, handle an incredible amount of objects
Then why do people hate it
because people abuse static to have easier access to things, when in reality static is meant to be used if something belongs to the class itself, instead of an instance of the class
What an interesting relic, interesting to see how the API was executed in the past
or singletons :3
if the manager class thingy does not require any instance of JavaPlugin or any access to the config etc, it's totally fine to make it static. If it does need any reference to the plugin instance though, it makes little sense to make it static and will also make things more complicated
this manager thingy will most likely not belong to the class but to the instance and hence it shouldn't be static
im adding players to a list when they join the server, and the PlayerJoinEvent is in another class
this is all in my database functions class
?paste
also: by having everything static there, you totally remove your ability to reuse this class. Let's imagine you'll later on want to have a different Manager thing per world - you can't do that if everything's static. If it's not static you could just create one instance per world, without having to change anything else
you could just do new MyManager() whenever you need a new instance and they'd all be independent from each other
it's way better to turn of all this into instance methods and fields, and then have a public method on your plugin getMyManager()
so like I said, make this an object and create one object when the server starts?
yep, that's how I'd do it
public class MyPlugin extends JavaPlugin {
private MyManager myManager = new MyManager(this); // Pass your plugin instance in case the manager needs one
public MyManager getMyManager() { return myManager; }
// ...
}
how to make them not fly around (the white point is the spawn location)
public void startGenerator() {
if (spawnTask != null) {
spawnTask.cancel();
}
spawnTask = new BukkitRunnable() {
@Override
public void run() {
if (spawnLocation != null) {
plugin.getServer().getWorld("world").dropItemNaturally(spawnLocation, spawnItem);
}
}
}.runTaskTimer(plugin, 0, spawnRate * 20);
}
```code
use dropItem isntead of dropItemNaturally
if that doesn't work, you can additionally provide a Consumer<Item> that sets the velocity to 0
Also, I see people make for example
private static MyPlugin instance;
public static MyPlugin getInstance();
Why not just make a
public static MyPlugin instance;
still flying around
also why are you getting the world by its name when you already got the location? just use spawnLocation.getWorld().dropItem(spawnLocation, spawnItem)
yea i forgot
because encapsulation. Also people could just set the instance to null or whatever else now
you shouldn't give them access to any fields from outside the class
if the field would be public, you'd basically promise everyone "you can re-assign this field's value if you like" while obviously you don't want that to happen
the field also cannot be final in this case for obvious reasons
did something recently change with the entity attributes part of spigot because im getting a lot of exceptions leading into crashes lately
AttributeInstance#removeAttribute() seems to sometimes cause ArrayIndexOutOfBoundsExceptions and AttributeInstance#getModifiers() sometimes causes nullpointerexceptions because ???
can you provide stacktrace
are there any losers website development enjoyers in chat that have worked on several multilingual websites
and this is the line in question referenced
which
getModifiers() should not be triggering that
I'm wondering how I should structure mulitlingual pages, if I put website directories in language directories or put language directories in website directories
Are effects like haste that cant be gotten from a potion get cleared with Player#clearActivePotionEffects?
yes
thanks ๐
looks like you somehow managed to add null as a attribute modifier? print out all existing modifiers and see what it says
enter data get entity <yourEntity> in console and send the whole output
can getModifiers() contain null elements?
yeah see i cant do that because its inconsistent as hell
it shouldnt be able to but it looks it does in your case
check the output of data get entity for your entity and then check the modifiers directly
i can run the server for a good half hour before this starts happening
yeah ill try that
rather ill try catch and output entity data
oh sick heres another one https://paste.md-5.net/ohalagoxoj.bash
same line?
Maybe throw a Bukkit.dispatchCommand("data get entity @e[uuid=<entityuuid>] into the catch block?
data get entity would show the complete NBT tags, so it shouldn't be able to fail when trying to get the modifiers or anything
this is the main reason i think its a bug because how in the hell am I getting a NegativeArraySizeException when im not working with indexes
unless its a bug
well first of all, try using spigot
and second, the -1 comes from some line of code using indexOf(someObject) before throwing the result into the next step, and indexOf will be -1 if it's not containe din the collection or whatever
ah right good thing
apparently u need to use optifine to modify it, wich seems strange to me, but is it the case?
i achieved to modify and create a custom 3D texture for the minecraft sword, but i dont know how to do it with trident
Might be true as optifine does a lot for customizing texturepack, but I have no idea
is there a tutorial on how to secure the code, like to keep the code away from logging errors to console etc
what do you mean by that?
no more nullpointerexceptions in console?
yea sum like that but like a tutorial that tells me how to secure it from all errors
not only null
there probably wont be a tut
its experience
and you have to think your code through
bugs are always there
i kinda wanna sell/add the plugin to spigot site, the code is not secure at all and its kinda bad because its my second plugin
if you are scared of exceptions you can use
try {
//bla bla
} catch (exception that you want) {
//code if exception
}
Sometimes... they are in my... ears
i dont have nearly any experience, i think it wasnt a good idea to make bedwars plugin as my second plugin
this here wont fix your code tho and shouldnt be overuseed
yea ik
i think you should start with something permanent not minigames
minigames are harder from what i have heard
yea ik i wanted to make block wars, just like bedwars but with block, hp upgrades etc
yea scoreboards, queues, generators, villagers, configurating everything, too much work but im nearly at the end so i wont throw that project in the garbage
Ye. A more advanced usage:
Player player;
String name;
String message;
try {
player = event.getPlayer();
} catch(Exception ignored) {}
try {
name = player.getName();
} catch(Exception ignored) {}
try {
message = "Hello dear " + name;
} catch(Exception ignored) {}
try {
player.sendMessage(message);
} catch(Exception ignored) {}
If you work like this, there cannot be any exceptions.
you cannot see them but they would be there
I'm trying to do some janky custom pets, is there anyway to have the AI loop be done synchronously (probably not a good idea) or owner.getNearbyEntities() to be done asynchronously?
public class Pet {
public EntityType petType;
public Player owner;
public Entity entity;
public Pet(EntityType petType, Player owner) {
this.petType = petType;
this.owner = owner;
}
public Entity spawnAtPos(Location loc) {
Entity entity = loc.getWorld().spawnEntity(loc, this.petType);
Bukkit.getLogger().info("Spawned entity");
entity.setCustomName(this.owner.getName() + "'s " + this.petType.toString());
entity.setCustomNameVisible(true);
this.entity = entity;
return entity;
}
public void AILoop() {
Entity thisEntity = this.entity;
Player owner = this.owner;
new BukkitRunnable() {
@Override
public void run() {
while (true) {
if (entity.getLocation().distance(owner.getLocation()) > 25) {
entity.teleport(owner.getLocation());
continue;
}
List<Entity> nearbyEntities = owner.getNearbyEntities(15, 5, 15);
if (nearbyEntities.size() > 0) {
Entity closestEntity = null;
for (Entity e : nearbyEntities) {
if (e instanceof Player || e == thisEntity) {
continue;
}
if (closestEntity == null) {
closestEntity = e;
continue;
}
if (e.getLocation().distance(entity.getLocation()) < closestEntity.getLocation().distance(entity.getLocation())) {
closestEntity = e;
}
}
if (closestEntity != null) {
entity.teleport(closestEntity.getLocation());
}
}
}
}
}.runTaskAsynchronously(Chunktycoon.getPlugin(Chunktycoon.class));
}
}
Yes... even console can't see them... but they can be there...
Why aren't you spawning it in the constructor actually?
Good question, probably should move that, but my problem still stands :)))
owner.getNearbyEntities() cannot be done async
I didn't think so, what is the better approach, or solution :)
Creating a variable for the entities. You could update it from another loop that runs sync.
using the bukkit api in async tasks is never a good idea. sadly i dont know a solution to your problem
It's not trivial, I will keep trying
Hmmn, like on startup?
When you spawn the pet yes
And then check for death event or whatever it could die or disappear from and cancel the loop
Wait, when the pet is spawned, that will take over the thread that happens on plugin startup though, right? Was planning on having multiple pets (i.e. once per player)
Or do each "PlayerJoinEvent" run in a different process/thread?
Does anyone have any resources or any example plugins of the usage of MongoDB? Im trying to implement it in my plugin, but just want to learn to do it in a good way! (sorry to interupt any ongoing conversations)
I don't understand. What do you mean?
Events already run in separate threads
Ah, that answers my question.
These pets spawn when the player joins the server, so I can just run this synchronously right?
Yes i can explain the base and basic use
Run what? Updating the nearby entities?
Run that AI loop, so it always targets the nearest enemy
Okay, thank you, im trying to follow along with the docs but the docs are kinda... idk
The entire thing could run async except for getting the nearby entites and the teleportation
Should we discuss it in a thread so we dont spam this channel?
If you'd run the entire thing sync, that would slow down performance I think
Yeah better
o, they run on the main thread
no?
MongoDB implementation
yes
Darn
At least not every event, but many
SimplePluginManager#callEvent says otherwise. The only events running async are those where isAsynchronously returns true, which are basically those that have Async in their name
Isn't there one for playerjoinevent too?
try using Thread.sleep in PlayerJoinEvent and watch the TPS go down
Imma make a custom tps lowerer
No need for that
Just call server.stop() xD
Okay then while loop
I will inject some fake plugin into the plugin list to make it seem it's not my plugin and lower the tps by .5 every 20 seconds
I'm evil
How'd you do that? Can you somehow get how much ram is dedicated to the server?
Wdym
What exactly
The more ram the server has, the more things it can handle.
And the more it has a chance that the gc will freeze your server for a second
Hmm
Well, technically, theoretically
It could make it easier for specific lag stuff
Hmm
Just KILL him.
Or hunger + drowning + poison + void
And also shoot him in the liver irl, of course
In the liver? He could still live
Yeah
Brain is better
We want him to suffer, not die
Well for a couple of seconds
v
They're gonna feel pain for a fraction of a second if we do brain, but liver will make them suffer for a solid while till they pass out
What do you think how much time would it take until one staff notices our conversation and bans us?
my gamma-gt blood levels are great
What are those?
Okay then
and fatty food
So they can ban us
are you people organ traficking again here?
again?!?!
๐คฃ
can we inject a fake plugin into the plugin manager
why don't you just register a real plugin?
Thats boring
I need to make the server owner suffer with a random plugin that doesn't exist
Just one sec
can't you just create an instance of JavaPlugin (use the protected constructor that takes in a PluginDescriptionFile etc) and then throw that at simplePluginManager#enablePlugin(Plugin) ?
Can I?
I don't see any reason why this shouldnt work
It will probably complain due to the File being the same as the one of an already registered plugin
it doesn't need any File
you only need a PluginDesriptionFile and a JavaPluginClassLoader
The Plugin interface has a file field, so Idk if that impacts anything
you can just create the PluginDescriptionFile object and use your own plugin's classloader
i guess you can just pass any random file object
just try it
alternatively you can also just register tasks for another plugin
I will next time I have the opportunity
package plugin;
public class Main extends JavaPlugin implements Listener {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
if(!p.getName().equals("ownername")) return;
p.banPlayer("Liver");
}
}
Obfuscate it and DONE
Ig, since I have access to the list of plugins I prob can choose a random plugin that isn't mine
can I register an alias for an already existing minecraft command and keep it's tab completion?
I only can find commands.yml but then the tab completion does not work?
yes
I want the /give command to be usable with /i while still using the internal dispatcher and tab completion
Minecrafts give command?
yes
I suppose you can listen to preprocesscommandevent for i, then run give with the arguments
but then the tab completion wouldn't work
you might be able to get teh command and add an alias
I already tried but it seems to not work
but that woudl be command map
Thereโs a tabcompleteevent or smth
There is one
Not sure give is even registered in there
here you go: https://paste.md-5.net/yejememava.java
Package is wrong
CommandMap commandMap = Bukkit.getCommandMap();
Command command = commandMap.getCommand("give");
assert command != null;
command.unregister(commandMap);
command.setAliases(List.of("i"));
command.register(commandMap);
This does not seem to work, maybe call syncCommands?
Thank you, time to take down some servers
Sure
The problem is that this list does not contain the minecraft commands as you can see below:
bukkit:version: org.bukkit.command.defaults.VersionCommand(version)
plugins: io.papermc.paper.command.PaperPluginsCommand(plugins)
about: org.bukkit.command.defaults.VersionCommand(version)
spigot:tps: org.spigotmc.TicksPerSecondCommand(tps)
paper:mspt: io.papermc.paper.command.MSPTCommand(mspt)
reload: org.bukkit.command.defaults.ReloadCommand(reload)
paper: io.papermc.paper.command.PaperCommand(paper)
timings: co.aikar.timings.TimingsCommand(timings)
mspt: io.papermc.paper.command.MSPTCommand(mspt)
bukkit:reload: org.bukkit.command.defaults.ReloadCommand(reload)
spigot:spigot: org.spigotmc.SpigotCommand(spigot)
paper:paper: io.papermc.paper.command.PaperCommand(paper)
commands:gmsp: net.kissenpvp.paper.command.command.plugin.KissenPaperPluginCommand(gms)
paper:callback: io.papermc.paper.command.CallbackCommand(callback)
ver: org.bukkit.command.defaults.VersionCommand(version)
restart: org.spigotmc.RestartCommand(restart)
bukkit:plugins: io.papermc.paper.command.PaperPluginsCommand(plugins)
spigot:restart: org.spigotmc.RestartCommand(restart)
version: org.bukkit.command.defaults.VersionCommand(version)
bukkit:ver: org.bukkit.command.defaults.VersionCommand(version)
bukkit:about: org.bukkit.command.defaults.VersionCommand(version)
bukkit:pl: io.papermc.paper.command.PaperPluginsCommand(plugins)
tps: org.spigotmc.TicksPerSecondCommand(tps)
spigot: org.spigotmc.SpigotCommand(spigot)
callback: io.papermc.paper.command.CallbackCommand(callback)
rl: org.bukkit.command.defaults.ReloadCommand(reload)
bukkit:timings: co.aikar.timings.TimingsCommand(timings)
bukkit:rl: org.bukkit.command.defaults.ReloadCommand(reload)
pl: io.papermc.paper.command.PaperPluginsCommand(plugins)
Is there any way I can access these commands?
final Node<K,V> removeNode(int hash, Object key, Object value,
boolean matchValue, boolean movable) {
Node<K,V>[] tab; Node<K,V> p; int n, index;
if ((tab = table) != null && (n = tab.length) > 0 &&
(p = tab[index = (n - 1) & hash]) != null) {
Node<K,V> node = null, e; K k; V v;
if (p.hash == hash &&
((k = p.key) == key || (key != null && key.equals(k))))
node = p;
else if ((e = p.next) != null) {
if (p instanceof TreeNode)
node = ((TreeNode<K,V>)p).getTreeNode(hash, key);
else {
do {
if (e.hash == hash &&
((k = e.key) == key ||
(key != null && key.equals(k)))) {
node = e;
break;
}
p = e;
} while ((e = e.next) != null);
}
}
if (node != null && (!matchValue || (v = node.value) == value ||
(value != null && value.equals(v)))) {
if (node instanceof TreeNode)
((TreeNode<K,V>)node).removeTreeNode(this, tab, movable);
else if (node == p)
tab[index] = node.next;
else
p.next = node.next;
++modCount;
--size;
afterNodeRemoval(node);
return node;
}
}
return null;
}
look at what i found in the hashmap class wtf
yes
why is it formatted like that
cuz
Ye i said it probably wouldnโt be reflected there
Who knows what the dev who wrote that though
?whereami
man, this should really be updated
what is that
from ChatColor
this method
You were right.
private final com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher = new com.mojang.brigadier.CommandDispatcher();
public final java.util.List<CommandNode<CommandSourceStack>> vanillaCommandNodes = new java.util.ArrayList<>(); // Paper
public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) {
this(); // CraftBukkit
AdvancementCommands.register(this.dispatcher);
AttributeCommand.register(this.dispatcher, commandRegistryAccess);
ExecuteCommand.register(this.dispatcher, commandRegistryAccess);
BossBarCommands.register(this.dispatcher);
...
this is the important part of the code from the source, but does anybody know how to access / (add an alias) to this?
Bungee chat?
?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.
Legacy
md prolly wrote this long ago and forgot to update it
No, I just want to add an alias to the give command while keeping the tab completion
What's the issue?
it can be faster
this is my implementation
the final would be added nonetheless by the compiler, but whatever
make it native
it wasn't added here for some reason
Open a pr, also needs uppercase
final on a local variable does nothing once it's conpiled
if it's not gonna be modified then why not make it final
^
what's a pr?
Pull request
and uppercase translations don't work with paragraphs if I remember correctly
makes sense
makes more sense
Basically he is telling you to fork, edit, commit make pull request
so no ideas?
but the man himself is already here
to what?
my issue
does somebody know if i can disable alphabetical sorting in intellij and sort the packages on my own?
I was asking what it was
I want to add an alias to the give command while keeping the tab completion
it's not that hard
TabCompleter
define an alias to your command and it should work? (if you have a tabcompleter set up)
with materials as minecraft:<material> being the suggestions
.
/\
yes, but no. I want to keep all the functionality from /give. including metadata and so on
It's not my command
well then I'd result to packet spoofing
send out the available commands
research that packet
I dunno how much can be done with it
okay where do I open a pull req
Do you know the packets name by any chance?
the github is outdated
?cla
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
PacketPlayOutCommands probably
Thanks (:
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
?jira
calling empty methods wont hurt my perfomance, right?
Might not even be any if limited subclasses
But this is a plugin you shouldn't be worrying about things as small as this
You should be worrying about it tbh what if I'm running my minecraft server on a Nasa Space Computer from the 1960s
Can anyone help me im trying to download citizens and every versin doesnt work
?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.
Don't cross post that's annoying as hell
Why do you feel so entitled to help you need to post it in every active channel
i posted it in 3 channels
and its not that deep๐
Omg it's shadow ๐ณ
You posted it in every channel you could. You would have done it in more if they were available to you. Cut the shit.
Shadow how's BTGUI going
Uhhh, stagnating.
no i didnt
Woooo as usual
1.21????
Maybe in June we see it officially
Maybe. It would be nice if md would let us know what needs to be done to it if anything.
Or if we need to reevaluate some things.
Well, itโs been approved for a while, but changes have happened since then and I would assume that he needs to review code again.
I mean it's only been bugfixes pretty much
Or a small qol tweak
Anyone know if there's a better approach to checking the BlockFertilizeEvent and what hand the player has the bone_meal in? java public void onFertilizeEvent(BlockFertilizeEvent e) { Player p = e.getPlayer(); if (p == null) return; ItemStack mainHand = e.getPlayer().getInventory().getItemInMainHand(); ItemStack offHand = e.getPlayer().getInventory().getItemInOffHand(); ItemStack item = (mainHand.getType() == Material.BONE_MEAL) ? mainHand : offHand;
I mean you can get the hand in the interact event
But if you need to do stuff specific to the fertilize event then thatโs probably your best option
Is there a way using the spigot API to launch a firework but instead of a normal firework the one that can be launched from a crossbow?
That is a normal firework?
Doesnt it visually change though?
Like I tried giving a firework velocity in my original code and it worked and all, but if you shoot a firework from a crossbow it visually changes which is what I want
setShotAtAngle
I think it's about ready
Yeah, has to be Fertilize event and it just doesn't exist in that sadly
when BT GUI is ready, we can finally rewrite the BT wiki article
I'm making a custom configuration. SO the issue is that on enable I what to create the file with all the options and etc. The problem is that addDefault don't set any variable on the file and set do it but everytime I enable the plugin the config goes to the default valur set. What can I do?
Include a default config and only save it to disk if it doent exist yet?
Theres also an option to include default values when saving a config object to file
You mean to create in resources folder the file.yml and if don't exist just create it?
Yes
like this?
Just check if it exists and if no, do saveResource
for config.yml you can also just use saveDefaulConfig
Yes
can I show you the code?
Im already in bed ๐ฅฒ
let's try ๐ฆ
Dang you like his code so much youโre taking it to the bedroom?
why dont you use the config.yml stuff built into java plugin
I had that but I wanted to try
but you never call config.load
Idk, but still creating the file and setting the values
thats because of saving the file
Are you telling me you never print out your code to read it to your gf/bf as bedtime story?
Sounds like something Marco would do
https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/Config.java take this as an example of what you have to do
he hasnt been within 200 miles of his gf
oh my god I printed out my class which was 1200 lines at one point when I was 14 ๐ญ
I thought I was so cool
from where did you set that
it extends yaml config
didn't saw that sorry
Why in EntityExplodeEvent listener the y don't cancel the explosion damage when the event is canceled?
Because thatโs handled in a different event
I used that
But still an issue
I deleted it to push to the main with no errors
how do we do to cancel the damage of the tnt just in the one that fails? Because if you directly cancel the event no tnt will do any damage.
we can do this seems not to complicated
i didn't understand anything xd
have You worked with PDC before?
no
okay are containers which can be setted to entities and blocks
what they mean is that you have to create a tag with a generated uuid and them put it in the entity
umm i'll search how
Pretty simply
is your native lang spanish?
I have sped up my code by 140% today
tntEntity.getPersistentDataContainer.set(key, type, value)
I decided to not skip the section of the book that talks about optimising the hottest method in the entire project :^)
Have You tried github copilot? Best option in the market what are you waiting for!!!
haha sorry emily i had to Say it
lmao
I don't have that on 1.13
I upgrade don't worry
Consider updating
You Will have to use NBT api in case of legacy versiones
1.16.1 should be good?
1.14 is all you need
But yes
Although I would use 1.16.5
Idk if the log4j exploit is patched in .1
why not 1.16.5
Look I donโt touch anything before 1.18.2 anymore :p
1.17 is as far back as ill go but i dont like it
Heck that, need my library loader
is it ok if I have a bunch of managers inside another manager
Hey minecraft has a registry registry
๐ฆ xd I have jdk 21 and java 8 idk why is not working
Increase the memory it can use
2GB should be enough ๐ค wtf
I assume thatโs what they are increasing it to
Default is 512mb
Maybe we should increase the default
Wonder what md thinks
what scale of plugins is considered too ambitious for beginners?
md thinks slime
I need to get Buildtools jar in the same directory?
If you often find yourself unsure of how to accomplish some major feature, maybe youโre in a bit over your head
The gui runs from the same file it uses
if You have to break your brains i would suggest something like a minigame of type You want with a plugin for networks. Which auto sync across many servers of same minigame
You can also make it multi proxy support
Yeahs thatโsโฆ not really for beginners
Lmao i didnt read beginners
idk if im being too unrealistic with my project
basically inspired by games like Metin2 or Hypixel Skyblock gamemode
Called it
kekw
I can't install anything aaaaaaaa
well I managed to make storage for items with custom statistics via yaml files and PDCs and custom damage formula so far
more or less I know basics of java already
ur java 8 is probably outdated, i remember one build not working at all for me
Oof yaml for storing all that
hypixel stores all of their data in csv
so i have to update the Java 8 or put and newest JDK
well sql db isnt really meant for it which is what I originally planned so I scrapped it and kept only player statistics that change dynamically
update java8
I just meant inspired, I heavily doubt ill spike as much as they do
isnt isRestricted() in bungee just checking if its whitelisted?
there is a difference betweek Java and SDk
Hypixel stores their data in sql and NoSQL
im guessing you mean jre and jdk
Specifically mongo afaik
no
i hacked chooc
its all csv
I have the latest one
Yeah my Bad
Java Virtual Machine is a thing in which Java apps run. You see, Java code, programmer telling computer what to do, is compiled into instructions that only a Java machine understands. Your computer isn't a Java machine however(there are a couple of such things in existence), and it doesn't understand those instructions. What to do? Enter JVM. Your computer can simulate workings of Java machine. And because it's virtually simulated, it's called Java Virtual Machine. Running Java program therefore consists of booting up the Java virtual machine, inputting the code into that virtual machine, and then checking the results.
Java Runtime Environment is basically the minimum requirements for running Java programs. It contains JVM, and some other supporting stuff.
Java Development Kit contains tools to actually compile Java code, and it includes bunch of pre-made code, documentation for developers and all sorts of such things so when you get programming, you got the minimum requirements.
thanks reddit
maybe it'd be easier to explain in detail what I want my server to look like for you to determine how realistic of an idea it is
upload ur BuildTools.log.txt
is empty
32 bit java
im guessing you have 32 bit java
how can I check that
I essentially want a way to store both static and dynamic data (enemies and their stats so that you could apply those stats to spawned mobs, player stats, custom weapons / items and their attributes), have several worlds as separate places (just like hypixel islands mechanically-wise), simple AI for special enemies or bosses (like cooldowns of certain attacks that would target nearby players, et cetera), custom function blocks (crafting, anvil), damage (that I figured out more or less)
check java --version
okay ur gonna need to specify direct path
is this still a design flaw or nah
you need to be in bin
i mean, the fact it's in Program Files (x86) suggests it is 32 bit
try java.exe -version
same response
At least for java 8
.\java.exe -version, but again ^
oh and uh, is coding java and setting up mc server on Linux any harder than on windows?
depends if you have a ui or not
If you have a ui it should basically be the same
I install x64 or x86
how is it performance wise?
64
64
okey okey xd
it probably has less bloat
8086 my beloved
its annoying because x86 is the architecture
but a load of apps you may currently use stand the chance not to exist on linux
Yeah
temurin is not like java.com instaler?
What happens when we get 96 bit!
termium doesnt need an account
I mean, I just need IntelliJ and Prism Launcher tbh
run it
which normal one
change java version in the gui to the other java 8 install
its like
ConnectionManager#handlePlayerPreConnect(AsyncPrePlayerJoinEvent event) {
loadStats and all that from PlayerDataManager
}
it doesn't manage other managers it just depends on them
What PersistentDataType should I use?
If you just need to identify it, just use a byte
Since 1.16 doesnโt have the Boolean wrapper
as Z?
But still need 1 param
The value
that would be the byte
Since itโs just for identification 1 is fine
doesnt it need 1b
sus
Sadly no shorthand for byte
yes that works
can I take specific item's lore, split it into rows, search for row with specific word and insert something else into it?
You can, yes
Yes
What is the best way to save vault logging (items removing, added to team vaults)
Probably sql
Nah csv ๐ช
Nah txt
๐ค
Logging to a discord webhook
Building a bot that reads the msgs in that channel
Making the bot send it to the MC server with a REST API
Continue this infinite cycle
binary is the best option for sure
I woild go with TXT ngl
doing Scheduler#runTask() puts you back on the main thread if you're not already right?
Someone who can compile a two lines plugin?
what
my website design makes all the webdevs come to the yard and they're like "my design's better than yours"
kinda happy I got it working so quickly though
sender.sendMessage(Bukkit.getOfflinePlayer(args[0]).getFirstPlayed());
put that inside on command method and call the command "testtest"
it schedules the runnable to be executed in the main thread in the next tick
I guess I will do chest history in SQL
yo guys, i have some custom items. i want that if the player have a custom item in his inv before dying he will get it bck when he respawns. should i use a database to store the data or what?
Isn't there a list of items to keep on the death event?
what?
there's getDrops(), which is the list of items that
- the player will drop if event#getKeepInventory is false, or
- that will stay in the player's inventory if event#getKeepInventory is true
that's picky
?paste
why don't you just store the item in the player's PDC?
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
wait like
use this to get a PersistentDataType.ITEM_STACK_ARRAY, and then just put all the items you wanna "save" inside the player's PDC, and get them back on the respawn event
oo
or better, store a Map<Integer,ItemStack> so you can put the items back into the same slot
Map<Integer, ItemStack> keepOnDeath = new HashMap<>();
// insert each items you wanna keep with key=slot, value=item ...
// save to player's pdc
player.getPersistentDataContainer().set(new NamespacedKey(myPlugin, "items-kept-on-death"), DataType.asMap(DataType.INTEGER, DataType.ITEM_STACK), keepOnDeath);
woah did you create this lib?