#help-archived
1 messages · Page 213 of 1
ill try
@subtle bison thanks changing the api version makes it work
glad i could help
didnt work
Tells spigot what version your plugin is meant for
it basically gets which minecraft version of blocks, items etc is gonna be used
In this case it tells spigot to use the new Materials rather than the legacy ones
ahh i see
@blazing burrow it tells spigot what minecraft version youre using. If youre using blocks from 1.13 than spigot wont know what they are unless you specify your version
yeah
public NPC(Location location, String name, String skinURL) {
this.location = location;
this.name = name;
final MinecraftServer server = ((CraftServer)Bukkit.getServer()).getServer();
final WorldServer world = ((CraftWorld)Bukkit.getWorld(location.getWorld().getName())).getHandle();
final GameProfile gameProfile = new GameProfile(UUID.randomUUID(), name);
final String[] skin = getSkin(skinURL);
System.out.println("VALUE:");
System.out.println(skin[0]);
System.out.println("SIGNATURE:");
System.out.println(skin[1]);
gameProfile.getProperties().put("textures", new Property("textures", skin[0], skin[1]));
entityPlayer = new EntityPlayer(server, world, gameProfile, new PlayerInteractManager(world));
entityPlayer.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
addNPCPacket();
}
Assuming that my value and signature are correct, what is my error? (The NPC's appear as Steves/Alexes). Or are my value and signature wrong?
Legacy I gusss
you need to specify api version if you wanna use legacy
1.12 and below don’t have an api-version
yeah he is right
okay thanks
anyone has any idea about my problem?
@blazing burrow if you are working with items and its not working i recommend adding api version
mhm i see
also it will tell you that you need to specify api-version in your console
so checking console is just a good way
You should set it to match the version you are developing for
LMAO
okay so its better to do api 1.16 since im doing 1.16
Yes
also api versions are always only first releases of the mc version
like 1.13, 1.14, 1.15, 1.16
never 1.16.1
atleast i dont think
oh okay thanks
@dusky sigil try to ask some better coders than me here bcs im not really experienced with configs
new to bukkit too
Why is so hard to get a premium plugin verified lol
the more you want something, the greater the resistance
yeh, as soon as you don't care, it falls into order in the universe
I want to provide a great plugin with full support and updates every week for a fee of $10.50
oh dear.
If it's a common plugin or a plugin that already exists they won't accept it.
another capitalist
need to realize that money flows to you when you aren't trying so hard
It's a plugin that exists but with a lot more features
the more you try to chase it, the harder it is
better to invest your energy in good karma
I ain't trying to chase the money
oh, so it's the pride?
Yeah and to support people
well, then open source
More features does not always mean good
what even is the plugin
better be good
if it's a plugin not worth being premium, they will also not accept it.
For example, if anyone could code it.
Hi there, if I try to change the skin of an NPC to a certain value and signature and
gameProfile.getProperties().put("textures", new Property("textures", value, signature));
doesn't work, does that mean my value and signature are wrong?
I think mine was in a weekend.
but they know me
then they convinced me to give it away for free
well, that's the story i'm stickin with
I just have 1 premium. I don't think I'll do any more premium resources, I expected more downloads tbh
yeh, asking minecrafters for money, its like blood from a turnip
I mean I get some premium resources, but some of them should definitely not be premium. If you want money go to a server a code for them or look at people hiring devs on the forums.
I'm making this ```
A Plugin with 2 systems
System 1:
Guild
Rewards
Bank
Unlockables
Levels
XP
Privacy
Player Limit
Fully Configurable
System 2:
Party
Mini-Challanges
Player Limit
Levels
Unlockables
Rewards
Points
they can disable party or guilds or have them both on```
I just use Parties
yawn.
hey kludge 😊
sup
great job on your auctionhouse plugin!
oh noes, they are chasing me
😏
must find a rock to hide under
I think I don't get downloads because I don't like making GUIs
yes GUIs very important
yo do y'all use the spigot api for public use, but the paper one for private use?
you guys should learn to type cuz guis are a PAIN
yo do y'all use the spigot api for public use, but the paper one for private use?
@frigid ember I always use spigot
Paper API doesn't offer many things tbh
oh shoot, are we not allowed to talk about paper here
i mean ehh, it has a couple useful methods
correct, the first part
I always end up using NMS so I don't really need extra methods
Bro if 5yo pays me I can code whatever they needs
5 year old as in 1.8.8
ppl really like 1.18.8
oh, 1.18.8, a premonition of sorts...
Although I prefer to use 1.12.2 when possible
oof, thought i was on the general channel...
Help is general when no one needs help
ok, in all seriousness, either someone ask for help or go to the general channel
actually, some of us don't have to ask
you can scroll up to my question
i have this config: ```yml
factions: ''
players:
- dfac08af-af88-42ff-8509-8f441bca858b
factionnames: - test
faction:
test:
leader: dfac08af-af88-42ff-8509-8f441bca858b
Members: 1
MemberNames:- dfac08af-af88-42ff-8509-8f441bca858b
and im doing this:```
cfgtotal.set("faction." + factionname, null);
i looked it up and it SHOULD delete all of the test: making the config look like this:```yml
factions: ''
players:
- dfac08af-af88-42ff-8509-8f441bca858b
factionnames: - test
faction:
and it doesnt work!
factionname should be correct..
i need a keyboard macro to type something then backspace over and over
are you saving it correctly after editing the file?
cfgtotal is a config file that - get this, EXISTS
also
SQL is pain i cant get it
its NOT
an arraylist
i even tried deleting it that way
private void saveData() {
for (Map.Entry<UUID, List<Data>> map : dataMap.entrySet()) {
getConfig().set("deathlocation." + map.getKey(), map.getValue());
}
saveConfig();
}```
Would this be a good option to save my hashmap since it exists of uuid, data
and data has 3 values
SQL is easy to learn and it's free so I really don't get what you mean by that. Meh, I never save anything in a yml file anymore besides NPC locations.
why are you trying to save a hashmap?
yes
@dusky sigil give me a sec looking on the forums for a solution, I don't really use yml files.
would need to see your config code
cfgtotal is FileConfiguration?
yeah
ohh to someone else
if you get the ConfigurationSection for faction then try to set "test" to null what happens?
why are you trying to save a hashmap?
@balmy sentinel save&load onrestart
otherwise the data will be lost?
@dusky sigil see if this thread helps, it's similar to what you're doing, but maybe you missed something https://www.spigotmc.org/threads/delete-configuration-section.131046/
saw that
rippp
If you want to save the data why are you storing it in a hashmap in the first place? If you really want to persist over restart use a yml file or a database @frigid ember
yes
.yml file
thats what I said didnt I?
but is this way of saving that value a good option?
yes, but my point is if you're trying to save it why are you putting it into a hasmap in the first place just put it in a yml file as soon as you get the info
would I then be able to access the info and delete it at certain moments?
ConfigurationSection cs = cfgtotal.getConfigurationSection("faction");
if (cs.contains(factionname) cs.set(factionname, null);
}```
set might not like the path
Whenever you get the data you need/want to save, save it. When you need to access that data, check if it exists in the yml file. If it exists, great, access it. If it doesn't exists do whatever you want.
but a .yml file on updates after reload/restart
don't forget to plugin.saveConfig() afterwards.
doesnt it?
ConfigurationSection cs = cfgtotal.getConfigurationSection("faction");
if (cs.contains(factionname)) {
cs.set(factionname, null);
}
}```
nvm I can keep saveConfig();
so like this?
but I always did it this way :p
I don't use a path for the set in ConfigurationSection methods
Frogsoup
yes?
to get the data again and put it in the hashmap again?
private void loadData() {
if (getConfig().getConfigurationSection("deathlocation") != null) {
for (String times : getConfig().getConfigurationSection("deathlocation").getKeys(true)) {
}
}
}```
?
and than put the info in
at the
I'm not really the person you should be asking about yml files. I prefer, and always use, databases as I find them far more efficient and useful for storing persistent data (especially if you want to store a lot of information).
@dusky sigil to answer you question in SQL all you would've had to do is DELETE FROM table WHERE field="factionName";
it's way easier than dealing with yml files imo. I would only use yml files for storing a small amount of data like the location of NPCs, maybe spawnpoints, etc.
found a 4 hours 20 mins (nice) vid on youtube. time to start the grind.
worth it imo. I had a whole semesters worth of SQL and I loved it.
_ _
is there a way to check if a player presses jump button?
or if they press it while in air?
Listen for PlayerMoveEvent and check if the Y increases
yeah but while they are already in air and moving?
Your search engine is your friend. a) https://www.spigotmc.org/threads/playerjumpevent.190738/ b) https://www.spigotmc.org/threads/how-verify-player-jump.119673/#post-1276537
yo how would I go around displaying the plugins list alphabetically?
on my 1.16 server they arent listed alphabetically
https://www.spigotmc.org/resources/✈️vehicles-no-resourcepacks-needed.12446/
So, this plugin has a feature where you can fire out of the tanks and helicopters. I have added the permissions to the default rank of my server but it hasnt worked. Can I have a helping hand please?
Depends
?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.
So, I'm working on a project that in addition to using Spigot Plugins for commands, uses Scoreboards to save data.
The thing is, I need help checking if a Player has a certain scoreboard tag, as well as adding or removing it.
These are my current lines of code that try to do this, but don't work:
// Add a tag to a player
player.getScoreboard().getEntries().add("BuildMode");
// Remove a tag from a player
player.getScoreboard().getEntries().remove("BuildMode");
// Check if the player has a tag
if (player.getScoreboard().getEntries().contains("BuildMode")) {
}```
Why not just use Persistent Data Containers
I ended up deciding to add plugin functionality AFTER building save data on a scoreboard.
And this is a private plugin, by the way.
o
I'm working on a project where I have to send a message in a 2-3 different classes. Would it be smart to create one class and have public static voids that send a player the message? i.e. player.sendMessage(Messages.promoted);
btw, it's Player#getScoreboardTags
Thank you!
👍
@fleet crane is your name based off the md5 checksum command for linux?
hello i need help in DeluxeHub (:
could anyone give me any advice on how to add something to a hashmap when a command is ran and then in an EventHandler check if that thing is in the hashmap and if yes do something and if no nothing will happen, by running the same command again it will remove the thing from the hashmap
its essentially a toggle command for eventhandler
i cant seem to get it working
You store it in main or a managrr then grab a instance of it
my code:
inside the class:
HashMap<String, Boolean> isBabyOn;
String babyToggle = "toggle";
when the command is ran:
isBabyOn.put(babyToggle, false); <--- i get an error here
inside the eventhandler:
if (isBabyOn.get(babyToggle) == Boolean.TRUE)
Why Boolean.TRUE lmao
No
):
Go to deluxeHub discord
yeah i realised the Boolean.TRUE wasnt the problem
so how to fix that tho
any hint
no need to replace it with true
Baby.onCommand(Baby.java:60) ~[?:?]
isBabyOn.put(babyToggle, false);
just remove it completely
Alright so I've used the InventoryClickEvent with the getMatrix method to simulate a crafting recipe. It has to be simulated as the output it different each time. So, I've used CraftingInventory#setResult to set the result. Everything works, although when it sets the result the result doesn't actually show, but I can click it and it will be there in my cursor as if it were there the entire time. How do I make it show in the result slot? CraftingInventory#setItem(0, ItemStack) didn't work.
if you have a map of booleans, unless you need a tri-state
use a set instead
set contains key = true, set doesn't contain key = false
diddling with a map just risks nulls
on it
The hashmap should be UUID and boolean
should be a uuid set
whats the haste url
unless it needs to be a tristate
wait how to do the code style on discord?
how can i use a loot table to generate an item?
do you need the boolean to be able to be null or not?
or do you only need true and false?
whoever is diddling with the map that has booleans in it
a simple question
?haste
do you need it to be null or not
?paste
@subtle bison
i only need true or false
will a set work
yes. that's why i'm telling you to use a set
a set is effectively a boolean map, but can't hold nulls
oh yeah thats sounds smart
but i need to initialise that too right
okay
but i dont get where
because if i do it in the onCommand its gonna be the same everytime
players flying around with elytra breaks the server performance (down to 3 tps)
any workaround for this other than banning elytra?
in the constructor of the class?
how can i set an item's name and not have it be in italic?
@proud furnace kinda works but it always thinks that isBabyOn = false since i initialised it that way in my constructor
yo why isnt this working
String servertotal = PlaceholderAPI.setPlaceholders(p, "%server_max_players%");
Does anyone know of a plugin that allows you to give temporary ranks (or permissions), and also execute commands when the rank starts or expires?
That has temporary ranks sure, no clue about the other thing
Luck perms Does the Temp Ranks / perms
Not sure about
execute commands when the rank starts or expires
@proud furnace https://paste.md-5.net/jidurasoso.java
yeah
no errors
Syntax error, insert "VariableDeclarators" to complete LocalVariableDeclaration
yeah i am getting the messages
i want there to be a toggle arg
ofc
of course
no but the thing is that if i dont check if the boolean is true or no it works fine without toggling
so i dont think thats the problem
i have tried it yet, working on it
and no im getting a different message every time
it swaps between on and off
yeah but the listener doesnt know that the boolean was changed i dont think
um
work perfectly now
u were right
tysm ily
Hello. Can anyone help me with this? Its a problem when I am stopping the server while I am in a staff mode. https://sourceb.in/1cdd2a2937 The problem is that its clearing my normal inventory
shouldve listened to you
if(ModModeManager.getInstance().isInModMode(p)){
p.getInventory().clear();
p.performCommand("mod");
}```
It says that it clears your inventory
If that's the problem, then remove that line
What do you mean mod inventory?
It have sepperate inventorys
thats my /mod command
it sepperates my inventory so I got one normal inventory and a mod inventory
All that line is doing is clearing everything you have in your current inventory, to Spigot you only have one, and that would be whatever you see when you press the button to open it
So if you can set your inventory back to the normal inventory, then clear it
That would work
As far as I know
it didn't work when i deleted the /clear now it made the mod inventory to the normal inventory
Does PotionEffectType#getId still work even if it's deprecated?
so it just replaced everything
i just got no idea what magic value means lmfao
@soft fable what are you trying to accomplish?
The problem is that its clearing my normal inventory
The problem is that its clearing my normal inventory
It clears my mod inventory
so which one
oh
That’s supposed to happen when you execute “player.getInventory().clear;” It clears everything in the players inventory?
ItzVipe says there are multiple inventories, one for normal, and one for mod
I am using an method to save inventory and load inventory
So all you would need to do is clear the correct one
So which one do you want to clear?
Does anyone have experience installing mysql on linux?
I am getting dependencies not found errors
To clear your mod inventory, just load in your mod inventory, then call player.getInventory().clear;
k
All spigot knows is that your inventory is what you see in your hotbar, and what you see when you open your inventory, it doesn't care about what you did to load or save
So to clear your mod inventory, make sure it is loaded, then set it to nothing, and save it
(And if you were previously in your normal inventory, then of course go back to normal inventory)
Anyway, I'll be afk for a while
yo how do you make this command work through console?
public class ListCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
OfflinePlayer p = (Player) sender;
String serveronline = PlaceholderAPI.setPlaceholders(p, "%server_online%");
String servertotal = PlaceholderAPI.setPlaceholders(p, "%server_max_players%");
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&eThere are currently &8(&6" + serveronline + "&8/&6" + servertotal + "&8)" + " &eplayers online on &6&lTheCrib&e."));
return false;
}
}
You’re casting the sender to a player that’s why it isn’t working. You should also do a check before casting to a player by checking if(sender instanceof Player).
But how would I make it work through console?
AH wait i deleted that
But how would I make it work through console?
You can't, you can only display in console random players, like you iterating over players or gets a random player from collection
Why do you need placeholders for that
Isn't there a bukkit.getMaxPlayers() and also bukkit.getOnlinePlayers().size()
just wanted to use placeholders 🤷♂️
makes no sense in console
Okay... here is the log again:
[08/01/2020 10:43:02 pm] [Server thread/INFO]: Perzan left the game[08/02/2020 03:52:08 am] [Server thread/INFO]: com.mojang.authlib.GameProfile@29c5ca6b[id=<null>,name=Skeppy,properties={},legacy=false] (/x.x.x.x:xxxxx) lost connection: Disconnected
Again, I am NOT Skeppy
I have no idea why his name appeared there
I’m not sure about Bukkit.getMaxPlayers(); but there is Bukkit.getOnlinePlayers().size();
Usually, "name" will say the username...
Probably because that player GameProfile is been modified/removed by something plugin, or you're running online/offline server and he/she connected via purchased/cracked client.
how do i remove a perms is it sumtin like -essentials.break idk
@frigid ember what permission plug-in are you using?
Bukkit.getPluginManager().removePermission
do /lp group <groupname> permission set essentials.break false
unset
or that
ok
Is there a way to track the worlds on a given spigot server or the whole bungee network?
What do you mean ?
As in: when a world gets added to the network, some event triggers, and when it gets deleted it triggers again?
Is there a way to have it hide the little "C418 - Cat" description sorta thing? Using custom item and don't want that to be tehre
@tiny pebble take a look at ItemFlags
What do you mean ?
@undone narwhal So basically I want to keep track of world-specific data for every world on the server. When the world gets deleted though, I'd like it to delete all the entries of data in the database that tracks it. When a new world gets created, it creates an entry in the database (that isn't so much the issue since I can just create the entry when I enter the first piece of data for that world...)
I know I can look up all the worlds on a server when it boots up and loads my plugin, that's not an issue.
What I don't know is if a world can get deleted while the server is running
and what to do with worlds that are on a different server in the bungee network.
Is there a way to have my plugin communicate with my plugin that's running on another server in the same bungee network?
Am I being stupid here?
I was recommended popSQL (not free anymore ): ) to use mySQL. does anyone have a free alternative?
So how would I go around making the plugin list alphabetical?
Plugin[] plugins = this.getServer().getPluginManager().getPlugins();
for (Plugin p : plugins) {
player.sendMessage(p.getName())
}
now you just gotta make it alphabetical
I'd suggest putting all of the plugin names into a arrayList and sorting.
and then join em' with commas
Plugin[] plugins = this.getServer().getPluginManager().getPlugins();
for (Plugin p : plugins) {
player.sendMessage(p.getName())
}
and use something like
Collections.sort(plugins, String.CASE_INSENSITIVE_ORDER);
to sort them i guess
its probably not but thats easy to create an arraylist and add them to it
by using the for loop
hold on
Just wait for Choco's PR 👀
It sends in json messages that shows description, version, etc. on hover
@frigid ember this is how you get the plugins into an ArrayList
ArrayList<String> pluginList = new ArrayList<String>( );
Plugin[] plugins = player.getServer().getPluginManager().getPlugins();
for (Plugin plugin : plugins) {
pluginList.add(plugin.getName());
}
Collections.sort(pluginList, String.CASE_INSENSITIVE_ORDER);
hmm
Coloring them shouldn't make any difference during the sorting right 🤔
KingAlter I have that already
o
@frigid ember this is how you get the plugins into an ArrayList
ArrayList<String> pluginList = new ArrayList<String>( );
Plugin[] plugins = player.getServer().getPluginManager().getPlugins();
for (Plugin plugin : plugins) {
pluginList.add(plugin.getName());
}
Collections.sort(pluginList, String.CASE_INSENSITIVE_ORDER);
@subtle bison sorry for the formatting btw
hmm let me see something hold on
@balmy sentinel I did but I'm not sure which it would be? Out of the six itemflags there are there isn't one that seems to disable a name unless it's considered an attribute. I'll try the attribute one though 😛
@tiny pebble turn them all off ;3
lmfao that's always a solution
it’s weird like if you want to hide the lore on the Banner Patterns (1.16 item) you need to turn of the potion effect item flag to hide it.
it’s weird and personally when I’m creating GUIs I don’t want anything showing anyways so I turn them all off
that's kinda whack
i want some things showing just not what the original item is since its a custom item
Arrays.asList(plugins)
like i have custom lore i wanna keep but i dont want people to know its secretly a CD 😮
Turning off the ItemFlags won’t remove a lore you set
ah sweet
how can i get the slot number of a specific item in an inventory?
basically the opposite of Inventory#getItem
If you listen on InventoryClickEvent there is event.getSlot()
ah im listening on CraftItemEvent
making it so when item A with item B, item A leaves another item behind, like crafting with a bucket
bucket of milk or something
no idea I’ve never messed with that event before. Your best bet is reading the docs or try the forums.
yeah i'll probably have to make my own method of some sort
@frigid ember still need it?
hmm?
ArrayList<String> pluginList = new ArrayList<String>( );
Plugin[] plugins = player.getServer().getPluginManager().getPlugins();
for (Plugin plugin : plugins) {
pluginList.add(plugin.getName());
}
Collections.sort(pluginList, String.CASE_INSENSITIVE_ORDER);
for (String pluginName : pluginList){
player.sendMessage(ChatColor.BLUE + pluginName);
}
wait can I dm you some code?
sure
ArrayList<String> pluginList = new ArrayList<String>( );
Plugin[] plugins = player.getServer().getPluginManager().getPlugins();
for (Plugin plugin : plugins) {
pluginList.add(plugin.getName());
}
Collections.sort(pluginList, String.CASE_INSENSITIVE_ORDER);
for (String pluginName : pluginList){
player.sendMessage(ChatColor.BLUE + pluginName);
}
@subtle bison btw anyone knows how to make it so that for each it will add the pluginName to 1 string?
Use StringBuilder
just use a StringJoiner
watch an example
yup
Player player = ...;
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
Arrays.stream(plugins).map(Plugin::getName).sort(String.CASE_INSENSITIVE_ORDER).forEach(plugin -> player.sendMessage(ChatColor.BLUE + plugin));
Don't you just want something like this tho
so much lambda 👀
stream 👀
lambda life
haha lol
i actually wanna understand them ^
I recommend SoloLearn
i saw them on a glance tho never looked into
feels bad how java knowledge doesn't always transfer
@jagged torrent well it gives the same output
I know xd
but i wanna put it into 1 string
to some degreee viper
you can do that too
how do you want to join them?
i have an example somewhere
@tiny dagger come into general if you want to do C discussion
ye
Is there a way to like... send an event? I have a simulated recipe and since it's simulated it doesn't really count as a recipe, therefore it doesn't send CraftItemEvent. How can I make it do that O.o
PluginManager#callEvent(Event)
Thank you!
anyone anything on the StringJoiner?
Player player = ...;
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
String formatted = Arrays.stream(plugins).map(Plugin::getName).sort(String.CASE_INSENSITIVE_ORDER).collect(() -> new StringJoiner(", ", "Plugins: ", ""), StringJoiner::add, StringJoiner::merge).toString();
player.sendMessage(formatted);
lambdas make life easy
probably time to learn it huh
classic java isn't bad either
true
Is there a significant benefit to lambdas other than making a lot of code use less code?
it is mostly visual
dont some lambdas refer to methods instead of creating anonymous classes?
like, methods made while compiling
wdym
a method called "lambda0" that i didnt code in can be seen with reflection sometimes
or lambda1
yes they are anonymous classes
thanks yall for teaching me StringJoiner lol kinda useful
how can i make a command that is able to be toggled?
so like /command yes it toggles on
/command no it toggles off
and when it's on, it does something every 2 seconds
to toggle on/off you just have to make a private boolean
register it
and then in your onCommand put yourBoolean = true / false
yeah make an array list and when you type command yes add something to it and when you type command no remove it
So make a website, host it, and then get the fields from the website saying weather or not it's enabled, and set it to your command, then when you want to use it, get the field again to see if it is enabled
nah an arraylist is worse
waitwait, wdym register the boolean?
Can someone check this? I get a ```
[18:18:53] [Server thread/WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bannedplayers WHERE UUID = 'fdd1a756-d7f0-4629-b72f-6bde5406a408' (UUID, BANN...' at line 1
```java
public static void createPlayer(Player p) {
PreparedStatement ps;
try {
UUID uuid = p.getUniqueId();
ps = connection.prepareStatement("SELECT * FROM bannedplayers WHERE UUID = ?");
ps.setString(1, uuid.toString());
ResultSet set = ps.executeQuery();
set.next();
if(!exists(p)) {
PreparedStatement ps2 = connection.prepareStatement("INSERT IGNORE INFO bannedplayers WHERE UUID = ? (UUID, BANNED, REASON) VALUES(?,?)");
ps2.setString(1, p.getUniqueId().toString());
ps2.setBoolean(2, false);
ps2.setInt(3, 0);
ps2.executeUpdate();
return;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
put it in your constructor @pale patio
public Baby(MainClass plugin) {
this.plugin = plugin;
yourBoolean = false;
}
oh
a better method
Instead of using a command
Just get the amount of entities in the world, and if it is an even number, then have it enable the command, if it isn't then disable it
not rn
hey guys,
i cant use the Port 8195 for Votifier. I entered at the ufw but i dont get a signal
anybody knows how to?
ArrayList<String> pluginList = new ArrayList<String>( );
Plugin[] plugins = player.getServer().getPluginManager().getPlugins();
for (Plugin plugin : plugins) {
pluginList.add(plugin.getName());
}
You can replace that with ArrayList<String> pluginList = Arrays.asList(bukkit.getPluginManager().getPlugins())
Can anyone help me?
oh yes, i do need some help @subtle bison
With?
how can i make it so that a snippet runs every 2 seconds?
yes
Can someone check this? I get a ```
[18:18:53] [Server thread/WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'bannedplayers WHERE UUID = 'fdd1a756-d7f0-4629-b72f-6bde5406a408' (UUID, BANN...' at line 1```java public static void createPlayer(Player p) {
PreparedStatement ps2 = connection.prepareStatement("INSERT IGNORE INFO bannedplayers WHERE UUID = ? (UUID, BANNED, REASON) VALUES(?,?)");
@umbral dirge What are you trying to insert?
Have you tried using
make a bukkit runnable with delay 40 ticks
BukkitScheduler?
Im inserting UUID, If he is banned, and the reason id
check if player instanceof Player
No, im going to make it false
INSERT IGNORE INFO shouldn't that be INTO
INSERT INTO bannedplayers(UUID, BANNED, REASON) VALUES (?, ?, ?)
omg
thank you guys
Yeah
it worked
ok
you don't need the (UUID, BANNED, REASON)
@tiny dagger But it helps when you have many tables and don't want to lookup the schema
@pale patio
new BukkitRunnable() {
@Override
public void run() {
// your code that will repeat ever 2 seconds
}
}.runTaskTimer(plugin, 0, 40); // 40 ticks == 2 seconds
yes but usually it's not needed
but what do i put at plugin?
yes but usually it's not needed
@tiny dagger Not needed, but doesn't harm anything
@pale patio if you are in your main class put this
An instance of your main class
ik for a fact that the more columns you have the more tedious is to read them
so i remove them
othervise yeah instance of it
oh god now i have another error when updting values
public static void banPlayer(Player p, int reason) {
try {
PreparedStatement ps = connection.prepareStatement("UPDATE bannedplayers SET BANNED = ? SET REASON = ? WHERE UUID = ?");
ps.setString(3, p.getUniqueId().toString());
ps.setBoolean(1, true);
ps.setInt(2, reason);
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
[18:30:24] [Server thread/WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET REASON = 1 WHERE UUID = 'e0f6e6e6-b818-45b0-94c1-99b1839ebdbb'' at line 1
oh
UPDATE bannedplayers SET BANNED = ?, REASON = ? WHERE UUID = ?
I recommend you to learn the sql syntax
oh
It will help you tremendously
Yeah its the first time working with it
A quick crash course will help you in the long run
and to stop the task?
You can use cancel() inside the runnable
Or make it a variable and then do variable.cancel();
wait how do you make a runnable a variable?
BukkitRunnable runnable = new BukkitRunnable
or use ids
The animation for the angel don't work.
make sure to close your SQL statements
best practice i think is to let the try close it for you
try (Closable cl = something.closableAndThrowable())
👀
e_e
that doesnt work
boolean hasBlock = false;
for (int x = 0; x <= bot.getSize().getLength(); x++) {
for (int z = 0; z <= bot.getSize().getWidth(); z++) {
for (int y = 0; y <= bot.getSize().getHeight(); y++) {
if (target.getRelative(z, y, z).getType() != Material.AIR) hasBlock = false;
}
}
}
is this how I check if a cubiod area with a certain size is empty?
wdym
well
thats what i what i think
you also need to go from negatibe something to positive something
why cant i upload pictures here
the circle thingy is the player
the square drawn is the block target
What would be the best method to run a task later by let's say a large amount of time like a Month? Would a bukkit runnable like RunTaskLater() Work just fine, or could there be potential problems with that?
bukkit runabble would cancel after a restart if i think correctly
kyrix you need to bind to your spigot account in order to upload stuff
BukkitRunnable runnable = new BukkitRunnable
@lone fog that doesnt work
it spews out error
s
i can't paste the image though
you need to verify
wdym
?paste
Incompatible types. Found: 'org.bukkit.scheduler.BukkitTask', required: 'org.bukkit.scheduler.BukkitRunnable'
done
guys, what would be the best way to find a plains biome on world loading? this seems like its very bad in performance
if (loc.getBlock().getBiome() != Biome.PLAINS) {
Main.getPlugin().getLogger().warning("Kein Biom gefunden. Suche erneut...");
searchBiome();
} else {
if (xPos.getBlock().getBiome() == Biome.PLAINS
&& xNeg.getBlock().getBiome() == Biome.PLAINS
&& zPos.getBlock().getBiome() == Biome.PLAINS
&& zNeg.getBlock().getBiome() == Biome.PLAINS) {
Main.getPlugin().getLogger().warning("Biom gefunden. Setze Spawnpoint und Border...");
world.setSpawnLocation(loc);
world.getWorldBorder().setCenter(loc);
world.getWorldBorder().setSize(500);
} else {
Main.getPlugin().getLogger().warning("Kein Biom gefunden. Suche erneut...");
searchBiome();
}
}
if (toggle) {
final BukkitTask runnable = new BukkitRunnable() {
@Override
public void run() {
Block targetBlock = player.getTargetBlock((Set<Material>) null, 10);
String readableBlock = targetBlock.getType().toString();
player.sendMessage(ChatColor.GOLD + "" + readableBlock);
}
}.runTaskTimer(this, 0, 20);
} else {
runnable.cancel();
player.sendMessage(ChatColor.RED + "Disabled");
}```
this is my code
error i'm getting is Cannot resolve symbol 'runnableSwaila'
if "runnableSwaila" exists, its probably not reachable
that means?
that means it doesn't want public to be there
If you want a bukkit task, why not use Bukkit.getScheduler().runTask
someone else told me to use the runnable
Idk man that code is weird
was applegod
just use a scheduler... doesnt matter i think
Seems like you need to learn java
yeah
Public can't be used inside a method
btw
viper
ehm
guys, what would be the best way to find a plains biome on world loading? this seems like its very bad in performance
if (loc.getBlock().getBiome() != Biome.PLAINS) { Main.getPlugin().getLogger().warning("Kein Biom gefunden. Suche erneut..."); searchBiome(); } else { if (xPos.getBlock().getBiome() == Biome.PLAINS && xNeg.getBlock().getBiome() == Biome.PLAINS && zPos.getBlock().getBiome() == Biome.PLAINS && zNeg.getBlock().getBiome() == Biome.PLAINS) { Main.getPlugin().getLogger().warning("Biom gefunden. Setze Spawnpoint und Border..."); world.setSpawnLocation(loc); world.getWorldBorder().setCenter(loc); world.getWorldBorder().setSize(500); } else { Main.getPlugin().getLogger().warning("Kein Biom gefunden. Suche erneut..."); searchBiome(); } } ``` you have an idea?
because you probably know something
yup
well... is #setAutoSave setting the normal save, doing every *** seconds, or the save at restart/stop?
then i could just remove the save and done
no need for creating the new world every time
nope it isnt... lmao
Is any alternative for pluginmessage to communicate between bungeecord and spigot, which don't needs player?
anyone recall waht mc version material data was deprecated. was that for 1.13?
or did that happen before in 1.12?
yes it was
ok so pre 1.13 should use material and data to make itemstack, right?
Yeah
yes
ok, thats what i thought.
so could someone anwser my question?
Is any alternative for pluginmessage to communicate between bungeecord and spigot, which don't needs player?
But other plugins can do this same and network will be overloaded
Check console
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> { what should the plugin variable be?
Instance of your main class
How would I get that from a separate class?
by learning java
😐
either make a static instance getter in your main class and get it in the code in the other class
or pass it down to the other class when you construct it, and hold onto it
hmm
i have question about the /team command
im not a coder or anything before you explain complicated language to me
but how do you make it so the colors & team name display in chat rather than just tab- i heard on reddit its due to spigot overlapping or interfering with it
and its possible to be changed by just opening a bit of code/file idk help me
there is or was a setting for it in either paper or spigot, but last I checked it was broken
oh alright
how do I change the view distance only on 1 world
I only know that Paper has World#setViewDistance(int)
Dont think that Spigot has an API for that.
oh ok
coding an autosell plugin atm, am i setting up this config correctly?
mines: A-mine: message: |- &6&m---------&8&m------&9&l[ &c&lShop Prices! &9&l]&8&m------&6&m--------- &9&l[&c$&9&l] &a64 Wood = $500 &9&l[&c$&9&l] &a64 Cobblestone = $250 &9&l[&c$&9&l] &a64 Coal = $750 &9&l[&c$&9&l] &a64 Iron = $1,500 &9&l[&c$&9&l] &a1 Diamond = $5,000 &6&m---------&8&m------&9&l[ &c&lShop Prices! &9&l]&8&m------&6&m--------- prices: ACACIA_WOOD: 8 BIRCH_WOOD: 8 COAL: 12 COBBLESTONE: 4 DARK_OAK_WOOD: 8 DIAMOND: 5000 IRON_INGOT: 24 JUNGLE_WOOD: 8 LOG: 8 SPRUCE_WOOD: 8
then trying to access it like
ConfigurationSection sec = plugin.getConfig().getConfigurationSection("mines."+perm+".prices");
it worked for awhile and then i would change a semingly unrelate part of the code (or add something to the config) and then my sec is empty even though there are def values under prices
Assuming perm is A-mine
yeah
ive run the config through http://www.yamllint.com/ so i know its valid
Validate and Verify your YAML documents, optimized for Ruby on Rails
maybe but I still want to see it
and, uh
what?
like i can get the "mines."+perm+".message" printing out
what does this mean?
i meant i can access and print out whats under
mines:
A-mine:
message:
but the prices return an empty config section
even though its definitely not empty, is that the best way to format something like that?
can you paste the code you are using to print out the contents of these sections
ive tested and can individuall access each price, so if i were to do "mines."+perm+".message.ACACIA_WOOD" i could get the int
so i dont print out the "prices" part, i print out the messages part
Normally you would get the keys of the "mines" section and iterate over the sub sections each representing a mine.
what do you mean? like get "mines."+perm instead?
You just get the keys in "mines"
Theres a spigot setting that says view distance
you wanted to set a view distance in a specific world right
then... create a section for the world
under world settings
and set the setting there
FileConfiguration fc;
ConfigurationSection mineSection = fc.getConfigurationSection("mines");
final Set<String> keys = fc.getKeys(false);
for (final String key : keys) {
final ConfigurationSection mineConfig = fc.getConfigurationSection(key);
// Do stuff with each mine
}
@neat willow
@ripe narwhal Not in the server.properties. In the Spigot.yml
i thought his issue was that the config section for prices was empty
or showed up as empty
by sorting the list and then appending it to the stringbuilder
Collections.sort()
Will sort the List in its "natural" order.
A bit more context pls
?paste
then... create a section for the world
@pastel nacelle so I just need to copy paste the world settings and put the view distance I want?
Clearly a Stringbuilder is not a collection
StringBuilder is not a collection
Sort first then build the string
@ripe narwhal I dont think you need to copy every property.
Idk what to do
So I'm attempting to run BuildTools from a Java ProcessBuilder but I keep getting this error, reckon I need to set some environment variables or something? 🤔 'sh' is not recognized as an internal or external command, operable program or batch file. Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [cmd.exe, /D, /C, sh, C:\Users\James\apache-maven-3.6.3/bin/mvn, install:install-file, -Dfile=work\mapped.7bc2ea8b.jar, -Dpackaging=jar, -DgroupId=org.spigotmc, -DartifactId=minecraft-server, -Dversion=1.16.1-SNAPSHOT]
I got this error @grim halo
Time: 02-08-2020 22:10
Description: Exception in server tick loop
java.lang.RuntimeException: org.bukkit.configuration.InvalidConfigurationException: mapping values are not allowed here
in 'string', line 62, column 31:
creative: view-distance: 6
^
So I'm attempting to run BuildTools from a Java ProcessBuilder but I keep getting this error, reckon I need to set some environment variables or something? 🤔
'sh' is not recognized as an internal or external command, operable program or batch file. Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [cmd.exe, /D, /C, sh, C:\Users\James\apache-maven-3.6.3/bin/mvn, install:install-file, -Dfile=work\mapped.7bc2ea8b.jar, -Dpackaging=jar, -DgroupId=org.spigotmc, -DartifactId=minecraft-server, -Dversion=1.16.1-SNAPSHOT]
@crimson sandal u on windows?
Yep!
'sh' is not recognized as an internal or external command,
operable program or batch file.
use git bash
@ripe narwhal send a screenshot of your config
@grim halo i think the issue is his syntax
okay so i am storing Block data into a list and i was wondering what would be the best way to save that data to a file and then load it back up again for like when the server restarts ?
@ripe narwhal You need to have a new line for each property.
Just look at my screenshot and copy it 1:1 then change the variables
@atomic nova There is probably no "best" way for that. You can get BlockData as a String and let Spigot convert it back.
That would be the simplest way. You can also write your own serializer that uses a less expressive way of storage.
But if you just want to load it on startup then writing it into a plain txt file would be sufficient i guess.
creative: view-distance: 6 is not valid yaml because of the second ':'
put the string in quotes
@frigid ember User name is longer than the allowed 16 chars (normally only happens on cracked clients)
@grim halo okay i tried writing the block data into the config file but it messes the config all up so when i try to load it back in it does work
the other way i was thinking was taking the block data and converting it to something small like Base64 into the list to make it easier to load/save
You should create new file for storing data. A config should only be used for configuration and not persistent data storage.
Btw this explains the BlockData conversion just right
dawn
is there a mov
mob
or an npc
or anything
thats longer than 16 characters
worse case scenario delete your world and let it regenerate
also account for color codes numbers and the symbols as well
Wait is this why you can't run BuildTools through a Java process? O.o https://hub.spigotmc.org/stash/projects/SPIGOT/repos/buildtools/commits/dad88319bd097e7ad29e8f6153627a3394532c86
Does md not want people to do that?
// Mapping string values to int keys
hash_map.put(10, "Geeks");
hash_map.put(15, "4");
hash_map.put(20, "Geeks");
hash_map.put(25, "Welcomes");
hash_map.put(30, "You");
// Displaying the HashMap
System.out.println("Initial Mappings are: " + hash_map.get(10));
returns "Geeks"
but how would i make it so that i can do:
hash_map.get("Geeks")
and it would return 10?
@marble geyser create a Map<String, Integer> or use a BiMap from guava
hi there, does anyone why my spigot server keeps showing hearts above mobs?
i want to use .get for the second value
You cant get from value to key as the values are not unique.
so a map could contain
"A" : 10
"B" : 10
"C" : 10
No way to get the key that is coupled to 10
oh
it's messing my bossbar settings because it constanlty replace name with hearts
lmao
@wide hawk Hearts above mobs? Sounds like a plugin.
ik but there is no plugin
well i have some
but i never intended to install for hearts
Wait wtf, the latest version of BuildTools is crashing for me altogether O.o
Even in the CMD prompt
Dafuq did yo udo
it seems to come right from the server itself
@wide hawk Show the plugin list. Maybe i recognise the plugin.
And it does not come from the server itself
Oh weird, looks like the portable git got corrupted
It it possible to only apply a glowing effect to the armor / items on armor stands? So far from my research it seems it isnt possible as glowing can only be applied to entities, but asking here anyways just to confirm
Its probably mcmmo. But i was told it was "added after the hearts"
@tribal field You would need multiple armor stands for that.
Yeah, I wanted to make the items themselves glow, not the armor stands
Yes but he wants a single item on the armorstand to glow
Also, how would multiple armor stands help?
You spawn one armor stand on the position per item slot. Make the armor stands invisible and give the respective armorstand the glow effect.
If you dont mind the extra resources
Even while its invis, you can see the entire glow effect on the armour stand though
Unless you want them all to glow, in which case you can just use one stand
One message removed from a suspended account.
Im guessing you're figured out what I meant :P
Wait im tired. Uhm make them a marker
Aha, all good. and what do you mean by a marker?
Armor stands have a marker property so they dont have a hitbox anymore
There should be an API for that
I'll give that a shot, thanks 😃
@rustic prism
#!/bin/sh
while true
do
java -xmx/xms/jar etc stuff here
echo "If you want to completely stop the server process now, press Ctrl+C before
the time is up!"
echo "Rebooting in:"
for i in 5 4 3 2 1
do
echo "$i..."
sleep 1
done
echo "Rebooting now!"
done
Its a pretty simple one...
I’ve been getting periodic lag spikes on my server of 2 people. Only plugin is MemCheck, but problem existed before I added it. Server has 6GB of ram
Ay, its works perfectly https://prnt.sc/tsuzmg, thanks again man @grim halo
/timings on
wait for some time
/timings paste
What's CMI? I've read something about it, but nowhere could I find what it is.
I found that link, but I need to be logged in to see it.
Thats because its a premium plugin
Not libre? Alright, time to hate it.
I mean its a really good plugin and the devs work is probably worth thousands of dollars now
CMI 😂
Sounds really bloated
essentials is a better essentials
Havent used a plugin from someone else in over 2 years but back then CMI was rly feature packed and you could run a server off of it.
Never liked Essentials.
How to change the player name tag? And is it possible without scoreboards?
You can disable it in the config
@dry horizon You can just set a players name
Yes
@dry horizon
https://www.spigotmc.org/threads/how-to-change-players-name-spigot-1-10-2.186778/
https://gist.github.com/Techcable/d574a6e78ada3b8511bd
@grim halo okay here is one from yesterday, i got lagged out in the middle of it
https://timings.spigotmc.org/?url=osizezayej
For one who considers themselves decent with nms entities, I will pay $5 for you to write me a custom entity class for a villager that has no pathfinder goals but the one to look at the nearest player. Not setting their movement speed to zero, but to avoid them from seeking jobs entirely by them having no pathfinding except looking at nearby players.
Spigot 1.8.9 does not exist fyi
Ok
Yes. If you use an ancient version you need to dig in the archives
I-
Unsupported versions = unsupported
@winged sparrow sure can do
Aight
tell me the version you want me to code it for 👀
@latent pond Disable auto saving. It looks like your server uses a lot of time on the main thread saving your world.
Thanks Fr33
okay, is there any downside to disabling it?
And what the hell is "Titty-2_nether"
lol my world name is poopsack and titty
one sec
tisnt that just the nether region file or something?
@latent pond I dont think there is a downside. Its only a higher risc if your server crashes.
well it's been getting there since i switched over to spigot
i used to run a modded 1.12 world and it never gave me issues
or use paper which has incremental autosave 😎
^
i switched to spigot so i could run a vanilla 1.16 world
nah screw paper. i dont want to have to deal with removed mechanics
well an smp i'm on had a bunch of redstone machines broken because of paper
if you consider exploits and bugs a "mechanic" then yes
paper doesn't even change redstone though
anyway i'm not switching to paper, is the only recomendation disabling auto-save
Everything else looks fine (although timings v2 from paper would have gotten me way more insight)
You can pre-render your world. If you adventure in one direction and load chunks the main thread could take a hit.
Im so free and recommend you my plugin i just rewrote :D
https://www.spigotmc.org/resources/fast-chunk-pregenerator.74429/
eigencraft redstone was dropped in 1.16 if that's what you're referring to
Oh eigencraft was dropped? Why?
1.16 changed redstone
and updating eigencraft to match the changes was something nobody wanted to do
i dont know man, i just know the server owner went into the Paper discord and they were a-holes to him when he asked about the things that got broken
it's in the "will be updated if someone steps up to get cancer" category now
Oh right. I remember some "physics improvements" from md9....
@latent pond Yes i have to admit that the paper discord i hella salty.
just the way I like it
so yeah, i'd rather not switch if i might come under fire just for trying to fumble my way around this stuff
anyway, thanks guys, will be back if issue persists 👋
Sure. Your preference. Did you check if autosaving was enabled?
it is, i get a message everytime the server saves
aight disable it. And pregenerate your world 😄
what is that?
since splögget can't generate chunks asynchronously, it bogs down your main thread and takes a big dump on your tps
so, you want to pre-generate the world so it doesn't lag to hell and back when people walk around
You can pre-render your world. If you adventure in one direction and load chunks the main thread could take a hit.
Im so free and recommend you my plugin i just rewrote :D
https://www.spigotmc.org/resources/fast-chunk-pregenerator.74429/
@grim halo
As stated above
okay, my friend and i were going in and out of the nether, and we've been wandering around a lot to look for a spot for a base. so that's the problem?
also lots of caving
probably not the main problem but it will def decrease your TPS if you wander around.
So, back at it again with another question 😛 Is there any way to keep the fog from a boss bar while having the boss bar not visible to players?
from console
/fcp start <radius> <world>
Generates the world from the center to the defined radius
is the center 0,0? our base is 2k from spawn
@tribal field If there is a way then it will be tricky.
@latent pond The center will be the world spawn
Yeah I figured rip
Does anybody knows how can i make a player write something on the chat but not send it? Like, complete a command
I mean, when the player click on x item, he is forced to write /command <x> <x> on the chat
dispatchCommand
Thanks
You cannot write something into the client's chat bar, no. The only way would be the client clicking a text component, but that's entirely client-side.
You can suggest a command with a text component
Any staff who can help me for a moment?
You cannot write something into the client's chat bar, no. The only way would be the client clicking a text component, but that's entirely client-side.
Ahh, so if i make a MenuGui, and when the player clicks on any item from it, its not possible?
Any staff who can help me for a moment?
?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.
No, but I'm sure someone here does
I do
Can anyone pass the GoldenCrates plugin link for 1.8 to 1.12? Thank you
@frigid ember Do you use Featherboard?
AnimatedNames=
?
@tacit spoke https://www.spigotmc.org/resources/goldencrates-1-14-1-16.48732/history
Search in the history. It should be listed here:
https://www.spigotmc.org/resources/goldencrates-1-14-1-16.48732/updates
@frigid ember What version are you on?