#help-development
1 messages · Page 1676 of 1
ok, then so long as you load it correctly, specifying the modid it should work
🤷
new ResourceLocation("nitrous", "background.png");
oh? I don't need to put assets/nitrous?
hm
if its still not workgin, open your jar and make sure you have an assets folder in the root
It's there
How would I get a direction vector with 2 locations. Im looking for the direction from fromLocation to toLocation.
Im using this code;
toLocation.subtract(fromLocation).toVector();
But the direction dosent seem to be correct.
toLocation.toVector().subtract(fromLocation.toVector());
Let me give it a shot, thanks
guys if i want to store a value from player with mysql what the command i should to use?
That all depends on your sql table
...
o
oops
yeah depends
That data seems very minor. do you really need it in sql?
yup
[20:47:29] [Client thread/WARN]: Failed to load texture: nitrous:background.png
java.io.FileNotFoundException: nitrous:background.png
``` ugh
file not found? it shoudl be looking for a resource in teh jar
🤷
Hmm that didn't work either :/. That gave me no direction I'm pretty sure. So I'm trying to generate a location that is in a direction to another location at a specified distance... Basically a waypoint for pathfinding over long distances.
Here is the class;
https://pastebin.com/MCJyEmX3
It seems that the direction is where the problem is, I'm calculating distances between locations to debug, on one access it works. but if i move diagonally to the other side of the the destination location the generated location actually gets further away from the destination, which I assume is because the direction vector is still facing the same direction. I'm no good with vectors and still very new to them but any help would be appreciated.
final Vector vector = targetLoc.toVector().subtract(sourceLoc.toVector()); Definitely works
Just noticed that from google. toLocation.toVector().subtract(fromLocation.toVector());
I use it in a lot of code
man this is dumb
/**
* Pass a Projectile and a destination
* to set its direction and new velocity.
*
* @param projectile
* @param targetLoc
* @return
*/
public void setTarget(final Projectile projectile, final Location targetLoc) {
final Vector velocityVector = targetLoc.toVector().subtract(projectile.getLocation().toVector());
velocityVector.normalize().multiply(projectile.getVelocity().length());
projectile.setVelocity(velocityVector);
}```
It's like it straight up ignores it
make sure 100% the resource exists in teh correct location inside your jar
Thanks
um, assets.nitrous?
nitrous should be a folder inside assets
it is
ok
and it is actually copied correctly inside the jar?
as a test try new ResourceLocation("nitrous", "nitrous/background.png");
well all I find says just background.png should be correct
you did set your ModId to nitrous?
as nitrous is not what you said it was before
yea
then from what I can see it should be working
modding is on a different level of wack
tried different image still doesn't work
it won;t be the image, its either the name you set for teh mod or, well no idea. from what you have told me its correct
i tried a diff name
I also get this ```java
[21:06:06] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:music.menu
[21:06:11] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:music.menu
[21:06:22] [Client thread/WARN]: Unable to play unknown soundEvent: minecraft:music.menu
make the name a static final, defined in your main so you can just use the variable elewhere
make ResourceLocation name static?
no your modId
in my gradle...
in your mod
so you just want me to do public static final MODID = "nitrous";
so you only change it in one place and don;t have to reype it
yes
then use that everywhere you need the modId
from this point I'd need to see code to spot any thing wrong
I've shown you how it "should" work
What's your github name?
the same as here
ECoral
I sent you something
got it
Pretty sure most of that texture loading should be in the init() method not render
render is called a lot and you don;t want to be loading the texture every time you render
however I see no issues with yoru code so far
When normalizing a vector it basically just becomes a direction correct? Then after multiplying by say 10.0 the vector should be 10 blocks away in that directions?
normalizing limits its length to 1
yes, multiply would make it 10 blocks, IF you are facing in one specific direction
im getting results over 100 blocks away grr
normalize the result of the subtraction
yes
private static Vector getDirectionToLocation(final Location fromLocation, final Location toLocation) {
return toLocation.toVector().subtract(fromLocation.toVector());
}
private static Location getLocationAtDistanceWithDirection(final Location location, double distance, final Vector direction) {
return direction.normalize().multiply(distance).toLocation(location.getWorld());
}
How do i paste code
please wrap in 3 `
oh
3` private static Vector getDirectionToLocation(final Location fromLocation, final Location toLocation) {
return toLocation.toVector().subtract(fromLocation.toVector());
}
private static Location getLocationAtDistanceWithDirection(final Location location, double distance, final Vector direction) {
return direction.normalize().multiply(distance).toLocation(location.getWorld());
}3`
it's a white screen
three ` not 3` 😉
lol sorry
return toLocation.toVector().subtract(fromLocation.toVector());
}
private static Location getLocationAtDistanceWithDirection(final Location location, double distance, final Vector direction) {
return direction.normalize().multiply(distance).toLocation(location.getWorld());
}```
return location.add(direction.normalize().multiply(distance));
can you paste teh error you get
no errors
I'm seeing nothign wrong in your code
so for a big network server is it recommended to create your own permissions/rank plugin or just use luckperms?
I'm trying not to rely to heavily on 3rd party plugins
GM has been here since the year dot. LP is newer and handles larger networks better
yeah, the goal is thousands of players.
I mean, I'm not expecting thousands of players immediately, but hopefully the server makes it years. basically everything is being made custom
no thousands on one server either, its a network, so multiple servers on one network, with ideally one database
is the assets folder in the very root of your jar?
@eternal oxide Thanks for the help man, its nice not getting screamed at for not knowing something 😛
everyone is a noob with vectors to start.
Right, they are like magic
what do you mean?
pretty much, till you get your head around the 3d world space
yea
the database drivers in the spigot api are for MySQL right
Sorry wrong tag
oh okay lol
is the assets folder in the very root of your jar?
yep, in your build folder it looks like its nested under main
whats it look like in your final jar
Then I'm afraid I can;t help any further. From what I can see everything is correct.
I see nothign wrong in your code
is there a way to change nametags?
player nametags
something with scoreboards or something right?
This is the same error you were having. with code and its fix. https://forums.minecraftforge.net/topic/17277-solved172problem-with-binding-texture-to-modelrenderer/
I was doing that before though
oh
If you manage to find the fix let me know
not sure why the background is white though
white? you have the texture not erroring now?
no errors
wait
no I do
i am just blind
same thing
java.io.FileNotFoundException: nitrous:kfc.png
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
but it is just blank
it will be, it says it can;t find the resource
in the runnable are you getting any blocks or checking any locations?
Well your error says you are triggering a new chunk load while the chunk is already being created in another thread
that runnable can;t have anything to do with it
I'm going to assume you have set a getCore()
then no I don;t see its possible
Not with the code you have shown
do you have ANY world/chunk/populator listeners?
a different error is good
well
um, are you running on windows?
you
is your server running under windows?
ok, make sure you only have one server instance running
./hubworld-2409fcd5-20be-45e7-9c8e-9f5aac03b105 has a session lock from another minecraft instance
perhaps from an earlier crash
Yeah so right now its a white screen and if I full screen it turns black
That just means there is no texture loaded/applied
right
well at least now it's not what it was before
wait does the image have to be a jpeg?
not from what I've seen
Yep I see no reason for your issue. You will have to find some Forge expert
You think I will find any here
doubtful
well I guess thanks
stop server, delete any session.lock files
how can i read a file including semicolons
final var name = prompt();
return name;
String text = reader.lines().map(String::trim); // removes all ending semicolons
tried a scanner?
that should work, didnt think of it
still skipping a lot of things
spaces, etc.
i dont feel like making a pattern
why does it remove semicolons anyways
else you will have you use a reader
i tried
ah sorry yep
// Before
call getName() {
final var name = prompt();
return name;
}
// After
call getName() {
final var name = prompt()
return name
}
InputStreamReader scanner = new InputStreamReader(Assess.class.getResourceAsStream(args[0]));
StringBuilder builder = new StringBuilder();
while (scanner.ready()) {
builder.append((char) scanner.read());
}
its doing \r's
i gotta make my own implementation
why not nextLine()?
same issue
removes spaces?
mhm
oo
found an apache utils class
StringUtils.chomp(txt, "\r")
we arent obligated to help you
im asking for help aswell
be patient
Which website?
works fine for me
do you mean sigot or actually spogit?
lmao
spigot has been up fine all week
refreshing didn;t clear it?
You get a new challenge page when you refresh
Open Date and Time by click the Start button, click Control Panel, click Clock, Language, and Region, and then click Date and Time.
Click the Internet Time tab, and then click Change settings… then check list Synchronize with an Internet time server with name Server : time.windows.com 761 and click Update now. Try that website again because that how i solved my problem with “This challenge page was accidentally cached and is no longer available”.```
is there a way to get a plugin to interact wiht a datapack? like read the lines and maybe add custom commands
there are no datapack API methods in Spigot yet
dang
do u think it would be feasible to use something to like read the datapack files
You would have to experiment. I've not heard of anyone doing it
ok
I thought about making API to load/unload datapacks but it's just such a sketchy thing to do
Oh they do have one. Yeah that's kinda what I'd had in mind when I initially looked at datapacks but I opted against adding it for the sole purpose that plugins really shouldn't be intermingling with datapacks imo
Hello everyone, everything good? can anybody help me? I would like to detect when any player hits the diamond block that the giant zombie is holding. It is possible?
Unfortunately I can't upload the image here, to get an idea
How to put and use HikariCP in project?
Are you using Maven or Gradle?
I apologize for the ignorance, but I have no idea.
Could you show what your project looks like?
I recommend creating a maven project since it will make things easier
hey hey, wondering what the event is for when a player right clicks holding an item
NOT PlayerInteractEvent
just when they right click
i remake
and now?
can somebody fix my plugin
somebody made it for me but accidentally did for wrong version and never fixed it
idk m9
its not calling for Action.RIGHT_CLICK_AIR
which is what im doing, im right clicking the air..
How do I check the direction a block is facing?
without an item?
with
so you are doing something wrong then
fair
is there a way to check if the player is eating without an event?
p.isEating()?
o i forgot i was using 1.13 api for 1.8-1.17
Ive only worked with 1.17 so far. Sorry.
cant find iseating even with 1.17
Weird. I was sure ive seen it
Make your own iseating by making a hashset with all players and a boolean and setting a players boolean to true while theyre eating? Just an idea
Would require a listener or 2 tho...
Might not work as im imagining
Check the 1.17 release post
Show your code
you wont get a right click air event if not holding an item
this is noted in the documentation
it is impossible to detect because the client does not send a packet
He's holding an item
already sorted that out
Aight
hi yes sry all good
I've been experimenting with trying to get NPCs (Emulated players) to work with skins. Does the skin packet (using PacketPlayOutEntityMetadata) need to be sent before or after the EntityPlayer spawns? There seems to be a chance whereby the skin doesn't always get loaded on the NPC when you join the server. Interestingly, the skin doesn't work at all during a new client session the first time you join the server.
public void updateSkin(Player player)
{
GameProfile gp = npcEntity.getProfile();
if(this.npc.getSkin() == null) { return; }
if(gp.getProperties().containsKey("textures"))
{
gp.getProperties().removeAll("textures");
}
// Sets skin
gp.getProperties().put("textures", new Property("textures",this.npc.getSkin().getTexture(),this.npc.getSkin().getSignature()));
// Destroys npc entity
destroy(player);
DelayedTaskUtils.executeDelayedTask(new Runnable()
{
@Override
public void run()
{
// Respawns npc entity
spawnEntity(player);
DataWatcher watcher = npcEntity.getDataWatcher();
byte allSkinParts = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40;
npcEntity.getDataWatcher().set(new DataWatcherObject<>(17,DataWatcherRegistry.a),/* 127 */allSkinParts);
PacketPlayOutEntityMetadata skinLayer = new PacketPlayOutEntityMetadata(npcEntity.getId(),watcher,true);
PlayerUtils.sendPacketsExceptOne(Lists.newArrayList(skinLayer),npcEntity);
}
},2L);
}
Add the dependency to your pom.xml then use
http://maven.apache.org/plugins/maven-shade-plugin/ to relocate and shade it in to your plugin
How do I get which direction oak log is facing? I have tried to use
Directional data = (Directional) blockData;
BlockFace face = ((Directional) b).getFacing();```
But I get this error: craftrotable cannot be cast to directional
What is the block
OAK_LOG
Use the rotatable interface
Ok thanks
Are there any reason to make scoreboard NMS in 1.17? Spigot's scoreboard system already works perfectly even it's not async and it does not effect server at all...
I wouldn't think so
As outlined in md_5's post about devs using NMS for things like scoreboards and bossbars even though there is already API for them
That's what I was thinking actually... The only good thing about NMS could be it doesn't save scoreboard in the world file but you can avoid by resetting scoreboard in your plugin.
Why do I get an error: CraftRotatable cannot be cast to org.bukkit.block.data.Rotatable
blockData.getRotation();```
Im trying to get OAK_LOGs rotation
Why is it saying multiple root tags?
<?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>me.chrissquartz</groupId>
<artifactId>nocheststeal</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>NoChestSteal</name>
<description>Players can't steal items in chests</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>chrissquartz.cf</url>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>C:\Users\user\Documents\Stuff\mc-servers\Paper-plugin-test\plugins</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</project>
<repository>
<id>papermc-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Read the docs for oak log and you will see they're not rotatable
Your tags are malformed, Quartz
This is what you have currently
<project>
</project>
<repository>
<id></id>
<url></url>
<id></id>
<url></url>
</repository>
<dependency>
</dependency>```
ok
What you want
<project>
<repositories>
<repository>
<id></id>
<url></url>
</repository>
<repository>
<id></id>
<url></url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency>
</dependencies>
</project>```
(fill in the stuff in there obvs)
ok thanks, and also thanks for using Quartz instead of like Chriss or smth like that
It was a 50/50 lol
¯_(ツ)_/¯
hi chriss
Hi
What is the maximum length for scoreboard team prefix and suffix in 1.16+? (not for name tags, just for scoreboard sidebar display)
@lost matrix regarding your guide here https://www.spigotmc.org/threads/guide-on-workload-distribution-or-how-to-handle-heavy-splittable-tasks.409003/, what would you reccomend instead of Block#setType(Material material)
That is the only way to really update blocks exclusively with the api
other ways require nms normally
NMS is not needed but should be faster and more performant afaik.
Can i ask for bungeecord here?
yes
lemme send
https://pastebin.com/6QEQr4Q2 error
https://pastebin.com/eqMdERQA task
https://pastebin.com/1biY1MM3 method with error
spoiler: it was working fine, suddendly it stopped and giving a nullpointer.
Which line in the method is the null pointer thrown at?
Does the server affects connecting/accessing a database? Like if the server is slow, it will require more amount of times to access a sql database
You should be doing database queries on a separate thread so they're not affected by load on the main thread.
see the third pastebin
That's a single method.
I know, but does server affects the process?
Oh wait you probably can't read errors
If it's on a separate thread no
Which is line 151 in FallbackServerBungee?
Is it normal to just search if specific player's uuid exist on the database took 30 seconds?
if (pingTask.isOffline(lobbies)) {
continue;
}
Then pingTask is null
Okay, try to take a look at this code https://paste.helpch.at/lapurudumo.js
It's called in async btw.
I don't know SQL in or outside of java so I wouldn't be able to spot an issue there. I guess you could see how long an extremely basic query takes though
i have the old jar with working code
but i don't see any difference
wtf
alright thanks
Where do you set pingTask and where is the method that's causing the null pointer called from
i copied the old code and still broken
how's possible
Is it possible to check if a player is currently colliding with an entity
Found this
(first google result btw)
hii mrs darth
cause
btw if someone could help with this that would be great
here is error: https://paste.md-5.net/nikifecoyu.sql
They told you how to fix it
last element in an array? i forget if there is an easy way like -1
anyone know how to do this without linking the two variables?
ItemStack fourOakPlanks = oakPlanksItem;
sure
Does anyone know how i can parse e.g. 2 into "double" or 3 into "triple"
switch case
Minecraft preferr IPv6 on connect
thanks
i would like to know if that is possible
its not
basically is boat rotating (y) with a player as passanger
any chance to do it with resourcepack?
yeah you can let it "rotate" or at least let it move in a circle. but upside down not.
the boat yeah. but probably not the player
:C
any way to rotate the player?
Idk if im stupid or whatever but I'm using a hashmap to put the player's uuid and a Date and later getting it, but for some reason getting the hashmap with the player is null but it shouldn't be.
private HashMap<UUID, Date> lastPacket = new HashMap<UUID, Date>(); <- hashmap
saving:
Bukkit.broadcastMessage("saving");
lastPacket.put(player.getUniqueId(), new Date(System.currentTimeMillis()));
later null check:
if (lastPacket.get(player.getUniqueId()) != null) {
It somehow doesn't pass this null check even though it has been saved and the debug message has been broadcasted. Am i just stupid?
Aight
changed all dates to instants and still have the issue that the hashmap returns null even tough its the same player and the broadcast has been triggered
Just a quick (non Spigot) question, does NBTs have changed in 1.17.1 ? I don't find any equivalent of net.minecraft.server.v[version].NBTTagCompound class
Hewwo
(just found my answer net.minecraft.nbt.NBTTagCompound)
Is there an event that fires later than PlayerJoinEvent when the player actually appears on the server and can see things?
no but yes, it is called lag
It was a serious question...
you can try calculate his ping and throw a runnable
PlayerJoinEvent is fired as soon as the players connection is accepted. Not when they appear in the world a few milliseconds later
Bukkit.getScheduler().runTask() will suffice
maybe ik
when the player joins, if he have an item at his hotbar, a packet will be sent
you can intercept this packet
so get their ping and / 20 + 1
the packet is PacketPlayOutSetSlot iguess
and schedule a task
i think the best way would be by intercepting the packet
I know how to intercept packets ye
you can use protrocollib
PacketPlayOutSetSlot is sent when they're in the world
.
I'd rather not use ProtocolLib but thanks ^^
this packet is sent when an item is set in his inventory
If they aren't being sent chunks, they won't receive whatever you're doing in the task anyways
You're overcomplicating things
so you can create your own packet intercepter 😎
Already have
maybe the client can send a packet after he joins the world too
So what about in a situation of low tps
👻 <- choco
What are you even trying to do?
Long story involving Npc's The skin will not update if you send a PacketPlayOutInfo about the npc being removed from the server too quickly
The player must be able to see the npc before this packet is sent
otherwise skin doesn't show
So I was looking for an event that could fire as soon as the player has loaded into the world and can see
Are you handling your own NPCs? Or what's the issue? Because again, the player won't see the NPC before you send it to them which in and of itself is reliant on their ping
I'm handling my own Npc's no libraries
Yeah so you should be fine to just send the info packet followed by the metadata packet both in a runnable
why not use citizens for your own sanity
I'd also second the use of Citizens but I mean if you're already done with your own then whatever
because I hate dependency hell
and because I choose to learn how stuff works
Nah, it gives me more granular control
i like integrating existing api’s and libraries because that means i get what i want faster
sure, but its often not needed
The problem with any plugin or library or api is you have to rely on someone
they become a dependency to your project
If I want to update on day 1 I should be able to
and then you write your own when its not supported anymore
and not wait for someone else
or use an alternative if one exists or gets made
Yeah I do that already. The issue I'm trying to solve (if it's even solveable is to remove the npc from the tab-list as soon as the player has loaded in and seen the npc(s))
oh you don't want them seen? o.O
go ahead and use minestom and rewrite the parts you need
oh i see what you mean
I have a delay as 10 seconds for testing
that works for me
but for some other people it may take way less or way longer
It's really just about calling that packet to be sent as soon as they've loaded in
Does anyone know of a good way to store constantly changing info about a player? like health, defense, etc.
not just when they've joined the server and are still logging in
let alone if the server is sending them chunk packets
hashmap?
Map<UUID,PlayerData> playerData = new HashMap<>();
ok, ty
for what
the player object already stores that for you
no like custom defense
Nah I think he means custom data
^^^
HashMap is the simplest of ways to do this
Hey how do I make it so my dependency’s for my servers plugin get auto updated on start?
with your own custom PlayerData class
Or use persitantdata
no i think that might be intense on the server
reading from every player every tick
persistent data is stored on the player itself
persistent data is stored in playerdata file
Hello, What's the way to save defaults only for properties which haven't existed before for a custom configuration file . (In case of update of plugin when added new properties)
in your Plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Do they get auto installed / updated then?
Nope
he probably means his pom/gradle
spigot just makes sure they get loaded first
oh like external libs
Ye so I want them to be auto updated to the latest version on the server on start so no human interference needs to happen
okay now i am confused
what exaclty are you trying to achieve
in what way
So basically the plugin jar gets updated to the latest version when the server starts.
so you would have to make a custom downloader
with given link to the download for each jar
Ye but I’m not quite sure how I would go about making the downloader
or if you're getting updates say from a github repo, you'd clone, compile, and replace
Correct me if i'm wrong but I think spigot disallows auto-updating plugins on their site
because malware
Ye my dependency’s are all on a GitHub repo and they have GitHub actions setup
Ye I just want it for my own servers plugin because I trust the dependency’s
oki
could compare the date of a commit to the current date as a check for an update?
and then if so, clone the repo to a sub directory somewhere (maybe in your plugins data folder), compile it and have it replace the current plugin jar.
this can be achieved with JGit
hey so im makin a crafting table gui thing and i want to make a method where i can choose what ingredients i want, if it's shaped or shapeless and whatnot to make a crafting recipe in my crafting gui, but i have no clue how to make that method.
if anyone got ideas for it and you can share that would be awesome, thanks!
https://pastebin.com/3Uv1Nfus
https://pastebin.com/NYd5J22d
https://pastebin.com/Zk9YEjru
Server says there aren't any plugins
guys is it possible to hide the player nametags?
Hello, got a problem: My friend got a custom plugin but it doesn't save any data, make no files on the server (Tags)
Server Version: 1.16.5
If any developer can help, there are no errors just the file not saving the datas and generating anything
Why not contact the developer that made it?
He's not active at all, that's the problem
He didn't replied since more than a week
It's a premium plugin, just need a quick fix for user data save
After opening the Jar using WinRAR, I can see the userdata file but that seem not saving
When you unlock tags and restart the server, that says I don't own any tags after owning some...
is the data stored in a yaml file
how do i check if there is a player that is on a team and in certan world ?
Pog
now just gotta figure out how to use custom font
Easy as pie for you 😉
halp pls
man the docs are so useful
I'm trying to make it so that when you harvest stone, it gets replaced by gold ore. Tried in creative and survival and I did register it in my plugin class.
@EventHandler
public void onOrePlace(PlayerHarvestBlockEvent e) {
//Player p = e.getPlayer();
if (e.getHarvestedBlock().getType() == (Material.STONE)) { e.getHarvestedBlock().getLocation().getBlock().setType(Material.GOLD_ORE);
}
}
}
does anyone know why this wont work? if(args[0].equalsIgnoreCase("feathered")){ p.getInventory().getItemInMainHand().addUnsafeEnchantment(FeatheredRegister.FEATHERED, 1); ItemStack item = p.getInventory().getItemInMainHand(); ItemMeta meta = p.getInventory().getItemInMainHand().getItemMeta(); ArrayList<String> lore = new ArrayList<>(); lore.add("§7Feathered I"); lore.add("§7(Feathered) > Sneak to fall slowly"); meta.setLore(lore); item.setItemMeta(meta); it works with another one but its not working with this one. it wont let me use the argument it just gives me the error that i set
BlockBreakEvent?
this seems not to work
remove the ; from after the if statement :/
I can almost bet thats what the warning is for
you cant have ; after an if statement you have to have {}
ok will make it spoiled
You don't have to have {} but you should also probably return as well
yea
before you scream on me about my java knowledge, i do it for fun, not enterprise
Its not that its the way you respond when someone gives you the answer
if (condition); is always redundant
does anyone know why this wont work? if(args[0].equalsIgnoreCase("feathered")){ p.getInventory().getItemInMainHand().addUnsafeEnchantment(FeatheredRegister.FEATHERED, 1); ItemStack item = p.getInventory().getItemInMainHand(); ItemMeta meta = p.getInventory().getItemInMainHand().getItemMeta(); ArrayList<String> lore = new ArrayList<>(); lore.add("§7Feathered I"); lore.add("§7(Feathered) > Sneak to fall slowly"); meta.setLore(lore); item.setItemMeta(meta); it works with another one but its not working with this one. it wont let me use the
yes
argument
you need to set the item back
it wont let me use the arguemnt
getItemInHand returns a copy
what?
getItemInMainHand() doesnt actually return the players itemstack
but rather a clone of it
ask it
Idk, you'll just accuse me again it feels like
^^^
oh right i forgot u tried to steal my plugin
can anyone else help then
but the itemstack works its just the argument of the command that doesnt work bc it sends me my error message.
What error message?
Anyways buenny I've told you already, stop going around here false accusing people, report to the support mail then. I am getting tired of having to tell you this.
you literally have never said that quit lying
}else{
p.sendmessage("§cCant find command:" + args[0])
}```
I have, and if you're not changing your attitude soon enough you'll be out of here.
i really don't know what to say man
you're beyond my comperhension, and that's not a good thing
I need more info, what do you type, what is the command meant to look like, how many augments do you need?
there is one arguement and the type is adding an enchantment to the item in main hand
@lean gull crafting table guis are a pain
(if you want it to function as an actual crafting table that is)
Im confused, if that message is appearing then you are using the wrong command?
question: can i make like a non existent crafting table where i can use the items in the crafting table gui and then see if they work to match a recipe?
it works with a different one and its using the same methods just with a different name arguement and enchantment
is it for a player to use?
wdym
which workbench
workbench = crafting table
so you want to validate something is a valid recipe?
lemme re-explain
pls 😅
basically there's a custom gui that has a 3x3 space in it to put items in
Ngl woods I have no idea, I'm so lost from what I can understand, you said your only problem is it runs that message, but the only way it runs that message is if you don't type in chat the right argument.
that is a custom crafting table
then i want to make a new normal crafting table, and put the items the player has put in the crafting the to the new crafting table to check if what they put is a valid recipe
Anyone know why there is a background behind the C https://imgur.com/a/h3pC0jy
i get you
ok
ok ill try and figure it out myself thanks for trying to help me
also if there's a better way to make shaped and shapeless recipes im all ears
shapeless is easy
does it have something to do with my main class? getCommand("enchantments").setExecutor(new MainCommand()); getCommand("enchantments").setExecutor(new FeatheredCommand()); getCommand("enchantments").setExecutor(new SnipeCommand()); getCommand("enchantments").setExecutor(new TelekinesisCommand());
you add everything to a list then you check if it has a certain amount
of each ingredient
so i think the only way to do this is probably some hacky way this the crafting matrix and nms
what's crafting matrix and nms
You should have them all in 1 class
Idk if a command can have multiple executors I would assume not
ohhhh ok ill try that
btw i think this is what im talking about
https://www.spigotmc.org/threads/creating-a-custom-crafting-gui.430406/
do you know what a matrix is?
so have all of the args in one class? with the main command??
nop
this looks good
just follow fords pseudo code
who dat and wat dat
Well I would have the class called CustomEnchantCommands then have it like this
if(args[0].equalsIgnoreCase("Enchant1") {
// Add enchant1 to the item here
}else if(args[0].equalsIgnoreCase("Enchant2") {
// Add enchant2 to item here
}else if(args[0].equalsIgnoreCase("Enchant3") {
// Add enchant3 to item here
}else {
send error message
}
ford is the user
drives_a_ford
and pseuodocode is code that follows no syntax but explains the logical steps
what
so how would i put my actions for each argument?
they no have github111!1
I changed it if that helps let me know if not
ok
just throw it thru fernflower or some shit
wtf is dat
decompiler
oh no thank
if they dunt hav github then i think they dunt want their code stolen
so um wat 2 do
Well they use reflection to get at the nms core classes to get the result
wat
its has errors on the else if statements and on the {}
u speak enchantment table language
They do some hacky shit to get at the core "minecraft code" in order to get the proper result
ahhh
Well if you copied and pasted it, it would. Add a ) on the end of each if statement
is there a way to just remake the minecraft code for crafting tables
without completly copying it
yea i just realised that thanks for pointing it out xD
you could probably brute force it
Anybody know how to access files that are packed in the minecraft.jar file in a plugin?
Like if I wanted to pull a loot table from an entity, or smth similar.
@lean gull
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getCraftingRecipe(org.bukkit.inventory.ItemStack[],org.bukkit.World)
this may be an option you just have to get the crafting matrix
declaration: package: org.bukkit, class: Bukkit
have never used it tho
Im assuming cause it is nullable it will return null if no Recipe is available
?stash
so um what do i do with this?
So i tried using blockbreak and still didn't work. Came up with this code, anyone know if i did something wrong?
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
Player p = e.getPlayer();
Location blockLocation = e.getBlock().getLocation();
if (p.getWorld().getBlockAt(blockLocation).getType() == Material.STONE) {
p.getWorld().getBlockAt(blockLocation).setType(Material.GOLD_ORE);
}
}
Hey I'm back how come the copyright text gets pushed whenever the game gets full screened but Test doesn't? https://imgur.com/jsNXzY1 (mixins with forge gradle)
just blockLocation.getBlock(). . .
Like this?
Player p = e.getPlayer();
Location blockLocation = e.getBlock().getLocation();
if (p.getWorld().getBlockAt(blockLocation).getType() == Material.STONE) {
blockLocation.getBlock().setType(Material.GOLD_ORE);
}
}
wdym? it literally provides the method
just get the crafting matrix
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
Player p = e.getPlayer();
Location blockLocation = e.getBlock().getLocation();
if (blockLocation.getBlock().getType() == Material.STONE) {
blockLocation.getBlock().setType(Material.GOLD_ORE);
}
}
@quaint mantle
ok
i'll use craftItem
why no
cause then i can just input all the items the player has put in
it calls the prepare craft event
are you registered the event listener
and if it's not null then i put the thing in there
it doesn’t actually craft it
yes
does driver manager have any functions to push data to my locally hosted database?
and how to fill out specific fields for a specifically implemented object
it just returns the craft result but also calls the event
which
and also
you dont need to location
yaa
i'm lookin at the drivermanager class and it has select few functions
@quaint mantle
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
Block block = e.getBlock();
if (block.getType() == Material.STONE) {
block.setType(Material.GOLD_ORE);
}
}
thank you
This is a very odd use case, but is there a possibilty of hiding a command execution from from console? (i know its a weird use case, and preferrably through api)
Question about teams:
Where are the teams saved? (Scoreboard Teams)
And are PacketPlayOutScoreboardTeam saved?
the one you said about
ah ok
use this
but the one u sent says it returns the recipe and not the result, what does it mean
do u kno why e2.getCurrentItem().equals(null) says it's gonna be always false?
if (e2.getSlot() == 24) {
if (e2.getCurrentItem().equals(null)) {
e2.setCancelled(true);
}
}```
ok thank it not say that anymore
Will a 1.16.5 plug-in run on a 1.17.1 server
y
ok it works half and half, when i break it it drops raw gold as if it was gold ore this is probably because it is being replaced the moment it breaks
It is a simple plug-in that only kills withers
run timer
what does that mean? sorry im new
Bukkit.getScheduler().runTaskLater(plugin, () -> {
// set block type
}, 10L)
plugin is undefined, how do i fix?
bruh
replace it to your main instance
do i replace it with my plugin class? im not sure
well im not exactly an expert programmer so i dont really know what you mean with that
ok but i still dont how to fit it in my main class?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
have you run buildtools with --remapped?
your pom reads 1.17-R0.1-SNAPSHOT but you built 1.17.1
have you tried using teh same artifact that you built?
1.17.1-R0.1-SNAPSHOT
what is the cause of this error?
look down the stack trace until you find the first line which mentions your code
in that line it will tell you what class and line number caused the error
no? at me.CoolElectronics.CSkyCore.main.GoldGeneratorHelper.onChunkLoad(GoldGeneratorHelper.java:93) ~[?:?]
the caused by line tells you what the error was.
and the line 93 in GoldGeneratorHelper.java is where it came from
So have a look at line 93 and see if you can work out what its talking about when it says a boolean being cast to a string
suh
bump
make a thread
world/data/scoreboard.dat
me?
how about PacketPlayOutScoreboardTeam packet
Is it ever saved on server side?
why would a packet be saved server side?
Once i made a mistake and made tons of teams
Like ~100 teams
and now im looking for safer way
And the bungee crashes
wait can a blockitem not be enchanted in an inv?
Already used it
But it uses too much memory until it crashes
Maybe limit the teams?
Maybe phantom cache the teams
Is it me or do yall see a black background there https://imgur.com/muOsqOI
always
1.17?
Since 1.17
1.16 smh
🤔
could also just update your java?
lmao
literally gives you more performance and gives you support for 1.17 and 1.18
but ok sure
oh god what was that
Well ok then...
My bat file
oh its because my filename is server jars without a space. Fucking stupid
🤦
Aint that the truth
bootstrapping time does not determine performance tho
yeah
I mean by that you could also say you should use JDK 1.8.0_291 because it's 0.1s quicker than JDK 11.0.2
You know that's probably because older JDKs can't utilize the CPU as good as newer ones can?
hi
[LobbyMenu] Loading LobbyMenu v1.0
[21:11:46] [Server thread/ERROR]: Plugin attempted to register net.corvus.lobbymenu.listener.JoinListener@57525ada while not enabled initializing LobbyMenu v1.0 (Is it up to date?)
org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register net.corvus.lobbymenu.listener.JoinListener@57525ada while not enabled
at org.bukkit.plugin.SimplePluginManager.registerEvents(SimplePluginManager.java:524) ~[next.jar:git-Spigot-db6de12-18fbb24]
at net.corvus.lobbymenu.listener.JoinListener.<init>(JoinListener.java:15) ~[?:?]
at net.corvus.lobbymenu.Main.onLoad(Main.java:11) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:297) [next.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [next.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [next.jar:git-Spigot-db6de12-18fbb24]
at java.base/java.lang.Thread.run(Thread.java:831) [?:?]
i have started programming and i keep getting this error what can i do
Dont try to register any events before onEnable
It makes sense if you think about it. The time per tick is lower than on older JDKs because it's simply quicker. Then because it runs for a shorter amount of time but utilizes more CPU, it seems as if it would be more hungry. It's just task manager etc. can't measure it in that detail and it seems as if its higher.
iphone 6 users dont have issues either but they still upgrade
because iphone 21 is better
difference here is that both are free
also CPU really doesn't make a difference
you are missing out on a free upgrade
I can't even properly measure CPU usage because JDK 17 doesn't really suck up anything on my 5800X
it's <8% most of the time
Especially if you then also use specialized GC flags
so?
@Override
public void onEnable() {
}
@Override
public void onLoad() {
new JoinListener(this);
}
On my own server it takes JDK 16.0.2 ~3 seconds to load it up without plugins. With JDK 17 its just 1.8 seconds.
not in onLoad
No, you have to register your stuff in the onEnable function. That runs after your plugin is properly enabled and only then certain functionality is given.
Also, this is with JDK 17 and 2 players on right now and Aikar flags. There's literally 0 reason not to upgrade.
I've been upgrading JDKs all the time and it's noticeable how performance increases all the time
oh okey thx
Wait till you actually get enough players an netty dead locks :3
Can’t just slap j11 into spigot 1.8 without updating netty
anyone know how to use Bukkit.craftItem's crafting matrix?
it uses the player display name afaik
oh right, it does not. mb. it uses NMS display name xD
Well, paper has a method to modify the message
but spigot doesn't really have much to do
im using paper
oh sweet, well there is PlayerAdvancementDoneEvent#message(Component)
which you can use to modify the component
it really isn't
well i see why
just static import most component methods (like Component.text)
replacing text is 10x harder
It’s not, it’s 10x nicer
You don’t have to do stupid string concatenation
Adventure does it for you
yea using the text replacement config really isn't that complex xD
final Component message = event.message();
if (message == null) return;
event.message(message.replaceText(
TextReplacementConfig.builder()
.matchLiteral(event.getPlayer().getName())
.replacement("Not a username")
.build()
));
is just so cute ngl
verbose as hell
but adventure is better since it mirrors the way mc handles it
so ye
pog
event.message(message.replaceText(builder -> builder.matchLiteral(event.getPlayer().getName()).replacement("NOT A USER")));
there
pfft
😌
someone pls halp

u mean creating a custom recipe?
So I'm trying to update my NMS code from 1.16.5 to 1.17.1, but I can't seem to get it working. For example, for my method displayEntities, the original 1.16.5 code (which is working), looked like this: https://github.com/MinecraftMediaLibrary/EzMediaCore/blob/ffd1025c3d5fa41d7b4180831fbc26876c13984c/v1_16_R3/src/main/java/io/github/pulsebeat02/ezmediacore/nms/impl/v1_16_R3/NMSMapPacketIntercepter.java#L259
The changed code which I attempted to write instead looks as so (1.17.1): https://github.com/MinecraftMediaLibrary/EzMediaCore/blob/97c7d2892d9c8f9183818ae2db676b316de0b3d0/v1_17_R1/src/main/java/io/github/pulsebeat02/ezmediacore/nms/impl/v1_17_R1/NMSMapPacketIntercepter.java#L205
In short, I am setting the color on Entity name tags. The 1.17.1 code which I attempted to write just displays the entities as white name tags, which don't have any color change.
Does anyone know where I gone wrong?
how do i get the entire string from a single log message
hai
next guy gotta teach you
Guess I can be
What log message are you trying to read?
Or do you want the entire console log
Hello everyone, everything good? can anybody help me? I would like to detect when any player hits the diamond block that the giant zombie is holding. It is possible?
Unfortunately I can't upload the image here, to get an idea
You would need to raytrace and create your own hitbox
i want to read every log message and parse each it to see if i need it or not... then i want to take the ones i need and store them in a database
anyone here know how I can add like a margin to a square corner?
I think you can add a new handler to the bukkit logger. Use that to read console messages
Wdym
CSS? Or what
no I wanna remove the sharp corner in a square
With css?
Could you give me an example of how I could do this? ❤️
How are you making the square
Wrong reply ._.
Anyway I'm off for today
so by calling this.getLogger() how do i use a handler on that logger? does that refer to the logger within the current instance of the spigot shell?
is there a function that is triggered everytime a log message is posted? (after the server is done setting up)
Paste above was for you
oh
thanks man
no im making a custom crafting gui and i need to test recipes for it with that
you throw in the 9 item stacks in the crafting gui as well as the world the crafting is happening in and it returns the recipe that matches the input or null if none
U sure
yes
Aight just checking
😂
well a rectangle but with drawRect();
dm me and ill help
JFrames?
formatting from the javadocs: https://i.fvdh.dev/lFNwzdhq.png
nah Forge gradle ```java
public static void drawRect(int left, int top, int right, int bottom, int color)
{
if (left < right)
{
int i = left;
left = right;
right = i;
}
if (top < bottom)
{
int j = top;
top = bottom;
bottom = j;
}
float f3 = (float)(color >> 24 & 255) / 255.0F;
float f = (float)(color >> 16 & 255) / 255.0F;
float f1 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
he backkk..
how do i pass anything into the parameters of the parameters in addHandler()
Ah right youre working on your 1.8 client right
How do I make a hashmap to store various information? Money, votes, deaths, deaths.
You sorted your texture loading issue?
yea
Youll have to do some OpenGL research
What was the fix?
Look at the example?
well I had to keep it in renderUI
but also it had to be in a assets folder
and mod id didn't matter because it wasn't needed
ok
Make an object containing that info and store it
god damn I'm cool
so i need to create an instance of a record class?
haha look at that I got this working https://gyazo.com/8d3400ae66c71482051ba0fd9cb9ae70
send code
tbh i think my issue is that i'm runing your paste within my onEnable() function. where should i be running it @chrome beacon
did it https://imgur.com/bUwCCmG honestly it wasn't that hard
of what?
yo this is pretty cool I just made a circle https://imgur.com/6IGTHyK
where is the plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
guess it goes in the root directory?
tbh i have no clue what to put for the main: attribute
your main class path
your package+main class
elgar
ArrayList<Player> players = PlayerInstance.getInstance().getPlayerList();
World world = Butter.getInstance().getServer().getWorld("world");
Block b = world.getBlockAt(-321,95,487);
//Error Here
Sign sign = (Sign) b.getState();
public void updateSign() {
//Bunch of sign text here cut out for visual sake.
}
}``` I keep getting a ClassCastExceptinn here. What am I doing wrong.
i don't really have a package name, can i just use org.spigotmc.<classname>
What sign did you import?
yes, but if that is the import you used then teh block is not a sign
do i use this import org.bukkit.block.data.type.Sign;?
If you want to cast the BlockData
Do an instanceof check to make sure it is a Sign you are getting
ight
fuck i don't remember how i'm supposed to make the package off the top of my head
Could someone help me center a image with this ```java FROM Gui.java class
public static void drawModalRectWithCustomSizedTexture(int x, int y, float u, float v, int width, int height, float textureWidth, float textureHeight)
{
float f = 1.0F / textureWidth;
float f1 = 1.0F / textureHeight;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)width) * f), (double)((v + (float)height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)width) * f), (double)(v * f1)).endVertex();
worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
tessellator.draw();
}
i thought it was supposed to be in one of the config files or somethin
or while ur starting the project u make it
Nothing prevents you from making a new package now XD
You'll have to update your plugin.yml
ah well right clickin src doesn't give me a new package option
Thats 1.8 packets by the looks
yes it is
You are unlikely to get help here on that, as its 1.8
Do you know where I can?
No clue, 1.8 is a decade old and really unsupported everywhere
It should have a new option. If you hover that a new window appears
add to that you are playing with packets
ah i found it, i had to right click the java file within the src directory
Wild XD
how do i make this package relevant to my project lol
i put my class that extends the javaplugin into it
You create the package then move your class files in there
right yeah im' gonna do that now
u really looked at my picture 😭
i fuckin had the wrong x by 1
which file does plugin.yml go in
still has it as plugin.yml does not exist for me
more specifically Jar does not contain plugin.yml
right click src -> new file -. "plugin.yml"
oh it's supposed to be in src
yer yer
ok i retry
this is Forge and also Tessellator (which is basically high-level OpenGL)
I don't know if I could help, I'll see if I can understand it
so @proud basin what's the problem with the code above?
plugin.yml goes in the resources folder under src
i just started guessing lol
but i found it
i saw the file name turn into a spigot symbol lol
i was ilk that's gotta be it lol
now im' running into actual plugin errors which is good.... time to debug it up xD
nothing is wrong with it
default sql url lets see here
If you want to center it you need to calculate its relative X/Y position based upon the rects size and screen resolution.
hm
client resolution, not screen
if I divide it will go down
divide?
no
the width is the width of the rect not teh client
you are specifying the dimensions of the rect it will draw
not the first 4
so x,y is the top left position it starts drawing, and width/height is where it ends
ignore u/v for now, they are texture coords
o
I got it
Gui.drawModalRectWithCustomSizedTexture(140, 98, 0.0F, 0.0F, 50, 50 ,50, 50);
It's in the correct spot
where I want it
right
yoru client window can be different sizes
so you need to calculate the x/y based upon teh client width/height
Is this where i want to use ScaledResolution?
something like x = clientWidth - (width/2)
width is teh width of your rect you want to draw
But do I use ScaledRes or this.width
Hi there, question to particles. I'm spawning a lot of them and it freezes my server.
But it doesn't show up in any timings. TPS are 20. Which component is actually hit here?
in the method width = width of rect. no idea what this.width is or ScaledWidth in your context
particles are freezing yoru client not the server
unless you are getting a lot of "can't keep up" messages. In which case you are running too much code in a tick
