#help-development
1 messages · Page 1795 of 1
I see
but yeah upgrading to 7+ fixed
thank
i probably wouldntve tried that, thought about it, but dismissed it
Yea
Hi, I have a small problem,
I'm trying to make custom recipes with items that have names that can change.
I tryed to do it with the PrepareItemCraftEvent but it makes a dupe glitch for a really weird reason (that's totally bugged, the items disappear but you can still click on the result and you see sometime the ingredients being literally duplicated in amount)
Is there a way to do it with exactchoice recipe ?
here is the actual PrepareItemCraftEvent that makes the dupe glitch (saw on the forum that it seems to be a spigot issue bc it shouldn't be used to make recipes, or smthing like that)
public void onPrepareItemCraft(PrepareItemCraftEvent e)
{
final CraftingInventory craftInventory = e.getInventory();
ItemStack[] content = craftInventory.getContents();
if(content.length >= 7)
{
if(content[4] != null && content[5] != null && content[6] != null
&& content[5].hasItemMeta())
{
ItemStack poopItem = ZePoopItem.getPoopItem(plugin);
ItemMeta poopIM = poopItem.getItemMeta();
ItemStack middleItem = content[5];
ItemMeta middleItemMeta = middleItem.getItemMeta();
poopIM.setDisplayName(middleItemMeta.getDisplayName());
poopItem.setItemMeta(poopIM);
poopItem.setAmount(middleItem.getAmount());
if(content[4].getType().equals(Material.WHEAT)
&& content[6].getType().equals(Material.WHEAT)
&& middleItem.equals(poopItem))
{
craftInventory.setResult(ZePoopCookieItem.getPoopCookieItem(plugin));
}
}
}
}
do you have a matching recipe registered
likely not
the prepare event isnt sufficient, you need a recipe, or to remove the items in the actual Craft event
A PDCRecipeChoice would be nice
I don't understand the actual "remove the items in the actual craft event" part
If I place like only one ingredient of each type
and get the result, it work normally, no duplication
you are setting a result but if no recipe exists, then the server doesnt know to 'use' the craft items when the actual craft occurs
this is why it dupes
so you either need to register a recipe (recommended); or code for actual CraftItemEvent, not just prepare
Gonna look into this, since I can't register a recipe as the itemstack changes with the player's name
That wouldn't be good ^^'
Then you do the validation in the prepare event
Just like ye old days before ExactChoice
Oh, well, that could be a solution also, thanks, gonna try that too
Do TextComponent support hexColors in 1.17?
Pretty sure they does
I have no idea why this is happening
Are you using the bungee import for the translation of the codes ?
tring stringBuilder = Tools.hexColorMSG("#4db9e3⭐#484f2aRango &e➠ ") + "%MyPlugin_hexColors%" + "\n" +
Tools.hexColorMSG("#4db9e3⭐#484f2aMonedas &e➠ &7") + Tools.getPlayerCoins(player) + "\n" +
Tools.hexColorMSG("#4db9e3⭐#484f2aCorazones &e➠ &7") + Tools.getPlayerHearts(player);
ComponentBuilder builder = new ComponentBuilder();
TextComponent format = new TextComponent(event.getFormat());
format.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(stringBuilder)));
TextComponent finalMessage = new TextComponent(event.getMessage());
finalMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(" ")));
builder.append(format).append(finalMessage);
for(Player online : Bukkit.getOnlinePlayers()){
online.spigot().sendMessage(builder.create());
}```
Its coming from another method but it is bungee's
Because it works for original message but not for the text component
Anyone know what the MVdWPlaceholderAPI Gradle Dependency, and Repository code are? Idc that it is outdated, the server I'm dev for just uses it for some reason. .-.
TextComponent.fromLegacyText
Could be down tbh, not sure that they still maintain those old repos
where exactly would I use that>
Anywhere you want to use a string with color codes in it
Other devs are able to use it. .-.
Or you can use .color on your text components
Try to ask directly on their discord, they will be able to give you more information about that ^^'
Can't find the discord on the spigot resource page.
Alright let me try that
Aren't those you're looking for ?
I'm looking for Gradle, not Maven.
.-.
Oh yeah x)
That seems to work, thank you so much
Unless they have a different repo url for it that they won't tell me. .-.
Well, they could have their own gradle repos
since I don't see any gradle repos on their posts
Wait.
Is there away to avoid that one hover event's text passes on to the next TextComponent? The second component I have there shouldn't have a message but it does
This @quasi patrol ?
the same from the first one
Where did you find it?
Google x)
How do I add a NMS player to a scoreboard team? I already tried adding the name as an entry to the team.
Any other suggestions (or packets I should send to the player to notify them of the change?)
Can you send me the link so I don't have to manually type it out lol?
Well, actually, you could have figure it out without it x), it's just a jitpack.io usage here
So I add two TextComponents together with a ComponentBuilder but I would like for one to have a hover event and the second one not to have one. I don't add hover event for the seconds one but it still shows the one from the first one.
Alright I'll try that thank you!
i tried both .reset and .append and it didnt work for me, same issue.. different person
builder.append(format).append(finalMessage).reset(); worked for me
THose methods, reset and append worked on the builder
so here's how im using it
the main parts to focus on, is usernameColored which has a hover event
show_text, just shows the rank
format is for chat
it shows the name >> message, right
assuming that .reset() works... there should be no hover event on the space, arrow, or message
there is a hover event on all of those though
the weird thing is that mute has a hover event, and .reset() seems to work there
like there's no hover event in the space, nor prefix in the mute + " " + format
how do I deobfuscate minecraft's server source code? Can I even make changes to it if i do?
is it BuildTools that can be used to make my own server jar?
Ah hm, thanks!
how do i look at the required input value of a gamerule in code?
?jd
that- doesn't really help me
Wasn't doing that for you
So I can uh, use BuildTools to make a small edit (like a random new line in a file), and build a new server jar off of that-?
sure but why
Just wondering
Class aClass = GameRule.<gamerule>.getType(); ?
what does the Class data type do
Is there a way to get the Villager/Entity instance from a Inventory / MerchantInventory?
MerchantInventory#getMerchant#getTrader is the Player instance
Ah crud i keep forgetting about that, sorry thanks!
you can check if the classes are the same
Do we have a trade event yet?
huh?
yes, lots
TradeSelectEvent
VillagerAcquireTradeEvent
VillagerReplenishTradeEvent
for instance here the class will be the boolean class
can't i just do .toString() at the end and then it will say like boolean or integer
1 sec lemme test that theory
i was right
[04:40:48 INFO]: [Gamerules] class java.lang.Integer
[04:40:48 INFO]: [Gamerules] class java.lang.Boolean```
Wait i think this was reversed
Im trying to get a Villager instance or Entity instance via InventoryClickEvent
So doing that wouldnt be useful, and casting getMerchant to Villager is just a ClassCastException
(Villager) getClickedInventory().getHolder()
Ahh ty
I assume this is only when the trade is selected, not when it’s actually used?
Yes
I guess you could detect when it’s used via the click event
Hmmm... curious for anybody that's done this before
When you use Entity#teleport() it makes the entity immune for about 2 seconds or so
Can that be overwritten with Entity#setNoDamageTicks(0)?
That invulnerability period is extremely annoying and if I can override that, it would be awesome
try it 🙂
for anybody that's done this before
Not able to test it at the moment and I'm sure someone's run into the same issue lol
hmm lemme try
wait i wonder if kill still kill the entity even if they are immune?
D:
Gradle btw.
Idc that MVdWPlaceholderAPI is outdated, the server I'm developing for uses this plugin so I have to suffer with it. .-.
I'm using libs disguises and getting java.lang.IllegalArgumentException: Plugin cannot be null
anyone know what could be causing that?
google "how to use jitpack.io", and you'll find the solution to your problem 😉
I still don't see the problam.
plugin is null somewhere
Share the error
ok
The repos doens't have the version you entered, just use the last commit to build it
How do i check if an item is a wooden sword
or something like that
i know its incredibly basic im just brain dead rn
Last commit?
?learnjava when
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.
I told you to google how the jitpack.io works, if you're not even willing to check it out, I can't help you ^^'
?paste
--refresh-dependencies?
bro im lazy to even read bro so hard to understand!11!!11!11
The website that I found wasn't very helpful .-.
JitPack Documentation
!verify sudologic
This account is already verified!
master-SNAPSHOT isn't working. .-.
Try the actual commit hash
Idk what the issue is
What is on this line
aspireinc.torture.Files.ServerScriptService.battleEngine.startPveBattle(battleEngine.java:42)
So um. How do I get that?
On the github repos
Where on the github repos?
in the commits section ?
(it is the DisguiseAPI.disguiseEntity())
This?
That's the branch name
yup
Short name, or click it and get the long name?
the long one
For what I assume is this. .-.
You did add the jitpack repo to your gradle right ?
This? gradle allprojects { repositories { jcenter() maven { url 'https://jitpack.io' } } }
yes, it should be in the build.gradle file
It is.
mmmh well that's strange, it should work x)
Already did that for many plugin without repos but only github repos
and worked pretty well for me x)
Should be since we can see in the error it tries to go over jitpack.io
So what do we do?
Well, last resort is to make a local repository, add it, and use it like that
D:
So, add your plugin in your maven local repos
and add "mavenLocal()" to your build.gradle repositories
Brain cells are now gone.
Well I don’t see anything with namespaced keys there so I imagine LibDisguises is to blame
Is your version up to date
anyone>
if i was making a player shop, where people could buy items... would i just store the things as
HashMap<Material, Integer>
Material the thing they're buying, Integer cost, loop through it and add it to the store..? or
im not tryna make a config for that 💀
?
I can help with that
you have another library
@ConfigValue
private Map<Material, Integer> shopPrices = ConfigManager.map(Material.class, Integer.class);```
Indeed I do
Did you end up trying the command library?
LOL
i didn't, i cloned the classes into another plugin (just a testing one) to see how it'd work out
but i got wrapped up in making Cosmetics
Why did you copy the classes instead of just shading with maven lol
idk
Well anyways if you want to make it configurable more easily you can try my config library
Let me know if you're interested and I will send docs
alrrr
i did have some config questions, but just the Bukkit configs so i'll ask those here if anyone¨s good with configs
Shoot
if anyones good, lmk -
ok
so i have all my player data files, in their own individual files
and they're just .txt, right
Right
Do you have a library library
That doesn't sound like a very good idea
how could i take each and every profile, add it to a configuration section, like a file i have player-info.yml
You can make a class directly serializable and deserialize with json
can someone help me, im using FaweAPI to load and paste schematic but it show the not in GZIP format warnings
let me make an example rq, of what i am trying to accomplish so its easier for me, and whoevers reading this
Doing that with the standard config library is a bit of a pain
But you can create a config section with createConfigurationSection(String) on any config class
And for that config section you can set additional keys and such
You don't actually need that though
You could just loop over each player doing this
player-data:
fb4cdeed-f266-4db8-87e4-ddfd963d7b00:
UUID: fb4cdeed-f266-4db8-87e4-ddfd963d7b00
Shards: 246
Rank: 100
Warns: 11
Kicks: 1
Mutes: 10
Bans: 1
Is muted: false
Is banned: false
Is vanished: false
Receiving notifications: true
Home location: -2372.2764900112825 72.0 -802.4190905671 world
``` is what im trying to get
and then for each player it just makes a new section
for (Player player : players) {
config.set(player.getUniqueId() + ".shards", 150);
config.set(player.getUniqueId() + ".rank", 100);
...
}```
now the question... because these configuration things confuse me a ton
how would i edit them, and save them
Edit them with set
i'd just config.set(their uuid, thing)
Yes
and then config.saveDefaults();?
No
no
Not saveDefaults
If you're using the config from Plugin#getConfig you can just call Plugin#saveConfiguration or whatever it is
Otherwise you call save(File)
hello
i'll dm you more, as i do this i think if you're okay with that
Sure, but it's gonna be kinda annoying to use the standard config library
I guess it's worth trying it at least a few times
But it's a lot of boilerplate and gets real old real fast
Mine isn't the only config libraries, there are a number of good ones out there
can a metadata store a location
You mean ItemMeta?
can someone help me with load and pasting schematic with world edit, it shows "not in GZIP format" warnings
Im using this code
no
?
If i wanted unlimited trades would i:
Set this to max int limit or -1?
OR
After trade is compelted set the trade amount += 1?
can it store locations
Probably
What do you mean
If not you can just serialize them to a string or whatever
Is that not defined by maxUses?
can someone help me?
If you wanted "unlimited" just set it to Integer.MAX_INT
Ask in enginehub or something
This is spigot support, not fawe support
alright
Ah thanks i forgot how to get that max int, i should of just googled it tbf
👍
Finally, MMOItems support with villager trades
Ah crud i need to reset the trade after it completes to reroll the stats smh
What plugin Sword ???
The sword is from MMOItems
But the villager trader plugin i made uses its API to put MMOItems into trades
Gonna work on implementing the costs now
Thx
Im only supporting the 2 i use
Theyre premium though so not many people will even use them
Why do they need support though
If the plugin is any good you should just be able to treat them like normal items without issue unless you're doing something funky on them
I mean for storage and similar
I mean things like Shops and whatnot its useful
EG with ShopGui+ having suport for items supports ise really useful
Yes you can just use the commands options and remake the item in the gui but
Why not just use the Plugins API to support that item and it will update as you change the item
If your just rewarding the custom item to a player then commands are fine but most cases do require a hook for item plugins
Config, not storage
I mean, I guess I could expect people to stick in serialized itemstacks... but I don’t think anyone will do that
Suppose I could make some kind of in game GUI to configure it
Ide just hook into the plugins api ngl
it takes just 1-2 lines of code
With MMOItems and CustomItems at least, theyre just simple one liners
Yeah but there are dozens of them
Why do that when I can just let the user stick in any old itemstack
Just add support when someone asks for it
Well if they change that custom Item in the plugin it wont work anymore
While if you use api it always works
Then they should update the item in the GUI
Its just a lot of work for the end user
Because anytime they wanna update an item they now have to go throughand do other configs as well now, even if its just guis its just rather tedious
Well I’ve already had a request for a plugin I can’t even find the dang API for
Actually it’s the one you just mentioned
Yeah MMOItems and CustomItems you need to mvn install-file
mvn install:install-file -Dfile=CustomItems.jar -DgroupId=com.jojomd -DartifactId=CustomItems -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar
And then you can import it like so
ignore selection my snipping tool buggin
What if I don’t own the plugin
Uhmm if its CustomItems ask JoJo he can help you, he will likely give you a copy of it as ive seen him do it before
as for MMOItems im not sure
fr though
I mean its public just not to people who bought the plugin 😉
xD
So privatly-public
But yeah idk why its so hard to implement a public API
Like almost any premium plugin doesnt have a public api anymore
Ive actually been waiting almost a year now for CustomItems to make a maven repo xD
Wow that was so much easier than i thought it was gonna be
Now trade ingredients can be mmo/custom items
im having some fileconfiguration issues
Whats it saying?
Thats quite weird
Are you sure your not seting the full uuid object somewhere else?
positive, im retrieving it frm somewhere, but im getting it as a string first
security thing, dont question the logistics behind it:
does path end with the .?
yes
its just the uuid + "."
it gets confusing for me when i see the + in a lot of places)
why would the UUID be the path and the value
player info
oh and its just a recycled thing, idk why its there
it used to be a security thing for the old player info system that i had
what happens if you try using uuid + ""?
this might be a config thing actuallyyy, i'll try something.. let me just delete the entire section and remake it
the config value you showed looks like something from a previous test
doesnt matter, will call the same method
yeah i think so @quaint mantle
Why aren't the libraries being excluded?
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.4.0_350</version>
<exclusions>
<exclusion>
<groupId>club.minnced</groupId>
<artifactId>opus-java</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Nah he means exclusions
And IIRC JDA needs those libaries and uses them
so you cant exclude them unless the library isnt used
Opus is optional
Unless exclusions need a scope? Cause i never knew them to need one
tried this and it doesn't compile
But doesnt JDA use the libary? same with the log4 one
even just referancing it will mean you cant exclude it, because youd get runtime errors
JDA Wiki:
Using Maven
Exclude OPUS natives if you don't need encoding/decoding of audio (With LavaPlayer you don't need these natives)
yeah
JDA
api("club.minnced:opus-java:1.1.0@pom") {
isTransitive = true
}
Weird
Im not entirely sure why maven wouldnt exclude that especially since its marked as transitive
😵💫
so i tried removing the section..
and so i rejoined, expecting it to be remade
the file size is now 307, so somethings shorter
but when i open it, its blank
can we see the code context?
yes which one
the creation of the line "Uuid" shouldnt have any more issues, its all string now..
the function it's in
yeah
boop
thats the removal of the section
there's a ton of arguments for this, ignore that
and what's fc?
and the file is just a bunch of empty lines?
is your code on a github by any chance?
anyone know how to prevent an anvil from changing the font/color when you enchant/apply books to an item?
ahhh, it was a FileZilla error @candid galleon
the lines are al there, and the uuid is now a string
tf is FileZilla
probably have to re-create the item stripping the italics
ftp thing
why not use WinSCP
ChatColor.stripColor()
host doesnt support it appearently
and WinSCP causes my CPU to go BRRR
strange
ya
yeah no that is not it
so you are saving the uuid in the uuid?
its fine now 😭
this is just a big ew
💀
as is this
any reason why imports are like, making no sense?
like why a class, that exists, and has existed for a while that i made... is suddenly "not real", when in reality it is right there
and is imported?
version update?
what does it say when you hover over the red lines?
highkey lowkey wack
nah, this is just straight truth
second one you can just click the import one
ok thanks
first one i'd double check the path
already imported tho
whats the class visibility?
they're both already imported, and the paths are correct
How can I register a command without using the plugin.yml, because I want to register commands from the config.yml
Is this possible.
yes, you will need to go over the commandmap and register your command there
hey I am new to gradle and plugin development, could anyone help me understand how to build a gradle based plugin in intellij?
The terminal is your best friend
if you are new to both Maven is probably your better choice
I am familiar with Maven but was modifying an open source project and its in gradle so .....
ok
How do i communicate with gradle terminal 😅 no idea about the gradle file structure
Then Just use gradlew.bat build / ./gradlew build
in intellij there is no built in ? not sure if we are talking about intellij here
I was trying to create an artifact
IntelliJ has a Terminal built-in, but cmd.exe does the same
So cannot use artifacts. i have to only use glradew?
So you want to Push to a maven repo?
So you Just want to create a jar?
yep
No Idea what this artifact Feature is about, but gradlew build should work with building a jar
The jar is created in the build/libs folder iirc
Alright thanks ^^
how would i prevent an arrow from slowing down and stopping in water?
declaration: package: org.bukkit.inventory.meta, interface: CompassMeta
Will this work, if the block in the location is not lodestone?
it depends on how often you set it
the value is validated whenever the compass is placed in or taken out of an inventory
Hmm, okay
Then, is there a way to make a specific compass to point to the specific location?
no, not permanently
How'd I make it so that when a new inventory opens to the player, it does not reset the mouse cursor to the middle
My code:
e.setCancelled(true);
if(e.getCurrentItem().getType() == Material.BARRIER){
player.closeInventory();
player.openInventory(mainMenu.getInventory());
}
}```
Thanks
Afik, you can't control clients mouse
I've seen other servers that have inventory guis that doesn't reset the location of the cursor
any idea how'd they execute this?
so clear the inventory, then add more items?
yes
that's very tedious for not making the cursor reset every time😓
thanks!
I'm thinking it's a good suggestion if spigot implements that we can update old inventory to new ones without closing/opening/creating any new inventories
Maybe create a fake lodestone
that isn't there
ItemMeta....
yea but the cursor goes to the center everytime
when you closeinventory then openinventory to update it
How though
what is spigot supposed to do about that? That's what happens when you close an inventory lol
Anus destroyer.
because 'TPS' is a concept that has no real meaning
maybe make a method that just makes clears the item of the current inventory and just add items to it instead of opening a closing/opening
uh, so like the existing inventory methods that are already there and allow you to clear and add items
yea, it's more of a convenience thing if you want to call it that
just clear yoru inventory, then add a new contents
you can pre build teh array so you just do a single add
- there is already Inventory.clear
hmm. Ok i see, thank you
You can open an inventory on top of another that way it won’t move your cursor
how?
Idk if that is how you are meant to do it but always worked for me since 1.8
Just don’t close the old one
does it work in 1.17.1?
https://streamable.com/b82xpi
https://paste.md-5.net/
Does anyone know why does the block break animation not reset for the block at those coords?
edit: got it fixed, needed to use the same entityID for all the stages
would that draw disadvantages? such as rendering many inventories at once for client side?
I wouldn’t imagine so the inventoryclosevent still gets called
Just a suggestion, you can use at own risk xD
alright, thanks
if you spam it, it can flicker. but other than that none
How do u make a bossbar with cusotm text?
BossBar bossbar = new BossBar(*with parameters of course);
create one, set text, send to player
this
Bossbar is an interface, that wont work
Bukkit.createBossbar
xd
nah? create it urself i think
it isnt hard ngl
k
would i do smth like this:
@EventHandler
public void ServerTickEvent(ServerEvent e) {
System.out.println(":H");
BossBar bossbar = Bukkit.createBossBar("King of the Hill Event", BarColor.BLUE, BarStyle.SOLID);
}
@ivory sleet
no
what do you want to do?
no its fine i did it
but BossBar bossbar = Bukkit.createBossBar("King of the Hill Event", BarColor.BLUE, BarStyle.SOLID); that isnt doing anything
public void serverTickEvent(Server server){
server.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
public void run(){
if (KothMain.kothStarted == true) {
System.out.println(":H");
BossBar bossbar = Bukkit.createBossBar("King of the Hill Event", BarColor.BLUE, BarStyle.SOLID);
}
}
}, 1, 1);
}
``` `:H` gets printed every tick but there is no bossbar
Why are you checking == true. There is no point in doing that
you need to add the player to the bossbar
^
ik
its a preference
i always do it
there is no point in using the ServerEvent either
not even sure what events are meant with Miscellaneous server events
will i have to iterate throught the server.getOnlinePlayers() to give it to all the online players?
Yes
cool
Also I don't think it's a good idea creating a new bossbar every tick like that
how should i do it?
Do it once
then add players to it every tick
Then add the player to it on join
so you add them on join and show the bossbar when the command gets executed
So this is basically when the Trade event finishes?
thanks @hybrid spoke and @chrome beacon !
could someone help make a plugin that makes it so anvils don't automatically name items to &b and instead keeps the respective name of what is in the first slot of an anvil?
java sucks, that's the problem
well then u are wrong at minecraft development
what does that even mean
TBF the anvil api is weird but it is fairly easy, you just need to look into the different Anvil events and play around with them a bit
well i've tried but when i try it with a server i just get errors with no idea what they mean
so not java, but you suck.
do you have any code so we can look at it?
All you need to do is set the anvil's result item's DisplayName meta to match the DisplayName meta of the item in slot 0 of the Anvil
Or just strip color
And then you need to handle previewing the item so it doesnt look all funky, i dont remember how to do that part
?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.
Does anyone know anything about this event?
Or should i just listen to inventory click event and then see if the slot 2 has an item in it when clicked? I dont see an easy option to see when a trade gets completed
the event i showed there didnt fire after trading with a NPC villager
so check to make sure item is not null -> check if itemmeta is not null -> check if displayname is not null -> setdisplay of the result to that of the first item's displayname? or am i just too dumb to get this shit
as it stands there, called when the villager gets a new trade
Item Meta and DisplayName will never be null
it will in case of air
So like when it unlocks a new one through leveling up?
i guess soo
Thats true but ide just material check the slot before tbh
fr tho
whats up with these Trade Events
they straight up dont fire LMAO
VillagerReplenishTradeEvent Is supposed to fire after a trade at least from this is what it sounds like
Ah screw it im just gonna use InventoryClickEvent and handle completed trade events that way
they fire just fine
That method does not fire
Called when a villager's trade's maximum uses is increased, due to a player's trade.
not every trade
I have a InventoryClickEvent in the same class that works, so i know its registered
So then is there any reliable way to see if a trade completes?
Other than doing a janky InventoryClickEvent for the 2nd slot on Merchant inventory?
not really. You can watch the TradeSelectEvent to see what trade is selected, then monitor the click I guess
Thing is with MerchantInventory i can get the currently selected trade
So TradeSelectEvent is kind of overal not needed tbf
hi, is it possible to cancel chunk load event so it doesn't read chunk files from the file system at all?
wat do you want
we dont want x y problem...
My plugin instantly switches the world of the player on player join, but I don't want to load the initial world chunks
That's the same thing I think. If the chunks don't load you get an empty world
its not teh same
Beileve it or not voids worlds are actually generated kinda, theyre not unloaded chunks or anything
the user joins in the overworld and instantly switches to the nether. So I don't want to load the overworld chunks because the player instantly switches and doesn't need them
then generate a void world as yoru overworld
can I do it from the plugin?
what plugin?
I don't think that's a good solution, seems a bit hacky
its teh correct solution if you don;t want chunks in yoru main world
any plugin. I mean with the spigot api
question, why are you not using your overworld at all?
I have it on a separate server
it seems pointless as you move them instantly to the nether, why not just make teh nether your overworld?
eliminate teh overworld server all together
No point in having it if you don't use it
hey what is wrong
[29.11 10:55:51.641] INFO: [Lobby-1] java.lang.NullPointerException
[29.11 10:55:51.641] INFO: [Lobby-1] at de.badtigermc.mysql.MySQL.createTable(MySQL.java:55) ~[?:?]
[29.11 10:55:51.641] INFO: [Lobby-1] at de.badtigermc.badban.main.Main.onEnable(Main.java:21) ~[?:?]
[29.11 10:55:51.641] INFO: [Lobby-1] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.641] INFO: [Lobby-1] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-db6de12-18fbb24]```
[29.11 10:55:51.642] INFO: [Lobby-1] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-db6de12-18fbb24]
[29.11 10:55:51.642] INFO: [Lobby-1] at java.base/java.lang.Thread.run(Thread.java:829) [?:?]```
for simplicity. I use the same linked playerdata folder for every server so I don't have to manually edit anything there
then link all the player data to the server that has your nether
very quick question because my brain is refusing to compute,
(ench instanceof AttackEnchant || ench instanceof DefenseEnchant) && !(ench instanceof ConditionEnchant) would this condition return false only if ench is instanceof both ConditionEnchant and AttackEnchant or instanceof both ConditionEnchant and DefenseEnchant
oh yea
OR its neither of the first two
no wait
That's what I'm doing. The player world and coordinates should be adjusted on world/server switch and I don't want to do it manually. So the player first joins to the same world and I instantly send him to the other world with a reflection so all the coordinates get calculated correctly and I don't mess with the playerdata file myself
type yoru requirements out in english first 🙂
what about !(ench instanceof AttackEnchant || ench instanceof DefenseEnchant) || !(ench instanceof ConditionEnchant)
are you trying to get a true or false response to the test?
it should return false if it's both instances
then test and not or
MySQL line 55: con.createStatement().executeUpdate("CREATE TABLE IF NOT EXIST BannedPlayer (Playername VARCHAR(100), UUID VARCHAR(100), End VARCHAR(100), Reason VARCHAR(100))");
Main line 21: MySQL.createTable();
Spigot 1.8.8
You need to contact the plugin author
im the plugin owner xd
you want to test for?
AttackEnchant && ConditionEnchant
or
DefenseEnchant && ConditionEnchant
yes, its opposite
so java if (!((AttackEnchant || DefenseEnchant) && ConditionEnchant)))?
that would return true if its NOT either attack or defense and condition
yea should work
remove teh ! if you want it inverse
thanks
My god why is there not a freakin TradeFinishedEvent or similar ffs
makes things so complicated
did you test the acquire one?
Yep up above i did
it just never fires
The acquire isnt finishing of atrade either from what javadocs says
so then you need to go over InventoryClickEvent
Oh trust me i am
its hell
https://www.toptal.com/developers/hastebin/oqarurahix.kotlin
Its messy right now, imdoing assloads of debugging so itll be like that
Right now im trying to make it so that the commands set to fire when the trade finishes dont keep on firing because if you have a non stackable like a sword and keep sitting there clicking the commands just kept firing
I have a fix for it, it was just to send the item right into the players inventory and clear the CurrentItem, but then im gonna have to handle shift clicks...
oh hey i made a new feature, trades automatically go into the inventory xD
nah not yet
Oh the way i handled it removed the shift clicking funtionality shiz
oh well
if((p.getInventory.getFirstEmpty) == -1) return "inventory full"
hmm there is a scenario that methods fail in
what if i have a full inv of ItemStack(Material.DIRT, 1)
that would fire as i have a full inventory when adding dirt which wouldnt be tre
The HashMap returned by addItem returns a HashMap of items that couldnt be added to the inventory iirc
oh damn ive managed to keep this plugin under 500 lines so far
well test it
(Playername VARCHAR(100)
wtf
playername is atleast 16
that is not the problem of the error btw, just performance stuff
maybe the connection is null ?
do some logging
looks like con is null
btw when you'd use java 16 you could see exactly in the error message what exactly is null
Just drop it
simpler just to try to add it, then drop anything thats in the returned map. Simpler code
.values().foreach item -> world.drop item
Yeah exactly, I'm doing it similar in my lib: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/de/jeff_media/jefflib/InventoryUtils.java#L75
AtomicInteger heh
https://imgur.com/a/uc8fruZ Any ideas why I can't get CraftWorld to import? I've tried maven, spigot, spigot-api, spigot jar, spigot remapped jar etc... I asked for a few days now still haven't gotten a solution.
run buildtools and use spigot as yoru artifact
Already have. Look at the images
in that screenshot you are using spigot-api not spigot
Look at all the images in the imgur link
I did, there are 4
also tried both remapped and not
yeap
right click your pom and select update project
Nope only spigot jar
I have
Tried.
^
then you did it wrong
tried
it works just fine
clearly not xD
give up programming then
Its an issue with spigots new jar system
World = Spigot-api CraftWorld = Spigot
yeah, variables inside lambdas must be final
no its not, CraftWorld is CraftBukkit, its nothign to do with MC mappings
oh just for the lambda?
yeah, that's why I'm using it
even tried with out maven
yeah you can find the PROPER server .jar at buildtools/Spigot/Spigot-Server/target
lol
Tried pre as well
um, that is going not work. Multiple of the same API
eclipse's maven integration sucks btw
I wouldn't wonder if eclipse is the problem and if mvn would compile without issues
it does work, it's just not very useful 😄
maven/eclipse is fine
I always had problems with eclipse + maven because eclipse would rather read it's own properties file overwriting the maven stuff
I've never had any issues other than occasionally having to refresh a project
I don't use maven (unless shading). Just did it for testing because md_5 wouldn't stop complaining that I wasn't using it to depend on spigot.
I'd shoot myself without maven
every one of my plugins depends on at least 3 of my libraries, I don't even want to imagine what'd happen if I'd have to update them all manually
I'd never go back to not using maven
same
imagine using eclipse without maven
yeah I already started to vomit
I just don't like needing to "build" my plugin everytime I'm testing and update 1 line of code.
so you just put the source code into your plugins directory?
? no I just export the plugin into my plugins folder.
and that's "building"
no thats exporting. Building is using a dependency manager to compile the jar.
he means building without a buildtool
no. that's exactly the same
yeah I know what he's talking about, just wanted to mention that it's still building 😄
🤦 think what you want
you too
even when I run gcc to compile just one single C file, it's also building
from the wikipedia article Building (Disambiguation)
"wikipedia" lol
You probably also dont trust books written by CS engineers I assume?
They also call it „building“
wikipedia is good for most things, unless its politics
yeah wikipedia is basically totally fine for everything unless you're writing something scientific etc
part of the reason is that people without real hobbies like me go through all the changes made by anyone and revert (or don't approve them at all) them when they don't provide proper proof for their changes
wikipedia can be edited by anyone. So for most uses its not good.
try to sneak a change into a wikipedia article and it'll get reverted within 2 minutes, or not approved at all
just try it
I bet you won't even find ANY false statement on wikipedia unless you spend hours searching for a tiny detail
There was literally a guy changing the size of a country for 2+ years on it LMFAO
just look for politics or woke rubbish and you'll find loads, but avoid that and its good
I got craftworld to import!!!
I don't find anything on that on the internet
how?
Still missing other shit like JSONObject and what not.
Deleted the class xD
that's not in the server .jar anymore
yeah I said eclipse sucks 😄
I know
Wasn't an eclipse issue.
just add Gson as dependency too
I don't use Gson.
Well
I use JSON (preferably simple)
when you're looking for JSONObject from older spigot versions
then yes, you've been using Gson
🤦 you need to go read the src lol
so they included gson for fun in the server .jar?
"from older spigot versions"
mc 1.8.3
well anyway, also for other json libraries: just add is as dependency when it's included in the server .jar, when not, shade it
alright, so it includes both
your referenced libraries part is really annoying to see lol
Gotta support the good versions 😉
yeah but why not just use modules for that, so you have a clean classpath for every NMS version
Not needed.
I just have one jar per module. I mean how does it work with 1.17 and 1.18? or are you using the remapped versions?
because e.g. "playerConnection" is called "b" in 1.17 and "a.b" or sth in 1.18 IIRC
Reflection
oh dear I also used those nasty approaches before I just switched to modules, it's way easier imho
Not really. And 1 class is better then 12+ classes with copied code with only the versions changed.
tell that again when you add 1.18 support please^^
It used to work fine with older versions, that's true
I already have
My minions plugin support 1.8.8 up to 1.18-rc3
btw is there any already working datapack for 1.18 that adds new biomes with a custom namespacedkey?
I want to try whether my thing here works https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_18_R1/src/main/java/de/jeff_media/jefflib/internal/nms/v1_18_R1/NMSBiomeUtils.java
it's working fine for vanilla biomes but no idea whether it also works for 1.18 custom biomes
Anyone know the issue
are you using maven / gradle?
what dependencies did you use?
looks like you were using CraftBukkit / Bukkit as dependency instead of spigot(-api)
I feel like I'm missing something... Does Gson not have a method to create a JsonObject from a map?
Closest I can get is
Gson gson = new Gson();
JsonObject = gson.fromJson(gson.toJson(Map));
```I would prefer not having to make it into a json string first.
Found it. toJsonTree(map) Hope this is what I want.
do you need a JsonObject, or just a json string?
normally you can just do ```java
Gson gson = new Gson();
String json = gson.toJson(myObject);
JsonObject::new is public fyi
The object not the string. (reply to: mfnalex)
But anyways no they don’t have a particular method to convert a map to a JsonObject
gson.toJsonTree(Map).getAsJsonObject()
Yes but that takes any object and tries to convert it
yeah but it doesn't take any parameters
Why would it take any params
Adventure and Spigot
because they want to have a Jsonobject representing their map and not representing emptiness
Adventure and paper I mean
are you using maven / gradle or sth?
Yes that’s what they need, which can be done with the Gson instance, however the Gson library didn’t make it for their need.
You can just throw a map into Gson. It will serialize it to json,+
👀
yeah but it'll return a String, and not a JsonObject
Sure you can just produce a JsonTree
I tried that but it wont load when I try to load it into a server
No clue why
Lemme open that one
it will definitely have shown you an error message^^
you compiled the plugin with a java version more recent than your java version the server runs
Your server uses an older java version than your compiler
in your pom.xml, you can change the java version inside the maven-compiler-plugin, e.g. like this:
<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>
and at the top inside <properties>:
<java.version>1.8</java.version>
*But what you should really do is using the latest java version for your server...
you compiled it using java 16, but your server is running something older
My server is runnning 16
It's been on 16-
you should compile with java 8 (if you want to support older versions), or java 16 if you need MC 1.17+, or java 17 ir you only need MC 1.18+
no, you compiled it using java 17
Java 16 uses major version 60
Java 17 uses major version 61
With my host, I go to start it and it says to update but then it don't update bruh
there we go
?
That is in console
pls answer this: is this a public you code just for you, or for the public
it says the java version
for the public, the plugin
for 1.18+ only? for 1.17+ only? or for older versions too?
1.17.1+
okay then compile it using java 16
that means
on YOUR PC
run java 16 to compile it
Then compile with java 16 and spigot 1.17+ and tell everyone that uses old java/spigot versions to fk off.
or better: let maven handle it. I already posted something about it above
we also still don't know whether you're using maven, or gradle, or neither
maven on one thing
but that would be important to know so we can tell you how to change the java version of your compiler
okay show your pom.xml pls
?paste
change "maven.compiler.source" and "maven.compiler.target" to 16
as i said
i cannot understand stuff usually-
change those numbers from 17 to 16
also, how are you building the .jar file? what exactly are you doing to let it create a .jar file?
pressing the play button at the top right corner is the only right answer 
cough
what am I supposed to use in 1.8 to send titles if the only method is deprecated?
packets?
- Stop using 1.8
- i believe there's sendTitle(String, String, int, int, int)
only one is this
do you really mean 1.8, or 1.18?
1.8
you are on 1.8. You can safely ignore EVERYTHING that says deprecated
also it's not deprecated because it wasn't subject to being removed, but because "API subject to change"
it was basically deprecated because the method was a draft
I was on a server a couple weeks ago that claimed that they could ban you via hardware id. Up until this point, I was unaware that this was possible since Minecraft didn't send hw info. Am I wrong? I can't find a tutorial on how to get this, but the server seemed pretty convinced this was possible.
And if this is possible, I want to integrate this into something lol
Its not.
it's basically bullshit
Gotcha, thank you for confirming my beliefs
hi i need help , why this is not updating every 5 seconds? there is no errors in console .. its just happend only when the server startup ..
How do i remove an items itemmeta
ItemStack#setItemMeta(null)
well it seems like the file is being used by another process 😄
are you on windows?
yeap
maybe you still have some process open that locked the file
stupid solution, but a reboot will fix it
or you find the process that "locked" the file and kill that one
Tried that.
Looked through task manager no java programs running
what line exactly is throwing that exception?
Windows cringedows
Files.copy
It's possible you have some other code that is trying to open the file
And you never close it
any reason why you're not using try-with-resources btw?
it will automatically handle closing the resources
no idea whether it helps, but try this
try(InputStream inp = this.getClass().getClassLoader().getResourceAsStream(filename)) {
Files.copy(inp, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
because right now, if Files.copy throws an exception, inp is never closed
Ill try it. But like I said I run all my bots with these exact methods. (Except for setupdFiles() thats new.)
same error
but it only happens for the last file, right?
nope all
oh okay
are you sure you never opened any of those files already in your code somewhere else?
I'm sure.
then I have no idea
public static void main(String args[]) {
ConfigManager().get().setupFiles();
}
hugh? What's ConfigManager()? a static method?
ty
I have a prepareanvilevent, when i set the result it shows up but i cant take it out
If you mean it gives you original item I think you need to listen to another event
@tender shard I've even added a 10ms delay and I still get the error.
https://serverfault.com/questions/1966/how-do-you-find-what-process-is-holding-a-file-open-in-windows maybe this helps somehow?
you MUST have a process that has the file open
you probably can't. You'd have to create the sound manually, or send a fake block to the player at the same time the noteblock plays
cant you just make the ConfigManager singleton a constant?
private static final ConfigManager INSTANCE = new ConfigManager();
public static ConfigManager get() {
return INSTANCE;
}
Unless you need it to be lazily initialised for some reason.
I meant to reply to the noteblock question but it was removed
No, it shows a custom result i have for the anvil thing it just wont come out of the anvil
are you running any other plugins?
I'm deleting the files before I start the program. So it can't be something from the previous start of the program keeping them open.
Then you are cancelling the inventory click event
I can use that. I forget why I did it my way lol
nope
you got an example code that I can try?
I've posted it all lol
I didn't have a repair cost, i set one and it works
Even after restarting my pc I get that error.
How does the task update the boards? How does this task obtain instances of your scoreboards?
I was talking do @runic mesa
👍
of course