#help-development
1 messages · Page 2003 of 1
couldn't be me. *sweats*
fair enough
then again
who reads plugin code
ah well
i havent had much issues with player objects yet
Any idea why removing an entity leaves behind a shadow?
I'd assume because it wasn't actually removed.
Seeing your code and how you're doing it would probably help.
3 minutes have passed
Here's the code
i have an issues
Wanted to remove some bs I made to try to prevent the shadow
https://paste.md-5.net/ivekicawax.http
There you go, I guess
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
about custom config, its save default thing, but its wont read
if i restart server its read it
first start dont read
second start work perfectly
uhm
Try this:
saveDefaultConfig();
reloadConfig();
Instead of just using saveDefaultConfig();
then just ignore it
nvm found the bug
if (!file.exists()) {
saveResource( "message.yml", false );
yaml = YamlConfiguration.loadConfiguration( file );
}```
you must tell them whats that reloadconfig is mate
i didnt specify yaml
Yeah, sorry
wdym
i dont know still working on fixing mini bugs

if (args.length == 0) {
if (SingleHomeUtils.getHomeNull( player )) {
player.sendMessage( ChatColor.translateAlternateColorCodes( '&', ConfigUtils.getPrefix() + " " + SHMessageUtils.noHome( player ) ) );
} else {
....
}```
Is there a way to trigger something from a different plugin ? For example force a leaderboard update that I have coded in another plugin.
return yaml.getString( "Homes." + player.getUniqueId() ) == null; }```
Sure
You can get an instance of the plugin with Bukkit.getPluginManager.getPlugin
But a proper API is generally better
So just plop it in the lib/ folder and load it from there ?
wtf bro
what i did wrong?
its like
Homes: uuid: x ect...
or maybe should make a list for multihomes
can you do that with gradle ?
nice code formatting
You can add whatever you want as a dependency with gradle
@trail pilot If you hate yml as much as I do, you could use a different file format/wrapper: https://github.com/justisr/HMFF
I just don't understand the part of where I add the API in the plugin.
i dont hate it lool
i will make it yaml - sqlite and mysql
h2 😌
.txt
h2?
no.
dont ever "no." me again
no.
(╯°□°)╯︵ ┻━┻
I think it was a falling air block.
Seems like it doesn't leave any shadows after I removed air from the list


Nice catch.
dum person here, i forgor somethin: how do i stop code from contuning? like if this and that is not that, then stop code
(in an event)
return
return;?
Mhm
event.setCancelled(true)?
no i meant to stop the code, not the event
ah
dumb question should be
if(!(sender instaceof Player)){ }
or
if(sender instaceof Player){ }
depends on what you need
oh
And command blocks
console cant use commands
i mean i wont
I mean if it’s a private plugin then you can skip it if you want
command blocks
Advocate best practices
In a public plugin you have to idiot proof it for everyone
im just asking because i always use (!(ect))
In a private plugin you have to idiot proof it for yourself
Does anyone know how to use specialsource with yarn instead of mojmap?
This is preferred, if you are to use a guard clause to highlight happy path
oh ok thanks
Still wish java allowed !instanceof
happy path sounds like elfs and dwarfs 👀
Just syntactically weird imo
Better than those stinky brackets
Squarecurly’t brackets
curly brackets
👼
I'll take the lack of a response as no
or take it as "people dont know"
That is what no means in this context
yes iirc, no way becuz specialsource hardcoded mojmap ig
ungh
Doesn't Special source just take in 2 mappings files?
So give it yarns mapping file instead of spigots
Or mojangs or whatever you're trying to do
Hm, let me check
It's a universal layout, right
Nope, won't work
ss requires a single consolidated mappings file
am I stupid or should this not warn me about getDrops returning null?
yarn is split into individual classes
(getScrap is annotated as nullable)
Intellij doesn't know if it's null or not the second time
how do i set a variable in another class to an instance of the plugin? i forgor
oh right the output could change
store it either as a JavaPlugin object or (your class name)
You can create a variable or use Optional#ofNullable
if you mean passing it, use dependency injection
?paste
i'm tryna call a function from the onEnable thing to my other class and then setting it there, but i can't call a non-static method from a whatever
https://paste.md-5.net/bilinogeji.cs
problems with towny api resident
oke thanks
So Optional.ofNullable(getScrap(amount)).orElse(getResource(amount))
dependency injection says hi
also they are called methods in java
From memory might not be correct
public static String getTowny_Name(Player p) {
TownyAPI TownyAPI = com.palmergames.bukkit.towny.TownyAPI.getInstance();
Resident resident = null;
try {
resident = TownyAPI.getDataSource().getResident(p);
} catch (TownyException e ){
// TODO Auto-generated catch block
e.printStackTrace();
}
if (resident.hasTown() == true){
Town town = null;
try {
town = resident.getTown();
} catch (NotRegisteredException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return town.getName();
}
}
== true shame on you
^
never understood why people write the full package name too
anyways what's the issue here?
my eclipse is saying to use the path
lol
Any way to consolidate it?
most tutorials have the full package path to avoid confusion or he might have a duplicate clas name somewhere
Otherwise, I doubt SS will work.
here is the exeception
RayGunShoot.getPluginInstance(this);
DerpPlugin plugin;
public void getPluginInstance(DerpPlugin plugin) {
this.plugin = plugin;
}``` it not work
ye
Seems like you're depending on and using different versions of the plugin
why not
aaaa
gimme second to update it
do your dependency injection with a constructor
Read what it says
1 sec i gotta learn what constructors again and how to use them
smh you still dont know
i did... and then i forgor
how can you forget that
Atleast he's going to figure it out himself instead of asking us.
That's definitely the right way to do it.
i told him to use constructors months ago
ObjectCreatedEvent :o
simplest way to explai nti
does he know what events are? 😎
static factory method ;skull;
well not really
do events have to be static?
no
since u can init it inside of the method
Thank you for giving me the hints
oh ok good
i solved it now :))
afaik u cant init events tho?
wrong version
good boy

