Add lombok
This commit is contained in:
parent
5c9141003f
commit
10ea384164
22
LICENSE
Normal file
22
LICENSE
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
Copyright (c)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the "Software"), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
36
README.md
Executable file
36
README.md
Executable file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# PlayerShops
|
||||||
|
___
|
||||||
|
|
||||||
|
## **Downloads**
|
||||||
|
Downloads can be obtained on GitHub actions page.
|
||||||
|
|
||||||
|
## **Building**
|
||||||
|
|
||||||
|
#### Initial setup
|
||||||
|
Clone the repo using `git clone https://github.com/Altitude-Devs/PlayerShops.git`.
|
||||||
|
|
||||||
|
#### Building
|
||||||
|
Use the command `./gradlew build --stacktrace` in the project root directory.
|
||||||
|
The compiled jar will be placed in directory `/build/libs/`.
|
||||||
|
|
||||||
|
## **Commands**
|
||||||
|
|
||||||
|
| Command | Description | Permission |
|
||||||
|
|---------------------|-----------------------------|-----------------------------|
|
||||||
|
|
||||||
|
## **Permissions**
|
||||||
|
|
||||||
|
| Permission | Description |
|
||||||
|
|-----------------------------|------------------------------------------------|
|
||||||
|
|
||||||
|
## **Configuration**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Magic value used to determine auto configuration updates, do not change this value
|
||||||
|
config-version: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
## **Support**
|
||||||
|
|
||||||
|
## **License**
|
||||||
|
[LICENSE](LICENSE)
|
||||||
|
|
@ -34,6 +34,9 @@ dependencies {
|
||||||
exclude("org.bukkit","bukkit")
|
exclude("org.bukkit","bukkit")
|
||||||
}
|
}
|
||||||
compileOnly("com.github.TechFortress:GriefPrevention:16.17.1")
|
compileOnly("com.github.TechFortress:GriefPrevention:16.17.1")
|
||||||
|
|
||||||
|
compileOnly("org.projectlombok:lombok:1.18.24")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
||||||
}
|
}
|
||||||
|
|
||||||
bukkit {
|
bukkit {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.alttd.playershops;
|
package com.alttd.playershops;
|
||||||
|
|
||||||
import com.alttd.playershops.config.Config;
|
import com.alttd.playershops.config.Config;
|
||||||
|
import com.alttd.playershops.handler.ShopHandler;
|
||||||
|
import lombok.Getter;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
|
@ -8,8 +10,12 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class PlayerShops extends JavaPlugin {
|
public class PlayerShops extends JavaPlugin {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static PlayerShops instance;
|
private static PlayerShops instance;
|
||||||
|
@Getter
|
||||||
private Economy econ;
|
private Economy econ;
|
||||||
|
@Getter
|
||||||
|
private ShopHandler shopHandler;
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
@ -23,6 +29,8 @@ public class PlayerShops extends JavaPlugin {
|
||||||
|
|
||||||
registerListeners();
|
registerListeners();
|
||||||
registerCommands();
|
registerCommands();
|
||||||
|
|
||||||
|
shopHandler = new ShopHandler(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupEconomy() {
|
private boolean setupEconomy() {
|
||||||
|
|
@ -56,8 +64,4 @@ public class PlayerShops extends JavaPlugin {
|
||||||
Config.reload();
|
Config.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerShops getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,10 @@ public class Config extends AbstractConfiguration {
|
||||||
config.readConfig(Config.class, null);
|
config.readConfig(Config.class, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int shopLimit = 100;
|
||||||
|
private static void shopSettings() {
|
||||||
|
String path = "shop-settings.";
|
||||||
|
shopLimit = config.getInt(path + "player-shop-limit", shopLimit);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
package com.alttd.playershops.config;
|
package com.alttd.playershops.config;
|
||||||
|
|
||||||
public class ShopMessageConfig {
|
public class ShopTypeConfig {
|
||||||
|
|
||||||
private final String shopType;
|
private final String shopType;
|
||||||
private final String configPath;
|
private final String configPath;
|
||||||
private final String defaultPath;
|
private final String defaultPath;
|
||||||
|
|
||||||
public ShopMessageConfig(String shopType) {
|
public ShopTypeConfig(String shopType) {
|
||||||
this.shopType = shopType;
|
this.shopType = shopType;
|
||||||
this.configPath = "shop.text." + this.shopType + ".";
|
this.configPath = "shop.type." + this.shopType + ".";
|
||||||
this.defaultPath = "shop.text.default.";
|
this.defaultPath = "shop.type.default.";
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
Config.config.readConfig(ShopMessageConfig.class, this);
|
Config.config.readConfig(ShopTypeConfig.class, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void set(String path, Object def) {
|
private static void set(String path, Object def) {
|
||||||
23
src/main/java/com/alttd/playershops/handler/ShopHandler.java
Normal file
23
src/main/java/com/alttd/playershops/handler/ShopHandler.java
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.alttd.playershops.handler;
|
||||||
|
|
||||||
|
import com.alttd.playershops.PlayerShops;
|
||||||
|
import com.alttd.playershops.config.Config;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ShopHandler {
|
||||||
|
|
||||||
|
private final PlayerShops plugin;
|
||||||
|
@Getter
|
||||||
|
private final Object2IntMap<UUID> shopBuildLimits;
|
||||||
|
|
||||||
|
public ShopHandler(PlayerShops instance) {
|
||||||
|
plugin = instance;
|
||||||
|
shopBuildLimits = new Object2IntOpenHashMap<>();
|
||||||
|
shopBuildLimits.defaultReturnValue(Config.shopLimit);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
|
public abstract class AbstractShop {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.playershops.shop;
|
package com.alttd.playershops.shop;
|
||||||
|
|
||||||
import com.alttd.playershops.config.ShopMessageConfig;
|
import com.alttd.playershops.config.ShopTypeConfig;
|
||||||
|
|
||||||
public enum ShopType {
|
public enum ShopType {
|
||||||
|
|
||||||
|
|
@ -9,10 +9,10 @@ public enum ShopType {
|
||||||
GAMBLE,
|
GAMBLE,
|
||||||
BARTER;
|
BARTER;
|
||||||
|
|
||||||
private final ShopMessageConfig shopMessageConfig;
|
private final ShopTypeConfig shopTypeConfig;
|
||||||
|
|
||||||
ShopType() {
|
ShopType() {
|
||||||
this.shopMessageConfig = new ShopMessageConfig(toString());
|
this.shopTypeConfig = new ShopTypeConfig(toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user