mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Merge branch 'dev'
This commit is contained in:
commit
d63602e568
4
.gitignore
vendored
4
.gitignore
vendored
@ -55,7 +55,9 @@ Temporary Items
|
||||
*.classpath
|
||||
*.project
|
||||
*.prefs
|
||||
/target/
|
||||
target/
|
||||
/bin/
|
||||
*.iml
|
||||
/.idea/
|
||||
|
||||
.flattened-pom.xml
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Migration/SQLtoFilesMigration.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Migration/SQLtoSQLMigration.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQLite.java" dialect="SQLite" />
|
||||
<file url="file://$PROJECT_DIR$/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Migration/SQLtoFilesMigration.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Migration/SQLtoSQLMigration.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java" dialect="GenericSQL" />
|
||||
<file url="file://$PROJECT_DIR$/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQLite.java" dialect="SQLite" />
|
||||
</component>
|
||||
</project>
|
61
Minepacks-API/README.md
Normal file
61
Minepacks-API/README.md
Normal file
@ -0,0 +1,61 @@
|
||||
<!-- Variables (this block will not be visible in the readme -->
|
||||
[banner]: https://pcgamingfreaks.at/images/minepacks.png
|
||||
[spigot]: https://www.spigotmc.org/resources/minepacks.19286/
|
||||
[license]: https://github.com/GeorgH93/Minepacks/blob/master/LICENSE
|
||||
[licenseImg]: https://img.shields.io/github/license/GeorgH93/Minepacks.svg
|
||||
[ci]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/
|
||||
[ciImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/badge/icon
|
||||
[apiVersionImg]: https://img.shields.io/badge/dynamic/xml.svg?label=api-version&query=%2F%2Frelease[1]&url=https%3A%2F%2Frepo.pcgamingfreaks.at%2Frepository%2Fmaven-releases%2Fat%2Fpcgamingfreaks%2FMinepacks-API%2Fmaven-metadata.xml
|
||||
[apiJavaDoc]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/javadoc/
|
||||
[apiBuilds]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/
|
||||
<!-- End of variables block -->
|
||||
|
||||
[![Logo][banner]][spigot]
|
||||
|
||||
This branch holds the API for the Minepacks plugin.
|
||||
|
||||
[![ciImg]][ci] [![apiVersionImg]][apiJavaDoc] [![licenseImg]][license]
|
||||
|
||||
## Adding it to your plugin
|
||||
### Maven
|
||||
The API is available through maven.
|
||||
#### Repository:
|
||||
```
|
||||
<repository>
|
||||
<id>pcgf-repo</id>
|
||||
<url>https://repo.pcgamingfreaks.at/repository/maven-everything</url>
|
||||
</repository>
|
||||
```
|
||||
#### Dependency:
|
||||
```
|
||||
<!-- Minepacks API -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks-API</artifactId>
|
||||
<version>2.2</version><!-- Check api-version shield for newest version -->
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Build from source:
|
||||
```
|
||||
git clone https://github.com/GeorgH93/Minepacks.git
|
||||
cd Minepacks
|
||||
mvn -pl Minepacks-API
|
||||
```
|
||||
|
||||
### Get access to the API:
|
||||
```java
|
||||
public MinepacksPlugin getMinepacks() {
|
||||
Plugin bukkitPlugin = Bukkit.getPluginManager().getPlugin("Minepacks");
|
||||
if(!(bukkitPlugin instanceof MinepacksPlugin)) {
|
||||
// Do something if Minepacks is not available
|
||||
return null;
|
||||
}
|
||||
return (MinepacksPlugin) bukkitPlugin;
|
||||
}
|
||||
```
|
||||
You can now use the returned `MinepacksPlugin` object to interact with the Minepacks plugin.
|
||||
|
||||
## Links
|
||||
* [JavaDoc][apiJavaDoc]
|
||||
* [API Build Server][apiBuilds]
|
60
Minepacks-API/pom.xml
Normal file
60
Minepacks-API/pom.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>Minepacks-API</artifactId>
|
||||
<parent>
|
||||
<artifactId>Minepacks-Parent</artifactId>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Minepacks-API</name>
|
||||
<description>API for the Bukkit/Spigot plugin Minepacks.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
<version>1.0.17-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<!-- Creates a jar with the sources (for maven repo) -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Creates a jar with the javadoc (for maven repo) -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface Backpack extends InventoryHolder
|
||||
{
|
||||
/**
|
||||
* Gets the owner of the backpack.
|
||||
*
|
||||
* @return The owner of the backpack;
|
||||
*/
|
||||
@NotNull OfflinePlayer getOwner();
|
||||
|
||||
/**
|
||||
* Let a given player open this backpack.
|
||||
*
|
||||
* @param player The player who opens the backpack.
|
||||
* @param editable Defines if the player who has opened the backpack can change the items inside.
|
||||
*/
|
||||
void open(@NotNull Player player, boolean editable);
|
||||
|
||||
/**
|
||||
* Let a given player open this backpack.
|
||||
*
|
||||
* @param player The player who opens the backpack.
|
||||
* @param editable Defines if the player who has opened the backpack can change the items inside.
|
||||
* @param title Custom title for the backpack (will be shown to the player who opened the backpack.
|
||||
*/
|
||||
void open(@NotNull Player player, boolean editable, @Nullable String title);
|
||||
|
||||
/**
|
||||
* Checks if the backpack is currently opened by a player.
|
||||
*
|
||||
* @return True if the backpack is open, false if not.
|
||||
*/
|
||||
boolean isOpen();
|
||||
|
||||
/**
|
||||
* Checks if a player can change the content of the backpack.
|
||||
*
|
||||
* @param player The player to be checked.
|
||||
* @return True if he can change the content, false if not.
|
||||
*/
|
||||
boolean canEdit(@NotNull Player player);
|
||||
|
||||
/**
|
||||
* Gets the size of the backpack.
|
||||
*
|
||||
* @return The size of the backpack.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
int getSize();
|
||||
|
||||
/**
|
||||
* Checks if the backpack has changed since it was last saved.
|
||||
*
|
||||
* @return True if it has been changed, false if not.
|
||||
*/
|
||||
boolean hasChanged();
|
||||
|
||||
/**
|
||||
* Marks that the content of the backpack a changed. It will be saved when the next player closes the backpack or before it gets removed from the cache.
|
||||
*/
|
||||
void setChanged();
|
||||
|
||||
/**
|
||||
* Forces the backpack to be saved
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* Removes all items from the backpack.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Drops the content of the backpack to the ground on a given location.
|
||||
*
|
||||
* @param location The location the content of the backpack should be dropped to.
|
||||
*/
|
||||
void drop(Location location);
|
||||
|
||||
/**
|
||||
* @param stack The item stack that should be added to the backpack.
|
||||
* @return null if the entire item stack has been added. An item stack containing the items that did not fit into the backpack.
|
||||
*/
|
||||
default @Nullable ItemStack addItem(ItemStack stack)
|
||||
{
|
||||
Map<Integer, ItemStack> left = addItems(stack);
|
||||
if(left.isEmpty()) return null;
|
||||
return left.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemStacks The item that should be added to the backpack.
|
||||
* @return A HashMap containing items that didn't fit. The key is the number of the added item
|
||||
*/
|
||||
default @NotNull Map<Integer, ItemStack> addItems(ItemStack... itemStacks)
|
||||
{
|
||||
return getInventory().addItem(itemStacks);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||
|
||||
public interface Callback<T>
|
||||
{
|
||||
void onResult(T done);
|
||||
|
||||
void onFail();
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface ItemFilter
|
||||
{
|
||||
/**
|
||||
* @param item The item that should be checked.
|
||||
* @return True if the item is not allowed. False if the item is allowed.
|
||||
*/
|
||||
@Contract("null->false")
|
||||
boolean isItemBlocked(@Nullable ItemStack item);
|
||||
|
||||
/**
|
||||
* @param player The player that should receive the message that the item is not allowed.
|
||||
* @param itemStack The item that is not allowed. Will be used for the name.
|
||||
*/
|
||||
void sendNotAllowedMessage(@NotNull Player player, @NotNull ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* @param player The player that should receive the message if the item is not allowed.
|
||||
* @param itemStack The item that should be checked.
|
||||
* @return True if the item is not allowed. False if the item is allowed.
|
||||
*/
|
||||
default boolean checkIsBlockedAndShowMessage(@NotNull Player player, @Nullable ItemStack itemStack)
|
||||
{
|
||||
if(isItemBlocked(itemStack))
|
||||
{
|
||||
sendNotAllowedMessage(player, itemStack);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||
|
||||
import at.pcgamingfreaks.Bukkit.Command.SubCommand;
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Command.HelpData;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Only available if the plugin is not running in standalone mode!
|
||||
*/
|
||||
public abstract class MinepacksCommand extends SubCommand
|
||||
{
|
||||
private static MinepacksPlugin minepacksPlugin = null;
|
||||
private static Method showHelp = null;
|
||||
private static Message messageNoPermission = new Message(ChatColor.RED + "You don't have the permission to do that.");
|
||||
private static Message messageNotFromConsole = new Message(ChatColor.RED + "This command can't be used from console!");
|
||||
protected final JavaPlugin plugin;
|
||||
private final boolean playerOnly;
|
||||
|
||||
//region Constructors
|
||||
/**
|
||||
* Creates a new command instance.
|
||||
*
|
||||
* @param plugin The plugin owning the command.
|
||||
* @param name The command used.
|
||||
* @param description The description of the command.
|
||||
* @param aliases List of aliases for that command.
|
||||
*/
|
||||
public MinepacksCommand(@NotNull JavaPlugin plugin, @NotNull String name, @NotNull String description, @Nullable String... aliases)
|
||||
{
|
||||
this(plugin, name, description, null, aliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new command instance.
|
||||
*
|
||||
* @param plugin The plugin owning the command.
|
||||
* @param name The command used.
|
||||
* @param description The description of the command.
|
||||
* @param permission The permission to be checked for this command. Players without the permission neither can use the command nor will they see it in help.
|
||||
* @param aliases List of aliases for that command.
|
||||
*/
|
||||
public MinepacksCommand(@NotNull JavaPlugin plugin, @NotNull String name, @NotNull String description, @Nullable String permission, @Nullable String... aliases)
|
||||
{
|
||||
this(plugin, name, description, permission, false, aliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new command instance.
|
||||
*
|
||||
* @param plugin The plugin owning the command.
|
||||
* @param name The command used.
|
||||
* @param description The description of the command.
|
||||
* @param permission The permission to be checked for this command. Players without the permission neither can use the command nor will they see it in help.
|
||||
* @param playerOnly Limits the command to players, console can't use and can't see the command.
|
||||
* @param aliases List of aliases for that command.
|
||||
*/
|
||||
public MinepacksCommand(@NotNull JavaPlugin plugin, @NotNull String name, @NotNull String description, @Nullable String permission, boolean playerOnly, @Nullable String... aliases)
|
||||
{
|
||||
super(name, description, permission, aliases);
|
||||
this.plugin = plugin;
|
||||
this.playerOnly = playerOnly;
|
||||
}
|
||||
//endregion
|
||||
|
||||
/**
|
||||
* Gets the instance of the marriage master plugin.
|
||||
*
|
||||
* @return The instance of the marriage master plugin.
|
||||
*/
|
||||
protected @NotNull MinepacksPlugin getMinepacksPlugin()
|
||||
{
|
||||
return minepacksPlugin;
|
||||
}
|
||||
|
||||
//region Command Stuff
|
||||
/**
|
||||
* Executes some basic checks and runs the command afterwards.
|
||||
*
|
||||
* @param sender Source of the command.
|
||||
* @param mainCommandAlias Alias of the plugins main command which was used.
|
||||
* @param alias Alias of the command which has been used.
|
||||
* @param args Passed command arguments.
|
||||
*/
|
||||
@Override
|
||||
public void doExecute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String... args)
|
||||
{
|
||||
if(playerOnly && !(sender instanceof Player))
|
||||
{
|
||||
messageNotFromConsole.send(sender);
|
||||
}
|
||||
else if(getPermission() != null && !sender.hasPermission(getPermission()))
|
||||
{
|
||||
messageNoPermission.send(sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
execute(sender, mainCommandAlias, alias, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes some basic checks and generates list for tab completion.
|
||||
*
|
||||
* @param sender Source of the command.
|
||||
* @param mainCommandAlias Alias of the plugins main command which has been used.
|
||||
* @param alias The alias used.
|
||||
* @param args The arguments passed to the command, including final partial argument to be completed and command label.
|
||||
* @return A List of possible completions for the final argument, or null to default to the command executor.
|
||||
*/
|
||||
@Override
|
||||
public List<String> doTabComplete(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String... args)
|
||||
{
|
||||
if(playerOnly && !(sender instanceof Player))
|
||||
{
|
||||
messageNotFromConsole.send(sender);
|
||||
}
|
||||
else if(getPermission() != null && !sender.hasPermission(getPermission()))
|
||||
{
|
||||
messageNoPermission.send(sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tabComplete(sender, mainCommandAlias, alias, args);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the help for a given {@link CommandSender}.
|
||||
*
|
||||
* @param requester The {@link CommandSender} that requested help.
|
||||
* @return All the help data for this command.
|
||||
*/
|
||||
@Override
|
||||
public @Nullable List<HelpData> getHelp(@NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = new LinkedList<>();
|
||||
help.add(new HelpData(getTranslatedName(), null, getDescription()));
|
||||
return help;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the help to a given command sender.
|
||||
*
|
||||
* @param sendTo The command sender that requested help.
|
||||
* @param usedMainCommandAlias The used backpack alias to replace the /backpack with the used alias.
|
||||
*/
|
||||
@Override
|
||||
public void showHelp(@NotNull CommandSender sendTo, @NotNull String usedMainCommandAlias)
|
||||
{
|
||||
try
|
||||
{
|
||||
showHelp.invoke(getMinepacksPlugin().getCommandManager(), sendTo, usedMainCommandAlias, doGetHelp(sendTo));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a user can use the command. Checks permission, marriage status and player/console.
|
||||
*
|
||||
* @param sender The player/console that should be checked.
|
||||
* @return True if it can use the command, false if not.
|
||||
*/
|
||||
@Override
|
||||
public boolean canUse(@NotNull CommandSender sender)
|
||||
{
|
||||
return (!playerOnly || sender instanceof Player) && (getPermission() == null || sender.hasPermission(getPermission()));
|
||||
}
|
||||
//endregion
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface MinepacksCommandManager
|
||||
{
|
||||
/**
|
||||
* Registers a new sub-command for /backpack.
|
||||
* This function is only available if the plugin is not running in standalone mode!
|
||||
*
|
||||
* @param command The command that should be registered.
|
||||
*/
|
||||
void registerSubCommand(@NotNull MinepacksCommand command);
|
||||
|
||||
/**
|
||||
* Unregisters a sub-command for /backpack.
|
||||
* This function is only available if the plugin is not running in standalone mode!
|
||||
*
|
||||
* @param command The command that should be unregistered.
|
||||
*/
|
||||
void unRegisterSubCommand(@NotNull MinepacksCommand command);
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface MinepacksPlugin
|
||||
{
|
||||
/**
|
||||
* Gets the instance of the minepacks plugin.
|
||||
* WARNING use this function at your own risk! If the plugin is not installed the MinepacksPlugin class will be unknown!
|
||||
*
|
||||
* @return The instance of the minepacks plugin.
|
||||
*/
|
||||
static @Nullable MinepacksPlugin getInstance()
|
||||
{
|
||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("Minepacks");
|
||||
return (plugin instanceof MinepacksPlugin && plugin.isEnabled()) ? (MinepacksPlugin) plugin : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the plugin is running in standalone mode. Some features and API functions are not available in standalone mode!
|
||||
*
|
||||
* @return True if the plugin is running in standalone mode.
|
||||
*/
|
||||
boolean isRunningInStandaloneMode();
|
||||
|
||||
/**
|
||||
* Let a given player open the backpack of an other player.
|
||||
*
|
||||
* @param opener The player who opens the backpack.
|
||||
* @param owner The owner of the backpack that should be opened.
|
||||
* @param editable Defines if the player who has opened the backpack can change the items inside.
|
||||
*/
|
||||
void openBackpack(@NotNull final Player opener, @NotNull final OfflinePlayer owner, final boolean editable);
|
||||
|
||||
/**
|
||||
* Let a given player open a given {@link Backpack}.
|
||||
*
|
||||
* @param opener The player who opens the backpack.
|
||||
* @param backpack The backpack to be opened. null will result in an error message for the player.
|
||||
* @param editable Defines if the player who has opened the backpack can change the items inside.
|
||||
*/
|
||||
void openBackpack(@NotNull final Player opener, @Nullable final Backpack backpack, boolean editable);
|
||||
|
||||
/**
|
||||
* Let a given player open the backpack of an other player.
|
||||
*
|
||||
* @param opener The player who opens the backpack.
|
||||
* @param owner The owner of the backpack that should be opened.
|
||||
* @param editable Defines if the player who has opened the backpack can change the items inside.
|
||||
* @param title Custom title for the backpack (will be shown to the player who opened the backpack.
|
||||
*/
|
||||
void openBackpack(@NotNull final Player opener, @NotNull final OfflinePlayer owner, final boolean editable, @Nullable String title);
|
||||
|
||||
/**
|
||||
* Let a given player open a given {@link Backpack}.
|
||||
*
|
||||
* @param opener The player who opens the backpack.
|
||||
* @param backpack The backpack to be opened. null will result in an error message for the player.
|
||||
* @param editable Defines if the player who has opened the backpack can change the items inside.
|
||||
* @param title Custom title for the backpack (will be shown to the player who opened the backpack.
|
||||
*/
|
||||
void openBackpack(@NotNull final Player opener, @Nullable final Backpack backpack, boolean editable, @Nullable String title);
|
||||
|
||||
/**
|
||||
* Retrieves the backpack for a given player.
|
||||
* This method only returns a backpack if it is in the cache.
|
||||
*
|
||||
* @param owner The player who's backpack should be retrieved.
|
||||
* @return The backpack of the given player. null if the backpack is in the cache.
|
||||
*/
|
||||
@Nullable Backpack getBackpackCachedOnly(@NotNull final OfflinePlayer owner);
|
||||
|
||||
/**
|
||||
* Retrieves the backpack for a given player.
|
||||
* This method runs async! The result will be delivered with a callback.
|
||||
* If no backpack exists a new one will be created.
|
||||
*
|
||||
* @param owner The player who's backpack should be retrieved.
|
||||
* @param callback The callback delivering the result of the request.
|
||||
*/
|
||||
void getBackpack(@NotNull final OfflinePlayer owner, @NotNull final Callback<Backpack> callback);
|
||||
|
||||
/**
|
||||
* Retrieves the backpack for a given player.
|
||||
* This method runs async! The result will be delivered with a callback.
|
||||
*
|
||||
* @param owner The player who's backpack should be retrieved.
|
||||
* @param callback The callback delivering the result of the request.
|
||||
* @param createNewIfNotExists If set to true, a new backpack will be created if there currently is no backpack for this player.
|
||||
*/
|
||||
void getBackpack(@NotNull final OfflinePlayer owner, @NotNull final Callback<Backpack> callback, boolean createNewIfNotExists);
|
||||
|
||||
/**
|
||||
* Gets the command manager of the Minepacks plugin.
|
||||
*
|
||||
* @return The command manager instance. null if the plugin is running in standalone mode
|
||||
*/
|
||||
@Nullable MinepacksCommandManager getCommandManager();
|
||||
|
||||
/**
|
||||
* Checks if the player is allowed to open a backpack based on is permissions and current game-mode.
|
||||
*
|
||||
* @param player The player to be checked.
|
||||
* @return True if the player can use a backpack. False if not.
|
||||
*/
|
||||
boolean isPlayerGameModeAllowed(final @NotNull Player player);
|
||||
|
||||
/**
|
||||
* Gets the item filter.
|
||||
*
|
||||
* @return The item filter. Null if item filter is disabled
|
||||
*/
|
||||
@Nullable ItemFilter getItemFilter();
|
||||
}
|
310
Minepacks/pom.xml
Normal file
310
Minepacks/pom.xml
Normal file
@ -0,0 +1,310 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>Minepacks</artifactId>
|
||||
<parent>
|
||||
<artifactId>Minepacks-Parent</artifactId>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Minepacks</name>
|
||||
<description>Minepacks is a backpack plugin with different backpack sizes, multi language support and SQLite and MySQL storage support.</description>
|
||||
<url>https://www.spigotmc.org/resources/19286/</url>
|
||||
<inceptionYear>2014</inceptionYear>
|
||||
|
||||
<properties>
|
||||
<author>GeorgH93</author>
|
||||
<version>${project.version}</version>
|
||||
<dependencies>depend: [ PCGF_PluginLib ]</dependencies>
|
||||
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}</mainClass>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Minepacks API -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks-API</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- PCGF Plugin Lib -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
<version>1.0.21-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- BadRabbit -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>BadRabbit-Bukkit</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test/src</testSourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>./</directory>
|
||||
<includes>
|
||||
<include>LICENSE</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<!-- Resolve lombok -->
|
||||
<plugin>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok-maven-plugin</artifactId>
|
||||
<version>1.18.10.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>delombok</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Bundle the API into the JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>ExcludeBadRabbit</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.class</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>Standalone</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<version>${project.version}-Standalone</version>
|
||||
<dependencies/>
|
||||
<mainClass>${project.groupId}.${project.artifactId}Standalone.Bukkit.${project.artifactId}</mainClass>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Shades some required libs into the final jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>Standalone</shadedClassifierName>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:PluginLib</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>at.pcgf.libs</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>at.pcgamingfreaks.Minepacks</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.*</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>at.pcgamingfreaks</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack</exclude>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Callback</exclude>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin</exclude>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommandManager</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>at.pcgamingfreaks:PluginLib</artifact>
|
||||
<excludes>
|
||||
<exclude>*.yml</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Replace all the PCGF-PluginLib code with alternatives -->
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>munge-maven-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>munge</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>munge</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<symbols>STANDALONE</symbols>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>Release</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<version>${project.version}-Release</version>
|
||||
<dependencies>softdepend: [ PCGF_PluginLib ]</dependencies>
|
||||
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}BadRabbit</mainClass>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>Standalone</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>Release</shadedClassifierName>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:BadRabbit</include>
|
||||
<include>at.pcgamingfreaks:Minepacks</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>at.pcgamingfreaks.BadRabbit</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.Minepacks</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<version>1.20</version>
|
||||
<configuration>
|
||||
<excludedScopes>test,provided,system</excludedScopes>
|
||||
<generateBundle>true</generateBundle>
|
||||
<licensesOutputFile>${project.build.directory}/generated-resources/licenses-THIRD-PARTY.xml</licensesOutputFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-third-party</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>add-third-party</goal>
|
||||
<goal>download-licenses</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
@ -15,7 +15,7 @@ BackpackTitleOther: "&b{OwnerName}'s Backpack"
|
||||
# The title of the inventory for the owner of the backpack.
|
||||
BackpackTitle: "&bBackpack"
|
||||
# Defines if the content of the backpack get dropped on the death of a player.
|
||||
# If enabled, it can be disabled for individual players with the "backpack.KeepOnDeath" permission.
|
||||
# If enabled, it can be disabled for individual players with the "backpack.keepOnDeath" permission.
|
||||
DropOnDeath: true
|
||||
# Defines the max amount of columns for a backpack.
|
||||
# The size of the user's backpack will be defined by the permission, permissions for bigger backpacks than this value will be ignored.
|
||||
@ -57,11 +57,6 @@ Database:
|
||||
AutoCleanup:
|
||||
# Defines the max amount of days backpacks will be stored. -1 to disable auto cleanup
|
||||
MaxInactiveDays: -1
|
||||
# If you would like to use UUIDs, it is recommended not to change this setting unless you know what you are doing!
|
||||
# true: Should be used if your server is running Minecraft 1.7.5 or newer
|
||||
# false: In offline mode or for minecraft version below 1.7.5
|
||||
# If you are using BungeeCord please set this setting based on your BungeeCord's online mode!!!
|
||||
UseUUIDs: true
|
||||
# Defines the storage format for UUIDs for compatibility with other plugins (shared tables)
|
||||
# true: format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
# false: format: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
@ -77,6 +72,10 @@ Database:
|
||||
Password: minecraft
|
||||
# The max amount of connections to the database the connection pool will open
|
||||
MaxConnections: 2
|
||||
# Sets the max lifetime of the connection in seconds. -1 = Default (30min)
|
||||
MaxLifetime: -1
|
||||
# Sets the idle timeout of the connection in seconds. -1 = Default (15min)
|
||||
IdleTimeout:
|
||||
# List of properties for your SQL connection. Can be used to disable SSL.
|
||||
# Properties: ["useSSL=false"]
|
||||
Properties: []
|
||||
@ -130,9 +129,16 @@ Shulkerboxes:
|
||||
|
||||
ItemFilter:
|
||||
# Enables the item filter. Make sure to define items to be filtered.
|
||||
Enable: false
|
||||
# List off items not allowed in the backpack. Can be name or id (id only for MC versions older than 1.13!).
|
||||
Blacklist: []
|
||||
Enabled: false
|
||||
# Changes the filter mode, either blacklist (only not listed materials are allowed) or whitelist (only listed materials are allowed)
|
||||
Mode: blacklist
|
||||
# Filter lists bellow. An item will be blocked (in blacklist mode) or allowed (in whitelist mode) if it matches on of the given filters.
|
||||
# List of materials that should be filtered. Can be name or id (id only for MC versions older than 1.13!).
|
||||
Materials: []
|
||||
# List of names that should be filtered. Must match the display name of the item exactly. & color codes will be converted automatically.
|
||||
Names: []
|
||||
# List of lore that should be filtered. Can be a single line or all lines of the lore.
|
||||
Lore: []
|
||||
|
||||
# This settings allow control over how the plugin behave in different worlds
|
||||
WorldSettings:
|
||||
@ -180,4 +186,4 @@ Misc:
|
||||
UseBungeeCord: false
|
||||
|
||||
# Config file version. Don't touch it!
|
||||
Version: 22
|
||||
Version: 24
|
@ -112,3 +112,12 @@ permissions:
|
||||
backpack.migrate:
|
||||
description: Allows to migrate data from one format to another.
|
||||
default: op
|
||||
backpack.backup:
|
||||
description: Allows to create a backup of a backpack.
|
||||
default: op
|
||||
backpack.restore:
|
||||
description: Allows to restore a backup of a backpack.
|
||||
default: op
|
||||
backpack.version:
|
||||
description: Allows to print the version details of the plugin and it's dependencies.
|
||||
default: op
|
@ -171,7 +171,7 @@ public void open(@NotNull Player player, boolean editable, final @Nullable Strin
|
||||
if(owner.isOnline())
|
||||
{
|
||||
Player owner = this.owner.getPlayer();
|
||||
if(owner != null && owner.hasPermission("backpack.use"))
|
||||
if(owner != null && owner.hasPermission(Permissions.USE))
|
||||
{
|
||||
int size = Minepacks.getInstance().getBackpackPermSize(owner);
|
||||
if(size != bp.getSize())
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,6 +23,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -37,7 +38,7 @@ public class BackupCommand extends MinepacksCommand
|
||||
|
||||
public BackupCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "backup", plugin.getLanguage().getTranslated("Commands.Description.Backup"), "backpack.backup", plugin.getLanguage().getCommandAliases("Backup"));
|
||||
super(plugin, "backup", plugin.getLanguage().getTranslated("Commands.Description.Backup"), Permissions.BACKUP, plugin.getLanguage().getCommandAliases("Backup"));
|
||||
helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">";
|
||||
messageCreated = plugin.getLanguage().getMessage("Ingame.Backup.Created");
|
||||
messageNoBackpack = plugin.getLanguage().getMessage("Ingame.Backup.NoBackpack");
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,6 +23,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -41,7 +42,7 @@ public class ClearCommand extends MinepacksCommand
|
||||
|
||||
public ClearCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "clear", plugin.getLanguage().getTranslated("Commands.Description.Clean"), "backpack.clean", plugin.getLanguage().getCommandAliases("Clean"));
|
||||
super(plugin, "clear", plugin.getLanguage().getTranslated("Commands.Description.Clean"), Permissions.CLEAN, plugin.getLanguage().getCommandAliases("Clean"));
|
||||
messageBackpackCleaned = plugin.getLanguage().getMessage("Ingame.Clean.BackpackCleaned");
|
||||
descriptionCleanOthers = plugin.getLanguage().getTranslated("Commands.Description.CleanOthers");
|
||||
helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">";
|
||||
@ -54,7 +55,7 @@ public void execute(final @NotNull CommandSender commandSender, @NotNull String
|
||||
if(commandSender instanceof Player && args.length < 2)
|
||||
{
|
||||
Player player = (Player) commandSender;
|
||||
target = (args.length == 1 && player.hasPermission("backpack.clean.others")) ? Bukkit.getOfflinePlayer(args[0]) : player;
|
||||
target = (args.length == 1 && player.hasPermission(Permissions.CLEAN_OTHER)) ? Bukkit.getOfflinePlayer(args[0]) : player;
|
||||
}
|
||||
else if(args.length == 1) target = Bukkit.getOfflinePlayer(args[0]);
|
||||
if(target != null)
|
||||
@ -91,7 +92,7 @@ public void onFail()
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||
{
|
||||
if(args.length > 0 && (!(commandSender instanceof Player) || commandSender.hasPermission("backpack.clean.other")))
|
||||
if(args.length > 0 && (!(commandSender instanceof Player) || commandSender.hasPermission(Permissions.CLEAN_OTHER)))
|
||||
{
|
||||
String name, arg = args[args.length - 1].toLowerCase(Locale.ROOT);
|
||||
List<String> names = new LinkedList<>();
|
||||
@ -109,7 +110,7 @@ public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull S
|
||||
public List<HelpData> getHelp(@NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = super.getHelp(requester);
|
||||
if(!(requester instanceof Player) || requester.hasPermission("backpack.clean.other"))
|
||||
if(!(requester instanceof Player) || requester.hasPermission(Permissions.CLEAN_OTHER))
|
||||
{
|
||||
//noinspection ConstantConditions
|
||||
help.add(new HelpData(getTranslatedName(), helpParam, descriptionCleanOthers));
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -106,6 +106,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(args.length == 0) // If the command was executed in the console without parameters
|
||||
{
|
||||
args = new String[]{"help"}; // Show help
|
||||
}
|
||||
return super.onCommand(sender, command, alias, args);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,6 +21,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Migration.MigrationManager;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -32,7 +33,7 @@ public class MigrateCommand extends MinepacksCommand
|
||||
{
|
||||
public MigrateCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "migrate", plugin.getLanguage().getTranslated("Commands.Description.Migrate"), "backpack.migrate", plugin.getLanguage().getCommandAliases("migrate"));
|
||||
super(plugin, "migrate", plugin.getLanguage().getTranslated("Commands.Description.Migrate"), Permissions.MIGRATE, plugin.getLanguage().getCommandAliases("migrate"));
|
||||
}
|
||||
|
||||
@Override
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,6 +23,7 @@
|
||||
import at.pcgamingfreaks.Message.MessageClickEvent;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -42,7 +43,7 @@ public class OpenCommand extends MinepacksCommand
|
||||
|
||||
public OpenCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "open", plugin.getLanguage().getTranslated("Commands.Description.Backpack"), "backpack.use", true, plugin.getLanguage().getCommandAliases("Open"));
|
||||
super(plugin, "open", plugin.getLanguage().getTranslated("Commands.Description.Backpack"), Permissions.USE, true, plugin.getLanguage().getCommandAliases("Open"));
|
||||
this.plugin = plugin;
|
||||
|
||||
messageCooldown = plugin.getLanguage().getMessage("Ingame.Open.Cooldown").replaceAll("\\{TimeLeft}", "%1\\$.1f").replaceAll("\\{TimeSpanLeft}", "%2\\$s");
|
||||
@ -70,7 +71,7 @@ public void execute(@NotNull CommandSender sender, @NotNull String main, @NotNul
|
||||
{
|
||||
if(getMinepacksPlugin().isPlayerGameModeAllowed(player))
|
||||
{
|
||||
if(plugin.getCooldownManager() != null && !player.hasPermission("backpack.noCooldown"))
|
||||
if(plugin.getCooldownManager() != null && !player.hasPermission(Permissions.NO_COOLDOWN))
|
||||
{
|
||||
long cd = plugin.getCooldownManager().getRemainingCooldown(player);
|
||||
if(cd > 0)
|
||||
@ -91,10 +92,10 @@ public void execute(@NotNull CommandSender sender, @NotNull String main, @NotNul
|
||||
}
|
||||
else
|
||||
{
|
||||
if(player.hasPermission("backpack.others"))
|
||||
if(player.hasPermission(Permissions.OTHERS))
|
||||
{
|
||||
//noinspection deprecation
|
||||
plugin.openBackpack(player, Bukkit.getOfflinePlayer(args[0]), player.hasPermission("backpack.others.edit"));
|
||||
plugin.openBackpack(player, Bukkit.getOfflinePlayer(args[0]), player.hasPermission(Permissions.OTHERS_EDIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -106,7 +107,7 @@ public void execute(@NotNull CommandSender sender, @NotNull String main, @NotNul
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender commandSender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||
{
|
||||
if(args.length > 0 && (!(commandSender instanceof Player) || commandSender.hasPermission("backpack.open.other")))
|
||||
if(args.length > 0 && (!(commandSender instanceof Player) || commandSender.hasPermission(Permissions.OTHERS)))
|
||||
{
|
||||
String name, arg = args[args.length - 1].toLowerCase(Locale.ROOT);
|
||||
List<String> names = new LinkedList<>();
|
||||
@ -125,7 +126,7 @@ public List<HelpData> getHelp(@NotNull CommandSender requester)
|
||||
{
|
||||
List<HelpData> help = new LinkedList<>();
|
||||
help.add(new HelpData(getTranslatedName(), null, getDescription(), MessageClickEvent.ClickEventAction.RUN_COMMAND));
|
||||
if(requester.hasPermission("backpack.open.other"))
|
||||
if(requester.hasPermission(Permissions.OTHERS))
|
||||
{
|
||||
help.add(new HelpData(getTranslatedName(), helpParam, descriptionOpenOthers));
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -32,7 +33,7 @@ public class ReloadCommand extends MinepacksCommand
|
||||
|
||||
public ReloadCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "reload", plugin.getLanguage().getTranslated("Commands.Description.Reload"), "backpack.reload", plugin.getLanguage().getCommandAliases("Reload"));
|
||||
super(plugin, "reload", plugin.getLanguage().getTranslated("Commands.Description.Reload"), Permissions.RELOAD, plugin.getLanguage().getCommandAliases("Reload"));
|
||||
|
||||
// Load messages
|
||||
messageReloading = plugin.getLanguage().getMessage("Ingame.Reload.Reloading");
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -24,6 +24,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
import at.pcgamingfreaks.StringUtils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -46,7 +47,7 @@ public class RestoreCommand extends MinepacksCommand
|
||||
|
||||
public RestoreCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "restore", plugin.getLanguage().getTranslated("Commands.Description.Restore"), "backpack.restore", plugin.getLanguage().getCommandAliases("Restore"));
|
||||
super(plugin, "restore", plugin.getLanguage().getTranslated("Commands.Description.Restore"), Permissions.RESTORE, plugin.getLanguage().getCommandAliases("Restore"));
|
||||
helpParam = "<" + plugin.getLanguage().get("Ingame.Restore.ParameterBackupName") + "> (" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ")";
|
||||
messageBackupsHeader = plugin.getLanguage().getMessage("Ingame.Restore.Headline").replaceAll("\\{CurrentPage}", "%1\\$d").replaceAll("\\{MaxPage}", "%2\\$d").replaceAll("\\{MainCommand}", "%3\\$s").replaceAll("\\{SubCommand}", "%4\\$s");
|
||||
messageBackupsFooter = plugin.getLanguage().getMessage("Ingame.Restore.Footer").replaceAll("\\{CurrentPage}", "%1\\$d").replaceAll("\\{MaxPage}", "%2\\$d").replaceAll("\\{MainCommand}", "%3\\$s").replaceAll("\\{SubCommand}", "%4\\$s");
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,6 +20,7 @@
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -32,7 +33,7 @@ public class UpdateCommand extends MinepacksCommand
|
||||
|
||||
public UpdateCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "update", plugin.getLanguage().getTranslated("Commands.Description.Update"), "backpack.update", plugin.getLanguage().getCommandAliases("Update"));
|
||||
super(plugin, "update", plugin.getLanguage().getTranslated("Commands.Description.Update"), Permissions.UPDATE, plugin.getLanguage().getCommandAliases("Update"));
|
||||
|
||||
messageCheckingForUpdates = plugin.getLanguage().getMessage("Ingame.Update.CheckingForUpdates");
|
||||
messageUpdated = plugin.getLanguage().getMessage("Ingame.Update.Updated");
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommand;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -31,7 +32,7 @@ public class VersionCommand extends MinepacksCommand
|
||||
|
||||
public VersionCommand(Minepacks plugin)
|
||||
{
|
||||
super(plugin, "version", plugin.getLanguage().getTranslated("Commands.Description.Version"), "backpack.version", plugin.getLanguage().getCommandAliases("Version"));
|
||||
super(plugin, "version", plugin.getLanguage().getTranslated("Commands.Description.Version"), Permissions.VERSION, plugin.getLanguage().getCommandAliases("Version"));
|
||||
minepacksVersion = plugin.getDescription().getName() + ": " + plugin.getDescription().getVersion();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
public class Config extends Configuration implements DatabaseConnectionConfiguration
|
||||
{
|
||||
private static final int CONFIG_VERSION = 22, UPGRADE_THRESHOLD = 22, PRE_V2_VERSION = 20;
|
||||
private static final int CONFIG_VERSION = 24, UPGRADE_THRESHOLD = CONFIG_VERSION, PRE_V2_VERSION = 20;
|
||||
|
||||
public Config(JavaPlugin plugin)
|
||||
{
|
||||
@ -61,7 +61,9 @@ protected void doUpgrade(@NotNull YamlFileManager oldConfig)
|
||||
}
|
||||
else
|
||||
{
|
||||
super.doUpgrade(oldConfig);
|
||||
Map<String, String> remappedKeys = new HashMap<>();
|
||||
if(oldConfig.getVersion() <= 23) remappedKeys.put("ItemFilter.Materials", "ItemFilter.Blacklist");
|
||||
doUpgrade(oldConfig, remappedKeys);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,13 +112,6 @@ public String getDBFields(String sub, String def)
|
||||
return getConfigE().getString("Database.Tables.Fields." + sub, def);
|
||||
}
|
||||
|
||||
public boolean getUseUUIDs()
|
||||
{
|
||||
boolean uuid = getConfigE().getBoolean("Database.UseUUIDs", true);
|
||||
if(!uuid) logger.warning(ConsoleColor.RED + "Disabling UUIDs is not recommended and can lead to unexpected behaviour. Please consider enabling UUIDs. The option will be removed at some point." + ConsoleColor.RESET);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public boolean useOnlineUUIDs()
|
||||
{
|
||||
String type = getConfigE().getString("Database.UUID_Type", "auto").toLowerCase(Locale.ENGLISH);
|
||||
@ -134,7 +129,7 @@ public boolean getUseUUIDSeparators()
|
||||
|
||||
public String getUnCacheStrategie()
|
||||
{
|
||||
return getConfigE().getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase(Locale.ROOT);
|
||||
return getConfigE().getString("Database.Cache.UnCache.Strategie", "interval").toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public long getUnCacheInterval()
|
||||
@ -285,22 +280,50 @@ public boolean isShulkerboxesExistingDestroyEnabled()
|
||||
//endregion
|
||||
|
||||
//region Item filter
|
||||
public boolean isItemFilterEnabled()
|
||||
public boolean isItemFilterEnabledNoShulker()
|
||||
{
|
||||
return getConfigE().getBoolean("ItemFilter.Enable", false) || getConfigE().getBoolean("Shulkerboxes.PreventInBackpack", true);
|
||||
return getConfigE().getBoolean("ItemFilter.Enabled", false);
|
||||
}
|
||||
|
||||
public Collection<MinecraftMaterial> getItemFilterBlacklist()
|
||||
public boolean isItemFilterEnabled()
|
||||
{
|
||||
List<String> stringBlacklist = getConfigE().getStringList("ItemFilter.Blacklist", new LinkedList<>());
|
||||
return isItemFilterEnabledNoShulker() || getConfigE().getBoolean("Shulkerboxes.PreventInBackpack", true);
|
||||
}
|
||||
|
||||
public Collection<MinecraftMaterial> getItemFilterMaterials()
|
||||
{
|
||||
if(!isItemFilterEnabledNoShulker()) return new LinkedList<>();
|
||||
List<String> stringMaterialList = getConfigE().getStringList("ItemFilter.Materials", new LinkedList<>());
|
||||
if(isItemFilterModeWhitelist()) stringMaterialList.add("air");
|
||||
Collection<MinecraftMaterial> blacklist = new LinkedList<>();
|
||||
for(String item : stringBlacklist)
|
||||
for(String item : stringMaterialList)
|
||||
{
|
||||
MinecraftMaterial mat = MinecraftMaterial.fromInput(item);
|
||||
if(mat != null) blacklist.add(mat);
|
||||
}
|
||||
return blacklist;
|
||||
}
|
||||
|
||||
public Set<String> getItemFilterNames()
|
||||
{
|
||||
if(!isItemFilterEnabledNoShulker()) return new HashSet<>();
|
||||
Set<String> names = new HashSet<>();
|
||||
getConfigE().getStringList("ItemFilter.Names", new LinkedList<>()).forEach(name -> names.add(ChatColor.translateAlternateColorCodes('&', name)));
|
||||
return names;
|
||||
}
|
||||
|
||||
public Set<String> getItemFilterLore()
|
||||
{
|
||||
if(!isItemFilterEnabledNoShulker()) return new HashSet<>();
|
||||
Set<String> loreSet = new HashSet<>();
|
||||
getConfigE().getStringList("ItemFilter.Lore", new LinkedList<>()).forEach(lore -> loreSet.add(ChatColor.translateAlternateColorCodes('&', lore)));
|
||||
return loreSet;
|
||||
}
|
||||
|
||||
public boolean isItemFilterModeWhitelist()
|
||||
{
|
||||
return getConfigE().getString("ItemFilter.Mode", "blacklist").toLowerCase(Locale.ENGLISH).equals("whitelist") && isItemFilterEnabledNoShulker();
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region World settings
|
@ -50,7 +50,7 @@ public abstract class Database implements Listener
|
||||
|
||||
protected final Minepacks plugin;
|
||||
protected final InventorySerializer itsSerializer;
|
||||
protected final boolean useUUIDs, onlineUUIDs, bungeeCordMode;
|
||||
protected final boolean onlineUUIDs, bungeeCordMode;
|
||||
protected boolean useUUIDSeparators, asyncSave = true;
|
||||
protected long maxAge;
|
||||
private final Map<OfflinePlayer, Backpack> backpacks = new ConcurrentHashMap<>();
|
||||
@ -62,7 +62,6 @@ public Database(Minepacks mp)
|
||||
plugin = mp;
|
||||
itsSerializer = new InventorySerializer(plugin.getLogger());
|
||||
useUUIDSeparators = plugin.getConfiguration().getUseUUIDSeparators();
|
||||
useUUIDs = plugin.getConfiguration().getUseUUIDs();
|
||||
onlineUUIDs = plugin.getConfiguration().useOnlineUUIDs();
|
||||
bungeeCordMode = plugin.getConfiguration().isBungeeCordModeEnabled();
|
||||
maxAge = plugin.getConfiguration().getAutoCleanupMaxInactiveDays();
|
||||
@ -122,7 +121,7 @@ public static Database getDatabase(Minepacks plugin)
|
||||
|
||||
public void backup(@NotNull Backpack backpack)
|
||||
{
|
||||
writeBackup(backpack.getOwner().getName(), getPlayerNameOrUUID(backpack.getOwner()), itsSerializer.getUsedSerializer(), itsSerializer.serialize(backpack.getInventory()));
|
||||
writeBackup(backpack.getOwner().getName(), getPlayerFormattedUUID(backpack.getOwner()), itsSerializer.getUsedSerializer(), itsSerializer.serialize(backpack.getInventory()));
|
||||
}
|
||||
|
||||
protected void writeBackup(@Nullable String userName, @NotNull String userIdentifier, final int usedSerializer, final @NotNull byte[] data)
|
||||
@ -164,25 +163,9 @@ public ArrayList<String> getBackups()
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
protected String getPlayerNameOrUUID(OfflinePlayer player)
|
||||
{
|
||||
if(useUUIDs)
|
||||
{
|
||||
return (useUUIDSeparators) ? player.getUniqueId().toString() : player.getUniqueId().toString().replace("-", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
return player.getName();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getPlayerFormattedUUID(OfflinePlayer player)
|
||||
{
|
||||
if(useUUIDs)
|
||||
{
|
||||
return (useUUIDSeparators) ? player.getUniqueId().toString() : player.getUniqueId().toString().replace("-", "");
|
||||
}
|
||||
return null;
|
||||
return (useUUIDSeparators) ? player.getUniqueId().toString() : player.getUniqueId().toString().replace("-", "");
|
||||
}
|
||||
|
||||
public @NotNull Collection<Backpack> getLoadedBackpacks()
|
@ -63,7 +63,6 @@ public void updatePlayer(Player player)
|
||||
// Files are stored with the users name or the uuid, there is no reason to update anything
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private void checkFiles()
|
||||
{
|
||||
File[] allFiles = saveFolder.listFiles((dir, name) -> name.endsWith(EXT));
|
||||
@ -79,49 +78,42 @@ private void checkFiles()
|
||||
continue; // We don't have to check if the file name is correct cause we have the deleted the file
|
||||
}
|
||||
int len = file.getName().length() - EXT.length();
|
||||
if(useUUIDs) // Use UUID-based saving
|
||||
if(len <= 16) // It's a player name
|
||||
{
|
||||
if(len <= 16) // It's a player name
|
||||
if(!file.renameTo(new File(saveFolder, UUIDConverter.getUUIDFromName(file.getName().substring(0, len), onlineUUIDs, useUUIDSeparators) + EXT)))
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, UUIDConverter.getUUIDFromName(file.getName().substring(0, len), onlineUUIDs, useUUIDSeparators) + EXT)))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
else // It's an UUID
|
||||
{
|
||||
if(file.getName().contains("-"))
|
||||
{
|
||||
if(!useUUIDSeparators)
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, file.getName().replaceAll("-", ""))))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(useUUIDSeparators)
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, file.getName().replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})" + EXT_REGEX, "$1-$2-$3-$4-$5" + EXT))))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
else if(len > 16) // Use name-based saving, we only have to rename it if it's name is more than 16 chars (minecraft max player name length)
|
||||
else // It's an UUID
|
||||
{
|
||||
file.renameTo(new File(saveFolder, UUIDConverter.getNameFromUUID(file.getName().substring(0, len)) + EXT));
|
||||
if(file.getName().contains("-"))
|
||||
{
|
||||
if(!useUUIDSeparators)
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, file.getName().replaceAll("-", ""))))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(useUUIDSeparators)
|
||||
{
|
||||
if(!file.renameTo(new File(saveFolder, file.getName().replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})" + EXT_REGEX, "$1-$2-$3-$4-$5" + EXT))))
|
||||
{
|
||||
plugin.getLogger().warning("Failed to rename file (" + file.getAbsolutePath() + ").");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getFileName(OfflinePlayer player)
|
||||
{
|
||||
return getPlayerNameOrUUID(player) + EXT;
|
||||
return getPlayerFormattedUUID(player) + EXT;
|
||||
}
|
||||
|
||||
// DB Functions
|
@ -40,14 +40,7 @@ protected FilesToSQLMigration(@NotNull Minepacks plugin, @NotNull Files oldDb, @
|
||||
super(plugin, oldDb, dbType, global);
|
||||
saveFolder = new File(this.plugin.getDataFolder(), Files.FOLDER_NAME);
|
||||
|
||||
if(uuid)
|
||||
{
|
||||
queryInsertUsers = replacePlaceholders(newDb, "INSERT INTO {TablePlayers} ({FieldUUID},{FieldName}) VALUES (?,?);");
|
||||
}
|
||||
else
|
||||
{
|
||||
queryInsertUsers = replacePlaceholders(newDb, "INSERT INTO {TablePlayers} ({FieldName}) VALUES (?);");
|
||||
}
|
||||
queryInsertUsers = replacePlaceholders(newDb, "INSERT INTO {TablePlayers} ({FieldUUID},{FieldName}) VALUES (?,?);");
|
||||
queryInsertBackpacks = replacePlaceholders(newDb, "INSERT INTO {TableBackpacks} ({FieldBPOwner},{FieldBPITS},{FieldBPVersion}) VALUES (?,?,?);");
|
||||
}
|
||||
|
||||
@ -64,7 +57,7 @@ protected FilesToSQLMigration(@NotNull Minepacks plugin, @NotNull Files oldDb, @
|
||||
{
|
||||
String name = file.getName().substring(0, file.getName().length() - Files.EXT.length());
|
||||
statementInsertUser.setString(1, name);
|
||||
if(uuid) statementInsertUser.setString(2, "UNKNOWN");
|
||||
statementInsertUser.setString(2, "UNKNOWN");
|
||||
statementInsertUser.executeUpdate();
|
||||
try(ResultSet rs = statementInsertUser.getGeneratedKeys())
|
||||
{
|
@ -41,7 +41,7 @@ public class SQLtoFilesMigration extends Migration
|
||||
protected SQLtoFilesMigration(@NotNull Minepacks plugin, @NotNull SQL oldDb) throws InvocationTargetException, IllegalAccessException
|
||||
{
|
||||
super(plugin, oldDb);
|
||||
@Language("SQL") String query = "SELECT " + (plugin.getConfiguration().getUseUUIDs() ? "{FieldUUID}" : "{FieldName}") + ",{FieldBPITS},{FieldBPVersion} FROM {TablePlayers} INNER JOIN {TableBackpacks} ON {FieldPlayerID}={FieldBPOwner};";
|
||||
@Language("SQL") String query = "SELECT {FieldUUID},{FieldBPITS},{FieldBPVersion} FROM {TablePlayers} INNER JOIN {TableBackpacks} ON {FieldPlayerID}={FieldBPOwner};";
|
||||
//noinspection ConstantConditions
|
||||
sqlQuery = (String) Reflection.getMethod(SQL.class, "replacePlaceholders", String.class).invoke(oldDb, query);
|
||||
saveFolder = new File(this.plugin.getDataFolder(), Files.FOLDER_NAME);
|
@ -37,14 +37,7 @@ protected SQLtoSQLMigration(@NotNull Minepacks plugin, @NotNull SQL oldDb, @NotN
|
||||
{
|
||||
super(plugin, oldDb, dbType, global);
|
||||
|
||||
if(uuid)
|
||||
{
|
||||
queryInsertUsers = replacePlaceholders(newDb, "INSERT INTO {TablePlayers} ({FieldPlayerID},{FieldName},{FieldUUID}) VALUES (?,?,?);");
|
||||
}
|
||||
else
|
||||
{
|
||||
queryInsertUsers = replacePlaceholders(newDb, "INSERT INTO {TablePlayers} ({FieldPlayerID},{FieldName}) VALUES (?,?);");
|
||||
}
|
||||
queryInsertUsers = replacePlaceholders(newDb, "INSERT INTO {TablePlayers} ({FieldPlayerID},{FieldName},{FieldUUID}) VALUES (?,?,?);");
|
||||
queryInsertBackpacks = replacePlaceholders(newDb, "INSERT INTO {TableBackpacks} ({FieldBPOwner},{FieldBPITS},{FieldBPVersion},{FieldBPLastUpdate}) VALUES (?,?,?,?);");
|
||||
}
|
||||
|
||||
@ -92,7 +85,7 @@ private void migrateUser(@NotNull ResultSet usersResultSet, @NotNull PreparedSta
|
||||
int userId = usersResultSet.getInt((String) FIELD_PLAYER_ID.get(oldDb));
|
||||
preparedStatement.setInt(1, userId);
|
||||
preparedStatement.setString(2, usersResultSet.getString((String) FIELD_PLAYER_NAME.get(oldDb)));
|
||||
if(uuid) preparedStatement.setString(3, usersResultSet.getString((String) FIELD_PLAYER_UUID.get(oldDb)));
|
||||
preparedStatement.setString(3, usersResultSet.getString((String) FIELD_PLAYER_UUID.get(oldDb)));
|
||||
}
|
||||
|
||||
private void migrateBackpack(@NotNull ResultSet backpacksResultSet, @NotNull PreparedStatement preparedStatement) throws Exception
|
@ -47,7 +47,6 @@ public abstract class ToSQLMigration extends Migration
|
||||
protected static final DateFormat SQLITE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
protected final SQL newDb;
|
||||
protected final boolean uuid;
|
||||
|
||||
protected ToSQLMigration(@NotNull Minepacks plugin, @NotNull Database oldDb, @NotNull String dbType, boolean global)
|
||||
{
|
||||
@ -63,7 +62,6 @@ protected ToSQLMigration(@NotNull Minepacks plugin, @NotNull Database oldDb, @No
|
||||
case "sqlite": newDb = new SQLite(plugin, connectionProvider); break;
|
||||
default: newDb = null;
|
||||
}
|
||||
uuid = plugin.getConfiguration().getUseUUIDs();
|
||||
}
|
||||
|
||||
protected @Language("SQL") String replacePlaceholders(SQL database, @Language("SQL") String query) throws Exception
|
@ -30,7 +30,6 @@
|
||||
|
||||
public class MySQL extends SQL
|
||||
{
|
||||
//TODO add cooldown sync table
|
||||
public MySQL(@NotNull Minepacks plugin, @Nullable ConnectionProvider connectionProvider)
|
||||
{
|
||||
super(plugin, (connectionProvider == null) ? new MySQLConnectionProvider(plugin.getLogger(), plugin.getDescription().getName(), plugin.getConfiguration()) : connectionProvider);
|
||||
@ -48,17 +47,9 @@ protected void checkDB()
|
||||
{
|
||||
try(Connection connection = getConnection())
|
||||
{
|
||||
if(useUUIDs)
|
||||
{
|
||||
DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TablePlayers} (\n{FieldPlayerID} INT UNSIGNED NOT NULL AUTO_INCREMENT,\n{FieldName} VARCHAR(16) NOT NULL,\n" +
|
||||
"{FieldUUID} CHAR(" + ((useUUIDSeparators) ? "36" : "32") + ") DEFAULT NULL," + "\nPRIMARY KEY ({FieldPlayerID}),\n" +
|
||||
"UNIQUE INDEX {FieldUUID}_UNIQUE ({FieldUUID})\n);"));
|
||||
}
|
||||
else
|
||||
{
|
||||
DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TablePlayers} (\n{FieldPlayerID} INT UNSIGNED NOT NULL AUTO_INCREMENT,\n{FieldName} CHAR(16) NOT NULL,\n" +
|
||||
"\nPRIMARY KEY ({FieldPlayerID})\n);"));
|
||||
}
|
||||
DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TablePlayers} (\n{FieldPlayerID} INT UNSIGNED NOT NULL AUTO_INCREMENT,\n{FieldName} VARCHAR(16) NOT NULL,\n" +
|
||||
"{FieldUUID} CHAR(" + ((useUUIDSeparators) ? "36" : "32") + ") DEFAULT NULL," + "\nPRIMARY KEY ({FieldPlayerID}),\n" +
|
||||
"UNIQUE INDEX {FieldUUID}_UNIQUE ({FieldUUID})\n);"));
|
||||
DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TableBackpacks} (\n{FieldBPOwner} INT UNSIGNED NOT NULL,\n{FieldBPITS} BLOB,\n{FieldBPVersion} INT DEFAULT 0,\n" +
|
||||
"{FieldBPLastUpdate} TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" +
|
||||
"PRIMARY KEY ({FieldBPOwner}),\nCONSTRAINT fk_{TableBackpacks}_{TablePlayers}_{FieldBPOwner} FOREIGN KEY ({FieldBPOwner}) " +
|
@ -54,10 +54,7 @@ public SQL(@NotNull Minepacks plugin, @NotNull ConnectionProvider connectionProv
|
||||
loadSettings();
|
||||
buildQuerys();
|
||||
checkDB();
|
||||
if(useUUIDs)
|
||||
{
|
||||
checkUUIDs(); // Check if there are user accounts without UUID
|
||||
}
|
||||
checkUUIDs(); // Check if there are user accounts without UUID
|
||||
|
||||
// Delete old backpacks
|
||||
if(maxAge > 0)
|
||||
@ -189,25 +186,11 @@ public Connection getConnection() throws SQLException
|
||||
protected final void buildQuerys()
|
||||
{
|
||||
// Build the SQL querys with placeholders for the table and field names
|
||||
queryGetBP = "SELECT {FieldBPOwner},{FieldBPITS},{FieldBPVersion} FROM {TableBackpacks} INNER JOIN {TablePlayers} ON {TableBackpacks}.{FieldBPOwner}={TablePlayers}.{FieldPlayerID} WHERE ";
|
||||
querySyncCooldown = "INSERT INTO {TableCooldowns} ({FieldCDPlayer},{FieldCDTime}) SELECT {FieldPlayerID},? FROM {TablePlayers} WHERE ";
|
||||
if(useUUIDs)
|
||||
{
|
||||
queryUpdatePlayerAdd = "INSERT INTO {TablePlayers} ({FieldName},{FieldUUID}) VALUES (?,?) ON DUPLICATE KEY UPDATE {FieldName}=?;";
|
||||
queryGetPlayerID = "SELECT {FieldPlayerID} FROM {TablePlayers} WHERE {FieldUUID}=?;";
|
||||
queryGetBP += "{FieldUUID}=?;";
|
||||
querySyncCooldown += "{FieldUUID}";
|
||||
queryGetCooldown = "SELECT * FROM {TableCooldowns} WHERE {FieldCDPlayer} IN (SELECT {FieldPlayerID} FROM {TablePlayers} WHERE {FieldUUID}=?);";
|
||||
}
|
||||
else
|
||||
{
|
||||
queryUpdatePlayerAdd = "INSERT IGNORE INTO {TablePlayers} ({FieldName}) VALUES (?);";
|
||||
queryGetPlayerID = "SELECT {FieldPlayerID} FROM {TablePlayers} WHERE {FieldName}=?;";
|
||||
queryGetBP += "{FieldName}=?;";
|
||||
querySyncCooldown = "{FieldName}";
|
||||
queryGetCooldown = "SELECT * FROM {TableCooldowns} WHERE {FieldCDPlayer} IN (SELECT {FieldPlayerID} FROM {TablePlayers} WHERE {FieldName}=?);";
|
||||
}
|
||||
querySyncCooldown += "=? ON DUPLICATE KEY UPDATE {FieldCDTime}=?;";
|
||||
queryGetBP = "SELECT {FieldBPOwner},{FieldBPITS},{FieldBPVersion} FROM {TableBackpacks} INNER JOIN {TablePlayers} ON {TableBackpacks}.{FieldBPOwner}={TablePlayers}.{FieldPlayerID} WHERE {FieldUUID}=?;";
|
||||
querySyncCooldown = "INSERT INTO {TableCooldowns} ({FieldCDPlayer},{FieldCDTime}) SELECT {FieldPlayerID},? FROM {TablePlayers} WHERE {FieldUUID}=? ON DUPLICATE KEY UPDATE {FieldCDTime}=?;";
|
||||
queryUpdatePlayerAdd = "INSERT INTO {TablePlayers} ({FieldName},{FieldUUID}) VALUES (?,?) ON DUPLICATE KEY UPDATE {FieldName}=?;";
|
||||
queryGetPlayerID = "SELECT {FieldPlayerID} FROM {TablePlayers} WHERE {FieldUUID}=?;";
|
||||
queryGetCooldown = "SELECT * FROM {TableCooldowns} WHERE {FieldCDPlayer} IN (SELECT {FieldPlayerID} FROM {TablePlayers} WHERE {FieldUUID}=?);";
|
||||
queryInsertBp = "REPLACE INTO {TableBackpacks} ({FieldBPOwner},{FieldBPITS},{FieldBPVersion}) VALUES (?,?,?);";
|
||||
queryUpdateBp = "UPDATE {TableBackpacks} SET {FieldBPITS}=?,{FieldBPVersion}=?,{FieldBPLastUpdate}={NOW} WHERE {FieldBPOwner}=?;";
|
||||
queryDeleteOldBackpacks = "DELETE FROM {TableBackpacks} WHERE {FieldBPLastUpdate} < DATE('now', '-{VarMaxAge} days')";
|
||||
@ -280,14 +263,7 @@ protected void runStatement(final String query, final Object... args)
|
||||
@Override
|
||||
public void updatePlayer(final Player player)
|
||||
{
|
||||
if(useUUIDs)
|
||||
{
|
||||
runStatementAsync(queryUpdatePlayerAdd, player.getName(), getPlayerFormattedUUID(player), player.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
runStatementAsync(queryUpdatePlayerAdd, player.getName());
|
||||
}
|
||||
runStatementAsync(queryUpdatePlayerAdd, player.getName(), getPlayerFormattedUUID(player), player.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -295,7 +271,7 @@ public void saveBackpack(final Backpack backpack)
|
||||
{
|
||||
final byte[] data = itsSerializer.serialize(backpack.getInventory());
|
||||
final int id = backpack.getOwnerID(), usedSerializer = itsSerializer.getUsedSerializer();
|
||||
final String nameOrUUID = getPlayerNameOrUUID(backpack.getOwner()), name = backpack.getOwner().getName();
|
||||
final String nameOrUUID = getPlayerFormattedUUID(backpack.getOwner()), name = backpack.getOwner().getName();
|
||||
|
||||
Runnable runnable = () -> {
|
||||
try(Connection connection = getConnection())
|
||||
@ -342,7 +318,7 @@ protected void loadBackpack(final OfflinePlayer player, final Callback<Backpack>
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try(Connection conn = getConnection(); PreparedStatement ps = conn.prepareStatement(queryGetBP))
|
||||
{
|
||||
ps.setString(1, getPlayerNameOrUUID(player));
|
||||
ps.setString(1, getPlayerFormattedUUID(player));
|
||||
final int bpID, version;
|
||||
final byte[] data;
|
||||
try(ResultSet rs = ps.executeQuery())
|
||||
@ -386,7 +362,7 @@ protected void loadBackpack(final OfflinePlayer player, final Callback<Backpack>
|
||||
public void syncCooldown(Player player, long cooldownTime)
|
||||
{
|
||||
Timestamp ts = new Timestamp(cooldownTime);
|
||||
runStatementAsync(querySyncCooldown, ts, getPlayerNameOrUUID(player), ts);
|
||||
runStatementAsync(querySyncCooldown, ts, getPlayerFormattedUUID(player), ts);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -395,7 +371,7 @@ public void getCooldown(final Player player, final Callback<Long> callback)
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try(Connection conn = getConnection(); PreparedStatement ps = conn.prepareStatement(queryGetCooldown))
|
||||
{
|
||||
ps.setString(1, getPlayerNameOrUUID(player));
|
||||
ps.setString(1, getPlayerFormattedUUID(player));
|
||||
try(ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
final long time = (rs.next()) ? rs.getLong(fieldCdTime) : 0;
|
@ -69,14 +69,7 @@ protected void updateQuerysForDialect()
|
||||
queryInsertBp = queryInsertBp.replaceAll("\\) VALUES \\(\\?,\\?,\\?", ",{FieldBPLastUpdate}) VALUES (?,?,?,DATE('now')");
|
||||
queryDeleteOldBackpacks = "DELETE FROM {TableBackpacks} WHERE {FieldBPLastUpdate} < DATE('now', '-{VarMaxAge} days')";
|
||||
queryUpdateBp = queryUpdateBp.replaceAll("\\{NOW}", "DATE('now')");
|
||||
if(useUUIDs)
|
||||
{
|
||||
queryUpdatePlayerAdd = "INSERT OR IGNORE INTO {TablePlayers} ({FieldName},{FieldUUID}) VALUES (?,?);";
|
||||
}
|
||||
else
|
||||
{
|
||||
queryUpdatePlayerAdd = queryUpdatePlayerAdd.replaceAll("INSERT IGNORE INTO", "INSERT OR IGNORE INTO");
|
||||
}
|
||||
queryUpdatePlayerAdd = "INSERT OR IGNORE INTO {TablePlayers} ({FieldName},{FieldUUID}) VALUES (?,?);";
|
||||
}
|
||||
|
||||
@SuppressWarnings("SqlResolve")
|
||||
@ -85,15 +78,12 @@ protected void checkDB()
|
||||
{
|
||||
try(Connection connection = getConnection(); Statement stmt = connection.createStatement())
|
||||
{
|
||||
stmt.execute("CREATE TABLE IF NOT EXISTS `backpack_players` (`player_id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` CHAR(16) NOT NULL" + ((useUUIDs) ? " , `uuid` CHAR(32)" : "") + " UNIQUE);");
|
||||
if(useUUIDs)
|
||||
stmt.execute("CREATE TABLE IF NOT EXISTS `backpack_players` (`player_id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` CHAR(16) NOT NULL , `uuid` CHAR(32) UNIQUE);");
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
stmt.execute("ALTER TABLE `backpack_players` ADD COLUMN `uuid` CHAR(32);");
|
||||
}
|
||||
catch(SQLException ignored) {}
|
||||
stmt.execute("ALTER TABLE `backpack_players` ADD COLUMN `uuid` CHAR(32);");
|
||||
}
|
||||
catch(SQLException ignored) {}
|
||||
stmt.execute("CREATE TABLE IF NOT EXISTS `backpacks` (`owner` INT UNSIGNED PRIMARY KEY, `itemstacks` BLOB, `version` INT DEFAULT 0);");
|
||||
try
|
||||
{
|
||||
@ -116,16 +106,9 @@ protected void checkDB()
|
||||
@Override
|
||||
public void updatePlayer(final Player player)
|
||||
{
|
||||
if(useUUIDs)
|
||||
{
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
runStatement(queryUpdatePlayerAdd, player.getName(), getPlayerFormattedUUID(player));
|
||||
runStatement("UPDATE `" + tablePlayers + "` SET `" + fieldPlayerName + "`=? WHERE `" + fieldPlayerUUID + "`=?;", player.getName(), getPlayerFormattedUUID(player));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
runStatementAsync(queryUpdatePlayerAdd, player.getName());
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
runStatement(queryUpdatePlayerAdd, player.getName(), getPlayerFormattedUUID(player));
|
||||
runStatement("UPDATE `" + tablePlayers + "` SET `" + fieldPlayerName + "`=? WHERE `" + fieldPlayerUUID + "`=?;", player.getName(), getPlayerFormattedUUID(player));
|
||||
});
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -52,7 +52,7 @@ public void run()
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(plugin.isDisabled(player) != WorldBlacklistMode.None) return;
|
||||
if(player.getInventory().firstEmpty() == -1 && player.hasPermission("backpack.use") && player.hasPermission("backpack.fullpickup"))
|
||||
if(player.getInventory().firstEmpty() == -1 && player.hasPermission(Permissions.USE) && player.hasPermission(Permissions.FULL_PICKUP))
|
||||
{
|
||||
// Only check loaded backpacks (loading them would take to much time for a repeating task, the backpack will be loaded async soon enough)
|
||||
Backpack backpack = (Backpack) plugin.getBackpackCachedOnly(player);
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2018 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,6 +21,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -39,7 +40,7 @@ public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
final Player player = event.getEntity();
|
||||
if(plugin.isDisabled(player) != WorldBlacklistMode.None) return;
|
||||
if (!player.hasPermission("backpack.keepOnDeath"))
|
||||
if (!player.hasPermission(Permissions.KEEP_ON_DEATH))
|
||||
{
|
||||
final Location location = player.getLocation();
|
||||
plugin.getBackpack(player, new Callback<Backpack>()
|
@ -32,28 +32,37 @@
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemFilter extends MinepacksListener implements at.pcgamingfreaks.Minepacks.Bukkit.API.ItemFilter
|
||||
{
|
||||
private final Message messageNotAllowedInBackpack;
|
||||
private final Collection<MinecraftMaterial> blockedMaterials = new HashSet<>();
|
||||
private final ItemNameResolver itemNameResolver;
|
||||
public final Message messageNotAllowedInBackpack;
|
||||
public final ItemNameResolver itemNameResolver;
|
||||
private final boolean whitelistMode;
|
||||
private final Collection<MinecraftMaterial> filteredMaterials = new HashSet<>();
|
||||
private final Set<String> filteredNames, filteredLore;
|
||||
|
||||
public ItemFilter(final Minepacks plugin)
|
||||
{
|
||||
super(plugin);
|
||||
|
||||
if(plugin.getConfiguration().isShulkerboxesPreventInBackpackEnabled())
|
||||
whitelistMode = plugin.getConfiguration().isItemFilterModeWhitelist();
|
||||
if(plugin.getConfiguration().isShulkerboxesPreventInBackpackEnabled() && !whitelistMode)
|
||||
{
|
||||
for(Material mat : DisableShulkerboxes.SHULKER_BOX_MATERIALS)
|
||||
{
|
||||
blockedMaterials.add(new MinecraftMaterial(mat, (short) -1));
|
||||
filteredMaterials.add(new MinecraftMaterial(mat, (short) -1));
|
||||
}
|
||||
}
|
||||
blockedMaterials.addAll(plugin.getConfiguration().getItemFilterBlacklist());
|
||||
filteredMaterials.addAll(plugin.getConfiguration().getItemFilterMaterials());
|
||||
filteredNames = plugin.getConfiguration().getItemFilterNames();
|
||||
filteredLore = plugin.getConfiguration().getItemFilterLore();
|
||||
|
||||
messageNotAllowedInBackpack = plugin.getLanguage().getMessage("Ingame.NotAllowedInBackpack").replaceAll("\\{ItemName}", "%s");
|
||||
|
||||
@ -78,6 +87,38 @@ public ItemFilter(final Minepacks plugin)
|
||||
/*end[STANDALONE]*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemBlocked(final @Nullable ItemStack item)
|
||||
{
|
||||
if(item == null) return false;
|
||||
if(filteredMaterials.contains(new MinecraftMaterial(item))) return !whitelistMode;
|
||||
if(item.hasItemMeta())
|
||||
{
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
assert meta != null; //TODO remove after testing
|
||||
if(meta.hasDisplayName() && filteredNames.contains(meta.getDisplayName())) return !whitelistMode;
|
||||
if(meta.hasLore() && !filteredLore.isEmpty())
|
||||
{
|
||||
StringBuilder loreBuilder = new StringBuilder();
|
||||
//noinspection ConstantConditions
|
||||
for(String loreLine : meta.getLore())
|
||||
{
|
||||
if(filteredLore.contains(loreLine)) return !whitelistMode;
|
||||
if(loreBuilder.length() > 0) loreBuilder.append("\n");
|
||||
loreBuilder.append(loreLine);
|
||||
}
|
||||
if(filteredLore.contains(loreBuilder.toString())) return !whitelistMode;
|
||||
}
|
||||
}
|
||||
return whitelistMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendNotAllowedMessage(@NotNull Player player, @NotNull ItemStack itemStack)
|
||||
{
|
||||
messageNotAllowedInBackpack.send(player, itemNameResolver.getName(itemStack));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryMoveItemEvent event)
|
||||
{
|
||||
@ -85,49 +126,45 @@ public void onItemMove(InventoryMoveItemEvent event)
|
||||
{
|
||||
if(event.getSource().getHolder() instanceof Player)
|
||||
{
|
||||
messageNotAllowedInBackpack.send((Player) event.getSource().getHolder(), itemNameResolver.getName(event.getItem()));
|
||||
sendNotAllowedMessage((Player) event.getSource().getHolder(), event.getItem());
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryClickEvent event)
|
||||
public void onItemClick(InventoryClickEvent event)
|
||||
{
|
||||
if(!(event.getWhoClicked() instanceof Player)) return;
|
||||
if(event.getInventory().getHolder() instanceof Backpack)
|
||||
{
|
||||
if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1)
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY && checkIsBlockedAndShowMessage(player, event.getCurrentItem()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1)
|
||||
{
|
||||
ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
|
||||
if(item != null && isItemBlocked(item))
|
||||
if(checkIsBlockedAndShowMessage(player, item))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(item));
|
||||
}
|
||||
}
|
||||
else if(event.getCurrentItem() != null && isItemBlocked(event.getCurrentItem()))
|
||||
else if(!player.getInventory().equals(event.getClickedInventory()) && checkIsBlockedAndShowMessage(player, event.getCursor()))
|
||||
{
|
||||
if(event.getClickedInventory() != null && event.getClickedInventory().getHolder() instanceof Backpack) return; // Allow user to move blacklisted items out of the backpack
|
||||
|
||||
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(event.getCurrentItem()));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryDragEvent event)
|
||||
public void onItemDrag(InventoryDragEvent event)
|
||||
{
|
||||
if(event.getInventory().getHolder() instanceof Backpack && event.getOldCursor() != null && isItemBlocked(event.getOldCursor()))
|
||||
if(event.getInventory().getHolder() instanceof Backpack && (isItemBlocked(event.getOldCursor()) || isItemBlocked(event.getCursor())) && event.getRawSlots().containsAll(event.getInventorySlots()))
|
||||
{
|
||||
messageNotAllowedInBackpack.send(event.getView().getPlayer(), itemNameResolver.getName(event.getOldCursor()));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemBlocked(ItemStack item)
|
||||
{
|
||||
return blockedMaterials.contains(new MinecraftMaterial(item));
|
||||
}
|
||||
}
|
@ -20,7 +20,10 @@
|
||||
import at.pcgamingfreaks.Bukkit.HeadUtils;
|
||||
import at.pcgamingfreaks.Bukkit.MCVersion;
|
||||
import at.pcgamingfreaks.Bukkit.Message.Message;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.WorldBlacklistMode;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -40,16 +43,19 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ItemShortcut implements Listener
|
||||
{
|
||||
private static final UUID MINEPACKS_UUID = UUID.nameUUIDFromBytes("Minepacks".getBytes());
|
||||
private final Minepacks plugin;
|
||||
private final String itemName, value;
|
||||
private final Message messageDoNotRemoveItem;
|
||||
|
||||
public ItemShortcut(Minepacks plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
itemName = ChatColor.translateAlternateColorCodes('&', plugin.getConfiguration().getItemShortcutItemName());
|
||||
value = plugin.getConfiguration().getItemShortcutHeadValue();
|
||||
messageDoNotRemoveItem = plugin.getLanguage().getMessage("Ingame.DontRemoveShortcut");
|
||||
@ -63,7 +69,7 @@ private boolean isItemShortcut(@Nullable ItemStack stack)
|
||||
|
||||
private void addItem(Player player)
|
||||
{
|
||||
if(player.hasPermission("backpack.use"))
|
||||
if(player.hasPermission(Permissions.USE))
|
||||
{
|
||||
boolean empty = false, item = false;
|
||||
for(ItemStack itemStack : player.getInventory())
|
||||
@ -79,12 +85,30 @@ else if(isItemShortcut(itemStack))
|
||||
}
|
||||
}
|
||||
|
||||
//region Add backpack item
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if(plugin.isDisabled(event.getPlayer()) != WorldBlacklistMode.None) return;
|
||||
addItem(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpawn(PlayerRespawnEvent event)
|
||||
{
|
||||
if(plugin.isDisabled(event.getPlayer()) != WorldBlacklistMode.None) return;
|
||||
addItem(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWorldChange(PlayerChangedWorldEvent event)
|
||||
{
|
||||
if(plugin.isDisabled(event.getPlayer()) != WorldBlacklistMode.None) return;
|
||||
addItem(event.getPlayer());
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region Prevent placing of backpack item
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onItemInteract(PlayerInteractEvent event)
|
||||
{
|
||||
@ -127,53 +151,71 @@ public void onItemFrameInteract(PlayerInteractEntityEvent event)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region Handle inventory actions
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onItemClick(InventoryClickEvent event)
|
||||
{
|
||||
if(event.getWhoClicked() instanceof Player)
|
||||
{
|
||||
final Player player = (Player) event.getWhoClicked();
|
||||
if(isItemShortcut(event.getCurrentItem()))
|
||||
{
|
||||
if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT)
|
||||
if(event.getAction() == InventoryAction.SWAP_WITH_CURSOR)
|
||||
{
|
||||
((Player) event.getWhoClicked()).performCommand("backpack open");
|
||||
if(plugin.isDisabled(player) != WorldBlacklistMode.None || !player.hasPermission(Permissions.USE) || !plugin.isPlayerGameModeAllowed(player)) return;
|
||||
Backpack backpack = plugin.getBackpackCachedOnly(player);
|
||||
if(backpack != null)
|
||||
{
|
||||
//TODO right click should place only one
|
||||
final ItemStack stack = event.getCursor();
|
||||
if(plugin.getItemFilter() == null || !plugin.getItemFilter().isItemBlocked(stack))
|
||||
{
|
||||
Map<Integer, ItemStack> full = backpack.getInventory().addItem(stack);
|
||||
stack.setAmount((full.isEmpty()) ? 0 : full.get(0).getAmount());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.getItemFilter().messageNotAllowedInBackpack.send(player, plugin.getItemFilter().itemNameResolver.getName(stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT)
|
||||
{
|
||||
player.performCommand("backpack open");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
messageDoNotRemoveItem.send(player);
|
||||
}
|
||||
}
|
||||
else if((event.getAction() == InventoryAction.HOTBAR_MOVE_AND_READD || event.getAction() == InventoryAction.HOTBAR_SWAP) && event.getHotbarButton() != -1)
|
||||
{
|
||||
ItemStack item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
|
||||
ItemStack item = player.getInventory().getItem(event.getHotbarButton());
|
||||
if(isItemShortcut(item))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
messageDoNotRemoveItem.send(player);
|
||||
}
|
||||
}
|
||||
else if(isItemShortcut(event.getCursor()) && !event.getWhoClicked().getInventory().equals(event.getClickedInventory()))
|
||||
else if(isItemShortcut(event.getCursor()) && !player.getInventory().equals(event.getClickedInventory()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
messageDoNotRemoveItem.send(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onItemDrag(InventoryDragEvent event)
|
||||
{ //TODO improve
|
||||
if(!event.getInventory().equals(event.getWhoClicked().getInventory()))
|
||||
{
|
||||
if(!event.getInventory().equals(event.getWhoClicked().getInventory()) && event.getRawSlots().containsAll(event.getInventorySlots()))
|
||||
{
|
||||
if(isItemShortcut(event.getCursor()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
}
|
||||
else if(isItemShortcut(event.getOldCursor()))
|
||||
if(isItemShortcut(event.getCursor()) || isItemShortcut(event.getOldCursor()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getWhoClicked());
|
||||
@ -181,6 +223,20 @@ else if(isItemShortcut(event.getOldCursor()))
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
if(isItemShortcut(event.getItemDrop().getItemStack()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getPlayer());
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
||||
/**
|
||||
* Removes the backpack item form the drops on death
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
@ -194,20 +250,4 @@ public void onDeath(PlayerDeathEvent event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onSpawn(PlayerDropItemEvent event)
|
||||
{
|
||||
if(isItemShortcut(event.getItemDrop().getItemStack()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
messageDoNotRemoveItem.send(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpawn(PlayerRespawnEvent event)
|
||||
{
|
||||
addItem(event.getPlayer());
|
||||
}
|
||||
}
|
@ -19,5 +19,5 @@
|
||||
|
||||
public class MagicValues
|
||||
{
|
||||
public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.19-SNAPSHOT";
|
||||
public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.21-SNAPSHOT";
|
||||
}
|
@ -36,6 +36,7 @@
|
||||
import at.pcgamingfreaks.Updater.UpdateProviders.BukkitUpdateProvider;
|
||||
import at.pcgamingfreaks.Updater.UpdateProviders.JenkinsUpdateProvider;
|
||||
import at.pcgamingfreaks.Updater.UpdateProviders.UpdateProvider;
|
||||
import at.pcgamingfreaks.Updater.UpdateResponseCallback;
|
||||
import at.pcgamingfreaks.Version;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -113,7 +114,7 @@ public void onEnable()
|
||||
|
||||
|
||||
//region Check compatibility with used minecraft version
|
||||
if(MCVersion.is(MCVersion.UNKNOWN) || MCVersion.isNewerThan(MCVersion.MC_NMS_1_15_R1))
|
||||
if(MCVersion.is(MCVersion.UNKNOWN) || !MCVersion.isUUIDsSupportAvailable() || MCVersion.isNewerThan(MCVersion.MC_NMS_1_15_R1))
|
||||
{
|
||||
this.warnOnVersionIncompatibility();
|
||||
this.setEnabled(false);
|
||||
@ -153,7 +154,7 @@ public void onDisable()
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public @Nullable Updater update(@Nullable at.pcgamingfreaks.Updater.Updater.UpdaterResponse output)
|
||||
public @Nullable Updater update(@Nullable UpdateResponseCallback updateResponseCallback)
|
||||
{
|
||||
UpdateProvider updateProvider;
|
||||
if(getDescription().getVersion().contains("Release")) updateProvider = new BukkitUpdateProvider(BUKKIT_PROJECT_ID, getLogger());
|
||||
@ -165,8 +166,8 @@ public void onDisable()
|
||||
updateProvider = new JenkinsUpdateProvider(JENKINS_URL, JENKINS_JOB_DEV, getLogger());
|
||||
/*end[STANDALONE]*/
|
||||
}
|
||||
Updater updater = new Updater(this, this.getFile(), true, updateProvider);
|
||||
updater.update(output);
|
||||
Updater updater = new Updater(this, true, updateProvider);
|
||||
updater.update(updateResponseCallback);
|
||||
return updater;
|
||||
}
|
||||
|
||||
@ -346,7 +347,7 @@ public int getBackpackPermSize(Player player)
|
||||
|
||||
public WorldBlacklistMode isDisabled(Player player)
|
||||
{
|
||||
if(worldBlacklistMode == WorldBlacklistMode.None || (worldBlacklistMode != WorldBlacklistMode.NoPlugin && player.hasPermission("backpack.ignoreWorldBlacklist"))) return WorldBlacklistMode.None;
|
||||
if(worldBlacklistMode == WorldBlacklistMode.None || (worldBlacklistMode != WorldBlacklistMode.NoPlugin && player.hasPermission(Permissions.IGNORE_WORLD_BLACKLIST))) return WorldBlacklistMode.None;
|
||||
if(worldBlacklist.contains(player.getWorld().getName().toLowerCase(Locale.ROOT))) return worldBlacklistMode;
|
||||
return WorldBlacklistMode.None;
|
||||
}
|
||||
@ -354,7 +355,7 @@ public WorldBlacklistMode isDisabled(Player player)
|
||||
@Override
|
||||
public boolean isPlayerGameModeAllowed(Player player)
|
||||
{
|
||||
return gameModes.contains(player.getGameMode()) || player.hasPermission("backpack.ignoreGameMode");
|
||||
return gameModes.contains(player.getGameMode()) || player.hasPermission(Permissions.IGNORE_GAME_MODE);
|
||||
}
|
||||
|
||||
public @Nullable CooldownManager getCooldownManager()
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package at.pcgamingfreaks.Minepacks.Bukkit;
|
||||
|
||||
public class Permissions
|
||||
{
|
||||
public static final String BASE = "backpack.";
|
||||
public static final String USE = BASE + "use";
|
||||
public static final String CLEAN = BASE + "clean";
|
||||
public static final String CLEAN_OTHER = BASE + "clean.other";
|
||||
public static final String FULL_PICKUP = BASE + "fullpickup";
|
||||
public static final String OTHERS = BASE + "others";
|
||||
public static final String OTHERS_EDIT = BASE + "others.edit";
|
||||
public static final String KEEP_ON_DEATH = BASE + "keepOnDeath";
|
||||
public static final String NO_COOLDOWN = BASE + "noCooldown";
|
||||
public static final String IGNORE_GAME_MODE = BASE + "ignoreGameMode";
|
||||
public static final String IGNORE_WORLD_BLACKLIST = BASE + "ignoreWorldBlacklist";
|
||||
public static final String UPDATE = BASE + "update";
|
||||
public static final String RELOAD = BASE + "reload";
|
||||
public static final String MIGRATE = BASE + "migrate";
|
||||
public static final String BACKUP = BASE + "backup";
|
||||
public static final String RESTORE = BASE + "restore";
|
||||
public static final String VERSION = BASE + "version";
|
||||
}
|
12
README.md
12
README.md
@ -17,7 +17,7 @@
|
||||
[ciDev]: https://ci.pcgamingfreaks.at/job/Minepacks%20Dev/
|
||||
[ciDevImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20Dev/badge/icon
|
||||
[apiVersionImg]: https://img.shields.io/badge/dynamic/xml.svg?label=api-version&query=%2F%2Frelease[1]&url=https%3A%2F%2Frepo.pcgamingfreaks.at%2Frepository%2Fmaven-releases%2Fat%2Fpcgamingfreaks%2FMinepacks-API%2Fmaven-metadata.xml
|
||||
[api]: https://github.com/GeorgH93/Minepacks/tree/API
|
||||
[api]: https://github.com/GeorgH93/Minepacks/tree/master/Minepacks-API
|
||||
[apiJavaDoc]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/javadoc/
|
||||
[apiBuilds]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/
|
||||
[bugReports]: https://github.com/GeorgH93/Minepacks/issues?q=is%3Aissue+is%3Aopen+label%3Abug
|
||||
@ -29,7 +29,7 @@
|
||||
[config]: https://github.com/GeorgH93/Minepacks/blob/master/resources/config.yml
|
||||
[pcgfPluginLib]: https://github.com/GeorgH93/PCGF_PluginLib
|
||||
[pcgfPluginLibAdvantages]: https://github.com/GeorgH93/Minepacks/wiki/Build-and-Mode-comparison#Advantages-of-using-the-PCGF-PluginLib
|
||||
[languages]: https://github.com/GeorgH93/Minepacks/tree/master/resources/lang
|
||||
[languages]: https://github.com/GeorgH93/Minepacks/tree/master/Minepacks/resources/lang
|
||||
<!-- End of variables block -->
|
||||
|
||||
[![Logo][banner]][spigot]
|
||||
@ -57,7 +57,7 @@ Minepacks is a backpack plugin for minecraft server running bukkit or spigot.
|
||||
## Requirements:
|
||||
### Runtime requirements:
|
||||
* Java 8
|
||||
* Bukkit, Spigot or Paper for Minecraft 1.7 or newer
|
||||
* Bukkit, Spigot or Paper for Minecraft 1.7.5 or newer
|
||||
* (Optional) [PCGF PluginLib][pcgfPluginLib] ([Advantages of using the PCGF PluginLib][pcgfPluginLibAdvantages])
|
||||
|
||||
### Build requirements:
|
||||
@ -76,7 +76,7 @@ git clone https://github.com/GeorgH93/Minepacks.git
|
||||
cd Minepacks
|
||||
mvn package
|
||||
```
|
||||
The final file will be in the `target` folder, named `Minepacks-<CurrentVersion>.jar`.
|
||||
The final file will be in the `Minepacks/target` folder, named `Minepacks-<CurrentVersion>.jar`.
|
||||
|
||||
### Standalone version:
|
||||
This version works without the PCGF-PluginLib, however some API features are not available.
|
||||
@ -85,7 +85,7 @@ git clone https://github.com/GeorgH93/Minepacks.git
|
||||
cd Minepacks
|
||||
mvn package -P Standalone,ExcludeBadRabbit
|
||||
```
|
||||
The final file will be in the `target` folder, named `Minepacks-<CurrentVersion>-Standalone.jar`.
|
||||
The final file will be in the `Minepacks/target` folder, named `Minepacks-<CurrentVersion>-Standalone.jar`.
|
||||
|
||||
### Release version:
|
||||
This is the version of the plugin published on dev.bukkit.org and spigotmc.org.
|
||||
@ -95,7 +95,7 @@ cd Minepacks
|
||||
mvn clean install -P Standalone,ExcludeBadRabbit
|
||||
mvn clean package -P Release
|
||||
```
|
||||
The final file will be in the `target` folder, named `Minepacks-<CurrentVersion>-Release.jar`.
|
||||
The final file will be in the `Minepacks/target` folder, named `Minepacks-<CurrentVersion>-Release.jar`.
|
||||
|
||||
## API:
|
||||
Minepacks V2 comes with an API that allows you to interact with this plugin.
|
||||
|
304
pom.xml
304
pom.xml
@ -2,8 +2,9 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks</artifactId>
|
||||
<version>2.1.7</version>
|
||||
<artifactId>Minepacks-Parent</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
|
||||
@ -19,7 +20,7 @@
|
||||
<url>https://ci.pcgamingfreaks.at/job/Minepacks/</url>
|
||||
</ciManagement>
|
||||
|
||||
<name>Minepacks</name>
|
||||
<name>Minepacks-Parent</name>
|
||||
<description>Minepacks is a backpack plugin with different backpack sizes, multi language support and SQLite and MySQL storage support.</description>
|
||||
<url>https://www.spigotmc.org/resources/19286/</url>
|
||||
<inceptionYear>2014</inceptionYear>
|
||||
@ -31,10 +32,7 @@
|
||||
</license>
|
||||
</licenses>
|
||||
<properties>
|
||||
<author>GeorgH93</author>
|
||||
<version>${project.version}</version>
|
||||
<dependencies>depend: [ PCGF_PluginLib ]</dependencies>
|
||||
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}</mainClass>
|
||||
<revision>2.2-BETA</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
@ -51,63 +49,17 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Minepacks API -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks-API</artifactId>
|
||||
<version>2.0.11</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Bukkit -->
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- PCGF Plugin Lib -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>PluginLib</artifactId>
|
||||
<version>1.0.19-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- BadRabbit -->
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>BadRabbit</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<classifier>Bukkit</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test/src</testSourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>./</directory>
|
||||
<includes>
|
||||
<include>LICENSE</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
@ -117,228 +69,50 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Bundle the API into the JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<pomElements>
|
||||
<description/>
|
||||
<inceptionYear/>
|
||||
<organization/>
|
||||
<scm/>
|
||||
<developers/>
|
||||
<contributors/>
|
||||
<mailingLists/>
|
||||
<issueManagement/>
|
||||
<repositories/>
|
||||
<ciManagement/>
|
||||
<!--<url/><pluginRepositories/><distributionManagement/>-->
|
||||
</pomElements>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>ExcludeBadRabbit</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>at/pcgamingfreaks/Minepacks/Bukkit/MinepacksBadRabbit.class</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>Standalone</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<version>${project.version}-Standalone</version>
|
||||
<dependencies/>
|
||||
<mainClass>${project.groupId}.${project.artifactId}Standalone.Bukkit.${project.artifactId}</mainClass>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Shades some required libs into the final jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>Standalone</shadedClassifierName>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:PluginLib</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>at.pcgf.libs</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>at.pcgamingfreaks.Minepacks</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.*</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>at.pcgamingfreaks</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks</shadedPattern>
|
||||
<excludes>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack</exclude>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.Callback</exclude>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin</exclude>
|
||||
<exclude>at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksCommandManager</exclude>
|
||||
</excludes>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>at.pcgamingfreaks:PluginLib</artifact>
|
||||
<excludes>
|
||||
<exclude>*.yml</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Replace all the PCGF-PluginLib code with alternatives -->
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>munge-maven-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>munge</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>munge</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<symbols>STANDALONE</symbols>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>Release</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<version>${project.version}-Release</version>
|
||||
<dependencies>softdepend: [ PCGF_PluginLib ]</dependencies>
|
||||
<mainClass>${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}BadRabbit</mainClass>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>Minepacks</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>Standalone</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>Release</shadedClassifierName>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>at.pcgamingfreaks:Minepacks-API</include>
|
||||
<include>at.pcgamingfreaks:BadRabbit</include>
|
||||
<include>at.pcgamingfreaks:Minepacks</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>at.pcgamingfreaks.BadRabbit</pattern>
|
||||
<shadedPattern>at.pcgamingfreaks.Minepacks</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<version>1.20</version>
|
||||
<configuration>
|
||||
<excludedScopes>test,provided,system</excludedScopes>
|
||||
<generateBundle>true</generateBundle>
|
||||
<licensesOutputFile>${project.build.directory}/generated-resources/licenses-THIRD-PARTY.xml</licensesOutputFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-third-party</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>add-third-party</goal>
|
||||
<goal>download-licenses</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<modules>
|
||||
<module>Minepacks-API</module>
|
||||
<module>Minepacks</module>
|
||||
</modules>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
Loading…
Reference in New Issue
Block a user