give lib ideas
prove
creates penguins and sends them to santa
should i make smth like
this man is using /reload
use plugman
boolean SafetyChecker.isThreadSafe(method)
it running on my pc not a host
dont throw a halting problem at us here
got that
Reload is fine for development purposes
but actually that might be useless
Please don't use plugman 
urgh whatever
why plugman breaks some plugins?
Well it can, but there's really just no reason or benefit to use it
give ideas for libs pls
nms 👀
LibsDisguises but not garbage
Hypixel nick feature is pure garbage
why
it has a set of skins to choose from
its almost easy to know when a player is nicked
the amount of skins in that set isnt that huge
you can memorize them if you want to
how do i check if an item has a custom tag
Just don't use the skins then
so basically it lets you change ur name
i know i need to use PersistentDataContainer but idk how
to something
and ur skin to something
and lets you randomize it as well
to randomize i might use something like NameMc API if that exists
to get real players ign
and change stuff on them
?pdc
for what do you need it?
nah the pdc
can someone explain to me how the uuid example works?
i dont know if i need to add message for tabcompleter
save an uuid in string format
its worth?
persistentDataContainer.set(namespacedKey, PersistentDataType.STRING, uuid.toString())```
i wanna know how it works though
everything saved there needs a namespacedkey
anyway im op lol
if (args.length == 0) {
list.add("home");
}```
should i need to add that?
tabcomplete?
ye you would, its not because you're an operator the args length will be different
ok
and for custom aliases?
with config
plugin.getCommand("home").setAliases(plugin.getConfig().getStringList("aliases"))
thakns
wtf
...
Hey, am I correct in saying worldedit 7 released with 1.13?
Probably inversed the check
if(!(sender instanceof Player && command.getName().equalsIgnoreCase("delhome")))
hm
If sender is not a player
For that to pass it has to not be a player and not be delhome command
its bugged af
with tab
if(sender instanceof Player && command.getName().equalsIgnoreCase("delhome")) { return null; }
tabcompleter
if (!(sender instanceof Player && command.getName().equalsIgnoreCase( "delhome" ))) { sender.sendMessage( ConfigUtils.getPrefix() + " you cant use this command on console" ); return true; }
onCommand
7.0.0 released for 1.13.2
I've decided to rewrite my plugin to support only newer versions and was wondering what the best worldedit version was to use
What command did you type
Use the lowest that your plugin supports
If your plugin supports 1.13+ then depend on 7.0.0
[15:40:39 INFO]: VinavilVerde issued server command: /sethome test [15:40:43 INFO]: VinavilVerde issued server command: /sethome [15:40:50 INFO]: VinavilVerde issued server command: /delhome
see lol
sethome work
damn paper only has 1.17?
wait no i was in wrong repo 🥲
PluginCommand home = getCommand("home"); home.setExecutor(new TeleportHome()); home.setTabCompleter(new TeleportHome());
Are sethome and delhome in the same class?
for executor and tab
nope
multiple class for all commands.
Don't create two instances
^
damn paper only has like 1.18
getCommand(discord).setExecutor(new DiscordCommand());```
is it nessecary to like use the double quotes while registering plugin?
cause someone who works on my pl didnt use it
as u can see at top
i mean
It's a variable
do u know java
u dont
^
If it's a String variable, then that's perfectly valid.
bruh i learnt java 2y ago
whats i ned todo
ok
2hex, you just destroyed them.
e
Only create one and use that
I find it funny tbh
Bruh i learnt it 2y ago and i am getting back into it pwez no bully 😦
anyways
lets pretend that never happened
🗿
pwez
?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.
getCommand("x").setExecutor(new x()); getCommand("x").setTabCompleter(new x());
??
im... out
cya
lol
ur doing the same
nah, a few more. collect them in 10 different arrays with the size of 900 each and use a newly created instance beside the arrays
What's the fastest / lightweight command manager?
wat
hes having fun
k
nah he's talking truth, you exactly need 103 instances for the command
and 35 tabcompletors
that shit make you laugh?
bad cat
hi everyone,
hope you all doing great!
question is this enough to update STATE ?
PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("UPDATE " + tableName + " SET STATE=? WHERE LIVE=?;");
ps.setString(1, state);
ps.setInt(2, 0);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}```
LIVE is always set to 0
i want to store state of a tournament (points,eliminations etc..)
using sql cuz i want to also use a discord bot and maybe also a website later
have you tried it?
yes
also not closing statements causes memory leaks
Is ACF considered "lightweight"?
and did it work?
no for some reason
and now am looking for what the issue is
is there even a match?
wdym
does the WHERE finds something?
PreparedStatement ps;
try {
ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS " + tableName +
"(STATE VARCHAR(100),LIVE INT(100));");
PreparedStatement ps1 = plugin.SQL.getConnection().prepareStatement("INSERT IGNORE INFO" + tableName + " (LIVE) VALUES(?);");
ps1.setInt(1, 0);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}```
i have this on onEnable so am guessing yes ?
tbh am not sure
It won't throw an error if it already exists I think
so how i can make tabcompleter?
bad design lol if you dont want to check
override TabCompletor#onTabComplete basically
-.-
so let your command class implement TabCompletor first
and for setTabSomething
can you please explain to me
hi how do i send i message on the player screen?
im not ignoring sql exceptions because im holding a cache, i check the cache first before doing anything
might not work in your case but ye
hm....
looks complicated but the whole tabcomplete is based on one method: StringUtils.copyPartialMatches
first arg is the last arg that the user enters so if the args.length == 2 then it will be args[1]
i removed IGNORE INFO but it still wouldnt work
second is an iterable, the options to have printed
i dunno
third is in my case always new ArrayList<>()
(the output)
is it working?
any idea why https://gyazo.com/c5ef157a884fed46b4d8beff7907b87b is red in colour
because it hasnt been pushed to github i guess
It hasn't been added to git so it's red
why dont you just use the tabcomplete method of bukkit
and that is?
git
yes lol
TabCompleter or TabExecutor 🤔
CommandBase dont
for what
the less accesible methods the better
ok i did it with git but it still is red
did you push it?
heres my full class , for some reason getStateString returns the initial state value when i restart server
and i cant find the issue on the sql code
smh i still dont understand the difference between execute and executeupdate
I mean
what are you expecting this to return? if (results.next())
its just api for different type of operations you might do fourteen brush
i always forget which ones
value of STATE
its invalid after the last row
what
i dont understand
If there were no more records, next() returns false, and you can no longer. Once the next() method has returned false, you should not call it anymore. Doing so may result in an exception.
if it finds the value on the table then it should return the value , or else it should return the default value which i set in the start of the class
no, next does not work that way
i meant that if value.next is true then it gets the value and returns it or else it sets the value to the default value
thats what i meant to say
no, the first part is right, the last part is not how it behaves
am talking about this part
try {
PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("SELECT * FROM " + tableName + " WHERE LIVE=?;");
ps.setInt(1, 0);
ResultSet results = ps.executeQuery();
if (results.next()) {
state = results.getString("STATE");
} else {
PreparedStatement ps1 = plugin.SQL.getConnection().prepareStatement("INSERT " + tableName + " (STATE,LIVE) VALUES(?,?);");
ps1.setString(1, state);
ps1.setInt(1, 0);
}
} catch (SQLException e) {
e.printStackTrace();
}
return state;
}```
it is one of the quirks with iterating in sql
then what should i try to do ?
please work with try with resources
test to make sure you are not at the end and deal with it
wdym
because statements needs to be closed
Go on
Can someone verify if compiling this plugin is just not working on servers https://github.com/NFT-Worlds/wrld-commands-plugin
was kind of wonky english in that sentence
oh yeah i did what you say and i added this at the end of every try catch
try {
assert ps != null;
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
} ```
idk if this is what you meat
if you do a try with resources which looks like this, the statement will be closed automoatically
try (PreparedStatement ps = connection.prepareStatement(sql)) {
// do stuff
} catch ...```
finally block goes brr
I've tried compiling it and got a few different problems including wrong version etc.
asserting that the statement != null isnt good either
man
if someone can get it working I'll paypal u $10
||fuck sql||
That's their fault, they're using Java 17 on Spigot 1.17.1.
lol
Is there a way to get the title of an inventory via Inventory class ?
this is for paper btw
Change the version in the pom.xml to 16 and it should work fine.
Doesn't matter, Minecraft 1.17.1 doesn't work on Java 17 lol
and yes I tried that
i wanna get inventory title from the event InventoryMoveItemEvent
isnt there a getInventory or getView method?
i already have the inventory
but there is any method which return title
Inventory::getTitle doesn't exist
and for the view, this event not return view
Because there are two inventories
https://www.spigotmc.org/threads/getting-the-title-of-a-inventory.425295/ pre and post 1.15 thread on title
Seems to be working for me.
on a server?
that doesn't help me
dm me jar file
look the event is use
if it works ill paypal u
which version are you trying to target?
this is not a version problem
man i dont even know where to start
Player#getOpenInventory#getTopInventory
@tribal holly
well pre-1.15 has getView and post does not
i looked trough all the code until i found the issue is somewhere in the sql syntaxes
and rewatched the tuts i made that from
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryMoveItemEvent.html i give you ten bucks if you fid a get view here
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
||sql is dumb||
@tribal holly
yep it return an inventory as e.getSource and so ? how do you get title ?
getInventory().getName() e.getInventory().getType().name()
My bad, try getTitle() directly on getOpenInventory()
you just need to write out how you expect it would behave and then match that
you already have the common running state, its just a special case you hit initially
hmmmmm maybe it will make 10 times i repeat this
did you see what the issue is ? like do you know what it could be ? (you dont gotta tell me i just wanna know lol)
::getName() don't exist
i'm not on 1.8
in getDestination no it doesnt
Try this
in SQL the actions happen after the call
Repost your code, I'll look into it
if(event.getDestination().getHolder() instanceof Player player) {
String title = player.getOpenInventory().getTitle();
}
thanks Dessie
hnmmmm
so you call next and it should return false, however if you were already at the end, it will return garbage and likely evaluate as true
the same will happen if the rows are empty - table is empty
this is also where it should give you the exception and be handled as fr3qu3ncy said
next returns false when theres nothing on the table right ?
i would not count on that. it would depend on java in this case
In my head I would think it should - but only on the first time it is called
however, it would be more prudent to test if there is a first row
you already do it mostly, however you are depending on next() to be false to do the insert
how to do that
package me.emerald.mphone;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class Mphone extends JavaPlugin implements Listener{
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("Starting plugin...");
}
@EventHandler
public void event(BlockBreakEvent event){
Block block = event.getBlock();
Player player = event.getPlayer();
player.getWorld().spawnEntity(block.getLocation(), EntityType.CREEPER);
}
}
Would this work?
When testing, it doesnt seem to
Have I made a mistake or smth?
register the event
You have to register the event in order for it to work. Bukkit.getPluginManager().registerEvents(Class<? extends JavaPlugin>, Class<? extends Listener>);
Where would I place that?
Near the top or..
Also, would I replace class as what
Inside your onEnable
FourteenBrush, twice '
this' as parameter
Confused
wdym 'this'
im new to java im sorry lol
?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.
this refers to the current instance.
public final class Mphone extends JavaPlugin implements Listener{
@Override
public void onEnable() {
// Plugin startup logic
Bukkit.getPluginManager().registerEvents(Mphone extends JavaPlugin, Class extends Listener);
System.out.println("Starting plugin...");
}
So like that?
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.
^. Essentially, you must insert two parameters: the first must extend JavaPlugin, and the second must be Listener.
Because your Mphone class extends both, the parameters might be 'this.' as DessieYT suggested, they refer to the current instance.
....registerEvents(this, this)
can you get a field even if it is in the superclass of an object?
i'm trying to get the knowncommands with reflections map but it's throwing an exception
wdym if it's in the super class
Like accessing a super field from an extending class?
if its not private you can
OH WAIT I SEE WHAT YOU MEAN
getServer().getPluginManager().registerEvents(this, this);
knowncommands is declared in SimpleCommandMap
yes like that
yes but learn java
Falling block collision detection
basically it says the field doesn't exist
is that a protected field
it's minecraft's command map
It's protected
i am using FieldUtils from apache and i am using this code
hold on
You should just be able to do this.knownCommands from an extending class.
try {
this.bukkitCommandMap = (CommandMap) FieldUtils.readDeclaredField(Bukkit.getServer(), "commandMap", true);
this.knownCommands = (Map<String, Command>) FieldUtils.readDeclaredField(bukkitCommandMap, "knownCommands", true);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
the commandmap i can get just fine
You don't need to use reflection though
I am very confused on what you're trying to do lol
i don't want to deal with the bs package names
injecting commands in the command map
.
this.knownCommands#put()??
You already have access to the field if you're extending SimpleCommandMap
oh
the issue is the 3rd line here throwing an exception
saying it can't get the field
but whats this then
what is this for
this is a class from the spigot jar
commandMap doesn't exist in SimpleCommandMap
it's the one that the second reflection gets
it is declared in the superclass
that's why i asked if you could get super fields
Mhm and where do you see a commandMap field 
its getting it from Bukkit.getServer()
not commandMap
knowncommands i said
Ohh oh
what exception is it throwing
this is the method from apache
and it's basically failing to get the field
it throws the second exception here
the cannot locate declared field...
Send the exception
java.lang.IllegalArgumentException: Cannot locate declared field org.bukkit.craftbukkit.v1_18_R1.command.CraftCommandMap.knownCommands
do you want the whole stacktrace
is there just a getField one
CraftCommandMap != SimpleCommandMap
or i mean readField
dude craftcommandmap extends simplecommandmap
erm wait hang on
is it possible to set durability for an item that can't take damage?
no you need to manage it on your own
is there a FieldUtils.readField(...)
In what version
without declared
1.18.1
tho i've often used these reflection methods and they worked fine
Then no
i dont know for sure but declared field sounds to me like a field declared in the class
oh now i get the difference
itself
makes sense lemme try
try using that
and now i actually know whats the difference lmao thought they were the same
i'm on https://papermc.io/downloads, does anyone know where i can download paper 1.18.1?
you find it?
why do you need 1.18.1 specifically and why don't you ask on papermc's discord
Is there a way to have the build tools build both craftbukkit and spigot?
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
if (command.getName().equalsIgnoreCase("challenge")){
if(sender instanceof Player){
Player p = (Player) sender;
if(damageEvent == true) {
damageEvent = false;
p.sendMessage(ChatColor.RED + "Challenge has stopped.");
}else{
damageEvent = true;
p.sendMessage(ChatColor.RED + "Challenge has began!");
}
}
}
return true;
}
Why doesnt this work? Im 99% sure I typed this correctly.
simply parse: ResultSet result = statement.executeQuery(sql) and determine if it has a result
im not on paper discord and i thought this place is ok, and also i need 1.18.1 cause no one uses 1.18.2 yet
Because as it is right now, it just deletes and clears the entire directory, including previously built artifacts
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
But I need both spigot and craftbukkit in my enviroment
--compile-craftbukkit iirc
Yes, but that only builds craftbukkit
And on rerunning to build spigot, it deletes everything and clears the directory
You have to register commands?
Hold on lettme try that
turns out that isnt what I had to do
had to place this in yml file
commands:
challenge:
description: Starts the server challenge.
usage: /<command>
Speaking of, how would i create an array and set it as a variable, like so:
{"Object": 5}
I think thats how it works here idk
/<command> will just print /<command>
Do --compile craftbukkit,spigot
Just worked for me lol
?learnjava pls
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.
hehe
ah, cool
is there a performant way to replace certain types of blocks on chunk generation?
isnt it better to do that on world creation?
Last question I swear lol:
How do I get the name of a block broken?
getType().name()
20,000% lol
...
im having problems running buildtools with
"C:\Program Files\Java\jdk-17.0.1\bin\java.exe" -jar BuildTools.jar --rev latest
it throws an IOException right after starting the clone of Bukkit:
Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file Bukkit\._LICENCE.txt17408649439070871510.tmp to Bukkit\LICENCE.txt
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:215)
at org.spigotmc.builder.Builder.clone(Builder.java:1051)
at org.spigotmc.builder.Builder.main(Builder.java:327)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: java.io.IOException: Could not rename file Bukkit\._LICENCE.txt17408649439070871510.tmp to Bukkit\LICENCE.txt
at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1516)
at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:563)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:467)
at org.eclipse.jgit.api.CloneCommand.checkout(CloneCommand.java:385)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:212)
... 3 more
Caused by: java.io.IOException: Could not rename file C:\Users\atomf\Desktop\code\.other\Bukkit\._LICENCE.txt17408649439070871510.tmp to C:\Users\atomf\Desktop\code\.other\Bukkit\LICENCE.txt
at org.eclipse.jgit.util.FileUtils.rename(FileUtils.java:323)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1514)
... 7 more
oh wait wtf now it passes
at least for now
this wont account for partial stacks tho
i'm usin a non stackable item anyway
looks like it was a git-eclipse problem perhaps they disagreed on the state of teh repo
so for an accurate check probs gonna need to loop over the content
public static boolean inventoryFits(Inventory inv, ItemStack item) {
int amt = item.getAmount();
for (ItemStack stack : inv.getContents()) {
if (stack.isSimalar(item) && stack.getAmount() + amt <= stack.getType().getMaxStackSize())
return true;
}
return false;
}
its a common function
i know
public enum InventoryFitsItem {
YES_IT_DOES_FIT_THE_ITEM,
NO
}
public static InventoryFitsItem doesInventoryFitTheSpecifiedItem(Inventory inventoryToCheckIfItFitsIn, ItemStack itemToCheckFor) {
int amountOfTheItemToCheckIfItFits = inventoryToCheckIfItFitsIn.getAmount();
for (ItemStack itemStackInInventory : inventoryToCheckIfItFitsIn.getContents()) {
if (itemStackInInventory.isSimalar(itemToCheckFor) && itemStackInInventory.getAmount() + amountOfTheItemToCheckIfItFits <= itemStackInInventory.getType().getMaxStackSize())
return InventoryFitsItem.YES_IT_DOES_FIT_THE_ITEM;
}
return InventoryFitsItem.NO;
}
``` @quaint mantle
i made it good
no
@quaint mantle ?
Map<String, Number> cases = new HashMap<>();
cases.Entry<"OBSIDIAN", 10.0>;
like so?
please learn java
noisy variable names .-.
?learnjava pleasepleaseplease
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.
💀
var name take more bits than the entire method
hey
guys i need a plugin like when player dies, there wont be a respawn screen till someone comes and heals him. Do you know a similar plugin?
how do i color an item? (leather horse armor)
bro
use texturepacks
what do i do to stop server screaming at me for modifying blocks async
i know what im doing
i am... how does that matter tho
yes, for milions of blocks gl
you wanted to color it right?
wont be a problem if you do it right
yes, it has a model with a colorable layer
then use a texture pack or to be exact, make your own
except it is
but it's a leather horse armor, i can color it with hex
I am?
yeah
Its cause im asking for help.
its really not a problem
i generated 27 million blocks with methods in the link above without any lagg
how do i use that
@quaint mantle So, I did research, but IntelJ or whatever its called says its not correct.. Any idea why?
HashMap<String, Integer> tableBlocks = new HashMap<>();
tableBlocks.put("OBSIDIAN", 10.0);
tableBlocks.put("QUARTZ_ORE", 7.0);
tableBlocks.put("EMERALD_ORE", 7.0);
tableBlocks.put("DIAMOND_ORE", 7.0);
tableBlocks.put("LAPIS_ORE", 5.0);
tableBlocks.put("REDSTONE_ORE", 5.0);
tableBlocks.put("GOLD_ORE", 5.0);
tableBlocks.put("IRON_ORE", 3.0);
tableBlocks.put("COAL_ORE", 3.0);
you are using Doubles
when the 2nd parameter is Integer
remove the .0s
Yea but, I want to create a table/map like so:
{"ORE": 5.0}
yes
it states .put doesnt exist
just change Integer to Double
ok
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.
Java isn't Javascript
"Cannot resolve symbol "put"
did you import the hash map
import java.util.HashMap;
yep
1.18 would suffice iirc
^^
anyone? (also i mean with hex)
i dunno how to use that
i just had to move it lol, also, why is hashmap.get requiring a bool
isnt the .get functionality for finding an object in a hashmap?
wait so i am doing it correct or
How do I get the GameProfile from a NPC? (EntityPlayer)
so it does
still don't know how to use it
declaration: package: org.bukkit.inventory.meta, interface: LeatherArmorMeta
it doesn't include leather horse armor
Docs might be outdated try it
guess what? i still do not know how
1.14 so not really
Docs outdated? What.
They're automatically being updated
They're automatically being generated from the actual API. Nothing on the Javadocs page is being manually done
and that will still function like normal meta and add the color thing?
Javadoc comments are not auto generated
eh i'll just use text components
@quaint mantle you do know that colored horse armor is deprecated right?
it was suppost to be a feature but to my knowledge, was never implimented
so colored horse armor isnt existant
but its value still exists for some reason
It's not
It really is lol
Have you ever seen colored horse armor?
Without a texture pack
what since when did that exist
pics or didnt happen :D
1.14
sus
Thats on bedrock lol
Ik it exists on bedrock, not java
Remember both are VERY different
My guy just open the game
Im on my laptop lmao
how do you color the armor ?
^
I refuse to believe that
and how was that working ? xD
There is no way that exists
^
It does just accept it ;/
Send a video
I refuse to
wtf
just wtf
lol
How do I get the GameProfile from a NPC? (EntityPlayer)
i litterly never saw that
what version ? mostly it will be an methodd called a,b,c...
1.18.1
if not remapped you should try to find the method for "GameProfile"
Not remapped. I'll try findining it
Why is everyone making their own NPCs
Because Citizens can't do everything
It can
cool to have that knowledge ... mostly easier to do advanced custom stuff
Id rather make it myself then work it out with citizens api
It will be 10x faster and documented with Citizens
Sure, But I wanna experience it how you actually do it
When working with NMS you're going to be mostly on your own
did you contribute to api with PR's ?
i am still waiting for ENUM-Change to make another change based on that to the WorldCreator but many stuff has to be discussed to implement it the best way
enum change?
to check if the obj you want to add is the same ?
no, i need a class type for my config serializer
it can be
like normally the type passed gets erased
but for instance
class SpecialList extends AbstractList<Server> implements List<Server> {
}
i assume it's still carried somewhere
yeah
which is for instance what gson uses for serializing collections
the decompiles know the types too which by that point there shouldn't be any info
private Class<T> persistentClass; public Constructor() { this.persistentClass = (Class<T>) ((ParameterizedType) getClass() .getGenericSuperclass()).getActualTypeArguments()[0]; } hmm
what a difficult way to get a list of the classes you need
🥲
@quaint mantle Whats the difference between p.SendMessage
and getServer().SendPluginMessage
sendPluginMessage does something completely else from what you probably think
I want to send a global message
in the server
to all the player
^
Sorry
tho it requires a broadcast permission for each receiver
I think I'm gonna wrap a collection to add the type on top
wait so, is there a workaround?
like getAllPlayers() and 1 by 1 send it
or smth
^^^
Thats what I was thinking
but How would I grab every player?
isnt that optional
myes, if you just wanna send to every player Bukkit.getOnlinePlayers().forEach(sender -> sender.sendMessage("message")); in principle
idk epicgodmc
pretty sure theres 2 serperate methods
int broadcastMessage(@NotNull
String message)
Broadcast a message to all players.
This is the same as calling broadcast(java.lang.String, java.lang.String) to BROADCAST_CHANNEL_USERS
states pretty obvious here that it uses the BROADTCAST_CHANNEL_USERS permission
ah
so something like this would work?
public void sendGlobalmessage(String msg) {
Bukkit.getOnlinePlayers().forEach(sender -> sender.sendMessage(msg));
}
myes
oh ty
Already done
sendGlobalMessage(ChatColor.RED + "Challenge has began!");
Works perfectly
?
something wrong..?
I mean doesn't matter really but yeah a bit more succinct, in return a bit slower
yeah, was just clarifying pros and cons as it might not be trivial to them
@quaint mantle hey friendo
Support hex color >:)
we was talking about node system how i can make it?
is already supported by ChatColor::translateAlternateColorCodes tho
Not quite
Unless that's new with 1.18
@ivory sleethello too my friendo
its been supported with aforementioned method since hex arrived
Everything I saw requires chatcolor.of from md5s api
yes which is what you should use
bungee chat api has been around since 1.8 and even earlier
helo :]
I'm aware I thought you meant you only need to do the one liner
Which wasn't working in my tests so what am I doing wrong
&x&F&F&F&F&F&F would provide white
Oh lord
yeah
Nvm I'm keeping the way I have it lol
#FFFFFF > whatever that was
yeah
Hey fellers, would anyone know how to center items in a chest recursively with just an input of 1 to 9 items?
I use minimessage myself but having a format like that is also nice
What is minimessage
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
and yes its incredibly fast
I've never used text components Idk what they were even
ah fair, well just a more object oriented way of dealing with string and display data
Its just great
im too stupid for understand that xd
I use it for item names

or im stupid or you dont know how to explain
there are 2 option
he is a op mega master
he understand all its too op
Someone who has got a good documentation for working with teams (f.ex. for a duel plugin) ?
Ping me in ur answer please ty
microsoft teams?
https://www.spigotmc.org/resources/duels.20171/ like that one?
@undone axle
