#help-development
1 messages · Page 687 of 1
Is there a ?shade
Btw i would highly recommend not using public fields.
And never make lists, sets, maps or other collections public and/or static.
So if I want a modifiable hashmap that I can access from any file, I should make a getter?
Nope. Never create getter or setter for collections (lists, sets, maps etc).
I draw my code with crayons. What's the best way to accomplish that?
I've noticed that InventoryEvent doesnt contain all events that can cause changes to a player's inventory (of course...), is there a list of events that can change inventories that aren't an InventoryEvent? Currently I'm aware of the pickup event, and the item drop event
If you do need to expose a getter, make sure it returns an immutable copy
public class PlayerDataManager {
private final Map<UUID, PlayerData> playerDataMap;
public PlayerDataManager() {
this.playerDataMap = new HashMap<>();
}
public PlayerData getPlayerData(UUID playerId) {
return this.playerDataMap.get(playerId);
}
public PlayerData removePlayerData(UUID playerId) {
return this.playerDataMap.remove(playerId);
}
... and so on
And like illusion said:
public List<UUID> getLoadedPlayers() {
return List.copyOf(this.playerDataMap.keySet());
}
If you need bulk content
ImmutableList.copyOf
^ no
So this.playerDataMap.remove(playerId) would modify the HashMap and then return it, or just return a modified copy?
List.copyOf already returns an immutable list
True
You never return the map. You create methods which modify the map
The idea is that this class acts as a map wrapper
Encapsulating the real map
All operations regarding that content go through your class ensuring you have full control
So it returns a PlayerDataManager?
Just make it a void or return the operation's return type
no it returns player data
Oh, I got the playerData object confused with the Map.
?????
Sooo
InventoryEvent: PLAYER related inventory event
Why the fuck is InventoryCloseEvent#getPlayer() returning a HumanEntity instane
Ah yes
A player is a human entity
Maybe it's not 100% sure it's a player so you have to check.
that method was introduced years ago because it matched nms behavior and is only kept due to compability iirc
The only class that inherits HumanEntity is Player
This worked. Thanks a bunch!
Does anybody know how to set up a development Environment for plugins
Or for eclipse https://bukkit.fandom.com/wiki/Plugin_Tutorial_(Eclipse)
I'm impressed someone actually remade the old screenshots that were formerly from Win XP and Win 7
neither maven nor gradle :X
i didnt actually read it what do you take me for
Actually apparently not. Noone edited the page that much after me back in 2021
i did a three second google search
I should update it again given that J17 is the norm nowadays
eh most of my code is still java 8 compliant
mostly cuz the 1 thing i know of is newer is the if(object instanceof Class object2) adds 'depth'
i usually do a if not return type of clause
works fine too
i find it is easier to read 🤷
if(!(sender instanceof Player player)) return;
player.getLocation(); // works!
does it
does
java 17
i thought you need brackets for that
how the f
Yeah pretty sure the scope of player is limited to the if statement
works fine
Although uh given the absence of the {}it could also not be the case whatever
Yeah then it is a quirk caused by {} not being a thing
sure, player is now a normal variable
like this?
In that case it does not work
yea exactly like that
WHAT
interesting
Is this eclipse compiler on steriods?
whats that half life symbol
Lambda?
clicking it tells you which method you're overriding with the lambda, in this case Function#apply
hm
oh on the topic of overriding
I've got a interface that has some methods that are there as hooks but rarely get used so i used empty method bodies instead of abstract
if i type @Override it only shows the abstract methods
is there some setting to display the empty method body methods as well?
If you have an interface like this, and then you create a new class:
... (1 sec)
and then you click this, yeah then it only adds the non default methods
buuuut
correction, I've done an abstract class, but apparantly its the same result
type @Over... and click "Override or Implement"
then it lets you choose which one to "generate"
@onyx fjord did u called mojang?
I am waiting for sue papers
For stealing code
XD
np. for interfaces, the quick fix would already give you the option for all methods, but apparently for abstract classes you#re right, there it only shows the actual abstract methods and you have to type Override manually again to make it add the other ones
eh, my MO is alt enter enter anyways lol
can you please take your personal "discussions" into DMs or #general
i asked mostly cuz i always forget the method names and have to open the superclass lol
paper doesnt redistribute mojangs code
if you are wondering how it works ask paper
What an idiot XDD
@ancient plank
Omfg XD
wub is goin
You thretened me yesterday so i am just asking how its going
thretened with what???
Mods?
ey buddy don't harass & insult ppl @green plaza
Sue for stealing code
He thretened me
I didn't
Why dont you guys just block each other
Here
how can i implement vault in my plugin?
and that is a threat? ...
Theres a tutorial on theor GitHub
What is it then?
Mojang won't dmca mods lol
can u link it
Google vault GitHub
i find only the milkvowl
Thats correct
ok letme explain
Answearing to you the answear is simple "No"
thx that is my first time i try to implement api
what do you wanna do? hook into vault, to e.g. query another permission or economy plugin, or do you want to write your own pemrission / economy plugin that allows other plugins to hook into your plugin using vault?
if you dont wanna help anyone and you dont need help leave this chat
How is the sue is going? Did u call mojang or not?
i want to do a custom economy and i want to allow lp to hook into my plugin
pls can someone timeout or kick them if they keep talking about their lawsuits in help-dev
@onyx fjord stop interacting with them, and @green plaza you were told this isn't the chat for this discussion
Okay, I see. In that case, first of all import vault into your project. are you using maven or gradle?
maven
did you already add the dependency?
no but i can do it rn
yeah do that quickly pls
ok now you create a class that implements Economy
import net.milkbowl.vault.economy.Economy;
public class MyEconomy implements Economy {
}
your IDE will now complain that you must implement all the methods from vault
you will have to implement all these methods
after that you can register your Economy class to the bukkit economy provider, in onLoad or onEnable:
Bukkit.getServicesManager().register(Economy.class, new MyEconomy(), myPlugin, ServicePriority.Normal);
now you're done!
you can't implement a Class
did you click the maven reload button after adding the dependency?
Economy is an interface
its not a class
it didn't show for me idk why
click the maven reload button
that is all my screen
it didn't show up see the screen
ok implemented all the methods
as said, now you register it in onEnable (or better in onLoad if that works)
^
dunno if it was you alex or 7smile7 (think it was smile), but Operation doesn't have a multiply option for some reason?
Actually how is ADD_SCALAR different from ADD_NUMBER if they both add to baseValue?
it gave me that 2 error idk if i make smth wrong
is your class actually called MyEconomy?
the file name is called MyEconomy too?
Add dependency first
you're missing the package declaration
package my.package.name;
public class MyEconomy ...
we
wdym T.T
what do you mean? you said you wanted to write an economy plugin
well so now implement all the methods that vault needs
Those values. Are so confusing. Always have been.
Given a base number B and a modifier M
then the operations are evaluated for the following result R
ADD_NUMBER
R = B + M -> Result = Base + Modifier
ADD_SCALAR (Horribly named)
R = B * M -> Result = Base * Modifier
MULTIPLY_SCALAR_1
R = B * (M + 1.0) -> Result = Base * (Modifier + 1.0)
Interface not gonna magically implement itself. :)
where i find all the methods? u mean the commands?
dude they are in your MyEconomy class
description's fucked too apparantly
you have like 50 empty methods there
now fill them with actual logic
the name and parameters will tell you what those methods are supposed to do
and what i have to add in it?
are you sure you want to write your own economy plugin?
Whatever it is you need to do to implement your own economy
ye?
the method names are self explanatory
withdraw(...) must withdraw a certain amount from a certain player, etc
prints out: Target 1.6, Speed: 0.8
I'm an idiot but i cannot figure out how
oh wait
its the base
which isnt affected by the item held
uuuuuuuuuurgh
oh jesus and now how can i do XD
seriously why does nothing of this stick
why does the game eat the modification i make to the damn values
SQL, NOSQL, YAML, JSON
I don't think you should be making your own economy right now
Store player's balance & modify
you typically have some kind of database - in worst case, a yaml file that just use entries like UUID: <amount of money>
btw is this copy button new?
so manipulate and/or query your database/file/whatever you use to provide all the features that vault wants to have
If so, it's handy
yeah
I dont remember that copy button so must be pretty new
huge feature
discord adds lots of stuff without telling anyone
i know for example this server has 10 roles
webdev be like
The best update ever, discord gets W.
you dont have to tell anyone if you can just update it without anyone ever realising it
One thing i have always been missing in vault is a separation between sync and async requests in the Economy interface.
You can either implement it to always be async (Which will break a ton of plugins) or always be sync (which means you
pretty much need to keep all balances loaded)
Agreed. Still wanting to add economy service interfaces to Bukkit
One for sync, one for async
The problem would be that plugins actually have to implement it :P
That would be godly ^
public CompletableFuture<Double> getBalanceAsync(OfflinePlayer player);
would be nice for example.
I can implement it just fine
I'd prefer separating it out into multiple interfaces imo
<@&690697121761853491> hmmmmmmm did that ping work
Economy and AsyncEconomy
I'd be the first to
im afraid it did
It didn't
i mean it has the right color
you can type it
only those in tab completion are pingable
ok guys wish me luck !!!!!
but it does not send a notif
@everyone 🧌
Vault is just way too deeply rooted in the spigot eco system sadly. Not sure if
a competitor would have a great time. (Unless he bridges to vault for easier migration).
Kotlin and gradle
vault has some flaws
@everyone Help me with my server pls its -0 tps pls
you cant have multiple economy currencies
It would be natively integrated into Bukkit. That on its own would be a substantial benefit
I do have a branch with an economy interface setup already
I just never really finished it all or PR'd it. Still exists though
if such service existed it should have a way for plugins to register custom currency
yeah inc conversion rates
Already 3 steps ahead of you
I just need to finish it tbh
does anybody know why every spigot version uses R0.1
Probably just some old convention
wasnt there a R0.2 in 1.18?
was there ever an R0.2 or R1.0
no
Don't believe so. Not in the API
you probably mean the craftbukkit package name @smoky oak
like org.bukkit.craftbukkit.v1_18_R2
This sounds like it could be generalized a bit
public interface DataProvider<K, V> {
public V get(K key);
}
public interface Economy extends DataProvider<OfflinePlayer, Double> {}
Not sure if that would be useful tho...
but that's still 1.18.2-R0.1-SNAPSHOT
ah
piece of advice dont have discord open twice lol
Not particularly. I'd prefer operating on UUIDs primarily and having overloads that supply OfflinePlayer instances
hm, choco? Have you ever worked with attributes?
or specifically with their internal code? asking cuz on your profile it says bukkit contributer
I took a bit of inspiration from Sponge's economy services
Because they do have some native ones
Here and there. What in particular?
well
apparantly no matter what modification i make to the GENERIC_ATTACK_SPEED attribute on a player, it gets ignored and the normal attack speed applied
I add some value, and it is like Attribute#getValue is like 1.6, but the actual attack speed is like 0.6
im using a axe to test this so i can really see the difference
its just
the getValue is supposed to apply after all modifiers, including the TOOL modifier
so why is it still reduced back down to 0.6 when the value its supposed to be is 1.6?
if (!user.getRank() == "VIP") {
player.sendMessage(ChatColor.RED + " You can't use this command!");
return;
}
why it doesnt work? I've tried literally everything
.equals() to compare strings, not ==
why not ==
== checks if two things are the same object in memory
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Depends on how you're adding the attributes I suppose. Bear in mind that attribute modifiers are just that, modifiers. It will change whatever the base value is
||.intern() ==|| :^)
because "VIP" creates a new object on stack and does not use the existing string from memory
what's the easiest way to get sth like ${project.version} in plugin.yml working, but in gradle?
groovy?
but I also use == for int's and it works then
They have resource replacements or something like that
yes
processRersources task
Yeah that thing
unload project, set it up with maven, reload project
one sec
well I'm adding an attributeModifier to the attribute.generic_attack_speed, then print out Player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).getValue to verify it actually changed.
It prints out it did change to 1.6 +/- rounding error but the actual attack speed is still wrong
Integers and other primitives can be compared with ==
I tried adding an attribute modifier to a sword but it ended up wiping away the existing damage, is there a reason for it?
Strings are not primitives
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
version: '${version}'
in plugin.yml
hm why is the props definition needed
and why do I have to tell it that version is version
im gonna feel like its to define what to replace
isn't that possible without that redundancy
I'm looking for the easiest way
mincrell plugin-yml
well not the easiest to get it done, but the "most clean" way to do it properly
i mean you can defo just do
processResources {
inputs.property('version', project.version)
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand(['version': project.version])
}
}
thanks, that looks much better! I'll quickly try that
erm
and then @version@ or ${version} ?
You lgbtq+-=><[] 123434 ??
${version}
my bf says so
Not banning defuu a long time ago was the mistake
thanks, that worked perfectly!
yep, thx!
why are you racist?
funny thing
i saw it the other time but nothing happened
fucking german people
kinky
yeah I've fucked a lot of german people
Is this some secret code i dont understand? What does this -=><[]etc mean?
do we have to ping the mods again
making fun of the LGBTQ+ bit, adding the extra symbols for some reason
private void setSpeed(double targetSpeed){
//reset
nullSpeed();
//calc
double currentSpeed = speedAttribute.getValue();
double applyValue = targetSpeed - currentSpeed;
speedModifier = new AttributeModifier(
"GGP|ARES|Axe",
applyValue,
AttributeModifier.Operation.ADD_NUMBER);
speedAttribute.addModifier(speedModifier);
player.sendMessage("TargetSpeed: "+targetSpeed+", speed is "+
player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).getValue());
}
but its still slow
Ah, weak
why though
he just fucked a lot of german people
it sounds embarrassingly
can you guys please continue the discussion about my sexuality in #general instead of here please, thank you
I'm trying to learn kotlin
bye
its not kotlin actually its gradle but kotlin version
we totally enjoyed having you here
how can i make a combat system?
are you freakin kidding me
switching from a sword to an axe doesnt trigger the PlayerItemHeldEvent ????????
wdym by make a combat system
painfully
make Map or Cache keeping player UUID and Long there
I mean... who wants to write groovy
me!!!!
hhmmm me
I write gradle groovy :P
combat tagging
we wanted to make an economy plugin 30 minutes ago but then didnt know what the economy plugin should do soo....
Your a terrible gumab being
when i hit a player there is a cooldown of 10 second where he can't do some commands
Human
I know <3
use a map
any reason for not using CombatLogX?
idk how it work
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Spigot forums exist
frostalf said sometihng about a cobalt based economy earlier and I think I'm going to do that eventually
you write a plugin in cobal?
no you can write some intermediary for them to communicat ethouhg
I like that you spelt it wrong because I did lol
maybe he want to learn making plugins??
rewriting the wheel isnt very smart
Why?
@onyx fjord can you translate
Tag.ITEMS_AXES.isTagged(player.getInventory().getItemInMainHand().getType())
this is false if you're switching from a not axe item to an axe item -.-
"fuck german people"
I mean, if he learns something while doing it
this server is so racist
alex does
?kick @quaint mantle stop being cringe
Done. That felt good.
only him
You need to check that one tick later or get the target slot in the event
Just learn OOP paradigm. Because you're focused on skript.
hello im black
is there event that triggers when any entity moves?
what i need is to give an effect to all entities that enter certain area
Kick feritz too
Because you associate with the other guy
What’s wrong with Skript
Skript is the best programming languagr
IIRC paper might have an EntityMoveEvent if you use that
didnt you just say "this server is so racist"
could be wrong thuogh
no paper
??
do u know if this happens with the main/offhand swap event too?
then you'd have to write a loop to check a bounding box
I did lol and what
this discord is so racist
nothing racist was going on?
Cant remember. But if they have methods for target hands then yes.
it was :<
@worldly ingot can you bonk them
do you enjoy wasting your time with these people? lol
ill probably just do that yeah
These guys don't even know what racism is
why are you mod abusing?
im just watching yt while here
im not a mod so how am i mod abusing
MOD BAN HIM, MOD BAN HIM all the time
bc ur trolls
this is cursed Bukkit.getScheduler().runTaskLater( Echo.getInstance(), () -> Echo.getInstance().getPlayerHandler(player).itemChangeEvent(), 1);
If you want to run it the next tick then runTask is sufficient
@quaint mantle timing you out for an hour and if I have to come back in here and tell you to knock it off again I'll just ban you instead
does anybody know what Permission#getName() is supposed to return? (I'm talking about Vault's Permission class, the one I have to implement for a custom permissions plugin - NOT about a regular "Permission")
iirc the permission name is just the permission node itself
what about the other guy
that can't be, the Permission class is basically the whole API class and does not refer to any single permission
Scheduling a task will result in the task being executed on the next tick earliest.
the Permission class methods like playerHas(String world, String player, String permission) etc, or isEnabled() etc - the "Permission" class is the whole API itself, not a single perm
Wait that doesnt sound right. Some native pls correct what i just said.
Oh, Vault's Permission interface, my mistake
Best thing to do is look at default implementations from Vault
do you mean "at the earliest"
probably I should return my plugins name there I guess
I'll take a looka t luckperms code
There's a Vault-API repo and a Vault repo, the latter of which has default implementations for popular plugins
oh ok I'll try to find that, thx
Let me rephrase it.
The earliest point in time, where a scheduled task will be executed, is the next tick.
what is wrong with you like literally
Elaborate
i tried it, it doesn't run next tick, but the same tick, causing the issue where it doesnt recognize it
What version are you on?
1.20
it is queued for the next tick
?
that has always been the case
must be some hidden issue then
Since when are scheduled tasks executed immediately.
quick question
They're not
does attacking reset attributes?
Thats what i thought as well
no
is it possible to create an inventory gui that is in the form of a dropper/dispenser (the 3x3 grid)?
yes
how do i do it
Internally there's a min tick requirement of 1
use a dropper inv instead of a normal one when creating the inventory through Bukkit.createInventory()
Like if you set the delay to 0 it just sets it to 1
oh
oh is there a different candidate for it
the 1 tick delay isnt enough
if i switch from axe to axe its the speed i set it to
if i switch sword-> axe its the slow axe speed
weird
ah i see InventoryType, thank you
Inventory inv = Bukkit.createInventory(null, InventoryType.DROPPER);
declaration: package: org.bukkit, class: Bukkit
only inventories that rely on nms are like the weird tile entity ones
Like crafting tables
unless that's been fixed in the later versions
thank you very much
why it didn't cancel the interaction with the item in the gui?
public void onInvetoryClick(InventoryClickEvent event) {
if (!event.getView().getTitle().equals(invName)) {
return;
}
event.setCancelled(true);
}```
Because you're comparing inv titles
Use InventoryHolder instead
declaration: package: org.bukkit.inventory, interface: InventoryHolder
wait discord finally added the link feature?
alright, now it's still saying the speed is set to 1.6 but the meter isn't loading at all???
Yup
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
ye
W update
IMO inventory holder better because with inventory holders I can store data.
ADSASEAAAAAAARGH
so I'm switching to a new item, but my attack speed is still the speed of the old item slot, I'm so effing done
at least i figured out a different angle to this issue
but why does switching between two axes of the same material not count as switching items? doesnt happen anymore; no idea why
why the F does it take 2 ticks for the attack speed attribute to change? this game, man...
when you're confused why all your tests passed so you add this and are happy when it fails lol
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class TestTest {
@Test
public void testTest() {
Assertions.assertFalse(true);
}
}
Ah yes. The classic test test
im confused. I have two events. One, on leave, unregisters handlers. The other, on inventory close, calls a method in the handler to properly update it
apparantly a player leaving the server calls PlayerQuitEvent, THEN InventoryCloseEvent? Where's the logic behind that?
no
craftbukkit code says otherwise
you sure you didnt do sth wrong?
green is calling InventoryCloseEvent, red is obviously PlayerQuitEvent
(that's PlayerList class)
thats... odd
I had a similar thought so i added print outs to the start of my events
theyre not getting printed
-.-
the logger stopped updating itself
fuck windows man
also now im sure
it tells me the leave is called before the close
which means the handler isnt registered anymore
are you doing any tasks or similar stuff?
@EventHandler
public void onClose(InventoryCloseEvent event) {
System.out.println("close");
}
@EventHandler
public void onQuit(PlayerQuitEvent event) {
System.out.println("quit");
}
If you only do this, I am sure it prints close before quit
the reference is probs getting deleted
thats the explanation for the exception
but why are the events out of order? I'm printing them first thing in the call
hm well
@tender shard
the return value of "io.github.moterius.GreekGodsPlugin.Echo.getPlayerHandler(org.bukkit.entity.Player)" is null
Which means its no longer registered. The handlers get unregistered in the Quit event. I made sure to do
if(!runnable.isCancelled()) runnable.cancel() for the only runnable in the code
the issue is the quit event running before the inventoryclose event im about 95% certain
have you done this?
basicylly yes
wdym with "basically" 😄
@EventHandler
public void onClose(InventoryCloseEvent event){
Echo.getInstance().getLogger().info("Close event");
are you manually messing with EventHandlers, e.g. unregistering them with the plugin handler or sth?
ok in both events, print out the stacktrace, lets see where your events actually get called from
@EventHandler
public void onQuit(PlayerQuitEvent event) {
new LinkageError().printStacktrace();
}
same for close event
then let's check the stacktraces
@EventHandler
public void onQuit(PlayerQuitEvent event) {
event.setCanceled(true);
}
When
ykw mfn ill just print out the timeNanos to make sure one actually runs before the other
brb
you only added player quit event, not close event too
wym
that theres copied from the message above
I need both stacktraces in full
btw heres timeNanos
[23:07:29] [Server thread/INFO]: [GreekGodsPlugin] TIME IS 78935914425700
[23:07:29] [Server thread/WARN]: java.lang.LinkageError
[23:07:29] [Server thread/WARN]: at io.github.moterius.GreekGodsPlugin.Event.Handlers.EventPlayerLeave.onLeave(EventPlayerLeave.java:14)
...
[23:07:29] [Server thread/INFO]: [GreekGodsPlugin] TIME IS 78935998247700
so yes the first one runs before the other
its not just a display error
in your server software, leave event is called in PlayerList line 528 and the close event is fired in PlayerList line 548
what's your /version ?
1.20 something
/version
ok let me check out that commit
not sure what you mean with this
oh the actual internals
nvm
gotta run buildtools, it's hella slow on my windows pc 🥲
if i knew how to build for a certain checkout I'd do it for you, i have a 4.2GHZ core
quick explanation?
or well the command line commands?
does the player have their own inventory open?
because in that case, the InventoryCloseEvent is indeed only called later
well not that im aware of
its not a kick
its the escape menu disconnect button
this is me on a local test server losing my mind
first two things, as expected - normal close event, then quit event. But the third part I marked, that also checks for open inventories again and calls a close event, one second
can i differentiate those two? If i just stop the second one it shouldnt cause any data related issues
are you by any chance opening an inventory between those two events again? because both checks are doing containerMenu != inventoryMenu
I'm noticing theyre calling different methods
not with my code and theres no other plugins
all im doing is escape -> disconnect
hey, can someone tell me how i can use the path parameter in the getConfig.getString() member to access these?
webhooks:
leave:
join:
break:
kill:
@worldly ingot
do you know anything about this?
it says this was fixed but apparently it wasnt?
webhooks.leave
I recall it getting fixed in a commit a long while ago I believe
thanks!
I just took a look at commit 8ef7afe (1.20.1) which also mentions the jira issue I just linked, but this still seems to happen sometimes - I have looked at the code and noticed these things
#help-development message see these screenshots
?stash
That commit was 1.16
choco has every git commit memorised
WorldServer#removePlayerImmediately in PlayerList#remove still calls the close event
after the quitevent was called
not to interrupt, but I'm trying to find the class in the stash but there's no net.minecraft. Is it not in that one?
its patches
k
you are not interrupting, we are literally talking about your issue lol
i cant figure out the stash lol
which bit
run buildtools for 1.20.1, then just do git checkout -b blabla 8ef7afe in the craftbukkit folder, then open the craftbukkit folder in IJ
then you have the code from your spigot version
Yeah hashes and all
the folder containing the buildtools file?
also wouldnt that still be there?
i havent run buildtools again so im assuing its still like that
yeah if that's the latest version you built, then you don't need to checkout
commit that added Main in cb
yea i just build and copy the server file
then just open craftbukkit folder in IJ as maven project
then head to PlayerList, lines 400ff roughly
line 500 is where remove(EntityPlayer) should start
yea once its loaded lol
CraftBukkit was almost called CraftBucket
it calls the close event in line 508, then quit event in 511, then close event in 532 although that shouldnt do it as because the inv should have already got closed before obv
it just said 'syncing' and i think it changed lol
there's also "SPIGOT-924" mentioned in the method but I cannt find that on jira
i really have no clue why it calls that event twice
where is this from?
PlayerList line 532 -> Ctrl+B into worldserver.removePlayerImmediately -> WorldServer line 1094 -> Ctrl+B into entityplayer.remove( -> EntityHuman#remove(RemovalReason)
huh your keybinds are different, its on f4 for me. thanks
mine is setup for control click kekw
yeah that works too for me lol
now I have 3 methods of doing it
middle click too!
i prefer ctrl click bc its easier
hm
Ctr+B, F4, Middle-CLick, and Ctrl+Click all the same lmao
I've looked at the methods, and i dont think there's anything different that could be used to differentiate the two close calls
i hoped i could use that one is using closeContainer and the other doCloseContainer but i dont think i can detect that with just the spigot api
bah much simpler solution
my cache contains a UUID -> enum map
i can check the map's keyset i think
for wat
still really frustrating i have to do it this way
the event still contains a player reference
hopefully
imma test it
otherclass.handleCloseEvent(); // this goes at the start of quit and inside close event
public void handleCloseEvent() {
// do stuff
}
you just add a close catch, if something is missing dont do anything
yeah sure but don't you wonder where this issue comes from
not really
i do
oh no it happens, cant do much about it
actually why the second call in the first place? there's no check if anything's open in the first place
also i was right, the player reference in the event after doCloseContainer isnt stale yet
so if(map.queryPlayer(player.uuid)) == null) return fixes this
dumb it happened in the first place but eh
Which is an instance of Rail
BlockData or BlockState?
BlockState state = start.getState();
BlockData data = start.getBlockData();
if (data instanceof Rail) {
Rail rail = (Rail) data;
Rail.Shape shape = rail.getShape();
}
data
Too lazy to test
Thanks
jds easier
What's the difference btw?
I know you can use BlockState for furnace for example, but what does it differ from BlockData and why is Rail used with BlockData instead of BlockState?
isnt blockState for NBT stuff and blockData for stuff like rail direction, water log etc?
yeah
Oh, talking about rail direction;
How do I obtain a rail "neighbour"? 😂
get the shape, figoure out which way then get the next block
block.getNeighbor(Direction.NORTH), replace direction with the pointy ends you get from the rail
You cannot cast or obtain a BlockFace from Rail.Shape
As Rail.Shape contains Z,X specific indexes
huh
Represents a captured state of a block, which will not change automatically.
Unlike Block, which only one object can exist per coordinate, BlockState can exist multiple times for any given Block. Note that another plugin may change the state of the block and you will not know, or they may change the block to another type entirely, causing your BlockState to become invalid.
basically a BlockState is like a "snapshot" of a whole block. which includes BlockData, and other stuff
Is there a way to update the swim state? Like the arms and legs positions after calling EntityPlayer#setPose ?
no
the code doesn't like there's any issue with it tbh
you should really try with a tiny plugin that does nothing besides printing "close" and "quit" and doesn't do anything else
only if it then still happens, that issue should be opened again
watch me
otherwise it must somehow be caused by you ¯_(ツ)_/¯
idk
normally I'd just try it out rn but I'm currently using gradle and it's a pain to quickly compile sth there into the plugins folder
eh not a big deal, im almost done
[23:54:09] [Server thread/INFO]: Moterius[/127.0.0.1:51610] logged in with entity id 279 at ([world]-101.00716740151456, 84.0, -34.53516050006216)
[23:54:12] [Server thread/INFO]: Moterius lost connection: Disconnected
[23:54:12] [Server thread/INFO]: [DAMNIT] PLAYER QUIT TIME IS 81738930559800
[23:54:12] [Server thread/INFO]: [DAMNIT] INVENTORY CLOSE TIME IS 81738947675200
[23:54:12] [Server thread/INFO]: Moterius left the game
package io.github.moterius.DAMNIT;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Echo extends JavaPlugin implements Listener {
@EventHandler
public void onLeave(PlayerQuitEvent event){
getLogger().info("PLAYER QUIT TIME IS "+System.nanoTime());
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event){
getLogger().info("INVENTORY CLOSE TIME IS "+System.nanoTime());
}
@Override
public void onEnable(){
getServer().getPluginManager().registerEvents(this,this);
}
}
done
then open a new issue for that
i dont have an account 😅
you can quickly make one, jira doesn't even require the CLA
you just signup and that's it
whys my full name required
idk
you dont need ur full name on jira
bottom of https://www.spigotmc.org/wiki/cla/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
'CLA' ?
contributing licensing agreement
you dont need to sign it
its just where it explains about jira signup
You don’t need to sign the CLA to create issues on the JIRA
hey guys i've got this plugin that works fine but I tried storing my Shapeless and Shaped recipes in a list of CraftingRecipe type and get this on startup
Failed to register events for class com.technovision.craftedkingdoms.commands.RecipesCommand because org/bukkit/inventory/CraftingRecipe does not exist.
Little confused as CraftingRecipe does infact exist and the rest of the Spigot and Bukkit API work fine
This is for 1.20.1 btw
:3 nice
It was added not long ago so the server was probably just a few commits out of date
Ah that makes sense, this jar is from a month ago
anyone wants to write a huge shell script with me lol
todo what
a tiny server manager for CLI - e.g. to quickly create a server with any given version (it'd build spigot or download paper of a specific version), update servers, install plugins by symlinking from a plugin repo, start/stop/attach to servers, stuff like that.
Currently I only wrote the very basics because I needed it formyself
that sounds painful
That sounds like something you dont want to write in shell. How about python?
write it in java
yeah but shell scripting is fun. I once already done this in python, it set up a whole environment etc but I'd rather do it in shell so it works for everyone
also I'm not good at python so my code was shit
the good thing about sh scripts is that you don't need to have anything installed (well besides screen for this, ofc)
make it in batch
Make it in vba for power point like a real dev
yeah that won't work, I only have 360 packages installed
root@gameservers-cli:~# 2>/dev/null apt list --installed | wc -l
360
having python installed is bloaaaat
oh if we're talking about scripts
dominick@n1:/etc/ssl/certs$ cat renew.sh
domain=$1
# Remove the first parameter from the argument list
shift
# Generate the certbot command options for subdomains
subdomains=""
for subdomain in "$@"; do
subdomains += " -d '$subdomain.$domain'"
done
rm -r /etc/letsencrypt/live/$domain
certbot certonly \
--manual \
--preferred-challenges=dns \
--email admin@$domain \
--agree-tos \
-d '$domain' \
$subdomains
dir_path=$(ls -d /etc/letsencrypt/live/$domain* | sort -Vr | head -n 1)
cp -f "$dir_path/*" /etc/ssl/certs/$domain
rm -r "$dir_path"
rm /etc/ssl/certs/$domain/README
chown -R root:ssl-$domain /etc/ssl/certs/$domain
chmod -R 740 /etc/ssl/certs/$domain
chmod 750 /etc/ssl/certs/$domain/renew.sh
i made this lovely thing
so i can just
./renew.sh dominick.sh * personal.*
i love it
though i haven't got to test it yet
mine is only this lol
#!/bin/bash
certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/certbot/cloudflare.ini $*
renewal is done by certbot's builtin cronjob
well I need to do it manually because I write * certs
wdym?
so I need to add the DNS TXT challenge
there's plugins for many providers but I switched to cloudflare for all domains
as for the reason my script is more than just the certbot command
let's me generify the script & write to /etc/ssl/certs instead of the letsencrypt managed directory
I wish IJ would use the system file explorer - the builtin one is so annoying. on macOS it does the system file dialog 🥲
Any idea how to get an instance of Holder<net.minecraft.world.level.biome.Biome> from a biome name (eg. "datapack:biome")
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000129550-Default-file-explorer @tender shard
great! thx!
ofc
This here, no?
that's the IJ explorer
I just switched to the windows native explorer
and it really only lets you choose files
oof
is it considered against the spigot tos to scrape the plugins on the spigot marketplace?
don’t they have an api
yes they have
the json api is somewhere in a field here https://github.com/JEFF-Media-GbR/Spigot-UpdateChecker/blob/master/src/main/java/com/jeff_media/updatechecker/UpdateChecker.java
they do?
https://api.spigotmc.org/simple/0.2/index.php?action=getResource&id=%s
if you need more info, there's spiget.org
i spent so much time building a proxy server in order to bypass spigot's cloudflare restrictions to allow web scrapers
thank you
ill just use spiget
silly billy
damn look at this fancy heredoc delimiter
I'd say this is not bad for a <200 lines shell script
it has configurable .env files, one global file for the servers directory and the default settings, and optionally one per server, to adjust ram, server name, screen session name, stop command (because bungee uses /end, not /stop) etc
https://github.com/mfnalex/mc.sh/blob/master/mc.sh
can I only have one prompt? btw in the string prompt, how do I get the player's chat input?
ofc you can only have one prompt - you just return Prompt.END_OF_CONVERSATION in acceptInput(...)
and to get the input, well that's the string parameter in acceptInput(...)
Ohhhh
the string parameter is the player's input
i see now
acceptInput means: you get the previous conversation data and user input as parameter, and then you return a new prompt how the conversation continues - or you return END_OF_CONVERSATION
is MySQL free to use
What
ah
You can host a MySQL database on your device for free
do i need to port forward or anything
or can i just host it off of a hosting site
if i add the files or smth
Most hosting sites just provide a MySQL database for you
This is embarrassing I’ve forgotten how to do this, but how do I create a craft entity without adding it to the world?
Create the NMS entity via its constructor
Do you mean something like new CraftAllay(server, entity) ? It seems to take an existing entity as an argument
I don’t see a NMSAllay class
Allay for MojMaps and Spigot maps
https://mappings.cephx.dev/1.20.1/net/minecraft/world/entity/animal/allay/Allay.html just a heads up if you're using mojmaps and aren't aware this site is super useful
version: 1.20.1, hash: ae503c1f10
The Allay class takes a huge amount of arguments in the constructor. Hasn’t there been a way to just create an entity with default values?
constructor should only have 2 elements as far as I see
EntityType and Level
Well aren’t I stupid… I accidentally was looking at the wrong class. Thanks
mappings website I posted above carries for stupid import errors and stuff like that
When running the /award C4 command (gives me the C4), the item is the correct model (c4 shaped as a head)
When crafting however, its a steve head.
Any idea why that might be here?
whoops
forgot paste
well in your generate item function you pass in null..?
is that not the item data in which you want to set
I have a system right now where I'm adding vectors to a map because I'm trying to seperate this into a sort of "model" to be able to be copied, right now the origin is setting at the block of jungle wood. (the one to the left of the white wood) and I would like the origin to start at the bottom instance of amethyst, how could I do that?
what no
data is for extra stuff
here ill show an example of the application for that
you also never set the items meta data
thats cause MetaFuncs takes care of that for me
Ill show you the Manager.Skull stuff
private final HashMap<String, String> skullList = new HashMap<>();
public void addNewSkull(String key, String data){
skullList.put(key, data);
}
public ItemStack getHeadByID(String key){
String texture = skullList.get(key);
if(skullList.containsKey(key)){
return getHeadByTexture(texture);
}
return new ItemStack(Material.PLAYER_HEAD); //Return a blank head.
}
Also before you say "Material.Player_Head is right there", why would it return that ONLY inside the recipe
That makes 0 sense
Skull.addNewSkull("C4", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGNlZTY5NGI1ZGYzNGY0MGQ1ZTc3NGJkMzA0NmRiODQ5ZTM0ZmY1NWE0ODJkMDczMWU5ZDdhN2JiNzRhMTIifX19");
what mc version are you on
1.20.1
Alright
wait hold on
i think im alread yusing those
sorry i went afk
public ItemStack getHeadByTexture(String texture) {
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
PlayerProfile profile = Bukkit.getServer().createPlayerProfile(UUID.randomUUID(), "");
try {
profile.getTextures().setSkin(new URL(getURLFromBase64(texture)));
SkullMeta meta = (SkullMeta) head.getItemMeta();
meta.setOwnerProfile(profile);
head.setItemMeta(meta);
} catch (MalformedURLException e) {
e.printStackTrace();
}
return head;
}
unless this isnt the same thing
Hey, you ever figure this out?
` i WAS JOKING
oh LOL
So if I prevent an item from being damaged by entities and blocks and prevent it from despawning, is there any way it can be destroyed?
if its picked up 🙂
Also if it falls into the void
Never really worked with the scoreboard api, is there a better way to do this?
is that even going to work?
coz ur using the same scoreboard. when doing it with multiple players it'll mess up no?
yeah that's a great question
But that's why I have it set as NEVER rather than TEAM_ONLY
but yeah I might use a team per player
idk
I can't use api even if I enter the dependency part correctly
What should i do
I will send an example
Did you include the repository ?
https://www.spigotmc.org/wiki/setting-up-the-worldedit-api/
also, maven will tell you what is wrong with this, I am sure
Something like "dependency not found in any repository"
Which should give you an idea of what to do
yeah
Did you hit the maven refresh button ?
Dependency 'com.sk89q.worldedit:worldedit-bukkit:7.2.9' not found
Is it possible to manually add the documentation into intellij? Its not being displayed while pressing Ctrl+Q (in some projects)
It should show up on top right whenever you make changes to pom, also could you send it ?
?paste
it usually pops up when u add something in the file, u can still manually refresh it
how can i do it manually
give me a second please
You open the "Maven" tab in IntelliJ and hit the refresh button there ig
oh okay
i deleted something and i saw it
oh
Could not find artifact com.sk89q.worldedit:worldedit-bukkit:pom:7.2.9 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
ye, you don't have the repo included in your pom
(I just hope that "guide" is not old)
also, why is it telling you about 7.2.9, when you have 7.2.0 in the pom 🤔
i forgot ctrl + z after deleting 🤦🏻
I thought it wouldn't be healthy to use snapshot (I'm not sure) so I made it 7.2.9
Is dependencies a long process to download?
I-
I don't think that matters, but I might be wrong, idk the naming scheme and their meanings
not really
It's already over 4 minutes, isn't that normal?
I just acted on my instincts 😃
oh its finished
can an1 help me
Unresolved dependency: 'com.sk89q.worldedit:worldedit-core:jar*:*7.2.9'
please tag me if you reply
something tells me that version doesn't exist
it should be true but i can check it right now
@shell robin la enes abi yardım et
By adding a minecraft private key, for example, when I press the e key, can I make a different gui panel outside the inventory?
wdym by "private key". A keybind?
"outside the inventory" what, where.
?paste your pom
@EventHandler
public void onPlayerEditBook(PlayerEditBookEvent e){
Player plr = e.getPlayer();
BookMeta newMeta = e.getNewBookMeta();
if(newMeta.getPageCount() > getConfig().getMaxBookPages()){
plr.sendMessage("AAA");
e.setNewBookMeta(e.getPreviousBookMeta());
//e.setCancelled(true);
}
}
How do I make BookMeta apply instantly? It only applies after the player rejoins
For example, I will make a store, like the battlefiled v menu, like the store will open when I press the E key.
minecraft
For starters, you can not have custom keybinds serverside
opening player inventory is not known to the server - no packet is sent, no event can be fired
hey!
does anyone know of a way to authorize my plugin with spigot payment?
basically checker whether the plugin was bought or redistributed somewhere
e.g.: Jets-Minions have this authZ, but idk how it works
what's the output of mvn clean package -X?
umm sorry for asking this
where should i write this
are you using INtelliJ?
i dont know is there any console on intellij
I'm not going to be a mod anyway, I'll just add it as a plugin, I'll process it into the .class, won't it still work?
okay i did
Again, you can't know if player opened the inventory
So you can not open a different menu based on this
Either do the shop in player inventory or figure out a different way to open the shop menu
Well, can I only do the inventory in this way without eliminating the inventory as a plugin, such as closing the 64 fields and expanding the background
You can't really make a menu like this, you're limited to vanilla containers - chests, hoppers, dispensers 'n such
There are however ways to "retexture" the menu and make it look/behave like something different, but for clicking you are still limited to slots.
so what's the output of that command?
Heyo, quick question. Whats the best way for a plugin to have self-updates? Im coding a private plugin and would love that it automatically updates when i push a commit to github
I got it, thank you
auto updates are trash, what if your latest version introduces a bug? yeah anyway the proper way is to just make your plugin download itself to plugins/updates/ and then craftbukkit will replace it automatically on next start
(Its a private plugin, auto-updates are just for conveniance, they will most certainly contain bugs lol)
So i just download the jar to the updates folder and restart the server then?
anyone know why gradle breaks on jitpack for me
with error Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory()
it works on my pc
gradle 4.8.1?!
gradle and gradle wrapper are seperate i think
i think its using wrapper 8.3
wait idk
no you're actually using version 4.8
old gradle versions had problems with java > 10
wtf
how does your jitpack.yml look like
or however its called
are you by any chance calling gradle build instead of gradlew build ? wouldnt surprise me if jitpack would by default use gradle 4, it also uses jdk 8 by default
maybe you could just send the repo
i have no idea what jitpack is doing tbh
i cant put gradlew clean install as a command because it doesnt find gradlew
because the pwd is not the repo
for some reason
that's magic